using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
using vnxbqy.UI;
|
|
//跨服充值排行榜
|
public class CSRankWin : ILWindow
|
{
|
Button Btn_Close;
|
Text m_MyRank;
|
ScrollerController m_RankListController;
|
|
#region Built-in
|
protected override void BindController()
|
{
|
Btn_Close = proxy.GetWidgtEx<Button>("Img_Close");
|
m_MyRank = proxy.GetWidgtEx<Text>("Txt_MyRank");
|
m_RankListController = proxy.GetWidgtEx<ScrollerController>("Scroller");
|
}
|
|
protected override void AddListeners()
|
{
|
Btn_Close.SetListener(() =>
|
{
|
WindowCenter.Instance.CloseIL<CSRankWin>();
|
});
|
|
}
|
|
protected override void OnPreOpen()
|
{
|
m_RankListController.OnRefreshCell += OnRefreshCell;
|
ILOperationTimeHepler.Instance.operationTimeUpdateEvent += operationTimeUpdateEvent;
|
|
}
|
|
protected override void OnPreClose()
|
{
|
m_RankListController.OnRefreshCell -= OnRefreshCell;
|
ILOperationTimeHepler.Instance.operationTimeUpdateEvent -= operationTimeUpdateEvent;
|
}
|
protected override void OnAfterOpen()
|
{
|
Display();
|
}
|
protected override void OnAfterClose()
|
{
|
}
|
#endregion
|
|
private void operationTimeUpdateEvent(Operation type)
|
{
|
if (type == CSRechargeModel.operationType)
|
{
|
Display();
|
}
|
}
|
void Display()
|
{
|
if (CSRechargeModel.Instance.RankIndex <= 0)
|
{
|
m_MyRank.text = Language.Get("L1045");
|
}
|
else
|
{
|
m_MyRank.text = Language.Get("L1092", CSRechargeModel.Instance.RankIndex);
|
}
|
|
m_RankListController.Refresh();
|
|
for (int i = 0; i < 100; i++)
|
m_RankListController.AddCell(ScrollerDataType.Header, i);
|
|
m_RankListController.Restart();
|
}
|
|
private void OnRefreshCell(ScrollerDataType type, CellView cell)
|
{
|
var Record = cell.GetILBehaviour<CSRankCell>();
|
if(Record != null)
|
Record.Display(cell.index);
|
}
|
|
}
|