using UnityEngine;
|
|
namespace vnxbqy.UI
|
{
|
public class FairySiegeScheduleRankWin : Window
|
{
|
[SerializeField] ScrollerController scrScore;
|
[SerializeField] ScrollerController scrTime;
|
FairySiegeActModel model { get { return ModelCenter.Instance.GetModel<FairySiegeActModel>(); } }
|
|
#region Build-in
|
|
protected override void AddListeners()
|
{
|
}
|
|
protected override void BindController()
|
{
|
}
|
|
protected override void OnPreOpen()
|
{
|
scrTime.OnRefreshCell += OnRefreshTimeCell;
|
scrScore.OnRefreshCell += OnRefreshScoreCell;
|
}
|
|
protected override void OnPreClose()
|
{
|
scrTime.OnRefreshCell -= OnRefreshTimeCell;
|
scrScore.OnRefreshCell -= OnRefreshScoreCell;
|
}
|
|
protected override void OnAfterOpen()
|
{
|
CreateTimeScroller();
|
CreateScoreScroller();
|
}
|
|
protected override void OnAfterClose()
|
{
|
}
|
|
#endregion
|
|
private void OnRefreshTimeCell(ScrollerDataType type, CellView cell)
|
{
|
var _cell = cell.GetComponent<FairySiegeScheduleTimeCell>();
|
_cell?.Display(cell.index);
|
}
|
|
private void OnRefreshScoreCell(ScrollerDataType type, CellView cell)
|
{
|
var _cell = cell.GetComponent<FairySiegeScheduleScoreCell>();
|
_cell?.Display(cell.index);
|
}
|
|
private void CreateTimeScroller()
|
{
|
scrTime.Refresh();
|
for (int i = 0; i < model.matchRoundMax; i++)
|
{
|
scrTime.AddCell(ScrollerDataType.Header, i);
|
}
|
scrTime.Restart();
|
}
|
|
private void CreateScoreScroller()
|
{
|
scrScore.Refresh();
|
var scoreRowData = model.GetScoreRowData();
|
if (!scoreRowData.IsNullOrEmpty())
|
{
|
for (int i = 0; i < scoreRowData.Count; i++)
|
{
|
scrScore.AddCell(ScrollerDataType.Header, i);
|
}
|
}
|
scrScore.Restart();
|
}
|
}
|
}
|