From 20f702b537af2bdfa5c86e7842602a96e5727a83 Mon Sep 17 00:00:00 2001 From: CrystalMoogle Date: Sun, 16 Jul 2023 17:34:38 +0100 Subject: [PATCH] Disable buttons when player turn ended --- BlackjackGUI/GameWindow.vb | 5 +++++ BlackjackGUI/game.vb | 2 ++ 2 files changed, 7 insertions(+) diff --git a/BlackjackGUI/GameWindow.vb b/BlackjackGUI/GameWindow.vb index fcb6c18..84ccc66 100644 --- a/BlackjackGUI/GameWindow.vb +++ b/BlackjackGUI/GameWindow.vb @@ -54,6 +54,11 @@ PlayerCard7.Image = Utilities.GetCardImage(card) End Sub + Private Sub EndPlayerTurn() Handles game.EndPlayerTurn + HitButton.Enabled = False + StandButton.Enabled = False + End Sub + Private Sub EndGame(message) Handles game.EndGame WinMessage.Text = message HitButton.Enabled = False diff --git a/BlackjackGUI/game.vb b/BlackjackGUI/game.vb index 5a05472..4f6f4e3 100644 --- a/BlackjackGUI/game.vb +++ b/BlackjackGUI/game.vb @@ -3,6 +3,7 @@ Public Event CardDealt(card, cardNumber, hide) Public Event SetTotalLabels(playerTotal, dealerTotal) Public Event ShowDealerCard(card) + Public Event EndPlayerTurn() Public Event EndGame(winMessage) Private player As Player @@ -107,6 +108,7 @@ Sub DealerTurn() GetTotal(dealer) + RaiseEvent EndPlayerTurn() RaiseEvent SetTotalLabels(player.total, dealer.total) RaiseEvent ShowDealerCard(dealer.hidden) If player.winType = WinCondition.Bust Then