mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-24 23:59:44 +01:00
lobby übergibt figur
This commit is contained in:
parent
f67fa4d7f0
commit
a6e6b5e158
@ -27,6 +27,8 @@ import pp.monopoly.game.client.ClientGameLogic;
|
||||
import pp.monopoly.game.server.Player;
|
||||
import pp.monopoly.game.server.PlayerColor;
|
||||
import pp.monopoly.game.server.PlayerHandler;
|
||||
import pp.monopoly.model.Figure;
|
||||
import pp.monopoly.model.Rotation;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@ -43,6 +45,7 @@ public class LobbyMenu {
|
||||
private PlayerHandler playerHandler; // Reference to PlayerHandler
|
||||
private TextField startingCapital; // Reference to the starting capital input field
|
||||
private TextField playerInputField; // Reference to the player name input field
|
||||
private Selector<String> figureDropdown; // Reference to the figure dropdown
|
||||
|
||||
|
||||
public LobbyMenu(MonopolyApp app) {
|
||||
@ -160,10 +163,11 @@ public class LobbyMenu {
|
||||
readyButton.setPreferredSize(new Vector3f(200, 60, 0)); // Set size to match the appearance in the image
|
||||
readyButton.setFontSize(18); // Adjust font size
|
||||
readyButton.setBackground(new QuadBackgroundComponent(ColorRGBA.Green)); // Add color to match the style
|
||||
readyButton.addClickCommands(source -> toggleReady(null));// Add functionality
|
||||
readyButton.addClickCommands(source -> applyStartingCapital(playerID));
|
||||
readyButton.addClickCommands(source -> applyPlayerName(playerID));
|
||||
readyButton.addClickCommands(source -> applyFigure(playerID));
|
||||
lowerRightMenu.addChild(readyButton);
|
||||
//TODO aktivieren des Spielers in den ready Status und Sprung in den nächsten Menüzustand
|
||||
|
||||
// Position the container near the bottom-right corner
|
||||
lowerRightMenu.setLocalTranslation(new Vector3f(app.getCamera().getWidth() - 320, 170, 3)); // X: 220px from the right, Y: 50px above the bottom
|
||||
@ -226,6 +230,21 @@ public class LobbyMenu {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the selected figure to the player.
|
||||
*/
|
||||
private void applyFigure(int playerID) {
|
||||
Player currentPlayer = playerHandler.getPlayerById(playerID);
|
||||
|
||||
String selectedFigure = figureDropdown.getSelectedItem();
|
||||
if (selectedFigure != null && !selectedFigure.isEmpty()) {
|
||||
currentPlayer.setFigure(new Figure(0, 0, 0, Rotation.RIGHT, "selectedFigure"));
|
||||
System.out.println("Player figure set to: " + selectedFigure);
|
||||
} else {
|
||||
System.err.println("Invalid figure selection.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Lädt das Hintergrundbild und fügt es als geometrische Ebene hinzu.
|
||||
*/
|
||||
@ -293,14 +312,6 @@ public class LobbyMenu {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Schaltet den "Bereit"-Status um.
|
||||
*/
|
||||
private void toggleReady(Label playersLabel) {
|
||||
// Beispiel-Logik für das Umschalten des Status
|
||||
playersLabel.setText("Spielerstatus aktualisiert."); // Beispieltext
|
||||
}
|
||||
|
||||
/**
|
||||
* Geht zurück zum CreateGameMenu.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user