/// <summary> /// Adds a new screen to the screen manager. /// </summary> public void AddScreen(GameScreen screen, string name) { screen.ScreenManager = this; screen.IsExiting = false; screen.Name = name; // If we have a graphics device, tell the screen to load content. if (isInitialized) { screen.LoadContent(); } screens.Add(screen.Name, screen); //screens.Add(screen); }
/// <summary> /// 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. /// </summary> public void RemoveScreen(GameScreen screen) { // If we have a graphics device, tell the screen to unload content. if (isInitialized) { screen.UnloadContent(); } screens.Remove(screen.Name);; screensToUpdate.Remove(screen); }