From 2e42f3afac49286c8556d80de1eae5fe20604db9 Mon Sep 17 00:00:00 2001 From: Johannes Schmelz Date: Mon, 25 Nov 2024 04:09:48 +0100 Subject: [PATCH] added testing shortcuts --- .../java/pp/monopoly/client/MonopolyApp.java | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) 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 9991bb6..bcc1bd7 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 @@ -23,12 +23,19 @@ import com.simsilica.lemur.style.BaseStyles; import pp.monopoly.game.client.MonopolyClient; import pp.monopoly.client.gui.SettingsMenu; import pp.monopoly.client.gui.StartMenu; +import pp.monopoly.client.gui.TestWorld; +import pp.monopoly.client.gui.popups.BuildingPropertyCard; +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.client.ClientGameLogic; import pp.monopoly.game.client.ServerConnection; import pp.monopoly.notification.ClientStateEvent; import pp.monopoly.notification.GameEventListener; import pp.monopoly.notification.InfoTextEvent; import pp.monopoly.notification.Sound; +import pp.dialog.Dialog; import pp.dialog.DialogBuilder; import pp.dialog.DialogManager; import pp.graphics.Draw; @@ -120,6 +127,16 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga */ private final ActionListener escapeListener = (name, isPressed, tpf) -> escape(isPressed); + //TODO temp for testing + private EventCard eventCard; + private BuildingPropertyCard buildingProperty; + private FoodFieldCard foodField; + private GateFieldCard gateField; + private BuyCard buyCard; + private boolean isBuyCardPopupOpen = false; + private final ActionListener BListener = (name, isPressed, tpf) -> handleB(isPressed); + private final ActionListener TListener = (name, isPressed, tpf) -> handleT(isPressed); + static { // Configure logging LogManager manager = LogManager.getLogManager(); @@ -248,8 +265,44 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga inputManager.addMapping(ESC, new KeyTrigger(KeyInput.KEY_ESCAPE)); inputManager.addMapping(CLICK, new MouseButtonTrigger(MouseInput.BUTTON_LEFT)); inputManager.addListener(escapeListener, ESC); + + //TODO tmp for testing + inputManager.addMapping("B", new KeyTrigger(KeyInput.KEY_B)); + inputManager.addListener(BListener, "B"); + inputManager.addMapping("T", new KeyTrigger(KeyInput.KEY_T)); + inputManager.addListener(TListener, "T"); } + //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 BuyCard(this); + if (eventCard != null && isBuyCardPopupOpen) { + // Schließe das SettingsMenu + System.out.println("Schließe BuyCardPopup..."); + eventCard.close(); + eventCard = null; + tmp.open(); + } else { + // Öffne das SettingsMenu + System.out.println("Öffne BuyCardPopup..."); + eventCard = new EventCard(this); + eventCard.open(); + dialogManager.close(tmp); + } + } + } + + //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(); + } + } + + + /** * Initializes and attaches the necessary application states for the game. */