47 Commits

Author SHA1 Message Date
Felix Koppe
c4e5b7f7c8 Merge main 2024-11-28 15:02:41 +01:00
Felix
35cf092d5c Merge commit 2024-11-27 08:44:29 +01:00
Felix
06e2d831ef Fix errors 2024-11-27 08:42:45 +01:00
Felix
75b53f8309 Fix model compile errors 2024-11-27 08:39:50 +01:00
Felix
58f94e73db Merge commit 2024-11-26 20:23:23 +01:00
Fleischer Hanno
46a6552bca refactored the whole client package structure 2024-11-26 11:12:58 +01:00
Fleischer Hanno
1d95146272 refactored the model to incoporate a correct folder structure 2024-11-26 11:12:56 +01:00
Benjamin Feyer
9859d52e02 edted some tests with null tests 2024-11-26 11:12:55 +01:00
Benjamin Feyer
e18ea15efa added javadocs 2024-11-26 11:12:54 +01:00
Benjamin Feyer
461a497353 added some more testmethods 2024-11-26 11:12:54 +01:00
Benjamin Feyer
4c3099ddf2 corrected testmethods in clientStateTest 2024-11-26 11:12:54 +01:00
Benjamin Feyer
b0ab870451 added tests in the serverStateTest
added the testmethods for rolldice and movepiece
2024-11-26 11:12:54 +01:00
Benjamin Feyer
993c94c306 edited some tests in ServerStateTest 2024-11-26 11:12:54 +01:00
Benjamin Feyer
e52af59cac minor changes 2024-11-26 11:12:54 +01:00
Benjamin Feyer
40f1bdb51f added some testmethods and corrected other in the clientStatemachineTests 2024-11-26 11:12:54 +01:00
Benjamin Feyer
436dae4ebc added some testmethods for the client testing the statechanges in the dialogs 2024-11-26 11:12:54 +01:00
Benjamin Feyer
1b2d4df96f added some mor testcases for the clientstatemachine 2024-11-26 11:12:54 +01:00
Benjamin Feyer
f3ca9f01c0 added the empty testmethods in serverstateTest and edited the testmethods for substates of choocePiece in Client into MovePiece 2024-11-26 11:12:54 +01:00
Benjamin Feyer
3c97cdae38 edited a test in the clientStateTest 2024-11-26 11:12:54 +01:00
Benjamin Feyer
227d4286e5 editet tests for the server and client statemachines 2024-11-26 11:12:54 +01:00
Benjamin Feyer
9939ec2861 added empty serverstatetests 2024-11-26 11:12:54 +01:00
Benjamin Feyer
1a6a460f9f initial test commit,
added all testclasses except Playertest, Viewtest, Cameratest, SettingsTest, SoundTest, ReactionTest and ClientStateTest. And filled all created testclasses with empty testmethods, except ServerStateTest.
2024-11-26 11:12:54 +01:00
Daniel Grigencha
ec58e9c85f added import statement with the refactored server messages 2024-11-26 11:12:54 +01:00
Daniel Grigencha
cf6777023f added mdga server controller 2024-11-26 11:12:54 +01:00
Daniel Grigencha
739279d3df added new server state chart 2024-11-26 11:12:52 +01:00
Daniel Grigencha
b6bf25671f reverted server messages 2024-11-26 11:12:50 +01:00
Daniel Grigencha
5a9fd2a939 deleted server state automaton 2024-11-26 11:12:49 +01:00
Hanno Fleischer
e1b21de718 added two Pieces in RequestPlayCard in order to differentiate between own and enemy pieces 2024-11-26 11:12:39 +01:00
Hanno Fleischer
f321608132 added two lists in PossiblePiece in order to differentiate between own and enemy pieces 2024-11-26 11:12:39 +01:00
Hanno Fleischer
dd7a27629b added static methods to construct a PlayCard message for each card type 2024-11-26 11:12:39 +01:00
Hanno Fleischer
eba681c350 added getter for ArrayList Player in Game and created a flag for ready status in Player 2024-11-26 11:12:39 +01:00
Daniel Grigencha
f97eea3e5e added default constructor for serialization purposes 2024-11-26 11:12:39 +01:00
Hanno Fleischer
1582038dfe added an ArrayList of Player in game and added the received methods in clientgamelogic 2024-11-26 11:12:39 +01:00
Daniel Grigencha
798e996a8d fixed sonarlint errors and deleted map playerConnectionID 2024-11-26 11:12:39 +01:00
Fleischer Hanno
472d87b0c9 refactored ceremony message 2024-11-26 11:12:39 +01:00
Fleischer Hanno
7cfb863e5c corrected refactoring mistake, ich which RankingResponce was renamed to RankingResponse 2024-11-26 11:12:35 +01:00
Fleischer Hanno
7e1d2e833e added getter for dialogstatemachine in dialogs 2024-11-26 11:12:30 +01:00
Fleischer Hanno
67a87ffa81 made all con structors of clients states public 2024-11-26 11:12:30 +01:00
Daniel Grigencha
12fbf4e77e added javadocs to all server messages 2024-11-26 11:12:30 +01:00
Daniel Grigencha
f6d16a81bf added javadocs to all client messages 2024-11-26 11:12:30 +01:00
Fleischer Hanno
6938ce16b7 added the constructors for all client states and their statemachines 2024-11-26 11:12:30 +01:00
Daniel Grigencha
85ea4d340c added more logic for the server state diagram 2024-11-26 11:12:30 +01:00
Fleischer Hanno
e3d5d8e2e9 added message contents to the messages
addedn the conentents for all messages regarding the BPMN diagramm and own interpretation.
also created an identifier for pieces to be used for network communication between server and client so that they talk about the same piece.
2024-11-26 11:12:30 +01:00
Daniel Grigencha
6dfb2980fa added more logic for the server state diagram 2024-11-26 11:12:26 +01:00
Fleischer Hanno
f3894a5058 added a method to check if a player has pieces in his waiting area 2024-11-26 11:11:51 +01:00
Hanno Fleischer
787d8b558c added the method tryMove and the methods used by it into serverstate 2024-11-26 11:11:51 +01:00
Daniel Grigencha
3949a00932 added more logic for the server state diagram 2024-11-26 11:11:51 +01:00
6 changed files with 82 additions and 137 deletions

View File

@@ -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;
}
}

View File

@@ -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);
}
}

View File

@@ -0,0 +1,7 @@
package pp.mdga.server;
public class DetermineStartPlayer extends GameState {
public DetermineStartPlayer(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -0,0 +1,7 @@
package pp.mdga.server;
public class GameState extends ServerState {
public GameState(ServerGameLogic logic) {
super(logic);
}
}

View File

@@ -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();
}
}

View File

@@ -0,0 +1,7 @@
package pp.mdga.server;
public class Turn extends GameState {
public Turn(ServerGameLogic logic) {
super(logic);
}
}