private void buttonClicked(object sender, EventArgs e) { ReversiButton currentButton = (ReversiButton)sender; mGame.PlayTurn(mGame.CurrentPlayer, new Move(currentButton.Row, currentButton.Col)); EndTurn(); }
private void InitializeComponentCustom(int iBoardSize) { // FormGame this.components = new System.ComponentModel.Container(); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(800, 450); this.Size = new Size((mButtonSize * (iBoardSize + 1)) + 16, (mButtonSize * (iBoardSize + 1)) + 39); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.MaximizeBox = false; this.Text = $"{kTitle} - {mGame.CurrentPlayer.Name}'s turn"; mGame.StartNewGame(); mGame.GameBoard.IsAbleToPlay(mGame.CurrentPlayer); mbuttonGameBoard = new ReversiButton[iBoardSize, iBoardSize]; for (int i = 0; i < iBoardSize; i++) { for (int j = 0; j < iBoardSize; j++) { mbuttonGameBoard[i, j] = new ReversiButton(i, j, mButtonSize); mbuttonGameBoard[i, j].Location = new Point((mButtonSize / 2) + (i * mButtonSize), (mButtonSize / 2) + (j * mButtonSize)); mbuttonGameBoard[i, j].Enabled = false; updateButtonBackgroundImage(i, j); this.Controls.Add(mbuttonGameBoard[i, j]); } } updatePossibleMoves(); }