Exemplo n.º 1
0
        private void BoardButton_Click(object sender, EventArgs e)
        {
            OthelloBoardButton othelloBoardButton = sender as OthelloBoardButton;

            r_OtheloLogicGame.Play(m_CurrentTurnSign, othelloBoardButton.RowIndex, othelloBoardButton.ColIndex);
            Refresh();
            Thread.Sleep(200);
            prepareNextUserTurn();
        }
Exemplo n.º 2
0
        private void createBoardButtons()
        {
            int buttonXPosition;
            int boardSize       = r_BoardButtons.GetLength(0);
            int buttonYPosition = k_FirstButtonPosition;

            for (int row = 0; row < boardSize; row++)
            {
                buttonXPosition = k_FirstButtonPosition;

                for (int col = 0; col < boardSize; col++)
                {
                    r_BoardButtons[row, col] = new OthelloBoardButton(row, col, buttonXPosition, buttonYPosition);
                    r_OtheloLogicGame.GameBoard[row, col].m_ReportSignChangedDelegate += r_BoardButtons[row, col].ChangeButtonStatus;
                    Controls.Add(r_BoardButtons[row, col]);
                    r_BoardButtons[row, col].Click += BoardButton_Click;
                    buttonXPosition += OthelloBoardButton.sr_ButtonSize;
                }

                buttonYPosition += OthelloBoardButton.sr_ButtonSize;
            }
        }