コード例 #1
0
ファイル: MainForm.cs プロジェクト: trbarrett/Four-in-a-Row
        private void btnNewGame_Click(object sender, EventArgs e)
        {
            using (var newGameForm = new NewGame()) {
                newGameForm.Player1AI = _newGamePlayer1AIStatus;
                newGameForm.Player2AI = _newGamePlayer2AIStatus;

                if (newGameForm.ShowDialog() == DialogResult.OK) {

                    _newGamePlayer1AIStatus = newGameForm.Player1AI;
                    _newGamePlayer2AIStatus = newGameForm.Player2AI;

                    Player player1 = new Player("Player 1",
                        Player.Player1TokenColour,
                        Player.Player1HighlightColour,
                        newGameForm.Player1AI);
                    Player player2 = new Player("Player 2",
                        Player.Player2TokenColour,
                        Player.Player2HighlightColour,
                        newGameForm.Player2AI);

                    _gameController = new GameController(this, dropBoard, player1, player2);
                    dropBoard.InitializeGameState(_gameController);
                }
            }
        }
コード例 #2
0
ファイル: DropBoard.cs プロジェクト: trbarrett/Four-in-a-Row
 public void InitializeGameState(GameController gameController)
 {
     _gameFinished = false;
     _currentGame = gameController;
     SetupBoard();
     this.Invalidate();
     SetCurrentPlayer(gameController.CurrentPlayer);
 }