Merge remote-tracking branch 'origin/development' into development

This commit is contained in:
Fleischer Hanno
2024-12-01 23:42:56 +01:00
3 changed files with 28 additions and 2 deletions

View File

@@ -107,7 +107,7 @@ public void simpleInitApp() {
gameView = new GameView(this);
ceremonyView = new CeremonyView(this);
enter(MdgaState.GAME);
enter(MdgaState.MAIN);
}
/**

View File

@@ -1,17 +1,33 @@
package pp.mdga.message.server;
import com.jme3.network.serializing.Serializable;
import pp.mdga.game.Board;
/**
* A message indicating that the game shall start.
*/
@Serializable
public class ServerStartGameMessage extends ServerMessage {
/**
* Create ServerStartGameMessage attributes.
*/
private final Board board;
/**
* Constructs a new ServerStartGame instance.
*/
public ServerStartGameMessage() {
super();
this.board = null;
}
/**
* Constructor.
*
* @param board as the complete board of this game as a Board object.
*/
public ServerStartGameMessage(Board board) {
this.board = board;
}
/**
@@ -24,6 +40,15 @@ public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* This method will be used to return board attribute of ServerStartGameMessage class.
*
* @return board as a Board object.
*/
public Board getBoard() {
return this.board;
}
/**
* Returns a string representation of this message.
*

View File

@@ -109,6 +109,7 @@ public void received(LobbyReadyMessage msg, int from) {
}
this.logic.getGame().setAllReady(true);
this.logic.getServerSender().broadcast(new ServerStartGameMessage(this.logic.getGame().getBoard()));
}
/**
@@ -149,7 +150,7 @@ public void received(LeaveGameMessage msg, int from) {
@Override
public void received(StartGameMessage msg, int from) {
if (msg.isForceStartGame() || this.logic.getGame().allReady()) {
this.logic.getServerSender().broadcast(new ServerStartGameMessage());
this.logic.getServerSender().broadcast(new ServerStartGameMessage(this.logic.getGame().getBoard()));
this.logic.setCurrentState(this.logic.getGameState());
}
}