Ejemplo n.º 1
0
 void FinishCancelCallBack()
 {
     callback_ = null;
     if (_cancelCallBack != null)
     {
         _cancelCallBack();
         _cancelCallBack = null;
     }
     base.hide();
     gameObject.SetActive(false);
 }
Ejemplo n.º 2
0
        public void show(string str, MsgBox.ShowType type = ShowType.OK, MsgBox.CallBack callback = null, UI_LAYER layer = UI_LAYER.COMMON_UI, MsgBox.CancelCallBack cancelCallback = null)
        {
            if (_tip != null)
            {
                _tip.text = str;
            }
            if (string.IsNullOrEmpty(str))
            {
                TyCrashReport.reportException(new System.Exception(), "msgbox content is empty");
            }
            if (callback_ != null)
            {
                base.hide();
                _OpenAgain = true;
            }
            gameObject.SetActive(true);

            {
                gameObject.transform.localPosition = new Vector3(0, 0, -(int)layer);
            }

            UIPanel panel = GetComponent <UIPanel>();

            if (panel != null)
            {
                panel.depth = (int)layer;
            }
            setWinAnimIgnoreTimeScale(Time.timeScale != 1);//如果时间缩放不为1,则需要忽略缩放
            base.show();
            hideAll();
            callback_       = callback;
            _cancelCallBack = cancelCallback;
            if (type == ShowType.OK)
            {
                _goOK.SetActive(true);
            }
            else if (type == ShowType.YesCancel)
            {
                _goYesCancel.SetActive(true);
            }
        }