Exemplo n.º 1
0
        private void clickForEndMove()
        {
            try
            {
                r_GameMover.MakeAMove(m_Board, m_StartPoint, m_EndPoint, m_PlayerTurn);

                if (r_GameMover.CanEatAgain)
                {
                    m_CurrentMove = eClickTypeMove.Combo;
                    m_StartPoint  = m_EndPoint;
                    damkaSquereButtonMatrix[m_StartPoint.GetX(), m_StartPoint.GetY()].BackColor = Color.Blue;
                }
                else
                {
                    swapTurn();
                    checkGameOver();
                    checkIfPCTurn();
                    m_CurrentMove = eClickTypeMove.Start;
                }

                updateGameDetails();
                checkGameOver();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
 private void checkIfCancelMove(DamkaSquereButton i_Sender)
 {
     if (i_Sender.BackColor == Color.LightBlue && m_CurrentMove == eClickTypeMove.End)
     {
         m_CurrentMove = eClickTypeMove.Cancel;
     }
 }
Exemplo n.º 3
0
 public DamkaGame() : base()
 {
     gameSettingsForm     = new GameSettings();
     groupBoxForMatrix    = new GroupBox();
     m_CurrentMove        = eClickTypeMove.Start;
     m_PlayerTurn         = (char)eCheckerGame.WhitePlayer;
     r_GameMover          = new Move();
     labelPlayer1HeadLine = new Label();
     labelPlayer2HeadLine = new Label();
     labelWhosTurn        = new Label();
     pictureBoxWhosTurn   = new PictureBox();
     r_SoundGame          = new SoundPlayer(DamkaUI.Properties.Resources.DamkaGameMusic);
     this.Text            = "Damka";
     this.Icon            = DamkaUI.Properties.Resources.Iron_Devil_Ids_3d_Icons_20_Ico_zilla;
     this.StartPosition   = FormStartPosition.Manual;
 }
Exemplo n.º 4
0
        private void roundEndMessegeBox(string i_msg)
        {
            DialogResult dialogResult;

            dialogResult = MessageBox.Show(i_msg.ToString(), "Damka", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (dialogResult == DialogResult.Yes)
            {
                m_Board.ResetGameBoard();
                updateGameDetails();
                m_CurrentMove = eClickTypeMove.Start;
                m_PlayerTurn  = (char)eCheckerGame.WhitePlayer;
            }
            else
            {
                this.Close();
            }
        }
Exemplo n.º 5
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;
            }
        }
Exemplo n.º 6
0
 private void clickForCancelAMove(DamkaSquereButton i_Sender)
 {
     i_Sender.BackColor = Color.FromArgb(209, 139, 71);
     m_CurrentMove      = eClickTypeMove.Start;
 }