/// <summary>
        /// Gets the popup that matches the proveded type.
        /// </summary>
        /// <param name="t">Type to find.</param>
        /// <returns>Matching instance; otherwise null.</returns>
        public Control TrackingByType(Type t)
        {
            if (IsTracking)
            {
                // Is the current popup matching the type?
                if (CurrentPopup.GetType() == t)
                {
                    return(CurrentPopup);
                }

                // Check the stack items in reverse order for a match
                VisualPopup[] popups = _stack.ToArray();
                for (int i = popups.Length - 1; i >= 0; i--)
                {
                    if (!popups[i].IsDisposed)
                    {
                        if (popups[i].GetType() == t)
                        {
                            return(popups[i]);
                        }
                    }
                }
            }

            return(null);
        }
예제 #2
0
        public void Open <T>() where T : Popup
        {
            if (CurrentPopup != null && CurrentPopup.GetType() == typeof(T))
            {
                return;
            }
            if (_activePopupStack.Any <T>())
            {
                return;
            }

            _popups.Get <T>().gameObject.SetActive(false);

            Popup popup = Instantiate(_popups.Get <T>(), _container);

            popup.Init();

            if (CurrentPopup != null && CurrentPopup.BaseSettings.PriorityLevel > _popups.Get <T>().BaseSettings.PriorityLevel)
            {
                _activePopupStack.Push(popup);
                return;
            }

            Register(popup);
            Open(popup);
        }