Cocoon Social Interface for the Google Play Games Extension.
Methods
-
<static> getMultiplayerInterface() → {Cocoon.Multiplayer.MultiplayerService}
-
Returns a Cocoon Multiplayer interface for the Game Center Extension.
Returns:
- Type
- Cocoon.Multiplayer.MultiplayerService
-
<static> getSocialInterface() → {Cocoon.Social.Interface}
-
Returns a Cocoon SocialGaming interface for the Google Play Games Extension. You can use the Google Play Games extension in two ways, with the official SDK API equivalent or with the CocoonJS Social API abstraction.
Returns:
-
<static> init(params, callback)
-
Initializes the service and tries to restore the last session.
Parameters:
Name Type Description params
Object Initialization options.
Properties
Name Type Description clientId
string The application clientID. Omit if its already provided in the native application via cloud configuration.
defaultLeaderboard
string The default leaderboard ID. You can omit it if you specify the leaderboardID in all the score queries or submits.
scopes
array Additional scope identifiers. Plus & Games APIs are included by default. To use cloud saved game include the 'drive.appfolder' scope.
showAchievementNotifications
boolean Enables or disables the native view notifications when an achievement is unlocked.
callback
function The initialization completed callback. Received params: error
-
<static> loadSavedGame(identifier, callback)
-
Loads a Saved Game Snapshot from the cloud
Parameters:
Name Type Description identifier
string snapshot identifier
callback
function The callback function. It receives the following parameters:
- Snapshot: Object with the title, description adn identifier of the snapshort. The data property contains the raw bytes converted to string.
- Error.
-
<static> showSavedGames(callback)
-
Show Google Play saved games activity and allows the user to choose a saved game or to create a new one
Parameters:
Name Type Description callback
function The callback function. It receives the following parameters:
- Snapshot: The selected snapshot metada, use loadSavedGame to fetch its data. If the user creates a new snapshot the idenfier will be empty.
- Error.
-
<static> submitEvent(eventId, increment)
-
Submit event
Parameters:
Name Type Description eventId
string The event Id.
increment
number The amount the event will be incremented with.
-
<static> writeSavedGame(snapshot, callback)
-
Writes a SavedGame Snapshot to the cloud
Parameters:
Name Type Description snapshot
Object snapshot object to store. New snapshot is created if the identifier is a new one. An object with:
- Identifier
- Title
- Description
- Data properties.
callback
function The callback function. It receives the following parameters:
- Error.