public void HideMessageBox(MB_TYPE mbType) { //this must be a singleton messagebox if (_singletonMessageboxMapping.ContainsKey(mbType)) { _singletonMessageboxMapping[mbType].SetActive(false); } }
public GameObject ShowMessageBox(string text, string caption, string leftStrIDS, string rightStrIDS, MB_TYPE type, UIMessageBox.OnClickCallback clickCallback, params System.Object[] args) { GameObject messageBox; GameObject parent = MessageBoxCamera.Instance.uiCamera.gameObject; switch (type) { case MB_TYPE.MB_OK: messageBox = NGUITools.AddChild(parent, mbOKPrefab); messageBox.GetComponent <UIMessageBox>().LocalizeButtonText(leftStrIDS, null); break; case MB_TYPE.MB_OK_WITH_ITEMS: messageBox = NGUITools.AddChild(parent, mbOKWithItemsPrefab); messageBox.GetComponent <UIMessageBox>().LocalizeButtonText(leftStrIDS, null); break; case MB_TYPE.MB_WAITING_DELAY: messageBox = NGUITools.AddChild(parent, mbWaitingDelayPrefab); break; case MB_TYPE.MB_OKCANCEL: messageBox = NGUITools.AddChild(parent, mbOKCancelPrefab); messageBox.GetComponent <UIMessageBox>().LocalizeButtonText(leftStrIDS, rightStrIDS); break; case MB_TYPE.MB_WAITING: messageBox = NGUITools.AddChild(parent, mbWaitingPrefab); break; case MB_TYPE.MB_INPUT: messageBox = NGUITools.AddChild(parent, mbInputPrefab); break; case MB_TYPE.MB_FLOATING: //check singletons if (_singletonMessageboxMapping.ContainsKey(MB_TYPE.MB_FLOATING)) { messageBox = _singletonMessageboxMapping[MB_TYPE.MB_FLOATING]; if (!messageBox.activeSelf) { messageBox.SetActive(true); } } else { messageBox = NGUITools.AddChild(parent, mbFloatingPrefab); _singletonMessageboxMapping.Add(MB_TYPE.MB_FLOATING, messageBox); } break; default: messageBox = null; Assertion.Check(false); break; } //end switch if (!_singletonMessageboxMapping.ContainsKey(type)) { _messageBoxList.Add(messageBox); } int layer = _messageBoxList.Count; if (type == MB_TYPE.MB_FLOATING) { layer += _singletonMessageboxMapping.Count; } messageBox.transform.localPosition = Vector3.back * layer * 5; UIMessageBox messageboxScript = messageBox.GetComponent <UIMessageBox>(); messageboxScript.SetParams(text, caption, clickCallback, args); return(messageBox); }
public GameObject ShowMessageBox(string text, string caption, MB_TYPE type, UIMessageBox.OnClickCallback clickCallback, params System.Object[] args) { return(ShowMessageBox(text, caption, null, null, type, clickCallback, args)); }
static extern int MessageBox(IntPtr hWnd, string lpText, string lpCaption, MB_TYPE uType);