This commit is contained in:
2026-09-13 15:59:13 +02:00
parent cf90775bad
commit 51f22f4155
2 changed files with 50 additions and 25 deletions
+29 -16
View File
@@ -157,25 +157,38 @@ namespace Casino
private void StartRound() private void StartRound()
{ {
if (currentBet <= 0 || currentBet > CurrentUser.Geld) try
{ {
ShowWaitingState(); if (currentBet <= 0 || currentBet > CurrentUser.Geld)
return; {
ShowWaitingState();
return;
}
// Einsatz vom Konto abziehen
CurrentUser.Geld -= Convert.ToInt32(currentBet);
SaveAccount();
currentProfit = 0;
currentPhase = 0;
roundRunning = true;
TxtBet.IsEnabled = false;
LoadCards();
UpdateHandUI();
UpdateWinDisplay();
SetPhaseUI();
}
catch (NullReferenceException)
{
MessageBox.Show(
"Bitte ein Betrag eingeben",
"Fehlermeldung 101",
MessageBoxButton.OK,
MessageBoxImage.Information);
} }
// Einsatz vom Konto abziehen
CurrentUser.Geld -= Convert.ToInt32(currentBet);
SaveAccount();
currentProfit = 0;
currentPhase = 0;
roundRunning = true;
TxtBet.IsEnabled = false;
LoadCards();
UpdateHandUI();
UpdateWinDisplay();
SetPhaseUI();
} }
private void LoadCards() private void LoadCards()
+21 -9
View File
@@ -131,15 +131,27 @@ namespace Casino
private async void Spin(object sender, RoutedEventArgs e) private async void Spin(object sender, RoutedEventArgs e)
{ {
int einsatz = Convert.ToInt32(einsatzFeld.Text);
users[MainWindow.currentUser].Geld-=einsatz;
Konto.Text = users[MainWindow.currentUser].Geld.ToString(); int einsatz = Convert.ToInt32(einsatzFeld.Text);
await Spin(); users[MainWindow.currentUser].Geld -= einsatz;
users[MainWindow.currentUser].Geld += CheckWin(currentSlot,einsatz); Konto.Text = users[MainWindow.currentUser].Geld.ToString();
Konto.Text = users[MainWindow.currentUser].Geld.ToString(); await Spin();
db.UpdateGeld( users[MainWindow.currentUser].Geld += CheckWin(currentSlot, einsatz);
users[MainWindow.currentUser].ID, Konto.Text = users[MainWindow.currentUser].Geld.ToString();
users[MainWindow.currentUser].Geld); db.UpdateGeld(
users[MainWindow.currentUser].ID,
users[MainWindow.currentUser].Geld);
/* catch (NullReferenceException)
{
MessageBox.Show(
"Bitte ein Betrag eingeben",
"Fehlermeldung 101",
MessageBoxButton.OK,
MessageBoxImage.Information);
}*/
} }
private void Hauptmenue(object sender, RoutedEventArgs e) private void Hauptmenue(object sender, RoutedEventArgs e)