mirror of
				https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
				synced 2025-11-04 07:36:14 +01:00 
			
		
		
		
	added button sounds
This commit is contained in:
		@@ -23,6 +23,7 @@ import static pp.monopoly.Resources.lookup;
 | 
			
		||||
 | 
			
		||||
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;
 | 
			
		||||
@@ -70,15 +71,24 @@ public class CreateGameMenu extends Dialog {
 | 
			
		||||
        cancelButton.setPreferredSize(new Vector3f(120, 40, 0));
 | 
			
		||||
        cancelButton.addClickCommands(source -> close());
 | 
			
		||||
        addChild(cancelButton);
 | 
			
		||||
        cancelButton.addClickCommands(s -> new StartMenu(app));
 | 
			
		||||
        cancelButton.addClickCommands(s -> ifTopDialog(() -> {
 | 
			
		||||
            new StartMenu(app);
 | 
			
		||||
            app.getGameLogic().playSound(Sound.BUTTON);
 | 
			
		||||
        }));
 | 
			
		||||
 | 
			
		||||
        // "Selber hosten"-Button
 | 
			
		||||
        addChild(serverButton).addClickCommands(s -> startServerInThread());
 | 
			
		||||
        addChild(serverButton).addClickCommands(s -> ifTopDialog(() -> {
 | 
			
		||||
            startServerInThread();
 | 
			
		||||
            app.getGameLogic().playSound(Sound.BUTTON);
 | 
			
		||||
        }));
 | 
			
		||||
 | 
			
		||||
        // "Beitreten"-Button
 | 
			
		||||
        joinButton.setPreferredSize(new Vector3f(120, 40, 0));
 | 
			
		||||
        addChild(joinButton);
 | 
			
		||||
        joinButton.addClickCommands(s -> connect());
 | 
			
		||||
        joinButton.addClickCommands(s -> ifTopDialog(() -> {
 | 
			
		||||
            app.connect();
 | 
			
		||||
            app.getGameLogic().playSound(Sound.BUTTON);
 | 
			
		||||
        }));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -26,6 +26,7 @@ import com.simsilica.lemur.style.ElementId;
 | 
			
		||||
import pp.dialog.Dialog;
 | 
			
		||||
import pp.monopoly.client.MonopolyApp;
 | 
			
		||||
import pp.monopoly.message.client.PlayerReady;
 | 
			
		||||
import pp.monopoly.notification.Sound;
 | 
			
		||||
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
 | 
			
		||||
@@ -133,7 +134,10 @@ public class LobbyMenu extends Dialog {
 | 
			
		||||
        Button cancelButton = new Button("Abbrechen");
 | 
			
		||||
        cancelButton.setPreferredSize(new Vector3f(200, 60, 0)); // Set size to match the appearance in the image
 | 
			
		||||
        cancelButton.setFontSize(18); // Adjust font size
 | 
			
		||||
        cancelButton.addClickCommands(source -> close()); // Add functionality
 | 
			
		||||
        cancelButton.addClickCommands(s -> ifTopDialog(() -> {
 | 
			
		||||
            this.close();
 | 
			
		||||
            app.getGameLogic().playSound(Sound.BUTTON);
 | 
			
		||||
        }));
 | 
			
		||||
        lowerLeftMenu.addChild(cancelButton);
 | 
			
		||||
 | 
			
		||||
        // Position the container near the bottom-left corner
 | 
			
		||||
@@ -146,7 +150,10 @@ public class LobbyMenu extends Dialog {
 | 
			
		||||
        readyButton.setPreferredSize(new Vector3f(200, 60, 0)); // Set size to match the appearance in the image
 | 
			
		||||
        readyButton.setFontSize(18); // Adjust font size
 | 
			
		||||
        readyButton.setBackground(new QuadBackgroundComponent(ColorRGBA.Green)); // Add color to match the style
 | 
			
		||||
        readyButton.addClickCommands(source -> toggleReady()); // Add functionality
 | 
			
		||||
        readyButton.addClickCommands(s -> ifTopDialog(() -> {
 | 
			
		||||
            toggleReady();
 | 
			
		||||
            app.getGameLogic().playSound(Sound.BUTTON);
 | 
			
		||||
        }));
 | 
			
		||||
        lowerRightMenu.addChild(readyButton);
 | 
			
		||||
 | 
			
		||||
        // Position the container near the bottom-right corner
 | 
			
		||||
@@ -254,6 +261,7 @@ public class LobbyMenu extends Dialog {
 | 
			
		||||
     */
 | 
			
		||||
    private void onDropdownSelectionChanged(String selected) {
 | 
			
		||||
        System.out.println("Selected: " + selected);
 | 
			
		||||
        app.getGameLogic().playSound(Sound.BUTTON);
 | 
			
		||||
        switch (selected) {
 | 
			
		||||
            case "[0]":
 | 
			
		||||
                figure = "Laptop";
 | 
			
		||||
 
 | 
			
		||||
@@ -20,6 +20,8 @@ import pp.monopoly.client.GameSound;
 | 
			
		||||
import pp.monopoly.client.MonopolyApp;
 | 
			
		||||
import pp.dialog.Dialog;
 | 
			
		||||
import pp.dialog.StateCheckboxModel;
 | 
			
		||||
import pp.monopoly.notification.Sound;
 | 
			
		||||
 | 
			
		||||
import static pp.util.PreferencesUtils.getPreferences;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -56,9 +58,14 @@ public class SettingsMenu extends Dialog {
 | 
			
		||||
        
 | 
			
		||||
        addChild(musicSlider);
 | 
			
		||||
 | 
			
		||||
        addChild(new Button("Zurück zum Spiel", new ElementId("button"))).addClickCommands(s -> ifTopDialog(this::close));
 | 
			
		||||
        addChild(new Button("Beenden", new ElementId("button"))).addClickCommands(s -> ifTopDialog(app::closeApp));
 | 
			
		||||
        
 | 
			
		||||
        addChild(new Button("Zurück zum Spiel", new ElementId("button"))).addClickCommands(s -> ifTopDialog(() -> {
 | 
			
		||||
            this.close();  // Close the StartMenu dialog
 | 
			
		||||
            app.getGameLogic().playSound(Sound.BUTTON);
 | 
			
		||||
        }));
 | 
			
		||||
        addChild(new Button("Beenden", new ElementId("button"))).addClickCommands(s -> ifTopDialog(() -> {
 | 
			
		||||
            app.getGameLogic().playSound(Sound.BUTTON);
 | 
			
		||||
            app.closeApp();
 | 
			
		||||
        }));
 | 
			
		||||
        update();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -14,6 +14,7 @@ import com.simsilica.lemur.component.SpringGridLayout;
 | 
			
		||||
import com.simsilica.lemur.style.ElementId;
 | 
			
		||||
import pp.dialog.Dialog;
 | 
			
		||||
import pp.monopoly.client.MonopolyApp;
 | 
			
		||||
import pp.monopoly.notification.Sound;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Toolbar Klasse, die am unteren Rand der Szene angezeigt wird.
 | 
			
		||||
@@ -135,7 +136,10 @@ public class Toolbar extends Dialog {
 | 
			
		||||
    private Button addDiceRollButton() {
 | 
			
		||||
        Button diceButton = new Button("Würfeln");
 | 
			
		||||
        diceButton.setPreferredSize(new Vector3f(50, 20, 0));
 | 
			
		||||
        diceButton.addClickCommands(source -> rollDice());
 | 
			
		||||
        diceButton.addClickCommands(s -> ifTopDialog(() -> {
 | 
			
		||||
            rollDice();
 | 
			
		||||
            app.getGameLogic().playSound(Sound.BUTTON);
 | 
			
		||||
        }));
 | 
			
		||||
        toolbarContainer.addChild(diceButton);
 | 
			
		||||
        return diceButton;
 | 
			
		||||
    }
 | 
			
		||||
@@ -143,21 +147,30 @@ public class Toolbar extends Dialog {
 | 
			
		||||
    private void addTradeMenuButton() {
 | 
			
		||||
        Button diceButton = new Button("Handeln");
 | 
			
		||||
        diceButton.setPreferredSize(new Vector3f(150, 50, 0)); // Größe des Buttons
 | 
			
		||||
        diceButton.addClickCommands(source -> rollDice());
 | 
			
		||||
        diceButton.addClickCommands(s -> ifTopDialog(() -> {
 | 
			
		||||
            rollDice();
 | 
			
		||||
            app.getGameLogic().playSound(Sound.BUTTON);
 | 
			
		||||
        }));
 | 
			
		||||
        toolbarContainer.addChild(diceButton);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void addEndTurnButton() {
 | 
			
		||||
        Button diceButton = new Button("Grundstücke");
 | 
			
		||||
        diceButton.setPreferredSize(new Vector3f(150, 50, 0)); // Größe des Buttons
 | 
			
		||||
        diceButton.addClickCommands(source -> rollDice());
 | 
			
		||||
        diceButton.addClickCommands(s -> ifTopDialog(() -> {
 | 
			
		||||
            rollDice();
 | 
			
		||||
            app.getGameLogic().playSound(Sound.BUTTON);
 | 
			
		||||
        }));
 | 
			
		||||
        toolbarContainer.addChild(diceButton);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void addPropertyMenuButton() {
 | 
			
		||||
        Button diceButton = new Button("Zug beenden");
 | 
			
		||||
        diceButton.setPreferredSize(new Vector3f(150, 50, 0)); // Größe des Buttons
 | 
			
		||||
        diceButton.addClickCommands(source -> rollDice());
 | 
			
		||||
        diceButton.addClickCommands(s -> ifTopDialog(() -> {
 | 
			
		||||
            rollDice();
 | 
			
		||||
            app.getGameLogic().playSound(Sound.BUTTON);
 | 
			
		||||
        }));
 | 
			
		||||
        toolbarContainer.addChild(diceButton);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user