Class AddPlayer
java.lang.Object
it.polimi.ingsw.gc14.Network.NetworkEvent
it.polimi.ingsw.gc14.Network.NetworkEvents.AddPlayer
- All Implemented Interfaces:
Serializable
Network event used to register a new player in the lobby.
The first player to join also proposes the desired number of players
for the match. Subsequent joiners ignore proposedNPlayer if the
game has already been created.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intNumber of players proposed by this player; used only when creating a new game.Fields inherited from class NetworkEvent
currentState, disconnectedPlayers, errorType, eventType, isError, orderLogicCard, playerList, slotPlayerMap, username -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanapply(GameController gameController) Applies this event to the specified server-side game controller.voidApplies this event to the client-side mini model, updating players, turn order, game state, and slot map.intMethods inherited from class NetworkEvent
enrichWithGameState, getErrorType, getEventType, getUsername, isError, setData, setErrorType, setIsError, toString
-
Field Details
-
proposedNPlayer
private final int proposedNPlayerNumber of players proposed by this player; used only when creating a new game.
-
-
Constructor Details
-
AddPlayer
Class constructor. Initializes all the attributes.- Parameters:
username- the name of the player requesting the eventproposedNPlayer- the number of proposed players to add to the match
-
-
Method Details
-
getProposedNPlayer
public int getProposedNPlayer()- Returns:
- the number of proposed players to add to the match
-
apply
Description copied from class:NetworkEventApplies this event to the specified server-side game controller.- Specified by:
applyin classNetworkEvent- Parameters:
gameController- the Game Controller on which to apply the event- Returns:
- true if the player could be added to the match, false otherwise
-
apply
Applies this event to the client-side mini model, updating players, turn order, game state, and slot map.- Specified by:
applyin classNetworkEvent- Parameters:
miniModel- the client-side model to update.
-