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 972728c..73e67b8 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 @@ -67,8 +67,8 @@ public class Toolbar extends Dialog implements GameEventListener { Container playerColorBar = new Container(); playerColorBar.setPreferredSize(new Vector3f(app.getCamera().getWidth(), 40, 0)); // Höhe des Balkens auf 10 festlegen playerColorBar.setBackground(new QuadBackgroundComponent(playerColor)); - playerColorBar.setLocalTranslation(0, 200, 1); // Positioniere ihn an der oberen Kante der Toolbar - container.attachChild(playerColorBar); + playerColorBar.setLocalTranslation(0, 220, 1); // Positioniere ihn an der oberen Kante der Toolbar + app.getGuiNode().attachChild(playerColorBar); // Übersicht und Konto accountContainer = container.addChild(new Container()); @@ -220,7 +220,6 @@ public class Toolbar extends Dialog implements GameEventListener { app.enqueue(() -> { setDiceIcon(imageLabel, diceToString(event.a())); setDiceIcon(imageLabel2, diceToString(event.b())); - app.getGameLogic().playSound(Sound.BUTTON); }); } diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/TradeMenu.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/TradeMenu.java index 74b2ead..a5029b2 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/TradeMenu.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/TradeMenu.java @@ -13,6 +13,7 @@ import com.simsilica.lemur.*; import com.simsilica.lemur.component.QuadBackgroundComponent; import com.simsilica.lemur.component.SpringGridLayout; import com.simsilica.lemur.core.VersionedList; +import com.simsilica.lemur.core.VersionedReference; import com.simsilica.lemur.style.ElementId; import pp.dialog.Dialog; import pp.monopoly.client.MonopolyApp; @@ -21,6 +22,8 @@ import pp.monopoly.model.TradeHandler; import pp.monopoly.model.fields.PropertyField; import pp.monopoly.notification.Sound; +import java.util.Set; + public class TradeMenu extends Dialog { private final MonopolyApp app; private final TradeHandler tradeHandler; @@ -30,6 +33,11 @@ public class TradeMenu extends Dialog { private Selector rightBuildingSelector, rightSpecialCardSelector; private TextField leftSelectionsField, rightSelectionsField; private TextField leftCurrencyInput, rightCurrencyInput; + private VersionedReference> selectionRef; // Reference to track selector changes + private String valueSelected = ""; // To keep track of the last selected value + private String buildingSelected = ""; + private String specialCardSelected = ""; + private static final ColorRGBA TRANSLUCENT_WHITE = new ColorRGBA(1, 1, 1, 0.5f); @@ -257,12 +265,30 @@ public class TradeMenu extends Dialog { super.close(); } + /** + * Updates the dialog periodically, called by the dialog manager. + * + * @param delta The time elapsed since the last update. + */ + @Override + public void update(float delta) { + // Check if the selection has changed + // if (selectionRef.update()) { + // String selected = playerSelector.getSelectedItem(); + // if (!selected.equals(lastSelected)) { + // lastSelected = selected; + // onDropdownSelectionChanged(selected); + } + } + + + /** * Handles dropdown selection changes and updates the trade handler. * * @param selected The selected item from the dropdown. */ - private void onDropdownSelectionChanged(String selected) { + /* private void onDropdownSelectionChanged(String selected) { app.getGameLogic().playSound(Sound.BUTTON); int idStart = selected.indexOf("(ID: ") + 5; // Find start of the ID int idEnd = selected.indexOf(")", idStart); // Find end of the ID @@ -273,7 +299,7 @@ public class TradeMenu extends Dialog { Player selectedPlayer = app.getGameLogic().getPlayerHandler().getPlayerById(playerId); if (selectedPlayer != null) { - tradeHandler.setReceiver(selectedPlayer); // Set the receiver in TradeHandler + } - } -} + }*/ +