mirror of
https://github.com/correl/mage.git
synced 2024-11-28 19:19:55 +00:00
Added some new sound files (PlayerLost, PlayerWon, PlayerSubmittedDeck, PlayerLeft).
This commit is contained in:
parent
2b916a5dfb
commit
182839d41a
12 changed files with 73 additions and 22 deletions
BIN
Mage.Client/sounds/OnPlayerLeft.wav
Normal file
BIN
Mage.Client/sounds/OnPlayerLeft.wav
Normal file
Binary file not shown.
BIN
Mage.Client/sounds/OnPlayerLost.wav
Normal file
BIN
Mage.Client/sounds/OnPlayerLost.wav
Normal file
Binary file not shown.
BIN
Mage.Client/sounds/OnPlayerSubmittedDeck.wav
Normal file
BIN
Mage.Client/sounds/OnPlayerSubmittedDeck.wav
Normal file
Binary file not shown.
BIN
Mage.Client/sounds/OnPlayerWon.wav
Normal file
BIN
Mage.Client/sounds/OnPlayerWon.wav
Normal file
Binary file not shown.
|
@ -56,7 +56,7 @@
|
|||
<Component id="tabPane" min="-2" pref="277" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnOk" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="25" max="32767" attributes="0"/>
|
||||
<EmptySpace min="0" pref="29" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
@ -153,8 +153,6 @@
|
|||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
|
@ -162,16 +160,9 @@
|
|||
<Component id="lblPlayerInfo" min="-2" pref="90" max="-2" attributes="0"/>
|
||||
<Component id="lblDurationMatch" alignment="0" min="-2" pref="101" max="-2" attributes="0"/>
|
||||
<Component id="lblMatchScore" alignment="0" min="-2" pref="86" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="lblDurationGame" min="-2" pref="101" max="-2" attributes="0"/>
|
||||
<Component id="lblLife" alignment="0" min="-2" pref="71" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="txtPlayerInfo" max="32767" attributes="0"/>
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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" +
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue