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.ConnectionState
object The object itself
Properties
Name Type Description UNKNOWN
string The connection is in unknown state.
CONNECTED
string The connection is in connected state.
DISCONNECTED
string 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.MatchRequest
object The object itself
Properties
Name Type Argument Description minPlayers
number The minimum number of players that may join the match.
maxPlayers
number The maximum number of players that may join the match.
playersToInvite
array <optional>
Optional list of player identifers for players to invite to the match.
playerGroup
number <optional>
Optional number identifying a subset of players allowed to join the match.
playerAttributes
number <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.PlayerInfo
object The object itself
Properties
Name Type Description userID
string The id of the user.
userName
string The name of the user.
-
<static> SendDataMode
-
This object represents the modes to send data.
Properties:
Name Type Description Cocoon.Multiplayer.SendDataMode
object The object itself
Properties
Name Type Description RELIABLE
string The data is sent continuously until it is successfully received by the intended recipients or the connection times out.
UNRELIABLE
string The data is sent once and is not sent again if a transmission error occurs.