From 26dc24a1f4fcf3458746163b7cd31c0ab93685ed Mon Sep 17 00:00:00 2001 From: Johannes Schmelz Date: Sun, 1 Dec 2024 13:53:50 +0100 Subject: [PATCH] fixed verhandeln --- .../java/pp/monopoly/client/gui/popups/ConfirmTrade.java | 6 ++++-- .../src/main/java/pp/monopoly/model/TradeHandler.java | 9 +-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/ConfirmTrade.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/ConfirmTrade.java index e0238e6..1dc284b 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/ConfirmTrade.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/ConfirmTrade.java @@ -80,7 +80,7 @@ public class ConfirmTrade extends Dialog { // Ablehnen-Button Button declineButton = confirmTradeContainer.addChild(new Button("Ablehnen", new ElementId("button"))); declineButton.setFontSize(32); - declineButton.addClickCommands(s -> ifTopDialog(() -> { //TODO Buttonfunktion prüfen + declineButton.addClickCommands(s -> ifTopDialog(() -> { app.getGameLogic().playSound(Sound.BUTTON); app.getGameLogic().send(new TradeResponse(false, tradeHandler)); close(); @@ -91,7 +91,9 @@ public class ConfirmTrade extends Dialog { negotiateButton.addClickCommands(s -> ifTopDialog( () -> { app.getGameLogic().playSound(Sound.BUTTON); close(); - new TradeMenu(app, new TradeHandler(app.getGameLogic().getPlayerHandler().getPlayerById(app.getId()))).open(); + TradeHandler t = new TradeHandler(app.getGameLogic().getPlayerHandler().getPlayerById(tradeHandler.getSender().getId())); + t.setReceiver(app.getGameLogic().getPlayerHandler().getPlayerById(tradeHandler.getReceiver().getId())); + new TradeMenu(app, t).open(); })); // Confirm-Button Button confirmButton = confirmTradeContainer.addChild(new Button("Bestätigen", new ElementId("button"))); diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/TradeHandler.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/TradeHandler.java index 0cffb17..4161b5f 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/TradeHandler.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/TradeHandler.java @@ -55,14 +55,7 @@ public class TradeHandler { /** * Constructs a TradeHandler for a single trade instance. * - * @param sender the Player initiating the trade - * @param receiver the Player receiving the trade offer - * @param offeredAmount the amount of money offered by the sender - * @param offeredProperties the properties offered by the sender - * @param offeredJailCards the jail cards offered by the sender - * @param requestedAmount the amount of money requested from the receiver - * @param requestedProperties the properties requested from the receiver - * @param requestedJailCards the jail cards requested from the receiver + * @param sender the Player initiating the trade */ public TradeHandler(Player sender) { this.sender = sender;