using vnxbqy.UI;
|
using System.Collections.Generic;
|
using System.Linq;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
//挑战妖王(个人BOSS)
|
public class ChallengeDemonKingInfoWin : Window
|
{
|
[SerializeField] ButtonEx btnClose;
|
[SerializeField] ScrollerController scroller;
|
ChallengeDemonKingModel challengeDemonKingModel { get { return ModelCenter.Instance.GetModel<ChallengeDemonKingModel>(); } }
|
|
protected override void BindController()
|
{
|
|
}
|
|
protected override void AddListeners()
|
{
|
btnClose.SetListener(() =>
|
{
|
WindowCenter.Instance.Close<ChallengeDemonKingInfoWin>();
|
});
|
}
|
|
protected override void OnPreOpen()
|
{
|
scroller.OnRefreshCell += OnRefreshCell;
|
}
|
|
protected override void OnAfterOpen()
|
{
|
scroller.Refresh();
|
var dict = PlayerPropertyConfig.GetShowDict();
|
var typeShowList = dict.Keys.ToList();
|
List<int> lineList1 = new List<int>();
|
List<int> lineList2 = new List<int>();
|
int index = 0;
|
for (int i = 0; i < typeShowList.Count; i++)
|
{
|
int type = typeShowList[i];
|
for (int j = 0; j < dict[type].Count; j++)
|
{
|
if (type == 1)
|
{
|
CellInfo cellInfo = new CellInfo();
|
cellInfo.infoInt1 = dict[type][j];
|
index += 1;
|
scroller.AddCell(ScrollerDataType.Header, index, cellInfo);
|
}
|
else if (type == 2)
|
{
|
lineList1.Add(dict[type][j]);
|
}
|
else if (type == 3)
|
{
|
lineList2.Add(dict[type][j]);
|
}
|
}
|
int count1 = lineList1.Count;
|
int count2 = lineList2.Count;
|
int count = count1 <= count2 ? count1 : count2;
|
for (int k = 0; k < count; k++)
|
{
|
CellInfo cellInfo = new CellInfo();
|
cellInfo.infoInt1 = lineList1[k];
|
cellInfo.infoInt2 = lineList2[k];
|
index += 1;
|
scroller.AddCell(ScrollerDataType.Header, index, cellInfo);
|
}
|
}
|
scroller.Restart();
|
}
|
|
protected override void OnAfterClose()
|
{
|
|
}
|
|
protected override void OnPreClose()
|
{
|
scroller.OnRefreshCell -= OnRefreshCell;
|
}
|
|
private void OnRefreshCell(ScrollerDataType type, CellView cell)
|
{
|
var _cell = cell as ChallengeDemonKingInfoCell;
|
_cell.Display(_cell.index, cell);
|
}
|
|
}
|