diff --git a/Mage.Client/sounds/OnPlayerLeft.wav b/Mage.Client/sounds/OnPlayerLeft.wav
new file mode 100644
index 0000000000..78ba0a785b
Binary files /dev/null and b/Mage.Client/sounds/OnPlayerLeft.wav differ
diff --git a/Mage.Client/sounds/OnPlayerLost.wav b/Mage.Client/sounds/OnPlayerLost.wav
new file mode 100644
index 0000000000..4516bc32b9
Binary files /dev/null and b/Mage.Client/sounds/OnPlayerLost.wav differ
diff --git a/Mage.Client/sounds/OnPlayerSubmittedDeck.wav b/Mage.Client/sounds/OnPlayerSubmittedDeck.wav
new file mode 100644
index 0000000000..cd96bf2bad
Binary files /dev/null and b/Mage.Client/sounds/OnPlayerSubmittedDeck.wav differ
diff --git a/Mage.Client/sounds/OnPlayerWon.wav b/Mage.Client/sounds/OnPlayerWon.wav
new file mode 100644
index 0000000000..5ded1a31e6
Binary files /dev/null and b/Mage.Client/sounds/OnPlayerWon.wav differ
diff --git a/Mage.Client/src/main/java/mage/client/dialog/GameEndDialog.form b/Mage.Client/src/main/java/mage/client/dialog/GameEndDialog.form
index 256cc2251a..18b754a8b9 100644
--- a/Mage.Client/src/main/java/mage/client/dialog/GameEndDialog.form
+++ b/Mage.Client/src/main/java/mage/client/dialog/GameEndDialog.form
@@ -56,7 +56,7 @@
-
+
@@ -155,22 +155,13 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
diff --git a/Mage.Client/src/main/java/mage/client/dialog/GameEndDialog.java b/Mage.Client/src/main/java/mage/client/dialog/GameEndDialog.java
index 2888b32911..2cf365e0d1 100644
--- a/Mage.Client/src/main/java/mage/client/dialog/GameEndDialog.java
+++ b/Mage.Client/src/main/java/mage/client/dialog/GameEndDialog.java
@@ -91,9 +91,9 @@ public class GameEndDialog extends MageDialog {
this.txtLife.setText(sb.toString());
if (gameEndView.hasWon()) {
- AudioManager.playPlayerJoinedTable();
+ AudioManager.playPlayerWon();
} else {
- AudioManager.playButtonCancel();
+ AudioManager.playPlayerLost();
}
txtMatchScore.setText(gameEndView.getMatchView().getResult());
diff --git a/Mage.Client/src/main/java/mage/client/remote/CallbackClientImpl.java b/Mage.Client/src/main/java/mage/client/remote/CallbackClientImpl.java
index 1831240e0a..a2250b20a8 100644
--- a/Mage.Client/src/main/java/mage/client/remote/CallbackClientImpl.java
+++ b/Mage.Client/src/main/java/mage/client/remote/CallbackClientImpl.java
@@ -39,6 +39,7 @@ import mage.client.constants.Constants.DeckEditorMode;
import mage.client.draft.DraftPanel;
import mage.client.game.GamePanel;
import mage.client.plugins.impl.Plugins;
+import mage.client.util.AudioManager;
import mage.client.util.DeckUtil;
import mage.client.util.GameManager;
import mage.client.util.object.SaveObjectUtil;
@@ -112,6 +113,16 @@ public class CallbackClientImpl implements CallbackClient {
ChatMessage message = (ChatMessage) callback.getData();
ChatPanel panel = MageFrame.getChat(callback.getObjectId());
if (panel != null) {
+ if (message.getSoundToPlay() != null) {
+ switch (message.getSoundToPlay()) {
+ case PlayerLeft:
+ AudioManager.playPlayerLeft();
+ break;
+ case PlayerSubmittedDeck:
+ AudioManager.playPlayerSubmittedDeck();
+ break;
+ }
+ }
if (message.getMessage().equals(Constants.MSG_TIP_HOT_KEYS_CODE) && panel.getConnectedChat() != null) {
panel.getConnectedChat().receiveMessage("[Tips] ", "You may use hot keys to play faster: " + "" +
"\nTurn Mousewheel - Show big image of card your mousepointer hovers over" +
diff --git a/Mage.Client/src/main/java/mage/client/util/AudioManager.java b/Mage.Client/src/main/java/mage/client/util/AudioManager.java
index cfed0bd6b4..afa3515182 100644
--- a/Mage.Client/src/main/java/mage/client/util/AudioManager.java
+++ b/Mage.Client/src/main/java/mage/client/util/AudioManager.java
@@ -47,6 +47,10 @@ public class AudioManager {
audioManager.onHover = audioManager.loadClip(Constants.BASE_SOUND_PATH + "OnHover.wav");
audioManager.playerJoinedTable = audioManager.loadClip(Constants.BASE_SOUND_PATH + "OnPlayerJoinedTable.wav");
+ audioManager.playerSubmittedDeck = audioManager.loadClip(Constants.BASE_SOUND_PATH + "OnPlayerSubmittedDeck.wav");
+ audioManager.playerLeft = audioManager.loadClip(Constants.BASE_SOUND_PATH + "OnPlayerLeft.wav");
+ audioManager.playerWon = audioManager.loadClip(Constants.BASE_SOUND_PATH + "OnPlayerWon.wav");
+ audioManager.playerLost = audioManager.loadClip(Constants.BASE_SOUND_PATH + "OnPlayerLost.wav");
}
return audioManager;
}
@@ -123,6 +127,22 @@ public class AudioManager {
checkAndPlayClip(getManager().playerJoinedTable);
}
+ public static void playPlayerSubmittedDeck() {
+ checkAndPlayClip(getManager().playerSubmittedDeck);
+ }
+
+ public static void playPlayerLeft() {
+ checkAndPlayClip(getManager().playerLeft);
+ }
+
+ public static void playPlayerLost() {
+ checkAndPlayClip(getManager().playerLost);
+ }
+
+ public static void playPlayerWon() {
+ checkAndPlayClip(getManager().playerWon);
+ }
+
private static void checkAndPlayClip(Clip clip) {
try {
if (clip != null) {
@@ -186,4 +206,8 @@ public class AudioManager {
private Clip onHover = null;
private Clip playerJoinedTable = null;
+ private Clip playerSubmittedDeck = null;
+ private Clip playerLeft = null;
+ private Clip playerWon = null;
+ private Clip playerLost = null;
}
diff --git a/Mage.Common/src/mage/view/ChatMessage.java b/Mage.Common/src/mage/view/ChatMessage.java
index 32eaa53105..ef6536f500 100644
--- a/Mage.Common/src/mage/view/ChatMessage.java
+++ b/Mage.Common/src/mage/view/ChatMessage.java
@@ -41,16 +41,26 @@ public class ChatMessage implements Serializable {
private String time;
private String message;
private MessageColor color;
+ private SoundToPlay soundToPlay;
public enum MessageColor {
BLACK, RED, GREEN, BLUE, ORANGE;
}
+ public enum SoundToPlay {
+ PlayerLeft, PlayerSubmittedDeck;
+ }
+
public ChatMessage(String username, String message, String time, MessageColor color) {
+ this(username, message, time, color, null);
+ }
+
+ public ChatMessage(String username, String message, String time, MessageColor color, SoundToPlay soundToPlay) {
this.username = username;
this.message = message;
this.time = time;
this.color = color;
+ this.soundToPlay = soundToPlay;
}
public String getMessage() {
@@ -76,4 +86,9 @@ public class ChatMessage implements Serializable {
public String getTime() {
return time;
}
+
+ public SoundToPlay getSoundToPlay() {
+ return soundToPlay;
+ }
+
}
diff --git a/Mage.Server/src/main/java/mage/server/ChatManager.java b/Mage.Server/src/main/java/mage/server/ChatManager.java
index ea6beccec1..a3eeebcad0 100644
--- a/Mage.Server/src/main/java/mage/server/ChatManager.java
+++ b/Mage.Server/src/main/java/mage/server/ChatManager.java
@@ -32,6 +32,7 @@ import mage.view.ChatMessage.MessageColor;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
+import mage.view.ChatMessage.SoundToPlay;
/**
*
@@ -75,6 +76,10 @@ public class ChatManager {
chatSessions.get(chatId).broadcast(userName, message, color, withTime);
}
+ public void broadcast(UUID chatId, String userName, String message, MessageColor color, boolean withTime, SoundToPlay soundToPlay) {
+ chatSessions.get(chatId).broadcast(userName, message, color, withTime, soundToPlay);
+ }
+
/**
*
* use mainly for announcing that a user connection was lost or that a user has reconnected
diff --git a/Mage.Server/src/main/java/mage/server/ChatSession.java b/Mage.Server/src/main/java/mage/server/ChatSession.java
index 67178d1944..da69d2d851 100644
--- a/Mage.Server/src/main/java/mage/server/ChatSession.java
+++ b/Mage.Server/src/main/java/mage/server/ChatSession.java
@@ -37,6 +37,7 @@ import java.util.concurrent.ConcurrentHashMap;
import mage.interfaces.callback.ClientCallback;
import mage.view.ChatMessage;
import mage.view.ChatMessage.MessageColor;
+import mage.view.ChatMessage.SoundToPlay;
import org.apache.log4j.Logger;
/**
@@ -89,6 +90,10 @@ public class ChatSession {
}
public void broadcast(String userName, String message, MessageColor color, boolean withTime) {
+ broadcast(userName, message, color, withTime, null);
+ }
+
+ public void broadcast(String userName, String message, MessageColor color, boolean withTime, SoundToPlay soundToPlay) {
if (!message.isEmpty()) {
Calendar cal = new GregorianCalendar();
final String msg = message;
@@ -98,7 +103,7 @@ public class ChatSession {
for (UUID userId: clients.keySet()) {
User user = UserManager.getInstance().getUser(userId);
if (user != null) {
- user.fireCallback(new ClientCallback("chatMessage", chatId, new ChatMessage(username, msg, time, color)));
+ user.fireCallback(new ClientCallback("chatMessage", chatId, new ChatMessage(username, msg, time, color, soundToPlay)));
}
else {
kill(userId, User.DisconnectReason.CleaningUp);
diff --git a/Mage.Server/src/main/java/mage/server/tournament/TournamentController.java b/Mage.Server/src/main/java/mage/server/tournament/TournamentController.java
index 797482839d..d33b85e6e6 100644
--- a/Mage.Server/src/main/java/mage/server/tournament/TournamentController.java
+++ b/Mage.Server/src/main/java/mage/server/tournament/TournamentController.java
@@ -45,13 +45,13 @@ import mage.game.match.MatchOptions;
import mage.game.tournament.Tournament;
import mage.game.tournament.TournamentPairing;
import mage.game.tournament.TournamentPlayer;
-import mage.players.Player;
import mage.server.ChatManager;
import mage.server.TableManager;
import mage.server.UserManager;
import mage.server.game.GamesRoomManager;
import mage.server.util.ThreadExecutor;
import mage.view.ChatMessage.MessageColor;
+import mage.view.ChatMessage.SoundToPlay;
import mage.view.TournamentView;
import org.apache.log4j.Logger;
@@ -240,7 +240,7 @@ public class TournamentController {
TournamentPlayer player = tournament.getPlayer(playerId);
if (player != null && !player.hasQuit()) {
tournamentSessions.get(playerId).submitDeck(deck);
- ChatManager.getInstance().broadcast(chatId, "", player.getPlayer().getName() + " has submitted his tournament deck", MessageColor.BLACK);
+ ChatManager.getInstance().broadcast(chatId, "", player.getPlayer().getName() + " has submitted his tournament deck", MessageColor.BLACK, true, SoundToPlay.PlayerSubmittedDeck);
}
}
}
@@ -267,7 +267,7 @@ public class TournamentController {
if (playerId != null) {
TournamentPlayer player = tournament.getPlayer(playerId);
if (player != null) {
- ChatManager.getInstance().broadcast(chatId, "", player.getPlayer().getName() + " has quit the tournament", MessageColor.BLACK);
+ ChatManager.getInstance().broadcast(chatId, "", player.getPlayer().getName() + " has quit the tournament", MessageColor.BLACK, true, SoundToPlay.PlayerLeft);
String info;
if (tournament.isDoneConstructing()) {
info = new StringBuilder("during round ").append(tournament.getRounds().size()).toString();