Merge work #7
@@ -6,7 +6,7 @@
|
||||
<option name="WORKING_DIRECTORY" value="$MODULE_WORKING_DIR$" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="pp.mdga.client.Board.*" />
|
||||
<option name="PATTERN" value="pp.mdga.client.board.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
package pp.mdga.client.Animation;
|
||||
|
||||
public enum MdgaAnimation {
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package pp.mdga.client.Board;
|
||||
|
||||
class PileControl {
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client.Acoustic;
|
||||
package pp.mdga.client.acoustic;
|
||||
|
||||
import com.jme3.system.NanoTimer;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client.Acoustic;
|
||||
package pp.mdga.client.acoustic;
|
||||
|
||||
import com.jme3.audio.AudioData;
|
||||
import com.jme3.audio.AudioNode;
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client.Acoustic;
|
||||
package pp.mdga.client.acoustic;
|
||||
|
||||
import com.jme3.audio.AudioData;
|
||||
import com.jme3.audio.AudioNode;
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client.Acoustic;
|
||||
package pp.mdga.client.acoustic;
|
||||
|
||||
/**
|
||||
* Enum representing the various sound effects used in the game.
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client.Acoustic;
|
||||
package pp.mdga.client.acoustic;
|
||||
|
||||
/**
|
||||
* Enum representing various music assets used in the game.
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client.Acoustic;
|
||||
package pp.mdga.client.acoustic;
|
||||
|
||||
/**
|
||||
* Enum representing various sound assets used in the game.
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client.Acoustic;
|
||||
package pp.mdga.client.acoustic;
|
||||
|
||||
/**
|
||||
* A record that encapsulates a sound asset along with its playback settings:
|
||||
@@ -1,6 +1,7 @@
|
||||
package pp.mdga.client.Animation;
|
||||
package pp.mdga.client.animation;
|
||||
|
||||
abstract class Animation {
|
||||
|
||||
abstract void play();
|
||||
|
||||
abstract void stop();
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client.Animation;
|
||||
package pp.mdga.client.animation;
|
||||
|
||||
import pp.mdga.client.MdgaApp;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client.Animation;
|
||||
package pp.mdga.client.animation;
|
||||
|
||||
class EmptyAnimation extends Animation {
|
||||
@Override
|
||||
@@ -0,0 +1,4 @@
|
||||
package pp.mdga.client.animation;
|
||||
|
||||
public enum MdgaAnimation {
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
package pp.mdga.client.Board;
|
||||
package pp.mdga.client.board;
|
||||
|
||||
record AssetOnMap(BoardAsset asset, int x, int y, float rot) {}
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client.Board;
|
||||
package pp.mdga.client.board;
|
||||
|
||||
enum BoardAsset {
|
||||
bigTent,
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client.Board;
|
||||
package pp.mdga.client.board;
|
||||
|
||||
import com.jme3.light.AmbientLight;
|
||||
import com.jme3.light.DirectionalLight;
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client.Board;
|
||||
package pp.mdga.client.board;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client.Board;
|
||||
package pp.mdga.client.board;
|
||||
|
||||
import com.jme3.renderer.RenderManager;
|
||||
import com.jme3.renderer.ViewPort;
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client.Board;
|
||||
package pp.mdga.client.board;
|
||||
|
||||
import com.jme3.renderer.RenderManager;
|
||||
import com.jme3.renderer.ViewPort;
|
||||
@@ -0,0 +1,5 @@
|
||||
package pp.mdga.client.board;
|
||||
|
||||
class PileControl {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package pp.mdga.client.dialog;
|
||||
|
||||
public class Dialog {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package pp.mdga.client.dialog;
|
||||
|
||||
public class MenuDialog {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package pp.mdga.client.dialog;
|
||||
|
||||
public class NetworkDialog {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package pp.mdga.client.gui;
|
||||
|
||||
public class GuiView {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class Animation extends ClientState {
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class AudioSettings extends Settings {
|
||||
public class AudioSettings extends ClientState {
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class Ceremony extends ClientState {
|
||||
private final CeremonyStateMachine ceremonyStateMachine = new CeremonyStateMachine();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class CeremonyStateMachine extends ClientStateMachine {
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class ChoosePiece extends Turn {
|
||||
public class ChoosePiece extends ClientState {
|
||||
private final ChoosePieceStateMachine choosePieceStateMachine = new ChoosePieceStateMachine();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class ChoosePieceStateMachine extends ClientStateMachine{
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class ChoosePowerCard extends PowerCard {
|
||||
public class ChoosePowerCard extends ClientState {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class ClientAutomaton extends ClientStateMachine {
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class ClientState {
|
||||
public abstract class ClientState {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public abstract class ClientStateMachine extends ClientState {
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class DetermineStartPlayer {
|
||||
public class DetermineStartPlayer extends ClientState {
|
||||
private final DetermineStartPlayerStateMachine determineStartPlayerStateMachine = new DetermineStartPlayerStateMachine();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class DetermineStartPlayerStateMachine extends ClientStateMachine{
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class Dialogs extends ClientState {
|
||||
private final DialogsStateMachine dialogsStateMachine = new DialogsStateMachine();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class DialogsStateMachine extends ClientStateMachine {
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class Game extends ClientState {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class GameState extends ClientState {
|
||||
private final GameStateMachine gameStateMachine = new GameStateMachine();
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class GameStateMachine extends ClientStateMachine {
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class Lobby extends Dialogs {
|
||||
public class Lobby extends ClientState {
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class MainSettings extends Settings {
|
||||
public class MainSettings extends ClientState {
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class MovePiece extends Turn {
|
||||
public class MovePiece extends ClientState {
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class NetworkDialog extends Dialogs {
|
||||
public class NetworkDialog extends ClientState {
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class NoPiece extends ChoosePiece {
|
||||
public class NoPiece extends ClientState {
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class PlayPowerCard extends PowerCard {
|
||||
public class PlayPowerCard extends ClientState {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class Podium extends ClientState {
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class PowerCard extends Turn {
|
||||
public class PowerCard extends ClientState {
|
||||
private final PowerCardStateMachine powerCardStateMachine = new PowerCardStateMachine();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class PowerCardStateMachine extends ClientStateMachine {
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class RollDice extends Turn {
|
||||
public class RollDice extends ClientState {
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class RollRankingDice extends DetermineStartPlayer {
|
||||
public class RollRankingDice extends ClientState {
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class SelectPiece extends ChoosePiece {
|
||||
public class SelectPiece extends ClientState {
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class Settings {
|
||||
public class Settings extends ClientState {
|
||||
private final SettingsStateMachine settingsStateMachine = new SettingsStateMachine();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class SettingsStateMachine extends ClientStateMachine {
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class Shield extends PowerCard {
|
||||
public class Shield extends ClientState {
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class Spectator {
|
||||
public class Spectator extends ClientState {
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class StartPiece extends ChoosePiece {
|
||||
public class StartPiece extends ClientState {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class Statistics extends ClientState {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class Swap extends ClientState {
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class SwitchEnemy extends PowerCard {
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class SwitchOwn extends PowerCard {
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class Turn {
|
||||
public class Turn extends ClientState {
|
||||
private final TurnStateMachine turnStateMachine = new TurnStateMachine();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class TurnStateMachine extends ClientStateMachine {
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class VideoSettings extends Settings {
|
||||
public class VideoSettings extends ClientState {
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class WaitRanking extends DetermineStartPlayer {
|
||||
public class WaitRanking extends ClientState {
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class Waiting {
|
||||
public class Waiting extends ClientState {
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package pp.mdga.client;
|
||||
|
||||
public class WaitingPiece extends ChoosePiece {
|
||||
public class WaitingPiece extends ClientState {
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@ public Board() {
|
||||
for (int i = 0; i < 40; i++) {
|
||||
if (i % 10 == 0) {
|
||||
infield[i] = new StartNode(
|
||||
i == 0 ? Color.ARMY :
|
||||
i == 10 ? Color.AIRFORCE :
|
||||
i == 20 ? Color.CYBER :
|
||||
Color.NAVY
|
||||
i == 0 ? Color.AIRFORCE :
|
||||
i == 10 ? Color.CYBER :
|
||||
i == 20 ? Color.NAVY :
|
||||
Color.ARMY
|
||||
);
|
||||
} else if (i == 4 || i == 14 || i == 24 || i == 34) {
|
||||
infield[i] = new BonusNode();
|
||||
@@ -47,4 +47,14 @@ public Map<Color, PlayerData> getPlayerData() {
|
||||
public Node[] getInfield() {
|
||||
return infield;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method sets a piece on a specific Node in the infield
|
||||
*
|
||||
* @param index the index of the node
|
||||
* @param piece the piece to be set
|
||||
*/
|
||||
public void setPieceOnBoard(int index, Piece piece) {
|
||||
infield[index].setOccupant(piece);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package pp.mdga.game;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import pp.mdga.server.Observer;
|
||||
|
||||
/**
|
||||
* The Game class represents the game state of the Ludo game.
|
||||
@@ -12,7 +12,7 @@
|
||||
public class Game {
|
||||
private int diceModifier = 1;
|
||||
private int diceEyes;
|
||||
private Map <Color, Player> players;
|
||||
private Map<Color, Player> players = new HashMap<Color, Player>();
|
||||
private Statistic gameStatistics;
|
||||
private ArrayList<BonusCard> drawPile;
|
||||
private ArrayList<BonusCard> discardPile = new ArrayList<>();
|
||||
@@ -21,13 +21,17 @@ public class Game {
|
||||
private LinkedList<Color> order;
|
||||
private Map<Color, Integer> playerConnectionID;
|
||||
|
||||
private ArrayList<Observer> observers = new ArrayList<>();
|
||||
private Boolean gameHasStarted = false;
|
||||
private Boolean playerHasDisconnected = false;
|
||||
|
||||
private static final int AMOUNT_OF_TURBO_CARDS = 16;
|
||||
private static final int AMOUNT_OF_SHIELD_AND_SWAP_CARDS = 12;
|
||||
|
||||
/**
|
||||
* This constructor creates a new Game object.
|
||||
*/
|
||||
public Game(){
|
||||
public Game() {
|
||||
gameStatistics = new Statistic();
|
||||
drawPile = new ArrayList<>();
|
||||
for (int i = 0; i < AMOUNT_OF_TURBO_CARDS; i++) {
|
||||
@@ -223,7 +227,7 @@ public void setPlayerConnectionID(Map<Color, Integer> playerConnectionID) {
|
||||
/**
|
||||
* This method sets the player connection ID.
|
||||
*
|
||||
* @param color the color of the player
|
||||
* @param color the color of the player
|
||||
* @param connectionID the new connection ID
|
||||
*/
|
||||
public void setPlayerConnectionID(Color color, int connectionID) {
|
||||
@@ -243,7 +247,7 @@ public int getPlayerConnectionID(Color color) {
|
||||
/**
|
||||
* This method adds a player to the game.
|
||||
*
|
||||
* @param color the color of the player
|
||||
* @param color the color of the player
|
||||
* @param player the player to be added
|
||||
*/
|
||||
public void addPlayer(Color color, Player player) {
|
||||
@@ -258,4 +262,71 @@ public void addPlayer(Color color, Player player) {
|
||||
public void removePlayer(Color color) {
|
||||
players.remove(color);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method adds an observer to the game.
|
||||
*
|
||||
* @param observer the observer to be added
|
||||
*/
|
||||
public void addObserver(Observer observer) {
|
||||
observers.add(observer);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method removes an observer from the game.
|
||||
*
|
||||
* @param observer the observer to be removed
|
||||
*/
|
||||
public void removeObserver(Observer observer) {
|
||||
observers.remove(observer);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the game has started.
|
||||
*
|
||||
* @return the game has started
|
||||
*/
|
||||
public Boolean getGameHasStarted() {
|
||||
return gameHasStarted;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method sets the game has started.
|
||||
*
|
||||
* @param gameHasStarted the new game has started
|
||||
*/
|
||||
public void setGameHasStarted(Boolean gameHasStarted) {
|
||||
this.gameHasStarted = gameHasStarted;
|
||||
if (gameHasStarted) notifyObservers();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the player has disconnected.
|
||||
*
|
||||
* @return the player has disconnected
|
||||
*/
|
||||
public Boolean playerHasDisconnected() {
|
||||
return playerHasDisconnected;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method sets the player has disconnected.
|
||||
*
|
||||
* @param playerHasDisconnected the new player has disconnected
|
||||
*/
|
||||
public void setPlayerHasDisconnected(Boolean playerHasDisconnected) {
|
||||
this.playerHasDisconnected = playerHasDisconnected;
|
||||
if (playerHasDisconnected) {
|
||||
notifyObservers();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method notifies the observers.
|
||||
*/
|
||||
public void notifyObservers() {
|
||||
for (Observer observer : new ArrayList<>(observers)) {
|
||||
observer.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,4 +79,13 @@ public BonusCard removeHandCard(BonusCard card) {
|
||||
}
|
||||
return cardToRemove;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the id of the connection to the client represented by this player.
|
||||
*
|
||||
* @return the id
|
||||
*/
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,4 +98,14 @@ public Piece removePieceFromWaitingArea() {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method sets a piece at the given index in the home area
|
||||
*
|
||||
* @param index the index of the node
|
||||
* @param piece the piece to be set at the given index
|
||||
*/
|
||||
public void setPieceInHome(int index, Piece piece) {
|
||||
homeNodes[index].setOccupant(piece);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,4 +28,10 @@ public interface ClientInterpreter {
|
||||
void received(SelectTSK selectTSK , int from);
|
||||
|
||||
void received(ForceContinueGame forceContinueGame, int from);
|
||||
|
||||
void received(ClientStartGame clientStartGame, int from);
|
||||
|
||||
void received(NoPowerCard noPowerCard, int from);
|
||||
|
||||
void received(SelectedPieces selectedPieces, int from);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import com.jme3.network.AbstractMessage;
|
||||
|
||||
public abstract class ClientMessage extends AbstractMessage {
|
||||
|
||||
protected ClientMessage() {
|
||||
super(true);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package pp.mdga.message.client;
|
||||
|
||||
public class ClientStartGame extends ClientMessage {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(ClientInterpreter interpreter, int from) {
|
||||
interpreter.received(this, from);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package pp.mdga.message.client;
|
||||
|
||||
public class NoPowerCard extends ClientMessage {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(ClientInterpreter interpreter, int from) {
|
||||
interpreter.received(this, from);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package pp.mdga.message.client;
|
||||
|
||||
public class SelectedPieces extends ClientMessage {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "null";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(ClientInterpreter interpreter, int from) {
|
||||
interpreter.received(this, from);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package pp.mdga.message.server;
|
||||
|
||||
public class StartGame extends ServerMessage {
|
||||
public class ServerStartGame extends ServerMessage {
|
||||
@Override
|
||||
public void accept(ServerInterpreter interpreter) {
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package pp.mdga.notification;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Notification that is sent when a card is acquired.
|
||||
*/
|
||||
public class AcquireCardNotification extends Notification{
|
||||
|
||||
private UUID cardId;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param cardId The id of the card that was acquired.
|
||||
*/
|
||||
public AcquireCardNotification(UUID cardId) {
|
||||
this.cardId = cardId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the id of the card that was acquired.
|
||||
* @return The id of the card that was acquired.
|
||||
*/
|
||||
public UUID getCardId() {
|
||||
return cardId;
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,24 @@
|
||||
|
||||
import pp.mdga.game.Color;
|
||||
|
||||
/**
|
||||
* Notification that the active player has changed
|
||||
*/
|
||||
public class ActivePlayerNotification extends Notification {
|
||||
ActivePlayerNotification(Color color) {
|
||||
|
||||
/**
|
||||
* The color of the active player
|
||||
*/
|
||||
private Color color;
|
||||
|
||||
ActivePlayerNotification(Color color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the color of the active player
|
||||
*/
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package pp.mdga.notification;
|
||||
|
||||
/**
|
||||
* Class CeremonyNotification
|
||||
*/
|
||||
public class CeremonyNotification extends Notification{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
CeremonyNotification() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package pp.mdga.notification;
|
||||
|
||||
/**
|
||||
* Notification that the dice is now.
|
||||
*/
|
||||
public class DiceNowNotification extends Notification {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
DiceNowNotification() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package pp.mdga.notification;
|
||||
|
||||
import pp.mdga.game.Color;
|
||||
|
||||
/**
|
||||
* Notification that is sent when a player has diced.
|
||||
*/
|
||||
public class DicingNotification extends Notification{
|
||||
|
||||
private Color color;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param color The color of the player that diced.
|
||||
*/
|
||||
DicingNotification(Color color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the color of the player that diced.
|
||||
* @return The color of the player that diced.
|
||||
*/
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,34 @@
|
||||
import pp.mdga.game.BonusCard;
|
||||
import pp.mdga.game.Color;
|
||||
|
||||
/**
|
||||
* Notification that a card has been drawn
|
||||
*/
|
||||
public class DrawCardNotification extends Notification {
|
||||
DrawCardNotification(Color color, BonusCard card) {
|
||||
|
||||
private Color color;
|
||||
private BonusCard card;
|
||||
|
||||
/**
|
||||
* @param color the color of the player who drew the card
|
||||
* @param card the card that was drawn
|
||||
*/
|
||||
DrawCardNotification(Color color, BonusCard card) {
|
||||
this.color = color;
|
||||
this.card = card;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the color of the player who drew the card
|
||||
*/
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the card that was drawn
|
||||
*/
|
||||
public BonusCard getCard() {
|
||||
return card;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package pp.mdga.notification;
|
||||
|
||||
/**
|
||||
* GameNotification class
|
||||
*/
|
||||
public class GameNotification extends Notification{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
GameNotification() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package pp.mdga.notification;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Notification that a piece has moved to a home.
|
||||
*/
|
||||
public class HomeMoveNotification extends Notification {
|
||||
|
||||
private UUID pieceId;
|
||||
private int homeIndex;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param pieceId the piece id
|
||||
* @param homeIndex the home index
|
||||
*/
|
||||
HomeMoveNotification(UUID pieceId, int homeIndex) {
|
||||
this.pieceId = pieceId;
|
||||
this.homeIndex = homeIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the piece id.
|
||||
*
|
||||
* @return the piece id
|
||||
*/
|
||||
public UUID getPieceId() {
|
||||
return pieceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the home index.
|
||||
*
|
||||
* @return the home index
|
||||
*/
|
||||
public int getHomeIndex() {
|
||||
return homeIndex;
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,24 @@
|
||||
|
||||
import pp.mdga.game.Color;
|
||||
|
||||
/**
|
||||
* Notification that a card has been drawn
|
||||
*/
|
||||
public class InterruptNotification extends Notification {
|
||||
InterruptNotification(Color color) {
|
||||
|
||||
private Color color;
|
||||
|
||||
/**
|
||||
* @param color the color of the player who drew the card
|
||||
*/
|
||||
InterruptNotification(Color color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the color of the player who drew the card
|
||||
*/
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package pp.mdga.notification;
|
||||
|
||||
/**
|
||||
* Notification that a dialog has been started
|
||||
*/
|
||||
public class LobbyDialogNotification extends Notification{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
LobbyDialogNotification() {
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,37 @@
|
||||
|
||||
import pp.mdga.game.Color;
|
||||
|
||||
/**
|
||||
* Notification that a piece has been moved.
|
||||
*/
|
||||
public class MovePieceNotification extends Notification {
|
||||
MovePieceNotification(Color color, int nodeIndex) {
|
||||
|
||||
private Color color;
|
||||
private int nodeIndex;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param color the color of the piece that has been moved.
|
||||
* @param nodeIndex the index of the node the piece has been moved to.
|
||||
*/
|
||||
MovePieceNotification(Color color, int nodeIndex) {
|
||||
this.color = color;
|
||||
this.nodeIndex = nodeIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the color of the piece that has been moved.
|
||||
* @return the color of the piece that has been moved.
|
||||
*/
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the index of the node the piece has been moved to.
|
||||
* @return the index of the node the piece has been moved to.
|
||||
*/
|
||||
public int getNodeIndex() {
|
||||
return nodeIndex;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package pp.mdga.notification;
|
||||
|
||||
import pp.mdga.game.Color;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class MoveThrowPieceNotification extends Notification{
|
||||
|
||||
private UUID pieceId1;
|
||||
private UUID pieceId2;
|
||||
private int nodeIndex;
|
||||
private Color colorPiece2;
|
||||
|
||||
/**
|
||||
* This constructor is used to create a new MoveThrowPieceNotification
|
||||
*
|
||||
* @param pieceId1 the pieceId1
|
||||
* @param pieceId2 the pieceId2
|
||||
* @param nodeIndex the nodeIndex
|
||||
* @param colorPiece2 the color
|
||||
*/
|
||||
public MoveThrowPieceNotification(UUID pieceId1, UUID pieceId2, int nodeIndex, Color colorPiece2) {
|
||||
this.pieceId1 = pieceId1;
|
||||
this.pieceId2 = pieceId2;
|
||||
this.nodeIndex = nodeIndex;
|
||||
this.colorPiece2 = colorPiece2;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the pieceId1
|
||||
*
|
||||
* @return the pieceId1
|
||||
*/
|
||||
public UUID getPieceId1() {
|
||||
return pieceId1;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the pieceId2
|
||||
*
|
||||
* @return the pieceId2
|
||||
*/
|
||||
public UUID getPieceId2() {
|
||||
return pieceId2;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the nodeIndex
|
||||
*
|
||||
* @return the nodeIndex
|
||||
*/
|
||||
public int getNodeIndex() {
|
||||
return nodeIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the color
|
||||
*
|
||||
* @return the color
|
||||
*/
|
||||
public Color getColor() {
|
||||
return colorPiece2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package pp.mdga.notification;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Notification that a piece has no shield.
|
||||
*/
|
||||
public class NoShieldNotification extends Notification{
|
||||
|
||||
private UUID pieceId;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param pieceId the id of the piece that has no shield.
|
||||
*/
|
||||
public NoShieldNotification(UUID pieceId) {
|
||||
this.pieceId = pieceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the id of the piece that has no shield.
|
||||
* @return the id of the piece that has no shield.
|
||||
*/
|
||||
public UUID getPieceId() {
|
||||
return pieceId;
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,34 @@
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Notification that a piece is in the game
|
||||
*/
|
||||
public class PieceInGameNotification extends Notification{
|
||||
PieceInGameNotification(Color color, UUID id) {
|
||||
private Color color;
|
||||
private UUID id;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param color the color of the piece
|
||||
* @param id the id of the piece
|
||||
*/
|
||||
PieceInGameNotification(Color color, UUID id) {
|
||||
this.color = color;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the color of the piece
|
||||
*/
|
||||
public Color getColor() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id of the piece
|
||||
*/
|
||||
public UUID getId() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,37 @@
|
||||
import pp.mdga.game.BonusCard;
|
||||
import pp.mdga.game.Color;
|
||||
|
||||
/**
|
||||
* Notification that a card has been played.
|
||||
*/
|
||||
public class PlayCardNotification extends Notification {
|
||||
PlayCardNotification(Color color, BonusCard card) {
|
||||
|
||||
private Color color;
|
||||
private BonusCard card;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param color the color of the player that played the card.
|
||||
* @param card the card that was played.
|
||||
*/
|
||||
PlayCardNotification(Color color, BonusCard card) {
|
||||
this.color = color;
|
||||
this.card = card;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the color of the player that played the card.
|
||||
* @return the color of the player that played the card.
|
||||
*/
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the card that was played.
|
||||
* @return the card that was played.
|
||||
*/
|
||||
public BonusCard getCard() {
|
||||
return card;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,37 @@
|
||||
|
||||
import pp.mdga.game.Color;
|
||||
|
||||
/**
|
||||
* Notification that a player is in the game.
|
||||
*/
|
||||
public class PlayerInGameNotification extends Notification {
|
||||
PlayerInGameNotification(Color color, String name) {
|
||||
|
||||
private Color color;
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param color the color of the player that is in the game.
|
||||
* @param name the name of the player that is in the game.
|
||||
*/
|
||||
PlayerInGameNotification(Color color, String name) {
|
||||
this.color = color;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the color of the player that is in the game.
|
||||
* @return the color of the player that is in the game.
|
||||
*/
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the player that is in the game.
|
||||
* @return the name of the player that is in the game.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user