Namespace: GameCenter

Cocoon.Social. GameCenter

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.

Type
Cocoon.Social.GameCenter.LocalPlayer

<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.

See:
Returns:
Type
Cocoon.Social.Interface

<static> loadAchievementDescriptions(callback)

Loads the application achievement descriptions.

Parameters:
Name Type Description
callback function

The callback function. It receives the following parameters:

<static> loadAchievements(callback)

Loads the earned achievements for the current logged in user.

Parameters:
Name Type Description
callback function

The callback function. It receives the following parameters:

<static> loadFriends(callback)

Loads the friends of the current logged in user.

Parameters:
Name Type Description
callback function

The callback function. It receives the following parameters:

<static> loadPlayers(playerIDs, callback)

Loads the players of the provided identifiers.

Parameters:
Name Type Description
playerIDs array

Array of player identifiers.

callback function

The callback function. It receives the following parameters:

<static> loadScores(callback, query)

Load the application achievement descriptions.

Parameters:
Name Type Argument Description
callback function

The callback function. It receives the following parameters:

query Cocoon.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
callback function <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
callback function

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
callback function

The callback function when the view is closed by the user. Response params: error

query Cocoon.Social.GameCenter.Leaderboard <optional>

Optional parameters

<static> submitAchievements(achievements, callback)

Reports user earned achievements to the server.

Parameters:
Name Type Description
achievements array

Array of Cocoon.Social.GameCenter.Achievement objects.

callback function

The callback function. Response params: error.

<static> submitScore(score, callback)

Report user score to the server.

Parameters:
Name Type Description
score Cocoon.Social.GameCenter.Score

Definition of the score and it's category (leaderboardID). If no category is specified the default one is used.

callback function

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.Achievement object

The object itself

Properties
Name Type Description
identifier string

The id of the achievement.

percentComplete number

Percentage of achievement complete (from 0 to 100).

lastReportedDate number

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.AchievementDescription object

The object itself

Properties
Name Type Description
identifier string

The identifier of the achievement.

title string

The title of the achievement.

achievedDescription string

The description for an achieved achievement.

unachievedDescription string

The description for an unachieved achievement.

maximumPoints number

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.Leaderboard object

The object itself

Properties
Name Type Description
category string

The category of the leaderboard (query parameter).

playerIDs array

Player identifiers array (query parameter).

timeScope Cocoon.Social.GameCenter.TimeScope

Time scope (query parameter).

playerScope Cocoon.Social.GameCenter.PlayerScope

Player scope (query parameter).

rangeStart number

Leaderboards start at index 1 and the length should be less than 100 (query parameter).

rangeLength number

Leaderboards start at index 1 and the length should be less than 100 (query parameter).

scores array

Scores array (response parameter).

localPlayerScore Cocoon.Social.GameCenter.Score

Local player score (response parameter).

localizedTitle string

Localized category title.

<static> LocalPlayer

The object that represents the information of a Game Center local player.

Properties:
Name Type Description
Cocoon.Social.GameCenter.LocalPlayer object

The object itself

Properties
Name Type Description
playerID string

The identifier of the player.

alias string

The alias of the player.

isAuthenticated boolean

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.Player object

The object itself

Properties
Name Type Description
playerID string

The identifier of the player.

alias string

The alias of the player.

isFriend boolean

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.PlayerScope object

The object itself

Properties
Name Type Description
GLOBAL string

Global.

FRIENDS string

Friends.

<static> Score

The object that represents a score in the leaderboards.

Properties:
Name Type Description
Cocoon.Social.GameCenter.Score object

The object itself

Properties
Name Type Description
userID string

The identifier of the player that recorded the score.

score number

The score value as a 64bit integer.

userName string

The name of the user.

imageURL string

imageURL The url of the user image.

leaderboardID string

Leaderboard category.

rank number

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.TimeScope object

The object itself

Properties
Name Type Description
TODAY string

Today.

WEEK string

A week.

ALL_TIME string

All registered time.

Atomic Plugins - JavaScript Documentation by Ludei, DocStrap Copyright © 2012-2013
The contributors to the JSDoc3 and DocStrap projects.