Esempio n. 1
0
        /// <summary>
        /// Change the screen.
        /// </summary>
        /// <param name="nextScreen">The next screen to load</param>
        /// <param name="transition">The ScreenTransition to use between
        /// screens</param>
        public void ChangeScreen(GameScreen nextScreen,
                                 ScreenTransition transition = null)
        {
            this.transition = transition;

            if (nextScreen != null)
            {
                if (transition != null)
                {
                    transition.Activate(currentScreen, nextScreen);
                    IsTransitioning = true;
                }
                else
                {
                    SetScreen(nextScreen);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Change the screen.
        /// </summary>
        /// <param name="screenName">The screen name</param>
        /// <param name="transition">The ScreenTransition to use between
        /// screens</param>
        public void ChangeScreen(string screenName,
                                 ScreenTransition transition = null)
        {
            GameScreen screen = null;

            this.transition = transition;

            if (screens.ContainsKey(screenName))
            {
                screen = screens[screenName];

                if (transition != null)
                {
                    transition.Activate(currentScreen, screen);
                    IsTransitioning = true;
                }
                else
                {
                    SetScreen(screen);
                }
            }
        }