Win sounds für slots eingebaut

This commit is contained in:
NBTEMP\bib
2026-09-12 17:19:28 +02:00
parent ca6b46b5c3
commit 70260fe16f
2 changed files with 29 additions and 6 deletions
+4 -3
View File
@@ -12,8 +12,9 @@ namespace Casino
class Audioplayer class Audioplayer
{ {
private readonly MediaPlayer player = new MediaPlayer(); private readonly MediaPlayer player = new MediaPlayer();
private readonly MediaPlayer shortplayer = new MediaPlayer();
public Audioplayer() { player.MediaEnded += Player_MediaEnded; } public Audioplayer() { shortplayer.MediaEnded += Player_MediaEnded; }
public void PlaySound(byte[] audioBlob) public void PlaySound(byte[] audioBlob)
{ {
@@ -25,8 +26,8 @@ namespace Casino
File.WriteAllBytes(tempFile, audioBlob); File.WriteAllBytes(tempFile, audioBlob);
player.Open(new Uri(tempFile)); shortplayer.Open(new Uri(tempFile));
player.Play(); shortplayer.Play();
} }
private void Player_MediaEnded(object? sender, EventArgs e) private void Player_MediaEnded(object? sender, EventArgs e)
+25 -3
View File
@@ -28,6 +28,7 @@ namespace Casino
Database db = new Database(); Database db = new Database();
private List<Byte[]> AlleBilder; private List<Byte[]> AlleBilder;
ObservableCollection<User> users = new ObservableCollection<User>(); ObservableCollection<User> users = new ObservableCollection<User>();
Audioplayer music = new Audioplayer();
Audioplayer audio = new Audioplayer(); Audioplayer audio = new Audioplayer();
private int[,] currentSlot = new int[3, 6]; private int[,] currentSlot = new int[3, 6];
@@ -43,6 +44,9 @@ namespace Casino
const decimal FULLBOARD = 50.00m; const decimal FULLBOARD = 50.00m;
private int highestWin = 5;
public Slots() public Slots()
{ {
InitializeComponent(); InitializeComponent();
@@ -63,7 +67,7 @@ namespace Casino
}; };
Konto.Text = users[MainWindow.currentUser].Geld.ToString(); Konto.Text = users[MainWindow.currentUser].Geld.ToString();
audio.PlayLoopingSound(db.GetSound(2)); music.PlayLoopingSound(db.GetSound(2));
} }
@@ -140,7 +144,7 @@ namespace Casino
private void Hauptmenue(object sender, RoutedEventArgs e) private void Hauptmenue(object sender, RoutedEventArgs e)
{ {
audio.Stop(); music.Stop();
Close(); Close();
} }
@@ -184,6 +188,7 @@ namespace Casino
board[0, 0] == board[0, 5]) board[0, 0] == board[0, 5])
{ {
multiplikator += X_MUSTER; multiplikator += X_MUSTER;
highestWin++;
} }
// Rand // Rand
@@ -208,6 +213,7 @@ namespace Casino
if (randGleich) if (randGleich)
{ {
multiplikator += RAND; multiplikator += RAND;
highestWin++;
} }
// X + Rand Bonus // X + Rand Bonus
@@ -218,6 +224,7 @@ namespace Casino
) )
{ {
multiplikator += X_UND_RAND; multiplikator += X_UND_RAND;
highestWin++;
} }
// Fullboard // Fullboard
@@ -239,8 +246,11 @@ namespace Casino
if (fullBoard) if (fullBoard)
{ {
multiplikator += FULLBOARD; multiplikator += FULLBOARD;
highestWin++;
} }
if (multiplikator != 0) PlayWinSound();
return einsatz * multiplikator; return einsatz * multiplikator;
} }
@@ -267,14 +277,25 @@ namespace Casino
gewinn += DREI; gewinn += DREI;
if (gleiche >= 4) if (gleiche >= 4)
{
gewinn += VIER; gewinn += VIER;
highestWin++;
}
if (gleiche >= 5) if (gleiche >= 5)
{
gewinn += FUENF; gewinn += FUENF;
highestWin++;
}
if (gleiche >= 6) if (gleiche >= 6)
{
gewinn += SECHS; gewinn += SECHS;
highestWin++;
} }
}
return gewinn; return gewinn;
} }
@@ -314,7 +335,8 @@ namespace Casino
void PlayWinSound() void PlayWinSound()
{ {
audio.PlaySound(db.GetSound(highestWin));
highestWin = 5;
} }
} }