Changed and :
removed the selectAnimationEnd Method from Waitranking and moved logic into the receivedActivePlayerMessage. Added in selectStart to always send a StartGameMessage in order to trigger incorrectRequestMEssage
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="MdgaApp" type="Application" factoryName="Application" singleton="false" nameIsGenerated="true">
|
<configuration default="false" name="MdgaApp" type="Application" factoryName="Application" singleton="false" nameIsGenerated="true">
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH" value="temurin-20" />
|
||||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
|
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
|
||||||
<option name="MAIN_CLASS_NAME" value="pp.mdga.client.MdgaApp" />
|
<option name="MAIN_CLASS_NAME" value="pp.mdga.client.MdgaApp" />
|
||||||
<module name="Projekte.mdga.client.main" />
|
<module name="Projekte.mdga.client.main" />
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ public void selectStart() {
|
|||||||
if (logic.isHost() && logic.getGame().areAllReady()) {
|
if (logic.isHost() && logic.getGame().areAllReady()) {
|
||||||
logic.send(new StartGameMessage());
|
logic.send(new StartGameMessage());
|
||||||
} else {
|
} else {
|
||||||
|
logic.send(new StartGameMessage());
|
||||||
LOGGER.log(System.Logger.Level.ERROR, "You are not the host");
|
LOGGER.log(System.Logger.Level.ERROR, "You are not the host");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,15 +4,12 @@
|
|||||||
import pp.mdga.client.ClientState;
|
import pp.mdga.client.ClientState;
|
||||||
import pp.mdga.client.gamestate.DetermineStartPlayerState;
|
import pp.mdga.client.gamestate.DetermineStartPlayerState;
|
||||||
import pp.mdga.message.client.AnimationEndMessage;
|
import pp.mdga.message.client.AnimationEndMessage;
|
||||||
import pp.mdga.message.server.ActivePlayerMessage;
|
import pp.mdga.message.server.*;
|
||||||
import pp.mdga.message.server.RankingResponseMessage;
|
|
||||||
import pp.mdga.message.server.RankingRollAgainMessage;
|
|
||||||
import pp.mdga.notification.ActivePlayerNotification;
|
import pp.mdga.notification.ActivePlayerNotification;
|
||||||
|
|
||||||
public class WaitRankingState extends DetermineStartPlayerStates {
|
public class WaitRankingState extends DetermineStartPlayerStates {
|
||||||
|
|
||||||
private final DetermineStartPlayerState parent;
|
private final DetermineStartPlayerState parent;
|
||||||
private boolean canTransition = false;
|
|
||||||
|
|
||||||
public WaitRankingState(ClientState parent, ClientGameLogic logic) {
|
public WaitRankingState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
@@ -29,33 +26,18 @@ public void exit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void received(RankingRollAgainMessage msg){
|
public void received(DiceNowMessage msg){
|
||||||
parent.setState(parent.getRollRankingDice());
|
parent.setState(parent.getRollRankingDice());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void received(RankingResponseMessage msg){
|
public void received(RankingResponseMessage msg){
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void selectAnimationEnd(){
|
|
||||||
logic.send(new AnimationEndMessage());
|
|
||||||
changeToIntro();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void received(ActivePlayerMessage msg){
|
public void received(ActivePlayerMessage msg){
|
||||||
logic.addNotification(new ActivePlayerNotification(msg.getColor()));
|
|
||||||
logic.getGame().setActiveColor(msg.getColor());
|
logic.getGame().setActiveColor(msg.getColor());
|
||||||
changeToIntro();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void changeToIntro(){
|
|
||||||
if (!canTransition){
|
|
||||||
canTransition = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
parent.setState(parent.getIntro());
|
parent.setState(parent.getIntro());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user