yyl
9 天以前 bb5909bcd36b48b919366c95b4248a3754452698
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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)
            {
                awakeStr = SkillConfig.Get(config.SkillID).Description;
            }
            else
            {
                for (int k = 0; k < config.AttrIDList.Length; k++)
                {
                    awakeStr += 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));
            }
        }
    }
 
}