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 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])); } else { itemCell.SetActive(false); } } } }