using System.Collections.Generic; 
 | 
using UnityEngine; 
 | 
using UnityEngine.UI; 
 | 
  
 | 
  
 | 
/// <summary> 
 | 
/// 武将觉醒总览界面 
 | 
/// </summary> 
 | 
public class HeroAwakePrivewWin : UIBase 
 | 
{ 
 | 
    [SerializeField] ScrollRect scrollRect; 
 | 
    [SerializeField] GameObject descCell; //用于创建 
 | 
    [SerializeField] Transform awakeCellParent; //潜能父节点 
 | 
    List<GameObject> awakeCellList;   //觉醒 
 | 
  
 | 
    protected override void InitComponent() 
 | 
    { 
 | 
        awakeCellList = new List<GameObject>(); 
 | 
    } 
 | 
  
 | 
    protected override void OnPreOpen() 
 | 
    { 
 | 
        scrollRect.verticalNormalizedPosition = 1; 
 | 
        Display(); 
 | 
    } 
 | 
  
 | 
    protected override void OnPreClose() 
 | 
    { 
 | 
    } 
 | 
  
 | 
  
 | 
    public void Display() 
 | 
    { 
 | 
        var hero = HeroManager.Instance.GetHero(HeroUIManager.Instance.selectAwakeHeroGuid); 
 | 
        if (hero == null) 
 | 
            return; 
 | 
  
 | 
        descCell.SetActive(false); 
 | 
        var maxLV = HeroAwakeConfig.GetMaxAwakeLV(hero.heroId); 
 | 
        var starCnt = HeroQualityConfig.Get(hero.Quality).InitStarUpper; 
 | 
        for (int i = 1; i <= maxLV; i++) 
 | 
        { 
 | 
            if (i > awakeCellList.Count) 
 | 
            { 
 | 
                awakeCellList.Add(Instantiate(descCell, awakeCellParent)); 
 | 
            } 
 | 
            var go = awakeCellList[i - 1]; 
 | 
            var descText = go.GetComponent<Text>(); 
 | 
            var nameText = go.GetComponent<Text>("skillname"); 
 | 
            go.SetActive(true); 
 | 
  
 | 
            var config = HeroAwakeConfig.GetHeroAwakeConfig(hero.heroId, i); 
 | 
  
 | 
            int type = config.UnlockTalentSlot != 0 ? 1 : config.SkillID != 0 ? 2 : 3; 
 | 
            var awakeStr = string.Empty; 
 | 
            if (type == 1) 
 | 
            { 
 | 
                starCnt += config.AddStarUpper; 
 | 
                awakeStr = Language.Get("HeroAwake8", config.UnlockTalentSlot, starCnt); 
 | 
            } 
 | 
            else if (type == 2) 
 | 
            { 
 | 
                var skill = SkillConfig.Get(config.SkillID); 
 | 
                awakeStr = Language.Get("L1039", skill.SkillName) + skill.Description; 
 | 
            } 
 | 
            else 
 | 
            { 
 | 
                for (int k = 0; k < config.AttrIDList.Length; k++) 
 | 
                { 
 | 
                    awakeStr += (string.IsNullOrEmpty(config.SkillIName) ? string.Empty : Language.Get("L1039", config.SkillIName)) +PlayerPropertyConfig.GetFullDescription(config.AttrIDList[k], config.AttrValueList[k], "{0}+" + UIHelper.AppendColor(TextColType.Green, "{1}")) + 
 | 
                        (k == config.AttrIDList.Length - 1 ? "" : "\n"); 
 | 
                } 
 | 
            } 
 | 
  
 | 
            if (i - 1 < hero.awakeLevel) 
 | 
            { 
 | 
                nameText.text = Language.Get("herocard12", i) + Language.Get("L1096"); 
 | 
                descText.text = awakeStr; 
 | 
            } 
 | 
            else 
 | 
            { 
 | 
                //置灰 
 | 
                nameText.text = UIHelper.AppendColor(TextColType.NavyGray, Language.Get("herocard12", i) + Language.Get("L1096")); 
 | 
                descText.text = UIHelper.AppendColor(TextColType.NavyGray, UIHelper.RemoveColor(awakeStr)); 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
  
 | 
} 
 |