private void SetDataToScreen(int screenID, IUIScreenData data)
 {
     if (_screens.ContainsKey(screenID))
     {
         _screens[screenID].SetCustomData(data);
     }
 }
Exemple #2
0
 public void OpenPopup(string customPopupID, IUIScreenData data = null)
 {
     if (Initialized)
     {
         _popups.Open(customPopupID, data);
     }
 }
        public void Open(string customID, IUIScreenData data)
        {
            customID = customID.Trim();

            int    id       = 0;
            string stringID = null;

            foreach (KeyValuePair <int, T> screen in _screens)
            {
                stringID = screen.Value.CustomID;
                if (stringID != null && stringID.Equals(customID))
                {
                    id = screen.Value.ID;
                    break;
                }
            }

            if (id > 0)
            {
                Open(id, data);
            }
            else
            {
                Debug.LogWarning("Screen with custom ID \"" + customID + "\" does not exist in current scene or not registered in UIManager. This can also be caused by spelling error.");
            }
        }
Exemple #4
0
 public void OpenPopup(int popupID, IUIScreenData data = null)
 {
     if (Initialized)
     {
         _popups.Open(popupID, data);
     }
 }
Exemple #5
0
 public void OpenScreen(string customScreenID, IUIScreenData data = null)
 {
     if (Initialized)
     {
         _screens.Open(customScreenID, data);
     }
 }
Exemple #6
0
 private void OpenScreen(int screenID, IUIScreenData data = null)
 {
     if (Initialized)
     {
         _screens.Open(screenID, data);
     }
 }
Exemple #7
0
        public void SetCustomData(IUIScreenData data)
        {
            ProcessCustomData(data);

            if (data != null)
            {
                data.Clear();
                data = null;
            }
        }
Exemple #8
0
        public virtual void ProcessCustomData(IUIScreenData customData)
        {
            if (customData != null)
            {
                UIGenericPopupButtonData data = (UIGenericPopupButtonData)customData;

                _label.text        = data.Label;
                _callback          = data.Callback;
                _closePopupOnPress = data.ClosePopupOnPress;

                if (data.ColorID > 0)
                {
                    ApplyColor(data.ColorID);
                }
            }
        }
        override protected void ProcessCustomData(IUIScreenData customData)
        {
            if (_closingRoutine != null)
            {
                StopCoroutine(_closingRoutine);
                _closingRoutine = null;
            }

            base.ProcessCustomData(customData);

            bool dataExists = customData != null;

            CleanUpButtons();

            _header.gameObject.SetActive(dataExists);
            _message.gameObject.SetActive(dataExists);

            foreach (UIGenericPopupButton button in _originalButtons)
            {
                button.gameObject.SetActive(dataExists);
            }

            if (dataExists)
            {
                UIGenericPopupData data = (UIGenericPopupData)customData;

                SetText(_header, data.Header);
                SetText(_message, data.Message);

                SetupButtons(data.Buttons);

                if (data.Width > 0f)
                {
                    RectTransform rt = _layoutGroup.GetComponent <RectTransform>();
                    if (rt != null)
                    {
                        rt.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, data.Width);
                    }
                }

                if (data.Timeout > 0f)
                {
                    CloseWithDelay(data.Timeout);
                }
            }
        }
        private void QueueNext()
        {
            if (_queue.Count > 0)
            {
                int           nextScreenID = _queue.Dequeue();
                IUIScreenData data         = _dataQueue.Dequeue();

                if (QueueSupported && _screens[nextScreenID] != null && _screens[nextScreenID].SkipInQueue && _queue.Count > 0)
                {
                    QueueNext();
                    return;
                }
                else
                {
                    Open(nextScreenID, data);
                }
            }
        }
        public void Open(int id, IUIScreenData data)
        {
            if (EmptyScreen)
            {
                ChangeState(id);
                SetDataToScreen(id, data);
            }
            else
            {
                QueueAdd(id, data);

                if (!QueueSupported)
                {
                    CloseCurrentScreen();
                }
                else if (QueueSupported && CurrentScreen != null && CurrentScreen.SkipInQueue)
                {
                    CloseCurrentScreen();
                }
            }
        }
Exemple #12
0
 virtual protected void ProcessCustomData(IUIScreenData customData)
 {
 }
 private void QueueAdd(int screenID, IUIScreenData data)
 {
     _queue.Enqueue(screenID);
     _dataQueue.Enqueue(data);
 }
Exemple #14
0
 public void OpenPopup(UIPopup popup, IUIScreenData data = null)
 {
     OpenPopup(popup.ID, data);
 }
Exemple #15
0
 public void OpenScreen(UIScreen screen, IUIScreenData data = null)
 {
     OpenScreen(screen.ID, data);
 }