From 1a41b548c4e1a42209f7a6d75bfc626890f1da5b Mon Sep 17 00:00:00 2001 From: Luca Puderbach Date: Mon, 2 Dec 2024 05:43:20 +0100 Subject: [PATCH 1/3] Figuren Drehung --- .../main/java/pp/monopoly/client/gui/TestWorld.java | 13 +++++++++++++ 1 file changed, 13 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 eabb48b..fea1a9a 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 @@ -134,6 +134,7 @@ public class TestWorld implements GameEventListener { private com.jme3.math.Quaternion calculateRotationForField(int fieldID) { com.jme3.math.Quaternion rotation = new com.jme3.math.Quaternion(); + // Berechne die Rotation basierend auf der Feld-ID if (fieldID >= 0 && fieldID <= 9) { // Untere Seite (0-9) rotation.fromAngleAxis(0, Vector3f.UNIT_Y); // Richtung: nach oben @@ -148,6 +149,18 @@ public class TestWorld implements GameEventListener { rotation.fromAngleAxis(3 * FastMath.HALF_PI, Vector3f.UNIT_Y); // Richtung: nach rechts } + // Korrigiere die Richtung für die Quadranten 10–19 und 30–39 (gegenüberliegende Richtung) + if ((fieldID >= 10 && fieldID <= 19) || (fieldID >= 30 && fieldID <= 39)) { + com.jme3.math.Quaternion oppositeDirection = new com.jme3.math.Quaternion(); + oppositeDirection.fromAngleAxis(FastMath.PI, Vector3f.UNIT_Y); // 180° drehen + rotation = rotation.multLocal(oppositeDirection); + } + + // Füge zusätzliche 90° nach links hinzu + com.jme3.math.Quaternion leftTurn = new com.jme3.math.Quaternion(); + leftTurn.fromAngleAxis(FastMath.HALF_PI, Vector3f.UNIT_Y); // 90° nach links + rotation = rotation.multLocal(leftTurn); + return rotation; } From db7a99dc5955d66e279f6c6799d0eaeba1d1584e Mon Sep 17 00:00:00 2001 From: Johannes Schmelz Date: Mon, 2 Dec 2024 05:43:49 +0100 Subject: [PATCH 2/3] fixed Top Dialog --- .../monopoly/client/gui/popups/BuildingPropertyCard.java | 8 ++++---- .../pp/monopoly/client/gui/popups/EventCardPopup.java | 6 +++++- .../java/pp/monopoly/client/gui/popups/FoodFieldCard.java | 8 ++++---- .../java/pp/monopoly/client/gui/popups/GateFieldCard.java | 8 ++++---- 4 files changed, 17 insertions(+), 13 deletions(-) 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 03bdb18..19b5344 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 @@ -67,19 +67,19 @@ public class BuildingPropertyCard extends Dialog { // Beenden-Button Button quitButton = buildingPropertyContainer.addChild(new Button("Beenden", new ElementId("button"))); quitButton.setFontSize(32); - quitButton.addClickCommands(s -> ifTopDialog(() -> { + quitButton.addClickCommands(s -> { System.err.println("Button does something?"); app.getGameLogic().playSound(Sound.BUTTON); close(); - })); + }); // Kaufen-Button Button buyButton = buildingPropertyContainer.addChild(new Button("Kaufen", new ElementId("button"))); buyButton.setFontSize(32); - buyButton.addClickCommands(s -> ifTopDialog( () -> { + buyButton.addClickCommands(s -> { app.getGameLogic().playSound(Sound.BUTTON); close(); app.getGameLogic().send(new BuyPropertyResponse()); - })); + }); // Zentriere das Popup buildingPropertyContainer.setLocalTranslation( diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/EventCardPopup.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/EventCardPopup.java index e42371c..976ace9 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/EventCardPopup.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/EventCardPopup.java @@ -13,6 +13,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.notification.Sound; /** * EventCardPopup is a popup which appears when a certain EventCard is triggered by entering a EventCardField @@ -62,7 +63,10 @@ public class EventCardPopup extends Dialog { // Beenden-Button Button quitButton = eventCardContainer.addChild(new Button("Jawohl", new ElementId("button"))); quitButton.setFontSize(32); - quitButton.addClickCommands(source -> close()); + quitButton.addClickCommands(source -> { + app.getGameLogic().playSound(Sound.BUTTON); + close(); + }); // Zentriere das Popup eventCardContainer.setLocalTranslation( 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 e0146c4..60681b7 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 @@ -77,18 +77,18 @@ public class FoodFieldCard extends Dialog { // Beenden-Button Button quitButton = foodFieldContainer.addChild(new Button("Beenden", new ElementId("button"))); quitButton.setFontSize(32); - quitButton.addClickCommands(s -> ifTopDialog(() -> { + quitButton.addClickCommands(s -> { app.getGameLogic().playSound(Sound.BUTTON); close(); - })); + }); // Kaufen-Button Button buyButton = foodFieldContainer.addChild(new Button("Kaufen", new ElementId("button"))); buyButton.setFontSize(32); - buyButton.addClickCommands(s -> ifTopDialog( () -> { + buyButton.addClickCommands(s -> { app.getGameLogic().playSound(Sound.BUTTON); app.getGameLogic().send(new BuyPropertyResponse()); close(); - })); + }); // Zentriere das Popup foodFieldContainer.setLocalTranslation( 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 cb81049..5c591d6 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 @@ -69,18 +69,18 @@ public class GateFieldCard extends Dialog { // Beenden-Button Button quitButton = gateFieldContainer.addChild(new Button("Beenden", new ElementId("button"))); quitButton.setFontSize(32); - quitButton.addClickCommands(s -> ifTopDialog(() -> { + quitButton.addClickCommands(s -> { app.getGameLogic().playSound(Sound.BUTTON); close(); - })); + }); // Kaufen-Button Button buyButton = gateFieldContainer.addChild(new Button("Kaufen", new ElementId("button"))); buyButton.setFontSize(32); - buyButton.addClickCommands(s -> ifTopDialog(() -> { + buyButton.addClickCommands(s -> { app.getGameLogic().playSound(Sound.BUTTON); app.getGameLogic().send(new BuyPropertyResponse()); close(); - })); + }); // Zentriere das Popup gateFieldContainer.setLocalTranslation( From 486c0a9810d57682b2fd782aacb0fc987a01d70f Mon Sep 17 00:00:00 2001 From: Johannes Schmelz Date: Mon, 2 Dec 2024 05:54:15 +0100 Subject: [PATCH 3/3] TopDialog --- .../client/gui/popups/BuildingPropertyCard.java | 8 ++++---- .../monopoly/client/gui/popups/EventCardPopup.java | 4 ++-- .../monopoly/client/gui/popups/FoodFieldCard.java | 8 ++++---- .../monopoly/client/gui/popups/GateFieldCard.java | 8 ++++---- .../java/pp/monopoly/client/gui/popups/Gulag.java | 13 +++++-------- 5 files changed, 19 insertions(+), 22 deletions(-) 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 19b5344..b78e7eb 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 @@ -67,19 +67,19 @@ public class BuildingPropertyCard extends Dialog { // Beenden-Button Button quitButton = buildingPropertyContainer.addChild(new Button("Beenden", new ElementId("button"))); quitButton.setFontSize(32); - quitButton.addClickCommands(s -> { + quitButton.addClickCommands(s -> ifTopDialog( () -> { System.err.println("Button does something?"); app.getGameLogic().playSound(Sound.BUTTON); close(); - }); + })); // Kaufen-Button Button buyButton = buildingPropertyContainer.addChild(new Button("Kaufen", new ElementId("button"))); buyButton.setFontSize(32); - buyButton.addClickCommands(s -> { + buyButton.addClickCommands(s -> ifTopDialog( () -> { app.getGameLogic().playSound(Sound.BUTTON); close(); app.getGameLogic().send(new BuyPropertyResponse()); - }); + })); // Zentriere das Popup buildingPropertyContainer.setLocalTranslation( diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/EventCardPopup.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/EventCardPopup.java index 976ace9..e02413b 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/EventCardPopup.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/EventCardPopup.java @@ -63,10 +63,10 @@ public class EventCardPopup extends Dialog { // Beenden-Button Button quitButton = eventCardContainer.addChild(new Button("Jawohl", new ElementId("button"))); quitButton.setFontSize(32); - quitButton.addClickCommands(source -> { + quitButton.addClickCommands(source -> ifTopDialog( () -> { app.getGameLogic().playSound(Sound.BUTTON); close(); - }); + })); // Zentriere das Popup eventCardContainer.setLocalTranslation( 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 60681b7..79a54a1 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 @@ -77,18 +77,18 @@ public class FoodFieldCard extends Dialog { // Beenden-Button Button quitButton = foodFieldContainer.addChild(new Button("Beenden", new ElementId("button"))); quitButton.setFontSize(32); - quitButton.addClickCommands(s -> { + quitButton.addClickCommands(s -> ifTopDialog( () -> { app.getGameLogic().playSound(Sound.BUTTON); close(); - }); + })); // Kaufen-Button Button buyButton = foodFieldContainer.addChild(new Button("Kaufen", new ElementId("button"))); buyButton.setFontSize(32); - buyButton.addClickCommands(s -> { + buyButton.addClickCommands(s -> ifTopDialog( () -> { app.getGameLogic().playSound(Sound.BUTTON); app.getGameLogic().send(new BuyPropertyResponse()); close(); - }); + })); // Zentriere das Popup foodFieldContainer.setLocalTranslation( 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 5c591d6..fa6674c 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 @@ -69,18 +69,18 @@ public class GateFieldCard extends Dialog { // Beenden-Button Button quitButton = gateFieldContainer.addChild(new Button("Beenden", new ElementId("button"))); quitButton.setFontSize(32); - quitButton.addClickCommands(s -> { + quitButton.addClickCommands(s -> ifTopDialog( () -> { app.getGameLogic().playSound(Sound.BUTTON); close(); - }); + })); // Kaufen-Button Button buyButton = gateFieldContainer.addChild(new Button("Kaufen", new ElementId("button"))); buyButton.setFontSize(32); - buyButton.addClickCommands(s -> { + buyButton.addClickCommands(s -> ifTopDialog( () -> { app.getGameLogic().playSound(Sound.BUTTON); app.getGameLogic().send(new BuyPropertyResponse()); close(); - }); + })); // Zentriere das Popup gateFieldContainer.setLocalTranslation( diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/Gulag.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/Gulag.java index 8d28032..3d5e3dc 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/Gulag.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/Gulag.java @@ -13,6 +13,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.notification.Sound; /** * Gulag is a warning popup that is triggered when a certain player enters the "Wache" field @@ -54,17 +55,13 @@ public class Gulag extends Dialog { gateFieldTitle.setFontSize(48); gateFieldTitle.setColor(ColorRGBA.Black); - // Text, der auf der Karte steht - /* Container textContainer = gulagContainer.addChild(new Container()); - textContainer.addChild(new Label("Du hast die Verbindung verloren und kannst nichts dagegen machen. Akzeptiere einfach, dass du verloren hast!", new ElementId("label-Text"))); - textContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f))); - textContainer.setPreferredSize(gulagContainer.getPreferredSize().addLocal(-250,-200,0)); - */ - // Beenden-Button Button quitButton = gulagContainer.addChild(new Button("Jawohl Gulag", new ElementId("button"))); quitButton.setFontSize(32); - quitButton.addClickCommands(source -> close()); + quitButton.addClickCommands(source -> ifTopDialog(() -> { + app.getGameLogic().playSound(Sound.BUTTON); + close(); + })); // Zentriere das Popup