using System.Linq;
|
using UnityEngine;
|
|
namespace vnxbqy.UI
|
{
|
public class FairySiegeRankAwardActPersonalCell : CellView
|
{
|
[SerializeField] ImageEx imgBG;
|
[SerializeField] ImageEx imgRank;
|
[SerializeField] TextEx txtRank;
|
|
[SerializeField] ImageEx imgTitle;
|
[SerializeField] UIFrame uifTitle;
|
[SerializeField] FairySiegeItemCellArr items;
|
[SerializeField] TextEx txtNeedScore;
|
|
FairySiegeActModel model { get { return ModelCenter.Instance.GetModel<FairySiegeActModel>(); } }
|
|
public void Display(int index)
|
{
|
if (model.operationCrossAct == null)
|
return;
|
int personalTemplateID = model.operationCrossAct.PersonalTemplateID;
|
var rankDict = BillboardAwardTempConfig.GetRankDict(personalTemplateID);
|
if (rankDict == null)
|
return;
|
var list = rankDict.Keys.ToList();
|
list.Sort();
|
int id = rankDict[list[index]];
|
if (!BillboardAwardTempConfig.Has(id))
|
return;
|
BillboardAwardTempConfig config = BillboardAwardTempConfig.Get(id);
|
items.Display(config.AwardItemList);
|
|
bool hasTitle = model.TryGetTitleId(config.AwardItemList, out int titleId);
|
imgTitle.SetActive(hasTitle);
|
if (hasTitle)
|
{
|
model.DisplayTitle(imgTitle, uifTitle, titleId);
|
}
|
|
if (index < 3)
|
{
|
imgRank.SetActive(true);
|
imgRank.SetSprite("actrank" + (index + 1));
|
imgRank.SetNativeSize();
|
imgBG.SetSprite("actrankBG" + (index + 1));
|
}
|
else
|
{
|
imgRank.SetActive(false);
|
imgBG.SetSprite("actrankBGOther");
|
}
|
|
var startRank = 1;
|
if (index > 0)
|
{
|
startRank = list[index - 1] + 1;
|
}
|
var endRank = list[index];
|
if (startRank == endRank)
|
{
|
txtRank.text = endRank.ToString();
|
}
|
else
|
{
|
txtRank.text = StringUtility.Contact(startRank, "-", endRank);
|
}
|
|
txtNeedScore.text = config.NeedValue == 0 ? string.Empty : Language.Get("FairySiege143", config.NeedValue);
|
}
|
}
|
}
|