diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/MonopolyApp.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/MonopolyApp.java index 1701df1..9991bb6 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/MonopolyApp.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/MonopolyApp.java @@ -28,6 +28,7 @@ import pp.monopoly.game.client.ServerConnection; import pp.monopoly.notification.ClientStateEvent; import pp.monopoly.notification.GameEventListener; import pp.monopoly.notification.InfoTextEvent; +import pp.monopoly.notification.Sound; import pp.dialog.DialogBuilder; import pp.dialog.DialogManager; import pp.graphics.Draw; @@ -416,8 +417,11 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga DialogBuilder.simple(dialogManager) .setTitle(lookup("dialog.question")) .setText(question) - .setOkButton(lookup("button.yes"), yesAction) - .setNoButton(lookup("button.no")) + .setOkButton(lookup("button.yes"), d -> { + getGameLogic().playSound(Sound.BUTTON); // Play sound + yesAction.run(); // Execute the original yesAction + }) + .setNoButton(lookup("button.no"), d -> getGameLogic().playSound(Sound.BUTTON)) .build() .open(); } @@ -431,7 +435,7 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga DialogBuilder.simple(dialogManager) .setTitle(lookup("dialog.error")) .setText(errorMessage) - .setOkButton(lookup("button.ok")) + .setOkButton(lookup("button.ok"), d -> getGameLogic().playSound(Sound.BUTTON)) .build() .open(); } diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CreateGameMenu.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CreateGameMenu.java index 979fbba..82cf38a 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CreateGameMenu.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CreateGameMenu.java @@ -28,6 +28,7 @@ import static pp.monopoly.Resources.lookup; import com.simsilica.lemur.style.ElementId; import pp.monopoly.client.MonopolyApp; import pp.monopoly.client.NetworkSupport; +import pp.monopoly.notification.Sound; import pp.monopoly.server.MonopolyServer; import pp.dialog.Dialog; import pp.dialog.DialogBuilder; @@ -89,18 +90,25 @@ public class CreateGameMenu extends Dialog { // "Abbrechen"-Button cancelButton.setPreferredSize(new Vector3f(120, 40, 0)); cancelButton.addClickCommands(s -> ifTopDialog(() -> { + app.getGameLogic().playSound(Sound.BUTTON); this.close(); new StartMenu(network.getApp()).open(); })); addChild(cancelButton); // "Selber hosten"-Button - serverButton.addClickCommands(s -> ifTopDialog(this::startServerInThread)); + serverButton.addClickCommands(s -> ifTopDialog( () -> { + network.getApp().getGameLogic().playSound(Sound.BUTTON); + startServerInThread(); + } )); addChild(serverButton); // "Beitreten"-Button joinButton.setPreferredSize(new Vector3f(120, 40, 0)); - joinButton.addClickCommands(s -> ifTopDialog(this::connect)); + joinButton.addClickCommands(s -> ifTopDialog( () -> { + app.getGameLogic().playSound(Sound.BUTTON); + connect(); + })); addChild(joinButton); }