mirror of
https://github.com/correl/mage.git
synced 2024-11-25 03:00:11 +00:00
Added a sound playing if human player joins a match.
This commit is contained in:
parent
1660f482ff
commit
e1db02baec
3 changed files with 16 additions and 3 deletions
BIN
Mage.Client/plugins/sounds/OnPlayerJoinedTable.wav
Normal file
BIN
Mage.Client/plugins/sounds/OnPlayerJoinedTable.wav
Normal file
Binary file not shown.
|
@ -49,6 +49,7 @@ import java.util.List;
|
|||
import java.util.UUID;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import mage.client.util.AudioManager;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -392,6 +393,7 @@ class UpdateSeatsTask extends SwingWorker<Void, TableView> {
|
|||
if (count > 0) {
|
||||
if (current > count) {
|
||||
MageTray.getInstance().displayMessage("New player joined your game.");
|
||||
AudioManager.playPlayerJoinedTable();
|
||||
} else {
|
||||
MageTray.getInstance().displayMessage("A player left your game.");
|
||||
}
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
package mage.client.util;
|
||||
|
||||
import java.io.File;
|
||||
import javax.sound.sampled.AudioFormat;
|
||||
import javax.sound.sampled.AudioInputStream;
|
||||
import javax.sound.sampled.AudioSystem;
|
||||
import javax.sound.sampled.Clip;
|
||||
import javax.sound.sampled.DataLine;
|
||||
import mage.client.constants.Constants;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.sound.sampled.*;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Manager class for playing audio files.
|
||||
*
|
||||
|
@ -42,6 +45,8 @@ public class AudioManager {
|
|||
audioManager.addArtifactClip = audioManager.loadClip(Constants.BASE_SOUND_PATH + "OnAddArtifact.wav");
|
||||
audioManager.updateStackClip = audioManager.loadClip(Constants.BASE_SOUND_PATH + "OnStackNew.wav");
|
||||
audioManager.onHover = audioManager.loadClip(Constants.BASE_SOUND_PATH + "OnHover.wav");
|
||||
|
||||
audioManager.playerJoinedTable = audioManager.loadClip(Constants.BASE_SOUND_PATH + "OnPlayerJoinedTable.wav");
|
||||
}
|
||||
return audioManager;
|
||||
}
|
||||
|
@ -114,6 +119,10 @@ public class AudioManager {
|
|||
checkAndPlayClip(getManager().onHover);
|
||||
}
|
||||
|
||||
public static void playPlayerJoinedTable() {
|
||||
checkAndPlayClip(getManager().playerJoinedTable);
|
||||
}
|
||||
|
||||
private static void checkAndPlayClip(Clip clip) {
|
||||
try {
|
||||
if (clip != null) {
|
||||
|
@ -175,4 +184,6 @@ public class AudioManager {
|
|||
private Clip addArtifactClip = null;
|
||||
private Clip updateStackClip = null;
|
||||
private Clip onHover = null;
|
||||
|
||||
private Clip playerJoinedTable = null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue