From f220aeb78c9135043b0f0dee0d44f2692a888096 Mon Sep 17 00:00:00 2001 From: Johannes Schmelz Date: Sun, 1 Dec 2024 21:42:05 +0100 Subject: [PATCH 1/2] resolve merge --- .../client/src/main/java/pp/monopoly/client/gui/TestWorld.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/TestWorld.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/TestWorld.java index 10e3eb1..8e2ef9c 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/TestWorld.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/TestWorld.java @@ -17,7 +17,9 @@ import pp.monopoly.client.gui.popups.ConfirmTrade; import pp.monopoly.client.gui.popups.EventCardPopup; import pp.monopoly.client.gui.popups.FoodFieldCard; import pp.monopoly.client.gui.popups.GateFieldCard; +import pp.monopoly.client.gui.popups.Gulag; import pp.monopoly.client.gui.popups.LooserPopUp; +import pp.monopoly.client.gui.popups.NoMoneyWarning; import pp.monopoly.client.gui.popups.TimeOut; import pp.monopoly.client.gui.popups.WinnerPopUp; import pp.monopoly.game.server.Player; From a24d6fd4b60b47bbbdedae9d52431a844f53d9f7 Mon Sep 17 00:00:00 2001 From: Simon Wilkening Date: Sun, 1 Dec 2024 21:44:14 +0100 Subject: [PATCH 2/2] BuildingFields corrected --- .../java/pp/monopoly/client/MonopolyApp.java | 2 +- .../client/gui/popups/ConfirmTrade.java | 2 +- .../monopoly/client/gui/popups/GulagInfo.java | 119 ++++++++++++++++++ 3 files changed, 121 insertions(+), 2 deletions(-) create mode 100644 Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/GulagInfo.java diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/MonopolyApp.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/MonopolyApp.java index f413454..aa6efba 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/MonopolyApp.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/MonopolyApp.java @@ -279,7 +279,7 @@ 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 handleB(boolean isPressed) { if (isPressed) { - Dialog tmp = new Gulag(this); + Dialog tmp = new GulagInfo(this); tmp.open(); } } diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/ConfirmTrade.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/ConfirmTrade.java index 1dc284b..669791e 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/ConfirmTrade.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/ConfirmTrade.java @@ -43,7 +43,7 @@ public class ConfirmTrade extends Dialog { backgroundContainer.setPreferredSize(confirmTradeContainer.getPreferredSize().addLocal(padding, padding, 0)); // Titel - Label title = confirmTradeContainer.addChild(new Label( "Handel", new ElementId("label-Bold"))); + Label title = confirmTradeContainer.addChild(new Label( "Handel", new ElementId("warning-title"))); title.setFontSize(48); title.setColor(ColorRGBA.Black); diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/GulagInfo.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/GulagInfo.java new file mode 100644 index 0000000..19c7e69 --- /dev/null +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/GulagInfo.java @@ -0,0 +1,119 @@ +package pp.monopoly.client.gui.popups; + +import com.jme3.math.ColorRGBA; +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.client.gui.SettingsMenu; +import pp.monopoly.client.gui.TradeMenu; +import pp.monopoly.message.client.TradeResponse; +import pp.monopoly.model.TradeHandler; +import pp.monopoly.model.fields.PropertyField; +import pp.monopoly.notification.Sound; + +/** + * ConfirmTrade is a popup which appears when a trade is proposed to this certain player. + */ +public class GulagInfo extends Dialog { + private final MonopolyApp app; + private final Container confirmTradeContainer; + private final Container backgroundContainer; + + + public GulagInfo(MonopolyApp app) { + super(app.getDialogManager()); + this.app = app; + + // Create the background container + backgroundContainer = new Container(); + backgroundContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); // Darker background + attachChild(backgroundContainer); + + // Hauptcontainer für das Bestätigungspopup + confirmTradeContainer = new Container(); + + float padding = 10; // Passt den backgroundContainer an die Größe des confirmTradeContainer an + backgroundContainer.setPreferredSize(confirmTradeContainer.getPreferredSize().addLocal(padding, padding, 0)); + + // Titel + Label title = confirmTradeContainer.addChild(new Label( "Gulag", new ElementId("warning-title"))); + title.setFontSize(48); + title.setColor(ColorRGBA.Black); + + // Text, der auf der Karte steht + // Die Werte werden dem Handel entnommen (Iwas auch immer da dann ist) + Container propertyValuesContainer = confirmTradeContainer.addChild(new Container()); + propertyValuesContainer.addChild(new Label("„Du sitzt im Gefänginis und kommst nicht raus ...", new ElementId("label-Text"))); + propertyValuesContainer.addChild(new Label("Es sei denn, du ...", new ElementId("label-Text")));// Leerzeile + propertyValuesContainer.addChild(new Label("", new ElementId("label-Text"))); + propertyValuesContainer.addChild(new Label("- bestichst die Wache mit 500 EUR", new ElementId("label-Text"))); + propertyValuesContainer.addChild(new Label("- löst eine Gulag-Frei-Karte ein", new ElementId("label-Text"))); + propertyValuesContainer.addChild(new Label("- wartest 3 Runden und bezahlst dann", new ElementId("label-Text")));// Leerzeile + propertyValuesContainer.addChild(new Label("- oder du würfelst einen Pasch", new ElementId("label-Text"))); + /*propertyValuesContainer.addChild(new Label("", new ElementId("label-Text")));// Leerzeile + propertyValuesContainer.addChild(new Label("- ", new ElementId("label-Text"))); + propertyValuesContainer.addChild(new Label("- EUR", new ElementId("label-Text"))); + propertyValuesContainer.addChild(new Label("- Sonderkaten", new ElementId("label-Text"))); + propertyValuesContainer.addChild(new Label("", new ElementId("label-Text")));// Leerzeile + propertyValuesContainer.addChild(new Label("tauschen, willst du das Angebot annehmen?", new ElementId("label-Text")));*/ + propertyValuesContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f))); + + + // Bezahlen-Button + Button negotiateButton = confirmTradeContainer.addChild(new Button("Bestechungsgeld bezahlen", new ElementId("button"))); + negotiateButton.setFontSize(32); + negotiateButton.addClickCommands(s -> ifTopDialog( () -> { + app.getGameLogic().playSound(Sound.BUTTON); + close(); + })); + // Ereigniskarte-Button + Button confirmButton = confirmTradeContainer.addChild(new Button("Ereigniskarte nutzen", new ElementId("button"))); + confirmButton.setFontSize(32); + confirmButton.addClickCommands(s -> ifTopDialog( () -> { + app.getGameLogic().playSound(Sound.BUTTON); + close(); + })); + // Schließen-Button + Button declineButton = confirmTradeContainer.addChild(new Button("Schließen", new ElementId("button"))); + declineButton.setFontSize(32); + declineButton.addClickCommands(s -> ifTopDialog(() -> { + app.getGameLogic().playSound(Sound.BUTTON); + close(); + })); + + // Zentriere das Menü + confirmTradeContainer.setLocalTranslation( + (app.getCamera().getWidth() - confirmTradeContainer.getPreferredSize().x) / 2, + (app.getCamera().getHeight() + confirmTradeContainer.getPreferredSize().y) / 2, + 8 + ); + + // Zentriere das Menü + backgroundContainer.setLocalTranslation( + (app.getCamera().getWidth() - confirmTradeContainer.getPreferredSize().x - padding) / 2, + (app.getCamera().getHeight() + confirmTradeContainer.getPreferredSize().y+ padding) / 2, + 7 + ); + + app.getGuiNode().attachChild(confirmTradeContainer); + } + + /** + * Schließt das Menü und entfernt die GUI-Elemente. + */ + @Override + public void close() { + app.getGuiNode().detachChild(confirmTradeContainer); // Entferne das Menü + app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand + super.close(); + } + + @Override + public void escape() { + new SettingsMenu(app).open(); + } +}