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);
|
}
|
}
|
}
|
|
}
|