示例#1
0
 /// <summary>
 /// 显示消息弹窗
 /// </summary>
 /// <param name="style">样式</param>
 /// <param name="handler">点击处理</param>
 /// <param name="title">标题</param>
 /// <param name="content">内容</param>
 /// <param name="ok">OK按钮文本</param>
 /// <param name="cancel">取消按钮文本</param>
 public void ShowMsgBox(UIMsgBoxStyle style, UIMsgBoxDelegate handler, string content, string title = "", string ok = "", string cancel = "")
 {
     if (string.IsNullOrEmpty(content))
     {
         JW.Common.Log.LogE("ShowMsgBox Error Content");
         return;
     }
     if (_msgBox != null)
     {
         UIFormHelper.DisposeFormClass <UIMsgBox>(ref _msgBox);
         _msgBox = null;
     }
     _msgBox = UIFormHelper.CreateResidentFormClass <UIMsgBox>();
     if (_msgBox != null)
     {
         if (string.IsNullOrEmpty(title))
         {
             title = _msgBoxDefaultTitle;
         }
         if (string.IsNullOrEmpty(ok))
         {
             ok = _msgBoxDefaultOk;
         }
         if (string.IsNullOrEmpty(cancel))
         {
             cancel = _msgBoxDefaultCancel;
         }
         _msgBoxHandler = handler;
         _msgBox.InitShow(style, OnMsgBoxResult, title, content, ok, cancel);
     }
 }
示例#2
0
 public void InitShow(UIMsgBoxStyle style, UIMsgBoxDelegate handler, string title, string content, string ok, string cancel)
 {
     _handler = handler;
     if (style == UIMsgBoxStyle.JustOk)
     {
         _uiOkButton.gameObject.SetActive(true);
         _uiCancelButton.gameObject.SetActive(false);
     }
     else
     {
         _uiOkButton.gameObject.SetActive(true);
         _uiCancelButton.gameObject.SetActive(true);
     }
     //
     _uiTitleText.text   = title;
     _uiContentText.text = content;
     _uiOkText.text      = ok;
     _uiCancelText.text  = cancel;
 }