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 paramsObject Initialization options.
Properties
Name Type Description clientIdstring The application clientID. Omit if its already provided in the native application via cloud configuration.
defaultLeaderboardstring The default leaderboard ID. You can omit it if you specify the leaderboardID in all the score queries or submits.
scopesarray Additional scope identifiers. Plus & Games APIs are included by default. To use cloud saved game include the 'drive.appfolder' scope.
showAchievementNotificationsboolean Enables or disables the native view notifications when an achievement is unlocked.
callbackfunction The initialization completed callback. Received params: error
-
<static> loadSavedGame(identifier, callback)
-
Loads a Saved Game Snapshot from the cloud
Parameters:
Name Type Description identifierstring snapshot identifier
callbackfunction 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 callbackfunction 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 eventIdstring The event Id.
incrementnumber The amount the event will be incremented with.
-
<static> writeSavedGame(snapshot, callback)
-
Writes a SavedGame Snapshot to the cloud
Parameters:
Name Type Description snapshotObject snapshot object to store. New snapshot is created if the identifier is a new one. An object with:
- Identifier
- Title
- Description
- Data properties.
callbackfunction The callback function. It receives the following parameters:
- Error.