//allin button private void btnAllIn_Click(object sender, EventArgs e) { pokerTable[0].AllIn(pokerTable.getPot(), pokerTable.decrementIndex(pokerTable.getCurrentIndex())); updateMove(); HideButtons(); TimerNextMove.Start(); }
//bet/raise button private void btnRaise_Click(object sender, EventArgs e) { if (pokerTable[pokerTable.getCurrentIndex()].getAmountToCall(pokerTable.getPot()) == 0) { getMoney.Text = "Bet"; getMoney.lblRaiseAmount.Text = "Bet Amount: "; } else { getMoney.Text = "Raise"; getMoney.lblRaiseAmount.Text = "Raise Amount: "; } getMoney.setMoney(pokerTable.getPot().MinimumRaise, (pokerTable[0].ChipStack - pokerTable[0].getAmountToCall(pokerTable.getPot()))); if (getMoney.ShowDialog() != DialogResult.OK) { return; } if (pokerTable[pokerTable.getCurrentIndex()].getAmountToCall(pokerTable.getPot()) != 0) { pokerTable[0].Raise(Convert.ToInt32(getMoney.nudBetRaise.Value), pokerTable.getPot(), pokerTable.decrementIndex(pokerTable.getCurrentIndex())); } else { pokerTable[0].Bet(Convert.ToInt32(getMoney.nudBetRaise.Value), pokerTable.getPot(), pokerTable.decrementIndex(pokerTable.getCurrentIndex())); } updateMove(); HideButtons(); TimerNextMove.Start(); }
//fold button private void btnFold_Click(object sender, EventArgs e) { pokerTable[0].Fold(pokerTable.getPot()); updateMove(); HideButtons(); panelPlayer.BackgroundImage = Image.FromFile("inactivebutton.png"); TimerNextMove.Start(); }
//check/call button private void btnCheck_Click(object sender, EventArgs e) { if (pokerTable[pokerTable.getCurrentIndex()].getAmountToCall(pokerTable.getPot()) != 0) { pokerTable[0].Call(pokerTable.getPot()); } else { pokerTable[0].Check(pokerTable.getPot()); } updateMove(); HideButtons(); TimerNextMove.Start(); }
public void matchStart() { if (PlayerWon() != 0) { TimerWait3Seconds.Stop(); lblBanner.Hide(); //Checks if the player has won at start of new round if (PlayerWon() == 1) { if (user.getUserName() != "default" && user.getPassword() != "default") { user.AddWin(); user.WriteToFile(); } panelBubble.Hide(); FormEndGame FormEndGame = new FormEndGame(true); FormEndGame.StartPosition = FormStartPosition.CenterScreen; FormEndGame.FormPoker = this; FormEndGame.Text = "You won!"; FormEndGame.ShowDialog(); } else if (PlayerWon() == -1) { if (user.getUserName() != "default" && user.getPassword() != "default") { user.AddLose(); user.WriteToFile(); } panelBubble.Hide(); FormEndGame FormEndGame = new FormEndGame(false); FormEndGame.StartPosition = FormStartPosition.CenterScreen; FormEndGame.FormPoker = this; FormEndGame.Text = "You lost!"; FormEndGame.ShowDialog(); } return; } HideControls(); for (int i = 0; i < pokerTable.getPlayers().Count; i++) { if (pokerTable[i].IsFolded()) { panelList[i].BackgroundImage = Image.FromFile("panelNormal.png"); } } //resetting variables to start new match timerCount = 0; showdownCount = 0; lblBanner.Show(); if (pokerTable.RoundCount == 10) { lblBanner.Text = "The minimum blinds have" + Environment.NewLine + "been raised"; } else { lblBanner.Text = "New Round"; } pokerTable.startNextMatch(); pokerTable.DealHoleCards(); DrawToScreen(); updateMove(); lblBubble.Text = pokerTable[pokerTable.getCurrentIndex()].Name + " is the dealer"; TimerNextMove.Start(); }