Compare commits
47 Commits
dev/client
...
dev/client
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c4e5b7f7c8 | ||
|
|
35cf092d5c | ||
|
|
06e2d831ef | ||
|
|
75b53f8309 | ||
|
|
58f94e73db | ||
|
|
46a6552bca | ||
|
|
1d95146272 | ||
|
|
9859d52e02 | ||
|
|
e18ea15efa | ||
|
|
461a497353 | ||
|
|
4c3099ddf2 | ||
|
|
b0ab870451 | ||
|
|
993c94c306 | ||
|
|
e52af59cac | ||
|
|
40f1bdb51f | ||
|
|
436dae4ebc | ||
|
|
1b2d4df96f | ||
|
|
f3ca9f01c0 | ||
|
|
3c97cdae38 | ||
|
|
227d4286e5 | ||
|
|
9939ec2861 | ||
|
|
1a6a460f9f | ||
|
|
ec58e9c85f | ||
|
|
cf6777023f | ||
|
|
739279d3df | ||
|
|
b6bf25671f | ||
|
|
5a9fd2a939 | ||
|
|
e1b21de718 | ||
|
|
f321608132 | ||
|
|
dd7a27629b | ||
|
|
eba681c350 | ||
|
|
f97eea3e5e | ||
|
|
1582038dfe | ||
|
|
798e996a8d | ||
|
|
472d87b0c9 | ||
|
|
7cfb863e5c | ||
|
|
7e1d2e833e | ||
|
|
67a87ffa81 | ||
|
|
12fbf4e77e | ||
|
|
f6d16a81bf | ||
|
|
6938ce16b7 | ||
|
|
85ea4d340c | ||
|
|
e3d5d8e2e9 | ||
|
|
6dfb2980fa | ||
|
|
f3894a5058 | ||
|
|
787d8b558c | ||
|
|
3949a00932 |
@@ -2,20 +2,17 @@
|
||||
|
||||
import pp.mdga.client.ClientGameLogic;
|
||||
import pp.mdga.client.ClientState;
|
||||
import pp.mdga.client.gameState.determineStartPlayerState.DetermineStartPlayerStateMachine;
|
||||
|
||||
public class DetermineStartPlayer extends GameStates {
|
||||
private final DetermineStartPlayerStateMachine determineStartPlayerStateMachine;
|
||||
|
||||
public DetermineStartPlayer(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
this.determineStartPlayerStateMachine = new DetermineStartPlayerStateMachine(parent, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
|
||||
public DetermineStartPlayerStateMachine getDetermineStartPlayerStateMachine() {
|
||||
return determineStartPlayerStateMachine;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package pp.mdga.client.gameState.determineStartPlayerState;
|
||||
|
||||
import pp.mdga.client.ClientGameLogic;
|
||||
import pp.mdga.client.ClientState;
|
||||
import pp.mdga.client.ClientStateMachine;
|
||||
|
||||
public class DetermineStartPlayerStateMachine extends ClientStateMachine {
|
||||
public DetermineStartPlayerStateMachine(ClientState parent, ClientGameLogic logic) {
|
||||
super(parent, logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RollRankingDice initialState() {
|
||||
return new RollRankingDice(this, logic);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package pp.mdga.server;
|
||||
|
||||
public class DetermineStartPlayer extends GameState {
|
||||
public DetermineStartPlayer(ServerGameLogic logic) {
|
||||
super(logic);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package pp.mdga.server;
|
||||
|
||||
public class GameState extends ServerState {
|
||||
public GameState(ServerGameLogic logic) {
|
||||
super(logic);
|
||||
}
|
||||
}
|
||||
@@ -2,215 +2,126 @@
|
||||
|
||||
import pp.mdga.game.Game;
|
||||
import pp.mdga.message.client.*;
|
||||
import pp.mdga.server.automaton.*;
|
||||
|
||||
import java.lang.System.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class ServerGameLogic implements ClientInterpreter {
|
||||
/**
|
||||
* Constants.
|
||||
*/
|
||||
private static final Logger LOGGER = System.getLogger(ServerGameLogic.class.getName());
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private final ServerSender serverSender;
|
||||
|
||||
private final Game game;
|
||||
|
||||
/**
|
||||
* States
|
||||
*/
|
||||
private ServerState currentState;
|
||||
private final ServerState lobbyState;
|
||||
private final ServerState gameState;
|
||||
private final ServerState interruptState;
|
||||
private final ServerState ceremonyState;
|
||||
private final ServerState state;
|
||||
|
||||
private final ServerState lobby = new Lobby(this);
|
||||
private final ServerState gameState = new GameState(this);
|
||||
private final ServerState interrupt = new Interrupt(this);
|
||||
private final ServerState ceremony = new Ceremony(this);
|
||||
private final ServerState turn = new Turn(this);
|
||||
private final ServerState determineStartPlayer = new DetermineStartPlayer(this);
|
||||
private final ServerState rollDice = new RollDice(this);
|
||||
private final ServerState powerCard = new PowerCard(this);
|
||||
private final ServerState movePiece = new MovePiece(this);
|
||||
private final ServerState choosePiece = new ChoosePiece(this);
|
||||
private final ServerState firstRoll = new FirstRoll(this);
|
||||
private final ServerState secondRoll = new SecondRoll(this);
|
||||
private final ServerState thirdRoll = new ThirdRoll(this);
|
||||
private final ServerState noPiece = new NoPiece(this);
|
||||
private final ServerState noTurn = new NoTurn(this);
|
||||
private final ServerState waitingPiece = new WaitingPiece(this);
|
||||
private final ServerState startPiece = new StartPiece(this);
|
||||
private final ServerState selectPiece = new SelectPiece(this);
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param serverSender
|
||||
* @param game
|
||||
*/
|
||||
public ServerGameLogic(ServerSender serverSender, Game game) {
|
||||
this.serverSender = serverSender;
|
||||
this.game = game;
|
||||
this.lobbyState = new LobbyState(this);
|
||||
this.gameState = new GameState(this);
|
||||
this.interruptState = new InterruptState(this);
|
||||
this.ceremonyState = new CeremonyState(this);
|
||||
this.currentState = this.lobbyState;
|
||||
this.state = lobby;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void received(AnimationEnd msg, int from) {
|
||||
this.currentState.received(msg, from);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(DeselectTSK msg, int from) {
|
||||
this.currentState.received(msg, from);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(StartGame msg, int from) {
|
||||
this.currentState.received(msg, from);
|
||||
public void received(ForceStartGame msg, int from) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(JoinServer msg, int from) {
|
||||
this.currentState.received(msg, from);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(LeaveGame msg, int from) {
|
||||
this.currentState.received(msg, from);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(LobbyReady msg, int from) {
|
||||
this.currentState.received(msg, from);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(LobbyNotReady msg, int from) {
|
||||
this.currentState.received(msg, from);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(Disconnected msg, int from) {
|
||||
this.currentState.received(msg, from);
|
||||
public void received(LobbyReady msg, int from) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(RequestBriefing msg, int from) {
|
||||
this.currentState.received(msg, from);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(RequestDie msg, int from) {
|
||||
this.currentState.received(msg, from);
|
||||
public void received(RequestDice msg, int from) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(RequestMove msg, int from) {
|
||||
this.currentState.received(msg, from);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(RequestPlayCard msg, int from) {
|
||||
this.currentState.received(msg, from);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(SelectCard msg, int from) {
|
||||
this.currentState.received(msg, from);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(SelectTSK msg, int from) {
|
||||
this.currentState.received(msg, from);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(ForceContinueGame msg, int from) {
|
||||
this.currentState.received(msg, from);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(ClientStartGame msg, int from) {
|
||||
this.currentState.received(msg, from);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(NoPowerCard msg, int from) {
|
||||
this.currentState.received(msg, from);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void received(SelectedPieces msg, int from) {
|
||||
this.currentState.received(msg, from);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be used to return serverSender attribute of ServerGameLogic class.
|
||||
*
|
||||
* @return serverSender as a ServerSender object.
|
||||
*/
|
||||
public ServerSender getServerSender() {
|
||||
return this.serverSender;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be used to return game attribute of ServerGameLogic class.
|
||||
*
|
||||
* @return game as a Game object.
|
||||
*/
|
||||
public Game getGame() {
|
||||
return this.game;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be used to return currentState attribute of ServerGameLogic class.
|
||||
*
|
||||
* @return currentState as a ServerState object.
|
||||
*/
|
||||
public ServerState getCurrentState() {
|
||||
return this.currentState;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be used to return lobbyState attribute of ServerGameLogic class.
|
||||
*
|
||||
* @return lobbyState as a ServerState object.
|
||||
*/
|
||||
public ServerState getLobbyState() {
|
||||
return this.lobbyState;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be used to return gameState attribute of ServerGameLogic class.
|
||||
*
|
||||
* @return gameState as a ServerState object.
|
||||
*/
|
||||
public ServerState getGameState() {
|
||||
return this.gameState;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be used to return interruptState attribute of ServerGameLogic class.
|
||||
*
|
||||
* @return interruptState as a ServerState object.
|
||||
*/
|
||||
public ServerState getInterruptState() {
|
||||
return this.interruptState;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be used to return ceremonyState attribute of ServerGameLogic class.
|
||||
*
|
||||
* @return ceremonyState as a ServerState object.
|
||||
*/
|
||||
public ServerState getCeremonyState() {
|
||||
return this.ceremonyState;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be used to set currentState attribute of ServerGameLogic class to the given state parameter.
|
||||
* In Addition, the currentState will be exited, changed and entered.
|
||||
*
|
||||
* @param state as the new currentState attribute as a ServerState object.
|
||||
*/
|
||||
public void setCurrentState(ServerState state) {
|
||||
if (this.currentState != null) {
|
||||
this.currentState.exit();
|
||||
}
|
||||
this.currentState = state;
|
||||
this.currentState.enter();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package pp.mdga.server;
|
||||
|
||||
public class Turn extends GameState {
|
||||
public Turn(ServerGameLogic logic) {
|
||||
super(logic);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user