refactored the whole client package structure

This commit is contained in:
Fleischer Hanno
2024-11-25 17:43:29 +01:00
parent 7178935553
commit 7eafa3da39
71 changed files with 457 additions and 233 deletions

View File

@@ -1,7 +0,0 @@
package pp.mdga.client;
public class Animation extends ClientState {
public Animation(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.client;
public class AudioSettings extends ClientState {
public AudioSettings(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,5 +1,7 @@
package pp.mdga.client;
import pp.mdga.client.ceremonyState.CeremonyStateMachine;
public class Ceremony extends ClientState {
private final CeremonyStateMachine ceremonyStateMachine;

View File

@@ -1,12 +0,0 @@
package pp.mdga.client;
public class ChoosePieceStateMachine extends ClientStateMachine{
public ChoosePieceStateMachine(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
@Override
public NoPiece initialState() {
return new NoPiece(this, logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.client;
public class ChoosePowerCard extends ClientState {
public ChoosePowerCard(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -2,13 +2,23 @@
public class ClientAutomaton extends ClientStateMachine {
private Dialogs dialogs;
private Ceremony ceremony;
private Game game;
private Interrupt interrupt;
public ClientAutomaton(ClientGameLogic logic){
super(null, logic);
dialogs = new Dialogs(this, logic);
ceremony = new Ceremony(this, logic);
game = new Game(this, logic);
entry();
}
@Override
public Dialogs initialState(){
return new Dialogs(this, logic);
return dialogs;
}
}

View File

@@ -1,5 +1,6 @@
package pp.mdga.client;
import pp.mdga.client.gameState.turnState.choosePieceState.StartPiece;
import pp.mdga.game.Game;
import pp.mdga.message.client.ClientMessage;
import pp.mdga.message.server.*;

View File

@@ -1,8 +0,0 @@
package pp.mdga.client;
public abstract class DialogStates extends ClientState{
public DialogStates(ClientState parent, ClientGameLogic logic){
super(parent, logic);
}
}

View File

@@ -1,5 +1,7 @@
package pp.mdga.client;
import pp.mdga.client.dialogState.DialogsStateMachine;
public class Dialogs extends ClientState {
private final DialogsStateMachine dialogsStateMachine;

View File

@@ -1,9 +1,11 @@
package pp.mdga.client;
public class GameState extends ClientState {
import pp.mdga.client.gameState.GameStateMachine;
public class Game extends ClientState {
private final GameStateMachine gameStateMachine;
public GameState(ClientState parent, ClientGameLogic logic) {
public Game(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
this.gameStateMachine = new GameStateMachine(parent, logic);
}

View File

@@ -2,9 +2,9 @@
public class Interrupt extends ClientState {
private final GameState lastState;
private final Game lastState;
public Interrupt(ClientState parent, ClientGameLogic logic, GameState lastState) {
public Interrupt(ClientState parent, ClientGameLogic logic, Game lastState) {
super(parent, logic);
this.lastState = lastState;
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.client;
public class Lobby extends ClientState {
public Lobby(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.client;
public class MovePiece extends ClientState {
public MovePiece(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.client;
public class NetworkDialog extends ClientState {
public NetworkDialog(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.client;
public class NoPiece extends ClientState {
public NoPiece(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.client;
public class PlayPowerCard extends ClientState {
public PlayPowerCard(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.client;
public class RollDice extends ClientState {
public RollDice(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.client;
public class RollRankingDice extends ClientState {
public RollRankingDice(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.client;
public class SelectPiece extends ClientState {
public SelectPiece(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,5 +1,7 @@
package pp.mdga.client;
import pp.mdga.client.settingsState.SettingsStateMachine;
public class Settings extends ClientState {
private final SettingsStateMachine settingsStateMachine;

View File

@@ -1,7 +0,0 @@
package pp.mdga.client;
public class Shield extends ClientState {
public Shield(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.client;
public class Spectator extends ClientState {
public Spectator(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.client;
public class StartPiece extends ClientState {
public StartPiece(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.client;
public class Swap extends ClientState {
public Swap(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.client;
public class VideoSettings extends ClientState {
public VideoSettings(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.client;
public class WaitRanking extends ClientState {
public WaitRanking(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.client;
public class Waiting extends ClientState {
public Waiting(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +0,0 @@
package pp.mdga.client;
public class WaitingPiece extends ClientState {
public WaitingPiece(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,4 +1,8 @@
package pp.mdga.client;
package pp.mdga.client.ceremonyState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.client.ClientStateMachine;
public class CeremonyStateMachine extends ClientStateMachine {

View File

@@ -1,4 +1,7 @@
package pp.mdga.client;
package pp.mdga.client.ceremonyState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class Podium extends ClientState {
public Podium(ClientState parent, ClientGameLogic logic) {

View File

@@ -1,4 +1,7 @@
package pp.mdga.client;
package pp.mdga.client.ceremonyState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class Statistics extends ClientState {
public Statistics(ClientState parent, ClientGameLogic logic) {

View File

@@ -0,0 +1,11 @@
package pp.mdga.client.dialogState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public abstract class DialogStates extends ClientState {
public DialogStates(ClientState parent, ClientGameLogic logic){
super(parent, logic);
}
}

View File

@@ -1,4 +1,8 @@
package pp.mdga.client;
package pp.mdga.client.dialogState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.client.ClientStateMachine;
public class DialogsStateMachine extends ClientStateMachine {
public DialogsStateMachine(ClientState parent, ClientGameLogic logic) {

View File

@@ -0,0 +1,10 @@
package pp.mdga.client.dialogState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class Lobby extends DialogStates {
public Lobby(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -0,0 +1,10 @@
package pp.mdga.client.dialogState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class NetworkDialog extends DialogStates {
public NetworkDialog(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,4 +1,7 @@
package pp.mdga.client;
package pp.mdga.client.dialogState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class StartDialog extends DialogStates {
public StartDialog(ClientState parent, ClientGameLogic logic) {

View File

@@ -0,0 +1,10 @@
package pp.mdga.client.gameState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class Animation extends GameStates {
public Animation(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,6 +1,10 @@
package pp.mdga.client;
package pp.mdga.client.gameState;
public class DetermineStartPlayer extends ClientState {
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.client.gameState.determineStartPlayer.DetermineStartPlayerStateMachine;
public class DetermineStartPlayer extends GameStates {
private final DetermineStartPlayerStateMachine determineStartPlayerStateMachine;
public DetermineStartPlayer(ClientState parent, ClientGameLogic logic) {

View File

@@ -1,4 +1,8 @@
package pp.mdga.client;
package pp.mdga.client.gameState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.client.ClientStateMachine;
public class GameStateMachine extends ClientStateMachine {
public GameStateMachine(ClientState parent, ClientGameLogic logic) {

View File

@@ -0,0 +1,10 @@
package pp.mdga.client.gameState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public abstract class GameStates extends ClientState {
public GameStates(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -0,0 +1,10 @@
package pp.mdga.client.gameState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class Spectator extends GameStates {
public Spectator(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,6 +1,10 @@
package pp.mdga.client;
package pp.mdga.client.gameState;
public class Turn extends ClientState {
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.client.gameState.turnState.TurnStateMachine;
public class Turn extends GameStates {
private final TurnStateMachine turnStateMachine;
public Turn(ClientState parent, ClientGameLogic logic) {

View File

@@ -0,0 +1,10 @@
package pp.mdga.client.gameState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class Waiting extends GameStates {
public Waiting(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,6 +1,11 @@
package pp.mdga.client;
package pp.mdga.client.gameState.determineStartPlayer;
public class DetermineStartPlayerStateMachine extends ClientStateMachine{
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.client.ClientStateMachine;
import pp.mdga.client.RollRankingDice;
public class DetermineStartPlayerStateMachine extends ClientStateMachine {
public DetermineStartPlayerStateMachine(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}

View File

@@ -0,0 +1,11 @@
package pp.mdga.client.gameState.determineStartPlayerState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.client.gameState.GameStates;
public class DetermineStartPlayerStates extends GameStates {
public DetermineStartPlayerStates(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -0,0 +1,11 @@
package pp.mdga.client.gameState.determineStartPlayerState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.client.gameState.determineStartPlayer.DetermineStartPlayerStates;
public class RollRankingDice extends DetermineStartPlayerStates {
public RollRankingDice(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -0,0 +1,11 @@
package pp.mdga.client.gameState.determineStartPlayerState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.client.gameState.GameStates;
public class WaitRanking extends GameStates {
public WaitRanking(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,6 +1,10 @@
package pp.mdga.client;
package pp.mdga.client.gameState.turnState;
public class ChoosePiece extends ClientState {
import pp.mdga.client.gameState.turnState.choosePieceState.ChoosePieceStateMachine;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class ChoosePiece extends TurnStates {
private final ChoosePieceStateMachine choosePieceStateMachine;

View File

@@ -0,0 +1,10 @@
package pp.mdga.client.gameState.turnState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class MovePiece extends TurnStates {
public MovePiece(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -0,0 +1,10 @@
package pp.mdga.client.gameState.turnState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class PlayPowerCard extends TurnStates {
public PlayPowerCard(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,6 +1,10 @@
package pp.mdga.client;
package pp.mdga.client.gameState.turnState;
public class PowerCard extends ClientState {
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.client.gameState.turnState.powerCardState.PowerCardStateMachine;
public class PowerCard extends TurnStates {
private final PowerCardStateMachine powerCardStateMachine;
public PowerCard(ClientState parent, ClientGameLogic logic) {

View File

@@ -0,0 +1,10 @@
package pp.mdga.client.gameState.turnState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class RollDice extends TurnStates {
public RollDice(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,4 +1,8 @@
package pp.mdga.client;
package pp.mdga.client.gameState.turnState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.client.ClientStateMachine;
public class TurnStateMachine extends ClientStateMachine {
public TurnStateMachine(ClientState parent, ClientGameLogic logic) {

View File

@@ -0,0 +1,11 @@
package pp.mdga.client.gameState.turnState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.client.gameState.GameStates;
public abstract class TurnStates extends GameStates {
public TurnStates(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -0,0 +1,16 @@
package pp.mdga.client.gameState.turnState.choosePieceState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.client.ClientStateMachine;
public class ChoosePieceStateMachine extends ClientStateMachine {
public ChoosePieceStateMachine(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
@Override
public NoPiece initialState() {
return new NoPiece(this, logic);
}
}

View File

@@ -0,0 +1,11 @@
package pp.mdga.client.gameState.turnState.choosePieceState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.client.gameState.turnState.TurnStates;
public abstract class ChoosePieceStates extends TurnStates {
public ChoosePieceStates(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -0,0 +1,10 @@
package pp.mdga.client.gameState.turnState.choosePieceState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class NoPiece extends ChoosePieceStates {
public NoPiece(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -0,0 +1,10 @@
package pp.mdga.client.gameState.turnState.choosePieceState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class SelectPiece extends ChoosePieceStates {
public SelectPiece(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -0,0 +1,10 @@
package pp.mdga.client.gameState.turnState.choosePieceState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class StartPiece extends ChoosePieceStates {
public StartPiece(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -0,0 +1,10 @@
package pp.mdga.client.gameState.turnState.choosePieceState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class WaitingPiece extends ChoosePieceStates {
public WaitingPiece(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -0,0 +1,10 @@
package pp.mdga.client.gameState.turnState.powerCardState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class ChoosePowerCard extends PowerCardStates {
public ChoosePowerCard(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,4 +1,8 @@
package pp.mdga.client;
package pp.mdga.client.gameState.turnState.powerCardState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.client.ClientStateMachine;
public class PowerCardStateMachine extends ClientStateMachine {
public PowerCardStateMachine(ClientState parent, ClientGameLogic logic) {

View File

@@ -0,0 +1,11 @@
package pp.mdga.client.gameState.turnState.powerCardState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.client.gameState.turnState.TurnStates;
public abstract class PowerCardStates extends TurnStates {
public PowerCardStates(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -0,0 +1,10 @@
package pp.mdga.client.gameState.turnState.powerCardState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class Shield extends PowerCardStates {
public Shield(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -0,0 +1,10 @@
package pp.mdga.client.gameState.turnState.powerCardState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class Swap extends PowerCardStates {
public Swap(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -0,0 +1,10 @@
package pp.mdga.client.settingsState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class AudioSettings extends SettingStates {
public AudioSettings(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,4 +1,7 @@
package pp.mdga.client;
package pp.mdga.client.settingsState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class MainSettings extends ClientState {
public MainSettings(ClientState parent, ClientGameLogic logic) {

View File

@@ -0,0 +1,10 @@
package pp.mdga.client.settingsState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public abstract class SettingStates extends ClientState {
public SettingStates(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,4 +1,8 @@
package pp.mdga.client;
package pp.mdga.client.settingsState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.client.ClientStateMachine;
public class SettingsStateMachine extends ClientStateMachine {
public SettingsStateMachine(ClientState parent, ClientGameLogic logic) {

View File

@@ -0,0 +1,10 @@
package pp.mdga.client.settingsState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class VideoSettings extends SettingStates {
public VideoSettings(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -4,10 +4,28 @@
import org.junit.Test;
import pp.mdga.client.*;
import pp.mdga.client.Ceremony;
import pp.mdga.client.StartPiece;
import pp.mdga.client.ceremonyState.CeremonyStateMachine;
import pp.mdga.client.ceremonyState.Podium;
import pp.mdga.client.ceremonyState.Statistics;
import pp.mdga.client.dialogState.DialogsStateMachine;
import pp.mdga.client.dialogState.Lobby;
import pp.mdga.client.dialogState.NetworkDialog;
import pp.mdga.client.dialogState.StartDialog;
import pp.mdga.client.gameState.*;
import pp.mdga.client.gameState.turnState.choosePieceState.*;
import pp.mdga.client.gameState.determineStartPlayer.DetermineStartPlayerStateMachine;
import pp.mdga.client.gameState.turnState.*;
import pp.mdga.client.gameState.turnState.powerCardState.ChoosePowerCard;
import pp.mdga.client.gameState.turnState.powerCardState.PowerCardStateMachine;
import pp.mdga.client.gameState.turnState.powerCardState.Shield;
import pp.mdga.client.gameState.turnState.powerCardState.Swap;
import pp.mdga.client.Settings;
import pp.mdga.client.settingsState.AudioSettings;
import pp.mdga.client.settingsState.MainSettings;
import pp.mdga.client.settingsState.SettingsStateMachine;
import pp.mdga.client.settingsState.VideoSettings;
import pp.mdga.game.BonusCard;
import pp.mdga.game.Color;
import pp.mdga.game.Game;
import pp.mdga.message.client.ClientMessage;
import java.util.ArrayList;
@@ -35,7 +53,7 @@ public class ClientStateTest {
private DetermineStartPlayerStateMachine determineStartPlayerStateMachine;
private Dialogs dialogs;
private DialogsStateMachine dialogsStateMachine;
private GameState gameState;
private Game gameState;
private GameStateMachine gameStateMachine;
private Interrupt interrupt;
private Lobby lobby;
@@ -104,12 +122,12 @@ public class ClientStateTest {
private BonusCard shieldCard;
private BonusCard turboCard;
private Game game;
private pp.mdga.game.Game game;
@Before
public void setUp() {
//initialize the game
game = new Game();
game = new pp.mdga.game.Game();
//initialize the playerID
from=1234;
@@ -179,7 +197,7 @@ public void send(ClientMessage msg) {
//initialize the states
dialogs = new Dialogs(clientAutomaton,clientGameLogic);
gameState = new GameState(clientAutomaton,clientGameLogic);
gameState = new Game(clientAutomaton,clientGameLogic);
ceremony = new Ceremony(clientAutomaton,clientGameLogic);
interrupt = new Interrupt(clientAutomaton,clientGameLogic,gameState);
@@ -243,10 +261,10 @@ public void testDialogsToGame() {
clientGameLogic.receive(startGame);
//tests if the client is in the gameState after receiving the message
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
//tests if the new State of the GameStateMachine is in DetermineStartPlayer
GameState gameState1 = (GameState) clientAutomaton.getState();
Game gameState1 = (Game) clientAutomaton.getState();
GameStateMachine gameStateMachine1 = gameState1.getGameStateMachine();
assertTrue(gameStateMachine1.getState() instanceof DetermineStartPlayer);
@@ -272,7 +290,7 @@ public void testDialogsToClientStateEndState() {
public void testClientGameToCeremony() {
//sends the ClientAutomaton in GameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
//sends the Ceremony-Message to the client
clientGameLogic.receive(ceremonyMessage);
@@ -295,7 +313,7 @@ public void testClientGameSubStatesToInterrupt() {
clientAutomaton.gotoState(gameState);
//tests if the client is in GameState
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
//sends the Ceremony-Message to the client
clientGameLogic.receive(interrupt);
@@ -338,7 +356,7 @@ public void testClientInterruptToGame() {
//Todo sends the continue-message
//tests if the client is in the game
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
}
/**
@@ -562,10 +580,10 @@ public void testLobbyToRollRankingDice() {
clientGameLogic.receive();//TODO message
//tests if the clientStateMachine is in the GameState
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
//tests if the clientStateMachine is in the DetermineStartPlayer
GameState gameState1 = (GameState) clientAutomaton.getState();
Game gameState1 = (Game) clientAutomaton.getState();
GameStateMachine gameStateMachine1 = gameState1.getGameStateMachine();
assertTrue(gameStateMachine1.getState() instanceof DetermineStartPlayer);
@@ -590,7 +608,7 @@ public void testDetermineStartPlayerToWait() {
public void testWaitToAnimation() {
//sends the ClientAutomaton in GameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
//sends the client in WaitState
gameStateMachine.gotoState(waiting);
@@ -598,7 +616,7 @@ public void testWaitToAnimation() {
//tests if a piece is moved,that the client goes into Animation
clientGameLogic.receive(moveMessage); //Todo ??? richtige message
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
assertTrue(gameStateMachine.getState() instanceof Animation);
//sends the client in WaitState
@@ -607,7 +625,7 @@ public void testWaitToAnimation() {
//tests if a powerCard is played,that the client goes into Animation
clientGameLogic.receive(playCardTurbo); //Todo ??? richtige message
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
assertTrue(gameStateMachine.getState() instanceof Animation);
//sends the client in WaitState
@@ -616,7 +634,7 @@ public void testWaitToAnimation() {
//tests if a die is rolled,that the client goes into Animation
clientGameLogic.receive(dice); //Todo ??? richtige message
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
assertTrue(gameStateMachine.getState() instanceof Animation);
}
@@ -627,7 +645,7 @@ public void testWaitToAnimation() {
public void testWaitToTurn() {
//sends client in gameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
//sends the gameStateMachine in the Waiting
gameStateMachine.gotoState(waiting);
@@ -637,7 +655,7 @@ public void testWaitToTurn() {
clientGameLogic.receive(activePlayer);
//tests if the client is in GameState
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
//tests if Client is in Turn
assertTrue(gameStateMachine.getState() instanceof Turn);
@@ -714,7 +732,7 @@ public void testPowerCardSubStatesToRollDice() {
public void testStayInPlayPowerCard() {
//sends the ClientAutomaton in GameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
//sends the gameStateMachine in the Turn
gameStateMachine.gotoState(turn);
@@ -727,7 +745,7 @@ public void testStayInPlayPowerCard() {
//Todo send messages to test to stay in playPowerCard
//tests if the client is in PlayPowerCard
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
assertTrue(gameStateMachine.getState() instanceof Turn);
assertTrue(turnStateMachine.getState() instanceof PlayPowerCard);
}
@@ -739,7 +757,7 @@ public void testStayInPlayPowerCard() {
public void testPlayPowerCardToRollDice() {
//sends the ClientAutomaton in GameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
//sends the gameStateMachine in the Turn
gameStateMachine.gotoState(turn);
@@ -753,7 +771,7 @@ public void testPlayPowerCardToRollDice() {
//Todo test other messages, that there is no state change
//tests if the client is in RollDice
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
assertTrue(gameStateMachine.getState() instanceof Turn);
assertTrue(turnStateMachine.getState() instanceof RollDice);
}
@@ -839,7 +857,7 @@ public void testChoosePowerCardToRollDice() {
//TODO
//sends the ClientAutomaton in GameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
//sends the gameStateMachine in the Turn
gameStateMachine.gotoState(turn);
@@ -856,7 +874,7 @@ public void testChoosePowerCardToRollDice() {
//todo send the messages, to force a state change to rollDice
//tests if the turnStateMachine is in RollDice
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
assertTrue(gameStateMachine.getState() instanceof Turn);
assertTrue(turnStateMachine.getState() instanceof RollDice);
}
@@ -868,7 +886,7 @@ public void testChoosePowerCardToRollDice() {
public void testChoosePowerCardToSwap() {
//sends the ClientAutomaton in GameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
//sends the gameStateMachine in the Turn
gameStateMachine.gotoState(turn);
@@ -885,7 +903,7 @@ public void testChoosePowerCardToSwap() {
//todo send the messages, to force a state change to swap
//tests if the client is in Swap
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
assertTrue(gameStateMachine.getState() instanceof Turn);
assertTrue(turnStateMachine.getState() instanceof PowerCard);
assertTrue(powerCardStateMachine.getState() instanceof Swap);
@@ -898,7 +916,7 @@ public void testChoosePowerCardToSwap() {
public void testChoosePowerCardToShield() {
//sends the ClientAutomaton in GameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
//sends the gameStateMachine in the Turn
gameStateMachine.gotoState(turn);
@@ -915,7 +933,7 @@ public void testChoosePowerCardToShield() {
//todo send the messages, to force a state change to shield
//tests if the client is in Shield
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
assertTrue(gameStateMachine.getState() instanceof Turn);
assertTrue(turnStateMachine.getState() instanceof PowerCard);
assertTrue(powerCardStateMachine.getState() instanceof Shield);
@@ -928,7 +946,7 @@ public void testChoosePowerCardToShield() {
public void testStayInShield() {
//sends the ClientAutomaton in GameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
//sends the gameStateMachine in the Turn
gameStateMachine.gotoState(turn);
@@ -945,7 +963,7 @@ public void testStayInShield() {
//todo send the messages, which dont force a statechange
//tests if the client is in PlayPowerCard
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
assertTrue(gameStateMachine.getState() instanceof Turn);
assertTrue(turnStateMachine.getState() instanceof PowerCard);
assertTrue(powerCardStateMachine.getState() instanceof PlayPowerCard);
@@ -958,7 +976,7 @@ public void testStayInShield() {
public void testShieldToPowerCardEndState() {
//sends the ClientAutomaton in GameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
//sends the gameStateMachine in the Turn
gameStateMachine.gotoState(turn);
@@ -976,7 +994,7 @@ public void testShieldToPowerCardEndState() {
//todo send the message to force the statechange
//tests if the client is in PlayPowerCard
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
assertTrue(gameStateMachine.getState() instanceof Turn);
assertTrue(turnStateMachine.getState() instanceof PlayPowerCard);
}
@@ -988,7 +1006,7 @@ public void testShieldToPowerCardEndState() {
public void testSwapToPowerCardEndState() {
//sends the ClientAutomaton in GameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
//sends the gameStateMachine in the Turn
gameStateMachine.gotoState(turn);
@@ -1005,7 +1023,7 @@ public void testSwapToPowerCardEndState() {
//todo send the message to force the statechange
//tests if the client is in PlayPowerCard
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
assertTrue(gameStateMachine.getState() instanceof Turn);
assertTrue(turnStateMachine.getState() instanceof PlayPowerCard);
}
@@ -1017,7 +1035,7 @@ public void testSwapToPowerCardEndState() {
public void testNoPieceInWaitingPiece() {
//sends the ClientAutomaton in GameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
//sends the gameStateMachine in the Turn
gameStateMachine.gotoState(turn);
@@ -1036,7 +1054,7 @@ public void testNoPieceInWaitingPiece() {
//sends to the clientGameLogic the message WaitPiece
clientGameLogic.receive(waitPiece);
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
assertTrue(gameStateMachine.getState() instanceof Turn);
assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
assertTrue(choosePieceStateMachine.getState() instanceof WaitingPiece);
@@ -1049,7 +1067,7 @@ public void testNoPieceInWaitingPiece() {
public void testNoPieceInSelectedPiece() {
//sends the ClientAutomaton in GameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
//sends the gameStateMachine in the Turn
gameStateMachine.gotoState(turn);
@@ -1068,7 +1086,7 @@ public void testNoPieceInSelectedPiece() {
//sends to the clientGameLogic the message SelectPiece
clientGameLogic.receive(selectPiece);
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
assertTrue(gameStateMachine.getState() instanceof Turn);
assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
assertTrue(choosePieceStateMachine.getState() instanceof SelectPiece);
@@ -1081,7 +1099,7 @@ public void testNoPieceInSelectedPiece() {
public void testNoPieceInStartPiece() {
//sends the ClientAutomaton in GameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
//sends the gameStateMachine in the Turn
gameStateMachine.gotoState(turn);
@@ -1100,7 +1118,7 @@ public void testNoPieceInStartPiece() {
//sends to the clientGameLogic the message StartPiece
clientGameLogic.receive(startPiece);
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
assertTrue(gameStateMachine.getState() instanceof Turn);
assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
assertTrue(choosePieceStateMachine.getState() instanceof StartPiece);
@@ -1113,7 +1131,7 @@ public void testNoPieceInStartPiece() {
public void testNoPieceInWait() {
//sends the ClientAutomaton in GameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
//sends the gameStateMachine in the Turn
gameStateMachine.gotoState(turn);
@@ -1132,7 +1150,7 @@ public void testNoPieceInWait() {
//sends to the clientGameLogic the message NoTurn
clientGameLogic.receive(noTurn);
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
assertTrue(gameStateMachine.getState() instanceof Turn);
assertTrue(turnStateMachine.getState() instanceof Waiting);
}
@@ -1144,7 +1162,7 @@ public void testNoPieceInWait() {
public void testStayInWaitingPiece() {
//sends the ClientAutomaton in GameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
//sends the gameStateMachine in the Turn
gameStateMachine.gotoState(turn);
@@ -1160,7 +1178,7 @@ public void testStayInWaitingPiece() {
//TODO send all sever-messages except ... to the clientGameLogic to test there are no state change
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
assertTrue(gameStateMachine.getState() instanceof Turn);
assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
assertTrue(choosePieceStateMachine.getState() instanceof WaitingPiece);
@@ -1173,7 +1191,7 @@ public void testStayInWaitingPiece() {
public void testWaitingPieceInChoosePieceEndState() {
//sends the ClientAutomaton in GameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
//sends the gameStateMachine in the Turn
gameStateMachine.gotoState(turn);
@@ -1189,7 +1207,7 @@ public void testWaitingPieceInChoosePieceEndState() {
//Todo send the message to the clientGameLogic to force a state change
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
assertTrue(gameStateMachine.getState() instanceof Turn);
assertTrue(turnStateMachine.getState() instanceof MovePiece);
}
@@ -1201,7 +1219,7 @@ public void testWaitingPieceInChoosePieceEndState() {
public void testStayInSelectedPiece() {
//sends the ClientAutomaton in GameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
//sends the gameStateMachine in the Turn
gameStateMachine.gotoState(turn);
@@ -1217,7 +1235,7 @@ public void testStayInSelectedPiece() {
//Todo send all server messages which dont force a state change here
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
assertTrue(gameStateMachine.getState() instanceof Turn);
assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
assertTrue(choosePieceStateMachine.getState() instanceof SelectPiece);
@@ -1230,7 +1248,7 @@ public void testStayInSelectedPiece() {
public void testSelectedPieceInChoosePieceEndState() {
//sends the ClientAutomaton in GameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
//sends the gameStateMachine in the Turn
gameStateMachine.gotoState(turn);
@@ -1246,7 +1264,7 @@ public void testSelectedPieceInChoosePieceEndState() {
//Todo send the message which force a state change
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
assertTrue(gameStateMachine.getState() instanceof Turn);
assertTrue(turnStateMachine.getState() instanceof MovePiece);
}
@@ -1258,7 +1276,7 @@ public void testSelectedPieceInChoosePieceEndState() {
public void testStayInStartPiece() {
//sends the ClientAutomaton in GameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
//sends the gameStateMachine in the Turn
gameStateMachine.gotoState(turn);
@@ -1274,7 +1292,7 @@ public void testStayInStartPiece() {
//todo send all messages which dont force a state change
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
assertTrue(gameStateMachine.getState() instanceof Turn);
assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
assertTrue(choosePieceStateMachine.getState() instanceof StartPiece);
@@ -1287,7 +1305,7 @@ public void testStayInStartPiece() {
public void testStartPieceToChoosePieceEndState() {
//sends the ClientAutomaton in GameState
clientAutomaton.gotoState(gameState);
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
//sends the gameStateMachine in the Turn
gameStateMachine.gotoState(turn);
@@ -1303,7 +1321,7 @@ public void testStartPieceToChoosePieceEndState() {
//Todo send the message which force a state change
assertTrue(clientAutomaton.getState() instanceof GameState);
assertTrue(clientAutomaton.getState() instanceof Game);
assertTrue(gameStateMachine.getState() instanceof Turn);
assertTrue(turnStateMachine.getState() instanceof MovePiece);
}