コード例 #1
0
        public void runClassicYahtzee()
        {
            m_yahtzeeView.showClassicYahtzeeMenu();
            var input = Console.ReadKey();
            switch (input.Key)
            {
                //Play Classic Yahtzee
                case ConsoleKey.D1:
                case ConsoleKey.NumPad1:
                    // 1 = Classic Yahtzee
                    setVersionOfGame(1);
                    playGame();
                    break;

                //Show Compact list
                case ConsoleKey.D2:
                case ConsoleKey.NumPad2:
                    DBYahtzee db = new DBYahtzee();
                    List<Player> pl = db.getEndGameScore();
                    ScoreListView scoreList = new ScoreListView();
                    scoreList.showCompactList(pl);
                    runClassicYahtzee();
                    break;

                // Show Detailed list
                case ConsoleKey.D3:
                case ConsoleKey.NumPad3:
                    DBYahtzee db2 = new DBYahtzee();
                    List<Player> pl2 = db2.getEndGameScore();
                    ScoreListView scoreList2 = new ScoreListView();
                    scoreList2.showDetailedList(pl2);
                    runClassicYahtzee();
                    break;

                case ConsoleKey.D4:
                case ConsoleKey.NumPad4:
                    if (checkIfAnySavedGame() == null)
                    {
                        runClassicYahtzee();
                    }
                    setLoadedGameTrue();
                    setVersionOfGame(1);
                    playGame();
                    break;
                case ConsoleKey.D5:
                case ConsoleKey.NumPad5:
                    MasterController mc = new MasterController();
                    mc.run();
                    break;
                case ConsoleKey.Escape:
                    Environment.Exit(0);
                    break;
                default:
                    runClassicYahtzee();
                    break;
            }
        }
コード例 #2
0
        public void runStrictYahtzee()
        {
            m_yahtzeeView.showStrictYahtzeeMenu();
            var input = Console.ReadKey();
            switch (input.Key)
            {
                //Play Strict Yahtzee
                case ConsoleKey.D1:
                case ConsoleKey.NumPad1:
                    // 2 = Strict Yahtzee
                    setVersionOfGame(2);
                    playGame();
                    break;

                //Show Compact list
                case ConsoleKey.D2:
                case ConsoleKey.NumPad2:
                    DBYahtzee db = new DBYahtzee();
                    List<Player> pl = db.getEndGameScore();
                    ScoreListView scoreList = new ScoreListView();
                    scoreList.showCompactList(pl);
                    runStrictYahtzee();
                    break;

                // Show Detailed list
                case ConsoleKey.D3:
                case ConsoleKey.NumPad3:
                    DBYahtzee db2 = new DBYahtzee();
                    List<Player> pl2 = db2.getEndGameScore();
                    ScoreListView scoreList2 = new ScoreListView();
                    scoreList2.showDetailedList(pl2);
                    runStrictYahtzee();
                    break;

                case ConsoleKey.D4:
                case ConsoleKey.NumPad4:
                    MasterController mc = new MasterController();
                    mc.run();
                    break;
                case ConsoleKey.Escape:
                    Environment.Exit(0);
                    break;
                default:
                    runStrictYahtzee();
                    break;
            }
        }