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 7d2e2f7..f55d672 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,27 +4,25 @@ 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.model.fields.PropertyField; -import pp.monopoly.notification.DiceRollEvent; -import pp.monopoly.notification.EventCardEvent; + import pp.monopoly.notification.GameEventListener; import pp.monopoly.notification.PopUpEvent; /** * TestWorld zeigt eine einfache Szene mit Spielfeld und Spielfiguren. */ -public class TestWorld { +public class TestWorld implements GameEventListener{ private final MonopolyApp app; private final List players; // Liste der Spieler, bereits aus GameStart geladen private CameraController cameraController; + private Toolbar toolbar; /** * Konstruktor für die TestWorld. @@ -35,6 +33,7 @@ public class TestWorld { public TestWorld(MonopolyApp app, List players) { this.app = app; this.players = players; + app.getGameLogic().removeListener(this); } /** @@ -52,6 +51,8 @@ public class TestWorld { createBoard(); createPlayerFigures(); // Lädt Figuren aus der bereits vorhandenen Liste setupCamera(); + toolbar = new Toolbar(app); + toolbar.open(); } /** diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/Toolbar.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/Toolbar.java index 06e982e..d3e82fc 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/Toolbar.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/Toolbar.java @@ -155,29 +155,10 @@ public class Toolbar extends Dialog implements GameEventListener { private void startDiceAnimation() { animatingDice = true; long startTime = System.currentTimeMillis(); - - Thread diceAnimation = new Thread(() -> { - int[] currentFace = {1}; + + new Thread(() -> { try { - while (System.currentTimeMillis() - startTime < 2000) { // Animation läuft für 4 Sekunden - currentFace[0] = (currentFace[0] % 6) + 1; - - String rotatingImage1 = diceToString(currentFace[0]); - String rotatingImage2 = diceToString((currentFace[0] % 6) + 1); - - IconComponent newIcon1 = new IconComponent(rotatingImage1); - newIcon1.setIconSize(new Vector2f(100, 100)); - app.enqueue(() -> imageLabel.setIcon(newIcon1)); - - IconComponent newIcon2 = new IconComponent(rotatingImage2); - newIcon2.setIconSize(new Vector2f(100, 100)); - app.enqueue(() -> imageLabel2.setIcon(newIcon2)); - - // Warte 100 ms, bevor die Bilder wechseln - Thread.sleep(100); - } - - // Animation beenden + animateDice(startTime); animatingDice = false; if (latestDiceRollEvent != null) { showFinalDiceResult(latestDiceRollEvent);