From 2d9cd0e4e177b9bcd97664a21ac4fc2ba339bdbf Mon Sep 17 00:00:00 2001 From: Johannes Schmelz Date: Fri, 29 Nov 2024 06:17:57 +0100 Subject: [PATCH 1/5] resolve merge conflict --- .../main/java/pp/monopoly/client/gui/TestWorld.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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 f55d672..04bdc2a 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 @@ -4,13 +4,14 @@ import java.util.List; import pp.monopoly.client.MonopolyApp; import pp.monopoly.client.gui.popups.BuyCard; +import pp.monopoly.client.gui.popups.EventCard; import pp.monopoly.client.gui.popups.FoodFieldCard; import pp.monopoly.client.gui.popups.GateFieldCard; import pp.monopoly.game.server.Player; import pp.monopoly.model.fields.BuildingProperty; import pp.monopoly.model.fields.FoodField; import pp.monopoly.model.fields.GateField; - +import pp.monopoly.notification.EventCardEvent; import pp.monopoly.notification.GameEventListener; import pp.monopoly.notification.PopUpEvent; @@ -33,7 +34,7 @@ public class TestWorld implements GameEventListener{ public TestWorld(MonopolyApp app, List players) { this.app = app; this.players = players; - app.getGameLogic().removeListener(this); + app.getGameLogic().addListener(this); } /** @@ -141,8 +142,10 @@ public class TestWorld implements GameEventListener{ } else if (fieldObject instanceof FoodField) { new FoodFieldCard(app).open(); } - - - + } + + @Override + public void receivedEvent(EventCardEvent event) { + new EventCard(app, event.description()).open(); } } From 782b1a10c38c3153e9f461ecc527a85e9e567615 Mon Sep 17 00:00:00 2001 From: Luca Puderbach Date: Fri, 29 Nov 2024 06:19:58 +0100 Subject: [PATCH 2/5] Kleine model Changes --- .../{Holster => Handyholster}/Handyholster.j3o | Bin .../black-leather_albedo.png | Bin .../Atlas_baseColor.png | Bin .../Atlas_metallicRoughness.png | Bin .../Atlas_normal.jpeg | Bin .../Atlas_transmission.png | Bin .../Jagermeister.j3o | Bin 7 files changed, 0 insertions(+), 0 deletions(-) rename Projekte/monopoly/client/src/main/resources/models/{Holster => Handyholster}/Handyholster.j3o (100%) rename Projekte/monopoly/client/src/main/resources/models/{Holster => Handyholster}/black-leather_albedo.png (100%) rename Projekte/monopoly/client/src/main/resources/models/{Jaegermeister => Jägermeister}/Atlas_baseColor.png (100%) rename Projekte/monopoly/client/src/main/resources/models/{Jaegermeister => Jägermeister}/Atlas_metallicRoughness.png (100%) rename Projekte/monopoly/client/src/main/resources/models/{Jaegermeister => Jägermeister}/Atlas_normal.jpeg (100%) rename Projekte/monopoly/client/src/main/resources/models/{Jaegermeister => Jägermeister}/Atlas_transmission.png (100%) rename Projekte/monopoly/client/src/main/resources/models/{Jaegermeister => Jägermeister}/Jagermeister.j3o (100%) diff --git a/Projekte/monopoly/client/src/main/resources/models/Holster/Handyholster.j3o b/Projekte/monopoly/client/src/main/resources/models/Handyholster/Handyholster.j3o similarity index 100% rename from Projekte/monopoly/client/src/main/resources/models/Holster/Handyholster.j3o rename to Projekte/monopoly/client/src/main/resources/models/Handyholster/Handyholster.j3o diff --git a/Projekte/monopoly/client/src/main/resources/models/Holster/black-leather_albedo.png b/Projekte/monopoly/client/src/main/resources/models/Handyholster/black-leather_albedo.png similarity index 100% rename from Projekte/monopoly/client/src/main/resources/models/Holster/black-leather_albedo.png rename to Projekte/monopoly/client/src/main/resources/models/Handyholster/black-leather_albedo.png diff --git a/Projekte/monopoly/client/src/main/resources/models/Jaegermeister/Atlas_baseColor.png b/Projekte/monopoly/client/src/main/resources/models/Jägermeister/Atlas_baseColor.png similarity index 100% rename from Projekte/monopoly/client/src/main/resources/models/Jaegermeister/Atlas_baseColor.png rename to Projekte/monopoly/client/src/main/resources/models/Jägermeister/Atlas_baseColor.png diff --git a/Projekte/monopoly/client/src/main/resources/models/Jaegermeister/Atlas_metallicRoughness.png b/Projekte/monopoly/client/src/main/resources/models/Jägermeister/Atlas_metallicRoughness.png similarity index 100% rename from Projekte/monopoly/client/src/main/resources/models/Jaegermeister/Atlas_metallicRoughness.png rename to Projekte/monopoly/client/src/main/resources/models/Jägermeister/Atlas_metallicRoughness.png diff --git a/Projekte/monopoly/client/src/main/resources/models/Jaegermeister/Atlas_normal.jpeg b/Projekte/monopoly/client/src/main/resources/models/Jägermeister/Atlas_normal.jpeg similarity index 100% rename from Projekte/monopoly/client/src/main/resources/models/Jaegermeister/Atlas_normal.jpeg rename to Projekte/monopoly/client/src/main/resources/models/Jägermeister/Atlas_normal.jpeg diff --git a/Projekte/monopoly/client/src/main/resources/models/Jaegermeister/Atlas_transmission.png b/Projekte/monopoly/client/src/main/resources/models/Jägermeister/Atlas_transmission.png similarity index 100% rename from Projekte/monopoly/client/src/main/resources/models/Jaegermeister/Atlas_transmission.png rename to Projekte/monopoly/client/src/main/resources/models/Jägermeister/Atlas_transmission.png diff --git a/Projekte/monopoly/client/src/main/resources/models/Jaegermeister/Jagermeister.j3o b/Projekte/monopoly/client/src/main/resources/models/Jägermeister/Jagermeister.j3o similarity index 100% rename from Projekte/monopoly/client/src/main/resources/models/Jaegermeister/Jagermeister.j3o rename to Projekte/monopoly/client/src/main/resources/models/Jägermeister/Jagermeister.j3o From f4cddbc87fac01ce0aac9a2cd388da7df6d0ee43 Mon Sep 17 00:00:00 2001 From: Simon Wilkening Date: Fri, 29 Nov 2024 06:20:23 +0100 Subject: [PATCH 3/5] Bankrott-Warnung und Timeout-Warning kommentiert und richtig benannt --- .../monopoly/client/gui/popups/Bankrupt.java | 27 +++++++++---------- .../monopoly/client/gui/popups/TimeOut.java | 20 +++++++------- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/Bankrupt.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/Bankrupt.java index 28f1b24..5ad93d1 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/Bankrupt.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/Bankrupt.java @@ -15,7 +15,7 @@ import pp.dialog.Dialog; import pp.monopoly.client.MonopolyApp; /** - * Bankrupt ist ein Overlay-Menü, welches aufgerufen werden kann, wenn man mit einem negativen Kontostand den Zug beenden möchte. // TODO welche menü-Klasse + * Bankrupt is a Warning-Popup, which appears, if the balance is negative at the end of a player´s turn // TODO welche menü-Klasse */ public class Bankrupt extends Dialog { private final MonopolyApp app; @@ -40,26 +40,26 @@ public class Bankrupt extends Dialog { app.getGuiNode().attachChild(backgroundContainer); - // Hauptcontainer für die Gebäudekarte + // Hauptcontainer für die Warnung bankruptContainer = new Container(); bankruptContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); bankruptContainer.setPreferredSize(new Vector3f(550,250,10)); - float padding = 10; // Padding around the settingsContainer for the background + float padding = 10; // Passt den backgroundContainer an die Größe des bankruptContainers an backgroundContainer.setPreferredSize(bankruptContainer.getPreferredSize().addLocal(padding, padding, 0)); // Titel - // Die Namen werden dynamisch dem BoardManager entnommen Label gateFieldTitle = bankruptContainer.addChild(new Label("Vorsicht !", new ElementId("settings-title"))); //TODO Dicke Schrift gateFieldTitle.setFontSize(48); gateFieldTitle.setColor(ColorRGBA.Black); - // Text, der auf der Karte steht - // Die Preise werden dynamisch dem BoardManager entnommen - Container Container = bankruptContainer.addChild(new Container()); - Container.addChild(new Label("Du hast noch einen negativen Kontostand. Wenn du jetzt deinen Zug beendest, gehst du Bankrott und verlierst das Spiel!", new ElementId("label-Text"))); - Container.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f))); - Container.setPreferredSize(bankruptContainer.getPreferredSize().addLocal(-250,-200,0)); + // Text, der im Popup steht + Container textContainer = bankruptContainer.addChild(new Container()); + textContainer.addChild(new Label("Du hast noch einen negativen Kontostand. Wenn du jetzt deinen Zug beendest, gehst du Bankrott und verlierst das Spiel!", new ElementId("label-Text"))); + textContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f))); + + // Passt den textContainer an die Größe des bankruptContainers an + textContainer.setPreferredSize(bankruptContainer.getPreferredSize().addLocal(-250,-200,0)); // Beenden-Button Button quitButton = bankruptContainer.addChild(new Button("Bestätigen", new ElementId("button"))); @@ -67,14 +67,14 @@ public class Bankrupt extends Dialog { quitButton.addClickCommands(source -> close()); - // Zentriere das Menü + // Zentriere den Container bankruptContainer.setLocalTranslation( (app.getCamera().getWidth() - bankruptContainer.getPreferredSize().x) / 2, (app.getCamera().getHeight() + bankruptContainer.getPreferredSize().y) / 2, 8 ); - + // Zentriere den Container backgroundContainer.setLocalTranslation( (app.getCamera().getWidth() - bankruptContainer.getPreferredSize().x - padding) / 2, (app.getCamera().getHeight() + bankruptContainer.getPreferredSize().y+ padding) / 2, @@ -101,7 +101,7 @@ public class Bankrupt extends Dialog { } /** - * Schließt das Menü und entfernt die GUI-Elemente. + * Closes the menu and removes the GUI elements. */ @Override public void close() { @@ -115,5 +115,4 @@ public class Bankrupt extends Dialog { public void escape() { close(); } - } \ No newline at end of file diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/TimeOut.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/TimeOut.java index 7f72153..0b208f4 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/TimeOut.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/TimeOut.java @@ -17,7 +17,7 @@ import pp.monopoly.notification.Sound; import static pp.monopoly.Resources.lookup; /** - * TimeOut ist ein Overlay-Menü, welches aufgerufen wird, wenn die Verbindung zum Server unterbrochen wurde. + * TimeOut is a warning popup that is triggered when the connection to the server is interrupted. */ public class TimeOut extends Dialog { private final MonopolyApp app; @@ -43,26 +43,24 @@ public class TimeOut extends Dialog { - // Hauptcontainer für die Gebäudekarte + // Hauptcontainer für die Warnung timeOutContainer = new Container(); timeOutContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); timeOutContainer.setPreferredSize(new Vector3f(550,250,10)); - float padding = 10; // Padding around the settingsContainer for the background + float padding = 10; // Passt den backgroundContainer an die Größe des bankruptContainers an backgroundContainer.setPreferredSize(timeOutContainer.getPreferredSize().addLocal(padding, padding, 0)); // Titel - // Die Namen werden dynamisch dem BoardManager entnommen Label gateFieldTitle = timeOutContainer.addChild(new Label("Vorsicht !", new ElementId("settings-title"))); //TODO dicke Schrift gateFieldTitle.setFontSize(48); gateFieldTitle.setColor(ColorRGBA.Black); // Text, der auf der Karte steht - // Die Preise werden dynamisch dem BoardManager entnommen - Container propertyValuesContainer = timeOutContainer.addChild(new Container()); - propertyValuesContainer.addChild(new Label("Du hast die Verbindung verloren und kannst nichts dagegen machen. Akzeptiere einfach, dass du verloren hast!", new ElementId("label-Text"))); - propertyValuesContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f))); - propertyValuesContainer.setPreferredSize(timeOutContainer.getPreferredSize().addLocal(-250,-200,0)); + Container textContainer = timeOutContainer.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(timeOutContainer.getPreferredSize().addLocal(-250,-200,0)); // Beenden-Button Button quitButton = timeOutContainer.addChild(new Button("Bestätigen", new ElementId("button"))); @@ -70,14 +68,14 @@ public class TimeOut extends Dialog { quitButton.addClickCommands(source -> close()); - // Zentriere das Menü + // Zentriere den Container timeOutContainer.setLocalTranslation( (app.getCamera().getWidth() - timeOutContainer.getPreferredSize().x) / 2, (app.getCamera().getHeight() + timeOutContainer.getPreferredSize().y) / 2, 8 ); - + // Zentriere den Container backgroundContainer.setLocalTranslation( (app.getCamera().getWidth() - timeOutContainer.getPreferredSize().x - padding) / 2, (app.getCamera().getHeight() + timeOutContainer.getPreferredSize().y+ padding) / 2, From b0c21dfcb89fd2ccb3c0ccd8a0b8c0d725f704bd Mon Sep 17 00:00:00 2001 From: Johannes Schmelz Date: Fri, 29 Nov 2024 06:23:08 +0100 Subject: [PATCH 4/5] added trigger for winner looser popup --- .../main/java/pp/monopoly/client/gui/TestWorld.java | 10 ++++++++-- .../java/pp/monopoly/game/client/ClientGameLogic.java | 8 +++----- .../main/java/pp/monopoly/notification/PopUpEvent.java | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) 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 04bdc2a..06612bf 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 @@ -7,6 +7,8 @@ import pp.monopoly.client.gui.popups.BuyCard; import pp.monopoly.client.gui.popups.EventCard; import pp.monopoly.client.gui.popups.FoodFieldCard; import pp.monopoly.client.gui.popups.GateFieldCard; +import pp.monopoly.client.gui.popups.LooserPopUp; +import pp.monopoly.client.gui.popups.WinnerPopUp; import pp.monopoly.game.server.Player; import pp.monopoly.model.fields.BuildingProperty; import pp.monopoly.model.fields.FoodField; @@ -130,8 +132,7 @@ public class TestWorld implements GameEventListener{ @Override public void receivedEvent(PopUpEvent event) { - System.err.println("Trigger ?"); - // if (event.desc() == "BuyCard") { + if(event.msg().equals("Buy")) { int field = app.getGameLogic().getPlayerHandler().getPlayers().get(0).getFieldID(); Object fieldObject = app.getGameLogic().getBoardManager().getFieldAtIndex(field); @@ -142,6 +143,11 @@ public class TestWorld implements GameEventListener{ } else if (fieldObject instanceof FoodField) { new FoodFieldCard(app).open(); } + } else if(event.msg().equals("Winner")) { + new WinnerPopUp(app).open(); + } else if(event.msg().equals("Looser")) { + new LooserPopUp(app).open(); + } } @Override 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 1b817c3..31c97d1 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,12 +226,10 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker { @Override public void received(GameOver msg) { if (msg.isWinner()) { - - //Winner popup + notifyListeners(new PopUpEvent("Winner")); playSound(Sound.WINNER); } else { - - // Looser popup + notifyListeners(new PopUpEvent("Looser")); playSound(Sound.LOSER); } } @@ -333,6 +331,6 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker { @Override public void received(BuyPropertyRequest msg) { - notifyListeners(new PopUpEvent()); + notifyListeners(new PopUpEvent("Buy")); } } diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/notification/PopUpEvent.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/notification/PopUpEvent.java index 85febde..a808eed 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/notification/PopUpEvent.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/notification/PopUpEvent.java @@ -1,6 +1,6 @@ package pp.monopoly.notification; -public record PopUpEvent() implements GameEvent{ +public record PopUpEvent(String msg) implements GameEvent{ @Override public void notifyListener(GameEventListener listener) { From 1438ae5e4ff0d283b2a7491b3184dfc5527e3e7f Mon Sep 17 00:00:00 2001 From: Johannes Schmelz Date: Fri, 29 Nov 2024 06:26:09 +0100 Subject: [PATCH 5/5] improve position calc --- .../client/src/main/java/pp/monopoly/client/gui/TestWorld.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 06612bf..3bc64bf 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 @@ -133,7 +133,7 @@ public class TestWorld implements GameEventListener{ @Override public void receivedEvent(PopUpEvent event) { if(event.msg().equals("Buy")) { - int field = app.getGameLogic().getPlayerHandler().getPlayers().get(0).getFieldID(); + int field = app.getGameLogic().getPlayerHandler().getPlayerById(app.getId()).getFieldID(); Object fieldObject = app.getGameLogic().getBoardManager().getFieldAtIndex(field); if (fieldObject instanceof BuildingProperty) {