Ejemplo n.º 1
0
 public override void Show(MessageBoxResquest _request, MessageBoxCallback _listener, int id = -1)
 {
     base.Show(_request, _listener);
     if (_request == null)
     {
         Hide(); return;
     }
     if (m_ProgressBar != null)
     {
         m_ProgressBar.fillAmount = _request.m_Progress;
         m_Progress.text          = (int)(_request.m_Progress * 100) + "%";
         if (Mathf.Abs(_request.m_Progress - 1) <= 0.01f)
         {
             if (_listener != null)
             {
                 _listener(response);
             }
             Hide();
         }
     }
     if (m_Title != null)
     {
         m_Title.text = _request.m_Title;
     }
     if (m_MessageTip != null)
     {
         m_MessageTip.text = _request.m_MessageInfor;  //提示信息
     }
 }
Ejemplo n.º 2
0
 public MsgBox(MessageBoxResquest req, MessageBoxCallback _call)
 {
     request           = req;
     callBack          = _call;
     BoxID             = BoxIDRecord;
     BaseMessageBoxObj = null;
 }
        public override void Show(MessageBoxResquest _request, MessageBoxCallback _listener, int id = -1)
        {
            base.Show(_request, _listener);
            if (_request == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(_request.m_MessageInfor) == false)
            {
                m_AllSystemMessage.Add(_request.m_MessageInfor); //压入消息
                                                                 // Debug.Log("新来的消息长度 " + (_request.m_MessageInfor).Length);
                m_MessageText.text += "\n" + _request.m_MessageInfor;

                if (_request.m_AutoClip)
                {                               //自动裁减  弹出最上层的消息 ***需要优化
                    StartCoroutine(AutoSize()); //*********不能直接在这里使用While循环 否则会在一帧内执行完 弹出所有的输入
                }
                else
                {
                    if (m_AllSystemMessage.Count > _request.m_MaxMsgCout && _request.m_MaxMsgCout > 0)
                    {                                           //对于超过数量的消息自动弹出最上层的消息
                        string _oldStr = m_AllSystemMessage[0]; //取第一个元素
                        _oldStr = _oldStr + "\n";
                        string _newStr     = m_MessageText.text;
                        int    totalLength = _newStr.Length;
                        int    deleteIndex = _oldStr.Length;
                        //   Debug.Log(_oldStr + "弹出的长度是 " + deleteIndex);
                        m_MessageText.text = _newStr.Substring(deleteIndex, totalLength - deleteIndex);
                        m_AllSystemMessage.RemoveAt(0);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public override void Show(MessageBoxResquest _request, MessageBoxCallback _listener, int id = -1)
        {
            base.Show(_request, _listener);
            if (_request == null)
            {
                Hide(); return;
            }
            _request.m_IsModel = true;   //等待框一定是模态的

            //MessageBoxModel.GetInstance().ModelMessageBoxRegest(this, true);

            if (m_Message != null)
            {
                m_Message.text = string.IsNullOrEmpty(_request.m_MessageInfor) ? "" : _request.m_MessageInfor;  //默认显示“”
            }
            EventCenter.GetInstance().AddUpdateEvent(AutoFillSize, EventCenter.UpdateRate.DelayTwooFrame);
            EventCenter.GetInstance().AddUpdateEvent(Waitting, EventCenter.UpdateRate.DelayTwooFrame);  //自旋转

            if (_request.m_DispearTime <= 0)
            {
                Debug.Log("等待时间太短!");
                _request.m_DispearTime = 1f;
            }

            StartCoroutine(AutoWait(_request.m_DispearTime));   //进入等待模式
            transform.SetParent(EventCenter.GetInstance().m_UIRoot);
            transform.localPosition = new Vector3(0, 0, 0.5f);
            transform.localRotation = Quaternion.identity;
        }
Ejemplo n.º 5
0
 public override void Show(MessageBoxResquest _request, MessageBoxCallback _listener, int id = -1)
 {
     base.Show(_request, _listener);
     if (_request == null)
     {
         return;
     }
     if (string.IsNullOrEmpty(_request.m_MessageInfor) == false)
     {
         if (_request.m_Highpriority)
         { //优先显示
             Debug.Log("优先显示");
             List <string> _newList = new List <string>(systemInfor.Count + 1);
             _newList.Add(_request.m_MessageInfor);  //压入数据
             for (int _index = 0; _index < systemInfor.Count; _index++)
             {
                 _newList.Add(systemInfor[_index]);
             }//for
             systemInfor.Clear();
             systemInfor = _newList;
         }//if
         else
         { //顺序显示
             systemInfor.Add(_request.m_MessageInfor);  //压入数据
         }
     }
     transform.position = _request.m_WorldPosition;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// VR 公告广播
 /// </summary>
 /// <param name="msg">要显示的消息</param>
 /// <param name="handle"></param>
 /// <param name="request"></param>
 public static void VRBrocard(string msg, MessageBoxCallback handle, MessageBoxResquest request)
 {
     if (request == null)
     {
         return;
     }
     request.m_MSGType      = MessageBoxResquest.MessageType.VRBrocard;
     request.m_MessageInfor = msg;
     Show(request, handle);
 }
Ejemplo n.º 7
0
        /// <summary>
        /// 显示一个自动滚动的进度条 它不能定义一个时间间隔自动关闭
        /// </summary>
        /// <param name="title"></param>
        /// <param name="msg"></param>
        /// <param name="handle"></param>
        /// <param name="request"></param>
        public static void Progress(float progress, MessageBoxCallback handle, MessageBoxResquest request)
        {
            if (request == null)
            {
                return;
            }
            request.m_MSGType  = MessageBoxResquest.MessageType.ProgressBar;
            request.m_Progress = progress;

            Show(request, handle);
        }
Ejemplo n.º 8
0
 void OnSceneLoadOver()
 {
     Debug.Log("OnSceneLoadOver..... MessageBoxModel");
     if (!string.IsNullOrEmpty(m_SystemNotify))
     {
         MessageBoxResquest resque = new MessageBoxResquest();
         resque.m_WorldPosition = UIMessageBox.ShowDefaultPosition;
         MessageBox.SystemTip(m_SystemNotify, 3f, null, resque);  //弹出系统弹框 3秒后消失
         m_SystemNotify = "";
     }
 }
Ejemplo n.º 9
0
 /// <summary>
 /// 显示一个垂直拉伸的提示框 几秒后自动消失
 /// </summary>
 /// <param name="msg"></param>
 /// <param name="dispearTime"></param>
 /// <param name="handle"></param>
 /// <param name="request"></param>
 public static void SystemTip(string msg, float dispearTime, MessageBoxCallback handle, MessageBoxResquest request)
 {
     //if (request == null) return;
     if (request == null)
     {
         request = new MessageBoxResquest();
     }
     request.m_MSGType      = MessageBoxResquest.MessageType.SystemTip;
     request.m_MessageInfor = msg;
     request.m_DispearTime  = dispearTime;
     Show(request, handle);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// 显示系统公告板消息
 /// </summary>
 /// <param name="request">消息请求</param>
 /// <param name="handle">消息回调</param>
 public void ShowVRBrocardMessage(MessageBoxResquest request, MessageBoxCallback handle)
 {
     //if (m_AllVRBrocard.Count < 1)
     //{
     //    return;
     //}
     //for (int _index = 0; _index < m_AllVRBrocard.Count; _index++)
     //{
     //    if (m_AllVRBrocard[_index] != null)
     //    {
     //        m_AllVRBrocard[_index].Show(request, handle);
     //    }
     //}
 }
Ejemplo n.º 11
0
        public override void Show(MessageBoxResquest _request, MessageBoxCallback _listener, int id = -1)
        {
            base.Show(_request, _listener, id);
            UITipMessageBox previous = null;

            if (CheckExitAndShowing(this, out previous))
            {  //There is one Tipe Exit
                if (previous != null)
                {
                    if (previous.gameObject.activeSelf)
                    {
                        previous.Hide();
                    }
                    else
                    {
                        allUITipMessageBoxList.Remove(previous);

                        if (MessageBox.MsgBoxPool != null)
                        {
                            MessageBox.MsgBoxPool.Recycle(previous, MessageBoxResquest.MessageType.TipsBox, (tips) => { tips.Reset(); });
                        }
                    }
                }//if
            }

            allUITipMessageBoxList.Add(this);

            if (gameObject.activeSelf == false)
            {
                gameObject.SetActive(true);
            }
            if (_request == null)
            {
                Hide();
                return;
            }
            ;
            m_TopCanvasTrans.SetParent(_request.m_Parent);                //父节点
            m_TopCanvasTrans.localScale       = _request.m_Scale;         //缩放
            m_TopCanvasTrans.localPosition    = _request.m_WorldPosition; //要显示的位置
            m_TopCanvasTrans.localEulerAngles = _request.m_Angle;         //要显示的位置

            if (_request.m_DispearTime >= 0)
            {
                StartCoroutine(AutoHide(_request.m_DispearTime));
            }

            ShowMsg();
        }
Ejemplo n.º 12
0
        public override void Show(MessageBoxResquest _request, MessageBoxCallback _listener, int id = -1)
        {
            base.Show(_request, _listener, id);
            if (_request == null)
            {
                Hide(); return;
            }
            BoxLevel = _request.m_BoxLevel;

            m_Message.alignment = _request.m_MsgTextAnchor;

            SetButtonStateBaseOnType(_request.m_MSGBtn);
            if (_request.m_MSGBtn == MessageBoxResquest.MessageBoxButton.YES)
            {
                _request.m_IsModel = true;   //自动为模态
            }
            ShowMsg();

            #region AutoHide

            if (_request.m_DispearTime != 0)
            {
                duration = _request.m_DispearTime;       //持续时间
                InvokeRepeating("UpdateTickView", 1, 1); //自动更新
                m_UIEffect1Text.text += (int)(_request.m_DispearTime + 0.5f);
                gridLayout.cellSize   = new Vector2(306, 76);
                StartCoroutine(AutoHide(_request.m_DispearTime));
            }
            else
            {
                gridLayout.cellSize = new Vector2(214, 86);
            }
            #endregion

            transform.SetParent(EventCenter.GetInstance().m_UIRoot);
            if (_request.m_WorldPosition != ShowDefaultPosition)
            {
                transform.position = _request.m_WorldPosition;  //自定义位置
            }
            else
            {
                transform.localPosition = ShowDefaultPosition;
            }

            transform.localPosition = _request.m_WorldPosition;
            transform.localRotation = Quaternion.identity;
            EventCenter.GetInstance().AddUpdateEvent(FollowCamera, EventCenter.UpdateRate.NormalFrame);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Post Request To Dic And Select The Special One To Show
        /// </summary>
        /// <param name="request"></param>
        /// <param name="callBack"></param>
        public void ShowMessageBox(MessageBoxResquest request, MessageBoxCallback callBack)
        {
            if (request == null)
            {
                return;
            }
            MsgBox _box = new MsgBox(request, callBack);

            if (AllPopMsgBoxCache.ContainsKey(request.m_BoxLevel) == false)
            {
                AllPopMsgBoxCache[request.m_BoxLevel] = new List <MsgBox>();
            }

            //***TopLevel Msg Need TODO
            AllPopMsgBoxCache[request.m_BoxLevel].Add(_box);

            ++TotalBoxWaitingCot;
            ++BoxIDRecord; //Idetify One Box
            GetMessageBoxToShow(_box);
        }
        public override void Show(MessageBoxResquest _request, MessageBoxCallback _listener, int id = -1)
        {
            base.Show(_request, _listener);
            if (gameObject.activeSelf == false)
            {
                gameObject.SetActive(true);
            }
            if (_request == null)
            {
                Hide();
                return;
            }
            ;
            m_TopCanvasTrans.SetParent(EventCenter.GetInstance().m_UIRoot); //父节点
            m_TopCanvasTrans.localScale       = Vector3.one / 1000;
            m_TopCanvasTrans.localPosition    = _request.m_WorldPosition;   //要显示的位置
            m_TopCanvasTrans.localEulerAngles = _request.m_Angle;           //要显示的位置

            if (_request.m_DispearTime == 0)
            {
                _request.m_DispearTime = 0;  //默认显示
            }
            if (isShowIng == false)
            {
                StartCoroutine(AutoHide(_request.m_DispearTime));
            }
            else
            {//正在显示
                StopCoroutine("AutoHide");
                StartCoroutine(AutoHide(_request.m_DispearTime));
            }
            m_TipMessage.text = _request.m_MessageInfor;


            EventCenter.GetInstance().AddUpdateEvent(AutoFillSize, EventCenter.UpdateRate.DelayOneFrame);
            EventCenter.GetInstance().AddUpdateEvent(FaceToCamera, EventCenter.UpdateRate.DelayOneFrame);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 显示一个输入框 有两个按钮和一个输入框接口输入
        /// </summary>
        /// <param name="title"></param>
        /// <param name="msg"></param>
        /// <param name="handle"></param>
        /// <param name="request"></param>
        /// <param name="multiline">是否是多行文本框 默认是单行</param>
        /// <param name="defaultStr">输入框默认显示的文本</param>
        public static void GetInput(string title, string msg, MessageBoxCallback handle, MessageBoxResquest request, bool multiline = false, string defaultStr = "")
        {
            if (request == null)
            {
                return;
            }

            request.m_MSGType              = MessageBoxResquest.MessageType.InputBox;
            request.m_MSGBtn               = MessageBoxResquest.MessageBoxButton.YESNO;
            request.m_Title                = title;
            request.m_MessageInfor         = msg;
            request.m_multilineInpt        = multiline;  //是否多行
            request.m_InputFilePlaceholder = defaultStr; //默认显示的输入

            Show(request, handle);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 显示一个确认信息框  有两个按钮
        /// </summary>
        /// <param name="title"></param>
        /// <param name="msg"></param>
        /// <param name="handle">回调</param>
        /// <param name="request">其他额外设置</param>
        public static void Confirm(string title, string msg, MessageBoxCallback handle, MessageBoxResquest request)
        {
            if (request == null)
            {
                return;
            }
            request.m_MSGType      = MessageBoxResquest.MessageType.Information;
            request.m_MSGBtn       = MessageBoxResquest.MessageBoxButton.YESNO;
            request.m_Title        = title;
            request.m_MessageInfor = msg;

            MessageBoxModel.GetInstance().ShowMessageBox(request, handle);
        }
Ejemplo n.º 17
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);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 显示一个模态系统等待框
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="waitTime">事件必须大于0</param>
        /// <param name="handle"></param>
        /// <param name="request"></param>
        public static void SystemWait(string msg, float waitTime, MessageBoxCallback handle, MessageBoxResquest request)
        {
            if (request == null)
            {
                return;
            }
            request.m_MSGType      = MessageBoxResquest.MessageType.SystemWait;
            request.m_MessageInfor = msg;
            request.m_DispearTime  = waitTime;
            request.m_IsModel      = true;

            Show(request, handle);
        }
Ejemplo n.º 19
0
 /// <summary>
 /// 显示一个水平拉伸提示框 无法操作并且会自动消失
 /// </summary>
 /// <param name="msg"></param>
 /// <param name="despearTime">自动消失时间</param>
 /// <param name="parent">父节点</param>
 /// <param name="handle"></param>
 /// <param name="request"></param>
 /// <param name="msgParameter">消息显示区域的参数设置</param>
 public static void Tips(string msg, float dispearTime, Transform parent, MessageBoxCallback handle, MessageBoxResquest request, params object[] msgParameter)
 {
     if (request == null)
     {
         return;
     }
     request.m_MSGType      = MessageBoxResquest.MessageType.TipsBox;
     request.m_MessageInfor = msg;
     request.m_MsgParameter = msgParameter;
     request.m_DispearTime  = dispearTime;
     request.m_Parent       = parent;
     Show(request, handle);
 }
Ejemplo n.º 20
0
 /// <summary>
 /// 系统滚动条广播
 /// </summary>
 /// <param name="msg"></param>
 /// <param name="highpriority">是否是高优先级</param>
 /// <param name="handle"></param>
 /// <param name="request"></param>
 public static void SystemBrocard(string msg, bool highpriority, MessageBoxCallback handle, MessageBoxResquest request)
 {
     if (request == null)
     {
         return;
     }
     request.m_MSGType      = MessageBoxResquest.MessageType.SystemBroadcast;
     request.m_MessageInfor = msg;
     request.m_Highpriority = highpriority;
     Show(request, handle);
 }
Ejemplo n.º 21
0
 /// <summary>
 /// 显示
 /// </summary>
 public virtual void Show(MessageBoxResquest _request, MessageBoxCallback _listener, int id = -1)
 {
     handle   = _listener;
     request  = _request;
     MsgBoxID = id;
 }