Files
JJBB/Assets/Project/Script/GUI/MeridiaSoul/BossBookLvUpTips.cs
2024-08-23 15:49:34 +08:00

136 lines
4.2 KiB
C#

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using GCGame.Table;
using System;
using Module.Log;
public class BossBookLvUpTips : UIControllerBase<BossBookLvUpTips>
{
#region show boss lv up
public static void ShowBossLvUpStatic(HandbookBossInfo bossInfo, Tab_BossHandBook curLevel, Tab_BossHandBook nextLevel)
{
UIManager.ShowUI(UIInfo.BossBookLvUpTips, delegate (bool bSucess, object param) {
if (bSucess)
{
BossBookLvUpTips.Instance().ShowBossLvUp(bossInfo, curLevel, nextLevel);
}
});
}
public void OnEnable()
{
SetInstance(this);
}
public void OnDisable()
{
SetInstance(null);
}
#endregion
public Image _Icon;
public Text _CurLevel;
public Text _NextLevel;
public Text _CurAttr;
public Text _NextAttr;
public Image _CostTypeIcon;
public Text _CostValue;
public GameObject _LvUpPanel;
public GameObject _MaxPanel;
public Text _MaxLevel;
private HandbookBossInfo _BossInfo;
private Tab_BossHandBook _NextLevelTab;
public void ShowBossLvUp(HandbookBossInfo bossInfo, Tab_BossHandBook curLevel, Tab_BossHandBook nextLevel)
{
_BossInfo = bossInfo;
_NextLevelTab = nextLevel;
if (curLevel == null)
{
LoadAssetBundle.Instance.SetImageSprite(_Icon, nextLevel.Icon);
var attrName = PropID.GetAttrName((PropID.PropertyID)nextLevel.PropId[0], -1, 0);
_CurAttr.text = attrName + "+" + 0;
_CurLevel.text = StrDictionary.GetClientDictionaryString("#{8113}", 0);
}
else
{
LoadAssetBundle.Instance.SetImageSprite(_Icon, curLevel.Icon);
var attrName = PropID.GetAttrName((PropID.PropertyID)curLevel.PropId[0], -1, curLevel.PropVal[0]);
_CurAttr.text = attrName + "+" + curLevel.PropVal[0];
_CurLevel.text = StrDictionary.GetClientDictionaryString("#{8113}", curLevel.Level);
}
if (nextLevel != null)
{
_LvUpPanel.SetActive(true);
_MaxPanel.SetActive(false);
var attrName = PropID.GetAttrName((PropID.PropertyID)nextLevel.PropId[0], -1, nextLevel.PropVal[0]);
_NextAttr.text = attrName + "+" + nextLevel.PropVal[0];
_NextLevel.text = StrDictionary.GetClientDictionaryString("#{8113}", nextLevel.Level);
LoadAssetBundle.Instance.SetImageSprite(_CostTypeIcon, UICurrencyItem.GetCurrencySprite((MONEYTYPE)nextLevel.CostSubType));
long ownValue = GameManager.gameManager.PlayerDataPool.GetLongPropty(nextLevel.CostType, nextLevel.CostSubType);
string numStr = _NextLevelTab.CostCount.ToString();
if (ownValue >= _NextLevelTab.CostCount)
{
numStr = StrDictionary.GetClientDictionaryString("#{5525}") + numStr + "</color>";
}
else
{
numStr = StrDictionary.GetClientDictionaryString("#{5526}") + numStr + "</color>";
}
_CostValue.text = ownValue.ToString() + "/" + numStr;
}
else
{
_LvUpPanel.SetActive(false);
_MaxPanel.SetActive(true);
_MaxLevel.text = StrDictionary.GetClientDictionaryString("#{49202}");
}
}
public void OnBtnClose()
{
UIManager.CloseUI(UIInfo.BossBookLvUpTips);
}
public void OnBtnLevelUp()
{
if (_NextLevelTab == null)
return;
var ownValue = GameManager.gameManager.PlayerDataPool.GetLongPropty(_NextLevelTab.CostType, _NextLevelTab.CostSubType);
if (_NextLevelTab.CostCount > ownValue)
{
MessageBoxLogic.OpenOKCancelBox(StrDictionary.GetClientDictionaryString("#{49201}", _NextLevelTab.CostCount), null, delegate ()
{
LevelUpOk();
}, null);
}
else
{
LevelUpOk();
}
}
private void LevelUpOk()
{
ReqHandbookBossPromote packet = new ReqHandbookBossPromote();
packet.BossId = _BossInfo.BossId;
packet.SendMsg();
OnBtnClose();
}
}