Cocoon Social Interface for the Game Center Extension.
Methods
-
<static> getLocalPlayer() → {Cocoon.Social.GameCenter.LocalPlayer}
-
Synchronous accessor for the current authResponse.
Returns:
Current Local Player data.
-
<static> getMultiplayerInterface() → {Cocoon.Multiplayer.MultiplayerService}
-
Returns a Cocoon Multiplayer interface for the Game Center Service.
Returns:
- Type
- Cocoon.Multiplayer.MultiplayerService
-
<static> getSocialInterface() → {Cocoon.Social.Interface}
-
Returns a Cocoon Social Interface for the Game Center Extension. You can use the Game Center extension in two ways, with 1:1 official API equivalent or with the Cocoon API abstraction.
Returns:
-
<static> loadAchievementDescriptions(callback)
-
Loads the application achievement descriptions.
Parameters:
Name Type Description callbackfunction The callback function. It receives the following parameters:
- Array of Cocoon.Social.GameCenter.Achievement.
- Error.
-
<static> loadAchievements(callback)
-
Loads the earned achievements for the current logged in user.
Parameters:
Name Type Description callbackfunction The callback function. It receives the following parameters:
- Array of Cocoon.Social.GameCenter.Achievement.
- Error.
-
<static> loadFriends(callback)
-
Loads the friends of the current logged in user.
Parameters:
Name Type Description callbackfunction The callback function. It receives the following parameters:
- Array of Cocoon.Social.GameCenter.Player.
- Error.
-
<static> loadPlayers(playerIDs, callback)
-
Loads the players of the provided identifiers.
Parameters:
Name Type Description playerIDsarray Array of player identifiers.
callbackfunction The callback function. It receives the following parameters:
- Array of Cocoon.Social.GameCenter.Player.
- Error.
-
<static> loadScores(callback, query)
-
Load the application achievement descriptions.
Parameters:
Name Type Argument Description callbackfunction The callback function. It receives the following parameters:
queryCocoon.Social.GameCenter.Leaderboard <optional>
Optional query parameters.
-
<static> login()
-
Authenticates the user.
-
<static> resetAchievements(callback)
-
Resets all the achievements of the current logged in user.
Parameters:
Name Type Argument Description callbackfunction <optional>
The callback function. Response params: error.
-
<static> showAchievements(callback)
-
Shows a native view with the standard user interface for achievements.
Parameters:
Name Type Description callbackfunction The callback function when the view is closed by the user. Response params: error
-
<static> showLeaderboards(callback, query)
-
Shows a native view with the standard user interface for leaderboards.
Parameters:
Name Type Argument Description callbackfunction The callback function when the view is closed by the user. Response params: error
queryCocoon.Social.GameCenter.Leaderboard <optional>
Optional parameters
-
<static> submitAchievements(achievements, callback)
-
Reports user earned achievements to the server.
Parameters:
Name Type Description achievementsarray Array of Cocoon.Social.GameCenter.Achievement objects.
callbackfunction The callback function. Response params: error.
-
<static> submitScore(score, callback)
-
Report user score to the server.
Parameters:
Name Type Description scoreCocoon.Social.GameCenter.Score Definition of the score and it's category (leaderboardID). If no category is specified the default one is used.
callbackfunction The callback function. Response params: error.
Members
-
<static> Achievement
-
The object that represents an earned achievement by the user.
Properties:
Name Type Description Cocoon.Social.GameCenter.Achievementobject The object itself
Properties
Name Type Description identifierstring The id of the achievement.
percentCompletenumber Percentage of achievement complete (from 0 to 100).
lastReportedDatenumber Date the achievement was last reported (unix time).
-
<static> AchievementDescription
-
The object that represents an earned achievement by the user.
Properties:
Name Type Description Cocoon.Social.GameCenter.AchievementDescriptionobject The object itself
Properties
Name Type Description identifierstring The identifier of the achievement.
titlestring The title of the achievement.
achievedDescriptionstring The description for an achieved achievement.
unachievedDescriptionstring The description for an unachieved achievement.
maximumPointsnumber The maximum points of the achievement.
-
<static> Leaderboard
-
The object that represents the set of high scores for the current game.
Properties:
Name Type Description Cocoon.Social.GameCenter.Leaderboardobject The object itself
Properties
Name Type Description categorystring The category of the leaderboard (query parameter).
playerIDsarray Player identifiers array (query parameter).
timeScopeCocoon.Social.GameCenter.TimeScope Time scope (query parameter).
playerScopeCocoon.Social.GameCenter.PlayerScope Player scope (query parameter).
rangeStartnumber Leaderboards start at index 1 and the length should be less than 100 (query parameter).
rangeLengthnumber Leaderboards start at index 1 and the length should be less than 100 (query parameter).
scoresarray Scores array (response parameter).
localPlayerScoreCocoon.Social.GameCenter.Score Local player score (response parameter).
localizedTitlestring Localized category title.
-
<static> LocalPlayer
-
The object that represents the information of a Game Center local player.
Properties:
Name Type Description Cocoon.Social.GameCenter.LocalPlayerobject The object itself
Properties
Name Type Description playerIDstring The identifier of the player.
aliasstring The alias of the player.
isAuthenticatedboolean Indicates the authentication state of the current player.
-
<static> Player
-
The object that represents the information of a Game Center player.
Properties:
Name Type Description Cocoon.Social.GameCenter.Playerobject The object itself
Properties
Name Type Description playerIDstring The identifier of the player.
aliasstring The alias of the player.
isFriendboolean True if the user is friend of the local player.
-
<static> PlayerScope
-
This object represents the possible Player Scopes for a leaderboad query.
Properties:
Name Type Description Cocoon.Social.GameCenter.PlayerScopeobject The object itself
Properties
Name Type Description GLOBALstring Global.
FRIENDSstring Friends.
-
<static> Score
-
The object that represents a score in the leaderboards.
Properties:
Name Type Description Cocoon.Social.GameCenter.Scoreobject The object itself
Properties
Name Type Description userIDstring The identifier of the player that recorded the score.
scorenumber The score value as a 64bit integer.
userNamestring The name of the user.
imageURLstring imageURL The url of the user image.
leaderboardIDstring Leaderboard category.
ranknumber The rank of the player within the leaderboard.
-
<static> TimeScope
-
This object represents the possible Time Scopes for a leaderboard query.
Properties:
Name Type Description Cocoon.Social.GameCenter.TimeScopeobject The object itself
Properties
Name Type Description TODAYstring Today.
WEEKstring A week.
ALL_TIMEstring All registered time.