Пример #1
0
        /// <summary>
        /// Makes info window not visible
        /// </summary>
        public void Hide()
        {
            gameObject.SetActive(false);

            if (null != InfoWindowActions && InfoWindowActions.Count > 0)
            {
                //Show next data
                InfoWindowData data = InfoWindowActions.Dequeue();
                Show(data.Text, data.OnConfirmAction, data.OnCancelAction, data.Type);
            }
        }
Пример #2
0
        private void Show(string text, UnityAction onConfirmAction, UnityAction onCancelAction, InfoWindowType type)
        {
            if (true == gameObject.GetActive())
            {
                //Info window is already active, store show action so it can be displayed after user closes window
                if (null == InfoWindowActions)
                {
                    InfoWindowActions = new Queue <InfoWindowData>();
                }

                InfoWindowData data = new InfoWindowData();
                data.Text            = text;
                data.OnConfirmAction = onConfirmAction;
                data.OnCancelAction  = onCancelAction;
                data.Type            = type;

                InfoWindowActions.Enqueue(data);
            }
            else
            {
                switch (type)
                {
                case InfoWindowType.Text:
                    CancelButton.gameObject.SetActive(false);
                    ConfirmationButton.gameObject.SetActive(false);
                    break;

                case InfoWindowType.Ok:
                    CancelButton.gameObject.SetActive(false);
                    ConfirmationButton.gameObject.SetActive(true);
                    break;

                case InfoWindowType.OkCancel:
                    CancelButton.gameObject.SetActive(true);
                    ConfirmationButton.gameObject.SetActive(true);
                    break;

                default:
                    break;
                }

                this.Text            = text;
                ConfirmButtonClicked = onConfirmAction;
                CancelButtonClicked  = onCancelAction;
                gameObject.SetActive(true);
            }
        }