示例#1
0
        /// <summary>
        /// Adds _targetScreen_ to the stack and uses the set transition (if there is one, otherwise simply raises the apropriate NavScreen events).
        /// </summary>
        /// <param name="targetScreen"></param>
        public void GoTo(NavScreen targetScreen)
        {
            if (!initialized)
            {
                Initialize();
            }

            if (transition == null)
            {
                if (CurrentScreen != null)
                {
                    CurrentScreen.OnHiding();
                    CurrentScreen.OnHidden();
                }
                targetScreen.OnShowing();
                targetScreen.OnShown();
            }
            else
            {
                StartCoroutine(transition.Play(CurrentScreen, targetScreen));
            }

            screens.Add(targetScreen);
        }
示例#2
0
        /// <summary>
        /// Removes the NavScreen at the top of the stack using the set transition.
        /// </summary>
        public void GoBack()
        {
            if (!initialized)
            {
                Initialize();
            }

            if (screens.Count == 0)
            {
                return;
            }

            if (!emptyPathAllowed && screens.Count == 1)
            {
                return;
            }

            NavScreen previousScreen = screens.Count >= 2 ? screens[screens.Count - 2] : null;

            if (transition == null)
            {
                CurrentScreen.OnHiding();
                CurrentScreen.OnHidden();
                if (previousScreen != null)
                {
                    previousScreen.OnShowing();
                    previousScreen.OnShown();
                }
            }
            else
            {
                StartCoroutine(transition.PlayReverse(CurrentScreen, previousScreen));
            }

            screens.RemoveAt(screens.Count - 1);
        }
 public abstract IEnumerator PlayReverse(NavScreen currentScreen, NavScreen previousScreen);
 public abstract IEnumerator Play(NavScreen currentScreen, NavScreen nextScreen);