diff --git a/Projekte/mdga/client/src/main/java/pp/mdga/client/ModelSyncronizer.java b/Projekte/mdga/client/src/main/java/pp/mdga/client/ModelSyncronizer.java index 78a717a4..0f7e980c 100644 --- a/Projekte/mdga/client/src/main/java/pp/mdga/client/ModelSyncronizer.java +++ b/Projekte/mdga/client/src/main/java/pp/mdga/client/ModelSyncronizer.java @@ -1,5 +1,6 @@ package pp.mdga.client; +import pp.mdga.client.acoustic.MdgaSound; import pp.mdga.client.view.CeremonyView; import pp.mdga.client.view.GameView; import pp.mdga.client.view.LobbyView; @@ -71,17 +72,21 @@ public void selectCard(BonusCard card) { public void confirm() { LOGGER.log(Level.INFO, "confirm"); + GameView gameView = (GameView) app.getView(); + if(a != null && b != null) { //swap + gameView.getBoardHandler().clearSelectable(); } else if (a != null) { //piece + gameView.getBoardHandler().clearSelectable(); } else if (card != null){ //card + gameView.getGuiHandler().clearSelectableCards(); } else { throw new RuntimeException("nothing to confirm"); } - GameView gameView = (GameView) app.getView(); gameView.noConfirm(); } @@ -120,6 +125,7 @@ public void setJoin(String ip, int port) { public void leave() { LOGGER.log(Level.INFO, "leave"); + app.getAcousticHandler().playSound(MdgaSound.LEAVE); enter(MdgaState.MAIN); } @@ -151,9 +157,9 @@ public void enter(MdgaState state) { if (state == MdgaState.LOBBY) { LobbyView lobbyView = (LobbyView) app.getView(); - //app.getNotificationSynchronizer().addTestNotification(new TskSelectNotification(Color.CYBER, "blablabupp", false)); - //app.getNotificationSynchronizer().addTestNotification(new TskSelectNotification(Color.ARMY, "Spieler 2", false)); - lobbyView.setReady(Color.ARMY, true); + app.getNotificationSynchronizer().addTestNotification(new TskSelectNotification(Color.CYBER, "blablabupp", false)); + app.getNotificationSynchronizer().addTestNotification(new TskSelectNotification(Color.ARMY, "Spieler 2", false)); + lobbyView.setReady(Color.ARMY, false); } } } diff --git a/Projekte/mdga/client/src/main/java/pp/mdga/client/acoustic/AcousticHandler.java b/Projekte/mdga/client/src/main/java/pp/mdga/client/acoustic/AcousticHandler.java index fbf78b2f..264197d4 100644 --- a/Projekte/mdga/client/src/main/java/pp/mdga/client/acoustic/AcousticHandler.java +++ b/Projekte/mdga/client/src/main/java/pp/mdga/client/acoustic/AcousticHandler.java @@ -86,10 +86,30 @@ public void playSound(MdgaSound sound) { assets.add(new SoundAssetDelayVolume(SoundAsset.UI_CLICK, 0.8f, 0.0f)); break; case START: - assets.add(new SoundAssetDelayVolume(SoundAsset.START, 0.8f, 0.2f)); + assets.add(new SoundAssetDelayVolume(SoundAsset.START, 0.8f, 0.5f)); + break; + case THROW: + assets.add(new SoundAssetDelayVolume(SoundAsset.LAUGHT, 1.0f, 0.2f)); + break; + case POWERUP: + assets.add(new SoundAssetDelayVolume(SoundAsset.POWERUP, 1.0f, 0.2f)); + break; + case SELF_READY: + assets.add(new SoundAssetDelayVolume(SoundAsset.ROBOT_READY, 1.0f, 0.0f)); + break; + case OTHER_READY: + assets.add(new SoundAssetDelayVolume(SoundAsset.UNIT_READY, 1.0f, 0.0f)); + break; + case OTHER_CONNECTED: + assets.add(new SoundAssetDelayVolume(SoundAsset.CONNECTED, 1.0f, 0.0f)); + break; + case NOT_READY: + assets.add(new SoundAssetDelayVolume(SoundAsset.UI_SOUND, 1.0f, 0.0f)); + break; + case LEAVE: + assets.add(new SoundAssetDelayVolume(SoundAsset.UI_SOUND2, 0.6f, 0.0f)); break; default: - break; } diff --git a/Projekte/mdga/client/src/main/java/pp/mdga/client/acoustic/MdgaSound.java b/Projekte/mdga/client/src/main/java/pp/mdga/client/acoustic/MdgaSound.java index 0a4949f3..78898155 100644 --- a/Projekte/mdga/client/src/main/java/pp/mdga/client/acoustic/MdgaSound.java +++ b/Projekte/mdga/client/src/main/java/pp/mdga/client/acoustic/MdgaSound.java @@ -24,4 +24,11 @@ public enum MdgaSound { WRONG_INPUT, UI_CLICK, START, + THROW, + POWERUP, + SELF_READY, + OTHER_READY, + OTHER_CONNECTED, + NOT_READY, + LEAVE, } diff --git a/Projekte/mdga/client/src/main/java/pp/mdga/client/acoustic/SoundAsset.java b/Projekte/mdga/client/src/main/java/pp/mdga/client/acoustic/SoundAsset.java index c931215a..24497300 100644 --- a/Projekte/mdga/client/src/main/java/pp/mdga/client/acoustic/SoundAsset.java +++ b/Projekte/mdga/client/src/main/java/pp/mdga/client/acoustic/SoundAsset.java @@ -19,9 +19,16 @@ enum SoundAsset { VICTORY("LevelUp2.wav"), LOST("GameOver.wav"), BUTTON_PRESS("menu_button.ogg"), - ERROR("error_sound.ogg"), + ERROR("buzzer.wav"), + UI_SOUND("ui_sound.ogg"), + UI_SOUND2("ui_swoosch.wav"), UI_CLICK("uiclick.ogg"), - START("gamestart.ogg"); + START("gamestart.ogg"), + LAUGHT("laughter.wav"), + POWERUP("powerup.wav"), + ROBOT_READY("robotReady.wav"), + UNIT_READY("unitReady.wav"), + CONNECTED("connected.wav"); private final String path; diff --git a/Projekte/mdga/client/src/main/java/pp/mdga/client/view/LobbyView.java b/Projekte/mdga/client/src/main/java/pp/mdga/client/view/LobbyView.java index 0c7df2f9..83c968cc 100644 --- a/Projekte/mdga/client/src/main/java/pp/mdga/client/view/LobbyView.java +++ b/Projekte/mdga/client/src/main/java/pp/mdga/client/view/LobbyView.java @@ -10,6 +10,7 @@ import com.jme3.texture.Texture; import com.jme3.util.SkyFactory; import pp.mdga.client.MdgaApp; +import pp.mdga.client.acoustic.MdgaSound; import pp.mdga.client.button.ButtonLeft; import pp.mdga.client.button.ButtonRight; import pp.mdga.client.button.LobbyButton; @@ -140,19 +141,21 @@ public void setTaken(Color color, boolean isTaken, boolean isSelf, String name) } public void setReady(Color color, boolean isReady) { - switch (color) { - case CYBER: - cyberButton.setReady(isReady); - break; - case AIRFORCE: - airforceButton.setReady(isReady); - break; - case ARMY: - armyButton.setReady(isReady); - break; - case NAVY: - navyButton.setReady(isReady); - break; + LobbyButton button = switch (color) { + case CYBER -> cyberButton; + case AIRFORCE -> airforceButton; + case ARMY -> armyButton; + case NAVY -> navyButton; + }; + + button.setReady(isReady); + + if(button.getTaken() != LobbyButton.Taken.SELF) { + app.getAcousticHandler().playSound(MdgaSound.OTHER_READY); + } + + if(!isReady) { + app.getAcousticHandler().playSound(MdgaSound.NOT_READY); } } @@ -189,11 +192,10 @@ private void toggleTsk(Color color) { private void ready() { app.getModelSyncronizer().setReady(); - //TODO: playSound + app.getAcousticHandler().playSound(MdgaSound.SELF_READY); } private void leaveLobby() { app.getModelSyncronizer().leave(); - //TODO: playSound } } diff --git a/Projekte/mdga/client/src/main/resources/Sounds/buzzer.wav b/Projekte/mdga/client/src/main/resources/Sounds/buzzer.wav new file mode 100644 index 00000000..da4918ca Binary files /dev/null and b/Projekte/mdga/client/src/main/resources/Sounds/buzzer.wav differ diff --git a/Projekte/mdga/client/src/main/resources/Sounds/connected.wav b/Projekte/mdga/client/src/main/resources/Sounds/connected.wav new file mode 100644 index 00000000..7cf7f293 Binary files /dev/null and b/Projekte/mdga/client/src/main/resources/Sounds/connected.wav differ diff --git a/Projekte/mdga/client/src/main/resources/Sounds/laughter.wav b/Projekte/mdga/client/src/main/resources/Sounds/laughter.wav new file mode 100644 index 00000000..b40a0fc8 Binary files /dev/null and b/Projekte/mdga/client/src/main/resources/Sounds/laughter.wav differ diff --git a/Projekte/mdga/client/src/main/resources/Sounds/powerup.wav b/Projekte/mdga/client/src/main/resources/Sounds/powerup.wav new file mode 100644 index 00000000..d47f449e Binary files /dev/null and b/Projekte/mdga/client/src/main/resources/Sounds/powerup.wav differ diff --git a/Projekte/mdga/client/src/main/resources/Sounds/robotReady.wav b/Projekte/mdga/client/src/main/resources/Sounds/robotReady.wav new file mode 100644 index 00000000..c9561f5f Binary files /dev/null and b/Projekte/mdga/client/src/main/resources/Sounds/robotReady.wav differ diff --git a/Projekte/mdga/client/src/main/resources/Sounds/error_sound.ogg b/Projekte/mdga/client/src/main/resources/Sounds/ui_sound.ogg similarity index 100% rename from Projekte/mdga/client/src/main/resources/Sounds/error_sound.ogg rename to Projekte/mdga/client/src/main/resources/Sounds/ui_sound.ogg diff --git a/Projekte/mdga/client/src/main/resources/Sounds/ui_swoosch.wav b/Projekte/mdga/client/src/main/resources/Sounds/ui_swoosch.wav new file mode 100644 index 00000000..8ece1f68 Binary files /dev/null and b/Projekte/mdga/client/src/main/resources/Sounds/ui_swoosch.wav differ diff --git a/Projekte/mdga/client/src/main/resources/Sounds/unitReady.wav b/Projekte/mdga/client/src/main/resources/Sounds/unitReady.wav new file mode 100644 index 00000000..898b3c8a Binary files /dev/null and b/Projekte/mdga/client/src/main/resources/Sounds/unitReady.wav differ diff --git a/Projekte/mdga/model/src/main/java/pp.mdga/notification/TskSelectNotification.java b/Projekte/mdga/model/src/main/java/pp.mdga/notification/TskSelectNotification.java index 5b99f0e7..826bb7a5 100644 --- a/Projekte/mdga/model/src/main/java/pp.mdga/notification/TskSelectNotification.java +++ b/Projekte/mdga/model/src/main/java/pp.mdga/notification/TskSelectNotification.java @@ -17,7 +17,7 @@ public class TskSelectNotification extends Notification{ * @param name the name of the player that is in the game. * @param self true if it was the local player selecting the tsk, false otherwise */ - TskSelectNotification(Color color, String name, boolean self) { + public TskSelectNotification(Color color, String name, boolean self) { this.color = color; this.name = name; this.self = self;