84 lines
1.8 KiB
C#
84 lines
1.8 KiB
C#
|
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using System.Collections;
|
|||
|
using Games.GlobeDefine;
|
|||
|
using GCGame.Table;
|
|||
|
using GCGame;
|
|||
|
|
|||
|
public class MessageInputLogic : UIControllerBase<MessageInputLogic>
|
|||
|
{
|
|||
|
#region static
|
|||
|
|
|||
|
public static void ShowMessageInput(string defaultStr, string title, MessageResult okCallBack)
|
|||
|
{
|
|||
|
Hashtable hash = new Hashtable();
|
|||
|
hash.Add("DefaultStr", defaultStr);
|
|||
|
hash.Add("Title", title);
|
|||
|
hash.Add("OKCallBack", okCallBack);
|
|||
|
UIManager.ShowUI(UIInfo.MessageInput, OnMessageInputShow, hash);
|
|||
|
}
|
|||
|
|
|||
|
static void OnMessageInputShow(bool bSuccess, object param)
|
|||
|
{
|
|||
|
Hashtable hash = param as Hashtable;
|
|||
|
if (!bSuccess)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
if (hash == null)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
if (Instance() != null)
|
|||
|
{
|
|||
|
Instance().Show((string)hash["DefaultStr"], (string)hash["Title"], (MessageResult)hash["OKCallBack"]);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
public Text _Title;
|
|||
|
public InputField _InputFiels;
|
|||
|
|
|||
|
public delegate void MessageResult(string resultStr);
|
|||
|
private MessageResult _MessageResult;
|
|||
|
|
|||
|
void OnEnable()
|
|||
|
{
|
|||
|
SetInstance(this);
|
|||
|
}
|
|||
|
|
|||
|
void OnDisable()
|
|||
|
{
|
|||
|
SetInstance(null);
|
|||
|
}
|
|||
|
|
|||
|
public void Show(string defaultStr, string title, MessageResult okCallBack)
|
|||
|
{
|
|||
|
_InputFiels.text = defaultStr;
|
|||
|
_MessageResult = okCallBack;
|
|||
|
_Title.text = title;
|
|||
|
}
|
|||
|
|
|||
|
public void MessageBoxOK()
|
|||
|
{
|
|||
|
UIManager.CloseUI(UIInfo.MessageInput);
|
|||
|
if (null != _MessageResult)
|
|||
|
{
|
|||
|
_MessageResult(_InputFiels.text);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void MessageBoxCancel()
|
|||
|
{
|
|||
|
UIManager.CloseUI(UIInfo.MessageInput);
|
|||
|
if (null != _MessageResult)
|
|||
|
{
|
|||
|
_MessageResult(null);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|