added logger
This commit is contained in:
@@ -18,7 +18,6 @@ public AnimationState(ClientState parent, ClientGameLogic logic) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
LOGGER.log(System.Logger.Level.INFO, "Entering AnimationState");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ public void exit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setState(DetermineStartPlayerStates state) {
|
public void setState(DetermineStartPlayerStates state) {
|
||||||
|
System.out.println("CLIENT STATE old: " + this.state + " new: " + state);
|
||||||
if(this.state != null){
|
if(this.state != null){
|
||||||
this.state.exit();
|
this.state.exit();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ public SpectatorState(ClientState parent, ClientGameLogic logic) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ public void exit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setState(TurnStates state){
|
public void setState(TurnStates state){
|
||||||
|
System.out.println("CLIENT STATE old: " + this.state + " new: " + state);
|
||||||
if(this.state != null){
|
if(this.state != null){
|
||||||
this.state.exit();
|
this.state.exit();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ public void exit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setState(ChoosePieceStates state){
|
public void setState(ChoosePieceStates state){
|
||||||
|
System.out.println("CLIENT STATE old: " + this.currentState + " new: " + state);
|
||||||
if(currentState != null){
|
if(currentState != null){
|
||||||
currentState.exit();
|
currentState.exit();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ public void exit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setState(PowerCardStates state) {
|
public void setState(PowerCardStates state) {
|
||||||
|
System.out.println("CLIENT STATE old: " + this.state + " new: " + state);
|
||||||
|
|
||||||
if(this.state != null){
|
if(this.state != null){
|
||||||
this.state.exit();
|
this.state.exit();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,15 +57,17 @@ public void setOccupant(Piece occupant) {
|
|||||||
* @return the old occupant of the node
|
* @return the old occupant of the node
|
||||||
*/
|
*/
|
||||||
public Piece moveOccupant(Piece newOccupant) {
|
public Piece moveOccupant(Piece newOccupant) {
|
||||||
if (occupant == null) {
|
throw new RuntimeException("BÖSE METHODE !!!!");
|
||||||
setOccupant(newOccupant);
|
|
||||||
return null;
|
// if (occupant == null) {
|
||||||
} else {
|
// setOccupant(newOccupant);
|
||||||
occupant.setShield(ShieldState.NONE);
|
// return null;
|
||||||
occupant.setState(PieceState.WAITING);
|
// } else {
|
||||||
setOccupant(newOccupant);
|
// occupant.setShield(ShieldState.NONE);
|
||||||
return occupant;
|
// occupant.setState(PieceState.WAITING);
|
||||||
}
|
// setOccupant(newOccupant);
|
||||||
|
// return occupant;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ private void checkSelectPiece(Player activePlayer){
|
|||||||
} else {
|
} else {
|
||||||
this.choosePieceAutomaton.getSelectPieceState().setMoveablePieces(moveablePieces);
|
this.choosePieceAutomaton.getSelectPieceState().setMoveablePieces(moveablePieces);
|
||||||
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getSelectPieceState());
|
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getSelectPieceState());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package pp.mdga.server.automaton.game.turn.choosepiece;
|
package pp.mdga.server.automaton.game.turn.choosepiece;
|
||||||
|
|
||||||
|
import pp.mdga.game.Node;
|
||||||
import pp.mdga.game.Piece;
|
import pp.mdga.game.Piece;
|
||||||
import pp.mdga.game.PieceState;
|
import pp.mdga.game.PieceState;
|
||||||
import pp.mdga.game.ShieldState;
|
import pp.mdga.game.ShieldState;
|
||||||
@@ -57,26 +58,33 @@ public void enter() {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void received(RequestMoveMessage msg, int from){
|
public void received(RequestMoveMessage msg, int from){
|
||||||
if (moveablePieces.contains(msg.getPiece())) {
|
if(!moveablePieces.contains(msg.getPiece())){
|
||||||
int indexOfPiece = moveablePieces.indexOf(msg.getPiece());
|
throw new RuntimeException("invalid Piece");
|
||||||
logic.getGame().getBoard().getInfield()[logic.getGame().getBoard().getInfieldIndexOfPiece(moveablePieces.get(indexOfPiece))].clearOccupant();
|
|
||||||
if (isHomeMove.get(indexOfPiece)) {
|
|
||||||
logic.getGame().getPlayerByColor(msg.getPiece().getColor()).setPieceInHome(targetIndex.get(indexOfPiece), logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid()));
|
|
||||||
if (logic.getGame().getPlayerByColor(msg.getPiece().getColor()).isHomeFinished(logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid()))) {
|
|
||||||
logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid()).setState(PieceState.HOMEFINISHED);
|
|
||||||
} else {
|
|
||||||
logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid()).setState(PieceState.HOME);
|
|
||||||
}
|
|
||||||
logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid()).setShield(ShieldState.NONE);
|
|
||||||
} else {
|
|
||||||
Piece occ = logic.getGame().getBoard().getInfield()[targetIndex.get(indexOfPiece)].moveOccupant(moveablePieces.get(indexOfPiece));
|
|
||||||
if (occ != null) {
|
|
||||||
logic.getGame().getPlayerByColor(occ.getColor()).addWaitingPiece(occ);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
logic.getServerSender().broadcast(new MoveMessage(moveablePieces.get(indexOfPiece), isHomeMove.get(indexOfPiece), targetIndex.get(indexOfPiece)));
|
|
||||||
this.choosePieceAutomaton.getTurnAutomaton().setCurrentState(this.choosePieceAutomaton.getTurnAutomaton().getMovePieceState());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int indexOfPiece = moveablePieces.indexOf(msg.getPiece());
|
||||||
|
logic.getGame().getBoard().getInfield()[logic.getGame().getBoard().getInfieldIndexOfPiece(moveablePieces.get(indexOfPiece))].clearOccupant();
|
||||||
|
if (isHomeMove.get(indexOfPiece)) {
|
||||||
|
logic.getGame().getPlayerByColor(msg.getPiece().getColor()).setPieceInHome(targetIndex.get(indexOfPiece), logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid()));
|
||||||
|
if (logic.getGame().getPlayerByColor(msg.getPiece().getColor()).isHomeFinished(logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid()))) {
|
||||||
|
logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid()).setState(PieceState.HOMEFINISHED);
|
||||||
|
} else {
|
||||||
|
logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid()).setState(PieceState.HOME);
|
||||||
|
}
|
||||||
|
logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid()).setShield(ShieldState.NONE);
|
||||||
|
} else {
|
||||||
|
Node targetNode = logic.getGame().getBoard().getInfield()[targetIndex.get(indexOfPiece)];
|
||||||
|
Piece occ = targetNode.getOccupant();
|
||||||
|
// Piece occ = logic.getGame().getBoard().getInfield()[targetIndex.get(indexOfPiece)].moveOccupant(moveablePieces.get(indexOfPiece));
|
||||||
|
if (occ != null) {
|
||||||
|
logic.getGame().getPlayerByColor(occ.getColor()).addWaitingPiece(occ);
|
||||||
|
}
|
||||||
|
|
||||||
|
targetNode.setOccupant(msg.getPiece());
|
||||||
|
}
|
||||||
|
logic.getServerSender().broadcast(new MoveMessage(moveablePieces.get(indexOfPiece), isHomeMove.get(indexOfPiece), targetIndex.get(indexOfPiece)));
|
||||||
|
this.choosePieceAutomaton.getTurnAutomaton().setCurrentState(this.choosePieceAutomaton.getTurnAutomaton().getMovePieceState());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user