merge Development into test #27

Merged
j23f0712 merged 14 commits from development into dev/test 2024-12-01 21:56:50 +01:00
4 changed files with 37 additions and 1 deletions
Showing only changes of commit 5206b03966 - Show all commits

View File

@@ -8,10 +8,19 @@ public class InterruptState extends ClientState {
private ClientState previousState; private ClientState previousState;
/**
* Creates a new InterruptState
*
* @param parent the parent state
* @param logic the game logic
*/
public InterruptState(ClientState parent, ClientGameLogic logic) { public InterruptState(ClientState parent, ClientGameLogic logic) {
super(parent, logic); super(parent, logic);
} }
/**
* Enters the new state machine
*/
@Override @Override
public void enter() { public void enter() {
previousState = null; previousState = null;

View File

@@ -7,26 +7,44 @@
public class SettingsState extends ClientState { public class SettingsState extends ClientState {
/**
* The current state of the settings
*/
private SettingStates currentState; private SettingStates currentState;
private final MainSettingsState mainSettingsState = new MainSettingsState(this, logic); private final MainSettingsState mainSettingsState = new MainSettingsState(this, logic);
private final AudioSettingsState audioSettingsState = new AudioSettingsState(this, logic); private final AudioSettingsState audioSettingsState = new AudioSettingsState(this, logic);
private final VideoSettingsState videoSettingsState = new VideoSettingsState(this, logic); private final VideoSettingsState videoSettingsState = new VideoSettingsState(this, logic);
/**
* Creates a new SettingsState
*
* @param parent the parent state
* @param logic the game logic
*/
public SettingsState(ClientState parent, ClientGameLogic logic) { public SettingsState(ClientState parent, ClientGameLogic logic) {
super(parent, logic); super(parent, logic);
} }
/**
* Enters the current state
*/
@Override @Override
public void enter() { public void enter() {
currentState = mainSettingsState; currentState = mainSettingsState;
} }
/**
* Exits the current state
*/
@Override @Override
public void exit() { public void exit() {
currentState.exit(); currentState.exit();
} }
/**
* Changes the current state
*/
public SettingStates getState(){ public SettingStates getState(){
return currentState; return currentState;
} }

View File

@@ -35,6 +35,7 @@ public void exit() {
@Override @Override
public void selectLeave() { public void selectLeave() {
parent.setState(parent.getStartDialog()); parent.setState(parent.getStartDialog());
logic.send(new LeaveGameMessage());
} }
@Override @Override

View File

@@ -11,6 +11,8 @@
import pp.mdga.notification.WaitMoveNotification; import pp.mdga.notification.WaitMoveNotification;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class NoPieceState extends ChoosePieceStates { public class NoPieceState extends ChoosePieceStates {
@@ -49,7 +51,13 @@ public void received(WaitPieceMessage msg){
@Override @Override
public void received(StartPieceMessage msg){ public void received(StartPieceMessage msg){
Piece piece = logic.getGame().getPieceThroughUUID(msg.getPieceIdentifier()); Piece piece = logic.getGame().getPieceThroughUUID(msg.getPieceIdentifier());
//TODO: logic.addNotification(null); List<UUID> listPiece = new ArrayList<>();
List<Integer> listIndex = new ArrayList<>();
List<Boolean> homeMove = new ArrayList<>();
listPiece.add(piece.getUuid());
listIndex.add(msg.getTargetIndex());
homeMove.add(false);
logic.addNotification(new SelectableMoveNotification(listPiece, listIndex, homeMove));
parent.setState(parent.getStartPiece()); parent.setState(parent.getStartPiece());
} }