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 231776d..12afb6d 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 @@ -21,7 +21,7 @@ import pp.battleship.client.gui.GameMusic; import pp.dialog.Dialog; import pp.dialog.StateCheckboxModel; import pp.dialog.TextInputDialog; -import pp.monopoly.client.gui.VolumeSlider; +import pp.battleship.client.gui.VolumeSlider; import static pp.util.PreferencesUtils.getPreferences; diff --git a/Projekte/battleship/client/src/main/java/pp/battleship/client/gui/VolumeSlider.java b/Projekte/battleship/client/src/main/java/pp/battleship/client/gui/VolumeSlider.java new file mode 100644 index 0000000..70f9097 --- /dev/null +++ b/Projekte/battleship/client/src/main/java/pp/battleship/client/gui/VolumeSlider.java @@ -0,0 +1,36 @@ +package pp.battleship.client.gui; + +import com.simsilica.lemur.Slider; + +/** + * The VolumeSlider class represents the Volume Slider in the Menu. + * It extends the Slider class and provides functionalities for setting the music volume, + * with the help of the Slider in the GUI + */ +public class VolumeSlider extends Slider { + + private final GameMusic music; + private double vol; + + /** + * Constructs the Volume Slider for the Menu dialog + * @param music the music instance + */ + public VolumeSlider(GameMusic music) { + super(); + this.music = music; + vol = GameMusic.volumeInPreferences(); + getModel().setPercent(vol); + } + + /** + * when triggered it updates the volume to the value set with the slider + */ + public void update() { + if (vol != getModel().getPercent()) { + vol = getModel().getPercent(); + music.setVolume( (float) vol); + } + } + +} diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/LooserPopUp.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/LooserPopUp.java new file mode 100644 index 0000000..a24fb2a --- /dev/null +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/LooserPopUp.java @@ -0,0 +1,52 @@ +package pp.monopoly.client.gui.popups; + +import com.simsilica.lemur.Button; +import com.simsilica.lemur.Container; +import com.simsilica.lemur.Label; +import com.simsilica.lemur.component.IconComponent; + +import pp.dialog.Dialog; +import pp.monopoly.client.MonopolyApp; + +public class LooserPopUp extends Dialog { + + private final MonopolyApp app; + + /** + * Constructs a new NetworkDialog. + * + * @param network The NetworkSupport instance to be used for network operations. + */ + public LooserPopUp(MonopolyApp app) { + super(app.getDialogManager()); + this.app = app; + initializeDialog(); + } + + /** + * Initializes the dialog with input fields and connection buttons. + */ + private void initializeDialog() { + Container inputContainer = new Container(); + + // Titel und Eingabefelder für Host und Port + inputContainer.addChild(new Label("Schade, du hast leider verloren!")); + inputContainer.addChild(new Label("Die nächste Runde wird besser!")); + + Label imageLabel = new Label(""); + IconComponent icon = new IconComponent("Pictures/MonopolyLooser.png"); // Icon mit Textur erstellen + icon.setIconScale(1); // Skalierung des Bildes + imageLabel.setIcon(icon); + + // Setze das Icon im Label + inputContainer.addChild(imageLabel); + + Button cancelButton = inputContainer.addChild(new Button("Spiel beenden")); + cancelButton.addClickCommands(source -> ifTopDialog(app::closeApp)); + + inputContainer.setLocalTranslation(300, 800, 0); + app.getGuiNode().attachChild(inputContainer); + + } +} + diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/WinnerPopUp.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/WinnerPopUp.java new file mode 100644 index 0000000..ffb4c09 --- /dev/null +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/WinnerPopUp.java @@ -0,0 +1,51 @@ +package pp.monopoly.client.gui.popups; + +import com.simsilica.lemur.Button; +import com.simsilica.lemur.Container; +import com.simsilica.lemur.Label; +import com.simsilica.lemur.component.IconComponent; + +import pp.dialog.Dialog; +import pp.monopoly.client.MonopolyApp; + +public class WinnerPopUp extends Dialog { + + private final MonopolyApp app; + + /** + * Constructs a new NetworkDialog. + * + * @param app The NetworkSupport instance to be used for network operations. + */ + public WinnerPopUp(MonopolyApp app) { + super(app.getDialogManager()); + this.app = app; + initializeDialog(); + } + + /** + * Initializes the dialog with input fields and connection buttons. + */ + private void initializeDialog() { + Container inputContainer = new Container(); + + // Titel und Eingabefelder für Host und Port + inputContainer.addChild(new Label("Herlichen Glückwunsch!")); + inputContainer.addChild(new Label("Du,bist der Monopoly Champion!!!")); + + Label imageLabel = new Label(""); + IconComponent icon = new IconComponent("Pictures/MonopolyWinner.png"); // Icon mit Textur erstellen + icon.setIconScale(1); // Skalierung des Bildes + imageLabel.setIcon(icon); + + // Setze das Icon im Label + inputContainer.addChild(imageLabel); + + Button cancelButton = inputContainer.addChild(new Button("Spiel beenden")); + cancelButton.addClickCommands(source -> ifTopDialog(app::closeApp)); + + inputContainer.setLocalTranslation(300, 800, 0); + app.getGuiNode().attachChild(inputContainer); + } +} + diff --git a/Projekte/monopoly/client/src/main/resources/Pictures/MonopolyLooser.png b/Projekte/monopoly/client/src/main/resources/Pictures/MonopolyLooser.png new file mode 100644 index 0000000..2de2fa1 Binary files /dev/null and b/Projekte/monopoly/client/src/main/resources/Pictures/MonopolyLooser.png differ diff --git a/Projekte/monopoly/client/src/main/resources/Pictures/MonopolyWinner.png b/Projekte/monopoly/client/src/main/resources/Pictures/MonopolyWinner.png new file mode 100644 index 0000000..1566809 Binary files /dev/null and b/Projekte/monopoly/client/src/main/resources/Pictures/MonopolyWinner.png differ