public void HandleMenuSelect(MenuItem item) { switch (item.Name) { case Strings.Start: { NextComponent = new StartState(Game, this); break; } case Strings.Help: { NextComponent = new HelpState(Game, (IComponent)this); break; } case Strings.HighScores: { NextComponent = new HighScoreState(Game, this); break; } case Strings.Settings: { NextComponent = new GameSettings(Game, (IComponent)this); break; } default: { //GridGame.ExitGame(); break; } } }
public override void Back() { if (_gameOver) { foreach (var player in _players) { Game.GameData.Data.HighScores.Add(new HighScore { Color = player.Color, Name = player.Name, Score = player.Score }); } Game.GameData.Data.HighScores = new List <HighScore>(Game.GameData.Data.HighScores.OrderByDescending(p => p.Score)); if (Game.GameData.Data.HighScores.Count >= 100) { Game.GameData.Data.HighScores.RemoveRange(100, Game.GameData.Data.HighScores.Count - 100); } NextComponent = new HighScoreState(Game, new MainMenu(Game, null)); try { if (_unlock) { Game.GameData.Data.GameGridsVsMode[GameType.Grid + 1] = new GameGrid { GameMode = Game.GameData.Data.GameGridsVsMode[ GameType.Grid + 1].GameMode, Locked = false, TileSize = Game.GameData.Data.GameGridsVsMode[ GameType.Grid + 1].TileSize, XTiles = Game.GameData.Data.GameGridsVsMode[ GameType.Grid + 1].XTiles, YTiles = Game.GameData.Data.GameGridsVsMode[ GameType.Grid + 1].YTiles } } ; } catch { //Finished Game. } } else { NextComponent = new InGameMenuState(Game, this); } }