少年修仙传客户端代码仓库
hch
3 天以前 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
using vnxbqy.UI;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
 
public class CrossServerBattleFieldResultCell : ILBehaviour
{
    Image rankImg;
    Text rank;
    Text name;
    Image firstImg;
    Text collectCrystal;
    Text killNum;
    Text score;
    List<ItemCell> items = new List<ItemCell>();
 
 
 
    protected override void Awake() 
    {
        rankImg = proxy.GetWidgtEx<Image>("IMG_Rank");
        rank = proxy.GetWidgtEx<Text>("Txt_Rank");
        name = proxy.GetWidgtEx<Text>("Txt_Name");
        firstImg = proxy.GetWidgtEx<Image>("Img_FirstSign");
        collectCrystal = proxy.GetWidgtEx<Text>("Txt_Crystal");
        killNum = proxy.GetWidgtEx<Text>("Txt_KillNum");
        score = proxy.GetWidgtEx<Text>("Txt_Integral");
        for (int i = 0; i < 5; i++)
        {
            items.Add(proxy.GetWidgtEx<ItemCell>("itemcell" + i));
        }
    }
 
    public void Display(int index)
    {
        var result = ILCrossServerModel.Instance.dungeonResult.factionInfoList[ILCrossServerModel.Instance.seeFaction - 1].rankPlayerList[index];
        if (index < 3)
        {
            rankImg.SetActiveIL(true);
            rank.SetActiveIL(false);
            rankImg.SetSprite(index == 0 ? "Rank_First" : (index == 1 ? "Rank_Second" : "Rank_Third"));
        }
        else
        {
            rankImg.SetActiveIL(false);
            rank.SetActiveIL(true);
            rank.text = (index + 1).ToString();
        }
 
        name.text = result.name;
        firstImg.SetActiveIL(index == 0);
        collectCrystal.text = result.crystalCollCnt.ToString();
        killNum.text = result.killCount.ToString();
 
        score.text = result.score.ToString();
        var awards = GetRankAwards(index);
        for (int i = 0; i < items.Count; i++)
        {
            if (i < awards.Count)
            {
                items[i].SetActiveIL(true);
                var itemID = awards[i].id;
                var model = new ItemCellModel(itemID, false, (ulong)awards[i].count);
                items[i].Init(model);
                items[i].button.SetListener(() =>
                {
                    ItemTipUtility.Show(itemID);
                });
            }
            else
            {
                items[i].SetActiveIL(false);
            }
        }
    }
 
 
    List<ItemEx> GetRankAwards(int index)
    {
        Dictionary<int, List<ItemEx>> awards = new Dictionary<int, List<ItemEx>>();
        if (ILCrossServerModel.Instance.dungeonResult.winnerFaction == ILCrossServerModel.Instance.seeFaction)
        {
            awards = ILCrossServerModel.Instance.winRankAwards;
        }
        else
        {
            awards = ILCrossServerModel.Instance.defeatRankAwards;
        }
        var keyList = awards.Keys.ToList();
        keyList.Sort();
        int findKey = 0;
        for (int i = 0; i < keyList.Count; i++)
        {
            if (index + 1 <= keyList[i])
            {
                findKey = keyList[i];
                break;
            }
        }
        if (findKey == 0)
        {
            return new List<ItemEx>();
        }
 
        return awards[findKey];
    }
 
}