Merge branch 'development' into 'dev/test'

Development

See merge request progproj/gruppen-ht24/Gruppe-01!13
This commit is contained in:
Benjamin Feyer
2024-11-24 20:58:39 +00:00
90 changed files with 1958 additions and 217 deletions

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class Animation extends ClientState {
protected Animation(ClientState parent, ClientGameLogic logic) {
public Animation(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class AudioSettings extends ClientState {
protected AudioSettings(ClientState parent, ClientGameLogic logic) {
public AudioSettings(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -3,8 +3,12 @@
public class Ceremony extends ClientState {
private final CeremonyStateMachine ceremonyStateMachine;
protected Ceremony(ClientState parent, ClientGameLogic logic) {
public Ceremony(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
this.ceremonyStateMachine = new CeremonyStateMachine(parent, logic);
}
public CeremonyStateMachine getCeremonyStateMachine() {
return ceremonyStateMachine;
}
}

View File

@@ -2,7 +2,7 @@
public class CeremonyStateMachine extends ClientStateMachine {
protected CeremonyStateMachine(ClientState parent, ClientGameLogic logic) {
public CeremonyStateMachine(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}

View File

@@ -1,10 +1,15 @@
package pp.mdga.client;
public class ChoosePiece extends ClientState {
private final ChoosePieceStateMachine choosePieceStateMachine;
protected ChoosePiece(ClientState parent, ClientGameLogic logic) {
public ChoosePiece(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
this.choosePieceStateMachine = new ChoosePieceStateMachine(parent, logic);
}
public ChoosePieceStateMachine getChoosePieceStateMachine() {
return choosePieceStateMachine;
}
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class ChoosePieceStateMachine extends ClientStateMachine{
protected ChoosePieceStateMachine(ClientState parent, ClientGameLogic logic) {
public ChoosePieceStateMachine(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class ChoosePowerCard extends ClientState {
protected ChoosePowerCard(ClientState parent, ClientGameLogic logic) {
public ChoosePowerCard(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -2,7 +2,6 @@
import pp.mdga.game.Game;
import pp.mdga.message.client.ClientMessage;
import pp.mdga.server.ServerSender;
public class ClientGameLogic {
static final System.Logger LOGGER = System.getLogger(ClientGameLogic.class.getName());

View File

@@ -3,8 +3,12 @@
public class DetermineStartPlayer extends ClientState {
private final DetermineStartPlayerStateMachine determineStartPlayerStateMachine;
protected DetermineStartPlayer(ClientState parent, ClientGameLogic logic) {
public DetermineStartPlayer(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
this.determineStartPlayerStateMachine = new DetermineStartPlayerStateMachine(parent, logic);
}
public DetermineStartPlayerStateMachine getDetermineStartPlayerStateMachine() {
return determineStartPlayerStateMachine;
}
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class DetermineStartPlayerStateMachine extends ClientStateMachine{
protected DetermineStartPlayerStateMachine(ClientState parent, ClientGameLogic logic) {
public DetermineStartPlayerStateMachine(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class DialogsStateMachine extends ClientStateMachine {
protected DialogsStateMachine(ClientState parent, ClientGameLogic logic) {
public DialogsStateMachine(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}

View File

@@ -3,8 +3,12 @@
public class GameState extends ClientState {
private final GameStateMachine gameStateMachine;
protected GameState(ClientState parent, ClientGameLogic logic) {
public GameState(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
this.gameStateMachine = new GameStateMachine(parent, logic);
}
public GameStateMachine getGameStateMachine() {
return gameStateMachine;
}
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class GameStateMachine extends ClientStateMachine {
protected GameStateMachine(ClientState parent, ClientGameLogic logic) {
public GameStateMachine(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}

View File

@@ -1,7 +1,5 @@
package pp.mdga.client;
import pp.mdga.server.GameState;
public class Interrupt extends ClientState {
private final GameState lastState;
@@ -11,4 +9,3 @@ public Interrupt(ClientState parent, ClientGameLogic logic, GameState lastState)
this.lastState = lastState;
}
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class Lobby extends ClientState {
protected Lobby(ClientState parent, ClientGameLogic logic) {
public Lobby(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class MainSettings extends ClientState {
protected MainSettings(ClientState parent, ClientGameLogic logic) {
public MainSettings(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class MovePiece extends ClientState {
protected MovePiece(ClientState parent, ClientGameLogic logic) {
public MovePiece(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class NetworkDialog extends ClientState {
protected NetworkDialog(ClientState parent, ClientGameLogic logic) {
public NetworkDialog(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class NoPiece extends ClientState {
protected NoPiece(ClientState parent, ClientGameLogic logic) {
public NoPiece(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class PlayPowerCard extends ClientState {
protected PlayPowerCard(ClientState parent, ClientGameLogic logic) {
public PlayPowerCard(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class Podium extends ClientState {
protected Podium(ClientState parent, ClientGameLogic logic) {
public Podium(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -3,8 +3,12 @@
public class PowerCard extends ClientState {
private final PowerCardStateMachine powerCardStateMachine;
protected PowerCard(ClientState parent, ClientGameLogic logic) {
public PowerCard(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
this.powerCardStateMachine = new PowerCardStateMachine(parent, logic);
}
public PowerCardStateMachine getPowerCardStateMachine() {
return powerCardStateMachine;
}
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class PowerCardStateMachine extends ClientStateMachine {
protected PowerCardStateMachine(ClientState parent, ClientGameLogic logic) {
public PowerCardStateMachine(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class RollDice extends ClientState {
protected RollDice(ClientState parent, ClientGameLogic logic) {
public RollDice(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class RollRankingDice extends ClientState {
protected RollRankingDice(ClientState parent, ClientGameLogic logic) {
public RollRankingDice(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class SelectPiece extends ClientState {
protected SelectPiece(ClientState parent, ClientGameLogic logic) {
public SelectPiece(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -3,8 +3,12 @@
public class Settings extends ClientState {
private final SettingsStateMachine settingsStateMachine;
protected Settings(ClientState parent, ClientGameLogic logic) {
public Settings(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
this.settingsStateMachine = new SettingsStateMachine(parent, logic);
}
public SettingsStateMachine getSettingsStateMachine() {
return settingsStateMachine;
}
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class SettingsStateMachine extends ClientStateMachine {
protected SettingsStateMachine(ClientState parent, ClientGameLogic logic) {
public SettingsStateMachine(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class Shield extends ClientState {
protected Shield(ClientState parent, ClientGameLogic logic) {
public Shield(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class Spectator extends ClientState {
protected Spectator(ClientState parent, ClientGameLogic logic) {
public Spectator(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class StartDialog extends ClientState {
protected StartDialog(ClientState parent, ClientGameLogic logic) {
public StartDialog(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class StartPiece extends ClientState {
protected StartPiece(ClientState parent, ClientGameLogic logic) {
public StartPiece(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class Statistics extends ClientState {
protected Statistics(ClientState parent, ClientGameLogic logic) {
public Statistics(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class Swap extends ClientState {
protected Swap(ClientState parent, ClientGameLogic logic) {
public Swap(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -3,8 +3,12 @@
public class Turn extends ClientState {
private final TurnStateMachine turnStateMachine;
protected Turn(ClientState parent, ClientGameLogic logic) {
public Turn(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
this.turnStateMachine = new TurnStateMachine(parent, logic);
}
public TurnStateMachine getTurnStateMachine() {
return turnStateMachine;
}
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class TurnStateMachine extends ClientStateMachine {
protected TurnStateMachine(ClientState parent, ClientGameLogic logic) {
public TurnStateMachine(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class VideoSettings extends ClientState {
protected VideoSettings(ClientState parent, ClientGameLogic logic) {
public VideoSettings(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class WaitRanking extends ClientState {
protected WaitRanking(ClientState parent, ClientGameLogic logic) {
public WaitRanking(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class Waiting extends ClientState {
protected Waiting(ClientState parent, ClientGameLogic logic) {
public Waiting(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,7 +1,7 @@
package pp.mdga.client;
public class WaitingPiece extends ClientState {
protected WaitingPiece(ClientState parent, ClientGameLogic logic) {
public WaitingPiece(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
}

View File

@@ -1,11 +1,35 @@
package pp.mdga.message.client;
import com.jme3.network.serializing.Serializable;
/**
* A message indicating an animation event is finished in the game.
*/
@Serializable
public class AnimationEnd extends ClientMessage {
@Override
public String toString() {
return "null";
/**
* Constructs an AnimationEnd message.
*/
public AnimationEnd() {
super();
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "AnimationEnd{}";
}
/**
* Accepts a visitor for processing this message.
*
* @param interpreter the visitor to be used for processing
* @param from the connection ID of the sender
*/
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);

View File

@@ -1,37 +1,143 @@
package pp.mdga.message.client;
/**
* Visitor interface for processing all client messages.
*/
public interface ClientInterpreter {
void received(AnimationEnd animationEnd, int from);
/**
* Processes a received AnimationEnd message.
*
* @param msg the AnimationEnd message to be processed
* @param from the connection ID from which the message was received
*/
void received(AnimationEnd msg, int from);
void received(DeselectTSK deselectTSK , int from);
/**
* Processes a received DeselectTSK message.
*
* @param msg the DeselectTSK message to be processed
* @param from the connection ID from which the message was received
*/
void received(DeselectTSK msg, int from);
void received(ForceStartGame forceStartGame, int from);
void received(JoinServer joinServer , int from);
/**
* Processes a received ForceStartGame message.
*
* @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(LeaveGame leaveGame , int from);
/**
* Processes a received JoinServer message.
*
* @param msg the JoinServer message to be processed
* @param from the connection ID from which the message was received
*/
void received(JoinServer msg, int from);
void received(LobbyNotReady lobbyNotReady , int from);
/**
* Processes a received LeaveGame message.
*
* @param msg the LeaveGame message to be processed
* @param from the connection ID from which the message was received
*/
void received(LeaveGame msg, int from);
void received(LobbyReady lobbyReady , int from);
/**
* Processes a received LobbyNotReady message.
*
* @param msg the LobbyNotReady message to be processed
* @param from the connection ID from which the message was received
*/
void received(LobbyNotReady msg, int from);
void received(RequestBriefing requestBriefing , int from);
/**
* Processes a received LobbyReady message.
*
* @param msg the LobbyReady message to be processed
* @param from the connection ID from which the message was received
*/
void received(LobbyReady msg, int from);
void received(RequestDice requestDice , int from);
/**
* Processes a received RequestBriefing message.
*
* @param msg the RequestBriefing message to be processed
* @param from the connection ID from which the message was received
*/
void received(RequestBriefing msg, int from);
void received(RequestMove requestMove , int from);
/**
* Processes a received RequestDice message.
*
* @param msg the RequestDice message to be processed
* @param from the connection ID from which the message was received
*/
void received(RequestDice msg, int from);
void received(RequestPlayCard requestPlayCard , int from);
/**
* Processes a received RequestMove message.
*
* @param msg the RequestMove message to be processed
* @param from the connection ID from which the message was received
*/
void received(RequestMove msg, int from);
void received(SelectCard selectCard , int from);
/**
* Processes a received RequestPlayCard message.
*
* @param msg the RequestPlayCard message to be processed
* @param from the connection ID from which the message was received
*/
void received(RequestPlayCard msg, int from);
void received(SelectTSK selectTSK , int from);
/**
* Processes a received SelectCard message.
*
* @param msg the SelectCard message to be processed
* @param from the connection ID from which the message was received
*/
void received(SelectCard msg, int from);
void received(ForceContinueGame forceContinueGame, int from);
/**
* Processes a received SelectTSK message.
*
* @param msg the SelectTSK message to be processed
* @param from the connection ID from which the message was received
*/
void received(SelectTSK msg, int from);
void received(ClientStartGame clientStartGame, int from);
/**
* Processes a received ForceContinueGame message.
*
* @param msg the ForceContinueGame message to be processed
* @param from the connection ID from which the message was received
*/
void received(ForceContinueGame msg, int from);
void received(NoPowerCard noPowerCard, int from);
/**
* Processes a received ClientStartGame message.
*
* @param msg the ClientStartGame message to be processed
* @param from the connection ID from which the message was received
*/
void received(ClientStartGame msg, int from);
void received(SelectedPieces selectedPieces, int from);
/**
* Processes a received NoPowerCard message.
*
* @param msg the NoPowerCard message to be processed
* @param from the connection ID from which the message was received
*/
void received(NoPowerCard msg, int from);
/**
* Processes a received SelectedPieces message.
*
* @param msg the SelectedPieces message to be processed
* @param from the connection ID from which the message was received
*/
void received(SelectedPieces msg, int from);
}

View File

@@ -2,10 +2,23 @@
import com.jme3.network.AbstractMessage;
/**
* An abstract base class for client messages used in network transfer.
* It extends the AbstractMessage class provided by the jme3-network library.
*/
public abstract class ClientMessage extends AbstractMessage {
/**
* Constructs a new ClientMessage instance.
*/
protected ClientMessage() {
super(true);
}
/**
* Accepts a visitor for processing this message.
*
* @param interpreter the visitor to be used for processing
* @param from the connection ID of the sender
*/
public abstract void accept(ClientInterpreter interpreter, int from);
}

View File

@@ -1,11 +1,35 @@
package pp.mdga.message.client;
import com.jme3.network.serializing.Serializable;
/**
* A message sent by the host to start the game.
*/
@Serializable
public class ClientStartGame extends ClientMessage {
@Override
public String toString() {
return "null";
/**
* Constructs a new ClientStartGame instance.
*/
public ClientStartGame() {
super();
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "ClientStartGame{}";
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
* @param from the connection ID from which the message was received
*/
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);

View File

@@ -1,23 +1,53 @@
package pp.mdga.message.client;
import com.jme3.network.serializing.Serializable;
import pp.mdga.game.Color;
/**
* A message sent by a client to deselect a TSK.
*/
@Serializable
public class DeselectTSK extends ClientMessage {
/**
* The color associated with the TSK to be deselected.
*/
private final Color color;
/**
* Constructs a new DeselectTSK message with the specified color.
*
* @param color the color associated with the TSK to be deselected
*/
public DeselectTSK(Color color) {
super();
this.color = color;
}
/**
* Returns the color associated with the TSK to be deselected.
*
* @return the color associated with the TSK to be deselected
*/
public Color getColor() {
return color;
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "null";
return "DeselectTSK{" + "color=" + color + '}';
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
* @param from the connection ID from which the message was received
*/
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);

View File

@@ -1,11 +1,35 @@
package pp.mdga.message.client;
import com.jme3.network.serializing.Serializable;
/**
* A message sent by the host to force the continuation of the game, when the game was interrupted.
*/
@Serializable
public class ForceContinueGame extends ClientMessage {
@Override
public String toString() {
return "null";
/**
* Constructs a new ForceContinueGame message.
*/
public ForceContinueGame() {
super();
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "ForceContinueGame{}";
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
* @param from the connection ID from which the message was received
*/
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);

View File

@@ -1,15 +1,35 @@
package pp.mdga.message.client;
public class ForceStartGame extends ClientMessage {
public ForceStartGame() {
import com.jme3.network.serializing.Serializable;
/**
* 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 {
/**
* Constructs a new ForceStartGame message.
*/
public ForceStartGame() {
super();
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "null";
return "ForceStartGame{}";
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
* @param from the connection ID from which the message was received
*/
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);

View File

@@ -1,11 +1,35 @@
package pp.mdga.message.client;
import com.jme3.network.serializing.Serializable;
/**
* A message sent by a client when joining the server.
*/
@Serializable
public class JoinServer extends ClientMessage {
@Override
public String toString() {
return "null";
/**
* Constructs a new JoinServer instance.
*/
public JoinServer() {
super();
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "JoinServer{}";
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
* @param from the connection ID from which the message was received
*/
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);

View File

@@ -1,11 +1,35 @@
package pp.mdga.message.client;
import com.jme3.network.serializing.Serializable;
/**
* A message sent by a client to leave the game.
*/
@Serializable
public class LeaveGame extends ClientMessage {
@Override
public String toString() {
return "null";
/**
* Constructs a new LeaveGame instance.
*/
public LeaveGame() {
super();
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "LeaveGame{}";
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
* @param from the connection ID from which the message was received
*/
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);

View File

@@ -1,11 +1,35 @@
package pp.mdga.message.client;
import com.jme3.network.serializing.Serializable;
/**
* A message sent by a client to unready in the lobby.
*/
@Serializable
public class LobbyNotReady extends ClientMessage {
@Override
public String toString() {
return "null";
/**
* Constructs a new LobbyNotReady instance.
*/
public LobbyNotReady() {
super();
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "LobbyNotReady{}";
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
* @param from the connection ID from which the message was received
*/
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);

View File

@@ -1,11 +1,35 @@
package pp.mdga.message.client;
import com.jme3.network.serializing.Serializable;
/**
* A message sent by the client to ready-up in the lobby.
*/
@Serializable
public class LobbyReady extends ClientMessage {
@Override
public String toString() {
return "null";
/**
* Constructs a new LobbyReady instance.
*/
public LobbyReady() {
super();
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "LobbyReady{}";
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
* @param from the connection ID from which the message was received
*/
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);

View File

@@ -1,11 +1,35 @@
package pp.mdga.message.client;
import com.jme3.network.serializing.Serializable;
/**
* A message sent by a client to indicate that the player is not using a power card.
*/
@Serializable
public class NoPowerCard extends ClientMessage {
@Override
public String toString() {
return "null";
/**
* Constructs a new NoPowerCard instance.
*/
public NoPowerCard() {
super();
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "NoPowerCard{}";
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
* @param from the connection ID from which the message was received
*/
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);

View File

@@ -1,11 +1,35 @@
package pp.mdga.message.client;
import com.jme3.network.serializing.Serializable;
/**
* A message sent by a client to request a briefing from the server. (after a reconnect)
*/
@Serializable
public class RequestBriefing extends ClientMessage {
@Override
public String toString() {
return "null";
/**
* Constructs a new RequestBriefing instance.
*/
public RequestBriefing() {
super();
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "RequestBriefing{}";
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
* @param from the connection ID from which the message was received
*/
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);

View File

@@ -1,11 +1,35 @@
package pp.mdga.message.client;
import com.jme3.network.serializing.Serializable;
/**
* A message sent by a client to request a die roll.
*/
@Serializable
public class RequestDice extends ClientMessage {
@Override
public String toString() {
return "null";
/**
* Constructs a new RequestDice instance.
*/
public RequestDice() {
super();
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "RequestDice{}";
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
* @param from the connection ID from which the message was received
*/
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);

View File

@@ -1,30 +1,49 @@
package pp.mdga.message.client;
import pp.mdga.game.Color;
import com.jme3.network.serializing.Serializable;
/**
* A message sent by a client to request a move for a piece.
*/
@Serializable
public class RequestMove extends ClientMessage {
/**
* The identifier for the piece.
*/
private final String pieceIdentifier;
/** Constructor for RequestMove
/**
* Constructor for RequestMove
* @param pieceIdentifier the piece identifier
*/
public RequestMove(String pieceIdentifier) {
this.pieceIdentifier = pieceIdentifier;
}
/** Getter for the piece identifier
/**
* Getter for the piece identifier
* @return the piece identifier
*/
public String getPieceIdentifier() {
return pieceIdentifier;
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return pieceIdentifier;
return "RequestMove{pieceIdentifier = " + pieceIdentifier + '}';
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
* @param from the connection ID from which the message was received
*/
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);

View File

@@ -1,30 +1,68 @@
package pp.mdga.message.client;
import com.jme3.network.serializing.Serializable;
import pp.mdga.game.BonusCard;
/**
* A message sent by a client to request playing a bonus card.
*/
@Serializable
public class RequestPlayCard extends ClientMessage {
/**
* The bonus card to be played.
*/
private final BonusCard card;
/**
* The identifier of the piece.
*/
private final String pieceIdentifier;
/**
* Constructs a new RequestPlayCard instance.
*
* @param card the bonus card to be played
* @param pieceIdentifier the identifier of the piece
*/
public RequestPlayCard(BonusCard card, String pieceIdentifier) {
this.pieceIdentifier = pieceIdentifier;
this.card = card;
}
/**
* Gets the bonus card associated with this request.
*
* @return the bonus card
*/
public BonusCard getCard() {
return card;
}
/**
* Gets the piece identifier associated with this request.
*
* @return the piece identifier
*/
public String getPieceIdentifier() {
return pieceIdentifier;
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return card.toString();
return "RequestPlayCard={card=" + card.toString() + '}';
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
* @param from the connection ID from which the message was received
*/
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);

View File

@@ -1,24 +1,52 @@
package pp.mdga.message.client;
import com.jme3.network.serializing.Serializable;
import pp.mdga.game.BonusCard;
/**
* A message sent from the client to the server to select a bonus card.
*/
@Serializable
public class SelectCard extends ClientMessage {
/**
* The bonus card to be selected.
*/
private final BonusCard card;
/**
* Constructs a new SelectCard instance.
*
* @param card the bonus card to be selected
*/
public SelectCard(BonusCard card) {
this.card = card;
}
/**
* Gets the bonus card associated with this selection.
*
* @return the bonus card
*/
public BonusCard getCard() {
return card;
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "null";
return "SelectCard{card=" + card + '}';
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
* @param from the connection ID from which the message was received
*/
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);

View File

@@ -1,7 +1,9 @@
package pp.mdga.message.client;
import com.jme3.network.serializing.Serializable;
import pp.mdga.game.Color;
@Serializable
public class SelectTSK extends ClientMessage {
private final Color color;
@@ -13,12 +15,23 @@ public SelectTSK(Color color) {
public Color getColor() {
return color;
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "null";
return "SelectTSK{color=" + color + '}';
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
* @param from the connection ID from which the message was received
*/
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);

View File

@@ -1,30 +1,49 @@
package pp.mdga.message.client;
import pp.mdga.game.Color;
import com.jme3.network.serializing.Serializable;
/**
* A message sent by a client to indicate that a piece has been selected for a bonus cards.
*/
@Serializable
public class SelectedPieces extends ClientMessage {
/**
* The piece identifier.
*/
private String pieceIdentifier;
/** Constructor for SelectedPieces
/**
* Constructor for SelectedPieces
* @param pieceIdentifier the piece identifier
*/
public SelectedPieces(String pieceIdentifier) {
this.pieceIdentifier = pieceIdentifier;
}
/** Getter for the piece identifier
/**
* Getter for the piece identifier
* @return the piece identifier
*/
public String getPieceIdentifier() {
return pieceIdentifier;
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "null";
return "SelectedPieces{pieceIdentifier=" + pieceIdentifier + '}';
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
* @param from the connection ID from which the message was received
*/
@Override
public void accept(ClientInterpreter interpreter, int from) {
interpreter.received(this, from);

View File

@@ -1,30 +1,63 @@
package pp.mdga.message.server;
import com.jme3.network.serializing.Serializable;
import pp.mdga.game.Color;
/**
* A message sent by the server to inform the clients about the active player.
*/
@Serializable
public class ActivePlayer extends ServerMessage {
private Color color;
/**
* The color of the active player.
*/
private final Color color;
/** Constructor for ActivePlayer
/**
* Constructor for ActivePlayer
*
* @param color the color of the active player
*/
public ActivePlayer(Color color) {
super();
this.color = color;
}
/** Getter for the color of the active player
/**
* Getter for the color of the active player
*
* @return the color of the active player
*/
public Color getColor() {
return color;
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "ActivePlayer{color=" + color + '}';
}
/**
* Returns the key for the informational text associated with this message.
*
* @return the key for the informational text
*/
@Override
public String getInfoTextKey() {
return "";

View File

@@ -1,36 +1,71 @@
package pp.mdga.message.server;
import com.jme3.network.serializing.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* A message sent by the server to the active player containing a list of pieces that the player can move any piece of the list on the board.
*/
@Serializable
public class AnyPiece extends ServerMessage {
/**
* The list of pieces
*/
private final ArrayList<String> piece;
private ArrayList<String> piece;
/** Constructor for AnyPiece
/**
* Constructor for AnyPiece
*/
public AnyPiece() {
super();
piece = new ArrayList<>();
}
/** Add a piece to the list of pieces
/**
* Add a piece to the list of pieces
*
* @param piece the piece to add
*/
public void addPiece(String piece) {
this.piece.add(piece);
}
/** Getter for the list of pieces
/**
* Getter for the list of pieces
*
* @return the list of pieces
*/
public ArrayList<String> getPiece() {
public List<String> getPiece() {
return piece;
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "AnyPiece{piece=" + piece + '}';
}
/**
* Returns the key for the info text of this message.
*
* @return the key for the info text of this message
*/
@Override
public String getInfoTextKey() {
return "";

View File

@@ -1,11 +1,44 @@
package pp.mdga.message.server;
public class Briefing extends ServerMessage {
@Override
public void accept(ServerInterpreter interpreter) {
import com.jme3.network.serializing.Serializable;
/**
* A message sent by the server to the reconnected player to provide a briefing about the current game state.
*/
@Serializable
public class Briefing extends ServerMessage {
/**
* Constructs a new Briefing instance.
*/
public Briefing() {
super();
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "";
}
/**
* Returns the key for the info text of this message.
*
* @return the key for the info text of this message
*/
@Override
public String getInfoTextKey() {
return "";

View File

@@ -1,11 +1,44 @@
package pp.mdga.message.server;
public class Ceremony extends ServerMessage {
@Override
public void accept(ServerInterpreter interpreter) {
import com.jme3.network.serializing.Serializable;
/**
* A message sent by the server to indicate the beginning of the ceremony.
*/
@Serializable
public class Ceremony extends ServerMessage {
/**
* Constructs a new Ceremony instance.
*/
public Ceremony() {
super();
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "";
}
/**
* Returns the key for the info text of this message.
*
* @return the key for the info text of this message
*/
@Override
public String getInfoTextKey() {
return "";

View File

@@ -1,22 +1,39 @@
package pp.mdga.message.server;
import java.util.ArrayList;
import com.jme3.network.serializing.Serializable;
import java.util.List;
/**
* A message sent by the server to the client to inform about the dice roll.
*/
@Serializable
public class Dice extends ServerMessage {
/**
* The eye of the dice
*/
private final int diceEye;
private final ArrayList<String> moveablePieces;
/** Constructor for Dice
* @param diceEye the eye of the dice
/**
* The pieces that can be moved
*/
private final List<String> moveablePieces;
/**
* Constructor for Dice
*
* @param diceEye the eye of the dice
* @param moveablePieces the pieces that can be moved
*/
public Dice(int diceEye, ArrayList<String> moveablePieces) {
public Dice(int diceEye, List<String> moveablePieces) {
super();
this.diceEye = diceEye;
this.moveablePieces = moveablePieces;
}
/** Constructor for inactivePlayer
/**
* Constructor for inactivePlayer
*
* @param diceEye the eye of the dice
* @return a new Dice object
*/
@@ -24,34 +41,60 @@ public static Dice inactivePlayer(int diceEye) {
return new Dice(diceEye, null);
}
/** Constructor for activePlayer
* @param diceEye the eye of the dice
/**
* Constructor for activePlayer
*
* @param diceEye the eye of the dice
* @param moveablePieces the pieces that can be moved
* @return a new Dice object
*/
public static Dice activePlayer(int diceEye, ArrayList<String> moveablePieces) {
public static Dice activePlayer(int diceEye, List<String> moveablePieces) {
return new Dice(diceEye, moveablePieces);
}
/** Getter for the eye of the dice
/**
* Getter for the eye of the dice
*
* @return the eye of the dice
*/
public int getDiceEye() {
return diceEye;
}
/** Getter for the pieces that can be moved
/**
* Getter for the pieces that can be moved
*
* @return the pieces that can be moved
*/
public ArrayList<String> getMoveablePieces() {
public List<String> getMoveablePieces() {
return moveablePieces;
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "";
}
/**
* Returns the key for the info text of this message.
*
* @return the key for the info text of this message
*/
@Override
public String getInfoTextKey() {
return "";

View File

@@ -1,11 +1,44 @@
package pp.mdga.message.server;
public class DiceAgain extends ServerMessage {
@Override
public void accept(ServerInterpreter interpreter) {
import com.jme3.network.serializing.Serializable;
/**
* A message sent by the server to the active player to indicate that they can roll the dice again.
*/
@Serializable
public class DiceAgain extends ServerMessage {
/**
* Constructs a new DiceAgain instance.
*/
public DiceAgain() {
super();
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "";
}
/**
* Returns the key for the info text of this message.
*
* @return the key for the info text of this message
*/
@Override
public String getInfoTextKey() {
return "";

View File

@@ -1,11 +1,44 @@
package pp.mdga.message.server;
public class DiceNow extends ServerMessage {
@Override
public void accept(ServerInterpreter interpreter) {
import com.jme3.network.serializing.Serializable;
/**
* A message sent by the server to the active player to enable the dice now button.
*/
@Serializable
public class DiceNow extends ServerMessage {
/**
* Constructs a new DiceNow instance.
*/
public DiceNow() {
super();
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "";
}
/**
* Returns the key for the info text of this message.
*
* @return the key for the info text of this message
*/
@Override
public String getInfoTextKey() {
return "";

View File

@@ -1,11 +1,44 @@
package pp.mdga.message.server;
public class EndOfTurn extends ServerMessage {
@Override
public void accept(ServerInterpreter interpreter) {
import com.jme3.network.serializing.Serializable;
/**
* A message sent by the server to indicate the end of the turn of the active player.
*/
@Serializable
public class EndOfTurn extends ServerMessage {
/**
* Constructs a new EndOfTurn instance.
*/
public EndOfTurn() {
super();
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "";
}
/**
* Returns the key for the info text of this message.
*
* @return the key for the info text of this message
*/
@Override
public String getInfoTextKey() {
return "";

View File

@@ -1,11 +1,44 @@
package pp.mdga.message.server;
public class LobbyAccept extends ServerMessage {
@Override
public void accept(ServerInterpreter interpreter) {
import com.jme3.network.serializing.Serializable;
/**
* A message sent by the server to indicate that the client has been accepted into the lobby.
*/
@Serializable
public class LobbyAccept extends ServerMessage {
/**
* Constructs a new LobbyAccept instance.
*/
public LobbyAccept() {
super();
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "";
}
/**
* Returns the key for the info text of this message.
*
* @return the key for the info text of this message
*/
@Override
public String getInfoTextKey() {
return "";

View File

@@ -1,11 +1,44 @@
package pp.mdga.message.server;
public class LobbyDeny extends ServerMessage {
@Override
public void accept(ServerInterpreter interpreter) {
import com.jme3.network.serializing.Serializable;
/**
* A message sent by the server to deny a client's request to join the lobby.
*/
@Serializable
public class LobbyDeny extends ServerMessage {
/**
* Constructs a new LobbyDeny instance.
*/
public LobbyDeny() {
super();
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "";
}
/**
* Returns the key for the info text of this message.
*
* @return the key for the info text of this message
*/
@Override
public String getInfoTextKey() {
return "";

View File

@@ -1,22 +1,62 @@
package pp.mdga.message.server;
import com.jme3.network.serializing.Serializable;
/**
* A message sent from the server to the client indicating that a player has joined the lobby.
*/
@Serializable
public class LobbyPlayerJoin extends ServerMessage {
/**
* The name of the player joining the lobby.
*/
private final String name;
/**
* Constructs a new LobbyPlayerJoin instance with the specified player name.
*
* @param name the name of the player joining the lobby
*/
public LobbyPlayerJoin(String name) {
super();
this.name = name;
}
/**
* Returns the name of the player joining the lobby.
*
* @return the name of the player joining the lobby
*/
public String getName() {
return name;
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "";
}
/**
* Returns the key for the info text of this message.
*
* @return the key for the info text of this message
*/
@Override
public String getInfoTextKey() {
return "";

View File

@@ -1,29 +1,78 @@
package pp.mdga.message.server;
import com.jme3.network.serializing.Serializable;
import pp.mdga.game.Color;
/**
* A message sent by the server to indicate that a player has left the lobby.
*/
@Serializable
public class LobbyPlayerLeave extends ServerMessage {
/**
* The name of the player leaving the lobby.
*/
private final String name;
/**
* The color associated with the player leaving the lobby.
*/
private final Color color;
/**
* Constructs a new LobbyPlayerLeave instance with the specified player name and color.
*
* @param name the name of the player leaving the lobby
* @param color the color associated with the player leaving the lobby
*/
public LobbyPlayerLeave(String name, Color color) {
super();
this.name = name;
this.color = color;
}
/**
* Returns the name of the player leaving the lobby.
*
* @return the name of the player leaving the lobby
*/
public String getName() {
return name;
}
/**
* Returns the color associated with the player leaving the lobby.
*
* @return the color associated with the player leaving the lobby
*/
public Color getColor() {
return color;
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "";
}
/**
* Returns the key for the info text of this message.
*
* @return the key for the info text of this message
*/
@Override
public String getInfoTextKey() {
return "";

View File

@@ -1,17 +1,30 @@
package pp.mdga.message.server;
public class MoveMessage extends ServerMessage {
import com.jme3.network.serializing.Serializable;
/**
* A message sent by the server to the client to move a piece on the board.
*/
@Serializable
public class MoveMessage extends ServerMessage {
/**
* The identifier of the piece that should be moved.
*/
private final String pieceIdentifier;
/**
* Constructs a new MoveMessage instance.
*
* @param identifier the identifier of the piece that should be moved
*/
public MoveMessage(String identifier) {
super();
this.pieceIdentifier = identifier;
}
/**
* Returns the identifier of the piece that should be moved.
*
* @return the identifier of the piece that should be moved
*/
public String getIdentifier() {
@@ -19,13 +32,30 @@ public String getIdentifier() {
}
/**
* @return the identifier of the piece that should be moved
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "";
}
/**
* Returns the key for the info text of this message.
*
* @return the key for the info text of this message
*/
@Override
public String getInfoTextKey() {
return "";

View File

@@ -1,11 +1,44 @@
package pp.mdga.message.server;
public class NoTurn extends ServerMessage {
@Override
public void accept(ServerInterpreter interpreter) {
import com.jme3.network.serializing.Serializable;
/**
* A message sent by the server to the active player to indicate that he has no valid moves.
*/
@Serializable
public class NoTurn extends ServerMessage {
/**
* Constructs a new NoTurn instance.
*/
public NoTurn() {
super();
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "";
}
/**
* Returns the key for the info text of this message.
*
* @return the key for the info text of this message
*/
@Override
public String getInfoTextKey() {
return "";

View File

@@ -1,11 +1,44 @@
package pp.mdga.message.server;
public class PauseGame extends ServerMessage {
@Override
public void accept(ServerInterpreter interpreter) {
import com.jme3.network.serializing.Serializable;
/**
* A message sent by the server to indicate that the game is paused.
*/
@Serializable
public class PauseGame extends ServerMessage {
/**
* Constructs a new PauseGame instance.
*/
public PauseGame() {
super();
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "";
}
/**
* Returns the key for the info text of this message.
*
* @return the key for the info text of this message
*/
@Override
public String getInfoTextKey() {
return "";

View File

@@ -1,22 +1,38 @@
package pp.mdga.message.server;
import com.jme3.network.serializing.Serializable;
import pp.mdga.game.BonusCard;
/**
* A message sent by the server to the active player to play a card.
*/
@Serializable
public class PlayCard extends ServerMessage {
/**
* The card that should be played.
*/
private final BonusCard card;
/**
* The identifier of the piece that should be moved.
*/
private final String pieceIdentifier;
/**
* @param card the card that should be played
* Constructs a new PlayCard message.
*
* @param card the card that should be played
* @param pieceIdentifier the identifier of the piece that should be moved
*/
public PlayCard(BonusCard card, String pieceIdentifier) {
super();
this.card = card;
this.pieceIdentifier = pieceIdentifier;
}
/**
* Returns the card that should be played.
*
* @return the card that should be played
*/
public BonusCard getCard() {
@@ -24,16 +40,39 @@ public BonusCard getCard() {
}
/**
* Returns the identifier of the piece that should be moved.
*
* @return the identifier of the piece that should be moved
*/
public String getPieceIdentifier() {
return pieceIdentifier;
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "";
}
/**
* Returns the key for the info text of this message.
*
* @return the key for the info text of this message
*/
@Override
public String getInfoTextKey() {
return "";

View File

@@ -1,38 +1,72 @@
package pp.mdga.message.server;
import com.jme3.network.serializing.Serializable;
import pp.mdga.game.BonusCard;
import java.util.ArrayList;
import java.util.List;
/**
* A message sent by the server to the client to indicate the possible cards that can be chosen.
*/
@Serializable
public class PossibleCard extends ServerMessage {
/**
* The list of possible cards.
*/
private final List<BonusCard> possibleCards;
private ArrayList<BonusCard> possibleCards;
/** Constructor for PossibleCard
/**
* Constructor for a PossibleCard instance.
*/
public PossibleCard() {
super();
possibleCards = new ArrayList<>();
}
/** Add a possible card to the list of possible cards
/**
* Add a possible card to the list of possible cards
*
* @param card the possible card to add
*/
public void addPossibleCard(BonusCard card) {
this.possibleCards.add(card);
}
/** Getter for the list of possible cards
/**
* Getter for the list of possible cards
*
* @return the list of possible cards
*/
public ArrayList<BonusCard> getPossibleCards() {
public List<BonusCard> getPossibleCards() {
return possibleCards;
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "";
}
/**
* Returns the key for the info text of this message.
*
* @return the key for the info text of this message
*/
@Override
public String getInfoTextKey() {
return "";

View File

@@ -1,27 +1,46 @@
package pp.mdga.message.server;
import com.jme3.network.serializing.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* A message sent by the server to the active player to give all possible pieces to choose from.
*/
@Serializable
public class PossiblePiece extends ServerMessage {
/**
* The list of possible own pieces
*/
private final List<String> possibleOwnPieces;
private final ArrayList<String> possibleOwnPieces;
private final ArrayList<String> possibleEnemyPieces;
/**
* The list of possible enemy pieces
*/
private final List<String> possibleEnemyPieces;
/** Constructor for PossiblePiece
/**
* Constructor for PossiblePiece
*/
public PossiblePiece() {
super();
possibleOwnPieces = new ArrayList<>();
possibleEnemyPieces = new ArrayList<>();
}
/** Add a piece to the list of possible pieces
/**
* Add a piece to the list of possible pieces
*
* @param piece the piece to add
*/
public void addOwnPossiblePiece(String piece) {
this.possibleOwnPieces.add(piece);
}
/** Add a piece to the list of possible enemy pieces
/**
* Add a piece to the list of possible enemy pieces
*
* @param piece the piece to add
*/
public void addEnemyPossiblePiece(String piece) {
@@ -31,15 +50,35 @@ public void addEnemyPossiblePiece(String piece) {
/** Getter for the list of possible pieces
* @return the list of possible pieces
*/
public ArrayList<String> getPossiblePieces() {
public List<String> getPossiblePieces() {
return possibleOwnPieces;
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "";
}
/**
* Returns the key for the info text of this message.
*
* @return the key for the info text of this message
*/
@Override
public String getInfoTextKey() {
return "";

View File

@@ -1,13 +0,0 @@
package pp.mdga.message.server;
public class RankingResponce extends ServerMessage {
@Override
public void accept(ServerInterpreter interpreter) {
}
@Override
public String getInfoTextKey() {
return "";
}
}

View File

@@ -0,0 +1,46 @@
package pp.mdga.message.server;
import com.jme3.network.serializing.Serializable;
/**
* A message sent by the server to all client to inform them about the current ranking. (only in DetermineStartPlayer)
*/
@Serializable
public class RankingResponse extends ServerMessage {
/**
* Constructs a new RankingResponse instance.
*/
public RankingResponse() {
super();
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "";
}
/**
* Returns the key for the info text of this message.
*
* @return the key for the info text of this message
*/
@Override
public String getInfoTextKey() {
return "";
}
}

View File

@@ -1,11 +1,44 @@
package pp.mdga.message.server;
public class RankingRollAgain extends ServerMessage {
@Override
public void accept(ServerInterpreter interpreter) {
import com.jme3.network.serializing.Serializable;
/**
* A message sent by the server to the clients to indicate that the ranking shall be rolled again. (only in DetermineStartPlayer)
*/
@Serializable
public class RankingRollAgain extends ServerMessage {
/**
* Constructs a new RankingRollAgain instance.
*/
public RankingRollAgain() {
super();
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "";
}
/**
* Returns the key for the info text of this message.
*
* @return the key for the info text of this message
*/
@Override
public String getInfoTextKey() {
return "";

View File

@@ -1,23 +1,60 @@
package pp.mdga.message.server;
import com.jme3.network.serializing.Serializable;
import pp.mdga.game.Game;
/**
* A message sent by the server to a client that has reconnected to the game. (give the last saved model)
*/
@Serializable
public class ReconnectBriefing extends ServerMessage {
/**
* The game.
*/
private final Game game;
/**
* Constructs a new ReconnectBriefing message.
*/
public ReconnectBriefing(Game game) {
super();
this.game = game;
}
/**
* Returns the game.
*
* @return the game
*/
public Game getGame() {
return game;
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "";
}
/**
* Returns the key for the info text of this message.
*
* @return the key for the info text of this message
*/
@Override
public String getInfoTextKey() {
return "";

View File

@@ -1,11 +1,44 @@
package pp.mdga.message.server;
public class ResumeGame extends ServerMessage {
@Override
public void accept(ServerInterpreter interpreter) {
import com.jme3.network.serializing.Serializable;
/**
* A message sent by the server to resume the game.
*/
@Serializable
public class ResumeGame extends ServerMessage {
/**
* Constructs a new ResumeGame instance.
*/
public ResumeGame() {
super();
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "";
}
/**
* Returns the key for the info text of this message.
*
* @return the key for the info text of this message
*/
@Override
public String getInfoTextKey() {
return "";

View File

@@ -1,4 +1,196 @@
package pp.mdga.message.server;
/**
* An interface for processing server messages.
* Implementations of this interface can be used to handle different types of server messages.
*/
public interface ServerInterpreter {
/**
* Handles an ActivePlayer message received from the server.
*
* @param msg the ActivePlayer message received
*/
void received(ActivePlayer msg);
/**
* Handles an AnyPiece message received from the server.
*
* @param msg the AnyPiece message received
*/
void received(AnyPiece msg);
/**
* Handles a Briefing message received from the server.
*
* @param msg the Briefing message received
*/
void received(Briefing msg);
/**
* Handles a Ceremony message received from the server.
*
* @param msg the Ceremony message received
*/
void received(Ceremony msg);
/**
* Handles a Dice message received from the server.
*
* @param msg the Dice message received
*/
void received(Dice msg);
/**
* Handles a DiceAgain message received from the server.
*
* @param msg the DiceAgain message received
*/
void received(DiceAgain msg);
/**
* Handles a DiceNow message received from the server.
*
* @param msg the DiceNow message received
*/
void received(DiceNow msg);
/**
* Handles an EndOfGame message received from the server.
*
* @param msg the EndOfGame message received
*/
void received(EndOfTurn msg);
/**
* Handles a GameOver message received from the server.
*
* @param msg the GameOver message received
*/
void received(LobbyAccept msg);
/**
* Handles a LobbyDeny message received from the server.
*
* @param msg the LobbyDeny message received
*/
void received(LobbyDeny msg);
/**
* Handles a LobbyPlayerJoin message received from the server.
*
* @param msg the LobbyPlayerJoin message received
*/
void received(LobbyPlayerJoin msg);
/**
* Handles a LobbyPlayerLeave message received from the server.
*
* @param msg the LobbyPlayerLeave message received
*/
void received(LobbyPlayerLeave msg);
/**
* Handles a MoveMessage message received from the server.
*
* @param msg the MoveMessage message received
*/
void received(MoveMessage msg);
/**
* Handles a NoTurn message received from the server.
*
* @param msg the NoTurn message received
*/
void received(NoTurn msg);
/**
* Handles a PauseGame message received from the server.
*
* @param msg the PauseGame message received
*/
void received(PauseGame msg);
/**
* Handles a PlayCard message received from the server.
*
* @param msg the PlayCard message received
*/
void received(PlayCard msg);
/**
* Handles a PossibleCard message received from the server.
*
* @param msg the PossibleCard message received
*/
void received(PossibleCard msg);
/**
* Handles a PossiblePiece message received from the server.
*
* @param msg the PossiblePiece message received
*/
void received(PossiblePiece msg);
/**
* Handles a RankingResponce message received from the server.
*
* @param msg the RankingResponce message received
*/
void received(RankingResponse msg);
/**
* Handles a RankingRollAgain message received from the server.
*
* @param msg the RankingRollAgain message received
*/
void received(RankingRollAgain msg);
/**
* Handles a ReconnectBriefing message received from the server.
*
* @param msg the ReconnectBriefing message received
*/
void received(ReconnectBriefing msg);
/**
* Handles a ResumeGame message received from the server.
*
* @param msg the ResumeGame message received
*/
void received(ResumeGame msg);
/**
* Handles a ServerStartGame message received from the server.
*
* @param msg the ServerStartGame message received
*/
void received(ServerStartGame msg);
/**
* Handles a StartPiece message received from the server.
*
* @param msg the StartPiece message received
*/
void received(StartPiece msg);
/**
* Handles a UpdateReady message received from the server.
*
* @param msg the UpdateReady message received
*/
void received(UpdateReady msg);
/**
* Handles a UpdateTSK message received from the server.
*
* @param msg the UpdateTSK message received
*/
void received(UpdateTSK msg);
/**
* Handles a WaitPiece message received from the server.
*
* @param msg the WaitPiece message received
*/
void received(WaitPiece msg);
}

View File

@@ -2,12 +2,30 @@
import com.jme3.network.AbstractMessage;
/**
* An abstract base class for server messages used in network transfer.
* It extends the AbstractMessage class provided by the jme3-network library.
*/
public abstract class ServerMessage extends AbstractMessage {
/**
* Constructs a new ServerMessage instance.
*/
protected ServerMessage() {
super(true);
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
public abstract void accept(ServerInterpreter interpreter);
/**
* Gets the bundle key of the informational text to be shown at the client.
* This key is used to retrieve the appropriate localized text for display.
*
* @return the bundle key of the informational text
*/
public abstract String getInfoTextKey();
}

View File

@@ -1,11 +1,44 @@
package pp.mdga.message.server;
public class ServerStartGame extends ServerMessage {
@Override
public void accept(ServerInterpreter interpreter) {
import com.jme3.network.serializing.Serializable;
/**
* A message indicating that the game shall start.
*/
@Serializable
public class ServerStartGame extends ServerMessage {
/**
* Constructs a new ServerStartGame instance.
*/
public ServerStartGame() {
super();
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "";
}
/**
* Returns the key for the info text of this message.
*
* @return the key for the info text of this message
*/
@Override
public String getInfoTextKey() {
return "";

View File

@@ -1,22 +1,61 @@
package pp.mdga.message.server;
public class StartPiece extends ServerMessage {
import com.jme3.network.serializing.Serializable;
/**
* A message sent by the server to the active player that he has to move a start piece.
*/
@Serializable
public class StartPiece extends ServerMessage {
/**
* The identifier for the piece.
*/
private final String pieceIdentifier;
/**
* Constructs a new StartPiece instance with the specified piece identifier.
*
* @param pieceIdentifier the identifier for the piece
*/
public StartPiece(String pieceIdentifier) {
super();
this.pieceIdentifier = pieceIdentifier;
}
/**
* Gets the identifier for the piece.
*
* @return the piece identifier
*/
public String getPieceIdentifier() {
return pieceIdentifier;
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "";
}
/**
* Returns the key for the info text of this message.
*
* @return the key for the info text of this message
*/
@Override
public String getInfoTextKey() {
return "";

View File

@@ -1,29 +1,78 @@
package pp.mdga.message.server;
import com.jme3.network.serializing.Serializable;
import pp.mdga.game.Color;
/**
* A message sent by the server to every client to update the readiness status of a player.
*/
@Serializable
public class UpdateReady extends ServerMessage {
/**
* The color associated with the update.
*/
private final Color color;
/**
* Indicates whether the player is ready.
*/
private final boolean ready;
/**
* Constructs a new UpdateReady instance with the specified color and readiness status.
*
* @param color the color associated with the update
* @param ready the readiness status
*/
public UpdateReady(Color color, boolean ready) {
super();
this.color = color;
this.ready = ready;
}
/**
* Gets the color associated with the update.
*
* @return the color
*/
public Color getColor() {
return color;
}
/**
* Checks if the player is ready.
*
* @return true if the player is ready, false otherwise
*/
public boolean isReady() {
return ready;
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "";
}
/**
* Returns the key for the info text of this message.
*
* @return the key for the info text of this message
*/
@Override
public String getInfoTextKey() {
return "";

View File

@@ -1,30 +1,77 @@
package pp.mdga.message.server;
import com.jme3.network.serializing.Serializable;
import pp.mdga.game.Color;
/**
* A message sent by the server to every client to update the TSK.
*/
@Serializable
public class UpdateTSK extends ServerMessage {
/**
* The name associated with the update.
*/
private final String name;
/**
* The color associated with the update.
*/
private final Color color;
/**
* Constructs a new UpdateTSK instance with the specified name and color.
*
* @param name the name associated with the update
* @param color the color associated with the update
*/
public UpdateTSK(String name, Color color) {
this.name = name;
this.color = color;
}
/**
* Gets the name associated with the update.
*
* @return the name
*/
public String getName() {
return name;
}
/**
* Gets the color associated with the update.
*
* @return the color
*/
public Color getColor() {
return color;
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "";
}
/**
* Returns the key for the info text of this message.
*
* @return the key for the info text of this message
*/
@Override
public String getInfoTextKey() {
return "";

View File

@@ -1,11 +1,44 @@
package pp.mdga.message.server;
import com.jme3.network.serializing.Serializable;
/**
* A message sent by the server to the active player to choose a piece from the waiting area.
*/
@Serializable
public class WaitPiece extends ServerMessage {
@Override
public void accept(ServerInterpreter interpreter) {
/**
* Constructs a new WaitPiece instance.
*/
public WaitPiece() {
super();
}
/**
* Accepts a visitor to process this message.
*
* @param interpreter the visitor to process this message
*/
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
/**
* Returns a string representation of this message.
*
* @return a string representation of this message
*/
@Override
public String toString() {
return "";
}
/**
* Returns the key for the info text of this message.
*
* @return the key for the info text of this message
*/
@Override
public String getInfoTextKey() {
return "";

View File

@@ -1,4 +1,8 @@
package pp.mdga.notification;
public abstract class Notification {
public void accept(){
}
}