//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Monday, March 05, 2018
|
//--------------------------------------------------------
|
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
using vnxbqy.UI;
|
using System.Linq;
|
|
public class CSRechargeWin : ILWindow
|
{
|
Text m_RankTxt;
|
Text m_PriceALL;
|
Text m_ServerRange;
|
Image m_PriceIcon;
|
Text m_TimeInfo;
|
Button Btn_Recharge;
|
ScrollerController m_ScrollControl;
|
#region Built-in
|
protected override void BindController()
|
{
|
m_RankTxt = proxy.GetWidgtEx<Text>("Txt_Rank");
|
m_PriceALL = proxy.GetWidgtEx<Text>("PriceALLTxt");
|
m_ServerRange = proxy.GetWidgtEx<Text>("Txt_ServerRange");
|
m_PriceIcon = proxy.GetWidgtEx<Image>("PriceIcon");
|
Btn_Recharge = proxy.GetWidgtEx<Button>("Btn_Recharge");
|
m_TimeInfo = proxy.GetWidgtEx<Text>("Txt_CoolDown");
|
m_ScrollControl = proxy.GetWidgtEx<ScrollerController>("RankAwardCtrl");
|
}
|
|
protected override void AddListeners()
|
{
|
Btn_Recharge.SetListener(() =>
|
{
|
WindowJumpMgr.Instance.WindowJumpToEx("VipRechargeWin");
|
});
|
}
|
|
protected override void OnPreOpen()
|
{
|
CSRechargeModel.Instance.UpdatePlayerBillboardEvent += Display;
|
CSRechargeModel.Instance.onRechargeInfoUpdate += Display;
|
m_ScrollControl.OnRefreshCell += OnRefreshCell;
|
m_ScrollControl.lockType = EnhanceLockType.KeepVertical;
|
}
|
|
|
|
protected override void OnPreClose()
|
{
|
CSRechargeModel.Instance.UpdatePlayerBillboardEvent -= Display;
|
CSRechargeModel.Instance.onRechargeInfoUpdate -= Display;
|
m_ScrollControl.OnRefreshCell -= OnRefreshCell;
|
}
|
|
|
protected override void OnAfterOpen()
|
{
|
CSRechargeModel.Instance.SendViewCrossBillboard();
|
Display();
|
DisplayTime();
|
}
|
|
protected override void OnAfterClose()
|
{
|
}
|
|
|
#endregion
|
|
void Display()
|
{
|
OperationBase operationBase;
|
if (!OperationTimeHepler.Instance.TryGetOperationTime(CSRechargeModel.operationType, out operationBase))
|
{
|
return;
|
}
|
OperationCSRecharge operation = operationBase as OperationCSRecharge;
|
m_PriceALL.text = Language.Get("CSRechargeMoney", (CSRechargeModel.Instance.playerRecharges / 100.0).ToString("0.##"));
|
m_PriceIcon.SetIconWithMoneyType(1);
|
m_PriceIcon.SetNativeSize();
|
|
UpdateMyRank();
|
UpdateServerList();
|
|
|
m_ScrollControl.Refresh();
|
|
for (var i = 0; i < operation.orderList.Count; i++)
|
{
|
m_ScrollControl.AddCell(ScrollerDataType.Header, i);
|
}
|
int BiliBoardCount = operation.orderList.Count;
|
var recharges = operation.drlcInfoDict.Keys.ToList();
|
for (var i = 0; i < recharges.Count; i++)
|
{
|
m_ScrollControl.AddCell(ScrollerDataType.Header, BiliBoardCount + i);
|
}
|
|
m_ScrollControl.Restart();
|
}
|
|
void UpdateMyRank()
|
{
|
if (CSRechargeModel.Instance.RankIndex <= 0)
|
{
|
m_RankTxt.text = Language.Get("CSRechargeRankNo");
|
}
|
else
|
{
|
m_RankTxt.text = Language.Get("CSRechargeRank", CSRechargeModel.Instance.RankIndex);
|
}
|
}
|
void UpdateServerList()
|
{
|
if(CSRechargeModel.Instance.serverTypeList.Count <=0)
|
{
|
m_ServerRange.text = StringUtility.Contact(Language.Get("CSRechargeServerTip"), Language.Get("CSRechargeServerAll"));
|
}
|
else
|
{
|
string serverInfo = Language.Get("CSRechargeServerTip");
|
for(int i=0;i < CSRechargeModel.Instance.serverTypeList.Count;i++ )
|
{
|
var data = CSRechargeModel.Instance.serverTypeList[i];
|
serverInfo += Language.Get("CSRechargeServer", data.server1, data.server2);
|
if ( i != CSRechargeModel.Instance.serverTypeList.Count -1)
|
{
|
serverInfo += ", ";
|
}
|
}
|
m_ServerRange.text = serverInfo;
|
}
|
}
|
|
private void OnRefreshCell(ScrollerDataType type, CellView cell)
|
{
|
var Record = cell.GetILBehaviour<CSRechargeCell>();
|
if (Record != null)
|
Record.Display(cell.index);
|
}
|
|
private void DisplayTime()
|
{
|
OperationBase operationBase;
|
if (OperationTimeHepler.Instance.TryGetOperationTime(CSRechargeModel.operationType, out operationBase))
|
{
|
OperationCSRecharge operation = operationBase as OperationCSRecharge;
|
m_TimeInfo.text = StringUtility.Contact(Language.Get("ExpActivity_Text1"), operation.ToDisplayTime());
|
}
|
}
|
|
}
|