added javadocs to all server messages
This commit is contained in:
@@ -1,30 +1,63 @@
|
|||||||
package pp.mdga.message.server;
|
package pp.mdga.message.server;
|
||||||
|
|
||||||
|
import com.jme3.network.serializing.Serializable;
|
||||||
import pp.mdga.game.Color;
|
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 {
|
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
|
* @param color the color of the active player
|
||||||
*/
|
*/
|
||||||
public ActivePlayer(Color color) {
|
public ActivePlayer(Color color) {
|
||||||
|
super();
|
||||||
this.color = color;
|
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
|
* @return the color of the active player
|
||||||
*/
|
*/
|
||||||
public Color getColor() {
|
public Color getColor() {
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accepts a visitor to process this message.
|
||||||
|
*
|
||||||
|
* @param interpreter the visitor to process this message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void accept(ServerInterpreter interpreter) {
|
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
|
@Override
|
||||||
public String getInfoTextKey() {
|
public String getInfoTextKey() {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -1,36 +1,71 @@
|
|||||||
package pp.mdga.message.server;
|
package pp.mdga.message.server;
|
||||||
|
|
||||||
|
import com.jme3.network.serializing.Serializable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
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 {
|
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() {
|
public AnyPiece() {
|
||||||
|
super();
|
||||||
piece = new ArrayList<>();
|
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
|
* @param piece the piece to add
|
||||||
*/
|
*/
|
||||||
public void addPiece(String piece) {
|
public void addPiece(String piece) {
|
||||||
this.piece.add(piece);
|
this.piece.add(piece);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Getter for the list of pieces
|
/**
|
||||||
|
* Getter for the list of pieces
|
||||||
|
*
|
||||||
* @return the list of pieces
|
* @return the list of pieces
|
||||||
*/
|
*/
|
||||||
public ArrayList<String> getPiece() {
|
public List<String> getPiece() {
|
||||||
return piece;
|
return piece;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accepts a visitor to process this message.
|
||||||
|
*
|
||||||
|
* @param interpreter the visitor to process this message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void accept(ServerInterpreter interpreter) {
|
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
|
@Override
|
||||||
public String getInfoTextKey() {
|
public String getInfoTextKey() {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -1,11 +1,44 @@
|
|||||||
package pp.mdga.message.server;
|
package pp.mdga.message.server;
|
||||||
|
|
||||||
public class Briefing extends ServerMessage {
|
import com.jme3.network.serializing.Serializable;
|
||||||
@Override
|
|
||||||
public void accept(ServerInterpreter interpreter) {
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
@Override
|
||||||
public String getInfoTextKey() {
|
public String getInfoTextKey() {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -1,11 +1,44 @@
|
|||||||
package pp.mdga.message.server;
|
package pp.mdga.message.server;
|
||||||
|
|
||||||
public class Ceremony extends ServerMessage {
|
import com.jme3.network.serializing.Serializable;
|
||||||
@Override
|
|
||||||
public void accept(ServerInterpreter interpreter) {
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
@Override
|
||||||
public String getInfoTextKey() {
|
public String getInfoTextKey() {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -1,22 +1,39 @@
|
|||||||
package pp.mdga.message.server;
|
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 {
|
public class Dice extends ServerMessage {
|
||||||
|
/**
|
||||||
|
* The eye of the dice
|
||||||
|
*/
|
||||||
private final int diceEye;
|
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
|
* @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.diceEye = diceEye;
|
||||||
this.moveablePieces = moveablePieces;
|
this.moveablePieces = moveablePieces;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Constructor for inactivePlayer
|
/**
|
||||||
|
* Constructor for inactivePlayer
|
||||||
|
*
|
||||||
* @param diceEye the eye of the dice
|
* @param diceEye the eye of the dice
|
||||||
* @return a new Dice object
|
* @return a new Dice object
|
||||||
*/
|
*/
|
||||||
@@ -24,34 +41,60 @@ public static Dice inactivePlayer(int diceEye) {
|
|||||||
return new Dice(diceEye, null);
|
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
|
* @param moveablePieces the pieces that can be moved
|
||||||
* @return a new Dice object
|
* @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);
|
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
|
* @return the eye of the dice
|
||||||
*/
|
*/
|
||||||
public int getDiceEye() {
|
public int getDiceEye() {
|
||||||
return diceEye;
|
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
|
* @return the pieces that can be moved
|
||||||
*/
|
*/
|
||||||
public ArrayList<String> getMoveablePieces() {
|
public List<String> getMoveablePieces() {
|
||||||
return moveablePieces;
|
return moveablePieces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accepts a visitor to process this message.
|
||||||
|
*
|
||||||
|
* @param interpreter the visitor to process this message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void accept(ServerInterpreter interpreter) {
|
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
|
@Override
|
||||||
public String getInfoTextKey() {
|
public String getInfoTextKey() {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -1,11 +1,44 @@
|
|||||||
package pp.mdga.message.server;
|
package pp.mdga.message.server;
|
||||||
|
|
||||||
public class DiceAgain extends ServerMessage {
|
import com.jme3.network.serializing.Serializable;
|
||||||
@Override
|
|
||||||
public void accept(ServerInterpreter interpreter) {
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
@Override
|
||||||
public String getInfoTextKey() {
|
public String getInfoTextKey() {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -1,11 +1,44 @@
|
|||||||
package pp.mdga.message.server;
|
package pp.mdga.message.server;
|
||||||
|
|
||||||
public class DiceNow extends ServerMessage {
|
import com.jme3.network.serializing.Serializable;
|
||||||
@Override
|
|
||||||
public void accept(ServerInterpreter interpreter) {
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
@Override
|
||||||
public String getInfoTextKey() {
|
public String getInfoTextKey() {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -1,11 +1,44 @@
|
|||||||
package pp.mdga.message.server;
|
package pp.mdga.message.server;
|
||||||
|
|
||||||
public class EndOfTurn extends ServerMessage {
|
import com.jme3.network.serializing.Serializable;
|
||||||
@Override
|
|
||||||
public void accept(ServerInterpreter interpreter) {
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
@Override
|
||||||
public String getInfoTextKey() {
|
public String getInfoTextKey() {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -1,11 +1,44 @@
|
|||||||
package pp.mdga.message.server;
|
package pp.mdga.message.server;
|
||||||
|
|
||||||
public class LobbyAccept extends ServerMessage {
|
import com.jme3.network.serializing.Serializable;
|
||||||
@Override
|
|
||||||
public void accept(ServerInterpreter interpreter) {
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
@Override
|
||||||
public String getInfoTextKey() {
|
public String getInfoTextKey() {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -1,11 +1,44 @@
|
|||||||
package pp.mdga.message.server;
|
package pp.mdga.message.server;
|
||||||
|
|
||||||
public class LobbyDeny extends ServerMessage {
|
import com.jme3.network.serializing.Serializable;
|
||||||
@Override
|
|
||||||
public void accept(ServerInterpreter interpreter) {
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
@Override
|
||||||
public String getInfoTextKey() {
|
public String getInfoTextKey() {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -1,22 +1,62 @@
|
|||||||
package pp.mdga.message.server;
|
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 {
|
public class LobbyPlayerJoin extends ServerMessage {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the player joining the lobby.
|
||||||
|
*/
|
||||||
private final String name;
|
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) {
|
public LobbyPlayerJoin(String name) {
|
||||||
|
super();
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of the player joining the lobby.
|
||||||
|
*
|
||||||
|
* @return the name of the player joining the lobby
|
||||||
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accepts a visitor to process this message.
|
||||||
|
*
|
||||||
|
* @param interpreter the visitor to process this message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void accept(ServerInterpreter interpreter) {
|
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
|
@Override
|
||||||
public String getInfoTextKey() {
|
public String getInfoTextKey() {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -1,29 +1,78 @@
|
|||||||
package pp.mdga.message.server;
|
package pp.mdga.message.server;
|
||||||
|
|
||||||
|
import com.jme3.network.serializing.Serializable;
|
||||||
import pp.mdga.game.Color;
|
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 {
|
public class LobbyPlayerLeave extends ServerMessage {
|
||||||
|
/**
|
||||||
|
* The name of the player leaving the lobby.
|
||||||
|
*/
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The color associated with the player leaving the lobby.
|
||||||
|
*/
|
||||||
private final Color color;
|
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) {
|
public LobbyPlayerLeave(String name, Color color) {
|
||||||
|
super();
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.color = color;
|
this.color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of the player leaving the lobby.
|
||||||
|
*
|
||||||
|
* @return the name of the player leaving the lobby
|
||||||
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
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() {
|
public Color getColor() {
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accepts a visitor to process this message.
|
||||||
|
*
|
||||||
|
* @param interpreter the visitor to process this message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void accept(ServerInterpreter interpreter) {
|
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
|
@Override
|
||||||
public String getInfoTextKey() {
|
public String getInfoTextKey() {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -1,17 +1,30 @@
|
|||||||
package pp.mdga.message.server;
|
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;
|
private final String pieceIdentifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Constructs a new MoveMessage instance.
|
||||||
|
*
|
||||||
* @param identifier the identifier of the piece that should be moved
|
* @param identifier the identifier of the piece that should be moved
|
||||||
*/
|
*/
|
||||||
public MoveMessage(String identifier) {
|
public MoveMessage(String identifier) {
|
||||||
|
super();
|
||||||
this.pieceIdentifier = identifier;
|
this.pieceIdentifier = identifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the identifier of the piece that should be moved.
|
||||||
|
*
|
||||||
* @return the identifier of the piece that should be moved
|
* @return the identifier of the piece that should be moved
|
||||||
*/
|
*/
|
||||||
public String getIdentifier() {
|
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
|
@Override
|
||||||
public void accept(ServerInterpreter interpreter) {
|
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
|
@Override
|
||||||
public String getInfoTextKey() {
|
public String getInfoTextKey() {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -1,11 +1,44 @@
|
|||||||
package pp.mdga.message.server;
|
package pp.mdga.message.server;
|
||||||
|
|
||||||
public class NoTurn extends ServerMessage {
|
import com.jme3.network.serializing.Serializable;
|
||||||
@Override
|
|
||||||
public void accept(ServerInterpreter interpreter) {
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
@Override
|
||||||
public String getInfoTextKey() {
|
public String getInfoTextKey() {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -1,11 +1,44 @@
|
|||||||
package pp.mdga.message.server;
|
package pp.mdga.message.server;
|
||||||
|
|
||||||
public class PauseGame extends ServerMessage {
|
import com.jme3.network.serializing.Serializable;
|
||||||
@Override
|
|
||||||
public void accept(ServerInterpreter interpreter) {
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
@Override
|
||||||
public String getInfoTextKey() {
|
public String getInfoTextKey() {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -1,22 +1,38 @@
|
|||||||
package pp.mdga.message.server;
|
package pp.mdga.message.server;
|
||||||
|
|
||||||
|
import com.jme3.network.serializing.Serializable;
|
||||||
import pp.mdga.game.BonusCard;
|
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 {
|
public class PlayCard extends ServerMessage {
|
||||||
|
/**
|
||||||
|
* The card that should be played.
|
||||||
|
*/
|
||||||
private final BonusCard card;
|
private final BonusCard card;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The identifier of the piece that should be moved.
|
||||||
|
*/
|
||||||
private final String pieceIdentifier;
|
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
|
* @param pieceIdentifier the identifier of the piece that should be moved
|
||||||
*/
|
*/
|
||||||
public PlayCard(BonusCard card, String pieceIdentifier) {
|
public PlayCard(BonusCard card, String pieceIdentifier) {
|
||||||
|
super();
|
||||||
this.card = card;
|
this.card = card;
|
||||||
this.pieceIdentifier = pieceIdentifier;
|
this.pieceIdentifier = pieceIdentifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the card that should be played.
|
||||||
|
*
|
||||||
* @return the card that should be played
|
* @return the card that should be played
|
||||||
*/
|
*/
|
||||||
public BonusCard getCard() {
|
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
|
* @return the identifier of the piece that should be moved
|
||||||
*/
|
*/
|
||||||
public String getPieceIdentifier() {
|
public String getPieceIdentifier() {
|
||||||
return pieceIdentifier;
|
return pieceIdentifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accepts a visitor to process this message.
|
||||||
|
*
|
||||||
|
* @param interpreter the visitor to process this message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void accept(ServerInterpreter interpreter) {
|
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
|
@Override
|
||||||
public String getInfoTextKey() {
|
public String getInfoTextKey() {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -1,38 +1,72 @@
|
|||||||
package pp.mdga.message.server;
|
package pp.mdga.message.server;
|
||||||
|
|
||||||
|
import com.jme3.network.serializing.Serializable;
|
||||||
import pp.mdga.game.BonusCard;
|
import pp.mdga.game.BonusCard;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
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 {
|
public class PossibleCard extends ServerMessage {
|
||||||
|
/**
|
||||||
|
* The list of possible cards.
|
||||||
|
*/
|
||||||
|
private final List<BonusCard> possibleCards;
|
||||||
|
|
||||||
private ArrayList<BonusCard> possibleCards;
|
/**
|
||||||
|
* Constructor for a PossibleCard instance.
|
||||||
/** Constructor for PossibleCard
|
|
||||||
*/
|
*/
|
||||||
public PossibleCard() {
|
public PossibleCard() {
|
||||||
|
super();
|
||||||
possibleCards = new ArrayList<>();
|
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
|
* @param card the possible card to add
|
||||||
*/
|
*/
|
||||||
public void addPossibleCard(BonusCard card) {
|
public void addPossibleCard(BonusCard card) {
|
||||||
this.possibleCards.add(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
|
* @return the list of possible cards
|
||||||
*/
|
*/
|
||||||
public ArrayList<BonusCard> getPossibleCards() {
|
public List<BonusCard> getPossibleCards() {
|
||||||
return possibleCards;
|
return possibleCards;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accepts a visitor to process this message.
|
||||||
|
*
|
||||||
|
* @param interpreter the visitor to process this message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void accept(ServerInterpreter interpreter) {
|
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
|
@Override
|
||||||
public String getInfoTextKey() {
|
public String getInfoTextKey() {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -1,27 +1,46 @@
|
|||||||
package pp.mdga.message.server;
|
package pp.mdga.message.server;
|
||||||
|
|
||||||
|
import com.jme3.network.serializing.Serializable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
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 {
|
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() {
|
public PossiblePiece() {
|
||||||
|
super();
|
||||||
possibleOwnPieces = new ArrayList<>();
|
possibleOwnPieces = new ArrayList<>();
|
||||||
possibleEnemyPieces = 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
|
* @param piece the piece to add
|
||||||
*/
|
*/
|
||||||
public void addOwnPossiblePiece(String piece) {
|
public void addOwnPossiblePiece(String piece) {
|
||||||
this.possibleOwnPieces.add(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
|
* @param piece the piece to add
|
||||||
*/
|
*/
|
||||||
public void addEnemyPossiblePiece(String piece) {
|
public void addEnemyPossiblePiece(String piece) {
|
||||||
@@ -31,15 +50,35 @@ public void addEnemyPossiblePiece(String piece) {
|
|||||||
/** Getter for the list of possible pieces
|
/** Getter for the list of possible pieces
|
||||||
* @return the list of possible pieces
|
* @return the list of possible pieces
|
||||||
*/
|
*/
|
||||||
public ArrayList<String> getPossiblePieces() {
|
public List<String> getPossiblePieces() {
|
||||||
return possibleOwnPieces;
|
return possibleOwnPieces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accepts a visitor to process this message.
|
||||||
|
*
|
||||||
|
* @param interpreter the visitor to process this message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void accept(ServerInterpreter interpreter) {
|
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
|
@Override
|
||||||
public String getInfoTextKey() {
|
public String getInfoTextKey() {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -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 "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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 "";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,44 @@
|
|||||||
package pp.mdga.message.server;
|
package pp.mdga.message.server;
|
||||||
|
|
||||||
public class RankingRollAgain extends ServerMessage {
|
import com.jme3.network.serializing.Serializable;
|
||||||
@Override
|
|
||||||
public void accept(ServerInterpreter interpreter) {
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
@Override
|
||||||
public String getInfoTextKey() {
|
public String getInfoTextKey() {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -1,23 +1,60 @@
|
|||||||
package pp.mdga.message.server;
|
package pp.mdga.message.server;
|
||||||
|
|
||||||
|
import com.jme3.network.serializing.Serializable;
|
||||||
import pp.mdga.game.Game;
|
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 {
|
public class ReconnectBriefing extends ServerMessage {
|
||||||
|
/**
|
||||||
|
* The game.
|
||||||
|
*/
|
||||||
private final Game game;
|
private final Game game;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new ReconnectBriefing message.
|
||||||
|
*/
|
||||||
public ReconnectBriefing(Game game) {
|
public ReconnectBriefing(Game game) {
|
||||||
|
super();
|
||||||
this.game = game;
|
this.game = game;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the game.
|
||||||
|
*
|
||||||
|
* @return the game
|
||||||
|
*/
|
||||||
public Game getGame() {
|
public Game getGame() {
|
||||||
return game;
|
return game;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accepts a visitor to process this message.
|
||||||
|
*
|
||||||
|
* @param interpreter the visitor to process this message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void accept(ServerInterpreter interpreter) {
|
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
|
@Override
|
||||||
public String getInfoTextKey() {
|
public String getInfoTextKey() {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -1,11 +1,44 @@
|
|||||||
package pp.mdga.message.server;
|
package pp.mdga.message.server;
|
||||||
|
|
||||||
public class ResumeGame extends ServerMessage {
|
import com.jme3.network.serializing.Serializable;
|
||||||
@Override
|
|
||||||
public void accept(ServerInterpreter interpreter) {
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
@Override
|
||||||
public String getInfoTextKey() {
|
public String getInfoTextKey() {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -1,4 +1,196 @@
|
|||||||
package pp.mdga.message.server;
|
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 {
|
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,30 @@
|
|||||||
|
|
||||||
import com.jme3.network.AbstractMessage;
|
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 {
|
public abstract class ServerMessage extends AbstractMessage {
|
||||||
|
/**
|
||||||
|
* Constructs a new ServerMessage instance.
|
||||||
|
*/
|
||||||
protected ServerMessage() {
|
protected ServerMessage() {
|
||||||
super(true);
|
super(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accepts a visitor to process this message.
|
||||||
|
*
|
||||||
|
* @param interpreter the visitor to process this message
|
||||||
|
*/
|
||||||
public abstract void accept(ServerInterpreter interpreter);
|
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();
|
public abstract String getInfoTextKey();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,44 @@
|
|||||||
package pp.mdga.message.server;
|
package pp.mdga.message.server;
|
||||||
|
|
||||||
public class ServerStartGame extends ServerMessage {
|
import com.jme3.network.serializing.Serializable;
|
||||||
@Override
|
|
||||||
public void accept(ServerInterpreter interpreter) {
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
@Override
|
||||||
public String getInfoTextKey() {
|
public String getInfoTextKey() {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -1,22 +1,61 @@
|
|||||||
package pp.mdga.message.server;
|
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;
|
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) {
|
public StartPiece(String pieceIdentifier) {
|
||||||
|
super();
|
||||||
this.pieceIdentifier = pieceIdentifier;
|
this.pieceIdentifier = pieceIdentifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the identifier for the piece.
|
||||||
|
*
|
||||||
|
* @return the piece identifier
|
||||||
|
*/
|
||||||
public String getPieceIdentifier() {
|
public String getPieceIdentifier() {
|
||||||
return pieceIdentifier;
|
return pieceIdentifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accepts a visitor to process this message.
|
||||||
|
*
|
||||||
|
* @param interpreter the visitor to process this message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void accept(ServerInterpreter interpreter) {
|
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
|
@Override
|
||||||
public String getInfoTextKey() {
|
public String getInfoTextKey() {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -1,29 +1,78 @@
|
|||||||
package pp.mdga.message.server;
|
package pp.mdga.message.server;
|
||||||
|
|
||||||
|
import com.jme3.network.serializing.Serializable;
|
||||||
import pp.mdga.game.Color;
|
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 {
|
public class UpdateReady extends ServerMessage {
|
||||||
|
/**
|
||||||
|
* The color associated with the update.
|
||||||
|
*/
|
||||||
private final Color color;
|
private final Color color;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether the player is ready.
|
||||||
|
*/
|
||||||
private final boolean 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) {
|
public UpdateReady(Color color, boolean ready) {
|
||||||
|
super();
|
||||||
this.color = color;
|
this.color = color;
|
||||||
this.ready = ready;
|
this.ready = ready;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the color associated with the update.
|
||||||
|
*
|
||||||
|
* @return the color
|
||||||
|
*/
|
||||||
public Color getColor() {
|
public Color getColor() {
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the player is ready.
|
||||||
|
*
|
||||||
|
* @return true if the player is ready, false otherwise
|
||||||
|
*/
|
||||||
public boolean isReady() {
|
public boolean isReady() {
|
||||||
return ready;
|
return ready;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accepts a visitor to process this message.
|
||||||
|
*
|
||||||
|
* @param interpreter the visitor to process this message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void accept(ServerInterpreter interpreter) {
|
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
|
@Override
|
||||||
public String getInfoTextKey() {
|
public String getInfoTextKey() {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -1,30 +1,77 @@
|
|||||||
package pp.mdga.message.server;
|
package pp.mdga.message.server;
|
||||||
|
|
||||||
|
import com.jme3.network.serializing.Serializable;
|
||||||
import pp.mdga.game.Color;
|
import pp.mdga.game.Color;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A message sent by the server to every client to update the TSK.
|
||||||
|
*/
|
||||||
|
@Serializable
|
||||||
public class UpdateTSK extends ServerMessage {
|
public class UpdateTSK extends ServerMessage {
|
||||||
|
/**
|
||||||
|
* The name associated with the update.
|
||||||
|
*/
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The color associated with the update.
|
||||||
|
*/
|
||||||
private final Color color;
|
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) {
|
public UpdateTSK(String name, Color color) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.color = color;
|
this.color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the name associated with the update.
|
||||||
|
*
|
||||||
|
* @return the name
|
||||||
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the color associated with the update.
|
||||||
|
*
|
||||||
|
* @return the color
|
||||||
|
*/
|
||||||
public Color getColor() {
|
public Color getColor() {
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accepts a visitor to process this message.
|
||||||
|
*
|
||||||
|
* @param interpreter the visitor to process this message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void accept(ServerInterpreter interpreter) {
|
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
|
@Override
|
||||||
public String getInfoTextKey() {
|
public String getInfoTextKey() {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -1,11 +1,44 @@
|
|||||||
package pp.mdga.message.server;
|
package pp.mdga.message.server;
|
||||||
|
|
||||||
public class WaitPiece extends ServerMessage {
|
import com.jme3.network.serializing.Serializable;
|
||||||
@Override
|
|
||||||
public void accept(ServerInterpreter interpreter) {
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A message sent by the server to the active player to choose a piece from the waiting area.
|
||||||
|
*/
|
||||||
|
@Serializable
|
||||||
|
public class WaitPiece extends ServerMessage {
|
||||||
|
/**
|
||||||
|
* 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
|
@Override
|
||||||
public String getInfoTextKey() {
|
public String getInfoTextKey() {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
Reference in New Issue
Block a user