using vnxbqy.UI;
|
using System;
|
using LitJson;
|
using System.Linq;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
class CharmLVUPWin : ILWindow
|
{
|
|
Button closeBtn;
|
RichText sourceTxt;
|
Text curCharmValue;
|
Button lvUPBtn;
|
Text title1;
|
Text value1;
|
RichText proptext1;
|
Text title2;
|
Text value2;
|
RichText proptext2;
|
|
|
#region Built-in
|
protected override void BindController()
|
{
|
closeBtn = proxy.GetWidgtEx<Button>("CloseButton");
|
sourceTxt = proxy.GetWidgtEx<RichText>("source");
|
curCharmValue = proxy.GetWidgtEx<Text>("curCharmValue");
|
lvUPBtn = proxy.GetWidgtEx<Button>("CommonButton");
|
title1 = proxy.GetWidgtEx<Text>("title1");
|
value1 = proxy.GetWidgtEx<Text>("value1");
|
proptext1 = proxy.GetWidgtEx<RichText>("proptext1");
|
title2 = proxy.GetWidgtEx<Text>("title2");
|
value2 = proxy.GetWidgtEx<Text>("value2");
|
proptext2 = proxy.GetWidgtEx<RichText>("proptext2");
|
}
|
|
protected override void AddListeners()
|
{
|
closeBtn.SetListener(()=> {
|
WindowCenter.Instance.CloseIL<CharmLVUPWin>();
|
});
|
|
lvUPBtn.SetListener(()=> {
|
var charmLV = (int)PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default11);
|
|
var config = ILLoveCharmConfig.Get(charmLV);
|
if (FlowerGiftModel.Instance.charmValue < config.UpNeedCharm) {
|
return;
|
}
|
LimitedTimeLuxuryGiftModel.Instance.IsItemIdShow(55, 1,1,3,0);
|
var pack = new IL_CB319_tagCGCharmLVUp();
|
GameNetSystem.Instance.SendInfo(pack);
|
});
|
}
|
|
protected override void OnPreOpen()
|
{
|
GameEvent.playerDataRefreshEvent += OnPlayerDataRefreshEvent;
|
Display();
|
}
|
|
protected override void OnPreClose()
|
{
|
GameEvent.playerDataRefreshEvent -= OnPlayerDataRefreshEvent;
|
}
|
|
#endregion
|
|
void Display()
|
{
|
string source = string.Empty;
|
var keyList = FlowerGiftModel.Instance.charmSourceDict.Keys.ToList();
|
for (int i = 0; i < keyList.Count; i++)
|
{
|
source = source + Language.Get("CharmSource", keyList[i], FlowerGiftModel.Instance.charmSourceDict[keyList[i]]);
|
}
|
|
sourceTxt.text = source;
|
|
curCharmValue.text = FlowerGiftModel.Instance.charmValue.ToString();
|
ShowProp();
|
}
|
|
|
void ShowProp()
|
{
|
var charmLV = (int)PlayerDatas.Instance.GetPlayerDataByType(PlayerDataType.default11);
|
var config = ILLoveCharmConfig.Get(charmLV);
|
var nextConfig = ILLoveCharmConfig.Get(charmLV + 1);
|
var beforeConfig = ILLoveCharmConfig.Get(charmLV - 1);
|
title1.text = config.Name;
|
value1.text = beforeConfig == null ? "0" : beforeConfig.UpNeedCharm.ToString();
|
proptext1.text = GetProp(config);
|
|
if (nextConfig == null)
|
{
|
title2.text = "";
|
value2.text = config.UpNeedCharm.ToString();
|
proptext2.text = Language.Get("L1055");
|
}
|
else
|
{
|
title2.text = nextConfig.Name;
|
value2.text = config.UpNeedCharm.ToString();
|
proptext2.text = GetProp(nextConfig);
|
}
|
}
|
|
string GetProp(ILLoveCharmConfig config)
|
{
|
string propValue = string.Empty;
|
for (int i = 0; i < config.LVAttrType.Length; i++)
|
{
|
propValue += PlayerPropertyConfig.GetFullDescription(config.LVAttrType[i], config.LVAttrValue[i]) + "</r>";
|
}
|
|
if (config.LVAwardItemInfo != string.Empty)
|
{
|
propValue += Language.Get("Charm1", JsonMapper.ToObject<int[][]>(config.LVAwardItemInfo)[0][0]);
|
}
|
|
return propValue;
|
}
|
|
void OnPlayerDataRefreshEvent(PlayerDataType dataType)
|
{
|
if (dataType != PlayerDataType.default11)
|
{
|
return;
|
}
|
ShowProp();
|
}
|
}
|