using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEngine.UI; /// /// 武将吞噬成功界面 /// public class HeroGiftEatSuccessWin : UIBase { [SerializeField] Image[] beforeStars; [SerializeField] Image[] afterStars; [SerializeField] Text[] attrInheritPerNameArr; //新增继承属性成长 [SerializeField] Text[] attrInheritPerTextArr; [SerializeField] Text[] nextAttrInheritPerTextArr; [SerializeField] Text[] attrPerNameArr; [SerializeField] Text[] attrPerTextArr; [SerializeField] Text[] nextAttrPerTextArr; [SerializeField] GiftBaseCell[] giftBaseCellArr; [SerializeField] Button okBtn; //角色 [SerializeField] Image taiziBG; [SerializeField] UIHeroController heroModel; [SerializeField] Text nameText; protected override void InitComponent() { okBtn.AddListener(CloseWindow); } protected override void OnPreOpen() { HeroUIManager.Instance.selectEatHeroIndexList.Clear(); if (string.IsNullOrEmpty(HeroUIManager.Instance.selectHeroGuidForGiftFuncForSuccessWin)) return; Display(); } protected override void OnPreClose() { HeroUIManager.Instance.waitResponse = default; } public void Display() { HeroInfo hero = HeroManager.Instance.GetHero(HeroUIManager.Instance.selectHeroGuidForGiftFuncForSuccessWin); if (hero == null) return; hero.RefreshInheritPer(); //强制重刷 int beforeStarCount = HeroUIManager.Instance.eatBeforeStar; int afterStarCount = hero.heroStar; HeroUIManager.Instance.ShowStarImg(beforeStarCount, beforeStars); HeroUIManager.Instance.ShowStarImg(afterStarCount, afterStars); //上阵属性 int valuePer = hero.GetAddPer(); for (int i = 0; i < attrPerTextArr.Length; i++) { int id = PlayerPropertyConfig.basePerAttrs[i]; attrPerNameArr[i].text = PlayerPropertyConfig.Get(id).Name; nextAttrPerTextArr[i].text = PlayerPropertyConfig.GetValueDescription(id, valuePer); attrPerTextArr[i].text = PlayerPropertyConfig.GetValueDescription(id, valuePer - hero.qualityConfig.StarAddPer * (afterStarCount - beforeStarCount)); } for (int i = 0; i < attrInheritPerNameArr.Length; i++) { int id = PlayerPropertyConfig.baseAttrs[i]; var curValue = hero.GetInheritAttrPer(id); var showID = hero.GetInheritAttrIDByBaseID(id); attrInheritPerNameArr[i].text = PlayerPropertyConfig.Get(showID).Name; nextAttrInheritPerTextArr[i].text = PlayerPropertyConfig.GetValueDescription(showID, curValue); var addPer = hero.GetInheritSingleAttrValue(showID); attrInheritPerTextArr[i].text = PlayerPropertyConfig.GetValueDescription(showID, curValue - addPer * (afterStarCount - beforeStarCount)); } //天赋 HeroUIManager.Instance.RefreshGiftCell(giftBaseCellArr, hero, HeroUIManager.Instance.heroBeforeGiftIDList, HeroUIManager.Instance.heroBeforeGiftLevelList); var heroConfig = hero.heroConfig; taiziBG.SetSprite("herodz" + heroConfig.Quality); heroModel.Create(hero.SkinID, heroConfig.UIScale); nameText.text = hero.breakLevel == 0 ? heroConfig.Name : Language.Get("herocardbreaklv", heroConfig.Name, hero.breakLevel); nameText.color = UIHelper.GetUIColorByFunc(heroConfig.Quality); } }