diff --git a/Projekte/.run/MonopolyApp (Mac).run.xml b/Projekte/.run/MonopolyApp (Mac).run.xml new file mode 100644 index 0000000..95dd7c1 --- /dev/null +++ b/Projekte/.run/MonopolyApp (Mac).run.xml @@ -0,0 +1,18 @@ + + + + \ No newline at end of file diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/LobbyMenu.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/LobbyMenu.java index 9e60d9f..2368699 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/LobbyMenu.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/LobbyMenu.java @@ -38,6 +38,13 @@ public class LobbyMenu extends Dialog { private Geometry circle; private Container lowerLeftMenu; private Container lowerRightMenu; + private ColorRGBA playerColor= ColorRGBA.Gray; + + private PlayerHandler playerHandler; + private TextField startingCapital; + private TextField playerInputField; + private Selector figureDropdown; + private TextField playerInputField = new TextField("Spieler 1"); private TextField startingCapital = new TextField("15000"); @@ -47,19 +54,20 @@ public class LobbyMenu extends Dialog { super(app.getDialogManager()); this.app = app; - // Hintergrundbild laden und hinzufügen - addBackgroundImage(); + app.getGuiNode().detachAllChildren(); // Entfernt das CreateGameMenu (inklusive Hintergrund) + + addBackgroundImage();// Hintergrundbild laden und hinzufügen 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.setPreferredSize(new Vector3f(1000, 600, 0)); 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.setPreferredSize(new Vector3f(600, 40, 0)); horizontalContainer.setBackground(null); Label title = horizontalContainer.addChild(new Label("Startkapital:", new ElementId("label-Bold"))); @@ -98,15 +106,16 @@ public class LobbyMenu extends Dialog { playerInputField.setPreferredSize(new Vector3f(100, 20, 0)); - playerInputField.setInsets(new Insets3f(5, 10, 5, 10)); // Add padding for the text inside the field + playerInputField.setInsets(new Insets3f(5, 10, 5, 10)); playerInputField.setBackground(new QuadBackgroundComponent(ColorRGBA.Black)); playerInputContainer.addChild(playerInputField); // Spacer (Center Circle Area) Label spacer = dropdownContainer.addChild(new Label("")); - spacer.setPreferredSize(new Vector3f(200, 200, 0)); // Adjust this to fit the center graphic + spacer.setPreferredSize(new Vector3f(200, 200, 0)); // Figur Dropdown Container figureDropdownContainer = dropdownContainer.addChild(new Container(new SpringGridLayout(Axis.Y, Axis.X))); + figureDropdownContainer.setPreferredSize(new Vector3f(150, 80, 0)); figureDropdownContainer.addChild(new Label("Figur:")); figureDropdownContainer.setBackground(null); @@ -120,7 +129,11 @@ public class LobbyMenu extends Dialog { Selector figureDropdown = new Selector<>(figures, "glass"); figureDropdown.setBackground(new QuadBackgroundComponent(ColorRGBA.DarkGray)); - figureDropdown.setPreferredSize(new Vector3f(100, 20, 0)); + figureDropdown.setPreferredSize(new Vector3f(150, 140, 0)); + Vector3f dimens = figureDropdownContainer.getPreferredSize(); + Vector3f dimens2 = figureDropdown.getPopupContainer().getPreferredSize(); + dimens2.setX( dimens.getX() ); + figureDropdown.getPopupContainer().setPreferredSize( dimens2 ); figureDropdownContainer.addChild(figureDropdown); addSelectionActionListener(figureDropdown, this::onDropdownSelectionChanged); @@ -155,13 +168,14 @@ public class LobbyMenu extends Dialog { app.getGameLogic().playSound(Sound.BUTTON); })); lowerRightMenu.addChild(readyButton); + //TODO aktivieren des Spielers in den ready Status und Sprung in den nächsten Menüzustand // Position the container near the bottom-right corner lowerRightMenu.setLocalTranslation(new Vector3f(app.getCamera().getWidth() - 320, 170, 3)); // X: 220px from the right, Y: 50px above the bottom app.getGuiNode().attachChild(lowerRightMenu); // Add a colored circle between the input field and the dropdown menu - circle = createCircle( ColorRGBA.Red); // 50 is the diameter, Red is the color + circle = createCircle(); // 50 is the diameter, Red is the color circle.setLocalTranslation(new Vector3f( (app.getCamera().getWidth()) / 2, // Center horizontally (app.getCamera().getHeight() / 2) - 90, // Adjust Y position @@ -178,7 +192,59 @@ public class LobbyMenu extends Dialog { app.getGuiNode().attachChild(menuContainer); } + /** + * Apply the starting capital only if the current player is the host. + */ + private void applyStartingCapital(int playerID) { + Player currentPlayer = playerHandler.getPlayerById(playerID); + // Check if the current player is the host + if (currentPlayer.equals(playerHandler.getHostPlayer())) { + try { + // Parse and validate starting capital + int startBalance = Integer.parseInt(startingCapital.getText().replaceAll("[^\\d]", "")); + if (startBalance < 0) throw new NumberFormatException("Starting capital must be positive."); + + // Apply the starting balance to all players + playerHandler.setStartBalance(startBalance); + System.out.println("Starting balance set to: " + startBalance); + } catch (NumberFormatException e) { + System.err.println("Invalid starting capital: " + e.getMessage()); + } + } else { + System.out.println("Only the host can set the starting balance."); + } + } + + /** + * Apply the player name from the input field. + */ + private void applyPlayerName(int playerID) { + Player currentPlayer = playerHandler.getPlayerById(playerID); + + String playerName = playerInputField.getText().trim(); + if (!playerName.isEmpty()) { + currentPlayer.setName(playerName); + System.out.println("Player name set to: " + playerName); + } else { + System.err.println("Invalid player name: Name cannot be empty."); + } + } + + /** + * Apply the selected figure to the player. + */ + private void applyFigure(int playerID) { + Player currentPlayer = playerHandler.getPlayerById(playerID); + + String selectedFigure = figureDropdown.getSelectedItem(); + if (selectedFigure != null && !selectedFigure.isEmpty()) { + currentPlayer.setFigure(new Figure(0, 0, 0, Rotation.RIGHT, "selectedFigure")); + System.out.println("Player figure set to: " + selectedFigure); + } else { + System.err.println("Invalid figure selection."); + } + } /** * Lädt das Hintergrundbild und fügt es als geometrische Ebene hinzu. @@ -195,21 +261,32 @@ public class LobbyMenu extends Dialog { app.getGuiNode().attachChild(background); } - private Geometry createCircle(ColorRGBA color) { + private Geometry createCircle() { Sphere sphere = new Sphere(90,90,60.0f); Geometry circleGeometry = new Geometry("Circle", sphere); // Create a material with a solid color Material material = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md"); - material.setColor("Color", color); // Set the desired color + material.setColor("Color", playerColor); // Set the desired color circleGeometry.setMaterial(material); return circleGeometry; } + public void setPlayerColor(ColorRGBA newColor) { + this.playerColor = newColor; + // Update the circle's color + if (circle != null) { + Material material = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md"); + material.setColor("Color", playerColor); + circle.setMaterial(material); + } + } /** - * Schaltet den "Bereit"-Status um. + * Assigns a color to the player based on their ID. + * + * @param playerID the player's ID */ private void toggleReady() { app.getGameLogic().send(new PlayerReady(true, playerInputField.getText(), figure, Integer.parseInt(startingCapital.getText()))); diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/BuildingPropertyCard.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/BuildingPropertyCard.java index 3ddf76c..39e948f 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/BuildingPropertyCard.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/BuildingPropertyCard.java @@ -23,7 +23,7 @@ public class BuildingPropertyCard extends Dialog { private final Geometry overlayBackground; private final Container buildingPropertyContainer; private final Container backgroundContainer; - private int index = 39; + private int index = 37; public BuildingPropertyCard(MonopolyApp app) { super(app.getDialogManager()); @@ -121,8 +121,8 @@ public class BuildingPropertyCard extends Dialog { app.getGuiNode().detachChild(buildingPropertyContainer); // Entferne das Menü app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand app.getGuiNode().detachChild(overlayBackground); // Entferne das Overlay - // app.setSettingsMenuOpen(false); // Menü als geschlossen markieren - // app.unblockInputs(); // Eingaben wieder aktivieren + app.setSettingsMenuOpen(false); // Menü als geschlossen markieren TODO passt diese Variable noch (zu finden unter den Temps in MonopolyApp + app.unblockInputs(); // Eingaben wieder aktivieren System.out.println("SettingsMenu geschlossen."); // Debugging-Ausgabe } diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/BuyCard.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/BuyCard.java index 54c4619..bfae0f6 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/BuyCard.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/BuyCard.java @@ -12,6 +12,7 @@ import com.simsilica.lemur.component.QuadBackgroundComponent; import com.simsilica.lemur.style.ElementId; import pp.dialog.Dialog; import pp.monopoly.client.MonopolyApp; +import pp.monopoly.model.fields.BuildingProperty; /** * SettingsMenu ist ein Overlay-Menü, das durch ESC aufgerufen werden kann. @@ -19,13 +20,18 @@ import pp.monopoly.client.MonopolyApp; public class BuyCard extends Dialog { private final MonopolyApp app; private final Geometry overlayBackground; - private final Container settingsContainer; + private final Container buyCardContainer; private final Container backgroundContainer; + private int index = 37; + public BuyCard(MonopolyApp app) { super(app.getDialogManager()); this.app = app; + //Generate the corresponfing field + BuildingProperty field = (BuildingProperty) app.getBoardManager().getFieldAtIndex(index); + // Halbtransparentes Overlay hinzufügen overlayBackground = createOverlayBackground(); app.getGuiNode().attachChild(overlayBackground); @@ -35,52 +41,55 @@ public class BuyCard extends Dialog { backgroundContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); // Darker background app.getGuiNode().attachChild(backgroundContainer); - // Hauptcontainer für das Menü - settingsContainer = new Container(); - settingsContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.1f, 0.1f, 0.1f, 0.9f))); + // Hauptcontainer für die Gebäudekarte + buyCardContainer = new Container(); + buyCardContainer.setBackground(new QuadBackgroundComponent(field.getColor().getColor())); - - // Titel - Label settingsTitle = settingsContainer.addChild(new Label("Gebäude 30", new ElementId("settings-title"))); //TODO Dynamische Gebäudezahl einfügen + Label settingsTitle = buyCardContainer.addChild(new Label( field.getName(), new ElementId("settings-title"))); settingsTitle.setFontSize(48); - int i = 0; - int a = 10; - int b = -45; - - // Effekt-Sound: Slider und Checkbox - Container propertyValuesContainer = settingsContainer.addChild(new Container()); - propertyValuesContainer.addChild(new Label("„Preis:" + i, new ElementId("label-Text")));//TODO Variable hier einsetzen - propertyValuesContainer.addChild(new Label("„Miete:" + a, new ElementId("label-Text")));//TODO Variable hier einsetzen - propertyValuesContainer.addChild(new Label("„Hypothek:" + b, new ElementId("label-Text")));//TODO Variable hier einsetzen + // Text, der auf der Karte steht + // Die Preise werden dynamisch dem BoardManager entnommen + Container propertyValuesContainer = buyCardContainer.addChild(new Container()); + propertyValuesContainer.addChild(new Label("„Grundstückswert: " + field.getPrice() + " EUR", new ElementId("label-Text"))); + propertyValuesContainer.addChild(new Label("", new ElementId("label-Text")));// Leerzeile + propertyValuesContainer.addChild(new Label("„Miete allein: " + field.getAllRent().get(0)+ " EUR", new ElementId("label-Text"))); + propertyValuesContainer.addChild(new Label("„-mit 1 Haus: " + field.getAllRent().get(1) + " EUR", new ElementId("label-Text"))); + propertyValuesContainer.addChild(new Label("„-mit 2 Häuser: " + field.getAllRent().get(2) + " EUR", new ElementId("label-Text"))); + propertyValuesContainer.addChild(new Label("„-mit 3 Häuser: " + field.getAllRent().get(3) + " EUR", new ElementId("label-Text"))); + propertyValuesContainer.addChild(new Label("„-mit 4 Häuser: " + field.getAllRent().get(4) + " EUR", new ElementId("label-Text"))); + propertyValuesContainer.addChild(new Label("„-mit 1 Hotel: " + field.getAllRent().get(5) + " EUR", new ElementId("label-Text"))); + propertyValuesContainer.addChild(new Label("„-1 Haus kostet: " + field.getHousePrice()+ " EUR", new ElementId("label-Text"))); + propertyValuesContainer.addChild(new Label("", new ElementId("label-Text")));// Leerzeile + propertyValuesContainer.addChild(new Label("„Hypothek: " + field.getHypo() + " EUR", new ElementId("label-Text"))); propertyValuesContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f))); // Beenden-Button - Button quitButton = settingsContainer.addChild(new Button("Beenden", new ElementId("button"))); + Button quitButton = buyCardContainer.addChild(new Button("Beenden", new ElementId("button"))); quitButton.setFontSize(32); // Kaufen-Button - Button buyButton = settingsContainer.addChild(new Button("Kaufen", new ElementId("button"))); + Button buyButton = buyCardContainer.addChild(new Button("Kaufen", new ElementId("button"))); buyButton.setFontSize(32); float padding = 10; // Padding around the settingsContainer for the background - backgroundContainer.setPreferredSize(settingsContainer.getPreferredSize().addLocal(padding, padding, 0)); + backgroundContainer.setPreferredSize(buyCardContainer.getPreferredSize().addLocal(padding, padding, 0)); // Zentriere das Menü - settingsContainer.setLocalTranslation( - (app.getCamera().getWidth() - settingsContainer.getPreferredSize().x) / 2, - (app.getCamera().getHeight() + settingsContainer.getPreferredSize().y) / 2, + buyCardContainer.setLocalTranslation( + (app.getCamera().getWidth() - buyCardContainer.getPreferredSize().x) / 2, + (app.getCamera().getHeight() + buyCardContainer.getPreferredSize().y) / 2, 8 ); backgroundContainer.setLocalTranslation( - (app.getCamera().getWidth() - settingsContainer.getPreferredSize().x - padding) / 2, - (app.getCamera().getHeight() + settingsContainer.getPreferredSize().y+ padding) / 2, + (app.getCamera().getWidth() - buyCardContainer.getPreferredSize().x - padding) / 2, + (app.getCamera().getHeight() + buyCardContainer.getPreferredSize().y+ padding) / 2, 7 ); - app.getGuiNode().attachChild(settingsContainer); + app.getGuiNode().attachChild(buyCardContainer); } /** @@ -105,13 +114,11 @@ public class BuyCard extends Dialog { @Override public void close() { System.out.println("Schließe SettingsMenu..."); // Debugging-Ausgabe - app.getGuiNode().detachChild(settingsContainer); // Entferne das Menü + app.getGuiNode().detachChild(buyCardContainer); // Entferne das Menü app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand app.getGuiNode().detachChild(overlayBackground); // Entferne das Overlay - // app.setSettingsMenuOpen(false); // Menü als geschlossen markieren - // app.unblockInputs(); // Eingaben wieder aktivieren + app.setSettingsMenuOpen(false); // Menü als geschlossen markieren TODO passt diese Variable noch (zu finden unter den Temps in MonopolyApp + app.unblockInputs(); // Eingaben wieder aktivieren System.out.println("SettingsMenu geschlossen."); // Debugging-Ausgabe } - - } diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/EventCard.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/EventCard.java new file mode 100644 index 0000000..2736b54 --- /dev/null +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/EventCard.java @@ -0,0 +1,118 @@ +package pp.monopoly.client.gui.popups; + +import com.jme3.material.Material; +import com.jme3.material.RenderState.BlendMode; +import com.jme3.math.ColorRGBA; +import com.jme3.scene.Geometry; +import com.jme3.scene.shape.Quad; +import com.simsilica.lemur.Button; +import com.simsilica.lemur.Container; +import com.simsilica.lemur.Label; +import com.simsilica.lemur.component.QuadBackgroundComponent; +import com.simsilica.lemur.style.ElementId; +import pp.dialog.Dialog; +import pp.monopoly.client.MonopolyApp; + +import pp.monopoly.model.card.Card; // TODO für den Import der Queue notwendig +/** + * SettingsMenu ist ein Overlay-Menü, das durch ESC aufgerufen werden kann. + */ +public class EventCard extends Dialog { + private final MonopolyApp app; + private final Geometry overlayBackground; + private final Container eventCardContainer; + private final Container backgroundContainer; + + + public EventCard(MonopolyApp app) { + super(app.getDialogManager()); + this.app = app; + + //Generate the corresponfing field + Card card = app.getDeckHelper().drawCard(); // TODO nimmt die Karten gerade unabhängig aus dem DeckHelper + + // Halbtransparentes Overlay hinzufügen + overlayBackground = createOverlayBackground(); + app.getGuiNode().attachChild(overlayBackground); + + // Create the background container + backgroundContainer = new Container(); + backgroundContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); // Darker background + app.getGuiNode().attachChild(backgroundContainer); + + // Hauptcontainer für die Gebäudekarte + eventCardContainer = new Container(); + eventCardContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); + + // Titel + // Die Namen werden dynamisch dem BoardManager entnommen + Label gateFieldTitle = eventCardContainer.addChild(new Label("Ereigniskarte", new ElementId("settings-title"))); + gateFieldTitle.setFontSize(48); + gateFieldTitle.setColor(ColorRGBA.Black); + + // Text, der auf der Karte steht + // Die Preise werden dynamisch dem BoardManager entnommen + Container propertyValuesContainer = eventCardContainer.addChild(new Container()); + propertyValuesContainer.addChild(new Label(card.getDescription(), new ElementId("label-Text"))); + propertyValuesContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f))); + + // Beenden-Button + Button quitButton = eventCardContainer.addChild(new Button("Jawohl", new ElementId("button"))); + quitButton.setFontSize(32); + quitButton.addClickCommands(source -> close()); + + + // TODO Kaufen-Button wird nicht mehr benötigt, prüfen ob weg kann + //Button buyButton = buyCardContainer.addChild(new Button("Kaufen", new ElementId("button"))); + //buyButton.setFontSize(32); + + float padding = 10; // Padding around the settingsContainer for the background + backgroundContainer.setPreferredSize(eventCardContainer.getPreferredSize().addLocal(padding, padding, 0)); + + + // Zentriere das Menü + eventCardContainer.setLocalTranslation( + (app.getCamera().getWidth() - eventCardContainer.getPreferredSize().x) / 2, + (app.getCamera().getHeight() + eventCardContainer.getPreferredSize().y) / 2, + 8 + ); + + backgroundContainer.setLocalTranslation( + (app.getCamera().getWidth() - eventCardContainer.getPreferredSize().x - padding) / 2, + (app.getCamera().getHeight() + eventCardContainer.getPreferredSize().y+ padding) / 2, + 7 + ); + + app.getGuiNode().attachChild(eventCardContainer); + } + + /** + * Erstellt einen halbtransparenten Hintergrund für das Menü. + * + * @return Geometrie des Overlays + */ + private Geometry createOverlayBackground() { + Quad quad = new Quad(app.getCamera().getWidth(), app.getCamera().getHeight()); + Geometry overlay = new Geometry("Overlay", quad); + Material material = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md"); + material.setColor("Color", new ColorRGBA(0, 0, 0, 0.5f)); // Halbtransparent + material.getAdditionalRenderState().setBlendMode(BlendMode.Alpha); + overlay.setMaterial(material); + overlay.setLocalTranslation(0, 0, 0); + return overlay; + } + + /** + * Schließt das Menü und entfernt die GUI-Elemente. + */ + @Override + public void close() { + System.out.println("Schließe SettingsMenu..."); // Debugging-Ausgabe + app.getGuiNode().detachChild(eventCardContainer); // Entferne das Menü + app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand + app.getGuiNode().detachChild(overlayBackground); // Entferne das Overlay + app.setBuyCardPopupOpen(false); // Menü als geschlossen markieren TODO passt diese Variable noch (zu finden unter den Temps in MonopolyApp + app.unblockInputs(); // Eingaben wieder aktivieren + System.out.println("SettingsMenu geschlossen."); // Debugging-Ausgabe + } +} \ No newline at end of file diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/FoodFieldCard.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/FoodFieldCard.java index 723e220..8b55a4d 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/FoodFieldCard.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/FoodFieldCard.java @@ -124,8 +124,8 @@ public class FoodFieldCard extends Dialog { app.getGuiNode().detachChild(foodFieldContainer); // Entferne das Menü app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand app.getGuiNode().detachChild(overlayBackground); // Entferne das Overlay - // app.setSettingsMenuOpen(false); // Menü als geschlossen markieren - // app.unblockInputs(); // Eingaben wieder aktivieren + app.setSettingsMenuOpen(false); // Menü als geschlossen markieren TODO passt diese Variable noch (zu finden unter den Temps in MonopolyApp + app.unblockInputs(); // Eingaben wieder aktivieren System.out.println("SettingsMenu geschlossen."); // Debugging-Ausgabe } diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/GateFieldCard.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/GateFieldCard.java index 4a9597a..a736662 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/GateFieldCard.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/GateFieldCard.java @@ -45,9 +45,9 @@ public class GateFieldCard extends Dialog { // Titel // Die Namen werden dynamisch dem BoardManager entnommen - Label settingsTitle = gateFieldContainer.addChild(new Label(field.getName(), new ElementId("settings-title"))); - settingsTitle.setFontSize(48); - settingsTitle.setColor(ColorRGBA.Black); + Label gateFieldTitle = gateFieldContainer.addChild(new Label(field.getName(), new ElementId("settings-title"))); + gateFieldTitle.setFontSize(48); + gateFieldTitle.setColor(ColorRGBA.Black); // Text, der auf der Karte steht // Die Preise werden dynamisch dem BoardManager entnommen @@ -118,8 +118,8 @@ public class GateFieldCard extends Dialog { app.getGuiNode().detachChild(gateFieldContainer); // Entferne das Menü app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand app.getGuiNode().detachChild(overlayBackground); // Entferne das Overlay - // app.setSettingsMenuOpen(false); // Menü als geschlossen markieren - // app.unblockInputs(); // Eingaben wieder aktivieren + app.setSettingsMenuOpen(false); // Menü als geschlossen markieren TODO passt diese Variable noch (zu finden unter den Temps in MonopolyApp + app.unblockInputs(); // Eingaben wieder aktivieren System.out.println("SettingsMenu geschlossen."); // Debugging-Ausgabe } diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/LoserPopUp.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/LoserPopUp.java new file mode 100644 index 0000000..7b7ea90 --- /dev/null +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/LoserPopUp.java @@ -0,0 +1,55 @@ +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); + + } +} + diff --git a/Projekte/monopoly/client/src/main/resources/Pictures/MonopolyLoser.png b/Projekte/monopoly/client/src/main/resources/Pictures/MonopolyLoser.png new file mode 100644 index 0000000..2de2fa1 Binary files /dev/null and b/Projekte/monopoly/client/src/main/resources/Pictures/MonopolyLoser.png differ diff --git a/Projekte/monopoly/client/src/main/resources/Pictures/dice/five.png b/Projekte/monopoly/client/src/main/resources/Pictures/dice/five.png new file mode 100644 index 0000000..92a4500 Binary files /dev/null and b/Projekte/monopoly/client/src/main/resources/Pictures/dice/five.png differ diff --git a/Projekte/monopoly/client/src/main/resources/Pictures/dice/four.png b/Projekte/monopoly/client/src/main/resources/Pictures/dice/four.png new file mode 100644 index 0000000..c5510c0 Binary files /dev/null and b/Projekte/monopoly/client/src/main/resources/Pictures/dice/four.png differ diff --git a/Projekte/monopoly/client/src/main/resources/Pictures/dice/one.png b/Projekte/monopoly/client/src/main/resources/Pictures/dice/one.png new file mode 100644 index 0000000..1fe1cd7 Binary files /dev/null and b/Projekte/monopoly/client/src/main/resources/Pictures/dice/one.png differ diff --git a/Projekte/monopoly/client/src/main/resources/Pictures/dice/six.png b/Projekte/monopoly/client/src/main/resources/Pictures/dice/six.png new file mode 100644 index 0000000..a71e581 Binary files /dev/null and b/Projekte/monopoly/client/src/main/resources/Pictures/dice/six.png differ diff --git a/Projekte/monopoly/client/src/main/resources/Pictures/dice/three.png b/Projekte/monopoly/client/src/main/resources/Pictures/dice/three.png new file mode 100644 index 0000000..40ea246 Binary files /dev/null and b/Projekte/monopoly/client/src/main/resources/Pictures/dice/three.png differ diff --git a/Projekte/monopoly/client/src/main/resources/Pictures/dice/two.png b/Projekte/monopoly/client/src/main/resources/Pictures/dice/two.png new file mode 100644 index 0000000..7b6b9b5 Binary files /dev/null and b/Projekte/monopoly/client/src/main/resources/Pictures/dice/two.png differ diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/ClientGameLogic.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/ClientGameLogic.java index 3260474..4467043 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/ClientGameLogic.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/ClientGameLogic.java @@ -226,7 +226,7 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker { @Override public void received(EventDrawCard msg) { setInfoText("Event card drawn: " + msg.getCardDescription()); - //event card logic + // Kartenlogik playSound(Sound.EVENT_CARD); } diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/Player.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/Player.java index 6040fb4..8e41fda 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/Player.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/Player.java @@ -95,7 +95,7 @@ public class Player implements FieldVisitor{ * Set the name of the Player * @param name the new name */ - void setName(String name) { + public void setName(String name) { this.name = name; } @@ -179,6 +179,7 @@ public class Player implements FieldVisitor{ public void buyProperty(PropertyField property) { if (property.getOwner() == null && accountBalance >= property.getPrice()) { properties.add(property); + property.setOwner(this); pay(property.getPrice()); } } diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/PlayerHandler.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/PlayerHandler.java index fc97a65..aebe09c 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/PlayerHandler.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/PlayerHandler.java @@ -165,7 +165,7 @@ public class PlayerHandler { * @param id the id to be searched for * @return the player with the required id */ - Player getPlayerById(int id) { + public Player getPlayerById(int id) { for (Player player : players) { if (player.getId() == id) return player; } @@ -184,7 +184,7 @@ public class PlayerHandler { players.get(0).setActive(); } - void setStartBalance(int amount) { + public void setStartBalance(int amount) { for (Player player : players) { player.setAccountBalance(amount); } diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/card/Card.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/card/Card.java index 8a25f5e..fb1e615 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/card/Card.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/card/Card.java @@ -15,9 +15,9 @@ public class Card { visitor.visit(this, player); } - String getDescription() { + public String getDescription() { return description; - } + } // TODO wird gerade in der EventCard zur erstellung des Popup genutzt String getKeyword() { return keyword;