Class ReconnectPlayer
java.lang.Object
it.polimi.ingsw.gc14.Network.NetworkEvent
it.polimi.ingsw.gc14.Network.NetworkEvents.ReconnectPlayer
- All Implemented Interfaces:
Serializable
Network event used to notify that a player has reconnected to the game.
- See Also:
-
Field Summary
Fields inherited from class NetworkEvent
currentState, disconnectedPlayers, errorType, eventType, isError, orderLogicCard, playerList, slotPlayerMap, username -
Constructor Summary
ConstructorsConstructorDescriptionReconnectPlayer(String username) Constructs a reconnection event for the specified player. -
Method Summary
Modifier and TypeMethodDescriptionbooleanapply(GameController gameController) Applies the reconnection event to the server-side game controller.voidApplies the reconnection 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
-
Constructor Details
-
ReconnectPlayer
Constructs a reconnection event for the specified player.- Parameters:
username- the username of the player who reconnected.
-
-
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 reconnection 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 player reconnection is handled successfully,falseotherwise.
-
apply
Applies the reconnection update to the client-side mini model.If the event does not represent an error, the player data, turn order, current game state, and slot assignments are updated.
- Specified by:
applyin classNetworkEvent- Parameters:
miniModel- the mini model on which to apply the event.
-