Added a sound playing if human player joins a match.

This commit is contained in:
LevelX2 2013-06-17 21:38:30 +02:00
parent 1660f482ff
commit e1db02baec
3 changed files with 16 additions and 3 deletions

Binary file not shown.

View file

@ -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.");
}

View file

@ -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;
}