85 lines
2.4 KiB
C#
85 lines
2.4 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using GCGame.Table;
|
|
using Module.Log;
|
|
|
|
// 等级礼包提示UI
|
|
// 用于辅助福利大厅的等级礼包
|
|
// 在玩家可领取的前几级会一直存在与界面中,达到后特定等级才有跳转功能,转至福利大厅相关界面
|
|
public class LevelGiftBagTip : MonoBehaviour {
|
|
|
|
public Button getAward; // 礼包跳转按钮
|
|
public Text desc; // 差距描述
|
|
|
|
private int desLevel = -1; // 目标等级即多少级才能领取礼包
|
|
|
|
private static LevelGiftBagTip instance;
|
|
public static LevelGiftBagTip Instance
|
|
{ get { return instance; } }
|
|
|
|
private void Awake()
|
|
{
|
|
if(instance == null)
|
|
{
|
|
instance = this;
|
|
getAward.onClick.AddListener(OnGetAwardBtnClick);
|
|
}
|
|
}
|
|
|
|
// 该level是差距等级
|
|
public void ShowLevel(int level, int desLevel = -1)
|
|
{
|
|
if(level > 0)
|
|
{
|
|
if(desLevel != -1)
|
|
{
|
|
this.desLevel = desLevel;
|
|
}
|
|
desc.text = StrDictionary.GetClientDictionaryString("#{64003}", level);
|
|
}
|
|
else if(level == 0)
|
|
{
|
|
if(desLevel != -1)
|
|
{
|
|
this.desLevel = desLevel;
|
|
}
|
|
desc.text = StrDictionary.GetClientDictionaryString("#{64004}");
|
|
}
|
|
// 如果是负数,则不正常,直接关闭
|
|
else
|
|
{
|
|
LogModule.ErrorLog("Trying open LevelGiftBagTip, but the level in tip is less than 0, please check !");
|
|
UIManager.CloseUI(UIInfo.LevelGiftBagTip);
|
|
}
|
|
}
|
|
|
|
// 尝试关闭等级礼包提示,条件为当前已领取的最高等级大于目前显示的等级
|
|
public void TryClose(int maxLevel)
|
|
{
|
|
if(maxLevel >= desLevel)
|
|
{
|
|
UIManager.CloseUI(UIInfo.LevelGiftBagTip);
|
|
}
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
instance = null;
|
|
}
|
|
|
|
private void OnGetAwardBtnClick()
|
|
{
|
|
UIManager.ShowUI(UIInfo.WelfareRoot,
|
|
(bool bSuccess, object param) =>
|
|
{
|
|
if(bSuccess)
|
|
{
|
|
// 等级礼包NodeID = 203
|
|
WelfareRootCtr.Instance.OpenWith(251);
|
|
}
|
|
});
|
|
}
|
|
}
|