Classes
Namespaces
Events
-
On invitation
-
Triggered when an invitation is received and loaded. This listener should be setup first thing even before the init is called.
Example
multiplayerService.on("invitation", { received: function() { console.log("Invitation received"); }, loaded: function(match, error) { console.log("Invitation ready: (Error: + " + JSON.stringify(error) + ")"); } });
Members
-
<static> ConnectionState
-
This object represents the connection state of a player.
Properties:
Name Type Description Cocoon.Multiplayer.ConnectionStateobject The object itself
Properties
Name Type Description UNKNOWNstring The connection is in unknown state.
CONNECTEDstring The connection is in connected state.
DISCONNECTEDstring The connection is in disconnected state.
-
<static> MatchRequest
-
This object is used to specify the parameters for a new multiplayer match.
Properties:
Name Type Description Cocoon.Multiplayer.MatchRequestobject The object itself
Properties
Name Type Argument Description minPlayersnumber The minimum number of players that may join the match.
maxPlayersnumber The maximum number of players that may join the match.
playersToInvitearray <optional>
Optional list of player identifers for players to invite to the match.
playerGroupnumber <optional>
Optional number identifying a subset of players allowed to join the match.
playerAttributesnumber <optional>
Optional mask that specifies the role that the local player would like to play in the game.
-
<static> PlayerInfo
-
The object that represents the information of a player inside a multiplayer match.
Properties:
Name Type Description Cocoon.Multiplayer.PlayerInfoobject The object itself
Properties
Name Type Description userIDstring The id of the user.
userNamestring The name of the user.
-
<static> SendDataMode
-
This object represents the modes to send data.
Properties:
Name Type Description Cocoon.Multiplayer.SendDataModeobject The object itself
Properties
Name Type Description RELIABLEstring The data is sent continuously until it is successfully received by the intended recipients or the connection times out.
UNRELIABLEstring The data is sent once and is not sent again if a transmission error occurs.