Class TotemChoice
java.lang.Object
it.polimi.ingsw.gc14.Network.NetworkEvent
it.polimi.ingsw.gc14.Network.NetworkEvents.TotemChoice
- All Implemented Interfaces:
Serializable
Network event used to handle a player's totem choice.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionList of totems still available after the choice has been processed.private final StringName of the totem selected by the player.Fields inherited from class NetworkEvent
currentState, disconnectedPlayers, errorType, eventType, isError, orderLogicCard, playerList, slotPlayerMap, username -
Constructor Summary
ConstructorsConstructorDescriptionTotemChoice(String username, String totem) Constructs a totem choice event for the specified player. -
Method Summary
Modifier and TypeMethodDescriptionbooleanapply(GameController gameController) Applies the totem choice event to the server-side game controller.voidApplies the totem choice update to the client-side mini model.voidenrichWithGameState(Game game, ArrayList<String> disconnectedUsernames) Populates this event with the current game state so clients can update their local model after receiving it.Methods inherited from class NetworkEvent
getErrorType, getEventType, getUsername, isError, setData, setErrorType, setIsError, toString
-
Field Details
-
totem
Name of the totem selected by the player. -
availableTotems
-
-
Constructor Details
-
TotemChoice
-
-
Method Details
-
enrichWithGameState
Description copied from class:NetworkEventPopulates this event with the current game state so clients can update their local model after receiving it. Subclasses that carry extra state (available totems, etc.) override this method and callsuperfirst.- Overrides:
enrichWithGameStatein classNetworkEvent- Parameters:
game- the current game model.disconnectedUsernames- usernames of currently disconnected players.
-
apply
Applies the totem choice event to the server-side game controller.- Specified by:
applyin classNetworkEvent- Parameters:
gameController- the game controller on which to apply the event.- Returns:
trueif the totem choice is handled successfully,falseotherwise.
-
apply
Applies the totem choice update to the client-side mini model.If the event does not represent an error, the player data, turn order, current game state, slot assignments, and available totems are updated.
- Specified by:
applyin classNetworkEvent- Parameters:
miniModel- the mini model on which to apply the event.
-