Beispiel #1
0
        private void pawn_PressedAfterAnotherPawnPressed(object sender, EventArgs e)
        {
            Button currentButton = (Button)sender;

            m_MoveToButton = (ButtonProxy)sender;
            foreach (Button btn in r_GameBoard)
            {
                if (!btn.BackColor.Equals(Color.Gray))
                {
                    btn.BackColor = Color.White;
                }
            }

            currentButton.BackColor = Color.White;
            foreach (Button button in r_GameBoard)
            {
                button.Click += pawn_Pressed;
                if (button.Equals((Button)m_SelectedButton))
                {
                    button.Click -= pawn_PressedAgain;
                }
                else
                {
                    button.Click -= pawn_PressedAfterAnotherPawnPressed;
                }
            }

            playerMove();
        }
Beispiel #2
0
        private void setBoard()
        {
            for (int i = 0; i < r_BoardSize; i++)
            {
                for (int j = 0; j < r_BoardSize; j++)
                {
                    r_GameBoard[i, j]           = new ButtonProxy(i, j);
                    r_GameBoard[i, j].BackColor = (i + j) % 2 == 0 ? Color.Gray : Color.White;
                    r_GameBoard[i, j].Location  = new Point(
                        ((i + (r_BoardSize / 2)) * 30) - (this.Width / 10),
                        m_FirstPlayerScoreLabel.Bottom + (j * 30));
                    r_GameBoard[i, j].Size = new Size(30, 30);
                    if (r_GameBoard[i, j].BackColor == Color.Gray)
                    {
                        r_GameBoard[i, j].Enabled = false;
                    }

                    r_GameBoard[i, j].Click += pawn_Pressed;
                    this.Controls.Add(r_GameBoard[i, j]);
                }
            }

            setPawns();
        }