mirror of
				https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
				synced 2025-11-04 13:56:22 +01:00 
			
		
		
		
	Compare commits
	
		
			8 Commits
		
	
	
		
			72cb7049ba
			...
			88409dcc99
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					88409dcc99 | ||
| 
						 | 
					5cacff39b7 | ||
| 
						 | 
					093723a9d0 | ||
| 
						 | 
					dfdbcdc9f3 | ||
| 
						 | 
					bd725e2dc4 | ||
| 
						 | 
					dd9d9144dd | ||
| 
						 | 
					1a429e4bb6 | ||
| 
						 | 
					ad6fb5e926 | 
@@ -136,6 +136,7 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
 | 
			
		||||
    private boolean isBuyCardPopupOpen = false;
 | 
			
		||||
    private final ActionListener BListener = (name, isPressed, tpf) -> handleB(isPressed);
 | 
			
		||||
    private final ActionListener TListener = (name, isPressed, tpf) -> handleT(isPressed);
 | 
			
		||||
    private TestWorld testWorld;
 | 
			
		||||
 | 
			
		||||
    static {
 | 
			
		||||
        // Configure logging
 | 
			
		||||
@@ -296,8 +297,8 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
 | 
			
		||||
    //logik zum wechselnden erscheinen und verschwinden beim drücken von B //TODO süäter entfernen
 | 
			
		||||
    private void handleT(boolean isPressed) {
 | 
			
		||||
        if (isPressed) {
 | 
			
		||||
            TestWorld tmp = new TestWorld(this);
 | 
			
		||||
            tmp.initializeScene();
 | 
			
		||||
            testWorld = new TestWorld(this);
 | 
			
		||||
            testWorld.initializeScene();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -350,6 +351,11 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
 | 
			
		||||
        super.simpleUpdate(tpf);
 | 
			
		||||
        dialogManager.update(tpf);
 | 
			
		||||
        logic.update(tpf);
 | 
			
		||||
 | 
			
		||||
        //TODO testing replace later
 | 
			
		||||
        if (testWorld != null) {
 | 
			
		||||
            testWorld.update(tpf);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,64 @@
 | 
			
		||||
package pp.monopoly.client.gui;
 | 
			
		||||
 | 
			
		||||
import com.jme3.material.Material;
 | 
			
		||||
import com.jme3.math.ColorRGBA;
 | 
			
		||||
import com.jme3.math.Vector3f;
 | 
			
		||||
import com.jme3.scene.Geometry;
 | 
			
		||||
import com.jme3.scene.shape.Quad;
 | 
			
		||||
import com.jme3.texture.Texture;
 | 
			
		||||
import com.simsilica.lemur.Axis;
 | 
			
		||||
import com.simsilica.lemur.Container;
 | 
			
		||||
import com.simsilica.lemur.Label;
 | 
			
		||||
import com.simsilica.lemur.TextField;
 | 
			
		||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
 | 
			
		||||
import com.simsilica.lemur.component.SpringGridLayout;
 | 
			
		||||
import com.simsilica.lemur.style.ElementId;
 | 
			
		||||
import pp.dialog.Dialog;
 | 
			
		||||
import pp.monopoly.client.MonopolyApp;
 | 
			
		||||
 | 
			
		||||
public class ChoosePartner extends Dialog {
 | 
			
		||||
 | 
			
		||||
    private final MonopolyApp app;
 | 
			
		||||
    private final Container menuContainer;
 | 
			
		||||
    private Geometry background;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public ChoosePartner(MonopolyApp app) {
 | 
			
		||||
        super(app.getDialogManager());
 | 
			
		||||
        this.app = app;
 | 
			
		||||
 | 
			
		||||
        // Hintergrundbild laden und hinzufügen
 | 
			
		||||
        addBackgroundImage();
 | 
			
		||||
 | 
			
		||||
        QuadBackgroundComponent translucentWhiteBackground =
 | 
			
		||||
                new QuadBackgroundComponent(new ColorRGBA(1.0f, 1.0f, 1.0f, 0.5f));
 | 
			
		||||
 | 
			
		||||
        menuContainer = new Container(new SpringGridLayout(Axis.Y, Axis.X));
 | 
			
		||||
        menuContainer.setPreferredSize(new Vector3f(1000, 600, 0)); // Fixed size of the container
 | 
			
		||||
        menuContainer.setBackground(translucentWhiteBackground);
 | 
			
		||||
 | 
			
		||||
        // Create a smaller horizontal container for the label, input field, and spacers
 | 
			
		||||
        Container horizontalContainer = menuContainer.addChild(new Container(new SpringGridLayout(Axis.X, Axis.Y)));
 | 
			
		||||
        horizontalContainer.setPreferredSize(new Vector3f(600, 40, 0)); // Adjust container size
 | 
			
		||||
        horizontalContainer.setBackground(null);
 | 
			
		||||
 | 
			
		||||
        Label title = horizontalContainer.addChild(new Label("Wähle deinen Handelspartner:", new ElementId("label-Bold")));
 | 
			
		||||
        title.setFontSize(40);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Lädt das Hintergrundbild und fügt es als geometrische Ebene hinzu.
 | 
			
		||||
     */
 | 
			
		||||
    private void addBackgroundImage() {
 | 
			
		||||
        Texture backgroundImage = app.getAssetManager().loadTexture("Pictures/unibw-Bib2.png");
 | 
			
		||||
        Quad quad = new Quad(app.getCamera().getWidth(), app.getCamera().getHeight());
 | 
			
		||||
        background = new Geometry("Background", quad);
 | 
			
		||||
        Material backgroundMaterial = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
 | 
			
		||||
        backgroundMaterial.setTexture("ColorMap", backgroundImage);
 | 
			
		||||
        background.setMaterial(backgroundMaterial);
 | 
			
		||||
        background.setLocalTranslation(0, 0, -1); // Hintergrundebene
 | 
			
		||||
 | 
			
		||||
        app.getGuiNode().attachChild(background);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -6,11 +6,16 @@ import java.util.Random;
 | 
			
		||||
import com.jme3.font.BitmapText;
 | 
			
		||||
import com.jme3.math.ColorRGBA;
 | 
			
		||||
import com.jme3.math.Vector3f;
 | 
			
		||||
import com.simsilica.lemur.*;
 | 
			
		||||
import com.simsilica.lemur.Axis;
 | 
			
		||||
import com.simsilica.lemur.Button;
 | 
			
		||||
import com.simsilica.lemur.Container;
 | 
			
		||||
import com.simsilica.lemur.Label;
 | 
			
		||||
import com.simsilica.lemur.Panel;
 | 
			
		||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
 | 
			
		||||
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;
 | 
			
		||||
@@ -81,11 +86,41 @@ public class Toolbar extends Dialog {
 | 
			
		||||
 | 
			
		||||
        // Menü-Container: Ein Container für Würfel
 | 
			
		||||
        Container diceContainer = toolbarContainer.addChild(new Container());
 | 
			
		||||
        diceContainer.setLayout(new SpringGridLayout(Axis.X, Axis.Y));
 | 
			
		||||
 | 
			
		||||
        // Create a horizontal container to align leftContainer and rightContainer side by side
 | 
			
		||||
        Container horizontalContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y));
 | 
			
		||||
        horizontalContainer.setPreferredSize(new Vector3f(200, 150, 0)); // Adjust size as needed
 | 
			
		||||
 | 
			
		||||
       // Create the first container (leftContainer)
 | 
			
		||||
        Container leftContainer = new Container();
 | 
			
		||||
        leftContainer.setPreferredSize(new Vector3f(100, 150, 0)); // Adjust size as needed
 | 
			
		||||
        leftContainer.addChild(new Label("Left Container", new ElementId("label")));
 | 
			
		||||
        leftContainer.addChild(new Button("Button 1"));
 | 
			
		||||
 | 
			
		||||
        // Create the second container (rightContainer)
 | 
			
		||||
        Container rightContainer = new Container();
 | 
			
		||||
        rightContainer.setPreferredSize(new Vector3f(100, 150, 0)); // Adjust size as needed
 | 
			
		||||
        rightContainer.addChild(new Label("Right Container", new ElementId("label")));
 | 
			
		||||
        rightContainer.addChild(new Button("Button 2"));
 | 
			
		||||
 | 
			
		||||
        // Add leftContainer and rightContainer to the horizontal container
 | 
			
		||||
        horizontalContainer.addChild(leftContainer);
 | 
			
		||||
        horizontalContainer.addChild(rightContainer);
 | 
			
		||||
 | 
			
		||||
       // Add the horizontalContainer to the diceContainer (top section)
 | 
			
		||||
        diceContainer.addChild(horizontalContainer);
 | 
			
		||||
 | 
			
		||||
        // Add the Würfeln button directly below the horizontalContainer
 | 
			
		||||
        Button diceButton = new Button("Würfeln");
 | 
			
		||||
        diceButton.setPreferredSize(new Vector3f(200, 50, 0)); // Full width for Würfeln button
 | 
			
		||||
        diceButton.addClickCommands(s -> ifTopDialog(() -> {
 | 
			
		||||
            rollDice();
 | 
			
		||||
            app.getGameLogic().playSound(Sound.BUTTON);
 | 
			
		||||
        }));
 | 
			
		||||
        diceContainer.addChild(diceButton);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        diceContainer.setPreferredSize(new Vector3f(400, 150, 0));
 | 
			
		||||
        diceContainer.addChild(new Label("Wo Würfel?", new ElementId("label")));
 | 
			
		||||
        diceContainer.addChild(addDiceRollButton());
 | 
			
		||||
        diceContainer.setBackground(null);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        // Menü-Container: Ein Nested-Container für Handeln, Grundstücke und Zug beenden
 | 
			
		||||
@@ -144,12 +179,15 @@ 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(s -> ifTopDialog(() -> {
 | 
			
		||||
        diceButton.addClickCommands(s  -> {
 | 
			
		||||
            rollDice();
 | 
			
		||||
            app.getGameLogic().playSound(Sound.BUTTON);
 | 
			
		||||
        }));
 | 
			
		||||
            this.close();
 | 
			
		||||
            System.out.println("test");
 | 
			
		||||
            new ChoosePartner(app).open();
 | 
			
		||||
        });
 | 
			
		||||
        toolbarContainer.addChild(diceButton);
 | 
			
		||||
    }
 | 
			
		||||
    }// TODO Funktion der Buttons Überarbeiten und prüfen
 | 
			
		||||
 | 
			
		||||
    private void addEndTurnButton() {
 | 
			
		||||
        Button diceButton = new Button("Grundstücke");
 | 
			
		||||
@@ -223,11 +261,15 @@ public class Toolbar extends Dialog {
 | 
			
		||||
        positionText.setText("Feld-ID: " + currentPosition);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Entfernt die Toolbar.
 | 
			
		||||
     */
 | 
			
		||||
    public void remove() {
 | 
			
		||||
    @Override
 | 
			
		||||
    public void close() {
 | 
			
		||||
        app.getGuiNode().detachChild(toolbarContainer);
 | 
			
		||||
        app.getGuiNode().detachChild(positionText);
 | 
			
		||||
        super.close();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void escape() {
 | 
			
		||||
        new SettingsMenu(app).open();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,55 +0,0 @@
 | 
			
		||||
package pp.monopoly.client.gui.popups;
 | 
			
		||||
 | 
			
		||||
import com.jme3.asset.TextureKey;
 | 
			
		||||
import com.jme3.math.Vector2f;
 | 
			
		||||
import com.jme3.texture.Texture;
 | 
			
		||||
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 LoserPopUp extends Dialog {
 | 
			
		||||
 | 
			
		||||
    private final MonopolyApp app;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a new NetworkDialog.
 | 
			
		||||
     *
 | 
			
		||||
     * @param network The NetworkSupport instance to be used for network operations.
 | 
			
		||||
     */
 | 
			
		||||
    public LoserPopUp(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("");
 | 
			
		||||
        TextureKey key = new TextureKey("Pictures/MonopolyLoser.png", true);
 | 
			
		||||
        Texture texture = app.getAssetManager().loadTexture(key);
 | 
			
		||||
        IconComponent icon = new IconComponent(texture.toString());     // Icon mit Textur erstellen
 | 
			
		||||
        icon.setIconSize(new Vector2f(155f, 120f));     // 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,500,0);
 | 
			
		||||
        attachChild(inputContainer);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user