Updated 'AnimationState' class.
Updated the 'AnimationState' class by setting the data type of 'messageReceived' from 'Map' to 'Set'.
This commit is contained in:
@@ -1,16 +1,14 @@
|
|||||||
package pp.mdga.server.automaton.game;
|
package pp.mdga.server.automaton.game;
|
||||||
|
|
||||||
import pp.mdga.message.client.AnimationEndMessage;
|
import pp.mdga.message.client.AnimationEndMessage;
|
||||||
import pp.mdga.message.server.DiceNowMessage;
|
|
||||||
import pp.mdga.server.ServerGameLogic;
|
import pp.mdga.server.ServerGameLogic;
|
||||||
import pp.mdga.server.automaton.GameState;
|
import pp.mdga.server.automaton.GameState;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents the animation state of the game state.
|
* This class represents the animation state of the game state.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class AnimationState extends GameAutomatonState {
|
public class AnimationState extends GameAutomatonState {
|
||||||
/**
|
/**
|
||||||
@@ -21,7 +19,7 @@ public class AnimationState extends GameAutomatonState {
|
|||||||
/**
|
/**
|
||||||
* Create AnimationState attributes.
|
* Create AnimationState attributes.
|
||||||
*/
|
*/
|
||||||
private final Map<Integer, Boolean> messageReceived = new HashMap<>();
|
private final Set<Integer> messageReceived = new HashSet<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a server state of the specified game logic.
|
* Constructs a server state of the specified game logic.
|
||||||
@@ -53,7 +51,7 @@ public void exit() {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(AnimationEndMessage msg, int from) {
|
public void received(AnimationEndMessage msg, int from) {
|
||||||
this.messageReceived.put(from, true);
|
this.messageReceived.add(from);
|
||||||
if (this.messageReceived.size() == this.logic.getGame().getPlayers().size()) {
|
if (this.messageReceived.size() == this.logic.getGame().getPlayers().size()) {
|
||||||
this.gameAutomaton.setCurrentState(this.gameAutomaton.getTurnState());
|
this.gameAutomaton.setCurrentState(this.gameAutomaton.getTurnState());
|
||||||
this.gameAutomaton.getTurnState().setCurrentState(this.gameAutomaton.getTurnState().getPowerCardState());
|
this.gameAutomaton.getTurnState().setCurrentState(this.gameAutomaton.getTurnState().getPowerCardState());
|
||||||
|
|||||||
Reference in New Issue
Block a user