added all current State getter in every client state machine
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,4 +43,8 @@ public RollRankingDiceState getRollRankingDice() {
|
||||
public WaitRankingState getWaitRanking() {
|
||||
return waitRankingState;
|
||||
}
|
||||
|
||||
public DetermineStartPlayerStates getState(){
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,4 +89,8 @@ public RollDiceState getRollDice() {
|
||||
public GameState getParent(){
|
||||
return parent;
|
||||
}
|
||||
|
||||
public TurnStates getState(){
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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<Color> colors;
|
||||
private ArrayList<String> names;
|
||||
private ArrayList<Integer> piecesThrown;
|
||||
private ArrayList<Integer> piecesLost;
|
||||
private ArrayList<Integer> bonusCardsPlayed;
|
||||
private ArrayList<Integer> sixes;
|
||||
private ArrayList<Integer> nodesMoved;
|
||||
private ArrayList<Integer> 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<Color> getColors() {
|
||||
return colors;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param colors the list of colors to set
|
||||
*/
|
||||
public void setColors(ArrayList<Color> colors) {
|
||||
this.colors = colors;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list of player names
|
||||
*/
|
||||
public ArrayList<String> getNames() {
|
||||
return names;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param names the list of player names to set
|
||||
*/
|
||||
public void setNames(ArrayList<String> names) {
|
||||
this.names = names;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list of pieces thrown
|
||||
*/
|
||||
public ArrayList<Integer> getPiecesThrown() {
|
||||
return piecesThrown;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param piecesThrown the list of pieces thrown to set
|
||||
*/
|
||||
public void setPiecesThrown(ArrayList<Integer> piecesThrown) {
|
||||
this.piecesThrown = piecesThrown;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list of pieces lost
|
||||
*/
|
||||
public ArrayList<Integer> getPiecesLost() {
|
||||
return piecesLost;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param piecesLost the list of pieces lost to set
|
||||
*/
|
||||
public void setPiecesLost(ArrayList<Integer> piecesLost) {
|
||||
this.piecesLost = piecesLost;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list of bonus cards played
|
||||
*/
|
||||
public ArrayList<Integer> getBonusCardsPlayed() {
|
||||
return bonusCardsPlayed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bonusCardsPlayed the list of bonus cards played to set
|
||||
*/
|
||||
public void setBonusCardsPlayed(ArrayList<Integer> bonusCardsPlayed) {
|
||||
this.bonusCardsPlayed = bonusCardsPlayed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list of sixes rolled
|
||||
*/
|
||||
public ArrayList<Integer> getSixes() {
|
||||
return sixes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param sixes the list of sixes rolled to set
|
||||
*/
|
||||
public void setSixes(ArrayList<Integer> sixes) {
|
||||
this.sixes = sixes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list of nodes moved
|
||||
*/
|
||||
public ArrayList<Integer> getNodesMoved() {
|
||||
return nodesMoved;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nodesMoved the list of nodes moved to set
|
||||
*/
|
||||
public void setNodesMoved(ArrayList<Integer> nodesMoved) {
|
||||
this.nodesMoved = nodesMoved;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list of bonus nodes
|
||||
*/
|
||||
public ArrayList<Integer> getBonusNodes() {
|
||||
return bonusNodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bonusNodes the list of bonus nodes to set
|
||||
*/
|
||||
public void setBonusNodes(ArrayList<Integer> bonusNodes) {
|
||||
this.bonusNodes = bonusNodes;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user