From 6355b98441bf6939d3b9e81772e0eb5ee9eacb93 Mon Sep 17 00:00:00 2001 From: Benjamin Feyer Date: Thu, 3 Oct 2024 13:46:18 +0200 Subject: [PATCH] Nr.10 edited 'Menu','Sound','battlship.properties' and 'battleship_de.properties' edited the property files to ensure, that in the menu the background music on/off and the background volume slider are named in eng and german, edited the childnotes for the menu, so the checkbox and slider are visible, edited the enum Suonds, for another entry 'BACKGROUNDMUSIC' --- .../client/src/main/java/pp/battleship/client/Menu.java | 6 ++++++ .../src/main/java/pp/battleship/notification/Sound.java | 7 ++++++- .../model/src/main/resources/battleship.properties | 2 ++ .../model/src/main/resources/battleship_de.properties | 3 +++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Projekte/battleship/client/src/main/java/pp/battleship/client/Menu.java b/Projekte/battleship/client/src/main/java/pp/battleship/client/Menu.java index 0e100e86..9eca93cc 100644 --- a/Projekte/battleship/client/src/main/java/pp/battleship/client/Menu.java +++ b/Projekte/battleship/client/src/main/java/pp/battleship/client/Menu.java @@ -10,6 +10,7 @@ import com.simsilica.lemur.Button; import com.simsilica.lemur.Checkbox; import com.simsilica.lemur.Label; +import com.simsilica.lemur.Slider; import com.simsilica.lemur.style.ElementId; import pp.dialog.Dialog; import pp.dialog.StateCheckboxModel; @@ -34,6 +35,7 @@ class Menu extends Dialog { private final Button loadButton = new Button(lookup("menu.map.load")); private final Button saveButton = new Button(lookup("menu.map.save")); + /** * Constructs the Menu dialog for the Battleship application. * @@ -45,6 +47,9 @@ public Menu(BattleshipApp app) { addChild(new Label(lookup("battleship.name"), new ElementId("header"))); //NON-NLS addChild(new Checkbox(lookup("menu.sound-enabled"), new StateCheckboxModel(app, GameSound.class))); + addChild(new Checkbox(lookup("background.music.checkbox"))); + addChild(new Label(lookup("background.music.volume"))); + addChild(new Slider(lookup("background.music.volume"))); addChild(loadButton) .addClickCommands(s -> ifTopDialog(this::loadDialog)); addChild(saveButton) @@ -53,6 +58,7 @@ public Menu(BattleshipApp app) { .addClickCommands(s -> ifTopDialog(this::close)); addChild(new Button(lookup("menu.quit"))) .addClickCommands(s -> ifTopDialog(app::closeApp)); + update(); } diff --git a/Projekte/battleship/model/src/main/java/pp/battleship/notification/Sound.java b/Projekte/battleship/model/src/main/java/pp/battleship/notification/Sound.java index d82ab698..ce0d6e8f 100644 --- a/Projekte/battleship/model/src/main/java/pp/battleship/notification/Sound.java +++ b/Projekte/battleship/model/src/main/java/pp/battleship/notification/Sound.java @@ -22,5 +22,10 @@ public enum Sound { /** * Sound of a ship being destroyed. */ - DESTROYED_SHIP + DESTROYED_SHIP, + + /** + * + */ + BACKGROUND_MUSIC //TODO } diff --git a/Projekte/battleship/model/src/main/resources/battleship.properties b/Projekte/battleship/model/src/main/resources/battleship.properties index 47f1f6cf..384aabb3 100644 --- a/Projekte/battleship/model/src/main/resources/battleship.properties +++ b/Projekte/battleship/model/src/main/resources/battleship.properties @@ -37,3 +37,5 @@ dialog.error=Error dialog.question=Question port.must.be.integer=Port must be an integer number map.doesnt.fit=The map doesn't fit to this game +background.music.checkbox= Background music on/off +background.music.volume= Background volume diff --git a/Projekte/battleship/model/src/main/resources/battleship_de.properties b/Projekte/battleship/model/src/main/resources/battleship_de.properties index 40394202..52585c4a 100644 --- a/Projekte/battleship/model/src/main/resources/battleship_de.properties +++ b/Projekte/battleship/model/src/main/resources/battleship_de.properties @@ -37,3 +37,6 @@ dialog.error=Fehler dialog.question=Frage port.must.be.integer=Der Port muss eine ganze Zahl sein map.doesnt.fit=Diese Karte passt nicht zu diesem Spiel +background.music.checkbox= Musik an/aus +background.music.volume= Musiklautstärke +