using System.Linq;
|
using UnityEngine;
|
|
namespace vnxbqy.UI
|
{
|
public class FairySiegeScheduleGroupCell : CellView
|
{
|
[SerializeField] EmblemCell emblem;
|
[SerializeField] ImageEx imgArrow;
|
[SerializeField] TextEx txtFairyName;
|
[SerializeField] TextEx txtLevel;
|
[SerializeField] TextEx txtPlayerName;
|
[SerializeField] TextEx txtRound;
|
[SerializeField] ButtonEx btnInfo;
|
[SerializeField] ButtonEx btnList;
|
FairySiegeActModel model { get { return ModelCenter.Instance.GetModel<FairySiegeActModel>(); } }
|
RankModel rankModel { get { return ModelCenter.Instance.GetModel<RankModel>(); } }
|
|
public void Display(int index, CellView cell)
|
{
|
int battleType = cell.info.Value.infoInt1;
|
var rankInfo = rankModel.GetRankPageDatas(FairySiegeActModel.crossRoundRankType);
|
if (rankInfo.IsNullOrEmpty())
|
return;
|
var list = rankInfo.Keys.ToList();
|
if (index < 0 || index >= rankInfo.Count)
|
return;
|
var info = rankInfo[list[index]];
|
|
emblem.InitUI(EmblemHelper.GetOtherEmblemModel((int)info.value3));
|
txtFairyName.text = info.name1;
|
txtPlayerName.text = info.name2;
|
txtLevel.text = UIHelper.ReplaceLargeNum(info.cmpValue * model.oneHundredMillion + info.cmpValue2);
|
txtRound.text = (index + 1).ToString();
|
|
bool isShowTip = model.TryGetMatchUpNum(model.operationCrossAct.JoinFamilyCnt, model.matchRound, battleType, out int num);
|
if (num <= 0 || !isShowTip)
|
{
|
imgArrow.SetActive(false);
|
}
|
else
|
{
|
imgArrow.SetActive(index < num);
|
}
|
btnInfo.SetListener(() =>
|
{
|
model.queryFairyId = info.id;
|
WindowCenter.Instance.Open<FairySiegeScheduleFairyInfoWin>();
|
});
|
|
btnList.SetListener(() =>
|
{
|
model.queryFairyId = info.id;
|
WindowCenter.Instance.Open<FairySiegeScheduleNameListWin>();
|
});
|
}
|
}
|
}
|