using UnityEngine; using UnityEngine.UI; using System.Collections; using Games.GlobeDefine; using GCGame.Table; using GCGame; public class SwornBroTitleInputRoot : UIControllerBase { #region static public static void ShowCommonTitleInput(MessageResult okCallBack) { Hashtable hash = new Hashtable(); hash.Add("OKCallBack", okCallBack); UIManager.ShowUI(UIInfo.SwornBroTitleInputRoot, OnCommonTitleInputShow, hash); } static void OnCommonTitleInputShow(bool bSuccess, object param) { Hashtable hash = param as Hashtable; if (!bSuccess) { return; } if (hash == null) { return; } if (SwornBroTitleInputRoot.Instance() != null) { SwornBroTitleInputRoot.Instance().ShowCommonTitle((MessageResult)hash["OKCallBack"]); } } public static void ShowSelfTitleInput(MessageResult okCallBack) { Hashtable hash = new Hashtable(); hash.Add("OKCallBack", okCallBack); UIManager.ShowUI(UIInfo.SwornBroTitleInputRoot, OnSelfTitleInputShow, hash); } static void OnSelfTitleInputShow(bool bSuccess, object param) { Hashtable hash = param as Hashtable; if (!bSuccess) { return; } if (hash == null) { return; } if (SwornBroTitleInputRoot.Instance() != null) { SwornBroTitleInputRoot.Instance().ShowSelfTitle((MessageResult)hash["OKCallBack"]); } } #endregion public GameObject _CommonTitle; public Text _MemCnt; public InputField _InputForward; public InputField _InputBack; public GameObject _SelfTitle; public InputField _InputSelf; public delegate void MessageResult(string titleStr); private MessageResult _MessageResult; void OnEnable() { SetInstance(this); } void OnDisable() { SetInstance(null); } public void OnForwardInput(string input) { if (input.Length > 4) { _InputForward.text = input.Substring(0, 4); } } public void OnBackInput(string input) { if (input.Length > 2) { _InputBack.text = input.Substring(0, 2); } } public void OnSelfInput(string input) { if (input.Length > 2) { _InputSelf.text = input.Substring(0, 2); } } public void ShowCommonTitle(MessageResult messageResult) { _CommonTitle.SetActive(true); _SelfTitle.SetActive(false); _MessageResult = messageResult; _InputForward.text = ""; _InputBack.text = ""; int strID = 4719 + GameManager.gameManager.PlayerDataPool.TeamInfo.GetTeamMemberCount(); _MemCnt.text = StrDictionary.GetClientDictionaryString("#{" + strID.ToString() + "}"); } public void ShowSelfTitle(MessageResult messageResult) { _CommonTitle.SetActive(false); _SelfTitle.SetActive(true); _MessageResult = messageResult; } public void MessageBoxOK() { if (null != _MessageResult) { if (_CommonTitle.activeSelf) { if (string.IsNullOrEmpty(_InputForward.text) || string.IsNullOrEmpty(_InputBack.text)) { GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{36103}")); } else { _MessageResult(_InputForward.text + _MemCnt.text + _InputBack.text); UIManager.CloseUI(UIInfo.SwornBroTitleInputRoot); } } else { if (string.IsNullOrEmpty(_InputSelf.text)) { GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{36103}")); } else { _MessageResult(_InputSelf.text); UIManager.CloseUI(UIInfo.SwornBroTitleInputRoot); } } } } public void MessageBoxCancel() { UIManager.CloseUI(UIInfo.SwornBroTitleInputRoot); if (null != _MessageResult) { _MessageResult(null); } } }