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