mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-24 22:49:44 +01:00
Compare commits
No commits in common. "fe68d991fca959dfac5fdebe621e85acb50bd219" and "c3a33b4402e526ce6a28a770f22ba26635004a7b" have entirely different histories.
fe68d991fc
...
c3a33b4402
@ -73,7 +73,7 @@ public class Toolbar extends Dialog {
|
||||
// Menü-Container: Ein Container für Würfel
|
||||
Container diceContainer = toolbarContainer.addChild(new Container());
|
||||
diceContainer.addChild(new Label("Wo Würfel?", new ElementId("label")));
|
||||
diceContainer.addChild(addDiceRollButton());
|
||||
diceContainer.addChild(new Button("Würfeln"));
|
||||
diceContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.4657f, 0.4735f, 0.4892f, 1.0f)));
|
||||
|
||||
// Menü-Container: Ein Nested-Container für Handeln, Grundstücke und Zug beenden
|
||||
@ -118,12 +118,11 @@ public class Toolbar extends Dialog {
|
||||
/**
|
||||
* Fügt den Würfel-Button hinzu, der die Figur entsprechend der gewürfelten Zahl bewegt.
|
||||
*/
|
||||
private Button addDiceRollButton() {
|
||||
private void addDiceRollButton() {
|
||||
Button diceButton = new Button("Würfeln");
|
||||
diceButton.setPreferredSize(new Vector3f(150, 50, 0)); // Größe des Buttons
|
||||
diceButton.addClickCommands(source -> rollDice());
|
||||
toolbarContainer.addChild(diceButton);
|
||||
return diceButton;
|
||||
}
|
||||
|
||||
private void addTradeMenuButton() {
|
||||
|
@ -246,12 +246,11 @@ public class ServerGameLogic implements ClientInterpreter {
|
||||
*/
|
||||
@Override
|
||||
public void received(ViewAssetsRequest msg, int from) {
|
||||
Player sender = playerHandler.getPlayerById(from);
|
||||
Player player = msg.getPlayer();
|
||||
if (sender != null && player != null) {
|
||||
LOGGER.log(Level.DEBUG, "Processing ViewAssetsRequest for player {0}", sender.getName());
|
||||
Player player = playerHandler.getPlayerById(from);
|
||||
if (player != null) {
|
||||
LOGGER.log(Level.DEBUG, "Processing ViewAssetsRequest for player {0}", player.getName());
|
||||
|
||||
send(sender, new ViewAssetsResponse(boardManager, player.getProperties(), player.getAccountBalance(), player.getNumJailCard()));
|
||||
send(player, new ViewAssetsResponse(player.getProperties(), player.getAccountBalance(), player.getNumJailCard()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,25 +1,12 @@
|
||||
package pp.monopoly.message.client;
|
||||
|
||||
import pp.monopoly.game.server.Player;
|
||||
|
||||
/**
|
||||
* Represents a request from a player to view their assets.
|
||||
*/
|
||||
public class ViewAssetsRequest extends ClientMessage{
|
||||
|
||||
private final Player player;
|
||||
|
||||
public ViewAssetsRequest(Player player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(ClientInterpreter interpreter, int from) {
|
||||
interpreter.received(this, from);
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
}
|
@ -2,16 +2,13 @@ package pp.monopoly.message.server;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import pp.monopoly.model.fields.BoardManager;
|
||||
import pp.monopoly.model.fields.PropertyField;
|
||||
|
||||
/**
|
||||
* Represents a response containing the player's assets.
|
||||
*/
|
||||
public class ViewAssetsResponse extends ServerMessage{
|
||||
|
||||
private final List<PropertyField> properties;
|
||||
private final BoardManager board;
|
||||
private final int accountBalance;
|
||||
private final int jailCards;
|
||||
|
||||
@ -21,8 +18,7 @@ public class ViewAssetsResponse extends ServerMessage{
|
||||
* @param properties a List of PropertyField objects representing the player's properties
|
||||
* @param accountBalance the player's current account balance
|
||||
*/
|
||||
public ViewAssetsResponse(BoardManager board, List<PropertyField> properties, int accountBalance, int jailCards) {
|
||||
this.board = board;
|
||||
public ViewAssetsResponse(List<PropertyField> properties, int accountBalance, int jailCards) {
|
||||
this.properties = properties;
|
||||
this.accountBalance = accountBalance;
|
||||
this.jailCards = jailCards;
|
||||
@ -51,7 +47,4 @@ public class ViewAssetsResponse extends ServerMessage{
|
||||
return jailCards;
|
||||
}
|
||||
|
||||
public BoardManager getboard() {
|
||||
return board;
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ public class BoardManager {
|
||||
* Creates a Monopoly GameBoard
|
||||
* @return the List of Fields in correct Order
|
||||
*/
|
||||
private List<Field> createBoard() {
|
||||
private static List<Field> createBoard() {
|
||||
ArrayList<Field> fields = new ArrayList<>();
|
||||
|
||||
fields.add(new GoField());
|
||||
@ -88,8 +88,4 @@ public class BoardManager {
|
||||
if (board.contains(field)) return field.getId();
|
||||
else throw new NoSuchElementException();
|
||||
}
|
||||
|
||||
public List<Field> getBoard() {
|
||||
return board;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user