少年修仙传客户端代码仓库
hch
4 天以前 600733c8f592cb9e65f2b7a3e110ac1d686e6bfe
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
using vnxbqy.UI;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
 
public class CrossServerBattleFieldRankCell : ILBehaviour
{
    List<ItemCell> itemCells = new List<ItemCell>();
    Transform Container_Top3;
    Transform Container_RankIndex;
    Text Txt_Name;
    Image Img_Rank;
    Text Txt_Count;
    Text Txt_RankIndex;
    Button Btn_Bill;
    RichText awardinfo;
 
    RankModel rankModel { get { return ModelCenter.Instance.GetModel<RankModel>(); } }
    ImpactRankModel impactRankModel { get { return ModelCenter.Instance.GetModel<ImpactRankModel>(); } }
        
    protected override void Awake() 
    {
 
        itemCells.Add(proxy.GetWidgtEx<ItemCell>("Item0"));
        itemCells.Add(proxy.GetWidgtEx<ItemCell>("Item1"));
        itemCells.Add(proxy.GetWidgtEx<ItemCell>("Item2"));
        itemCells.Add(proxy.GetWidgtEx<ItemCell>("Item3"));
 
        Container_Top3 = proxy.GetWidgtEx<Transform>("Container_Top3");
        Container_RankIndex = proxy.GetWidgtEx<Transform>("Container_RankIndex");
        Txt_Name = proxy.GetWidgtEx<Text>("Txt_Name");
        Img_Rank = proxy.GetWidgtEx<Image>("Img_Rank");
        Txt_Count = proxy.GetWidgtEx<Text>("Txt_Count");
        Txt_RankIndex = proxy.GetWidgtEx<Text>("Txt_RankIndex");
        Btn_Bill = proxy.GetWidgtEx<Button>("Btn_Bill");
        awardinfo = proxy.GetWidgtEx<RichText>("awardinfo");
    }
 
    public void Display(int index)
    {
        int rankType = ILCrossServerModel.Instance.rankTypes[ILCrossServerModel.Instance.selectRankIndex];
        var awards = ILCrossServerModel.Instance.GetRankAwards(rankType);
        var keys = awards.Keys.ToList();
        keys.Sort();
        var rankIndex = keys[index];
        var items = awards[rankIndex];
        for (int i = 0; i < itemCells.Count; i++)
        {
            if (i < items.Count)
            {
                itemCells[i].SetActiveIL(true);
                var itemId = items[i].id;
                var model = new ItemCellModel(itemId, false, (ulong)items[i].count);
                itemCells[i].Init(model);
                itemCells[i].auctionIcon.SetActiveIL(items[i].bind != 0);
                itemCells[i].button.SetListener(() =>
                {
                    ItemTipUtility.Show(itemId);
                });
            }
            else
            {
                itemCells[i].SetActiveIL(false);
            }
        }
        if (rankIndex <= 3)
        {
            Container_Top3.SetActiveIL(true);
            Container_RankIndex.SetActiveIL(false);
            
            var ranks = rankModel.GetRankPageDatas(rankType);
            Img_Rank.SetSprite(rankIndex == 1 ? "Rank_First" : rankIndex == 2 ? "Rank_Second" : "Rank_Third");
            if (ranks != null && index < ranks.Count)
            {
                Txt_Name.text = ranks[index].name1;
                Txt_Count.text = Language.Get("CrossBattleField50_" + ILCrossServerModel.Instance.selectRankIndex, ranks[index].cmpValue);
            }
            else
            {
                Txt_Name.text = "-";
                Txt_Count.text = "-";
            }
        }
        else
        {
            Container_Top3.SetActiveIL(false);
            Container_RankIndex.SetActiveIL(true);
 
            Txt_RankIndex.text = (keys[index - 1] + 1) +"-" + rankIndex;
 
            Btn_Bill.SetListener(()=> {
                impactRankModel.viewRankStartIndex = keys[index - 1];
                impactRankModel.presentBillRankType = (RankType)rankType;
                rankModel.QueryRankByPage(rankType, impactRankModel.viewRankStartIndex);
                WindowCenter.Instance.Open<ImpactBillRankWin>();
            });
        }
 
        if (rankType == 151)
        {
            awardinfo.SetActiveIL(true);
            var moneys = ILCrossServerModel.Instance.cyBillMoneyDict[rankIndex];
            awardinfo.text = Language.Get("CrossBattleField51", moneys[0], moneys[1]);
        }
        else
        {
            awardinfo.SetActiveIL(false);
        }
    }
 
 
}