78 lines
2.0 KiB
C#
78 lines
2.0 KiB
C#
using UnityEngine;
|
|
using System.Collections;
|
|
using UnityEngine.UI;
|
|
using GCGame.Table;
|
|
|
|
// 开服活动页面菜单Item
|
|
public class OpenServiceSubMenuItem : UIItemSelect {
|
|
|
|
public GameObject redPoint; // 红点
|
|
public Image btnBG; // 按钮背景
|
|
public Text btnDesc; // 按钮文字
|
|
public Text hlBtnDesc; // 高亮按钮文字
|
|
public Text reamtinTimeText;
|
|
|
|
private int tagId = -1;
|
|
public int TagID
|
|
{
|
|
get;
|
|
private set;
|
|
}
|
|
|
|
public override void Show(Hashtable hash)
|
|
{
|
|
|
|
MarketingActPacketSubTag data = (MarketingActPacketSubTag)hash["InitObj"];
|
|
if(data != null)
|
|
{
|
|
InitMenu(data);
|
|
base.Show();
|
|
}
|
|
}
|
|
|
|
public void InitMenu(MarketingActPacketSubTag data)
|
|
{
|
|
tagId = data.tagId;
|
|
|
|
if(btnDesc != null && !string.IsNullOrEmpty(data.btnDesc))
|
|
{
|
|
btnDesc.text = StrDictionary.GetServerDictionaryFormatString(data.btnDesc);
|
|
btnDesc.gameObject.SetActive(true);
|
|
|
|
if(hlBtnDesc != null)
|
|
{
|
|
hlBtnDesc.text = btnDesc.text;
|
|
hlBtnDesc.gameObject.SetActive(true);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
btnDesc.gameObject.SetActive(false);
|
|
|
|
if(hlBtnDesc != null)
|
|
{
|
|
hlBtnDesc.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
if (btnBG != null && data.btnIconPath.Count > 0 && !string.IsNullOrEmpty(data.btnIconPath[0]))
|
|
{
|
|
LoadAssetBundle.Instance.SetImageSprite(btnBG, data.btnIconPath[0]);
|
|
}
|
|
|
|
SetRedPoint(data.state);
|
|
}
|
|
|
|
// 设置红点信息
|
|
public void SetRedPoint(int state)
|
|
{
|
|
if(redPoint != null)
|
|
{
|
|
redPoint.gameObject.SetActive(state > 0);
|
|
}
|
|
|
|
if (reamtinTimeText)
|
|
reamtinTimeText.text = (state >= 99 ? 99 : state).ToString();
|
|
}
|
|
}
|