コード例 #1
0
ファイル: Program.cs プロジェクト: kossar/battleships
        private static string LoadGameAction(BattleShips battleShips, DbContextOptions <ApplicationDbContext> dbOptions)
        {
            Console.Clear();

            var games = BattleShips.LoadSavedGames(dbOptions);

            var menuGames = new Menu(MenuLevel.Level2Plus);

            menuGames.AddMenuHeader("Saved Games");
            foreach (var game in games)
            {
                menuGames.AddMenuItem(new MenuItem($"{game.PlayerA.Name} vs {game.PlayerB.Name} - {game.Description}", $"{game.GameId}", () =>
                {
                    battleShips.LoadGame(game.GameId, dbOptions);
                    PlayBattleShips(battleShips, dbOptions);

                    return("");
                }
                                                   ));
            }
            menuGames.RunMenu();
            return("m");
        }