mirror of
https://github.com/correl/mage.git
synced 2024-11-28 19:19:55 +00:00
Added sound if player leaves table. Changed some sounds.
This commit is contained in:
parent
4efb832b8d
commit
ecc6295638
8 changed files with 22 additions and 3 deletions
Binary file not shown.
BIN
Mage.Client/sounds/OnPlayerQuit.wav
Normal file
BIN
Mage.Client/sounds/OnPlayerQuit.wav
Normal file
Binary file not shown.
BIN
Mage.Client/sounds/OnPlayerQuitTournament.wav
Normal file
BIN
Mage.Client/sounds/OnPlayerQuitTournament.wav
Normal file
Binary file not shown.
|
@ -114,6 +114,9 @@ public class CallbackClientImpl implements CallbackClient {
|
|||
case PlayerLeft:
|
||||
AudioManager.playPlayerLeft();
|
||||
break;
|
||||
case PlayerQuitTournament:
|
||||
AudioManager.playPlayerQuitTournament();
|
||||
break;
|
||||
case PlayerSubmittedDeck:
|
||||
AudioManager.playPlayerSubmittedDeck();
|
||||
break;
|
||||
|
|
|
@ -41,6 +41,7 @@ public class AudioManager {
|
|||
private MageClip playerSubmittedDeck = null;
|
||||
private MageClip playerWhispered = null;
|
||||
private MageClip playerLeft = null;
|
||||
private MageClip playerQuitTournament = null;
|
||||
private MageClip playerWon = null;
|
||||
private MageClip playerLost = null;
|
||||
/**
|
||||
|
@ -222,6 +223,14 @@ public class AudioManager {
|
|||
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() {
|
||||
if(audioManager.playerLost == null) {
|
||||
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) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
clip.setFramePosition(0);
|
||||
clip.start();
|
||||
|
|
|
@ -53,7 +53,7 @@ public class ChatMessage implements Serializable {
|
|||
}
|
||||
|
||||
public enum SoundToPlay {
|
||||
PlayerLeft, PlayerSubmittedDeck, PlayerWhispered;
|
||||
PlayerLeft, PlayerQuitTournament, PlayerSubmittedDeck, PlayerWhispered;
|
||||
}
|
||||
|
||||
public ChatMessage(String username, String message, String time, MessageColor color) {
|
||||
|
|
|
@ -70,6 +70,7 @@ import java.util.concurrent.ScheduledExecutorService;
|
|||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import mage.game.Game;
|
||||
import mage.view.ChatMessage;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -387,7 +388,12 @@ public class TableController {
|
|||
match.leave(playerId);
|
||||
}
|
||||
User user = UserManager.getInstance().getUser(userId);
|
||||
user.removeTable(playerId);
|
||||
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);
|
||||
} else {
|
||||
logger.debug("TableController.leaveTable user with this userId not found userId: " + userId);
|
||||
}
|
||||
userPlayerMap.remove(userId);
|
||||
} else if (!table.getState().equals(TableState.FINISHED)) {
|
||||
if (table.isTournament()) {
|
||||
|
|
|
@ -305,7 +305,7 @@ public class TournamentController {
|
|||
if (tPlayer != null) {
|
||||
if (started) {
|
||||
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;
|
||||
if (tournament.isDoneConstructing()) {
|
||||
info = new StringBuilder("during round ").append(tournament.getRounds().size()).toString();
|
||||
|
|
Loading…
Reference in a new issue