Win sounds für slots eingebaut
This commit is contained in:
@@ -12,8 +12,9 @@ namespace Casino
|
||||
class Audioplayer
|
||||
{
|
||||
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)
|
||||
{
|
||||
@@ -25,8 +26,8 @@ namespace Casino
|
||||
|
||||
File.WriteAllBytes(tempFile, audioBlob);
|
||||
|
||||
player.Open(new Uri(tempFile));
|
||||
player.Play();
|
||||
shortplayer.Open(new Uri(tempFile));
|
||||
shortplayer.Play();
|
||||
}
|
||||
|
||||
private void Player_MediaEnded(object? sender, EventArgs e)
|
||||
|
||||
+25
-3
@@ -28,6 +28,7 @@ namespace Casino
|
||||
Database db = new Database();
|
||||
private List<Byte[]> AlleBilder;
|
||||
ObservableCollection<User> users = new ObservableCollection<User>();
|
||||
Audioplayer music = new Audioplayer();
|
||||
Audioplayer audio = new Audioplayer();
|
||||
private int[,] currentSlot = new int[3, 6];
|
||||
|
||||
@@ -43,6 +44,9 @@ namespace Casino
|
||||
const decimal FULLBOARD = 50.00m;
|
||||
|
||||
|
||||
private int highestWin = 5;
|
||||
|
||||
|
||||
public Slots()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -63,7 +67,7 @@ namespace Casino
|
||||
|
||||
};
|
||||
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)
|
||||
{
|
||||
audio.Stop();
|
||||
music.Stop();
|
||||
Close();
|
||||
}
|
||||
|
||||
@@ -184,6 +188,7 @@ namespace Casino
|
||||
board[0, 0] == board[0, 5])
|
||||
{
|
||||
multiplikator += X_MUSTER;
|
||||
highestWin++;
|
||||
}
|
||||
|
||||
// Rand
|
||||
@@ -208,6 +213,7 @@ namespace Casino
|
||||
if (randGleich)
|
||||
{
|
||||
multiplikator += RAND;
|
||||
highestWin++;
|
||||
}
|
||||
|
||||
// X + Rand Bonus
|
||||
@@ -218,6 +224,7 @@ namespace Casino
|
||||
)
|
||||
{
|
||||
multiplikator += X_UND_RAND;
|
||||
highestWin++;
|
||||
}
|
||||
|
||||
// Fullboard
|
||||
@@ -239,8 +246,11 @@ namespace Casino
|
||||
if (fullBoard)
|
||||
{
|
||||
multiplikator += FULLBOARD;
|
||||
highestWin++;
|
||||
}
|
||||
|
||||
if (multiplikator != 0) PlayWinSound();
|
||||
|
||||
return einsatz * multiplikator;
|
||||
}
|
||||
|
||||
@@ -267,14 +277,25 @@ namespace Casino
|
||||
gewinn += DREI;
|
||||
|
||||
if (gleiche >= 4)
|
||||
{
|
||||
gewinn += VIER;
|
||||
highestWin++;
|
||||
}
|
||||
|
||||
if (gleiche >= 5)
|
||||
{
|
||||
gewinn += FUENF;
|
||||
highestWin++;
|
||||
}
|
||||
|
||||
if (gleiche >= 6)
|
||||
{
|
||||
gewinn += SECHS;
|
||||
highestWin++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return gewinn;
|
||||
}
|
||||
@@ -314,7 +335,8 @@ namespace Casino
|
||||
|
||||
void PlayWinSound()
|
||||
{
|
||||
|
||||
audio.PlaySound(db.GetSound(highestWin));
|
||||
highestWin = 5;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user