changed parameter of DieMessage and included the force resumgame logic in intterrupt

This commit is contained in:
Fleischer Hanno
2024-12-01 13:56:31 +01:00
parent 26d2d0587d
commit e70331d85d
4 changed files with 18 additions and 24 deletions

View File

@@ -267,6 +267,10 @@ public void selectStart(){
state.selectStart();
}
public void selectResume(){
state.selectResume();
}
public void setState(ClientState state){
this.state.exit();
state.enter();

View File

@@ -236,6 +236,10 @@ public void selectNext(){
LOGGER.log(Level.DEBUG, "Next not allowed");
}
public void selectResume(){
LOGGER.log(Level.DEBUG, "Resume not allowed");
}
protected CeremonyNotification createCeremonyNotification(){
CeremonyNotification notification = new CeremonyNotification();
for (var player : logic.getGame().getPlayers().entrySet()){

View File

@@ -1,5 +1,6 @@
package pp.mdga.client;
import pp.mdga.message.client.ForceContinueGameMessage;
import pp.mdga.message.server.ResumeGameMessage;
import pp.mdga.notification.ResumeNotification;
@@ -29,6 +30,13 @@ public ClientState getPreviousState() {
return previousState;
}
@Override
public void selectResume(){
if(logic.isHost()){
logic.send(new ForceContinueGameMessage());
}
}
public void received(ResumeGameMessage msg) {
//TODO: logic.addNotification(new ResumeNotification());
logic.setState(previousState);

View File

@@ -18,9 +18,8 @@ public class DieMessage extends ServerMessage {
* Constructor for Dice
*
* @param diceEye the eye of the dice
* @param moveablePieces the pieces that can be moved
*/
public DieMessage(int diceEye, List<String> moveablePieces) {
public DieMessage(int diceEye) {
super();
this.diceEye = diceEye;
}
@@ -28,31 +27,10 @@ public DieMessage(int diceEye, List<String> moveablePieces) {
/**
* Default constructor for serialization purposes.
*/
private DieMessage() {
public DieMessage() {
diceEye = 0;
}
/**
* Constructor for inactivePlayer
*
* @param diceEye the eye of the dice
* @return a new Dice object
*/
public static DieMessage inactivePlayer(int diceEye) {
return new DieMessage(diceEye, null);
}
/**
* Constructor for activePlayer
*
* @param diceEye the eye of the dice
* @param moveablePieces the pieces that can be moved
* @return a new Dice object
*/
public static DieMessage activePlayer(int diceEye, List<String> moveablePieces) {
return new DieMessage(diceEye, moveablePieces);
}
/**
* Getter for the eye of the dice
*