Added sound if player leaves table. Changed some sounds.

This commit is contained in:
LevelX2 2014-07-26 14:59:42 +02:00
parent 4efb832b8d
commit ecc6295638
8 changed files with 22 additions and 3 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -114,6 +114,9 @@ public class CallbackClientImpl implements CallbackClient {
case PlayerLeft: case PlayerLeft:
AudioManager.playPlayerLeft(); AudioManager.playPlayerLeft();
break; break;
case PlayerQuitTournament:
AudioManager.playPlayerQuitTournament();
break;
case PlayerSubmittedDeck: case PlayerSubmittedDeck:
AudioManager.playPlayerSubmittedDeck(); AudioManager.playPlayerSubmittedDeck();
break; break;

View file

@ -41,6 +41,7 @@ public class AudioManager {
private MageClip playerSubmittedDeck = null; private MageClip playerSubmittedDeck = null;
private MageClip playerWhispered = null; private MageClip playerWhispered = null;
private MageClip playerLeft = null; private MageClip playerLeft = null;
private MageClip playerQuitTournament = null;
private MageClip playerWon = null; private MageClip playerWon = null;
private MageClip playerLost = null; private MageClip playerLost = null;
/** /**
@ -222,6 +223,14 @@ public class AudioManager {
checkAndPlayClip(getManager().playerLeft); checkAndPlayClip(getManager().playerLeft);
} }
public static void playPlayerQuitTournament() {
if(audioManager.playerQuitTournament== null) {
audioManager.playerQuitTournament = new MageClip(audioManager.loadClip(Constants.BASE_SOUND_PATH + "OnPlayerQuitTournament.wav"),
AudioGroup.OtherSounds);
}
checkAndPlayClip(getManager().playerQuitTournament);
}
public static void playPlayerLost() { public static void playPlayerLost() {
if(audioManager.playerLost == null) { if(audioManager.playerLost == null) {
audioManager.playerLost = new MageClip(audioManager.loadClip(Constants.BASE_SOUND_PATH + "OnPlayerLost.wav"), audioManager.playerLost = new MageClip(audioManager.loadClip(Constants.BASE_SOUND_PATH + "OnPlayerLost.wav"),
@ -261,6 +270,7 @@ public class AudioManager {
public void play(final Clip clip) { public void play(final Clip clip) {
new Thread(new Runnable() { new Thread(new Runnable() {
@Override
public void run() { public void run() {
clip.setFramePosition(0); clip.setFramePosition(0);
clip.start(); clip.start();

View file

@ -53,7 +53,7 @@ public class ChatMessage implements Serializable {
} }
public enum SoundToPlay { public enum SoundToPlay {
PlayerLeft, PlayerSubmittedDeck, PlayerWhispered; PlayerLeft, PlayerQuitTournament, PlayerSubmittedDeck, PlayerWhispered;
} }
public ChatMessage(String username, String message, String time, MessageColor color) { public ChatMessage(String username, String message, String time, MessageColor color) {

View file

@ -70,6 +70,7 @@ import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import mage.game.Game; import mage.game.Game;
import mage.view.ChatMessage;
/** /**
@ -387,7 +388,12 @@ public class TableController {
match.leave(playerId); match.leave(playerId);
} }
User user = UserManager.getInstance().getUser(userId); User user = UserManager.getInstance().getUser(userId);
if (user != null) {
ChatManager.getInstance().broadcast(chatId, user.getName(), "has left the table", ChatMessage.MessageColor.BLUE, true, ChatMessage.MessageType.STATUS, ChatMessage.SoundToPlay.PlayerLeft);
user.removeTable(playerId); user.removeTable(playerId);
} else {
logger.debug("TableController.leaveTable user with this userId not found userId: " + userId);
}
userPlayerMap.remove(userId); userPlayerMap.remove(userId);
} else if (!table.getState().equals(TableState.FINISHED)) { } else if (!table.getState().equals(TableState.FINISHED)) {
if (table.isTournament()) { if (table.isTournament()) {

View file

@ -305,7 +305,7 @@ public class TournamentController {
if (tPlayer != null) { if (tPlayer != null) {
if (started) { if (started) {
if (tPlayer.isInTournament()) { if (tPlayer.isInTournament()) {
ChatManager.getInstance().broadcast(chatId, "", tPlayer.getPlayer().getName() + " has quit the tournament", MessageColor.BLACK, true, MessageType.STATUS, SoundToPlay.PlayerLeft); ChatManager.getInstance().broadcast(chatId, "", tPlayer.getPlayer().getName() + " has quit the tournament", MessageColor.BLACK, true, MessageType.STATUS, SoundToPlay.PlayerQuitTournament);
String info; String info;
if (tournament.isDoneConstructing()) { if (tournament.isDoneConstructing()) {
info = new StringBuilder("during round ").append(tournament.getRounds().size()).toString(); info = new StringBuilder("during round ").append(tournament.getRounds().size()).toString();