private void button_Click(object sender, EventArgs e) { GameButton button = sender as GameButton; int x = button.X; int y = button.Y; m_GameManager.PlayTurn(x, y); }
private void generateButtonMatrix() { m_ButtonMatrix = new GameButton[r_BoardDimension, r_BoardDimension]; for (int row = 0; row < r_BoardDimension; row++) { for (int col = 0; col < r_BoardDimension; col++) { m_ButtonMatrix[row, col] = new GameButton(); m_ButtonMatrix[row, col].X = col; m_ButtonMatrix[row, col].Y = row; m_ButtonMatrix[row, col].Width = m_ButtonMatrix[row, col].Height = k_ButtonSize; m_ButtonMatrix[row, col].Location = new System.Drawing.Point((row * (k_ButtonSize + k_ButtonSpacing)) + k_ButtonSpacing, (col * (k_ButtonSpacing + k_ButtonSize)) + k_ButtonSpacing); m_ButtonMatrix[row, col].Click += button_Click; m_ButtonMatrix[row, col].TabIndex = ((row + 1) * r_BoardDimension) + (col + 1); m_ButtonMatrix[row, col].Enabled = false; m_GameManager.GetCell(row, col).ColorIsChanged += buttonChangeColor; this.Controls.Add(m_ButtonMatrix[row, col]); } } }