Ejemplo n.º 1
0
        private void m_ButtonMatrix_Click(object sender, EventArgs e)
        {
            GameButton button = sender as GameButton;
            int        x      = button.X;
            int        y      = button.Y;

            m_GameManager.DoIteration(y, x);
        }
Ejemplo n.º 2
0
        private void generateButtonMatrix()
        {
            m_ButtonMatrix = new GameButton[r_BoardDimension, r_BoardDimension];

            for (int y = 0; y < r_BoardDimension; y++)
            {
                for (int x = 0; x < r_BoardDimension; x++)
                {
                    m_ButtonMatrix[y, x]          = new GameButton();
                    m_ButtonMatrix[y, x].X        = x;
                    m_ButtonMatrix[y, x].Y        = y;
                    m_ButtonMatrix[y, x].Width    = m_ButtonMatrix[y, x].Height = k_ButtonSize;
                    m_ButtonMatrix[y, x].Location = new System.Drawing.Point((y * (k_ButtonSize + k_ButtonSpacing)) + k_ButtonSpacing, (x * (k_ButtonSpacing + k_ButtonSize)) + k_ButtonSpacing);
                    m_ButtonMatrix[y, x].Click   += m_ButtonMatrix_Click;
                    m_ButtonMatrix[y, x].TabIndex = ((y + 1) * r_BoardDimension) + (x + 1);
                    m_ButtonMatrix[y, x].Enabled  = false;
                    m_GameManager.GetCellFromBoard(x, y).ChangeColor += gameButton_ChangeColor;

                    this.Controls.Add(m_ButtonMatrix[y, x]);
                }
            }
        }