/// <summary> /// Initialize a new LoadScreen that will clear the other screens and load the new one automatically. /// </summary> /// <param name="Game">Requires the main form of the project to have access to its members.</param> /// <param name="Screens">An array of GameScreen to create while loading.</param> /// <param name="BackgroundBuffer">A background picture to use for the loading screen. Can be null.</param> /// <param name="graphics">Pour utiliser tout ce qui attrait a la fenetre</param> public LoadScreen(IServiceProvider serviceProvider, GameScreen[] Screens, Texture2D BackgroundBuffer, GraphicsDeviceManager graphics) : base(serviceProvider, graphics) { this.Screens = Screens; this.BackgroundBuffer = BackgroundBuffer; //Remove everything else. for (int i = 0; i < GameScreen.listGameScreen.Count; i++) { GameScreen.RemoveScreen(i); } }
public override void Update(GameTime gameTime) { //If all the GameScreen are unloaded and only this GameScreen is loaded. if (GameScreen.listGameScreen.Count == 1) { //Ask the Game to remove this GameScreen the next time it update. GameScreen.RemoveScreen(this); //Create and load the pending GameScreen array. for (int i = 0; i < Screens.Length; i++) { GameScreen.AddScreen(Screens[i]); } } }