diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/multiplayer/client/Client.java b/src/main/java/ch/unibas/dmi/dbis/cs108/multiplayer/client/Client.java index 436f601..6ad5608 100644 --- a/src/main/java/ch/unibas/dmi/dbis/cs108/multiplayer/client/Client.java +++ b/src/main/java/ch/unibas/dmi/dbis/cs108/multiplayer/client/Client.java @@ -283,6 +283,10 @@ public class Client { return out; } + public int getPosition() { + return position; + } + public void sendToChat(String substring) { chatApp.getChatController().addChatMsgToView(substring); } diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/multiplayer/client/gui/GameStateModel.java b/src/main/java/ch/unibas/dmi/dbis/cs108/multiplayer/client/gui/GameStateModel.java new file mode 100644 index 0000000..67fa925 --- /dev/null +++ b/src/main/java/ch/unibas/dmi/dbis/cs108/multiplayer/client/gui/GameStateModel.java @@ -0,0 +1,40 @@ +package ch.unibas.dmi.dbis.cs108.multiplayer.client.gui; + +/** + * A Class that saves the current game State of the Game the client is in. Should get updated regularly + * The gui gets its game information from here + */ +public class GameStateModel { + private int nrOfPlayers; //sets the length of the train + /** + * true if it is the day + */ + private boolean isDayClone; + + /** + * A primitive clone of the passengerTrain in the GameState of the server. + * in passengerTrainClone[0] the names of the passengers are stored, in passengerTrainClone[1] the roles + * (human/ghost/spectator). The indices of the array correspond with the positions + */ + private String[][] passengerTrainClone; + + /** + * Constructs a GamesStateModel with the passengerTrainClone length at nrOfPlayers + * @param nrOfPlayers the amount of different objects to be saved + */ + public void GameStateModel(int nrOfPlayers) { + this.nrOfPlayers = nrOfPlayers; + passengerTrainClone = new String[2][nrOfPlayers]; + } + + /** + * Updates the passengerTrainClone + * @param names an array of the names of the players + * @param roles an array of the roles, should be in the form g/h/s + */ + public void setPassengerTrainClone(String[] names, String[] roles) { + passengerTrainClone[0] = names; + passengerTrainClone[1] = roles; + + } +}