Exemplo n.º 1
0
        protected override void ShowWidget(IUIDataParams data)
        {
            MessageBoxDataParam messageData = data as MessageBoxDataParam;

            {
                MessageBoxType = messageData.MessageBoxType;

                // ok button
                UIModuleButton okButton = GetButton(0);
                if (okButton != null)
                {
                    okButton.SetActive(true);
                    okButton.Set(OnOkButtonClick);
                }

                // cancel button
                UIModuleButton cancelButton = GetButton(1);
                if (cancelButton != null)
                {
                    cancelButton.SetActive(MessageBoxType == eMessageBoxType.OKAndCancel ? true : false);
                    cancelButton.Set(OnCancelButtonClick);
                }

                // close button
                SetButton(2, OnCancelButtonClick);
            }

            SetText(Title, messageData.TitleText);
            SetText(Message, messageData.MessageText);

            m_completed = messageData.CompletedAction;
        }
Exemplo n.º 2
0
        public void ShowMessageBox(string title, string message, eMessageBoxType messageBoxType,
                                   System.Action <bool> completed = null, float activeTime = 0.0f)
        {
            MessageBoxWidget widget =
                m_widgetRepositories.FindWidget("MessageBoxWidget") as MessageBoxWidget;

            if (widget == null)
            {
                widget = m_widgetRepositories.CreateWidget <MessageBoxWidget>("System/MessageBoxWidget");
            }

            if (widget != null)
            {
                if (widget.IsActive == true)
                {
                    m_messageBoxQueue.Enqueue(
                        new MessageBoxDataParam(title, message, messageBoxType, completed, activeTime));
                }
                else
                {
                    MessageBoxDataParam messageBoxDataParam =
                        new MessageBoxDataParam(title, message, messageBoxType, completed, activeTime);
                    widget.Show(activeTime, messageBoxDataParam);
                }
            }
        }
Exemplo n.º 3
0
        protected void ClearMessageBoxQueue()
        {
            if (m_messageBoxQueue.Any() == false)
            {
                return;
            }

            for (int i = 0; i < m_messageBoxQueue.Count; ++i)
            {
                MessageBoxDataParam messageBoxDataParam = m_messageBoxQueue.Dequeue();
                if (messageBoxDataParam != null)
                {
                    messageBoxDataParam.Dispose();
                }
            }

            m_messageBoxQueue.Clear();
        }
Exemplo n.º 4
0
        protected void UpdateMessageBoxQueue(float delta)
        {
            if (m_messageBoxQueue.Any() == false)
            {
                return;
            }

            MessageBoxWidget widget = m_widgetRepositories.FindWidget("MessageBoxWidget") as MessageBoxWidget;

            if (widget != null && widget.IsGameOjectActive != true)
            {
                MessageBoxDataParam messageBoxDataParam = m_messageBoxQueue.Dequeue();
                if (messageBoxDataParam != null)
                {
                    widget.Show(messageBoxDataParam.ActiveTime, messageBoxDataParam);
                }
                messageBoxDataParam.Dispose();
            }
        }