Aufteilung

This commit is contained in:
2026-09-14 21:27:58 +02:00
parent 09a4d0cd40
commit 205126d724
14 changed files with 83 additions and 158 deletions
+13 -27
View File
@@ -22,7 +22,7 @@ namespace Casino
/// </summary>
public partial class Slots : Window
{
// Lenard Gerdes
private List<Image> _bilder;
private Random _random = new Random();
Database db = new Database();
@@ -46,7 +46,7 @@ namespace Casino
private int highestWin = 5;
// Lenard Gerdes
public Slots()
{
InitializeComponent();
@@ -90,6 +90,7 @@ namespace Casino
}
return image;
}
// Lenard Gerdes
private async Task Spin()
{
for (int i = 0; i < 15; i++)
@@ -120,20 +121,14 @@ namespace Casino
currentSlot[0, j] = randomBild;
LoadCard(_bilder[j], randomBild);
}
}
await Task.Delay(150);
}
}
// Lenard Gerdes
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();
@@ -141,20 +136,10 @@ namespace Casino
users[MainWindow.currentUser].Geld += CheckWin(currentSlot, einsatz);
Konto.Text = users[MainWindow.currentUser].Geld.ToString();
db.UpdateGeld(
users[MainWindow.currentUser].ID,
users[MainWindow.currentUser].ID,
users[MainWindow.currentUser].Geld);
/* catch (NullReferenceException)
{
MessageBox.Show(
"Bitte ein Betrag eingeben",
"Fehlermeldung 101",
MessageBoxButton.OK,
MessageBoxImage.Information);
}*/
}
// Lenard Gerdes
private void Hauptmenue(object sender, RoutedEventArgs e)
{
music.Stop();
@@ -162,7 +147,7 @@ namespace Casino
}
// Lenard Gerdes
public decimal CheckWin(int[,] board, decimal einsatz)
{
decimal multiplikator = 0m;
@@ -267,7 +252,7 @@ namespace Casino
return einsatz * multiplikator;
}
// Lenard Gerdes
private decimal CheckLine(params int[] werte)
{
decimal gewinn = 0;
@@ -315,16 +300,16 @@ namespace Casino
//Numberfield
//Numberfield Colin Langer
private static readonly Regex _regex = new Regex("^[0-9]"); // Regex to match non-numeric input
//nur nummern
//nur nummern Colin Langer
private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
e.Handled = !_regex.IsMatch(e.Text);
}
// Keine Spaces
// Keine Spaces Colin Langer
private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Space)
@@ -333,7 +318,7 @@ namespace Casino
}
}
//das man nichts reinkopieren kann außer Zahlen
//das man nichts reinkopieren kann außer Zahlen Colin Langer
private void TextBox_Pasting(object sender, DataObjectPastingEventArgs e)
{
if (e.DataObject.GetDataPresent(typeof(String)))
@@ -346,6 +331,7 @@ namespace Casino
}
}
// Lenard Gerdes
void PlayWinSound()
{
audio.PlaySound(db.GetSound(highestWin));