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
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
 
public class OSRankHeroCallAwardCell : CellView
{
    [SerializeField] Text rankText;
    [SerializeField] Image rankImg;
    [SerializeField] ItemCell[] itemCells;
 
    public void Display(int index)
    {
        var rank = index + 1;
        if (index < 3)
        {
            rankImg.SetActive(true);
            rankText.SetActive(false);
            rankImg.SetSprite($"Rank{index + 1}");
        }
        else
        {
            rankImg.SetActive(false);
            rankText.SetActive(true);
            var keys = OSActivityManager.Instance.heroCallRankAwards.Keys.ToList();
            keys.Sort();
            var startRank = keys[index - 1] + 1;
            var endRank = keys[index];
            rank = endRank;
            if (startRank == endRank)
            {
                rankText.text = startRank.ToString();
            }
            else
            {
                rankText.text = startRank + "-" + endRank;
            }
        }
 
        var award = OSActivityManager.Instance.heroCallRankAwards[rank];
        for (int i = 0; i < itemCells.Length; i++)
        {
            var itemCell = itemCells[i];
            if (i < award.Length)
            {
                itemCell.SetActive(true);
                int itemID = award[i][0];
                itemCell.Init(new ItemCellModel(itemID, true, award[i][1]));
                itemCell.button.SetListener(() => ItemTipUtility.Show(itemID));
            }
            else
            {
                itemCell.SetActive(false);
            }
        }
    }
 
}