diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/BuildingAdminMenu.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/BuildingAdminMenu.java index d903c03..3e6d134 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/BuildingAdminMenu.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/BuildingAdminMenu.java @@ -18,18 +18,46 @@ import pp.monopoly.client.gui.popups.SellHouse; import pp.monopoly.client.gui.popups.TakeMortage; import pp.monopoly.notification.Sound; +/** + * Represents the building administration menu in the Monopoly application. + *
+ * Provides options to manage properties, including building houses, demolishing houses, + * taking mortgages, repaying mortgages, and viewing an overview of owned properties. + *
+ */ public class BuildingAdminMenu extends Dialog { + /** Reference to the Monopoly application instance. */ private final MonopolyApp app; + /** Main container for the menu's UI components. */ private final Container mainContainer; + + /** Background geometry for the menu. */ private Geometry background; + + /** Button to navigate back to the previous menu. */ private final Button backButton = new Button("Zurück"); + + /** Button to build houses on properties. */ private final Button buildButton = new Button("Bauen"); + + /** Button to demolish houses on properties. */ private final Button demolishButton = new Button("Abriss"); + + /** Button to take out a mortgage on properties. */ private final Button takeMortgageButton = new Button("Hypothek aufnehmen"); + + /** Button to repay a mortgage on properties. */ private final Button payMortgageButton = new Button("Hypothek bezahlen"); + + /** Button to open the property overview menu. */ private final Button overviewButton = new Button("Übersicht"); + /** + * Constructs the building administration menu. + * + * @param app the Monopoly application instance + */ public BuildingAdminMenu(MonopolyApp app) { super(app.getDialogManager()); this.app = app; @@ -163,6 +191,9 @@ public class BuildingAdminMenu extends Dialog { app.getGuiNode().attachChild(background); } + /** + * Closes the building administration menu and detaches its elements from the GUI. + */ @Override public void close() { app.getGuiNode().detachChild(mainContainer); @@ -170,11 +201,19 @@ public class BuildingAdminMenu extends Dialog { super.close(); } + /** + * Opens the settings menu when the escape key is pressed. + */ @Override public void escape() { new SettingsMenu(app).open(); } + /** + * Periodic updates for the menu, if required. + * + * @param delta Time since the last update in seconds. + */ @Override public void update(float delta) { // Periodic updates if necessary diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CameraController.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CameraController.java index 61fe44c..718d871 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CameraController.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CameraController.java @@ -4,20 +4,16 @@ import com.jme3.math.Vector3f; import com.jme3.renderer.Camera; /** - * Steuert die Kamerabewegung in der Szene. + * Controls the movement of the camera within the scene. */ public class CameraController { private final Camera camera; - private final float height = 25; // Höhe der Kamera über dem Spielfeld // Aktueller Winkel in der Kreisbewegung + private final float height = 25; // Height of the camera above the game board /** - * Konstruktor für den CameraController. + * Constructor for the CameraController. * - * @param camera Die Kamera, die gesteuert werden soll - * @param center Der Mittelpunkt der Kreisbewegung (Fokuspunkt) - * @param radius Der Radius der Kreisbewegung - * @param height Die Höhe der Kamera über dem Fokuspunkt - * @param speed Die Geschwindigkeit der Kamerabewegung + * @param camera The camera to be controlled */ public CameraController(Camera camera) { this.camera = camera; @@ -26,27 +22,45 @@ public class CameraController { } /** - * Aktualisiert die Kameraposition und -ausrichtung. + * Updates the camera's position and orientation. * - * @param tpf Zeit pro Frame + * @param tpf Time per frame */ public void update(float tpf) { camera.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y); } + /** + * Sets the camera's position based on the field ID. + * + * @param fieldID The ID of the field to which the camera should move + */ public void setPosition(int fieldID) { camera.setLocation(fieldIdToVector(fieldID)); } + /** + * Sets the camera's position using specific coordinates. + * + * @param x The X-coordinate of the new camera position + * @param y The Y-coordinate of the new camera position + */ public void setPosition(float x, float y) { - camera.setLocation(new Vector3f(x,height,y)); + camera.setLocation(new Vector3f(x, height, y)); } + /** + * Maps a field ID to its corresponding position in the game world. + * + * @param fieldID The ID of the field + * @return The position of the field as a {@link Vector3f} + * @throws IllegalArgumentException If the field ID is invalid + */ private Vector3f fieldIdToVector(int fieldID) { - if (fieldID <= 10) return new Vector3f(30,height,0); + if (fieldID <= 10) return new Vector3f(30, height, 0); if (fieldID <= 20) return new Vector3f(0, height, 30); if (fieldID <= 30) return new Vector3f(-30, height, 0); if (fieldID <= 40) return new Vector3f(0, height, -30); else throw new IllegalArgumentException(); } -} +} \ No newline at end of file diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/GameBoardSynchronizer.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/GameBoardSynchronizer.java index 637f7ab..f8dd72e 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/GameBoardSynchronizer.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/GameBoardSynchronizer.java @@ -26,9 +26,9 @@ import static pp.util.FloatMath.PI; /** * The {@code GameBoardSynchronizer} class is responsible for synchronizing the graphical - * representation of the ships and shots on the sea map with the underlying data model. + * representation of the Game board and figures with the underlying data model. * It extends the {@link BoardSynchronizer} to provide specific synchronization - * logic for the sea map. + * logic for the Game board. */ class GameBoardSynchronizer extends BoardSynchronizer { private static final String UNSHADED = "Common/MatDefs/Misc/Unshaded.j3md"; //NON-NLS @@ -42,9 +42,9 @@ class GameBoardSynchronizer extends BoardSynchronizer { /** * Constructs a {@code GameBoardSynchronizer} object with the specified application, root node, and ship map. * - * @param app the Battleship application + * @param app the Monopoly application * @param root the root node to which graphical elements will be attached - * @param map the ship map containing the ships and shots + * @param map the Game Board containing fields and figures */ public GameBoardSynchronizer(MonopolyApp app, Node root, Board board) { super(board, root); @@ -54,17 +54,15 @@ class GameBoardSynchronizer extends BoardSynchronizer { } /** - * Visits a {@link Battleship} and creates a graphical representation of it. - * The representation is either a 3D model or a simple box depending on the - * type of battleship. + * Visits a {@link Figure} and creates a graphical representation of it. + * The representation is a 3D model. * - * @param ship the battleship to be represented - * @return the node containing the graphical representation of the battleship + * @param figure the figure to be represented + * @return the node containing the graphical representation of the figure */ public Spatial visit(Figure figure) { final Node node = new Node(FIGURE); node.attachChild(createBox(figure)); - // compute the center of the ship in world coordinates final float x = 1; final float z = 1; node.setLocalTranslation(x, 0f, z); @@ -72,10 +70,10 @@ class GameBoardSynchronizer extends BoardSynchronizer { } /** - * Creates a simple box to represent a battleship that is not of the "King George V" type. + * Creates a representation of a figure * - * @param ship the battleship to be represented - * @return the geometry representing the battleship as a box + * @param figure the figure to be represented + * @return the geometry representing the figure */ private Spatial createBox(Figure figure) { final Box box = new Box(0.5f * (figure.getMaxY() - figure.getMinY()) + 0.3f, diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/LobbyMenu.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/LobbyMenu.java index 8e4be3a..7724bd9 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/LobbyMenu.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/LobbyMenu.java @@ -31,19 +31,47 @@ import pp.monopoly.notification.Sound; import java.util.Set; +/** + * Represents the lobby menu in the Monopoly application. + *+ * Provides functionality for player configuration, including input for starting capital, + * player name, and figure selection, as well as options to ready up or exit the game. + *
+ */ public class LobbyMenu extends Dialog { + /** Reference to the Monopoly application instance. */ private final MonopolyApp app; + + /** Main container for the lobby menu UI. */ private final Container menuContainer; + + /** Background geometry for the menu. */ private Geometry background; + + /** Colored circle displayed between input fields and dropdown menus. */ private Geometry circle; + + /** Container for the lower-left section of the menu. */ private Container lowerLeftMenu; + + /** Container for the lower-right section of the menu. */ private Container lowerRightMenu; + /** Text field for entering the player's name. */ private TextField playerInputField; + + /** Text field for entering the starting capital. */ private TextField startingCapital = new TextField("15000"); + + /** Selected player figure. */ private String figure; + /** + * Constructs the lobby menu for player configuration. + * + * @param app the Monopoly application instance + */ public LobbyMenu(MonopolyApp app) { super(app.getDialogManager()); this.app = app; @@ -193,7 +221,7 @@ public class LobbyMenu extends Dialog { /** - * Lädt das Hintergrundbild und fügt es als geometrische Ebene hinzu. + * Adds a background image to the lobby menu. */ private void addBackgroundImage() { Texture backgroundImage = app.getAssetManager().loadTexture("Pictures/lobby.png"); @@ -207,6 +235,11 @@ public class LobbyMenu extends Dialog { app.getGuiNode().attachChild(background); } + /** + * Creates a circle graphic element for the menu. + * + * @return the created circle geometry + */ private Geometry createCircle() { Sphere sphere = new Sphere(90,90,60.0f); @@ -220,6 +253,11 @@ public class LobbyMenu extends Dialog { return circleGeometry; } + /** + * Maps the player's ID to a corresponding color. + * + * @return the color associated with the player's ID + */ private ColorRGBA idToColor() { switch (app.getId()+1) { case 1: return PlayerColor.CYAN.getColor(); @@ -235,19 +273,25 @@ public class LobbyMenu extends Dialog { } /** - * Schaltet den "Bereit"-Status um. + * Toggles the player's ready state and sends the configuration to the server. */ private void toggleReady() { app.getGameLogic().send(new PlayerReady(true, playerInputField.getText(), figure, Integer.parseInt(startingCapital.getText()))); } + /** + * Opens the settings menu when the escape key is pressed. + */ @Override public void escape() { new SettingsMenu(app).open(); } /** - * Adds a custom action listener to the Selector. + * Adds a custom action listener to a dropdown selector. + * + * @param selector the selector to add the listener to + * @param listener the action to perform when a selection changes */ private void addSelectionActionListener(Selector+ * Facilitates trade interactions between players, including selection of properties, + * currency, and special cards for offers and requests. + *
+ */ public class TradeMenu extends Dialog { + + /** The Monopoly application instance. */ private final MonopolyApp app; + + /** The trade handler managing trade logic. */ private final TradeHandler tradeHandler; + /** Main container for the trade menu UI. */ private final Container mainContainer; + + /** Background geometry for the menu. */ private Geometry background; private Selector