merge development into test #22
@@ -1,7 +1,15 @@
|
|||||||
package pp.mdga.client;
|
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 {
|
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) {
|
public CeremonyState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
@@ -9,11 +17,29 @@ public CeremonyState(ClientState parent, ClientGameLogic logic) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
|
currentState = podiumState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
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 GameState gameState = new GameState(null, this);
|
||||||
private final CeremonyState ceremonyState = new CeremonyState(null, this);
|
private final CeremonyState ceremonyState = new CeremonyState(null, this);
|
||||||
private final InterruptState interruptState = new InterruptState(null, this);
|
private final InterruptState interruptState = new InterruptState(null, this);
|
||||||
|
private final SettingsState settingsState = new SettingsState(null, this);
|
||||||
|
|
||||||
public ClientGameLogic(Game game, ClientSender clientSender) {
|
public ClientGameLogic(Game game, ClientSender clientSender) {
|
||||||
this.game = game;
|
this.game = game;
|
||||||
@@ -286,6 +287,10 @@ public DialogsState getDialogs(){
|
|||||||
return dialogsState;
|
return dialogsState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SettingsState getSettings(){
|
||||||
|
return settingsState;
|
||||||
|
}
|
||||||
|
|
||||||
public Notification getNotification(){
|
public Notification getNotification(){
|
||||||
return notifications.remove(0);
|
return notifications.remove(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,45 @@
|
|||||||
package pp.mdga.client;
|
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 {
|
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) {
|
public SettingsState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
|
currentState = mainSettingsState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
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;
|
package pp.mdga.client.ceremonyState;
|
||||||
|
|
||||||
|
import pp.mdga.client.CeremonyState;
|
||||||
import pp.mdga.client.ClientGameLogic;
|
import pp.mdga.client.ClientGameLogic;
|
||||||
import pp.mdga.client.ClientState;
|
import pp.mdga.client.ClientState;
|
||||||
|
|
||||||
public class PodiumState extends CeremonyStates {
|
public class PodiumState extends CeremonyStates {
|
||||||
|
|
||||||
|
private final CeremonyState parent;
|
||||||
|
|
||||||
public PodiumState(ClientState parent, ClientGameLogic logic) {
|
public PodiumState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
|
this.parent = (CeremonyState) parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -17,4 +22,8 @@ public void enter() {
|
|||||||
public void exit() {
|
public void exit() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void selectNext(){
|
||||||
|
parent.setState(parent.getStatisticsState());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,4 +43,8 @@ public RollRankingDiceState getRollRankingDice() {
|
|||||||
public WaitRankingState getWaitRanking() {
|
public WaitRankingState getWaitRanking() {
|
||||||
return waitRankingState;
|
return waitRankingState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DetermineStartPlayerStates getState(){
|
||||||
|
return state;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,4 +89,8 @@ public RollDiceState getRollDice() {
|
|||||||
public GameState getParent(){
|
public GameState getParent(){
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TurnStates getState(){
|
||||||
|
return state;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import pp.mdga.client.ClientGameLogic;
|
import pp.mdga.client.ClientGameLogic;
|
||||||
import pp.mdga.client.ClientState;
|
import pp.mdga.client.ClientState;
|
||||||
|
|
||||||
public class MainSettingsState extends ClientState {
|
public class MainSettingsState extends SettingStates {
|
||||||
public MainSettingsState(ClientState parent, ClientGameLogic logic) {
|
public MainSettingsState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,156 @@
|
|||||||
package pp.mdga.notification;
|
package pp.mdga.notification;
|
||||||
|
|
||||||
|
import pp.mdga.game.Color;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CeremonyNotification
|
* 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
|
* Constructor
|
||||||
|
* Initializes all lists.
|
||||||
*/
|
*/
|
||||||
public CeremonyNotification() {
|
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