added classes for client and server state machine

- a client state machine consits out of a 'ClientState' (every state of the machine) and a 'ClientStateMachine' (every state, which consists out of states), the machine starts with the ClientAutomaton
- analog for server
- started to implement logic for the server, transition from 'Lobby' to 'GameState'
This commit is contained in:
Daniel Grigencha
2024-11-17 15:27:09 +01:00
parent a9fd13caab
commit aae7ed9a87
82 changed files with 719 additions and 72 deletions

View File

@@ -1,4 +1,65 @@
package pp.mdga.server;
public class ServerState {
import pp.mdga.game.Piece;
import pp.mdga.message.client.*;
import pp.mdga.message.server.PossibleCard;
import java.lang.System.Logger;
public abstract class ServerState implements Observer {
protected static final Logger LOGGER = System.getLogger(ServerState.class.getName());
protected ServerState parent;
protected ServerGameLogic logic;
public ServerState(ServerState parent, ServerGameLogic logic) {
this.parent = parent;
this.logic = logic;
}
public void entry() { /* do nothing */ }
public void receivedAnimationEnd(AnimationEnd msg) { /* do nothing */ }
// todo piece?
public void receivedConfirmPiece(Piece piece) { /* do nothing */ }
public void receivedDeselectTSK(DeselectTSK msg) { /* do nothing */ }
public void receivedNoPowerCard(NoPowerCard msg) { /* do nothing */ }
public void receivedNotReady(LobbyNotReady msg) { /* do nothing */ }
public void receivedPowerCardChoice(SelectCard msg) { /* do nothing */ }
public void receivedReady(LobbyReady msg) { /* do nothing */ }
public void receivedRequestDice(RequestDice msg) { /* do nothing */ }
// todo msg?
public void receivedRollRankingDice() { /* do nothing */ }
public void receivedSelectTSK(SelectTSK msg) { /* do nothing */ }
public void receivedSelectedPieces(SelectedPieces msg) { /* do nothing */ }
public void receivedStartGame(ClientStartGame msg) { /* do nothing */ }
public void sentPossibleCard(PossibleCard msg) { /* do nothing */ }
// todo msg?, sent to everyone?
public void sentRankingResponse() { /* do nothing */ }
public void gotoState(ServerState state) {
throw new IllegalStateException("not in a statemachine");
}
public ServerState getParent() {
return parent;
}
public void update() { /* do nothing */ }
@Override
public String toString() {
return getClass().getSimpleName();
}
}