Merge branch 'development' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-01 into development
This commit is contained in:
@@ -61,6 +61,8 @@ private void handleLobby(Notification notification) {
|
|||||||
if (notification instanceof TskSelectNotification n) {
|
if (notification instanceof TskSelectNotification n) {
|
||||||
lobbyView.setTaken(n.getColor(), true, n.isSelf(), n.getName());
|
lobbyView.setTaken(n.getColor(), true, n.isSelf(), n.getName());
|
||||||
lobbyView.setTaken(n.getColor(), true, false, n.getName());
|
lobbyView.setTaken(n.getColor(), true, false, n.getName());
|
||||||
|
} else if (notification instanceof StartDialogNotification) {
|
||||||
|
app.enter(MdgaState.MAIN);
|
||||||
} else if (notification instanceof TskUnselectNotification n) {
|
} else if (notification instanceof TskUnselectNotification n) {
|
||||||
lobbyView.setTaken(n.getColor(), false, false, null);
|
lobbyView.setTaken(n.getColor(), false, false, null);
|
||||||
} else if(notification instanceof LobbyReadyNotification lobbyReadyNotification) {
|
} else if(notification instanceof LobbyReadyNotification lobbyReadyNotification) {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
import pp.mdga.message.server.UpdateReadyMessage;
|
import pp.mdga.message.server.UpdateReadyMessage;
|
||||||
import pp.mdga.message.server.UpdateTSKMessage;
|
import pp.mdga.message.server.UpdateTSKMessage;
|
||||||
import pp.mdga.notification.LobbyReadyNotification;
|
import pp.mdga.notification.LobbyReadyNotification;
|
||||||
|
import pp.mdga.notification.StartDialogNotification;
|
||||||
import pp.mdga.notification.TskSelectNotification;
|
import pp.mdga.notification.TskSelectNotification;
|
||||||
import pp.mdga.notification.TskUnselectNotification;
|
import pp.mdga.notification.TskUnselectNotification;
|
||||||
|
|
||||||
@@ -36,6 +37,7 @@ public void exit() {
|
|||||||
@Override
|
@Override
|
||||||
public void selectLeave() {
|
public void selectLeave() {
|
||||||
parent.setState(parent.getStartDialog());
|
parent.setState(parent.getStartDialog());
|
||||||
|
logic.addNotification(new StartDialogNotification());
|
||||||
logic.send(new LeaveGameMessage());
|
logic.send(new LeaveGameMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,6 +74,7 @@ public void selectStart(){
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void received(ServerStartGameMessage msg){
|
public void received(ServerStartGameMessage msg){
|
||||||
|
|
||||||
parent.startGame();
|
parent.startGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,6 @@ public void enter() {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Exited CeremonyState state.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public void enter() {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Exited GameState state.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public void enter() {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Exited InterruptState state.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public void enter() {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Exited LobbyState state.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,7 +55,9 @@ public void received(JoinedLobbyMessage msg, int from) {
|
|||||||
Player player = new Player(msg.getName());
|
Player player = new Player(msg.getName());
|
||||||
player.setColor(Color.getColorByIndex(this.logic.getGame().getPlayers().size()));
|
player.setColor(Color.getColorByIndex(this.logic.getGame().getPlayers().size()));
|
||||||
this.logic.getGame().addPlayer(from, player);
|
this.logic.getGame().addPlayer(from, player);
|
||||||
this.logic.getServerSender().broadcast(new LobbyPlayerJoinedMessage(from, player));
|
for (Map.Entry<Integer, Player> entry: this.logic.getGame().getPlayers().entrySet()) {
|
||||||
|
this.logic.getServerSender().broadcast(new LobbyPlayerJoinedMessage(entry.getKey(), entry.getValue()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,6 +10,11 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class AnimationState extends GameAutomatonState {
|
public class AnimationState extends GameAutomatonState {
|
||||||
|
/**
|
||||||
|
* Create FirstRollState constants.
|
||||||
|
*/
|
||||||
|
private static final System.Logger LOGGER = System.getLogger(AnimationState.class.getName());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a server state of the specified game logic.
|
* Constructs a server state of the specified game logic.
|
||||||
*
|
*
|
||||||
@@ -22,12 +27,12 @@ public AnimationState(GameState gameAutomaton, ServerGameLogic logic) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Entered AnimationState state.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Exited AnimationState state.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
import pp.mdga.message.server.DieMessage;
|
import pp.mdga.message.server.DieMessage;
|
||||||
import pp.mdga.server.ServerGameLogic;
|
import pp.mdga.server.ServerGameLogic;
|
||||||
import pp.mdga.server.automaton.GameState;
|
import pp.mdga.server.automaton.GameState;
|
||||||
|
import pp.mdga.server.automaton.game.turn.RollDiceState;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -12,6 +13,11 @@
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class DetermineStartPlayerState extends GameAutomatonState {
|
public class DetermineStartPlayerState extends GameAutomatonState {
|
||||||
|
/**
|
||||||
|
* Create FirstRollState constants.
|
||||||
|
*/
|
||||||
|
private static final System.Logger LOGGER = System.getLogger(DetermineStartPlayerState.class.getName());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create DetermineStartPlayerState attributes.
|
* Create DetermineStartPlayerState attributes.
|
||||||
*/
|
*/
|
||||||
@@ -29,12 +35,12 @@ public DetermineStartPlayerState(GameState gameAutomaton, ServerGameLogic logic)
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Entered DetermineStartPlayerState state.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Exited DetermineStartPlayerState state.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,6 +9,10 @@
|
|||||||
* It will also be used as the turn automaton.
|
* It will also be used as the turn automaton.
|
||||||
*/
|
*/
|
||||||
public class TurnState extends GameAutomatonState {
|
public class TurnState extends GameAutomatonState {
|
||||||
|
/**
|
||||||
|
* Create FirstRollState constants.
|
||||||
|
*/
|
||||||
|
private static final System.Logger LOGGER = System.getLogger(TurnState.class.getName());
|
||||||
/**
|
/**
|
||||||
* Create TurnState states.
|
* Create TurnState states.
|
||||||
*/
|
*/
|
||||||
@@ -36,12 +40,12 @@ public TurnState(GameState gameAutomaton, ServerGameLogic logic) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Entered TurnState state.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Exited TurnState state.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2,8 +2,24 @@
|
|||||||
|
|
||||||
import pp.mdga.server.ServerGameLogic;
|
import pp.mdga.server.ServerGameLogic;
|
||||||
import pp.mdga.server.automaton.game.TurnState;
|
import pp.mdga.server.automaton.game.TurnState;
|
||||||
|
import pp.mdga.server.automaton.game.turn.choosepiece.*;
|
||||||
|
|
||||||
public class ChoosePieceState extends TurnAutomatonState {
|
public class ChoosePieceState extends TurnAutomatonState {
|
||||||
|
/**
|
||||||
|
* Create LobbyState constants.
|
||||||
|
*/
|
||||||
|
private static final System.Logger LOGGER = System.getLogger(ChoosePieceState.class.getName());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create ChoosePieceState attributes.
|
||||||
|
*/
|
||||||
|
private ChoosePieceAutomatonState currentState;
|
||||||
|
private final NoPieceState noPieceState;
|
||||||
|
private final NoTurnState noTurnState;
|
||||||
|
private final WaitingPieceState waitingPieceState;
|
||||||
|
private final StartPieceState startPieceState;
|
||||||
|
private final SelectPieceState selectPieceState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a server state of the specified game logic.
|
* Constructs a server state of the specified game logic.
|
||||||
*
|
*
|
||||||
@@ -12,15 +28,89 @@ public class ChoosePieceState extends TurnAutomatonState {
|
|||||||
*/
|
*/
|
||||||
public ChoosePieceState(TurnState turnAutomaton, ServerGameLogic logic) {
|
public ChoosePieceState(TurnState turnAutomaton, ServerGameLogic logic) {
|
||||||
super(turnAutomaton, logic);
|
super(turnAutomaton, logic);
|
||||||
|
this.noPieceState = new NoPieceState(this, logic);
|
||||||
|
this.noTurnState = new NoTurnState(this, logic);
|
||||||
|
this.waitingPieceState = new WaitingPieceState(this, logic);
|
||||||
|
this.startPieceState = new StartPieceState(this, logic);
|
||||||
|
this.selectPieceState = new SelectPieceState(this, logic);
|
||||||
|
this.setCurrentState(this.noPieceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Exited ChoosePieceState state.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Entered ChoosePieceState state.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be used to return currentState attribute of ChoosePieceState class.
|
||||||
|
*
|
||||||
|
* @return currentState as a ChoosePieceAutomatonState object.
|
||||||
|
*/
|
||||||
|
public ChoosePieceAutomatonState getCurrentState() {
|
||||||
|
return this.currentState;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be used to return noPieceState attribute of ChoosePieceState class.
|
||||||
|
*
|
||||||
|
* @return noPieceState as a NoOPieceState object.
|
||||||
|
*/
|
||||||
|
public NoPieceState getNoPieceState() {
|
||||||
|
return this.noPieceState;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be used to return noTurnState attribute of ChoosePieceState class.
|
||||||
|
*
|
||||||
|
* @return noTurnState as a NoTurnState object.
|
||||||
|
*/
|
||||||
|
public NoTurnState getNoTurnState() {
|
||||||
|
return this.noTurnState;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be used to return waitingPieceState attribute of ChoosePieceState class.
|
||||||
|
*
|
||||||
|
* @return waitingPieceState as a WaitingPieceState object.
|
||||||
|
*/
|
||||||
|
public WaitingPieceState getWaitingPieceState() {
|
||||||
|
return this.waitingPieceState;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be used to return startPieceState attribute of ChoosePieceState class.
|
||||||
|
*
|
||||||
|
* @return startPieceState as a StartPieceState object.
|
||||||
|
*/
|
||||||
|
public StartPieceState getStartPieceState() {
|
||||||
|
return this.startPieceState;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be used to return selectPieceState attribute of ChoosePieceState class.
|
||||||
|
*
|
||||||
|
* @return selectPieceState as a SelectPieceState object.
|
||||||
|
*/
|
||||||
|
public SelectPieceState getSelectPieceState() {
|
||||||
|
return this.selectPieceState;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be used to set currentState attribute of ChoosePieceState class to the given state parameter.
|
||||||
|
* In Addition, the currentState will be exited, changed and entered.
|
||||||
|
*
|
||||||
|
* @param state as the new currentState attribute as a ChoosePieceAutomatonState object.
|
||||||
|
*/
|
||||||
|
public void setCurrentState(ChoosePieceAutomatonState state) {
|
||||||
|
if (this.currentState != null) {
|
||||||
|
this.currentState.exit();
|
||||||
|
}
|
||||||
|
this.currentState = state;
|
||||||
|
this.currentState.enter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,10 @@
|
|||||||
import pp.mdga.server.automaton.game.TurnState;
|
import pp.mdga.server.automaton.game.TurnState;
|
||||||
|
|
||||||
public class MovePieceState extends TurnAutomatonState {
|
public class MovePieceState extends TurnAutomatonState {
|
||||||
|
/**
|
||||||
|
* Create LobbyState constants.
|
||||||
|
*/
|
||||||
|
private static final System.Logger LOGGER = System.getLogger(MovePieceState.class.getName());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a server state of the specified game logic.
|
* Constructs a server state of the specified game logic.
|
||||||
@@ -17,11 +21,11 @@ public MovePieceState(TurnState turnAutomaton, ServerGameLogic logic) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Entered MovePieceState state.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Exited MovePieceState state.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
package pp.mdga.server.automaton.game.turn;
|
package pp.mdga.server.automaton.game.turn;
|
||||||
|
|
||||||
import pp.mdga.server.ServerGameLogic;
|
import pp.mdga.server.ServerGameLogic;
|
||||||
|
import pp.mdga.server.automaton.game.AnimationState;
|
||||||
import pp.mdga.server.automaton.game.TurnState;
|
import pp.mdga.server.automaton.game.TurnState;
|
||||||
|
|
||||||
public class PlayPowerCardState extends TurnAutomatonState {
|
public class PlayPowerCardState extends TurnAutomatonState {
|
||||||
|
/**
|
||||||
|
* Create FirstRollState constants.
|
||||||
|
*/
|
||||||
|
private static final System.Logger LOGGER = System.getLogger(PlayPowerCardState.class.getName());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a server state of the specified game logic.
|
* Constructs a server state of the specified game logic.
|
||||||
*
|
*
|
||||||
@@ -16,11 +22,11 @@ public PlayPowerCardState(TurnState turnAutomaton, ServerGameLogic logic) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Entered PlayPowerCardState state.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Exited PlayPowerCardState state.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
package pp.mdga.server.automaton.game.turn;
|
package pp.mdga.server.automaton.game.turn;
|
||||||
|
|
||||||
import pp.mdga.server.ServerGameLogic;
|
import pp.mdga.server.ServerGameLogic;
|
||||||
|
import pp.mdga.server.automaton.game.AnimationState;
|
||||||
import pp.mdga.server.automaton.game.TurnState;
|
import pp.mdga.server.automaton.game.TurnState;
|
||||||
|
|
||||||
public class PowerCardState extends TurnAutomatonState {
|
public class PowerCardState extends TurnAutomatonState {
|
||||||
|
/**
|
||||||
|
* Create FirstRollState constants.
|
||||||
|
*/
|
||||||
|
private static final System.Logger LOGGER = System.getLogger(PowerCardState.class.getName());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a server state of the specified game logic.
|
* Constructs a server state of the specified game logic.
|
||||||
*
|
*
|
||||||
@@ -16,11 +22,11 @@ public PowerCardState(TurnState turnAutomaton, ServerGameLogic logic) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Exited PowerCardState state.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Entered PowerCardState state.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,25 @@
|
|||||||
|
|
||||||
import pp.mdga.server.ServerGameLogic;
|
import pp.mdga.server.ServerGameLogic;
|
||||||
import pp.mdga.server.automaton.game.TurnState;
|
import pp.mdga.server.automaton.game.TurnState;
|
||||||
|
import pp.mdga.server.automaton.game.turn.rolldice.FirstRollState;
|
||||||
|
import pp.mdga.server.automaton.game.turn.rolldice.RollDiceAutomatonState;
|
||||||
|
import pp.mdga.server.automaton.game.turn.rolldice.SecondRollState;
|
||||||
|
import pp.mdga.server.automaton.game.turn.rolldice.ThirdRollState;
|
||||||
|
|
||||||
public class RollDiceState extends TurnAutomatonState {
|
public class RollDiceState extends TurnAutomatonState {
|
||||||
|
/**
|
||||||
|
* Create FirstRollState constants.
|
||||||
|
*/
|
||||||
|
private static final System.Logger LOGGER = System.getLogger(RollDiceState.class.getName());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create RollDiceState attributes.
|
||||||
|
*/
|
||||||
|
private RollDiceAutomatonState currentState;
|
||||||
|
private final FirstRollState firstRollState;
|
||||||
|
private final SecondRollState secondRollState;
|
||||||
|
private final ThirdRollState thirdRollState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a server state of the specified game logic.
|
* Constructs a server state of the specified game logic.
|
||||||
*
|
*
|
||||||
@@ -12,15 +29,69 @@ public class RollDiceState extends TurnAutomatonState {
|
|||||||
*/
|
*/
|
||||||
public RollDiceState(TurnState turnAutomaton, ServerGameLogic logic) {
|
public RollDiceState(TurnState turnAutomaton, ServerGameLogic logic) {
|
||||||
super(turnAutomaton, logic);
|
super(turnAutomaton, logic);
|
||||||
|
this.firstRollState = new FirstRollState(this, logic);
|
||||||
|
this.secondRollState = new SecondRollState(this, logic);
|
||||||
|
this.thirdRollState = new ThirdRollState(this, logic);
|
||||||
|
this.setCurrentState(this.firstRollState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Entered RollDiceState state.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Exited RollDiceState state.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be used to return currentState attribute of RollDiceState class.
|
||||||
|
*
|
||||||
|
* @return currentState as a RollDiceAutomatonState object.
|
||||||
|
*/
|
||||||
|
public RollDiceAutomatonState getCurrentState() {
|
||||||
|
return this.currentState;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be used to return firstRollState attribute of RollDiceState class.
|
||||||
|
*
|
||||||
|
* @return firstRollState as a FirstRollState object.
|
||||||
|
*/
|
||||||
|
public FirstRollState getFirstRollState() {
|
||||||
|
return this.firstRollState;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be used to return secondRollState attribute of RollDiceState class.
|
||||||
|
*
|
||||||
|
* @return secondRollState as a SecondRollState object.
|
||||||
|
*/
|
||||||
|
public SecondRollState getSecondRollState() {
|
||||||
|
return this.secondRollState;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be used to return currentState attribute of RollDiceState class.
|
||||||
|
*
|
||||||
|
* @return thirdRollState as a ThirdRollState object.
|
||||||
|
*/
|
||||||
|
public ThirdRollState getThirdRollState() {
|
||||||
|
return this.thirdRollState;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be used to set currentState attribute of RollDiceState class to the given state parameter.
|
||||||
|
* In Addition, the currentState will be exited, changed and entered.
|
||||||
|
*
|
||||||
|
* @param state as the new currentState attribute as a RollDiceAutomatonState object.
|
||||||
|
*/
|
||||||
|
public void setCurrentState(RollDiceAutomatonState state) {
|
||||||
|
if (this.currentState != null) {
|
||||||
|
this.currentState.exit();
|
||||||
|
}
|
||||||
|
this.currentState = state;
|
||||||
|
this.currentState.enter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ public abstract class ChoosePieceAutomatonState extends ServerState {
|
|||||||
/**
|
/**
|
||||||
* Constructs a server state of the specified game logic.
|
* Constructs a server state of the specified game logic.
|
||||||
*
|
*
|
||||||
|
* @param choosePieceAutomaton as the automaton of the choose piece state as a ChoosePieceState object.
|
||||||
* @param logic the game logic
|
* @param logic the game logic
|
||||||
*/
|
*/
|
||||||
public ChoosePieceAutomatonState(ChoosePieceState choosePieceAutomaton, ServerGameLogic logic) {
|
public ChoosePieceAutomatonState(ChoosePieceState choosePieceAutomaton, ServerGameLogic logic) {
|
||||||
|
|||||||
@@ -3,5 +3,35 @@
|
|||||||
import pp.mdga.server.ServerGameLogic;
|
import pp.mdga.server.ServerGameLogic;
|
||||||
import pp.mdga.server.automaton.game.turn.ChoosePieceState;
|
import pp.mdga.server.automaton.game.turn.ChoosePieceState;
|
||||||
|
|
||||||
public class NoPieceState {
|
public class NoPieceState extends ChoosePieceAutomatonState {
|
||||||
|
/**
|
||||||
|
* Create FirstRollState constants.
|
||||||
|
*/
|
||||||
|
private static final System.Logger LOGGER = System.getLogger(NoPieceState.class.getName());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a server state of the specified game logic.
|
||||||
|
*
|
||||||
|
* @param choosePieceAutomaton as the automaton of the choose piece state as a ChoosePieceState object.
|
||||||
|
* @param logic the game logic
|
||||||
|
*/
|
||||||
|
public NoPieceState(ChoosePieceState choosePieceAutomaton, ServerGameLogic logic) {
|
||||||
|
super(choosePieceAutomaton, logic);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be used whenever this state will be entered.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void enter() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Entered NoPieceState state.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be used whenever this state will be exited.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void exit() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Exited NoPieceState state.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,5 +3,35 @@
|
|||||||
import pp.mdga.server.ServerGameLogic;
|
import pp.mdga.server.ServerGameLogic;
|
||||||
import pp.mdga.server.automaton.game.turn.ChoosePieceState;
|
import pp.mdga.server.automaton.game.turn.ChoosePieceState;
|
||||||
|
|
||||||
public class NoTurnState {
|
public class NoTurnState extends ChoosePieceAutomatonState {
|
||||||
|
/**
|
||||||
|
* Create FirstRollState constants.
|
||||||
|
*/
|
||||||
|
private static final System.Logger LOGGER = System.getLogger(NoTurnState.class.getName());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a server state of the specified game logic.
|
||||||
|
*
|
||||||
|
* @param choosePieceAutomaton as the automaton of the choose piece state as a ChoosePieceState object.
|
||||||
|
* @param logic the game logic
|
||||||
|
*/
|
||||||
|
public NoTurnState(ChoosePieceState choosePieceAutomaton, ServerGameLogic logic) {
|
||||||
|
super(choosePieceAutomaton, logic);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be used whenever this state will be entered.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void enter() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Entered NoTurnState state.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be used whenever this state will be exited.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void exit() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Exited NoTurnState state.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,35 @@
|
|||||||
import pp.mdga.server.ServerGameLogic;
|
import pp.mdga.server.ServerGameLogic;
|
||||||
import pp.mdga.server.automaton.game.turn.ChoosePieceState;
|
import pp.mdga.server.automaton.game.turn.ChoosePieceState;
|
||||||
|
|
||||||
public class SelectPieceState {
|
public class SelectPieceState extends ChoosePieceAutomatonState {
|
||||||
|
/**
|
||||||
|
* Create FirstRollState constants.
|
||||||
|
*/
|
||||||
|
private static final System.Logger LOGGER = System.getLogger(SelectPieceState.class.getName());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a server state of the specified game logic.
|
||||||
|
*
|
||||||
|
* @param choosePieceAutomaton as the automaton of the choose piece state as a ChoosePieceState object.
|
||||||
|
* @param logic the game logic
|
||||||
|
*/
|
||||||
|
public SelectPieceState(ChoosePieceState choosePieceAutomaton, ServerGameLogic logic) {
|
||||||
|
super(choosePieceAutomaton, logic);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be used whenever this state will be entered.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void enter() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Entered SelectPieceState state.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be used whenever this state will be exited.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void exit() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Exited SelectPieceState state.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,5 +3,35 @@
|
|||||||
import pp.mdga.server.ServerGameLogic;
|
import pp.mdga.server.ServerGameLogic;
|
||||||
import pp.mdga.server.automaton.game.turn.ChoosePieceState;
|
import pp.mdga.server.automaton.game.turn.ChoosePieceState;
|
||||||
|
|
||||||
public class StartPieceState {
|
public class StartPieceState extends ChoosePieceAutomatonState {
|
||||||
|
/**
|
||||||
|
* Create FirstRollState constants.
|
||||||
|
*/
|
||||||
|
private static final System.Logger LOGGER = System.getLogger(StartPieceState.class.getName());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a server state of the specified game logic.
|
||||||
|
*
|
||||||
|
* @param choosePieceAutomaton as the automaton of the choose piece state as a ChoosePieceState object.
|
||||||
|
* @param logic the game logic
|
||||||
|
*/
|
||||||
|
public StartPieceState(ChoosePieceState choosePieceAutomaton, ServerGameLogic logic) {
|
||||||
|
super(choosePieceAutomaton, logic);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be used whenever this state will be entered.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void enter() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Exited StartPieceState state.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be used whenever this state will be exited.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void exit() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Entered StartPieceState state.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,37 @@
|
|||||||
|
|
||||||
import pp.mdga.server.ServerGameLogic;
|
import pp.mdga.server.ServerGameLogic;
|
||||||
import pp.mdga.server.automaton.game.turn.ChoosePieceState;
|
import pp.mdga.server.automaton.game.turn.ChoosePieceState;
|
||||||
|
import pp.mdga.server.automaton.game.turn.rolldice.FirstRollState;
|
||||||
|
|
||||||
public class WaitingPieceState {
|
public class WaitingPieceState extends ChoosePieceAutomatonState {
|
||||||
|
/**
|
||||||
|
* Create FirstRollState constants.
|
||||||
|
*/
|
||||||
|
private static final System.Logger LOGGER = System.getLogger(WaitingPieceState.class.getName());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a server state of the specified game logic.
|
||||||
|
*
|
||||||
|
* @param choosePieceAutomaton as the automaton of the choose piece state as a ChoosePieceState object.
|
||||||
|
* @param logic the game logic
|
||||||
|
*/
|
||||||
|
public WaitingPieceState(ChoosePieceState choosePieceAutomaton, ServerGameLogic logic) {
|
||||||
|
super(choosePieceAutomaton, logic);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be used whenever this state will be entered.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void enter() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Entered WaitingPieceState state.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be used whenever this state will be exited.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void exit() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Exited WaitingPieceState state.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,6 @@ public void enter() {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
LOGGER.log(System.Logger.Level.DEBUG, "Exited FirstRollStatte state.");
|
LOGGER.log(System.Logger.Level.DEBUG, "Exited FirstRollState state.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ public abstract class RollDiceAutomatonState extends ServerState {
|
|||||||
/**
|
/**
|
||||||
* Constructs a server state of the specified game logic.
|
* Constructs a server state of the specified game logic.
|
||||||
*
|
*
|
||||||
* @param logic the game logic
|
* @param rollDiceAutomaton as the automaton of the roll dice state as a RollDiceState object.
|
||||||
|
* @param logic the game logic
|
||||||
*/
|
*/
|
||||||
public RollDiceAutomatonState(RollDiceState rollDiceAutomaton, ServerGameLogic logic) {
|
public RollDiceAutomatonState(RollDiceState rollDiceAutomaton, ServerGameLogic logic) {
|
||||||
super(logic);
|
super(logic);
|
||||||
|
|||||||
@@ -3,5 +3,29 @@
|
|||||||
import pp.mdga.server.ServerGameLogic;
|
import pp.mdga.server.ServerGameLogic;
|
||||||
import pp.mdga.server.automaton.game.turn.RollDiceState;
|
import pp.mdga.server.automaton.game.turn.RollDiceState;
|
||||||
|
|
||||||
public class SecondRollState {
|
public class SecondRollState extends RollDiceAutomatonState {
|
||||||
|
/**
|
||||||
|
* Create FirstRollState constants.
|
||||||
|
*/
|
||||||
|
private static final System.Logger LOGGER = System.getLogger(SecondRollState.class.getName());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a server state of the specified game logic.
|
||||||
|
*
|
||||||
|
* @param rollDiceAutomaton as the automaton of the roll dice state as a RollDiceState object.
|
||||||
|
* @param logic the game logic
|
||||||
|
*/
|
||||||
|
public SecondRollState(RollDiceState rollDiceAutomaton, ServerGameLogic logic) {
|
||||||
|
super(rollDiceAutomaton, logic);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enter() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Entered SecondRollState state.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exit() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Exited SecondRollState state.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,5 +3,29 @@
|
|||||||
import pp.mdga.server.ServerGameLogic;
|
import pp.mdga.server.ServerGameLogic;
|
||||||
import pp.mdga.server.automaton.game.turn.RollDiceState;
|
import pp.mdga.server.automaton.game.turn.RollDiceState;
|
||||||
|
|
||||||
public class ThirdRollState {
|
public class ThirdRollState extends RollDiceAutomatonState {
|
||||||
|
/**
|
||||||
|
* Create FirstRollState constants.
|
||||||
|
*/
|
||||||
|
private static final System.Logger LOGGER = System.getLogger(ThirdRollState.class.getName());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a server state of the specified game logic.
|
||||||
|
*
|
||||||
|
* @param rollDiceAutomaton as the automaton of the roll dice state as a RollDiceState object.
|
||||||
|
* @param logic the game logic
|
||||||
|
*/
|
||||||
|
public ThirdRollState(RollDiceState rollDiceAutomaton, ServerGameLogic logic) {
|
||||||
|
super(rollDiceAutomaton, logic);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enter() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Exited ThirdRollState state.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exit() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Entered ThirdRollState state.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user