private void LoadNextLevel() { if (levelIndex == MaxLevelIndex) { //LoadingScreen.Load(ScreenManager, false, null, new QuickMenuScreen()); //LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(), new MainMenuScreen()); LevelUpScreen l = new LevelUpScreen(true, false); l.totalScore = prevScore; l.totalStar = starCount; l.Accepted += GameOverAccepted; ScreenManager.AddScreen(l, null); return; } // Unloads the content for the current level before loading the next one. if (level != null) level.Dispose(); // Load the level. level = new Level(ScreenManager, levelIndex); ++levelIndex; load = true; //ScreenManager.AddScreen(new PauseMenuScreen(), ControllingPlayer); }
void MessageBoxAccepted(object sender, PlayerIndexEventArgs e) { if (level.IsLevelUp) { if (levelIndex == MaxLevelIndex) { //LoadingScreen.Load(ScreenManager, false, null, new QuickMenuScreen()); //LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(), new MainMenuScreen()); LevelUpScreen l = new LevelUpScreen(true, false); l.totalScore = Score; l.totalStar = Stars; l.Accepted += GameOverAccepted; ScreenManager.AddScreen(l, null); return; } //ScreenManager.AddScreen(new PauseMenuScreen(), ControllingPlayer); LoadNextLevel(); } else if (level.ReloadLevel) ReloadCurrentLevel(); }
/// <summary> /// Updates the state of the game. This method checks the GameScreen.IsActive /// property, so the game will stop updating when the pause menu is active, /// or if you tab away to a different application. /// </summary> public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); if (load) { if (level.IsLevelUp) { load = false; LevelUpScreen l = new LevelUpScreen(false, level.Score >= level.starScore); l.Accepted += MessageBoxAccepted; ScreenManager.AddScreen(l, null); } else if (level.ReloadLevel) { load = false; MessageBoxScreen m = new MessageBoxScreen(gameContent.blank, true); m.Accepted += MessageBoxAccepted; m.Cancelled += MessageBoxAccepted; ScreenManager.AddScreen(m, null); } } if (IsActive) level.Update(gameTime); }
/// <summary> /// Updates the state of the game. This method checks the GameScreen.IsActive /// property, so the game will stop updating when the pause menu is active, /// or if you tab away to a different application. /// </summary> public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); if (m == null) { if (level.IsLevelUp) { m = new MessageBoxScreen("Level Up!"); BitSitsGames.ScoreData.Level = levelIndex; BitSitsGames.ScoreData.Score = Score; BitSitsGames.ScoreData.Stars = Stars; if (levelIndex == MaxLevelIndex) { m = new MessageBoxScreen("Game Over"); BitSitsGames.ScoreData.Level = 0; BitSitsGames.ScoreData.Score = BitSitsGames.ScoreData.Stars = 0; } m.Accepted += MessageBoxAccepted; //ScreenManager.AddScreen(m, ControllingPlayer); LevelUpScreen l = new LevelUpScreen(false, level.Score >= level.starScore); l.Accepted += MessageBoxAccepted; ScreenManager.AddScreen(l, null); } else if (level.ReloadLevel) { m = new MessageBoxScreen("Reload Level!"); m.Accepted += MessageBoxAccepted; ScreenManager.AddScreen(m, ControllingPlayer); } } if (IsActive) level.Update(gameTime); }