using vnxbqy.UI;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
class FaQiLVUPSuccessWin : ILWindow
|
{
|
Button closeBtn;
|
Text upgrateName;
|
ScrollerController attrScroll;
|
float openTime = 0f;
|
|
#region Built-in
|
protected override void BindController()
|
{
|
closeBtn = proxy.GetWidgtEx<Button>("Btn_Close");
|
upgrateName = proxy.GetWidgtEx<Text>("upgratetxt");
|
attrScroll = proxy.GetWidgtEx<ScrollerController>("prolayoutScroller");
|
|
}
|
|
protected override void AddListeners()
|
{
|
closeBtn.SetListener(() => {
|
//打开x秒内不响应关闭
|
if (Time.time - openTime < 1)
|
{
|
return;
|
}
|
WindowCenter.Instance.CloseIL<FaQiLVUPSuccessWin>();
|
});
|
|
}
|
|
protected override void OnPreOpen()
|
{
|
openTime = Time.time;
|
upgrateName.text = Language.Get("FuncRankName", FaQiLVUPModel.Instance.faqiLV);
|
attrScroll.OnRefreshCell += OnRefreshCell;
|
|
}
|
|
protected override void OnPreClose()
|
{
|
attrScroll.OnRefreshCell -= OnRefreshCell;
|
}
|
|
protected override void OnAfterOpen()
|
{
|
attrScroll.Refresh();
|
|
var curConfig = ILFaQiLVUpConfig.Get(FaQiLVUPModel.Instance.faqiLV);
|
var beforeConfig = ILFaQiLVUpConfig.Get(FaQiLVUPModel.Instance.faqiLV - 1);
|
|
var showCnt = curConfig.LVAttrType.Length + beforeConfig.UpItemAttrType.Length;
|
for (int i = 0; i < showCnt; i++)
|
{
|
attrScroll.AddCell(ScrollerDataType.Header, i);
|
}
|
attrScroll.Restart();
|
attrScroll.m_Scorller.RefreshActiveCellViews();
|
}
|
#endregion
|
|
void OnRefreshCell(ScrollerDataType type, CellView cell)
|
{
|
var curText = cell.FindComponentEx<Text>("Txt_Current");
|
var nextText = cell.FindComponentEx<Text>("Txt_Next");
|
var index = cell.index;
|
var curConfig = ILFaQiLVUpConfig.Get(FaQiLVUPModel.Instance.faqiLV);
|
var beforeConfig = ILFaQiLVUpConfig.Get(FaQiLVUPModel.Instance.faqiLV - 1);
|
if (index < beforeConfig.UpItemAttrType.Length)
|
{
|
var value = beforeConfig.UpItemAttrValue[index];
|
var id = curConfig.UpItemAttrType[index];
|
var nextValue= FaQiLVUPModel.Instance.faqiLVUPAttr[id];
|
|
value = nextValue - value;
|
curText.text = StringUtility.Contact(PlayerPropertyConfig.Get(id).Name, ":", PlayerPropertyConfig.GetValueDescription(id, value));
|
nextText.text = PlayerPropertyConfig.GetValueDescription(id, nextValue);
|
|
}
|
else
|
{
|
var lvIndex = index - beforeConfig.UpItemAttrType.Length;
|
var id = curConfig.LVAttrType[lvIndex];
|
var nextValue = FaQiLVUPModel.Instance.faqiLVUPAttr[id];
|
var value = nextValue - curConfig.LVAttrValue[lvIndex];
|
curText.text = StringUtility.Contact(PlayerPropertyConfig.Get(id).Name, ":", PlayerPropertyConfig.GetValueDescription(id, value));
|
nextText.text = PlayerPropertyConfig.GetValueDescription(id, nextValue);
|
|
}
|
|
}
|
}
|