/// <summary>
        /// Updates the loading screen.
        /// </summary>
        public override void Update(GameTime gameTime, bool otherScreenHasFocus,
                                    bool coveredByOtherScreen)
        {
            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);

            // If all the previous screens have finished transitioning
            // off, it is time to actually perform the load.
            if (otherScreensAreGone)
            {
                ScreenManager.Pop(this);

                foreach (Screen screen in screensToLoad)
                {
                    if (screen != null)
                    {
                        ScreenManager.Push(screen);
                    }
                }

                // Once the load has finished, we use ResetElapsedTime to tell
                // the  game timing mechanism that we have just finished a very
                // long frame, and that it should not try to catch up.
                ScreenManager.Game.ResetElapsedTime();
            }
        }
Beispiel #2
0
 public virtual void ExitScreen()
 {
     // if screen has zero transition time, remove it
     if (TransitionOffTime == TimeSpan.Zero)
     {
         // If the screen has a zero transition time, remove it immediately.
         ScreenManager.Pop(this);
     }
     else
     {
         // Otherwise flag that it should transition off and then exit.
         isExiting = true;
     }
 }
Beispiel #3
0
        public virtual void Update(GameTime gameTime,
                                   bool focus,
                                   bool covered)
        {
            this.otherScreenHasFocus = focus;

            if (isExiting)
            {
                // If screen is going away, should transition off
                state = ScreenState.TransitionOff;

                if (!UpdateTransition(gameTime, transitionOffTime, 1))
                {
                    // when transition finishes, remove screen
                    screenManager.Pop(this);
                }
            }
            else if (covered)
            {
                // if screen is covered by another, transition off
                if (UpdateTransition(gameTime, transitionOffTime, 1))
                {
                    // still transitioning
                    state = ScreenState.TransitionOff;
                }
                else
                {
                    // transition finished
                    state = ScreenState.Hidden;
                }
            }
            else
            {
                // otherwise screen should transition on and become active
                if (UpdateTransition(gameTime, transitionOnTime, -1))
                {
                    // still transitioning
                    state = ScreenState.TransitionOn;
                }
                else
                {
                    // transition finished
                    state = ScreenState.Active;
                }
            }
        }