implemented all methods required for the state pattern in the client and adjusted the messages to work with player ids instead of names
This commit is contained in:
@@ -19,9 +19,15 @@ public class ClientGameLogic implements ServerInterpreter {
|
||||
private Map<UUID, Piece> pieces;
|
||||
private Map<UUID, BonusCard> cards;
|
||||
|
||||
private Dialogs dialogs = new Dialogs(null, this);
|
||||
private GameState gameState = new GameState(null, this);
|
||||
private Ceremony ceremony = new Ceremony(null, this);
|
||||
private Interrupt interrupt = new Interrupt(null, this);
|
||||
|
||||
public ClientGameLogic(Game game, ClientSender clientSender) {
|
||||
this.game = game;
|
||||
this.clientSender = clientSender;
|
||||
state = dialogs;
|
||||
}
|
||||
|
||||
public void send(ClientMessage msg){
|
||||
@@ -43,178 +49,197 @@ public ClientState getState(){
|
||||
|
||||
@Override
|
||||
public void received(ActivePlayer msg) {
|
||||
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(AnyPiece msg) {
|
||||
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(Briefing msg) {
|
||||
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(CeremonyMessage msg) {
|
||||
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(Dice msg) {
|
||||
|
||||
public void received(Die msg) {
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(DiceAgain msg) {
|
||||
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(DiceNow msg) {
|
||||
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(EndOfTurn msg) {
|
||||
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(LobbyAccept msg) {
|
||||
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(LobbyDeny msg) {
|
||||
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(LobbyPlayerJoin msg) {
|
||||
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(LobbyPlayerLeave msg) {
|
||||
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(MoveMessage msg) {
|
||||
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(NoTurn msg) {
|
||||
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(PauseGame msg) {
|
||||
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(PlayCard msg) {
|
||||
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(PossibleCard msg) {
|
||||
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(PossiblePiece msg) {
|
||||
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(RankingResponse msg) {
|
||||
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(RankingRollAgain msg) {
|
||||
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(ReconnectBriefing msg) {
|
||||
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(ResumeGame msg) {
|
||||
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(ServerStartGame msg) {
|
||||
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(StartPiece msg) {
|
||||
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(UpdateReady msg) {
|
||||
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(UpdateTSK msg) {
|
||||
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(WaitPiece msg) {
|
||||
|
||||
state.received(msg);
|
||||
}
|
||||
|
||||
public void selectPiece(UUID pieceId){
|
||||
//TODO
|
||||
state.selectPiece(pieceId);
|
||||
}
|
||||
|
||||
public void selectCard(UUID cardId){
|
||||
//TODO
|
||||
state.selectCard(cardId);
|
||||
}
|
||||
|
||||
public void selectTsk(Color color){
|
||||
//TODO
|
||||
state.selectTSK(color);
|
||||
}
|
||||
|
||||
public void selectDice(){
|
||||
//TODO
|
||||
state.selectDice();
|
||||
}
|
||||
|
||||
public void selectName(String name){
|
||||
//TODO
|
||||
state.setName(name);
|
||||
}
|
||||
|
||||
public void selectReady(boolean ready){
|
||||
//TODO
|
||||
state.selectReady();
|
||||
}
|
||||
|
||||
public void selectHost(){
|
||||
//TODO
|
||||
state.selectHost();
|
||||
}
|
||||
|
||||
public void selectLeave(){
|
||||
//TODO
|
||||
state.selectLeave();
|
||||
}
|
||||
|
||||
public void selectJoin(){
|
||||
//TODO
|
||||
state.selectJoin();
|
||||
}
|
||||
|
||||
public void selectStart(){
|
||||
//TODO
|
||||
state.selectStart();
|
||||
}
|
||||
|
||||
public void setState(ClientState state){
|
||||
this.state.exit();
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public GameState getGameState(){
|
||||
return gameState;
|
||||
}
|
||||
|
||||
public Ceremony getCeremony(){
|
||||
return ceremony;
|
||||
}
|
||||
|
||||
public Interrupt getInterrupt(){
|
||||
return interrupt;
|
||||
}
|
||||
|
||||
public Dialogs getDialogs(){
|
||||
return dialogs;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
import pp.mdga.game.Color;
|
||||
import pp.mdga.message.server.*;
|
||||
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.UUID;
|
||||
|
||||
public abstract class ClientState implements Observer, ServerInterpreter {
|
||||
protected static final System.Logger LOGGER = System.getLogger(ClientState.class.getName());
|
||||
@@ -52,7 +54,7 @@ public void received(CeremonyMessage msg) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(Dice msg) {
|
||||
public void received(Die msg) {
|
||||
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
|
||||
}
|
||||
|
||||
@@ -165,4 +167,52 @@ public void received(UpdateTSK msg) {
|
||||
public void received(WaitPiece msg) {
|
||||
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
|
||||
}
|
||||
|
||||
public void selectPiece(UUID id) {
|
||||
LOGGER.log(Level.DEBUG, "Selecting piece not allowed.");
|
||||
}
|
||||
|
||||
public void selectCard(UUID id) {
|
||||
LOGGER.log(Level.DEBUG, "Selecting card not allowed.");
|
||||
}
|
||||
|
||||
public void selectTSK(Color color) {
|
||||
LOGGER.log(Level.DEBUG, "Selecting TSK not allowed.");
|
||||
}
|
||||
|
||||
public void selectDice() {
|
||||
LOGGER.log(Level.DEBUG, "Selecting dice not allowed.");
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
LOGGER.log(Level.DEBUG, "Setting name not allowed.");
|
||||
}
|
||||
|
||||
public void selectReady() {
|
||||
LOGGER.log(Level.DEBUG, "Selecting ready not allowed.");
|
||||
}
|
||||
|
||||
public void selectHost() {
|
||||
LOGGER.log(Level.DEBUG, "Selecting host not allowed.");
|
||||
}
|
||||
|
||||
public void selectJoin() {
|
||||
LOGGER.log(Level.DEBUG, "Selecting join not allowed.");
|
||||
}
|
||||
|
||||
public void selectLeave() {
|
||||
LOGGER.log(Level.DEBUG, "Selecting leave not allowed.");
|
||||
}
|
||||
|
||||
public void deselectTSK(Color color) {
|
||||
LOGGER.log(Level.DEBUG, "Deselecting TSK not allowed.");
|
||||
}
|
||||
|
||||
public void selectUnready(){
|
||||
LOGGER.log(Level.DEBUG, "Selecting unready not allowed.");
|
||||
}
|
||||
|
||||
public void selectStart(){
|
||||
LOGGER.log(Level.DEBUG, "Starting not allowed");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,4 +45,9 @@ public NetworkDialog getNetworkDialog() {
|
||||
public StartDialog getStartDialog() {
|
||||
return startDialog;
|
||||
}
|
||||
|
||||
public void startGame(){
|
||||
exit();
|
||||
logic.setState(logic.getGameState());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class Game extends ClientState {
|
||||
|
||||
public Game(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
import pp.mdga.client.gameState.*;
|
||||
|
||||
public class GameState extends ClientState {
|
||||
|
||||
private GameStates state;
|
||||
|
||||
private Animation animation = new Animation(this, logic);
|
||||
private DetermineStartPlayer determineStartPlayer = new DetermineStartPlayer(this, logic);
|
||||
private Spectator spectator = new Spectator(this, logic);
|
||||
private Turn turn = new Turn(this, logic);
|
||||
private Waiting waiting = new Waiting(this, logic);
|
||||
|
||||
public GameState(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
state = determineStartPlayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,17 @@
|
||||
|
||||
public class Interrupt extends ClientState {
|
||||
|
||||
private final Game lastState;
|
||||
|
||||
public Interrupt(ClientState parent, ClientGameLogic logic, Game lastState) {
|
||||
public Interrupt(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
this.lastState = lastState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package pp.mdga.client.ceremonyState;
|
||||
|
||||
import pp.mdga.client.ClientGameLogic;
|
||||
import pp.mdga.client.ClientState;
|
||||
|
||||
public abstract class CeremonyStates extends ClientState {
|
||||
protected CeremonyStates(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,18 @@
|
||||
import pp.mdga.client.ClientGameLogic;
|
||||
import pp.mdga.client.ClientState;
|
||||
|
||||
public class Podium extends ClientState {
|
||||
public class Podium extends CeremonyStates {
|
||||
public Podium(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,18 @@
|
||||
import pp.mdga.client.ClientGameLogic;
|
||||
import pp.mdga.client.ClientState;
|
||||
|
||||
public class Statistics extends ClientState {
|
||||
public class Statistics extends CeremonyStates {
|
||||
public Statistics(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,62 @@
|
||||
|
||||
import pp.mdga.client.ClientGameLogic;
|
||||
import pp.mdga.client.ClientState;
|
||||
import pp.mdga.client.Dialogs;
|
||||
import pp.mdga.game.Color;
|
||||
import pp.mdga.message.client.*;
|
||||
import pp.mdga.message.server.ServerStartGame;
|
||||
|
||||
public class Lobby extends DialogStates {
|
||||
|
||||
private final Dialogs parent;
|
||||
|
||||
public Lobby(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
this.parent = (Dialogs) parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectLeave() {
|
||||
parent.setState(parent.getStartDialog());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectTSK(Color color) {
|
||||
logic.send(new SelectTSK(color));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deselectTSK(Color color) {
|
||||
logic.send(new DeselectTSK(color));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectReady() {
|
||||
logic.send(new LobbyReady());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectUnready(){
|
||||
logic.send(new LobbyNotReady());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectStart(){
|
||||
logic.send(new StartGame());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(ServerStartGame msg){
|
||||
parent.startGame();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,14 @@ public class Animation extends GameStates {
|
||||
public Animation(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,4 +8,14 @@ public class DetermineStartPlayer extends GameStates {
|
||||
public DetermineStartPlayer(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,14 @@ public class Spectator extends GameStates {
|
||||
public Spectator(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,4 +8,14 @@ public class Turn extends GameStates {
|
||||
public Turn(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,14 @@ public class Waiting extends GameStates {
|
||||
public Waiting(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
import pp.mdga.client.ClientState;
|
||||
import pp.mdga.client.gameState.GameStates;
|
||||
|
||||
public class DetermineStartPlayerStates extends GameStates {
|
||||
public abstract class DetermineStartPlayerStates extends GameStates {
|
||||
public DetermineStartPlayerStates(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,4 +7,14 @@ public class RollRankingDice extends DetermineStartPlayerStates {
|
||||
public RollRankingDice(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,4 +8,14 @@ public class WaitRanking extends GameStates {
|
||||
public WaitRanking(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,4 +8,14 @@ public class ChoosePiece extends TurnStates {
|
||||
public ChoosePiece(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,14 @@ public class MovePiece extends TurnStates {
|
||||
public MovePiece(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,14 @@ public class PlayPowerCard extends TurnStates {
|
||||
public PlayPowerCard(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,4 +8,14 @@ public class PowerCard extends TurnStates {
|
||||
public PowerCard(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,14 @@ public class RollDice extends TurnStates {
|
||||
public RollDice(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,14 @@ public class NoPiece extends ChoosePieceStates {
|
||||
public NoPiece(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,14 @@ public class SelectPiece extends ChoosePieceStates {
|
||||
public SelectPiece(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,14 @@ public class StartPiece extends ChoosePieceStates {
|
||||
public StartPiece(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,14 @@ public class WaitingPiece extends ChoosePieceStates {
|
||||
public WaitingPiece(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,14 @@ public class ChoosePowerCard extends PowerCardStates {
|
||||
public ChoosePowerCard(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,14 @@ public class Shield extends PowerCardStates {
|
||||
public Shield(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,14 @@ public class Swap extends PowerCardStates {
|
||||
public Swap(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,14 @@ public class AudioSettings extends SettingStates {
|
||||
public AudioSettings(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,14 @@ public class MainSettings extends ClientState {
|
||||
public MainSettings(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,14 @@ public class VideoSettings extends SettingStates {
|
||||
public VideoSettings(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public interface ClientInterpreter {
|
||||
* @param msg the ForceStartGame message to be processed
|
||||
* @param from the connection ID from which the message was received
|
||||
*/
|
||||
void received(ForceStartGame msg, int from);
|
||||
void received(StartGame msg, int from);
|
||||
|
||||
/**
|
||||
* Processes a received JoinServer message.
|
||||
@@ -140,4 +140,12 @@ public interface ClientInterpreter {
|
||||
* @param from the connection ID from which the message was received
|
||||
*/
|
||||
void received(SelectedPieces msg, int from);
|
||||
|
||||
/**
|
||||
* Processes a received disconnect message.
|
||||
*
|
||||
* @param msg the disconnect message to be processed
|
||||
* @param from the connection ID from which the message was received
|
||||
*/
|
||||
void received(Disconnected msg, int from);
|
||||
}
|
||||
|
||||
@@ -7,11 +7,23 @@
|
||||
*/
|
||||
@Serializable
|
||||
public class JoinServer extends ClientMessage {
|
||||
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* Constructs a new JoinServer instance.
|
||||
*/
|
||||
public JoinServer(String name) {
|
||||
super();
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new JoinServer instance.
|
||||
*/
|
||||
public JoinServer() {
|
||||
super();
|
||||
name = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,12 +6,21 @@
|
||||
* A message sent by the host to force start the game when not everyone is ready or not everyone has selected a TSK.
|
||||
*/
|
||||
@Serializable
|
||||
public class ForceStartGame extends ClientMessage {
|
||||
public class StartGame extends ClientMessage {
|
||||
|
||||
private final boolean forceStartGame;
|
||||
|
||||
public StartGame(boolean forceStartGame){
|
||||
super();
|
||||
this.forceStartGame = forceStartGame;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new ForceStartGame message.
|
||||
*/
|
||||
public ForceStartGame() {
|
||||
public StartGame() {
|
||||
super();
|
||||
forceStartGame = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13,14 +13,20 @@ public class LobbyPlayerJoin extends ServerMessage {
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* The ID of the new Player
|
||||
*/
|
||||
private final int id;
|
||||
|
||||
/**
|
||||
* Constructs a new LobbyPlayerJoin instance with the specified player name.
|
||||
*
|
||||
* @param name the name of the player joining the lobby
|
||||
*/
|
||||
public LobbyPlayerJoin(String name) {
|
||||
public LobbyPlayerJoin(int id, String name) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -28,6 +34,7 @@ public LobbyPlayerJoin(String name) {
|
||||
*/
|
||||
private LobbyPlayerJoin() {
|
||||
name = null;
|
||||
id = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,6 +46,15 @@ public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the id of the new Player
|
||||
*
|
||||
* @return the id of the player
|
||||
*/
|
||||
public int getId(){
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accepts a visitor to process this message.
|
||||
*
|
||||
|
||||
@@ -11,7 +11,7 @@ public class LobbyPlayerLeave extends ServerMessage {
|
||||
/**
|
||||
* The name of the player leaving the lobby.
|
||||
*/
|
||||
private final String name;
|
||||
private final int id;
|
||||
|
||||
/**
|
||||
* The color associated with the player leaving the lobby.
|
||||
@@ -21,12 +21,12 @@ public class LobbyPlayerLeave extends ServerMessage {
|
||||
/**
|
||||
* Constructs a new LobbyPlayerLeave instance with the specified player name and color.
|
||||
*
|
||||
* @param name the name of the player leaving the lobby
|
||||
* @param id the id of the player leaving the lobby
|
||||
* @param color the color associated with the player leaving the lobby
|
||||
*/
|
||||
public LobbyPlayerLeave(String name, Color color) {
|
||||
public LobbyPlayerLeave(int id, Color color) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.id = id;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public LobbyPlayerLeave(String name, Color color) {
|
||||
* Default constructor for serialization purposes.
|
||||
*/
|
||||
private LobbyPlayerLeave() {
|
||||
name = null;
|
||||
id = 0;
|
||||
color = null;
|
||||
}
|
||||
|
||||
@@ -43,8 +43,8 @@ private LobbyPlayerLeave() {
|
||||
*
|
||||
* @return the name of the player leaving the lobby
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,11 +34,11 @@ public interface ServerInterpreter {
|
||||
void received(CeremonyMessage msg);
|
||||
|
||||
/**
|
||||
* Handles a Dice message received from the server.
|
||||
* Handles a Die message received from the server.
|
||||
*
|
||||
* @param msg the Dice message received
|
||||
*/
|
||||
void received(Dice msg);
|
||||
void received(Die msg);
|
||||
|
||||
/**
|
||||
* Handles a DiceAgain message received from the server.
|
||||
|
||||
@@ -11,7 +11,7 @@ public class UpdateTSK extends ServerMessage {
|
||||
/**
|
||||
* The name associated with the update.
|
||||
*/
|
||||
private final String name;
|
||||
private final int id;
|
||||
|
||||
/**
|
||||
* The color associated with the update.
|
||||
@@ -21,12 +21,12 @@ public class UpdateTSK extends ServerMessage {
|
||||
/**
|
||||
* Constructs a new UpdateTSK instance with the specified name and color.
|
||||
*
|
||||
* @param name the name associated with the update
|
||||
* @param id the name associated with the update
|
||||
* @param color the color associated with the update
|
||||
*/
|
||||
public UpdateTSK(String name, Color color) {
|
||||
public UpdateTSK(int id, Color color) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.id = id;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@ private UpdateTSK() {
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,7 +53,7 @@ public void received(DeselectTSK msg, int from) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(ForceStartGame msg, int from) {
|
||||
public void received(StartGame msg, int from) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public class ClientStateTest {
|
||||
private DetermineStartPlayerStateMachine determineStartPlayerStateMachine;
|
||||
private Dialogs dialogs;
|
||||
private DialogsStateMachine dialogsStateMachine;
|
||||
private Game gameState;
|
||||
private GameState gameState;
|
||||
private GameStateMachine gameStateMachine;
|
||||
private Interrupt interrupt;
|
||||
private Lobby lobby;
|
||||
@@ -193,7 +193,7 @@ public void send(ClientMessage msg) {
|
||||
|
||||
//initialize the states
|
||||
dialogs = new Dialogs(clientAutomaton,clientGameLogic);
|
||||
gameState = new Game(clientAutomaton,clientGameLogic);
|
||||
gameState = new GameState(clientAutomaton,clientGameLogic);
|
||||
ceremony = new Ceremony(clientAutomaton,clientGameLogic);
|
||||
interrupt = new Interrupt(clientAutomaton,clientGameLogic,gameState);
|
||||
|
||||
@@ -257,10 +257,10 @@ public void testDialogsToGame() {
|
||||
clientGameLogic.receive(startGame);
|
||||
|
||||
//tests if the client is in the gameState after receiving the message
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
|
||||
//tests if the new State of the GameStateMachine is in DetermineStartPlayer
|
||||
Game gameState1 = (Game) clientAutomaton.getState();
|
||||
GameState gameState1 = (GameState) clientAutomaton.getState();
|
||||
GameStateMachine gameStateMachine1 = gameState1.getGameStateMachine();
|
||||
assertTrue(gameStateMachine1.getState() instanceof DetermineStartPlayer);
|
||||
|
||||
@@ -286,7 +286,7 @@ public void testDialogsToClientStateEndState() {
|
||||
public void testClientGameToCeremony() {
|
||||
//sends the ClientAutomaton in GameState
|
||||
clientAutomaton.gotoState(gameState);
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the Ceremony-Message to the client
|
||||
clientGameLogic.receive(ceremonyMessage);
|
||||
@@ -309,7 +309,7 @@ public void testClientGameSubStatesToInterrupt() {
|
||||
clientAutomaton.gotoState(gameState);
|
||||
|
||||
//tests if the client is in GameState
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the Ceremony-Message to the client
|
||||
clientGameLogic.receive(interrupt);
|
||||
@@ -352,7 +352,7 @@ public void testClientInterruptToGame() {
|
||||
//Todo sends the continue-message
|
||||
|
||||
//tests if the client is in the game
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -576,10 +576,10 @@ public void testLobbyToRollRankingDice() {
|
||||
clientGameLogic.receive();//TODO message
|
||||
|
||||
//tests if the clientStateMachine is in the GameState
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
|
||||
//tests if the clientStateMachine is in the DetermineStartPlayer
|
||||
Game gameState1 = (Game) clientAutomaton.getState();
|
||||
GameState gameState1 = (GameState) clientAutomaton.getState();
|
||||
GameStateMachine gameStateMachine1 = gameState1.getGameStateMachine();
|
||||
assertTrue(gameStateMachine1.getState() instanceof DetermineStartPlayer);
|
||||
|
||||
@@ -604,7 +604,7 @@ public void testDetermineStartPlayerToWait() {
|
||||
public void testWaitToAnimation() {
|
||||
//sends the ClientAutomaton in GameState
|
||||
clientAutomaton.gotoState(gameState);
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the client in WaitState
|
||||
gameStateMachine.gotoState(waiting);
|
||||
@@ -612,7 +612,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 Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine.getState() instanceof Animation);
|
||||
|
||||
//sends the client in WaitState
|
||||
@@ -621,7 +621,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 Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine.getState() instanceof Animation);
|
||||
|
||||
//sends the client in WaitState
|
||||
@@ -630,7 +630,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 Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine.getState() instanceof Animation);
|
||||
}
|
||||
|
||||
@@ -641,7 +641,7 @@ public void testWaitToAnimation() {
|
||||
public void testWaitToTurn() {
|
||||
//sends client in gameState
|
||||
clientAutomaton.gotoState(gameState);
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the gameStateMachine in the Waiting
|
||||
gameStateMachine.gotoState(waiting);
|
||||
@@ -651,7 +651,7 @@ public void testWaitToTurn() {
|
||||
clientGameLogic.receive(activePlayer);
|
||||
|
||||
//tests if the client is in GameState
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
|
||||
//tests if Client is in Turn
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
@@ -728,7 +728,7 @@ public void testPowerCardSubStatesToRollDice() {
|
||||
public void testStayInPlayPowerCard() {
|
||||
//sends the ClientAutomaton in GameState
|
||||
clientAutomaton.gotoState(gameState);
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the gameStateMachine in the Turn
|
||||
gameStateMachine.gotoState(turn);
|
||||
@@ -741,7 +741,7 @@ public void testStayInPlayPowerCard() {
|
||||
//Todo send messages to test to stay in playPowerCard
|
||||
|
||||
//tests if the client is in PlayPowerCard
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine.getState() instanceof PlayPowerCard);
|
||||
}
|
||||
@@ -753,7 +753,7 @@ public void testStayInPlayPowerCard() {
|
||||
public void testPlayPowerCardToRollDice() {
|
||||
//sends the ClientAutomaton in GameState
|
||||
clientAutomaton.gotoState(gameState);
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the gameStateMachine in the Turn
|
||||
gameStateMachine.gotoState(turn);
|
||||
@@ -767,7 +767,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 Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine.getState() instanceof RollDice);
|
||||
}
|
||||
@@ -853,7 +853,7 @@ public void testChoosePowerCardToRollDice() {
|
||||
//TODO
|
||||
//sends the ClientAutomaton in GameState
|
||||
clientAutomaton.gotoState(gameState);
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the gameStateMachine in the Turn
|
||||
gameStateMachine.gotoState(turn);
|
||||
@@ -870,7 +870,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 Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine.getState() instanceof RollDice);
|
||||
}
|
||||
@@ -882,7 +882,7 @@ public void testChoosePowerCardToRollDice() {
|
||||
public void testChoosePowerCardToSwap() {
|
||||
//sends the ClientAutomaton in GameState
|
||||
clientAutomaton.gotoState(gameState);
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the gameStateMachine in the Turn
|
||||
gameStateMachine.gotoState(turn);
|
||||
@@ -899,7 +899,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 Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine.getState() instanceof PowerCard);
|
||||
assertTrue(powerCardStateMachine.getState() instanceof Swap);
|
||||
@@ -912,7 +912,7 @@ public void testChoosePowerCardToSwap() {
|
||||
public void testChoosePowerCardToShield() {
|
||||
//sends the ClientAutomaton in GameState
|
||||
clientAutomaton.gotoState(gameState);
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the gameStateMachine in the Turn
|
||||
gameStateMachine.gotoState(turn);
|
||||
@@ -929,7 +929,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 Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine.getState() instanceof PowerCard);
|
||||
assertTrue(powerCardStateMachine.getState() instanceof Shield);
|
||||
@@ -942,7 +942,7 @@ public void testChoosePowerCardToShield() {
|
||||
public void testStayInShield() {
|
||||
//sends the ClientAutomaton in GameState
|
||||
clientAutomaton.gotoState(gameState);
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the gameStateMachine in the Turn
|
||||
gameStateMachine.gotoState(turn);
|
||||
@@ -959,7 +959,7 @@ public void testStayInShield() {
|
||||
//todo send the messages, which dont force a statechange
|
||||
|
||||
//tests if the client is in PlayPowerCard
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine.getState() instanceof PowerCard);
|
||||
assertTrue(powerCardStateMachine.getState() instanceof PlayPowerCard);
|
||||
@@ -972,7 +972,7 @@ public void testStayInShield() {
|
||||
public void testShieldToPowerCardEndState() {
|
||||
//sends the ClientAutomaton in GameState
|
||||
clientAutomaton.gotoState(gameState);
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the gameStateMachine in the Turn
|
||||
gameStateMachine.gotoState(turn);
|
||||
@@ -990,7 +990,7 @@ public void testShieldToPowerCardEndState() {
|
||||
//todo send the message to force the statechange
|
||||
|
||||
//tests if the client is in PlayPowerCard
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine.getState() instanceof PlayPowerCard);
|
||||
}
|
||||
@@ -1002,7 +1002,7 @@ public void testShieldToPowerCardEndState() {
|
||||
public void testSwapToPowerCardEndState() {
|
||||
//sends the ClientAutomaton in GameState
|
||||
clientAutomaton.gotoState(gameState);
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the gameStateMachine in the Turn
|
||||
gameStateMachine.gotoState(turn);
|
||||
@@ -1019,7 +1019,7 @@ public void testSwapToPowerCardEndState() {
|
||||
//todo send the message to force the statechange
|
||||
|
||||
//tests if the client is in PlayPowerCard
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine.getState() instanceof PlayPowerCard);
|
||||
}
|
||||
@@ -1031,7 +1031,7 @@ public void testSwapToPowerCardEndState() {
|
||||
public void testNoPieceInWaitingPiece() {
|
||||
//sends the ClientAutomaton in GameState
|
||||
clientAutomaton.gotoState(gameState);
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the gameStateMachine in the Turn
|
||||
gameStateMachine.gotoState(turn);
|
||||
@@ -1050,7 +1050,7 @@ public void testNoPieceInWaitingPiece() {
|
||||
//sends to the clientGameLogic the message WaitPiece
|
||||
clientGameLogic.receive(waitPiece);
|
||||
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
|
||||
assertTrue(choosePieceStateMachine.getState() instanceof WaitingPiece);
|
||||
@@ -1063,7 +1063,7 @@ public void testNoPieceInWaitingPiece() {
|
||||
public void testNoPieceInSelectedPiece() {
|
||||
//sends the ClientAutomaton in GameState
|
||||
clientAutomaton.gotoState(gameState);
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the gameStateMachine in the Turn
|
||||
gameStateMachine.gotoState(turn);
|
||||
@@ -1082,7 +1082,7 @@ public void testNoPieceInSelectedPiece() {
|
||||
//sends to the clientGameLogic the message SelectPiece
|
||||
clientGameLogic.receive(selectPiece);
|
||||
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
|
||||
assertTrue(choosePieceStateMachine.getState() instanceof SelectPiece);
|
||||
@@ -1095,7 +1095,7 @@ public void testNoPieceInSelectedPiece() {
|
||||
public void testNoPieceInStartPiece() {
|
||||
//sends the ClientAutomaton in GameState
|
||||
clientAutomaton.gotoState(gameState);
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the gameStateMachine in the Turn
|
||||
gameStateMachine.gotoState(turn);
|
||||
@@ -1114,7 +1114,7 @@ public void testNoPieceInStartPiece() {
|
||||
//sends to the clientGameLogic the message StartPiece
|
||||
clientGameLogic.receive(startPiece);
|
||||
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
|
||||
assertTrue(choosePieceStateMachine.getState() instanceof StartPiece);
|
||||
@@ -1127,7 +1127,7 @@ public void testNoPieceInStartPiece() {
|
||||
public void testNoPieceInWait() {
|
||||
//sends the ClientAutomaton in GameState
|
||||
clientAutomaton.gotoState(gameState);
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the gameStateMachine in the Turn
|
||||
gameStateMachine.gotoState(turn);
|
||||
@@ -1146,7 +1146,7 @@ public void testNoPieceInWait() {
|
||||
//sends to the clientGameLogic the message NoTurn
|
||||
clientGameLogic.receive(noTurn);
|
||||
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine.getState() instanceof Waiting);
|
||||
}
|
||||
@@ -1158,7 +1158,7 @@ public void testNoPieceInWait() {
|
||||
public void testStayInWaitingPiece() {
|
||||
//sends the ClientAutomaton in GameState
|
||||
clientAutomaton.gotoState(gameState);
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the gameStateMachine in the Turn
|
||||
gameStateMachine.gotoState(turn);
|
||||
@@ -1174,7 +1174,7 @@ public void testStayInWaitingPiece() {
|
||||
|
||||
//TODO send all sever-messages except ... to the clientGameLogic to test there are no state change
|
||||
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
|
||||
assertTrue(choosePieceStateMachine.getState() instanceof WaitingPiece);
|
||||
@@ -1187,7 +1187,7 @@ public void testStayInWaitingPiece() {
|
||||
public void testWaitingPieceInChoosePieceEndState() {
|
||||
//sends the ClientAutomaton in GameState
|
||||
clientAutomaton.gotoState(gameState);
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the gameStateMachine in the Turn
|
||||
gameStateMachine.gotoState(turn);
|
||||
@@ -1203,7 +1203,7 @@ public void testWaitingPieceInChoosePieceEndState() {
|
||||
|
||||
//Todo send the message to the clientGameLogic to force a state change
|
||||
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine.getState() instanceof MovePiece);
|
||||
}
|
||||
@@ -1215,7 +1215,7 @@ public void testWaitingPieceInChoosePieceEndState() {
|
||||
public void testStayInSelectedPiece() {
|
||||
//sends the ClientAutomaton in GameState
|
||||
clientAutomaton.gotoState(gameState);
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the gameStateMachine in the Turn
|
||||
gameStateMachine.gotoState(turn);
|
||||
@@ -1231,7 +1231,7 @@ public void testStayInSelectedPiece() {
|
||||
|
||||
//Todo send all server messages which dont force a state change here
|
||||
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
|
||||
assertTrue(choosePieceStateMachine.getState() instanceof SelectPiece);
|
||||
@@ -1244,7 +1244,7 @@ public void testStayInSelectedPiece() {
|
||||
public void testSelectedPieceInChoosePieceEndState() {
|
||||
//sends the ClientAutomaton in GameState
|
||||
clientAutomaton.gotoState(gameState);
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the gameStateMachine in the Turn
|
||||
gameStateMachine.gotoState(turn);
|
||||
@@ -1260,7 +1260,7 @@ public void testSelectedPieceInChoosePieceEndState() {
|
||||
|
||||
//Todo send the message which force a state change
|
||||
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine.getState() instanceof MovePiece);
|
||||
}
|
||||
@@ -1272,7 +1272,7 @@ public void testSelectedPieceInChoosePieceEndState() {
|
||||
public void testStayInStartPiece() {
|
||||
//sends the ClientAutomaton in GameState
|
||||
clientAutomaton.gotoState(gameState);
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the gameStateMachine in the Turn
|
||||
gameStateMachine.gotoState(turn);
|
||||
@@ -1288,7 +1288,7 @@ public void testStayInStartPiece() {
|
||||
|
||||
//todo send all messages which dont force a state change
|
||||
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine.getState() instanceof ChoosePiece);
|
||||
assertTrue(choosePieceStateMachine.getState() instanceof StartPiece);
|
||||
@@ -1301,7 +1301,7 @@ public void testStayInStartPiece() {
|
||||
public void testStartPieceToChoosePieceEndState() {
|
||||
//sends the ClientAutomaton in GameState
|
||||
clientAutomaton.gotoState(gameState);
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
|
||||
//sends the gameStateMachine in the Turn
|
||||
gameStateMachine.gotoState(turn);
|
||||
@@ -1317,7 +1317,7 @@ public void testStartPieceToChoosePieceEndState() {
|
||||
|
||||
//Todo send the message which force a state change
|
||||
|
||||
assertTrue(clientAutomaton.getState() instanceof Game);
|
||||
assertTrue(clientAutomaton.getState() instanceof GameState);
|
||||
assertTrue(gameStateMachine.getState() instanceof Turn);
|
||||
assertTrue(turnStateMachine.getState() instanceof MovePiece);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user