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); } }
private void checkIfCancelMove(DamkaSquereButton i_Sender) { if (i_Sender.BackColor == Color.LightBlue && m_CurrentMove == eClickTypeMove.End) { m_CurrentMove = eClickTypeMove.Cancel; } }
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; }
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(); } }
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; } }
private void clickForCancelAMove(DamkaSquereButton i_Sender) { i_Sender.BackColor = Color.FromArgb(209, 139, 71); m_CurrentMove = eClickTypeMove.Start; }