示例#1
0
        /// <summary>
        /// 自定义消息框  不能被用户调用触发,只能被消息系统内部调用
        /// </summary>
        /// <param name="request"></param>
        /// <param name="handle"></param>
        public static BaseMessageBox Show(MessageBoxResquest request, MessageBoxCallback handle, int id = -1)
        {
            BaseMessageBox result       = null;
            GameObject     _boxResource = null;

            switch (request.m_MSGType)
            {
            case MessageBoxResquest.MessageType.Information:
                #region 弹出提示框
                if (MsgBoxPool != null)
                {
                    result = MsgBoxPool.GetInstance("UIMessageBox", MessageBoxResquest.MessageType.Information, null, (messageBox) =>
                    {
                        //Debug.Log("AAAAAAAAAAAAAAAAAAAAAAAAA " + messageBox.gameObject.name + " ::" + messageBox.BoxLevel);
                        messageBox.Show(request, handle, id);
                    });
                }
                break;

                #endregion
            case MessageBoxResquest.MessageType.InputBox:
                #region 弹出输入框
                _boxResource = Resources.Load <GameObject>("Prefabs/UI/MessageBox/UIInputMessageBox");
                if (_boxResource != null)
                {
                    GameObject  box       = GameObject.Instantiate(_boxResource);
                    IMessageBox _imessage = box.GetComponent <IMessageBox>();
                    _imessage.Show(request, handle);
                }
                #endregion
                break;

            case MessageBoxResquest.MessageType.SystemBroadcast:
                #region 弹出走马灯效果
                if (UISystemMessageBox.Instance == null)
                {
                    _boxResource = Resources.Load <GameObject>("Prefabs/UI/MessageBox/UISystemBroadcast");
                    if (_boxResource != null)
                    {
                        GameObject  box       = GameObject.Instantiate(_boxResource);
                        IMessageBox _imessage = box.GetComponent <IMessageBox>();
                        _imessage.Show(request, handle);
                    }
                }
                else
                {
                    UISystemMessageBox.Instance.Show(request, handle);
                }

                #endregion
                break;

            case MessageBoxResquest.MessageType.TipsBox:
                #region 弹出提示框
                ////_boxResource = Resources.Load<GameObject>("Prefabs/UI/MessageBox/UITipBox");
                ////if (_boxResource != null)
                ////{
                ////    GameObject box = GameObject.Instantiate(_boxResource);
                ////    result = box.GetComponent<BaseMessageBox>();
                ////    result.Show(request, handle);
                ////}

                #region 弹出提示框
                if (MsgBoxPool != null)
                {
                    result = MsgBoxPool.GetInstance("UITipBox", MessageBoxResquest.MessageType.TipsBox, null, (tipBox) => { tipBox.Show(request, handle, id); });      //对象池中没有类型标示获得的池对象类型不对
                }
                #endregion
                #endregion
                break;

            case MessageBoxResquest.MessageType.ProgressBar:
                #region 弹出进度匡
                _boxResource = Resources.Load <GameObject>("Prefabs/UI/MessageBox/UIProgressBox");
                if (_boxResource != null)
                {
                    GameObject  box       = GameObject.Instantiate(_boxResource);
                    IMessageBox _imessage = box.GetComponent <IMessageBox>();
                    _imessage.Show(request, handle);
                }

                #endregion
                break;

            case MessageBoxResquest.MessageType.SystemWait:
                #region 弹出系统等待框
                _boxResource = Resources.Load <GameObject>("Prefabs/UI/MessageBox/UISystemWaitBox");
                if (_boxResource != null)
                {
                    GameObject  box       = GameObject.Instantiate(_boxResource);
                    IMessageBox _imessage = box.GetComponent <IMessageBox>();
                    _imessage.Show(request, handle);
                }
                #endregion
                break;

            case MessageBoxResquest.MessageType.VRBrocard:
                #region 显示公告板内容
                MessageBoxModel.GetInstance().ShowVRBrocardMessage(request, handle);
                #endregion
                break;

            case MessageBoxResquest.MessageType.SystemTip:
                #region 显示系统提示框
                _boxResource = Resources.Load <GameObject>("Prefabs/UI/MessageBox/UISystemTip");
                if (_boxResource != null)
                {
                    GameObject  box       = GameObject.Instantiate(_boxResource);
                    IMessageBox _imessage = box.GetComponent <IMessageBox>();
                    _imessage.Show(request, handle);
                }
                #endregion
                break;
            }

            return(result);
        }