diff --git a/Projekte/mdga/model/src/main/java/pp/mdga/client/CeremonyState.java b/Projekte/mdga/model/src/main/java/pp/mdga/client/CeremonyState.java index dd83c91e..12ff870a 100644 --- a/Projekte/mdga/model/src/main/java/pp/mdga/client/CeremonyState.java +++ b/Projekte/mdga/model/src/main/java/pp/mdga/client/CeremonyState.java @@ -1,7 +1,15 @@ package pp.mdga.client; +import pp.mdga.client.ceremonyState.CeremonyStates; +import pp.mdga.client.ceremonyState.PodiumState; +import pp.mdga.client.ceremonyState.StatisticsState; + public class CeremonyState extends ClientState { + private CeremonyStates currentState; + + private final PodiumState podiumState = new PodiumState(this, logic); + private final StatisticsState statisticsState = new StatisticsState(this, logic); public CeremonyState(ClientState parent, ClientGameLogic logic) { super(parent, logic); @@ -9,11 +17,29 @@ public CeremonyState(ClientState parent, ClientGameLogic logic) { @Override public void enter() { - + currentState = podiumState; } @Override public void exit() { + currentState.exit(); + } + public void setState(CeremonyStates state){ + this.currentState.exit(); + state.enter(); + currentState = state; + } + + public PodiumState getPodiumState(){ + return podiumState; + } + + public StatisticsState getStatisticsState(){ + return statisticsState; + } + + public CeremonyStates getState(){ + return currentState; } } diff --git a/Projekte/mdga/model/src/main/java/pp/mdga/client/ClientGameLogic.java b/Projekte/mdga/model/src/main/java/pp/mdga/client/ClientGameLogic.java index 32cf9754..ad560205 100644 --- a/Projekte/mdga/model/src/main/java/pp/mdga/client/ClientGameLogic.java +++ b/Projekte/mdga/model/src/main/java/pp/mdga/client/ClientGameLogic.java @@ -26,6 +26,7 @@ public class ClientGameLogic implements ServerInterpreter { private final GameState gameState = new GameState(null, this); private final CeremonyState ceremonyState = new CeremonyState(null, this); private final InterruptState interruptState = new InterruptState(null, this); + private final SettingsState settingsState = new SettingsState(null, this); public ClientGameLogic(Game game, ClientSender clientSender) { this.game = game; @@ -286,6 +287,10 @@ public DialogsState getDialogs(){ return dialogsState; } + public SettingsState getSettings(){ + return settingsState; + } + public Notification getNotification(){ return notifications.remove(0); } diff --git a/Projekte/mdga/model/src/main/java/pp/mdga/client/SettingsState.java b/Projekte/mdga/model/src/main/java/pp/mdga/client/SettingsState.java index 88800cc8..969a08cf 100644 --- a/Projekte/mdga/model/src/main/java/pp/mdga/client/SettingsState.java +++ b/Projekte/mdga/model/src/main/java/pp/mdga/client/SettingsState.java @@ -1,18 +1,45 @@ package pp.mdga.client; +import pp.mdga.client.settingsState.AudioSettingsState; +import pp.mdga.client.settingsState.MainSettingsState; +import pp.mdga.client.settingsState.SettingStates; +import pp.mdga.client.settingsState.VideoSettingsState; + public class SettingsState extends ClientState { + private SettingStates currentState; + + private final MainSettingsState mainSettingsState = new MainSettingsState(this, logic); + private final AudioSettingsState audioSettingsState = new AudioSettingsState(this, logic); + private final VideoSettingsState videoSettingsState = new VideoSettingsState(this, logic); + public SettingsState(ClientState parent, ClientGameLogic logic) { super(parent, logic); } @Override public void enter() { - + currentState = mainSettingsState; } @Override public void exit() { + currentState.exit(); + } + public SettingStates getState(){ + return currentState; + } + + public MainSettingsState getMainSettingsState(){ + return mainSettingsState; + } + + public AudioSettingsState getAudioSettingsState(){ + return audioSettingsState; + } + + public VideoSettingsState getVideoSettingsState(){ + return videoSettingsState; } } diff --git a/Projekte/mdga/model/src/main/java/pp/mdga/client/ceremonyState/PodiumState.java b/Projekte/mdga/model/src/main/java/pp/mdga/client/ceremonyState/PodiumState.java index b6a5c535..199fde11 100644 --- a/Projekte/mdga/model/src/main/java/pp/mdga/client/ceremonyState/PodiumState.java +++ b/Projekte/mdga/model/src/main/java/pp/mdga/client/ceremonyState/PodiumState.java @@ -1,11 +1,16 @@ package pp.mdga.client.ceremonyState; +import pp.mdga.client.CeremonyState; import pp.mdga.client.ClientGameLogic; import pp.mdga.client.ClientState; public class PodiumState extends CeremonyStates { + + private final CeremonyState parent; + public PodiumState(ClientState parent, ClientGameLogic logic) { super(parent, logic); + this.parent = (CeremonyState) parent; } @Override @@ -17,4 +22,8 @@ public void enter() { public void exit() { } + + public void selectNext(){ + parent.setState(parent.getStatisticsState()); + } } diff --git a/Projekte/mdga/model/src/main/java/pp/mdga/client/gameState/DetermineStartPlayerState.java b/Projekte/mdga/model/src/main/java/pp/mdga/client/gameState/DetermineStartPlayerState.java index 0413ad9b..8b6480c6 100644 --- a/Projekte/mdga/model/src/main/java/pp/mdga/client/gameState/DetermineStartPlayerState.java +++ b/Projekte/mdga/model/src/main/java/pp/mdga/client/gameState/DetermineStartPlayerState.java @@ -43,4 +43,8 @@ public RollRankingDiceState getRollRankingDice() { public WaitRankingState getWaitRanking() { return waitRankingState; } + + public DetermineStartPlayerStates getState(){ + return state; + } } diff --git a/Projekte/mdga/model/src/main/java/pp/mdga/client/gameState/TurnState.java b/Projekte/mdga/model/src/main/java/pp/mdga/client/gameState/TurnState.java index c0af142d..055986cf 100644 --- a/Projekte/mdga/model/src/main/java/pp/mdga/client/gameState/TurnState.java +++ b/Projekte/mdga/model/src/main/java/pp/mdga/client/gameState/TurnState.java @@ -89,4 +89,8 @@ public RollDiceState getRollDice() { public GameState getParent(){ return parent; } + + public TurnStates getState(){ + return state; + } } diff --git a/Projekte/mdga/model/src/main/java/pp/mdga/client/settingsState/MainSettingsState.java b/Projekte/mdga/model/src/main/java/pp/mdga/client/settingsState/MainSettingsState.java index 8e1b3f25..5b1bde44 100644 --- a/Projekte/mdga/model/src/main/java/pp/mdga/client/settingsState/MainSettingsState.java +++ b/Projekte/mdga/model/src/main/java/pp/mdga/client/settingsState/MainSettingsState.java @@ -3,7 +3,7 @@ import pp.mdga.client.ClientGameLogic; import pp.mdga.client.ClientState; -public class MainSettingsState extends ClientState { +public class MainSettingsState extends SettingStates { public MainSettingsState(ClientState parent, ClientGameLogic logic) { super(parent, logic); } diff --git a/Projekte/mdga/model/src/main/java/pp/mdga/notification/CeremonyNotification.java b/Projekte/mdga/model/src/main/java/pp/mdga/notification/CeremonyNotification.java index 20a270dc..f7210f69 100644 --- a/Projekte/mdga/model/src/main/java/pp/mdga/notification/CeremonyNotification.java +++ b/Projekte/mdga/model/src/main/java/pp/mdga/notification/CeremonyNotification.java @@ -1,12 +1,156 @@ package pp.mdga.notification; +import pp.mdga.game.Color; + +import java.util.ArrayList; + /** * Class CeremonyNotification + * Represents a notification for a ceremony in the game. + * + * Index mapping: + * index = 0 ==> winner + * index = 1 ==> 2nd + * index = 2 ==> third place + * index = 3 ==> loser + * index = 4 ==> total */ -public class CeremonyNotification extends Notification{ +public class CeremonyNotification extends Notification { + private ArrayList colors; + private ArrayList names; + private ArrayList piecesThrown; + private ArrayList piecesLost; + private ArrayList bonusCardsPlayed; + private ArrayList sixes; + private ArrayList nodesMoved; + private ArrayList bonusNodes; + /** * Constructor + * Initializes all lists. */ public CeremonyNotification() { + this.colors = new ArrayList<>(); + this.names = new ArrayList<>(); + this.piecesThrown = new ArrayList<>(); + this.piecesLost = new ArrayList<>(); + this.bonusCardsPlayed = new ArrayList<>(); + this.sixes = new ArrayList<>(); + this.nodesMoved = new ArrayList<>(); + this.bonusNodes = new ArrayList<>(); + } + + // Getters and Setters + + /** + * @return the list of colors + */ + public ArrayList getColors() { + return colors; + } + + /** + * @param colors the list of colors to set + */ + public void setColors(ArrayList colors) { + this.colors = colors; + } + + /** + * @return the list of player names + */ + public ArrayList getNames() { + return names; + } + + /** + * @param names the list of player names to set + */ + public void setNames(ArrayList names) { + this.names = names; + } + + /** + * @return the list of pieces thrown + */ + public ArrayList getPiecesThrown() { + return piecesThrown; + } + + /** + * @param piecesThrown the list of pieces thrown to set + */ + public void setPiecesThrown(ArrayList piecesThrown) { + this.piecesThrown = piecesThrown; + } + + /** + * @return the list of pieces lost + */ + public ArrayList getPiecesLost() { + return piecesLost; + } + + /** + * @param piecesLost the list of pieces lost to set + */ + public void setPiecesLost(ArrayList piecesLost) { + this.piecesLost = piecesLost; + } + + /** + * @return the list of bonus cards played + */ + public ArrayList getBonusCardsPlayed() { + return bonusCardsPlayed; + } + + /** + * @param bonusCardsPlayed the list of bonus cards played to set + */ + public void setBonusCardsPlayed(ArrayList bonusCardsPlayed) { + this.bonusCardsPlayed = bonusCardsPlayed; + } + + /** + * @return the list of sixes rolled + */ + public ArrayList getSixes() { + return sixes; + } + + /** + * @param sixes the list of sixes rolled to set + */ + public void setSixes(ArrayList sixes) { + this.sixes = sixes; + } + + /** + * @return the list of nodes moved + */ + public ArrayList getNodesMoved() { + return nodesMoved; + } + + /** + * @param nodesMoved the list of nodes moved to set + */ + public void setNodesMoved(ArrayList nodesMoved) { + this.nodesMoved = nodesMoved; + } + + /** + * @return the list of bonus nodes + */ + public ArrayList getBonusNodes() { + return bonusNodes; + } + + /** + * @param bonusNodes the list of bonus nodes to set + */ + public void setBonusNodes(ArrayList bonusNodes) { + this.bonusNodes = bonusNodes; } }