Пример #1
0
 /// <summary>
 /// Tells the screen to go away. Unlike ScreenManager.RemoveScreen, which
 /// instantly kills the screen, this method respects the transition timings
 /// and will give the screen a chance to gradually transition off.
 /// </summary>
 public void ExitScreen()
 {
     if (TransitionOffTime == TimeSpan.Zero)
     {
         // If the screen has a zero transition time, remove it immediately.
         ScreenManager.RemoveScreen(this);
     }
     else
     {
         // Otherwise flag that it should transition off and then exit.
         _isExiting = true;
     }
 }
Пример #2
0
        /// <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)
            {
                return;
            }
            ScreenManager.RemoveScreen(this);

            foreach (var screen in _screensToLoad.Where(screen => screen != null))
            {
                ScreenManager.AddScreen(screen, ControllingPlayer);
            }

            // 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();
        }