diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CameraInputHandler.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CameraInputHandler.java
new file mode 100644
index 0000000..d494b76
--- /dev/null
+++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CameraInputHandler.java
@@ -0,0 +1,60 @@
+//package pp.monopoly.client.gui;
+//
+//import com.jme3.input.InputManager;
+//import com.jme3.input.KeyInput;
+//import com.jme3.input.controls.ActionListener;
+//import com.jme3.input.controls.KeyTrigger;
+//
+///**
+// * Handhabt die Eingaben für die Kamera.
+// */
+//public class CameraInputHandler {
+//
+// private CameraController cameraController; // Kamera-Controller
+//
+// /**
+// * Konstruktor für den CameraInputHandler.
+// *
+// * @param cameraController Der Kamera-Controller, der gesteuert werden soll.
+// * @param inputManager Der InputManager, um Eingaben zu registrieren.
+// */
+// public CameraInputHandler(CameraController cameraController, InputManager inputManager) {
+// if (cameraController == null || inputManager == null) {
+// throw new IllegalArgumentException("CameraController und InputManager dürfen nicht null sein");
+// }
+// this.cameraController = cameraController;
+//
+// // Mappings für Kamerasteuerung
+// inputManager.addMapping("FocusCurrentPlayer", new KeyTrigger(KeyInput.KEY_1)); // Modus 1
+// inputManager.addMapping("FocusSelf", new KeyTrigger(KeyInput.KEY_2)); // Modus 2
+// inputManager.addMapping("FreeCam", new KeyTrigger(KeyInput.KEY_3)); // Modus 3
+//
+// // Listener für die Kameramodi
+// inputManager.addListener(actionListener, "FocusCurrentPlayer", "FocusSelf", "FreeCam");
+// }
+//
+// /**
+// * ActionListener für die Kamerasteuerung.
+// */
+// private final ActionListener actionListener = (name, isPressed, tpf) -> {
+// if (!isPressed) return;
+//
+// // Umschalten der Kamera-Modi basierend auf der Eingabe
+// switch (name) {
+// case "FocusCurrentPlayer" -> {
+// cameraController.setMode(CameraController.CameraMode.FOCUS_CURRENT_PLAYER);
+// System.out.println("Kameramodus: Fokus auf aktuellen Spieler");
+// }
+// case "FocusSelf" -> {
+// cameraController.setMode(CameraController.CameraMode.FOCUS_SELF);
+// System.out.println("Kameramodus: Fokus auf eigene Figur");
+// }
+// case "FreeCam" -> {
+// cameraController.setMode(CameraController.CameraMode.FREECAM);
+// System.out.println("Kameramodus: Freie Kamera");
+// }
+// default -> System.err.println("Unbekannter Kameramodus: " + name);
+// }
+// };
+//}
+//
\ No newline at end of file
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 f94c04a..cb4a3d9 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
@@ -23,6 +23,7 @@ import pp.monopoly.notification.Sound;
import java.util.HashSet;
import java.util.Set;
+
/**
* Represents the trade menu dialog in the Monopoly application.
*
@@ -45,7 +46,7 @@ public class TradeMenu extends Dialog {
private Geometry background;
private Selector leftBuildingSelector, leftSpecialCardSelector;
private Selector rightBuildingSelector, rightSpecialCardSelector;
- private TextField leftSelectionsField, rightSelectionsField;
+ private Label leftSelectionsLabel, rightSelectionsLabel;
private TextField leftCurrencyInput, rightCurrencyInput;
private VersionedReference> leftBuildingRef, rightBuildingRef;
@@ -217,12 +218,14 @@ public class TradeMenu extends Dialog {
Container middleSection = new Container(new SpringGridLayout(Axis.Y, Axis.X));
middleSection.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8f, 0.8f, 0.8f, 1.0f)));
- Label middleLabelTop = middleSection.addChild(new Label("Gebäude: Währung: Sonderkarten:"));
+ Label middleLabelTop = middleSection.addChild(new Label("Meine Gebäude:"));
middleLabelTop.setFontSize(24);
+ middleLabelTop.setTextVAlignment(VAlignment.Center);
+ middleLabelTop.setTextHAlignment(HAlignment.Center);
middleLabelTop.setInsets(new Insets3f(5, 5, 5, 5));
- leftSelectionsField = middleSection.addChild(new TextField(""));
- leftSelectionsField.setPreferredSize(new Vector3f(600, 50, 0));
+ leftSelectionsLabel = middleSection.addChild(new Label(""));
+ leftSelectionsLabel.setPreferredSize(new Vector3f(600, 50, 0));
Container buttons = middleSection.addChild(new Container(new SpringGridLayout()));
Button cancel = new Button("Abbrechen");
@@ -242,12 +245,14 @@ public class TradeMenu extends Dialog {
buttons.addChild(cancel);
buttons.addChild(trade);
- Label middleLabelBottom = middleSection.addChild(new Label("Gebäude: Währung: Sonderkarten:"));
+ Label middleLabelBottom = middleSection.addChild(new Label("Gebäude des Gegenspielers:"));
middleLabelBottom.setFontSize(24);
+ middleLabelBottom.setTextVAlignment(VAlignment.Center);
+ middleLabelBottom.setTextHAlignment(HAlignment.Center);
middleLabelBottom.setInsets(new Insets3f(5, 5, 5, 5));
- rightSelectionsField = middleSection.addChild(new TextField(""));
- rightSelectionsField.setPreferredSize(new Vector3f(600, 50, 0));
+ rightSelectionsLabel = middleSection.addChild(new Label(""));
+ rightSelectionsLabel.setPreferredSize(new Vector3f(600, 50, 0));
return middleSection;
}
@@ -321,25 +326,23 @@ public class TradeMenu extends Dialog {
*/
@Override
public void update(float delta) {
- if (leftBuildingRef.update() || leftCardRef.update() || leftCurrencyRef.update()) {
- updateSelections(leftSelectionsField, leftBuildingSelector, leftCurrencyInput, leftSpecialCardSelector, true);
+ if (leftBuildingRef.update() || leftCardRef.update()) {
+ updateSelections(leftSelectionsLabel, leftBuildingSelector, true);
}
- if (rightBuildingRef.update() || rightCardRef.update() || rightCurrencyRef.update()) {
- updateSelections(rightSelectionsField, rightBuildingSelector, rightCurrencyInput, rightSpecialCardSelector, false);
+ if (rightBuildingRef.update() || rightCardRef.update()) {
+ updateSelections(rightSelectionsLabel, rightBuildingSelector, false);
}
}
/**
- * Updates the displayed selections for properties, currency, and cards.
+ * Updates the displayed selections for properties.
*
- * @param target the target text field to update
+ * @param target the target label to update
* @param building the building selector
- * @param currency the currency input field
- * @param card the special card selector
* @param isLeft true if updating the left column; false otherwise
*/
- private void updateSelections(TextField target, Selector building, TextField currency, Selector card, boolean isLeft) {
+ private void updateSelections(Label target, Selector building, boolean isLeft) {
StringBuilder buildingText = new StringBuilder();
if (isLeft) {
if (leftselBuildings.contains(building.getSelectedItem())) {
@@ -347,8 +350,8 @@ public class TradeMenu extends Dialog {
} else {
leftselBuildings.add(building.getSelectedItem()); // Add if not already selected
}
- for (String property : leftselBuildings) {
- buildingText.append(property);
+ for (String property : leftselBuildings) {
+ buildingText.append(property).append(", ");
}
} else {
if (rightselBuildings.contains(building.getSelectedItem())) {
@@ -356,14 +359,12 @@ public class TradeMenu extends Dialog {
} else {
rightselBuildings.add(building.getSelectedItem()); // Add if not already selected
}
- for (String property : rightselBuildings) {
- buildingText.append(property);
+ for (String property : rightselBuildings) {
+ buildingText.append(property).append(", ");
}
}
- String currencyText = currency.getText() != null ? currency.getText().trim() : "";
- String cardText = card.getSelectedItem() != null ? card.getSelectedItem() : "";
- target.setText(String.join(" | ", buildingText, currencyText, cardText));
+ target.setText(buildingText.toString().replaceAll(", $", ""));
}
/** Opens the settings menu when the escape key is pressed. */
diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/AcceptTrade.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/AcceptTrade.java
index 6a6795d..067cd65 100644
--- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/AcceptTrade.java
+++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/AcceptTrade.java
@@ -73,7 +73,7 @@ public class AcceptTrade extends Dialog {
// Text, der im Popup steht
Container textContainer = noMoneyWarningContainer.addChild(new Container());
- textContainer.addChild(new Label("Du hast Spieler"+ msg.getTradeHandler().getReceiver().getName() + "einen Handel vorgeschlagen", new ElementId("label-Text")));
+ textContainer.addChild(new Label("Du hast Spieler"+ " " + msg.getTradeHandler().getReceiver().getName() + " " + "einen Handel vorgeschlagen", new ElementId("label-Text")));
textContainer.addChild(new Label("", new ElementId("label-Text")));
textContainer.addChild(new Label("Der Handel wurde angenommen", new ElementId("label-Text")));
textContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
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 db1f065..438c39e 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
@@ -70,19 +70,18 @@ public class ConfirmTrade extends Dialog {
}
// Text, der auf der Karte steht
- // Die Werte werden dem Handel entnommen (Iwas auch immer da dann ist)
Container propertyValuesContainer = confirmTradeContainer.addChild(new Container());
- propertyValuesContainer.addChild(new Label("„Spieler " + tradeHandler.getSender().getName() + " möchte:", new ElementId("label-Text")));
+ propertyValuesContainer.addChild(new Label("„Spieler " + " " + tradeHandler.getSender().getName() + " " +" möchte:", new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("", new ElementId("label-Text")));// Leerzeile
propertyValuesContainer.addChild(new Label("- " + offeredProperties, new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("- " + tradeHandler.getOfferedAmount() + " EUR", new ElementId("label-Text")));
- propertyValuesContainer.addChild(new Label("- " + tradeHandler.getOfferedJailCards() +" Sonderkaten", new ElementId("label-Text")));
+ propertyValuesContainer.addChild(new Label("- " + tradeHandler.getOfferedJailCards() +" Sonderkarten", new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("", new ElementId("label-Text")));// Leerzeile
propertyValuesContainer.addChild(new Label("gegen:", new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("", new ElementId("label-Text")));// Leerzeile
propertyValuesContainer.addChild(new Label("- "+ requestedProperties, new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("- "+ tradeHandler.getRequestedAmount() +" EUR", new ElementId("label-Text")));
- propertyValuesContainer.addChild(new Label("- "+ tradeHandler.getRequestedJailCards() +" Sonderkaten", new ElementId("label-Text")));
+ propertyValuesContainer.addChild(new Label("- "+ tradeHandler.getRequestedJailCards() +" Sonderkarten", new ElementId("label-Text")));
propertyValuesContainer.addChild(new Label("", new ElementId("label-Text")));// Leerzeile
propertyValuesContainer.addChild(new Label("tauschen, willst du das Angebot annehmen?", new ElementId("label-Text")));
propertyValuesContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/ReceivedRent.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/ReceivedRent.java
index 83e8784..178e104 100644
--- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/ReceivedRent.java
+++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/ReceivedRent.java
@@ -107,7 +107,7 @@ public class ReceivedRent extends Dialog {
// Rent message
Container textContainer = container.addChild(new Container());
- textContainer.addChild(new Label("Du bekommst von Spieler " + playerName + " " + amount + " EUR Miete",
+ textContainer.addChild(new Label("Du bekommst von Spieler " + " " + playerName + " " + amount + " EUR Miete",
new ElementId("label-Text")));
textContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
textContainer.setPreferredSize(container.getPreferredSize().addLocal(-250, -200, 0));
diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/RejectTrade.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/RejectTrade.java
index 92f1d07..fc98bf6 100644
--- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/RejectTrade.java
+++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/RejectTrade.java
@@ -74,7 +74,7 @@ public class RejectTrade extends Dialog {
// Text, der im Popup steht
Container textContainer = noMoneyWarningContainer.addChild(new Container());
- textContainer.addChild(new Label("Du hast Spieler"+ msg.getTradeHandler().getReceiver().getName() + "einen Handel vorgeschlagen", new ElementId("label-Text")));
+ textContainer.addChild(new Label("Du hast Spieler"+ " " + msg.getTradeHandler().getReceiver().getName() + " " + "einen Handel vorgeschlagen", new ElementId("label-Text")));
textContainer.addChild(new Label("", new ElementId("label-Text")));
textContainer.addChild(new Label("Der Handel wurde abgelehnt", new ElementId("label-Text")));
textContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/Rent.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/Rent.java
index 21653d5..bd87b39 100644
--- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/Rent.java
+++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/Rent.java
@@ -107,7 +107,7 @@ public class Rent extends Dialog {
// Rent message
Container textContainer = container.addChild(new Container());
- textContainer.addChild(new Label("Du musst Spieler " + playerName + " " + amount + " EUR Miete zahlen",
+ textContainer.addChild(new Label("Du musst Spieler " + " " + playerName + " " + amount + " EUR Miete zahlen",
new ElementId("label-Text")));
textContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
textContainer.setPreferredSize(container.getPreferredSize().addLocal(-250, -200, 0));
diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/ActiveState.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/ActiveState.java
index 78dfed1..ff6702e 100644
--- a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/ActiveState.java
+++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/ActiveState.java
@@ -1,8 +1,18 @@
package pp.monopoly.game.client;
-public class ActiveState extends ClientState{
+/**
+ * Represents the active client state in the Monopoly game.
+ * Extends {@link ClientState}.
+ */
+public class ActiveState extends ClientState {
+ /**
+ * Constructs an ActiveState with the specified game logic.
+ *
+ * @param logic the client-side game logic associated with this state
+ * used to manage game interactions and transitions
+ */
ActiveState(ClientGameLogic logic) {
super(logic);
}
-}
+}
\ No newline at end of file
diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/ClientState.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/ClientState.java
index 4bd64db..b9f2361 100644
--- a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/ClientState.java
+++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/ClientState.java
@@ -6,24 +6,25 @@
////////////////////////////////////////
package pp.monopoly.game.client;
-import pp.monopoly.model.IntPoint;
import java.io.File;
import java.io.IOException;
import java.lang.System.Logger.Level;
+import pp.monopoly.model.IntPoint;
+
/**
- * Defines the behavior and state transitions for the client-side game logic.
- * Different states of the game logic implement this interface to handle various game events and actions.
+ * Defines the behavior and state transitions for the client-side game logic in Monopoly.
+ * Different states of the game logic implement this abstract class to handle various game events and actions.
*/
abstract class ClientState {
/**
- * The game logic object.
+ * The game logic object managing the client-side state.
*/
final ClientGameLogic logic;
/**
- * Constructs a client state of the specified game logic.
+ * Constructs a client state for the specified game logic.
*
* @param logic the game logic
*/
@@ -49,16 +50,16 @@ abstract class ClientState {
}
/**
- * Checks if the battle state should be shown.
+ * Checks if the player's turn should be shown in the current state.
*
- * @return true if the battle state should be shown, false otherwise
+ * @return true if the player's turn should be shown, false otherwise
*/
boolean showTurn() {
return false;
}
/**
- * Moves the preview figure to the specified position.
+ * Moves the preview figure to the specified position on the game board.
*
* @param pos the new position for the preview figure
*/
@@ -67,13 +68,13 @@ abstract class ClientState {
}
/**
- * Loads a map from the specified file.
+ * Loads a game configuration from the specified file.
*
- * @param file the file to load the map from
- * @throws IOException if the map cannot be loaded in the current state
+ * @param file the file to load the game configuration from
+ * @throws IOException if the configuration cannot be loaded in the current state
*/
- void loadMap(File file) throws IOException {
- throw new IOException("You are not allowed to load a map in this state of the game");
+ void loadGameConfig(File file) throws IOException {
+ throw new IOException("You are not allowed to load a game configuration in this state of the game.");
}
/**
@@ -81,5 +82,7 @@ abstract class ClientState {
*
* @param delta time in seconds since the last update call
*/
- void update(float delta) { /* do nothing by default */ }
+ void update(float delta) {
+ // Default implementation does nothing
+ }
}
diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/LobbyState.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/LobbyState.java
index 5fc6bd0..f2db68b 100644
--- a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/LobbyState.java
+++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/LobbyState.java
@@ -1,7 +1,16 @@
package pp.monopoly.game.client;
-public class LobbyState extends ClientState{
+/**
+ * Represents the lobby state of the client in the Monopoly game.
+ * Extends {@link ClientState}.
+ */
+public class LobbyState extends ClientState {
+ /**
+ * Constructs a LobbyState with the specified game logic.
+ *
+ * @param logic the client-side game logic
+ */
LobbyState(ClientGameLogic logic) {
super(logic);
}
diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/WaitForTurnState.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/WaitForTurnState.java
index d6c6407..0575966 100644
--- a/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/WaitForTurnState.java
+++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/game/client/WaitForTurnState.java
@@ -1,7 +1,16 @@
package pp.monopoly.game.client;
-public class WaitForTurnState extends ClientState{
+/**
+ * Represents the state where the client is waiting for their turn in the Monopoly game.
+ * Extends {@link ClientState}.
+ */
+public class WaitForTurnState extends ClientState {
+ /**
+ * Constructs a WaitForTurnState with the specified game logic.
+ *
+ * @param logic the client-side game logic
+ */
WaitForTurnState(ClientGameLogic logic) {
super(logic);
}