예제 #1
0
 public void StartGameCheck(MenuWindow window)
 {
     if (Players.Count < 2)
         MessageBox.Show("You need at least two players.");
     else if (BoardWidth == 0)
         MessageBox.Show("You need to select a board size");
     else
         StartGame(window);
 }
예제 #2
0
        public void StartGame(MenuWindow window)
        {
            if(!IsRandomSeed)
                Randomizer.SetSeed(Seed);

            Game game = new Game(new Board(BoardHeight, BoardWidth, (BoardHeight * 20), (BoardWidth * 20)));

            for (int i = 0; i < Players.Count; i++)
            {
                if (Players[i].Name == null)
                    Players[i].Name = GetRandomName(Players[i].IsBot);

                if (Players[i].IsBot)
                    game.AddBot(Players[i].Name);
                else
                    game.AddHuman(Players[i].Name);
            }

            MainWindow mainWindow = new MainWindow(game, (BoardHeight * 20), (BoardWidth * 20));
            mainWindow.Show();
            window.Close();
        }