84 lines
1.9 KiB
C#
84 lines
1.9 KiB
C#
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using System.Collections;
|
|
using Games.GlobeDefine;
|
|
using GCGame.Table;
|
|
using GCGame;
|
|
|
|
public class MessageHelpLogic : UIControllerBase<MessageHelpLogic>
|
|
{
|
|
#region start
|
|
|
|
public static void ShowHelpMessage(int messageID)
|
|
{
|
|
UIManager.ShowUI(UIInfo.MessageHelp, ShowHelpMessageFinish, messageID);
|
|
}
|
|
|
|
public static void ShowHelpMessageFinish(bool bSuccess, object param)
|
|
{
|
|
int messageID = (int)param;
|
|
|
|
MessageHelpLogic.Instance().ShowHelpMessageInner(messageID);
|
|
}
|
|
|
|
public void Awake()
|
|
{
|
|
SetInstance(this);
|
|
}
|
|
|
|
public void OnDestory()
|
|
{
|
|
SetInstance(null);
|
|
}
|
|
|
|
//void Update()
|
|
//{
|
|
// _BGTransform.sizeDelta = new Vector2(_AttrContainer.sizeDelta.x + 40, _AttrContainer.sizeDelta.y + 40);
|
|
//}
|
|
|
|
public void CloseWindow()
|
|
{
|
|
UIManager.CloseUI(UIInfo.MessageHelp);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region
|
|
|
|
public Text _MessageTitle;
|
|
//public RectTransform _AttrContainer;
|
|
//public RectTransform _BGTransform;
|
|
public GameObject[] _AttrPanel;
|
|
public Text[] _AttrText;
|
|
|
|
public void ShowHelpMessageInner(int messageID)
|
|
{
|
|
var tabMessage = TableManager.GetHelpMessageByID(messageID, 0);
|
|
if (tabMessage == null)
|
|
{
|
|
CloseWindow();
|
|
return;
|
|
}
|
|
|
|
_MessageTitle.text = tabMessage.Title;
|
|
int maxTips = Mathf.Min(tabMessage.getMessageCount(), _AttrPanel.Length);
|
|
for (int i = 0; i < maxTips; ++i)
|
|
{
|
|
string tipStr = tabMessage.GetMessagebyIndex(i);
|
|
if (string.IsNullOrEmpty(tipStr) || tipStr.Length < 2)
|
|
{
|
|
_AttrPanel[i].SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
_AttrPanel[i].SetActive(true);
|
|
_AttrText[i].text = tipStr;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
}
|