RemoveScreen() public méthode

Removes a screen from the screen manager. You should normally use GameScreen.ExitScreen instead of calling this directly, so the screen can gradually transition off rather than just being instantly removed.
public RemoveScreen ( GameScreen screen ) : void
screen GameScreen
Résultat void
 /// <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.
         m_isExiting = true;
     }
 }
        /// <summary>
        /// Allows the screen to run logic, such as updating the transition position.
        /// Unlike HandleInput, this method is called regardless of whether the screen
        /// is active, hidden, or in the middle of a transition.
        /// </summary>
        public virtual void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
        {
            this.otherScreenHasFocus = otherScreenHasFocus;

            if (m_isExiting)
            {
                // If the screen is going away to die, it should transition off.
                m_screenState = ScreenState.TransitionOff;

                if (!UpdateTransition(gameTime, m_transitionOffTime, 1))
                {
                    // When the transition finishes, remove the screen.
                    ScreenManager.RemoveScreen(this);
                }
            }
            else if (coveredByOtherScreen)
            {
                // If the screen is covered by another, it should transition off.
                if (UpdateTransition(gameTime, m_transitionOffTime, 1))
                {
                    // Still busy transitioning.
                    m_screenState = ScreenState.TransitionOff;
                }
                else
                {
                    // Transition finished!
                    m_screenState = ScreenState.Hidden;
                }
            }
            else
            {
                // Otherwise the screen should transition on and become active.
                if (UpdateTransition(gameTime, m_transitionOnTime, -1))
                {
                    // Still busy transitioning.
                    m_screenState = ScreenState.TransitionOn;
                }
                else
                {
                    // Transition finished!
                    m_screenState = ScreenState.Active;
                }
            }
        }
        /// <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.RemoveScreen(this);

                foreach (GameScreen screen in screensToLoad)
                {
                    if (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();
            }
        }