Пример #1
0
 private void checkIfCancelMove(DamkaSquereButton i_Sender)
 {
     if (i_Sender.BackColor == Color.LightBlue && m_CurrentMove == eClickTypeMove.End)
     {
         m_CurrentMove = eClickTypeMove.Cancel;
     }
 }
Пример #2
0
        private void clickForStartMove(DamkaSquereButton i_Sender)
        {
            Square sqr = m_Board.GetSquare(i_Sender.Coordnate.GetX(), i_Sender.Coordnate.GetY());

            if (sqr.GetChecker() == null)
            {
                MessageBox.Show("Error: Start Point is Empty", "Wrong Move", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (sqr.GetChecker().Color != m_PlayerTurn)
            {
                MessageBox.Show("Wrong Pawn Choose: Please Choose Other Color ", "Wrong Pawn", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                m_CurrentMove      = eClickTypeMove.End;
                m_StartPoint       = i_Sender.Coordnate;
                i_Sender.BackColor = Color.LightBlue;
            }
        }
Пример #3
0
        private void DamkaSquareMove(DamkaSquereButton i_Sender)
        {
            switch (m_CurrentMove)
            {
            case eClickTypeMove.Start:
                clickForStartMove(i_Sender);
                break;

            case eClickTypeMove.End:
            case eClickTypeMove.Combo:
                m_EndPoint = i_Sender.Coordnate;
                clickForEndMove();
                break;

            case eClickTypeMove.Cancel:
                clickForCancelAMove(i_Sender);
                break;
            }
        }
Пример #4
0
        private void setTheCorrectPawnForDamkaButton(Square i_Sqr, DamkaSquereButton i_Button)
        {
            if (i_Sqr.GetChecker() == null)
            {
                i_Button.Text            = string.Empty;
                i_Button.BackgroundImage = null;
            }
            else
            {
                switch (i_Sqr.GetChecker().Color)
                {
                case (char)eCheckerGame.BlackPlayer:
                    if (i_Sqr.GetChecker().IsKing)
                    {
                        i_Button.BackgroundImage = DamkaUI.Properties.Resources.redKing;
                    }
                    else
                    {
                        i_Button.BackgroundImage = DamkaUI.Properties.Resources.red;
                    }

                    break;

                case (char)eCheckerGame.WhitePlayer:
                    if (i_Sqr.GetChecker().IsKing)
                    {
                        i_Button.BackgroundImage = DamkaUI.Properties.Resources.whiteKing;
                    }
                    else
                    {
                        i_Button.BackgroundImage = DamkaUI.Properties.Resources.white;
                    }

                    break;
                }

                i_Button.BackgroundImageLayout = ImageLayout.Stretch;
            }
        }
Пример #5
0
        private void createDamkaButtonBoard()
        {
            for (int i = 0; i < m_Board.GetSize; i++)
            {
                for (int j = 0; j < m_Board.GetSize; j++)
                {
                    damkaSquereButtonMatrix[i, j]          = new DamkaSquereButton(new Damka.Logic.Point(i, j), m_Board.GetSquare(i, j));
                    damkaSquereButtonMatrix[i, j].Size     = new Size(50, 50);
                    damkaSquereButtonMatrix[i, j].Location = new System.Drawing.Point(50 * j, 50 * i);
                    damkaSquereButtonMatrix[i, j].Click   += new EventHandler(this.damkaSquereButton_Click);
                    if ((i < m_Board.GetSize) && (mudoloTwoRowXorCol(i, j)))
                    {
                        damkaSquereButtonMatrix[i, j].BackColor = Color.FromArgb(209, 139, 71);  // was white;
                    }
                    else
                    {
                        damkaSquereButtonMatrix[i, j].BackColor = Color.FromArgb(255, 206, 158);  // was black;
                        damkaSquereButtonMatrix[i, j].Enabled   = false;
                    }

                    groupBoxForMatrix.Controls.Add(damkaSquereButtonMatrix[i, j]);
                }
            }
        }
Пример #6
0
 private void clickForCancelAMove(DamkaSquereButton i_Sender)
 {
     i_Sender.BackColor = Color.FromArgb(209, 139, 71);
     m_CurrentMove      = eClickTypeMove.Start;
 }