/// <summary> /// /// </summary> public override void PostProcessing() { base.PostProcessing(); _popup = new OptionsScreen(true); _popup.Exited += new EventHandler(_popup_Exited); _popupEnabled = true; this.Exiting += new EventHandler(PauseScreen_Exiting); }
/// <summary> /// Removes a screen from the screen manager. You should normally /// use <see cref="GameScreen"/>.ExitScreen instead of calling this directly, so /// the screen can gradually transition off rather than just being /// instantly removed. /// </summary> public void RemoveScreen(GameScreen screen) { // If we have a graphics device, tell the screen to unload content. if ((_graphicsDeviceService != null) && (_graphicsDeviceService.GraphicsDevice != null)) { screen.UnloadContent(); } // Remove the screen from the arrays lock (_screens) _screens.Remove(screen); lock (_screensToUpdate) _screensToUpdate.Remove(screen); // Dispose the Screen (Release it's Content) screen.Dispose(); }
/// <summary> /// Exits all screens /// </summary> public void ExitAll() { GameScreen[] to_remove = null; lock (_screens) { to_remove = new GameScreen[_screens.Count]; _screens.CopyTo(to_remove); } foreach (GameScreen i_screen in to_remove) i_screen.ExitScreen(); }
/// <summary> /// Removes all screens but argument screen /// </summary> /// <param name="excluded_screen"></param> public void RemoveAllBut(GameScreen excludedScreen) { List<GameScreen> i_screensToRemove = new List<GameScreen>(); lock (_screens) foreach (GameScreen i_screen in _screens) if (i_screen != excludedScreen) i_screensToRemove.Add(i_screen); foreach (GameScreen i_screen in i_screensToRemove) RemoveScreen(i_screen); i_screensToRemove.Clear(); }
/// <summary> /// Adds a new screen to the screen manager. /// </summary> public void AddScreen(GameScreen screen) { screen.ScreenManager = this; screen.Game = this.Game; // Initialize this Screen screen.Initialize(); // If we have a graphics device, tell the screen to load content. if ((_graphicsDeviceService != null) && (_graphicsDeviceService.GraphicsDevice != null)) { // Load the Content screen.LoadContent(new ContentManager(Game.Services, "Content")); } // Actually Add the screen to the list lock (_screens) _screens.Add(screen); // Process post actions screen.PostProcessing(); }