lcy
昨天 247c64258e0102a1028199f14866a1fd1c1a205f
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
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
 
public class ArenaAwardCell : CellView
{
    [SerializeField] ImageEx imgRank;
    [SerializeField] TextEx txtRank;
    [SerializeField] ItemCell[] itemCells;
    public void Display(int index, CellView cellView)
    {
        int functionOrder = cellView.info.Value.infoInt1;
        Dictionary<int, int[][]> rewardDict = ArenaManager.Instance.GetArenaAwardDict(functionOrder);
        if (rewardDict.IsNullOrEmpty())
            return;
        var list = rewardDict.Keys.ToList();
        list.Sort();
 
 
        int rank = list[index];
        
        if (rank <= 3)
        {
            imgRank.SetActive(true);
            txtRank.SetActive(false);
            imgRank.SetSprite(StringUtility.Contact("Rank", rank));
            txtRank.text = rank.ToString();
        }
        else
        {
            imgRank.SetActive(false);
            txtRank.SetActive(true);
            int lastIndex = index - 1;
            txtRank.text = lastIndex > 0 && lastIndex < list.Count ? Language.Get("Arena15", list[lastIndex] + 1, rank) : string.Empty;
        }
 
        int key = list[index];
        int[][] rewardArr = rewardDict[key];
        for (int i = 0; i < itemCells.Length; i++)
        {
            var itemCell = itemCells[i];
            if (!rewardArr.IsNullOrEmpty() && i < rewardArr.Length)
            {
                int itemCellIndex = i;
                itemCell.SetActive(true);
                itemCell.Init(new ItemCellModel(rewardArr[i][0], true, rewardArr[i][1]));
                itemCell.button.SetListener(() => ItemTipUtility.Show(rewardArr[itemCellIndex][0], true));
            }
            else
            {
                itemCell.SetActive(false);
            }
        }
    }
}