Compare commits
24
Commits
bf0f703f28
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
539a79a262 | ||
|
|
a071b93d46 | ||
|
|
1d89b1440a | ||
|
|
c19fca22d2 | ||
|
|
bb0552ba5a | ||
|
|
ca62b656b8 | ||
|
|
74adefe0aa | ||
|
|
94453ea9d2 | ||
|
|
d873e5d099 | ||
|
|
97a78428bb | ||
|
|
0a89009a93 | ||
|
|
78a22d9c0e | ||
|
|
571367ca8c | ||
|
|
e336e6369d | ||
|
|
205126d724 | ||
|
|
09a4d0cd40 | ||
|
|
1a02e3003f | ||
|
|
d8df625bac | ||
|
|
81550cf1bb | ||
|
|
20bf9eb37b | ||
|
|
fbc37f3e2b | ||
|
|
b42d119397 | ||
|
|
6735e1fcc2 | ||
|
|
4d2b5c7700 |
@@ -0,0 +1,102 @@
|
|||||||
|
<Window x:Class="Casino.AdminView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:Casino"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Adminbereich"
|
||||||
|
Height="700"
|
||||||
|
Width="1100"
|
||||||
|
WindowStartupLocation="CenterScreen">
|
||||||
|
<!-- Lenard Gerdes -->
|
||||||
|
|
||||||
|
|
||||||
|
<Grid Margin="20">
|
||||||
|
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="0"
|
||||||
|
Text="Adminbereich"
|
||||||
|
FontSize="30"
|
||||||
|
FontWeight="Bold"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Margin="0,0,0,20"/>
|
||||||
|
|
||||||
|
<!-- Nutzerliste -->
|
||||||
|
<DataGrid x:Name="UserDataGrid"
|
||||||
|
Grid.Row="1"
|
||||||
|
AutoGenerateColumns="False"
|
||||||
|
IsReadOnly="True"
|
||||||
|
SelectionMode="Single"
|
||||||
|
CanUserAddRows="False"
|
||||||
|
Margin="0,0,0,20">
|
||||||
|
|
||||||
|
<DataGrid.Columns>
|
||||||
|
|
||||||
|
<DataGridTextColumn Header="ID"
|
||||||
|
Binding="{Binding ID}"
|
||||||
|
Width="220"/>
|
||||||
|
|
||||||
|
<DataGridTextColumn Header="Name"
|
||||||
|
Binding="{Binding Name}"
|
||||||
|
Width="150"/>
|
||||||
|
|
||||||
|
<DataGridTextColumn Header="Alter"
|
||||||
|
Binding="{Binding Age}"
|
||||||
|
Width="80"/>
|
||||||
|
|
||||||
|
<DataGridTextColumn Header="Passwort"
|
||||||
|
Binding="{Binding Passwort}"
|
||||||
|
Width="280"/>
|
||||||
|
|
||||||
|
<DataGridTextColumn Header="Geld"
|
||||||
|
Binding="{Binding Geld}"
|
||||||
|
Width="100"/>
|
||||||
|
|
||||||
|
<DataGridTextColumn Header="Rolle"
|
||||||
|
Binding="{Binding Rolle}"
|
||||||
|
Width="100"/>
|
||||||
|
|
||||||
|
</DataGrid.Columns>
|
||||||
|
|
||||||
|
</DataGrid>
|
||||||
|
|
||||||
|
<StackPanel Grid.Row="2"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
HorizontalAlignment="Center">
|
||||||
|
|
||||||
|
<Button x:Name="BtnBearbeiten"
|
||||||
|
Content="Bearbeiten"
|
||||||
|
Width="150"
|
||||||
|
Height="45"
|
||||||
|
Margin="10"
|
||||||
|
Click="BtnBearbeiten_Click"/>
|
||||||
|
|
||||||
|
<Button x:Name="BtnLoeschen"
|
||||||
|
Content="Löschen"
|
||||||
|
Width="150"
|
||||||
|
Height="45"
|
||||||
|
Margin="10"
|
||||||
|
Click="BtnLoeschen_Click"/>
|
||||||
|
|
||||||
|
<Button Content="Aktualisieren"
|
||||||
|
Width="150"
|
||||||
|
Height="45"
|
||||||
|
Margin="10"
|
||||||
|
Click="BtnAktualisieren_Click"/>
|
||||||
|
|
||||||
|
<Button Content="Schließen"
|
||||||
|
Width="150"
|
||||||
|
Height="45"
|
||||||
|
Margin="10"
|
||||||
|
Click="BtnSchliessen_Click"/>
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace Casino
|
||||||
|
{
|
||||||
|
public partial class AdminView : Window
|
||||||
|
{
|
||||||
|
private readonly Database db = new Database();
|
||||||
|
|
||||||
|
private ObservableCollection<User> users;
|
||||||
|
|
||||||
|
public AdminView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
// Prüfen, ob der aktuell eingeloggte Benutzer Admin ist
|
||||||
|
if (MainWindow.currentUser < 0)
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"Es ist kein Benutzer eingeloggt.",
|
||||||
|
"Fehler",
|
||||||
|
MessageBoxButton.OK,
|
||||||
|
MessageBoxImage.Error);
|
||||||
|
|
||||||
|
Close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
users = db.GetUser();
|
||||||
|
|
||||||
|
// Sicherheitsprüfung über die Datenbank
|
||||||
|
if (MainWindow.currentUser >= users.Count ||
|
||||||
|
!db.SelectAdmin(users[MainWindow.currentUser].ID))
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"Du hast keine Admin-Rechte.",
|
||||||
|
"Zugriff verweigert",
|
||||||
|
MessageBoxButton.OK,
|
||||||
|
MessageBoxImage.Warning);
|
||||||
|
|
||||||
|
Close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UserDataGrid.ItemsSource = users;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnBearbeiten_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (UserDataGrid.SelectedItem is not User selectedUser)
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"Bitte wähle zuerst einen Benutzer aus.",
|
||||||
|
"Kein Benutzer ausgewählt",
|
||||||
|
MessageBoxButton.OK,
|
||||||
|
MessageBoxImage.Warning);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
EditUserView editView = new EditUserView(selectedUser);
|
||||||
|
|
||||||
|
editView.ShowDialog();
|
||||||
|
|
||||||
|
// Nach dem Schließen Daten neu laden
|
||||||
|
users = db.GetUser();
|
||||||
|
UserDataGrid.ItemsSource = users;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnLoeschen_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (UserDataGrid.SelectedItem is not User selectedUser)
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"Bitte wähle zuerst einen Benutzer aus.",
|
||||||
|
"Kein Benutzer ausgewählt",
|
||||||
|
MessageBoxButton.OK,
|
||||||
|
MessageBoxImage.Warning);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sicherheitsabfrage
|
||||||
|
MessageBoxResult result = MessageBox.Show(
|
||||||
|
$"Möchtest du den Benutzer '{selectedUser.Name}' wirklich löschen?",
|
||||||
|
"Benutzer löschen",
|
||||||
|
MessageBoxButton.YesNo,
|
||||||
|
MessageBoxImage.Warning);
|
||||||
|
|
||||||
|
if (result != MessageBoxResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Benutzer aus Datenbank löschen
|
||||||
|
bool success = db.DeleteUser(selectedUser.ID);
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"Benutzer wurde erfolgreich gelöscht.",
|
||||||
|
"Erfolgreich",
|
||||||
|
MessageBoxButton.OK,
|
||||||
|
MessageBoxImage.Information);
|
||||||
|
|
||||||
|
users = db.GetUser();
|
||||||
|
UserDataGrid.ItemsSource = users;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"Der Benutzer konnte nicht gelöscht werden.",
|
||||||
|
"Fehler",
|
||||||
|
MessageBoxButton.OK,
|
||||||
|
MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnAktualisieren_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
users = db.GetUser();
|
||||||
|
UserDataGrid.ItemsSource = users;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnSchliessen_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+57
-8
@@ -4,30 +4,79 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
namespace Casino
|
namespace Casino
|
||||||
{
|
{
|
||||||
class Audioplayer
|
class Audioplayer //ki
|
||||||
{
|
{
|
||||||
private readonly MediaPlayer player = new MediaPlayer();
|
private readonly MediaPlayer player = new MediaPlayer();
|
||||||
private readonly MediaPlayer shortplayer = new MediaPlayer();
|
private readonly MediaPlayer shortplayer = new MediaPlayer();
|
||||||
|
private readonly List<MediaPlayer> activePlayers = new();
|
||||||
|
|
||||||
public Audioplayer() { shortplayer.MediaEnded += Player_MediaEnded; }
|
public Audioplayer() { shortplayer.MediaEnded += Player_MediaEnded; }
|
||||||
|
|
||||||
public void PlaySound(byte[] audioBlob)
|
public void PlaySound(byte[] audioBlob, int soundId)
|
||||||
{
|
{
|
||||||
|
if (audioBlob == null || audioBlob.Length == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
string tempFile = System.IO.Path.Combine(
|
string tempFile = System.IO.Path.Combine(
|
||||||
System.IO.Path.GetTempPath(),
|
System.IO.Path.GetTempPath(),
|
||||||
Guid.NewGuid() + ".mp3");
|
"casino_" + Guid.NewGuid().ToString("N") + ".mp3");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
File.WriteAllBytes(tempFile, audioBlob);
|
try
|
||||||
|
{
|
||||||
|
File.WriteAllBytes(tempFile, audioBlob);
|
||||||
|
|
||||||
shortplayer.Open(new Uri(tempFile));
|
MediaPlayer player = new MediaPlayer();
|
||||||
shortplayer.Play();
|
|
||||||
|
activePlayers.Add(player);
|
||||||
|
|
||||||
|
player.MediaEnded += (sender, e) =>
|
||||||
|
{
|
||||||
|
player.Close();
|
||||||
|
activePlayers.Remove(player);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (File.Exists(tempFile))
|
||||||
|
File.Delete(tempFile);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// Datei wird eventuell noch kurz von Windows verwendet.
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
player.MediaFailed += (sender, e) =>
|
||||||
|
{
|
||||||
|
player.Close();
|
||||||
|
activePlayers.Remove(player);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (File.Exists(tempFile))
|
||||||
|
File.Delete(tempFile);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
player.Open(new Uri(tempFile));
|
||||||
|
player.Play();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"Fehler beim Abspielen des Sounds:\n" + ex.Message,
|
||||||
|
"Soundfehler",
|
||||||
|
MessageBoxButton.OK,
|
||||||
|
MessageBoxImage.Error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Player_MediaEnded(object? sender, EventArgs e)
|
private void Player_MediaEnded(object? sender, EventArgs e)
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
<Window x:Class="Casino.Blackjack"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
xmlns:local="clr-namespace:Casino"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
Title="Blackjack" Height="1080" Width="1980">
|
|
||||||
<Grid>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="100"></ColumnDefinition>
|
|
||||||
<ColumnDefinition Width="280"></ColumnDefinition>
|
|
||||||
<ColumnDefinition Width="20"></ColumnDefinition>
|
|
||||||
<ColumnDefinition Width="280"></ColumnDefinition>
|
|
||||||
<ColumnDefinition Width="20"></ColumnDefinition>
|
|
||||||
<ColumnDefinition Width="280"></ColumnDefinition>
|
|
||||||
<ColumnDefinition Width="20"></ColumnDefinition>
|
|
||||||
<ColumnDefinition Width="280"></ColumnDefinition>
|
|
||||||
<ColumnDefinition Width="20"></ColumnDefinition>
|
|
||||||
<ColumnDefinition Width="280"></ColumnDefinition>
|
|
||||||
<ColumnDefinition Width="20"></ColumnDefinition>
|
|
||||||
<ColumnDefinition Width="280"></ColumnDefinition>
|
|
||||||
<ColumnDefinition Width="100"></ColumnDefinition>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="70"></RowDefinition>
|
|
||||||
<RowDefinition Height="270"></RowDefinition>
|
|
||||||
<RowDefinition Height="270"></RowDefinition>
|
|
||||||
<RowDefinition Height="270"></RowDefinition>
|
|
||||||
<RowDefinition Height="200"></RowDefinition>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
|
|
||||||
|
|
||||||
<Image Grid.Column="5" Grid.Row="1" x:Name="Dealer_Bild_1"/>
|
|
||||||
<Image Grid.Column="7" Grid.Row="1" x:Name="Dealer_Bild_2"/>
|
|
||||||
|
|
||||||
<Button Grid.Row="0" Content="Hauptmenü" HorizontalAlignment="Center" Click="Hauptmenue" Width="100"/>
|
|
||||||
<TextBox HorizontalAlignment="Right" Height="100" Grid.Row="4" TextWrapping="Wrap" Text="Einsatz" VerticalAlignment="Center" Width="192" PreviewTextInput="TextBox_OnPreviewTextInput" PreviewKeyDown="TextBox_OnPreviewKeyDown" DataObject.Pasting="TextBox_Pasting" Grid.Column="5" Grid.ColumnSpan="3" Margin="0,0,194,0"/>
|
|
||||||
</Grid>
|
|
||||||
</Window>
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
namespace Casino
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Interaktionslogik für Blackjack.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class Blackjack : Window
|
|
||||||
{
|
|
||||||
public Blackjack()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
rand();
|
|
||||||
LoadCard(55);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadCard(int Bild)
|
|
||||||
{
|
|
||||||
Database db = new Database();
|
|
||||||
byte[] img = db.GetCardImage(Bild);//2-10
|
|
||||||
|
|
||||||
Dealer_Bild_1.Source = ByteArrayToImage(img);
|
|
||||||
}
|
|
||||||
|
|
||||||
private BitmapImage ByteArrayToImage(byte[] bytes)
|
|
||||||
{
|
|
||||||
BitmapImage image = new BitmapImage();
|
|
||||||
using (MemoryStream ms = new MemoryStream(bytes))
|
|
||||||
{
|
|
||||||
image.BeginInit();
|
|
||||||
image.CacheOption = BitmapCacheOption.OnLoad;
|
|
||||||
image.StreamSource = ms;
|
|
||||||
image.EndInit();
|
|
||||||
}
|
|
||||||
return image;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int rand()
|
|
||||||
{
|
|
||||||
Random ran = new Random();
|
|
||||||
int temp = ran.Next(13, 66);
|
|
||||||
Console.WriteLine(temp);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
private void Hauptmenue(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Numberfeld
|
|
||||||
private static readonly Regex _regex = new Regex("[^0-9]"); // Regex to match non-numeric input
|
|
||||||
|
|
||||||
//nur nummern
|
|
||||||
private void TextBox_OnPreviewTextInput(object sender, TextCompositionEventArgs e)
|
|
||||||
{
|
|
||||||
e.Handled = !_regex.IsMatch(e.Text);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Keine Spaces
|
|
||||||
private void TextBox_OnPreviewKeyDown(object sender, KeyEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.Key == Key.Space)
|
|
||||||
{
|
|
||||||
e.Handled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//das man nichts reinkopieren kann außer Zahlen
|
|
||||||
private void TextBox_Pasting(object sender, DataObjectPastingEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.DataObject.GetDataPresent(typeof(String)))
|
|
||||||
{
|
|
||||||
var text = (String)e.DataObject.GetData((typeof(String)));
|
|
||||||
if (!_regex.IsMatch((string)text))
|
|
||||||
{
|
|
||||||
e.CancelCommand();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+27
-28
@@ -5,39 +5,39 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:Casino"
|
xmlns:local="clr-namespace:Casino"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Bus Driver"
|
Title="Bus Fahrer"
|
||||||
Height="1080"
|
Height="1080"
|
||||||
Width="1960"
|
Width="1800"
|
||||||
WindowState="Maximized"
|
WindowState="Maximized"
|
||||||
WindowStyle="None"
|
WindowStyle="None"
|
||||||
Background="#2C3E50">
|
Background="#195925">
|
||||||
|
<!-- Lenard Gerdes -->
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="100"/>
|
<ColumnDefinition Width="1*"></ColumnDefinition>
|
||||||
<ColumnDefinition Width="280"/>
|
<ColumnDefinition Width="200"></ColumnDefinition>
|
||||||
<ColumnDefinition Width="20"/>
|
<ColumnDefinition Width="20"></ColumnDefinition>
|
||||||
<ColumnDefinition Width="280"/>
|
<ColumnDefinition Width="200"></ColumnDefinition>
|
||||||
<ColumnDefinition Width="20"/>
|
<ColumnDefinition Width="20"></ColumnDefinition>
|
||||||
<ColumnDefinition Width="280"/>
|
<ColumnDefinition Width="200"></ColumnDefinition>
|
||||||
<ColumnDefinition Width="20"/>
|
<ColumnDefinition Width="20"></ColumnDefinition>
|
||||||
<ColumnDefinition Width="280"/>
|
<ColumnDefinition Width="200"></ColumnDefinition>
|
||||||
<ColumnDefinition Width="20"/>
|
<ColumnDefinition Width="20"></ColumnDefinition>
|
||||||
<ColumnDefinition Width="280"/>
|
<ColumnDefinition Width="200"></ColumnDefinition>
|
||||||
<ColumnDefinition Width="20"/>
|
<ColumnDefinition Width="20"></ColumnDefinition>
|
||||||
<ColumnDefinition Width="280"/>
|
<ColumnDefinition Width="200"></ColumnDefinition>
|
||||||
<ColumnDefinition Width="100"/>
|
<ColumnDefinition Width="1*"></ColumnDefinition>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="70"/>
|
<RowDefinition Height="1*"></RowDefinition>
|
||||||
<RowDefinition Height="270"/>
|
<RowDefinition Height="200"></RowDefinition>
|
||||||
<RowDefinition Height="270"/>
|
<RowDefinition Height="200"></RowDefinition>
|
||||||
<RowDefinition Height="270"/>
|
<RowDefinition Height="200"></RowDefinition>
|
||||||
<RowDefinition Height="200"/>
|
<RowDefinition Height="1*"></RowDefinition>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<!-- Main Menu -->
|
|
||||||
<Button Grid.Column="0"
|
<Button Grid.Column="0"
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Content="Main Menu"
|
Content="Main Menu"
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
<Image Grid.Column="7" Grid.Row="2" x:Name="Bild_3" Margin="5" Stretch="Uniform"/>
|
<Image Grid.Column="7" Grid.Row="2" x:Name="Bild_3" Margin="5" Stretch="Uniform"/>
|
||||||
<Image Grid.Column="9" Grid.Row="2" x:Name="Bild_4" Margin="5" Stretch="Uniform"/>
|
<Image Grid.Column="9" Grid.Row="2" x:Name="Bild_4" Margin="5" Stretch="Uniform"/>
|
||||||
|
|
||||||
<!-- Frage 1: Rot / Schwarz -->
|
<!-- Rot / Schwarz -->
|
||||||
<StackPanel x:Name="PanelRedBlack"
|
<StackPanel x:Name="PanelRedBlack"
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
Grid.Column="3"
|
Grid.Column="3"
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
Tag="Black"/>
|
Tag="Black"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Frage 2: Höher / Niedriger -->
|
<!-- Höher / Niedriger -->
|
||||||
<StackPanel x:Name="PanelHigherLower"
|
<StackPanel x:Name="PanelHigherLower"
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
Grid.Column="3"
|
Grid.Column="3"
|
||||||
@@ -120,7 +120,7 @@
|
|||||||
Tag="Lower"/>
|
Tag="Lower"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Frage 3: Innen / Außen -->
|
<!-- Innen / Außen -->
|
||||||
<StackPanel x:Name="PanelInsideOutside"
|
<StackPanel x:Name="PanelInsideOutside"
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
Grid.Column="3"
|
Grid.Column="3"
|
||||||
@@ -154,7 +154,7 @@
|
|||||||
Tag="Outside"/>
|
Tag="Outside"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Frage 4: Symbol -->
|
<!-- Symbol -->
|
||||||
<StackPanel x:Name="PanelSuit"
|
<StackPanel x:Name="PanelSuit"
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
Grid.Column="3"
|
Grid.Column="3"
|
||||||
@@ -285,7 +285,6 @@
|
|||||||
Grid.Row="4"
|
Grid.Row="4"
|
||||||
Height="30"
|
Height="30"
|
||||||
Width="100"
|
Width="100"
|
||||||
Margin="90,133,90,37"
|
|
||||||
Background="DarkRed"
|
Background="DarkRed"
|
||||||
Foreground="Silver"
|
Foreground="Silver"
|
||||||
TextAlignment="Right"
|
TextAlignment="Right"
|
||||||
|
|||||||
+52
-83
@@ -15,7 +15,7 @@ namespace Casino
|
|||||||
{
|
{
|
||||||
public partial class Busfahrer : Window
|
public partial class Busfahrer : Window
|
||||||
{
|
{
|
||||||
public class Card
|
public class Card //Colin Langer
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string WertRaw { get; set; } = string.Empty;
|
public string WertRaw { get; set; } = string.Empty;
|
||||||
@@ -25,11 +25,9 @@ namespace Casino
|
|||||||
|
|
||||||
public bool IsRed =>
|
public bool IsRed =>
|
||||||
FarbeRaw.Equals("Hearts", StringComparison.OrdinalIgnoreCase) ||
|
FarbeRaw.Equals("Hearts", StringComparison.OrdinalIgnoreCase) ||
|
||||||
FarbeRaw.Equals("Diamonds", StringComparison.OrdinalIgnoreCase) ||
|
FarbeRaw.Equals("Diamond", StringComparison.OrdinalIgnoreCase);
|
||||||
FarbeRaw.Equals("Diamond", StringComparison.OrdinalIgnoreCase) ||
|
|
||||||
FarbeRaw.Equals("Herz", StringComparison.OrdinalIgnoreCase) ||
|
|
||||||
FarbeRaw.Equals("Karo", StringComparison.OrdinalIgnoreCase);
|
|
||||||
|
|
||||||
|
//Colin Langer
|
||||||
public Card(int id, string wert, string farbe, byte[] imgBytes)
|
public Card(int id, string wert, string farbe, byte[] imgBytes)
|
||||||
{
|
{
|
||||||
Id = id;
|
Id = id;
|
||||||
@@ -42,19 +40,21 @@ namespace Casino
|
|||||||
Image = ByteArrayToImage(imgBytes);
|
Image = ByteArrayToImage(imgBytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Colin Langer
|
||||||
|
//verwandelt den textwert in punktwert um
|
||||||
private static int ParseValue(string wert)
|
private static int ParseValue(string wert)
|
||||||
{
|
{
|
||||||
return wert.Trim() switch
|
return wert.Trim() switch
|
||||||
{
|
{
|
||||||
"Jack" or "Bube" => 11,
|
"Jack" => 11,
|
||||||
"Queen" or "Dame" => 12,
|
"Queen" => 12,
|
||||||
"King" or "König" => 13,
|
"King" => 13,
|
||||||
"Ace" or "Ass" => 14,
|
"Ace" => 14,
|
||||||
_ => int.TryParse(wert, out int value) ? value : 0
|
_ => int.TryParse(wert, out int value) ? value : 0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
//Colin Langer
|
||||||
|
//konvertiert das Bild von der Datenbank um
|
||||||
private static BitmapImage ByteArrayToImage(byte[] bytes)
|
private static BitmapImage ByteArrayToImage(byte[] bytes)
|
||||||
{
|
{
|
||||||
BitmapImage image = new BitmapImage();
|
BitmapImage image = new BitmapImage();
|
||||||
@@ -98,37 +98,30 @@ namespace Casino
|
|||||||
|
|
||||||
private User CurrentUser => users[MainWindow.currentUser];
|
private User CurrentUser => users[MainWindow.currentUser];
|
||||||
|
|
||||||
// =========================
|
// Lenard Gerdes
|
||||||
// KONTO
|
|
||||||
// =========================
|
|
||||||
|
|
||||||
private void UpdateAccountDisplay()
|
private void UpdateAccountDisplay()
|
||||||
{
|
{
|
||||||
Konto.Text = CurrentUser.Geld.ToString();
|
Konto.Text = CurrentUser.Geld.ToString();
|
||||||
}
|
}
|
||||||
|
// Lenard Gerdes
|
||||||
private void SaveAccount()
|
private void SaveAccount()
|
||||||
{
|
{
|
||||||
db.UpdateGeld(CurrentUser.ID, CurrentUser.Geld);
|
db.UpdateGeld(CurrentUser.ID, CurrentUser.Geld);
|
||||||
UpdateAccountDisplay();
|
UpdateAccountDisplay();
|
||||||
}
|
}
|
||||||
|
//Colin Langer
|
||||||
// =========================
|
|
||||||
// SPIEL STARTEN
|
|
||||||
// =========================
|
|
||||||
|
|
||||||
private void BtnStart_Click(object sender, RoutedEventArgs e)
|
private void BtnStart_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
StartGameFromInput();
|
StartGameFromInput();
|
||||||
}
|
}
|
||||||
|
//Colin Langer
|
||||||
private void StartGameFromInput()
|
private void StartGameFromInput()
|
||||||
{
|
{
|
||||||
if (roundRunning)
|
if (roundRunning)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//Prüfen die eingabe
|
||||||
if (!int.TryParse(TxtBet.Text, out int bet) || bet <= 0)
|
if (!int.TryParse(TxtBet.Text, out int bet) || bet <= 0)
|
||||||
{
|
{
|
||||||
MessageBox.Show(
|
MessageBox.Show(
|
||||||
@@ -154,7 +147,7 @@ namespace Casino
|
|||||||
currentBet = bet;
|
currentBet = bet;
|
||||||
StartRound();
|
StartRound();
|
||||||
}
|
}
|
||||||
|
//Colin Langer
|
||||||
private void StartRound()
|
private void StartRound()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -165,7 +158,6 @@ namespace Casino
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Einsatz vom Konto abziehen
|
|
||||||
CurrentUser.Geld -= Convert.ToInt32(currentBet);
|
CurrentUser.Geld -= Convert.ToInt32(currentBet);
|
||||||
SaveAccount();
|
SaveAccount();
|
||||||
|
|
||||||
@@ -187,10 +179,9 @@ namespace Casino
|
|||||||
MessageBoxButton.OK,
|
MessageBoxButton.OK,
|
||||||
MessageBoxImage.Information);
|
MessageBoxImage.Information);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//Colin Langer
|
||||||
|
// lädt und mischt die karten aus der datenbank
|
||||||
private void LoadCards()
|
private void LoadCards()
|
||||||
{
|
{
|
||||||
deck = db.GetAllCards()
|
deck = db.GetAllCards()
|
||||||
@@ -211,7 +202,8 @@ namespace Casino
|
|||||||
handCards.Add(DrawCard());
|
handCards.Add(DrawCard());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Colin Langer
|
||||||
|
// nimmt die oberste karte
|
||||||
private Card DrawCard()
|
private Card DrawCard()
|
||||||
{
|
{
|
||||||
Card card = deck[0];
|
Card card = deck[0];
|
||||||
@@ -219,10 +211,7 @@ namespace Casino
|
|||||||
return card;
|
return card;
|
||||||
}
|
}
|
||||||
|
|
||||||
// =========================
|
//Colin Langer
|
||||||
// KARTEN ANZEIGEN
|
|
||||||
// =========================
|
|
||||||
|
|
||||||
private void UpdateHandUI()
|
private void UpdateHandUI()
|
||||||
{
|
{
|
||||||
Bild_1.Source = cardBackImage;
|
Bild_1.Source = cardBackImage;
|
||||||
@@ -255,7 +244,8 @@ namespace Casino
|
|||||||
Bild_4.Source = handCards[3].Image;
|
Bild_4.Source = handCards[3].Image;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Colin Langer
|
||||||
|
// dreht die karten je nach runde um
|
||||||
private void RevealCurrentCard()
|
private void RevealCurrentCard()
|
||||||
{
|
{
|
||||||
if (handCards.Count < 4)
|
if (handCards.Count < 4)
|
||||||
@@ -283,10 +273,7 @@ namespace Casino
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// =========================
|
// Lenard Gerdes
|
||||||
// SPIELLOGIK
|
|
||||||
// =========================
|
|
||||||
|
|
||||||
private async Task ProcessGuessAsync(bool success)
|
private async Task ProcessGuessAsync(bool success)
|
||||||
{
|
{
|
||||||
if (!roundRunning)
|
if (!roundRunning)
|
||||||
@@ -303,7 +290,7 @@ namespace Casino
|
|||||||
UpdateWinDisplay();
|
UpdateWinDisplay();
|
||||||
SetPhaseUI();
|
SetPhaseUI();
|
||||||
|
|
||||||
await Task.Delay(1000);
|
await Task.Delay(100);
|
||||||
|
|
||||||
// Nächste Runde mit demselben Einsatz
|
// Nächste Runde mit demselben Einsatz
|
||||||
if (currentBet <= CurrentUser.Geld)
|
if (currentBet <= CurrentUser.Geld)
|
||||||
@@ -325,16 +312,14 @@ namespace Casino
|
|||||||
UpdateWinDisplay();
|
UpdateWinDisplay();
|
||||||
SetPhaseUI();
|
SetPhaseUI();
|
||||||
|
|
||||||
// Vierte Frage richtig -> automatisch auszahlen
|
|
||||||
if (currentPhase == 4)
|
if (currentPhase == 4)
|
||||||
{
|
{
|
||||||
roundRunning = false;
|
roundRunning = false;
|
||||||
|
|
||||||
PayoutCurrentProfit();
|
PayoutCurrentProfit();
|
||||||
|
|
||||||
await Task.Delay(1000);
|
await Task.Delay(100);
|
||||||
|
|
||||||
// Neue Runde automatisch starten
|
|
||||||
if (currentBet <= CurrentUser.Geld)
|
if (currentBet <= CurrentUser.Geld)
|
||||||
{
|
{
|
||||||
StartRound();
|
StartRound();
|
||||||
@@ -345,7 +330,7 @@ namespace Casino
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Colin Langer
|
||||||
private decimal CalculateCurrentProfit()
|
private decimal CalculateCurrentProfit()
|
||||||
{
|
{
|
||||||
return currentPhase switch
|
return currentPhase switch
|
||||||
@@ -357,11 +342,8 @@ namespace Casino
|
|||||||
_ => 0
|
_ => 0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
//Colin Langer
|
||||||
// =========================
|
// passt die buttons an je nach runde
|
||||||
// FRAGEN
|
|
||||||
// =========================
|
|
||||||
|
|
||||||
private async void ColorButton_Click(object sender, RoutedEventArgs e)
|
private async void ColorButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is not Button button)
|
if (sender is not Button button)
|
||||||
@@ -383,7 +365,7 @@ namespace Casino
|
|||||||
|
|
||||||
await ProcessGuessAsync(success);
|
await ProcessGuessAsync(success);
|
||||||
}
|
}
|
||||||
|
//Colin Langer
|
||||||
private async void HigherLowerButton_Click(object sender, RoutedEventArgs e)
|
private async void HigherLowerButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is not Button button)
|
if (sender is not Button button)
|
||||||
@@ -402,7 +384,7 @@ namespace Casino
|
|||||||
|
|
||||||
await ProcessGuessAsync(success);
|
await ProcessGuessAsync(success);
|
||||||
}
|
}
|
||||||
|
//Colin Langer
|
||||||
private async void InsideOutsideButton_Click(object sender, RoutedEventArgs e)
|
private async void InsideOutsideButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is not Button button)
|
if (sender is not Button button)
|
||||||
@@ -424,7 +406,7 @@ namespace Casino
|
|||||||
|
|
||||||
await ProcessGuessAsync(success);
|
await ProcessGuessAsync(success);
|
||||||
}
|
}
|
||||||
|
//Colin Langer
|
||||||
private async void BtnSuit_Click(object sender, RoutedEventArgs e)
|
private async void BtnSuit_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is not Button button || button.Tag == null)
|
if (sender is not Button button || button.Tag == null)
|
||||||
@@ -439,7 +421,7 @@ namespace Casino
|
|||||||
|
|
||||||
await ProcessGuessAsync(success);
|
await ProcessGuessAsync(success);
|
||||||
}
|
}
|
||||||
|
//Colin Langer
|
||||||
private static bool IsSameSuit(string cardSuit, string chosenSuit)
|
private static bool IsSameSuit(string cardSuit, string chosenSuit)
|
||||||
{
|
{
|
||||||
if (cardSuit.Equals(chosenSuit, StringComparison.OrdinalIgnoreCase))
|
if (cardSuit.Equals(chosenSuit, StringComparison.OrdinalIgnoreCase))
|
||||||
@@ -449,25 +431,20 @@ namespace Casino
|
|||||||
|
|
||||||
return chosenSuit switch
|
return chosenSuit switch
|
||||||
{
|
{
|
||||||
"Hearts" => cardSuit.Equals("Herz", StringComparison.OrdinalIgnoreCase),
|
"Hearts" => cardSuit.Equals("Hearts", StringComparison.OrdinalIgnoreCase),
|
||||||
"Diamonds" => cardSuit.Equals("Karo", StringComparison.OrdinalIgnoreCase) ||
|
"Diamonds" => cardSuit.Equals("Diamond", StringComparison.OrdinalIgnoreCase),
|
||||||
cardSuit.Equals("Diamond", StringComparison.OrdinalIgnoreCase),
|
"Spades" => cardSuit.Equals("Spades", StringComparison.OrdinalIgnoreCase),
|
||||||
"Spades" => cardSuit.Equals("Pik", StringComparison.OrdinalIgnoreCase),
|
"Clubs" => cardSuit.Equals("Clubs", StringComparison.OrdinalIgnoreCase),
|
||||||
"Clubs" => cardSuit.Equals("Kreuz", StringComparison.OrdinalIgnoreCase),
|
|
||||||
_ => false
|
_ => false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
//Colin Langer
|
||||||
private enum CardColor
|
private enum CardColor
|
||||||
{
|
{
|
||||||
Red,
|
Red,
|
||||||
Black
|
Black
|
||||||
}
|
}
|
||||||
|
//Colin Langer
|
||||||
// =========================
|
|
||||||
// CASH OUT
|
|
||||||
// =========================
|
|
||||||
|
|
||||||
private void BtnCashOut_Click(object sender, RoutedEventArgs e)
|
private void BtnCashOut_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!roundRunning || currentProfit <= 0)
|
if (!roundRunning || currentProfit <= 0)
|
||||||
@@ -488,7 +465,7 @@ namespace Casino
|
|||||||
|
|
||||||
ShowWaitingState();
|
ShowWaitingState();
|
||||||
}
|
}
|
||||||
|
//Colin Langer
|
||||||
private void PayoutCurrentProfit()
|
private void PayoutCurrentProfit()
|
||||||
{
|
{
|
||||||
if (currentProfit <= 0)
|
if (currentProfit <= 0)
|
||||||
@@ -500,10 +477,8 @@ namespace Casino
|
|||||||
SaveAccount();
|
SaveAccount();
|
||||||
}
|
}
|
||||||
|
|
||||||
// =========================
|
//Colin Langer
|
||||||
// UI
|
// blendet die buttons der jewaligen runde ein
|
||||||
// =========================
|
|
||||||
|
|
||||||
private void SetPhaseUI()
|
private void SetPhaseUI()
|
||||||
{
|
{
|
||||||
PanelRedBlack.Visibility = Visibility.Collapsed;
|
PanelRedBlack.Visibility = Visibility.Collapsed;
|
||||||
@@ -541,7 +516,8 @@ namespace Casino
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Colin Langer
|
||||||
|
// wartet kurz falls ein neuer einsatz eingegeben wird
|
||||||
private void ShowWaitingState()
|
private void ShowWaitingState()
|
||||||
{
|
{
|
||||||
roundRunning = false;
|
roundRunning = false;
|
||||||
@@ -554,26 +530,19 @@ namespace Casino
|
|||||||
BtnStart.Visibility = Visibility.Visible;
|
BtnStart.Visibility = Visibility.Visible;
|
||||||
TxtBet.IsEnabled = true;
|
TxtBet.IsEnabled = true;
|
||||||
}
|
}
|
||||||
|
//Colin Langer
|
||||||
private void UpdateWinDisplay()
|
private void UpdateWinDisplay()
|
||||||
{
|
{
|
||||||
BtnCashOut.Content = $"Cash Out (${currentProfit:F2})";
|
BtnCashOut.Content = $"Cash Out (${currentProfit:F2})";
|
||||||
}
|
}
|
||||||
|
//Colin Langer
|
||||||
// =========================
|
|
||||||
// HAUPTMENÜ
|
|
||||||
// =========================
|
|
||||||
|
|
||||||
private void Hauptmenue(object sender, RoutedEventArgs e)
|
private void Hauptmenue(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
music.Stop();
|
music.Stop();
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
//Colin Langer
|
||||||
// =========================
|
// verwandelt das bild aus der datenbank um in eine bild für die oberfläche
|
||||||
// BILD AUS BYTE[]
|
|
||||||
// =========================
|
|
||||||
|
|
||||||
private static BitmapImage ByteArrayToImage(byte[] bytes)
|
private static BitmapImage ByteArrayToImage(byte[] bytes)
|
||||||
{
|
{
|
||||||
BitmapImage image = new BitmapImage();
|
BitmapImage image = new BitmapImage();
|
||||||
@@ -591,9 +560,9 @@ namespace Casino
|
|||||||
}
|
}
|
||||||
|
|
||||||
// =========================
|
// =========================
|
||||||
// EINSATZ VALIDIERUNG
|
// EINSATZFELD Colin Langer
|
||||||
// =========================
|
// =========================
|
||||||
|
// In Slots ist die erklärung drin
|
||||||
|
|
||||||
private static readonly Regex NumberRegex = new Regex("^[0-9]+$");
|
private static readonly Regex NumberRegex = new Regex("^[0-9]+$");
|
||||||
|
|
||||||
@@ -626,4 +595,4 @@ namespace Casino
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
File diff suppressed because one or more lines are too long
+122
-5
@@ -5,6 +5,7 @@ using System.Data;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
using MySql.Data.MySqlClient;
|
using MySql.Data.MySqlClient;
|
||||||
|
|
||||||
namespace Casino
|
namespace Casino
|
||||||
@@ -16,6 +17,7 @@ namespace Casino
|
|||||||
{
|
{
|
||||||
ObservableCollection<User> user = new ObservableCollection<User>();
|
ObservableCollection<User> user = new ObservableCollection<User>();
|
||||||
|
|
||||||
|
//Lenard Gerdes
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
MySql.Data.MySqlClient.MySqlConnection myConnection;
|
MySql.Data.MySqlClient.MySqlConnection myConnection;
|
||||||
@@ -40,7 +42,8 @@ namespace Casino
|
|||||||
Name = myReader.GetString("name"),
|
Name = myReader.GetString("name"),
|
||||||
Alter = myReader.GetInt32("age"),
|
Alter = myReader.GetInt32("age"),
|
||||||
Passwort = myReader.GetString("passwort"),
|
Passwort = myReader.GetString("passwort"),
|
||||||
Geld = myReader.GetDecimal("geld")
|
Geld = myReader.GetDecimal("geld"),
|
||||||
|
Rolle = myReader.GetString("Rolle")
|
||||||
};
|
};
|
||||||
|
|
||||||
user.Add(u);
|
user.Add(u);
|
||||||
@@ -82,7 +85,7 @@ namespace Casino
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Colin Langer
|
||||||
public byte[] GetCardImage(int id)
|
public byte[] GetCardImage(int id)
|
||||||
{
|
{
|
||||||
byte[] imageBytes = null;
|
byte[] imageBytes = null;
|
||||||
@@ -106,7 +109,7 @@ namespace Casino
|
|||||||
|
|
||||||
return imageBytes;
|
return imageBytes;
|
||||||
}
|
}
|
||||||
|
//Cloin Langer
|
||||||
public List<Busfahrer.Card> GetAllCards()
|
public List<Busfahrer.Card> GetAllCards()
|
||||||
{
|
{
|
||||||
var cards = new List<Busfahrer.Card>();
|
var cards = new List<Busfahrer.Card>();
|
||||||
@@ -135,8 +138,8 @@ namespace Casino
|
|||||||
|
|
||||||
return cards;
|
return cards;
|
||||||
}
|
}
|
||||||
|
|
||||||
// NEU: Holt das Bild der Kartenrückseite
|
// Holt das Bild der Kartenrückseite Colin Langer
|
||||||
public byte[] GetCardBackImage()
|
public byte[] GetCardBackImage()
|
||||||
{
|
{
|
||||||
byte[] imageBytes = null;
|
byte[] imageBytes = null;
|
||||||
@@ -200,5 +203,119 @@ namespace Casino
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool SelectAdmin(string userId)
|
||||||
|
{
|
||||||
|
using MySqlConnection connection = new MySqlConnection(myConnectionString);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
connection.Open();
|
||||||
|
|
||||||
|
string sql = @"
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM Nutzer
|
||||||
|
WHERE id = @id
|
||||||
|
AND Rolle = 'Admin'";
|
||||||
|
|
||||||
|
using MySqlCommand command = new MySqlCommand(sql, connection);
|
||||||
|
|
||||||
|
command.Parameters.AddWithValue("@id", userId);
|
||||||
|
|
||||||
|
int count = Convert.ToInt32(command.ExecuteScalar());
|
||||||
|
|
||||||
|
return count > 0;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"Fehler bei der Admin-Abfrage:\n" + ex.Message,
|
||||||
|
"Datenbankfehler",
|
||||||
|
MessageBoxButton.OK,
|
||||||
|
MessageBoxImage.Error);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool DeleteUser(string userId)
|
||||||
|
{
|
||||||
|
using MySqlConnection connection = new MySqlConnection(myConnectionString);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
connection.Open();
|
||||||
|
|
||||||
|
string sql = @"
|
||||||
|
DELETE FROM Nutzer
|
||||||
|
WHERE id = @id";
|
||||||
|
|
||||||
|
using MySqlCommand command = new MySqlCommand(sql, connection);
|
||||||
|
|
||||||
|
command.Parameters.AddWithValue("@id", userId);
|
||||||
|
|
||||||
|
int affectedRows = command.ExecuteNonQuery();
|
||||||
|
|
||||||
|
return affectedRows > 0;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"Fehler beim Löschen des Benutzers:\n" + ex.Message,
|
||||||
|
"Datenbankfehler",
|
||||||
|
MessageBoxButton.OK,
|
||||||
|
MessageBoxImage.Error);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool UpdateUser(
|
||||||
|
string userId,
|
||||||
|
string name,
|
||||||
|
int age,
|
||||||
|
string passwort,
|
||||||
|
decimal geld,
|
||||||
|
string rolle)
|
||||||
|
{
|
||||||
|
using MySqlConnection connection = new MySqlConnection(myConnectionString);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
connection.Open();
|
||||||
|
|
||||||
|
string sql = @"
|
||||||
|
UPDATE Nutzer
|
||||||
|
SET name = @name,
|
||||||
|
age = @age,
|
||||||
|
passwort = @passwort,
|
||||||
|
geld = @geld,
|
||||||
|
Rolle = @rolle
|
||||||
|
WHERE id = @id";
|
||||||
|
|
||||||
|
using MySqlCommand command = new MySqlCommand(sql, connection);
|
||||||
|
|
||||||
|
command.Parameters.AddWithValue("@name", name);
|
||||||
|
command.Parameters.AddWithValue("@age", age);
|
||||||
|
command.Parameters.AddWithValue("@passwort", passwort);
|
||||||
|
command.Parameters.AddWithValue("@geld", geld);
|
||||||
|
command.Parameters.AddWithValue("@rolle", rolle);
|
||||||
|
command.Parameters.AddWithValue("@id", userId);
|
||||||
|
|
||||||
|
int affectedRows = command.ExecuteNonQuery();
|
||||||
|
|
||||||
|
return affectedRows > 0;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"Fehler beim Aktualisieren des Benutzers:\n" + ex.Message,
|
||||||
|
"Datenbankfehler",
|
||||||
|
MessageBoxButton.OK,
|
||||||
|
MessageBoxImage.Error);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Casino
|
|
||||||
{
|
|
||||||
internal class Decks
|
|
||||||
{
|
|
||||||
int Deckid { get; set; }
|
|
||||||
int Kartenid { get; set; }
|
|
||||||
string name { get; set; }
|
|
||||||
|
|
||||||
public Decks(int d, int k, string n)
|
|
||||||
{
|
|
||||||
Deckid = d;
|
|
||||||
Kartenid = k;
|
|
||||||
name = n;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
<Window x:Class="Casino.EditUserView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
Title="Benutzer bearbeiten"
|
||||||
|
Height="550"
|
||||||
|
Width="500"
|
||||||
|
WindowStartupLocation="CenterScreen">
|
||||||
|
<!-- Lenard Gerdes -->
|
||||||
|
|
||||||
|
<Grid Margin="25">
|
||||||
|
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="0"
|
||||||
|
Text="Benutzer bearbeiten"
|
||||||
|
FontSize="28"
|
||||||
|
FontWeight="Bold"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Margin="0,0,0,25"/>
|
||||||
|
|
||||||
|
<StackPanel Grid.Row="1"
|
||||||
|
Margin="0,5">
|
||||||
|
|
||||||
|
<TextBlock Text="Name"
|
||||||
|
FontWeight="Bold"/>
|
||||||
|
|
||||||
|
<TextBox x:Name="TxtName"
|
||||||
|
Height="35"/>
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Grid.Row="2"
|
||||||
|
Margin="0,5">
|
||||||
|
|
||||||
|
<TextBlock Text="Alter"
|
||||||
|
FontWeight="Bold"/>
|
||||||
|
|
||||||
|
<TextBox x:Name="TxtAge"
|
||||||
|
Height="35"/>
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Grid.Row="3"
|
||||||
|
Margin="0,5">
|
||||||
|
|
||||||
|
<TextBlock Text="Neues Passwort"
|
||||||
|
FontWeight="Bold"/>
|
||||||
|
|
||||||
|
<PasswordBox x:Name="TxtPasswort"
|
||||||
|
Height="35"/>
|
||||||
|
|
||||||
|
<TextBlock Text="Leer lassen = Passwort nicht ändern"
|
||||||
|
FontSize="12"
|
||||||
|
Foreground="Gray"/>
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Grid.Row="4"
|
||||||
|
Margin="0,5">
|
||||||
|
|
||||||
|
<TextBlock Text="Geld"
|
||||||
|
FontWeight="Bold"/>
|
||||||
|
|
||||||
|
<TextBox x:Name="TxtGeld"
|
||||||
|
Height="35"/>
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Grid.Row="5"
|
||||||
|
Margin="0,5">
|
||||||
|
|
||||||
|
<TextBlock Text="Rolle"
|
||||||
|
FontWeight="Bold"/>
|
||||||
|
|
||||||
|
<ComboBox x:Name="CmbRolle"
|
||||||
|
Height="35">
|
||||||
|
|
||||||
|
<ComboBoxItem Content="User"/>
|
||||||
|
<ComboBoxItem Content="Admin"/>
|
||||||
|
|
||||||
|
</ComboBox>
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Grid.Row="6"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
|
Margin="0,25,0,0">
|
||||||
|
|
||||||
|
<Button Content="Speichern"
|
||||||
|
Width="140"
|
||||||
|
Height="40"
|
||||||
|
Margin="10"
|
||||||
|
Click="BtnSpeichern_Click"/>
|
||||||
|
|
||||||
|
<Button Content="Abbrechen"
|
||||||
|
Width="140"
|
||||||
|
Height="40"
|
||||||
|
Margin="10"
|
||||||
|
Click="BtnAbbrechen_Click"/>
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,149 @@
|
|||||||
|
using System;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace Casino
|
||||||
|
{
|
||||||
|
public partial class EditUserView : Window
|
||||||
|
{
|
||||||
|
private readonly Database db = new Database();
|
||||||
|
|
||||||
|
private readonly User selectedUser;
|
||||||
|
|
||||||
|
public EditUserView(User user)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
selectedUser = user;
|
||||||
|
|
||||||
|
// Bestehende Werte anzeigen
|
||||||
|
TxtName.Text = selectedUser.Name;
|
||||||
|
TxtAge.Text = selectedUser.Alter.ToString();
|
||||||
|
TxtGeld.Text = selectedUser.Geld.ToString();
|
||||||
|
|
||||||
|
// Rolle auswählen
|
||||||
|
foreach (ComboBoxItem item in CmbRolle.Items)
|
||||||
|
{
|
||||||
|
if (item.Content?.ToString() == selectedUser.Rolle)
|
||||||
|
{
|
||||||
|
CmbRolle.SelectedItem = item;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnSpeichern_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(TxtName.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"Bitte gib einen Namen ein.",
|
||||||
|
"Fehler",
|
||||||
|
MessageBoxButton.OK,
|
||||||
|
MessageBoxImage.Warning);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alter prüfen
|
||||||
|
if (!int.TryParse(TxtAge.Text, out int age) ||
|
||||||
|
age < 0 ||
|
||||||
|
age > 150)
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"Bitte gib ein gültiges Alter ein.",
|
||||||
|
"Fehler",
|
||||||
|
MessageBoxButton.OK,
|
||||||
|
MessageBoxImage.Warning);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Geld prüfen
|
||||||
|
if (!decimal.TryParse(TxtGeld.Text, out decimal geld))
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"Bitte gib einen gültigen Geldbetrag ein.",
|
||||||
|
"Fehler",
|
||||||
|
MessageBoxButton.OK,
|
||||||
|
MessageBoxImage.Warning);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CmbRolle.SelectedItem is not ComboBoxItem selectedRoleItem)
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"Bitte wähle eine Rolle aus.",
|
||||||
|
"Fehler",
|
||||||
|
MessageBoxButton.OK,
|
||||||
|
MessageBoxImage.Warning);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string rolle = selectedRoleItem.Content?.ToString() ?? "User";
|
||||||
|
|
||||||
|
// Passwort:
|
||||||
|
// leer = altes Passwort behalten
|
||||||
|
string passwort = selectedUser.Passwort;
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(TxtPasswort.Password))
|
||||||
|
{
|
||||||
|
passwort = HashPassword(TxtPasswort.Password);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Datenbank aktualisieren
|
||||||
|
bool success = db.UpdateUser(
|
||||||
|
selectedUser.ID,
|
||||||
|
TxtName.Text.Trim(),
|
||||||
|
age,
|
||||||
|
passwort,
|
||||||
|
geld,
|
||||||
|
rolle);
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"Benutzer wurde erfolgreich aktualisiert.",
|
||||||
|
"Erfolgreich",
|
||||||
|
MessageBoxButton.OK,
|
||||||
|
MessageBoxImage.Information);
|
||||||
|
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show(
|
||||||
|
"Die Änderungen konnten nicht gespeichert werden.",
|
||||||
|
"Fehler",
|
||||||
|
MessageBoxButton.OK,
|
||||||
|
MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnAbbrechen_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string HashPassword(string password)
|
||||||
|
{
|
||||||
|
using SHA256 sha256 = SHA256.Create();
|
||||||
|
|
||||||
|
byte[] bytes = Encoding.UTF8.GetBytes(password);
|
||||||
|
byte[] hash = sha256.ComputeHash(bytes);
|
||||||
|
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
|
foreach (byte b in hash)
|
||||||
|
{
|
||||||
|
builder.Append(b.ToString("X2"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return builder.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-1
@@ -12,7 +12,8 @@
|
|||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
AllowsTransparency="True"
|
AllowsTransparency="True"
|
||||||
MouseDown="Window_MouseDown">
|
MouseDown="Window_MouseDown">
|
||||||
|
<!-- Lenard Gerdes -->
|
||||||
|
|
||||||
<Border CornerRadius="20"
|
<Border CornerRadius="20"
|
||||||
Background="#590D00"
|
Background="#590D00"
|
||||||
BorderBrush="Gold"
|
BorderBrush="Gold"
|
||||||
|
|||||||
+16
-5
@@ -26,11 +26,15 @@ namespace Casino
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class Login : Window
|
public partial class Login : Window
|
||||||
{
|
{
|
||||||
|
//Alles von Lenard Gerdes
|
||||||
|
Database db = new Database();
|
||||||
|
ObservableCollection<User> users = new ObservableCollection<User>();
|
||||||
|
|
||||||
|
|
||||||
public Login()
|
public Login()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
users = db.GetUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -39,10 +43,19 @@ namespace Casino
|
|||||||
{
|
{
|
||||||
if (checkLogin(TxtName.Text, TxtPasswort.Password))
|
if (checkLogin(TxtName.Text, TxtPasswort.Password))
|
||||||
{
|
{
|
||||||
|
Console.WriteLine(users[MainWindow.currentUser].Rolle);
|
||||||
|
if (users[MainWindow.currentUser].Rolle.Equals("Admin"))
|
||||||
|
{
|
||||||
|
AdminView adminView = new AdminView();
|
||||||
|
adminView.Show();
|
||||||
|
Close();
|
||||||
|
}else
|
||||||
|
{
|
||||||
MainWindow mainWindow = new MainWindow();
|
MainWindow mainWindow = new MainWindow();
|
||||||
mainWindow.Show();
|
mainWindow.Show();
|
||||||
Close();
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -53,9 +66,7 @@ namespace Casino
|
|||||||
|
|
||||||
private bool checkLogin(string name, string passwort)
|
private bool checkLogin(string name, string passwort)
|
||||||
{
|
{
|
||||||
Database db = new Database();
|
|
||||||
ObservableCollection<User> users = new ObservableCollection<User>();
|
|
||||||
users = db.GetUser();
|
|
||||||
string hash = HashPassword(passwort);
|
string hash = HashPassword(passwort);
|
||||||
|
|
||||||
for (int i = 0; i < users.Count(); i++)
|
for (int i = 0; i < users.Count(); i++)
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
Title="MainWindow" Height="450" Width="800"
|
Title="MainWindow" Height="450" Width="800"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
>
|
>
|
||||||
|
<!-- Lenard Gerdes -->
|
||||||
|
|
||||||
<Border
|
<Border
|
||||||
|
|
||||||
Background="#590D00"
|
Background="#590D00"
|
||||||
@@ -32,8 +32,7 @@
|
|||||||
<RowDefinition Height="1*"/>
|
<RowDefinition Height="1*"/>
|
||||||
|
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Button Content="Slots" HorizontalAlignment="Center" Grid.Column="2" Grid.Row="2" VerticalAlignment="Center" Width="79" Height="40" Click="Slots_Click" Background="Silver"/>
|
<Button Content="Slots" HorizontalAlignment="Center" Grid.Column="3" Grid.Row="2" VerticalAlignment="Center" Width="79" Height="40" Click="Slots_Click" Background="Silver"/>
|
||||||
<Button Content="Blackjack" HorizontalAlignment="Center" Grid.Column="3" Grid.Row="2" VerticalAlignment="Center" Height="40" Width="79" Click="Blackjack_Click" Background="Silver"/>
|
|
||||||
<Button Content="Busfahrer" HorizontalAlignment="Center" Grid.Column="1" Grid.Row="2" VerticalAlignment="Center" Height="40" Width="79" Click="Busfahrer_Click" Background="Silver"/>
|
<Button Content="Busfahrer" HorizontalAlignment="Center" Grid.Column="1" Grid.Row="2" VerticalAlignment="Center" Height="40" Width="79" Click="Busfahrer_Click" Background="Silver"/>
|
||||||
<TextBlock Name="TxtName" VerticalAlignment="Top" Grid.Column="2" Height="30" Margin="0,10,0,0" Foreground="Gold"/>
|
<TextBlock Name="TxtName" VerticalAlignment="Top" Grid.Column="2" Height="30" Margin="0,10,0,0" Foreground="Gold"/>
|
||||||
<TextBlock Name="TxtKonto" VerticalAlignment="Top" Grid.Column="3" Height="30" Margin="0,10,0,0" Foreground="Gold"/>
|
<TextBlock Name="TxtKonto" VerticalAlignment="Top" Grid.Column="3" Height="30" Margin="0,10,0,0" Foreground="Gold"/>
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ namespace Casino
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class MainWindow : Window
|
public partial class MainWindow : Window
|
||||||
{
|
{
|
||||||
|
// Alles von Lenard Gerdes
|
||||||
public static int currentUser;
|
public static int currentUser;
|
||||||
ObservableCollection<User> users = new ObservableCollection<User>();
|
ObservableCollection<User> users = new ObservableCollection<User>();
|
||||||
Database db = new Database();
|
Database db = new Database();
|
||||||
@@ -27,6 +28,7 @@ namespace Casino
|
|||||||
setup();
|
setup();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Slots_Click(object sender, RoutedEventArgs e)
|
private void Slots_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -35,12 +37,6 @@ namespace Casino
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void Blackjack_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
Blackjack slotsWindow = new Blackjack();
|
|
||||||
slotsWindow.Show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Busfahrer_Click(object sender, RoutedEventArgs e)
|
private void Busfahrer_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Busfahrer slotsWindow = new Busfahrer();
|
Busfahrer slotsWindow = new Busfahrer();
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
Name/Passwort
|
||||||
|
Test User:
|
||||||
|
(Günter/123)
|
||||||
|
(Nutzer/Test)
|
||||||
|
(Gerdi/Mast)
|
||||||
|
|
||||||
|
|
||||||
|
Admin:
|
||||||
|
(Admin/test)
|
||||||
|
|
||||||
|
Webseiten:
|
||||||
|
https://oneuptime.com/blog/post/2026-03-31-mysql-to-base64-from-base64-functions/view
|
||||||
|
https://learn.microsoft.com/en-za/answers/questions/476098/retrieving-image-from-binary-data-ole-object-acces
|
||||||
|
https://kenney.nl/assets/boardgame-pack (Karten)
|
||||||
|
https://wiki.selfhtml.org/wiki/JavaScript/DOM/HTMLElement/innerHTML
|
||||||
|
wiki.selfhtml.org
|
||||||
|
stackoverflow.com
|
||||||
File diff suppressed because one or more lines are too long
+4
-3
@@ -9,12 +9,13 @@
|
|||||||
WindowState="Maximized"
|
WindowState="Maximized"
|
||||||
WindowStyle="None"
|
WindowStyle="None"
|
||||||
Background="Transparent">
|
Background="Transparent">
|
||||||
|
<!-- Lenard Gerdes -->
|
||||||
|
|
||||||
<Border
|
<Border
|
||||||
|
|
||||||
Background="#590D00"
|
Background="#590D00"
|
||||||
BorderBrush="Gold"
|
BorderBrush="Gold"
|
||||||
BorderThickness="5">
|
BorderThickness="5">
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
|
|||||||
+167
-83
@@ -22,7 +22,7 @@ namespace Casino
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class Slots : Window
|
public partial class Slots : Window
|
||||||
{
|
{
|
||||||
|
// Lenard Gerdes
|
||||||
private List<Image> _bilder;
|
private List<Image> _bilder;
|
||||||
private Random _random = new Random();
|
private Random _random = new Random();
|
||||||
Database db = new Database();
|
Database db = new Database();
|
||||||
@@ -45,8 +45,9 @@ namespace Casino
|
|||||||
|
|
||||||
|
|
||||||
private int highestWin = 5;
|
private int highestWin = 5;
|
||||||
|
private int bestSoundId;
|
||||||
|
|
||||||
|
// Lenard Gerdes
|
||||||
public Slots()
|
public Slots()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -61,9 +62,10 @@ namespace Casino
|
|||||||
};
|
};
|
||||||
AlleBilder = new List<Byte[]>
|
AlleBilder = new List<Byte[]>
|
||||||
{
|
{
|
||||||
db.GetCardImage(2),db.GetCardImage(3),db.GetCardImage(4),
|
db.GetCardImage(2),db.GetCardImage(3),
|
||||||
db.GetCardImage(5),db.GetCardImage(6),db.GetCardImage(7),
|
db.GetCardImage(4),/*db.GetCardImage(5),
|
||||||
db.GetCardImage(8),db.GetCardImage(9),db.GetCardImage(10),
|
db.GetCardImage(6),db.GetCardImage(7),
|
||||||
|
db.GetCardImage(8),db.GetCardImage(9), db.GetCardImage(10)*/
|
||||||
|
|
||||||
};
|
};
|
||||||
Konto.Text = users[MainWindow.currentUser].Geld.ToString();
|
Konto.Text = users[MainWindow.currentUser].Geld.ToString();
|
||||||
@@ -89,6 +91,7 @@ namespace Casino
|
|||||||
}
|
}
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
// Lenard Gerdes
|
||||||
private async Task Spin()
|
private async Task Spin()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 15; i++)
|
for (int i = 0; i < 15; i++)
|
||||||
@@ -119,41 +122,45 @@ namespace Casino
|
|||||||
currentSlot[0, j] = randomBild;
|
currentSlot[0, j] = randomBild;
|
||||||
LoadCard(_bilder[j], randomBild);
|
LoadCard(_bilder[j], randomBild);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
await Task.Delay(150);
|
await Task.Delay(150);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Lenard Gerdes
|
||||||
private async void Spin(object sender, RoutedEventArgs e)
|
private async void Spin(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Versucht das Textfeld auszulesen und zu konvertieren
|
||||||
|
if (string.IsNullOrWhiteSpace(einsatzFeld.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Bitte gib einen Einsatz ein.", "Eingabe fehlt", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int einsatz = Convert.ToInt32(einsatzFeld.Text);
|
int einsatz = Convert.ToInt32(einsatzFeld.Text);
|
||||||
|
|
||||||
|
if (einsatz <= 0)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Der Einsatz muss größer als 0 sein.", "Ungültiger Einsatz", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
users[MainWindow.currentUser].Geld -= einsatz;
|
users[MainWindow.currentUser].Geld -= einsatz;
|
||||||
Konto.Text = users[MainWindow.currentUser].Geld.ToString();
|
Konto.Text = users[MainWindow.currentUser].Geld.ToString();
|
||||||
|
|
||||||
await Spin();
|
await Spin();
|
||||||
|
|
||||||
users[MainWindow.currentUser].Geld += CheckWin(currentSlot, einsatz);
|
users[MainWindow.currentUser].Geld += CheckWin(currentSlot, einsatz);
|
||||||
Konto.Text = users[MainWindow.currentUser].Geld.ToString();
|
Konto.Text = users[MainWindow.currentUser].Geld.ToString();
|
||||||
|
|
||||||
db.UpdateGeld(
|
db.UpdateGeld(
|
||||||
users[MainWindow.currentUser].ID,
|
users[MainWindow.currentUser].ID,
|
||||||
users[MainWindow.currentUser].Geld);
|
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)
|
private void Hauptmenue(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
music.Stop();
|
music.Stop();
|
||||||
@@ -161,12 +168,15 @@ namespace Casino
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Lenard Gerdes
|
||||||
public decimal CheckWin(int[,] board, decimal einsatz)
|
public decimal CheckWin(int[,] board, decimal einsatz)
|
||||||
{
|
{
|
||||||
decimal multiplikator = 0m;
|
decimal multiplikator = 0m;
|
||||||
|
|
||||||
// Waagerecht
|
// ==========================================
|
||||||
|
// WAAGERECHT
|
||||||
|
// ==========================================
|
||||||
|
|
||||||
for (int row = 0; row < 3; row++)
|
for (int row = 0; row < 3; row++)
|
||||||
{
|
{
|
||||||
multiplikator += CheckLine(
|
multiplikator += CheckLine(
|
||||||
@@ -175,19 +185,29 @@ namespace Casino
|
|||||||
board[row, 2],
|
board[row, 2],
|
||||||
board[row, 3],
|
board[row, 3],
|
||||||
board[row, 4],
|
board[row, 4],
|
||||||
board[row, 5]);
|
board[row, 5]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Senkrecht
|
|
||||||
|
// ==========================================
|
||||||
|
// SENKRECHT
|
||||||
|
// ==========================================
|
||||||
|
|
||||||
for (int col = 0; col < 6; col++)
|
for (int col = 0; col < 6; col++)
|
||||||
{
|
{
|
||||||
multiplikator += CheckLine(
|
multiplikator += CheckLine(
|
||||||
board[0, col],
|
board[0, col],
|
||||||
board[1, col],
|
board[1, col],
|
||||||
board[2, col]);
|
board[2, col]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// X Muster
|
|
||||||
|
// ==========================================
|
||||||
|
// X-MUSTER
|
||||||
|
// ==========================================
|
||||||
|
|
||||||
bool x1 =
|
bool x1 =
|
||||||
board[0, 0] == board[1, 1] &&
|
board[0, 0] == board[1, 1] &&
|
||||||
board[1, 1] == board[2, 2];
|
board[1, 1] == board[2, 2];
|
||||||
@@ -196,14 +216,24 @@ namespace Casino
|
|||||||
board[0, 5] == board[1, 4] &&
|
board[0, 5] == board[1, 4] &&
|
||||||
board[1, 4] == board[2, 3];
|
board[1, 4] == board[2, 3];
|
||||||
|
|
||||||
if (x1 && x2 &&
|
bool xMuster =
|
||||||
board[0, 0] == board[0, 5])
|
x1 &&
|
||||||
|
x2 &&
|
||||||
|
board[0, 0] == board[0, 5];
|
||||||
|
|
||||||
|
if (xMuster)
|
||||||
{
|
{
|
||||||
multiplikator += X_MUSTER;
|
multiplikator += X_MUSTER;
|
||||||
highestWin++;
|
|
||||||
|
// Sound-ID für X-Muster
|
||||||
|
highestWin = Math.Max(highestWin, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rand
|
|
||||||
|
// ==========================================
|
||||||
|
// RAND
|
||||||
|
// ==========================================
|
||||||
|
|
||||||
int randId = board[0, 0];
|
int randId = board[0, 0];
|
||||||
|
|
||||||
bool randGleich =
|
bool randGleich =
|
||||||
@@ -213,117 +243,179 @@ namespace Casino
|
|||||||
board[0, 3] == randId &&
|
board[0, 3] == randId &&
|
||||||
board[0, 4] == randId &&
|
board[0, 4] == randId &&
|
||||||
board[0, 5] == randId &&
|
board[0, 5] == randId &&
|
||||||
|
|
||||||
board[2, 0] == randId &&
|
board[2, 0] == randId &&
|
||||||
board[2, 1] == randId &&
|
board[2, 1] == randId &&
|
||||||
board[2, 2] == randId &&
|
board[2, 2] == randId &&
|
||||||
board[2, 3] == randId &&
|
board[2, 3] == randId &&
|
||||||
board[2, 4] == randId &&
|
board[2, 4] == randId &&
|
||||||
board[2, 5] == randId &&
|
board[2, 5] == randId &&
|
||||||
|
|
||||||
board[1, 0] == randId &&
|
board[1, 0] == randId &&
|
||||||
board[1, 5] == randId;
|
board[1, 5] == randId;
|
||||||
|
|
||||||
if (randGleich)
|
if (randGleich)
|
||||||
{
|
{
|
||||||
multiplikator += RAND;
|
multiplikator += RAND;
|
||||||
highestWin++;
|
|
||||||
|
// Sound-ID für Rand
|
||||||
|
highestWin = Math.Max(highestWin, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
// X + Rand Bonus
|
|
||||||
if (
|
// ==========================================
|
||||||
randGleich &&
|
// X + RAND
|
||||||
x1 && x2 &&
|
// ==========================================
|
||||||
board[0, 0] == board[0, 5]
|
|
||||||
)
|
if (randGleich && xMuster)
|
||||||
{
|
{
|
||||||
multiplikator += X_UND_RAND;
|
multiplikator += X_UND_RAND;
|
||||||
highestWin++;
|
|
||||||
|
// Sound-ID für X + Rand
|
||||||
|
highestWin = Math.Max(highestWin, 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fullboard
|
|
||||||
|
// ==========================================
|
||||||
|
// FULLBOARD
|
||||||
|
// ==========================================
|
||||||
|
|
||||||
int first = board[0, 0];
|
int first = board[0, 0];
|
||||||
|
|
||||||
bool fullBoard = true;
|
bool fullBoard = true;
|
||||||
|
|
||||||
for (int r = 0; r < 3; r++)
|
for (int row = 0; row < 3; row++)
|
||||||
{
|
{
|
||||||
for (int c = 0; c < 6; c++)
|
for (int col = 0; col < 6; col++)
|
||||||
{
|
{
|
||||||
if (board[r, c] != first)
|
if (board[row, col] != first)
|
||||||
{
|
{
|
||||||
fullBoard = false;
|
fullBoard = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!fullBoard)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fullBoard)
|
if (fullBoard)
|
||||||
{
|
{
|
||||||
multiplikator += FULLBOARD;
|
multiplikator += FULLBOARD;
|
||||||
highestWin++;
|
|
||||||
|
// Fullboard = Sound-ID 12
|
||||||
|
highestWin = 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (multiplikator != 0) PlayWinSound();
|
|
||||||
|
// ==========================================
|
||||||
|
// SOUND
|
||||||
|
// ==========================================
|
||||||
|
|
||||||
|
if (multiplikator > 0)
|
||||||
|
{
|
||||||
|
PlayWinSound();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ==========================================
|
||||||
|
// AUSZAHLUNG
|
||||||
|
// ==========================================
|
||||||
|
|
||||||
return einsatz * multiplikator;
|
return einsatz * multiplikator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// =========================================================
|
||||||
|
// CHECK LINE
|
||||||
|
// =========================================================
|
||||||
|
|
||||||
private decimal CheckLine(params int[] werte)
|
private decimal CheckLine(params int[] werte)
|
||||||
{
|
{
|
||||||
decimal gewinn = 0;
|
if (werte.Length < 3)
|
||||||
|
return 0m;
|
||||||
|
|
||||||
int laenge = werte.Length;
|
decimal gewinn = 0m;
|
||||||
|
|
||||||
for (int start = 0; start < laenge; start++)
|
int start = 0;
|
||||||
|
|
||||||
|
while (start < werte.Length)
|
||||||
{
|
{
|
||||||
int gleiche = 1;
|
int gleiche = 1;
|
||||||
|
|
||||||
for (int next = start + 1; next < laenge; next++)
|
while (start + gleiche < werte.Length &&
|
||||||
|
werte[start + gleiche] == werte[start])
|
||||||
{
|
{
|
||||||
if (werte[next] == werte[start])
|
gleiche++;
|
||||||
gleiche++;
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gleiche >= 3)
|
|
||||||
gewinn += DREI;
|
|
||||||
|
|
||||||
if (gleiche >= 4)
|
|
||||||
{
|
|
||||||
gewinn += VIER;
|
|
||||||
highestWin++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gleiche >= 5)
|
|
||||||
{
|
|
||||||
gewinn += FUENF;
|
|
||||||
highestWin++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Nur den höchsten passenden Gewinn dieser Reihe geben
|
||||||
if (gleiche >= 6)
|
if (gleiche >= 6)
|
||||||
{
|
{
|
||||||
gewinn += SECHS;
|
gewinn += SECHS;
|
||||||
|
|
||||||
|
if (8 > bestSoundId)
|
||||||
|
bestSoundId = 8;
|
||||||
|
|
||||||
highestWin++;
|
highestWin++;
|
||||||
}
|
}
|
||||||
|
else if (gleiche >= 5)
|
||||||
|
{
|
||||||
|
gewinn += FUENF;
|
||||||
|
|
||||||
|
if (7 > bestSoundId)
|
||||||
|
bestSoundId = 7;
|
||||||
|
|
||||||
|
highestWin++;
|
||||||
|
}
|
||||||
|
else if (gleiche >= 4)
|
||||||
|
{
|
||||||
|
gewinn += VIER;
|
||||||
|
|
||||||
|
if (6 > bestSoundId)
|
||||||
|
bestSoundId = 6;
|
||||||
|
|
||||||
|
highestWin++;
|
||||||
|
}
|
||||||
|
else if (gleiche >= 3)
|
||||||
|
{
|
||||||
|
gewinn += DREI;
|
||||||
|
|
||||||
|
if (5 > bestSoundId)
|
||||||
|
bestSoundId = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
start += gleiche;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return gewinn;
|
return gewinn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// =========================================================
|
||||||
|
// WIN SOUND AUS DATENBANK
|
||||||
|
// =========================================================
|
||||||
|
|
||||||
//Numberfield
|
void PlayWinSound()
|
||||||
|
{
|
||||||
|
bestSoundId = highestWin+1;
|
||||||
|
if (bestSoundId > 0)
|
||||||
|
audio.PlaySound(db.GetSound(bestSoundId), bestSoundId);
|
||||||
|
|
||||||
|
bestSoundId = 0; // fehlte komplett
|
||||||
|
highestWin = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Numberfield Colin Langer
|
||||||
private static readonly Regex _regex = new Regex("^[0-9]"); // Regex to match non-numeric input
|
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)
|
private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
|
||||||
{
|
{
|
||||||
e.Handled = !_regex.IsMatch(e.Text);
|
e.Handled = !_regex.IsMatch(e.Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keine Spaces
|
// Keine Spaces Colin Langer
|
||||||
private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e)
|
private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Key == Key.Space)
|
if (e.Key == Key.Space)
|
||||||
@@ -332,7 +424,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)
|
private void TextBox_Pasting(object sender, DataObjectPastingEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.DataObject.GetDataPresent(typeof(String)))
|
if (e.DataObject.GetDataPresent(typeof(String)))
|
||||||
@@ -344,13 +436,5 @@ namespace Casino
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayWinSound()
|
|
||||||
{
|
|
||||||
audio.PlaySound(db.GetSound(highestWin));
|
|
||||||
highestWin = 5;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Casino
|
|
||||||
{
|
|
||||||
public class Spiele
|
|
||||||
{
|
|
||||||
public string Name { get; set; }
|
|
||||||
public int MinBetrag { get; set; }
|
|
||||||
|
|
||||||
public Spiele(string n, int m)
|
|
||||||
{
|
|
||||||
Name = n;
|
|
||||||
MinBetrag = m;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+6
-2
@@ -1,18 +1,20 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Casino
|
namespace Casino
|
||||||
{
|
{
|
||||||
public class User
|
public class User // Lenard Gerdes
|
||||||
{
|
{
|
||||||
public string ID { get; set; }
|
public string ID { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public int Alter { get; set; }
|
public int Alter { get; set; }
|
||||||
public string Passwort { get; set; }
|
public string Passwort { get; set; }
|
||||||
public decimal Geld { get; set; }
|
public decimal Geld { get; set; }
|
||||||
|
public string Rolle { get; set; }
|
||||||
public User(string name, int age, string passwort)
|
public User(string name, int age, string passwort)
|
||||||
{
|
{
|
||||||
ID = ID_Generation();
|
ID = ID_Generation();
|
||||||
@@ -20,14 +22,16 @@ namespace Casino
|
|||||||
Alter = age;
|
Alter = age;
|
||||||
Passwort = passwort;
|
Passwort = passwort;
|
||||||
Geld = 1000;
|
Geld = 1000;
|
||||||
|
Rolle = "User";
|
||||||
}
|
}
|
||||||
public User(string id, string name, int age,string passwort, int geld)
|
public User(string id, string name, int age,string passwort, int geld, string rolle)
|
||||||
{
|
{
|
||||||
ID = id;
|
ID = id;
|
||||||
Name = name;
|
Name = name;
|
||||||
Alter = age;
|
Alter = age;
|
||||||
Passwort = passwort;
|
Passwort = passwort;
|
||||||
Geld = geld;
|
Geld = geld;
|
||||||
|
Rolle = rolle;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ID_Generation()
|
private string ID_Generation()
|
||||||
|
|||||||
Reference in New Issue
Block a user