yyl
22 小时以前 4b5b31a23a74c1559460643836d70778d7d49931
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
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
 
//阵型
public class HeroFormationCell : CellView
{
    [SerializeField] Image activeImg;
    [SerializeField] Image countryOnImg;    //上阵阵型激活国家
    [SerializeField] Image[] OnCountImgs;    //上阵数量激活
    [SerializeField] RichText attrText;
 
    public void Display(int index)
    {
        Int2 result = HeroUIManager.Instance.GetMaxCountHeroCountry(HeroUIManager.Instance.selectTeamType, true);
 
        var config = HeroLineupHaloConfig.GetConfig(result.x, result.y);
        bool sameCountry = result.x == (index + 1);
 
        activeImg.SetActive(config != null && sameCountry);
 
 
        countryOnImg.SetSprite("heroTeamCountry" + (index + 1));
        if (config == null || !sameCountry)
        {
            for (int i = 0; i < OnCountImgs.Length; i++)
            {
                OnCountImgs[i].SetActive(false);
            }
        }
        else
        {
            for (int i = 0; i < OnCountImgs.Length; i++)
            {
                if (i < result.y)
                {
                    OnCountImgs[i].SetActive(true);
                    OnCountImgs[i].SetSprite("heroTeamCountryPoint" + result.x);
                }
                else
                {
                    OnCountImgs[i].SetActive(false);
                }
            }
        }
 
 
        var attrDict = HeroLineupHaloConfig.GetAttrsByCountry(index + 1);
        var countList = attrDict.Keys.ToList();
        countList.Sort();
        string text = string.Empty;
        for (int k = 0; k < countList.Count; k++)
        {
            int count = countList[k];
            string lineText = string.Empty;
            bool isActive = sameCountry && count <= result.y;
            string countStr = isActive ? UIHelper.AppendColor(TextColType.Green, count.ToString()) : count.ToString();
            lineText = (k == 0 ? "" : "</r>") + Language.Get("herocard37", countStr, HeroUIManager.Instance.GetJobName(index + 1));
            var attrConfig = attrDict[count];
            for (int i = 0; i < attrConfig.AttrIDList.Length; i++)
            {
                string format = !isActive ? "{0}+{1}" : "{0}+" + UIHelper.AppendColor(TextColType.Green, "{1}");
                lineText += " " + PlayerPropertyConfig.GetFullDescription(attrConfig.AttrIDList[i], attrConfig.AttrValueList[i], format);
            }
 
            text += UIHelper.AppendColor(isActive ? TextColType.NavyBrown : TextColType.Gray, lineText);
        }
        attrText.text = text;
    }
}