using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEngine.UI; /// /// 武将吞噬成功界面 /// public class HeroGiftEatSuccessWin : UIBase { [SerializeField] Image[] beforeStars; [SerializeField] Image[] afterStars; [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() { if (string.IsNullOrEmpty(HeroUIManager.Instance.selectHeroGuidForGiftFuncForSuccessWin)) return; Display(); HeroUIManager.Instance.selectEatHeroGuid = ""; } public void Display() { HeroInfo hero = HeroManager.Instance.GetHero(HeroUIManager.Instance.selectHeroGuidForGiftFuncForSuccessWin); if (hero == null) return; int beforeStarCount = hero.heroStar - 1; int afterStarCount = hero.heroStar; HeroUIManager.Instance.ShowStarImg(beforeStarCount, beforeStars); HeroUIManager.Instance.ShowStarImg(afterStarCount, afterStars); //上阵属性 int valuePer = hero.GetOnBattleAddPer(); 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); } //天赋 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); } }