saving the players

This commit is contained in:
Johannes Schmelz 2024-11-24 00:32:16 +01:00
parent d582c59a7d
commit e780513b35

View File

@ -5,6 +5,7 @@ import java.lang.System.Logger.Level;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import pp.monopoly.game.server.Player;
import pp.monopoly.message.client.ClientMessage; import pp.monopoly.message.client.ClientMessage;
import pp.monopoly.message.server.BuyPropertyResponse; import pp.monopoly.message.server.BuyPropertyResponse;
import pp.monopoly.message.server.DiceResult; import pp.monopoly.message.server.DiceResult;
@ -50,6 +51,8 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
/** The current state of the client game logic. */ /** The current state of the client game logic. */
private ClientState state = new LobbyState(this); private ClientState state = new LobbyState(this);
private List<Player> players;
/** /**
* Constructs a ClientGameLogic with the specified sender object. * Constructs a ClientGameLogic with the specified sender object.
* *
@ -80,6 +83,10 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
state.entry(); state.entry();
} }
public List<Player> getPlayers() {
return players;
}
/** /**
* Returns the player's game board. * Returns the player's game board.
* *
@ -236,6 +243,7 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
*/ */
@Override @Override
public void received(GameStart msg) { public void received(GameStart msg) {
players = msg.getPlayers();
setInfoText("The game has started! Good luck!"); setInfoText("The game has started! Good luck!");
setState(new WaitForTurnState(this)); setState(new WaitForTurnState(this));
} }