using System;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
|
//历练秘笈
|
public class ExpSecretCollectionWin : UIBase
|
{
|
[SerializeField] Text costzcText;
|
[SerializeField] Text addExpText;
|
[SerializeField] Text addMoneyText;
|
[SerializeField] ScrollerController scroller;
|
[SerializeField] Button buyBtn;
|
[SerializeField] Text buyText;
|
[SerializeField] Transform buyYetRect;
|
|
|
protected override void InitComponent()
|
{
|
buyBtn.AddListener(() =>
|
{
|
RechargeManager.Instance.CTG(ExpSecretCollectionManager.Instance.ctgID);
|
});
|
}
|
|
protected override void OnPreOpen()
|
{
|
|
ExpSecretCollectionManager.Instance.UpdateExpSecretCollectionEvent += OnExpSecretCollectionEvent;
|
scroller.OnRefreshCell += OnRefreshCell;
|
CreateScroller();
|
Display();
|
}
|
|
|
protected override void OnPreClose()
|
{
|
ExpSecretCollectionManager.Instance.UpdateExpSecretCollectionEvent -= OnExpSecretCollectionEvent;
|
scroller.OnRefreshCell -= OnRefreshCell;
|
}
|
|
void CreateScroller()
|
{
|
scroller.Refresh();
|
var keys = LLMJConfig.GetKeys();
|
keys.Sort();
|
foreach (var key in keys)
|
{
|
scroller.AddCell(ScrollerDataType.Header, key);
|
}
|
scroller.Restart();
|
scroller.JumpIndex(ExpSecretCollectionManager.Instance.m_MJLV - 1);
|
}
|
|
void OnRefreshCell(ScrollerDataType type, CellView cell)
|
{
|
var _cell = cell as ExpSecretCollectionCell;
|
_cell.Display(cell.index);
|
}
|
|
void OnExpSecretCollectionEvent()
|
{
|
Display();
|
}
|
|
void Display()
|
{
|
costzcText.text = ExpSecretCollectionManager.Instance.m_Zhanchui >= 1000000 ?
|
UIHelper.ReplaceLargeNum(ExpSecretCollectionManager.Instance.m_Zhanchui) :
|
ExpSecretCollectionManager.Instance.m_Zhanchui.ToString();
|
|
var config = LLMJConfig.Get(ExpSecretCollectionManager.Instance.m_MJLV);
|
|
if (ExpSecretCollectionManager.Instance.m_MJLV == 0)
|
{
|
addExpText.text = "0";
|
addMoneyText.text = "0";
|
}
|
else
|
{
|
addExpText.text = ExpSecretCollectionManager.Instance.m_ExpEx + "/" + config.ExpExUpper;
|
addMoneyText.text = ExpSecretCollectionManager.Instance.m_DecomposeEx + "/" + config.DecomposeExUpper;
|
}
|
|
buyBtn.SetActive(ExpSecretCollectionManager.Instance.m_MJLV == 0);
|
RechargeManager.Instance.TryGetOrderInfo(ExpSecretCollectionManager.Instance.ctgID, out var orderInfoConfig);
|
buyText.text = Language.Get("PayMoneyNum", orderInfoConfig.PayRMBNumOnSale);
|
buyYetRect.SetActive(ExpSecretCollectionManager.Instance.m_MJLV != 0);
|
|
scroller.m_Scorller.RefreshActiveCellViews();
|
}
|
|
}
|