Show / Hide Table of Contents

Class AN_LeaderboardsClient

A client to interact with leaderboards functionality. https://developers.google.com/android/reference/com/google/android/gms/games/LeaderboardsClient

Inheritance
System.Object
AN_LeaderboardsClient
Namespace: SA.Android.GMS.Games
Assembly: cs.temp.dll.dll
Syntax
public class AN_LeaderboardsClient : AN_LinkedObject

Methods

GetAllLeaderboardsIntent(Action<AN_IntentResult>)

Asynchronously loads an Intent to show the list of leaderboards for a game. Note that this must be invoked with so that the identity of the calling package can be established.

Required Scopes: SCOPE_GAMES_LITE

Declaration
public void GetAllLeaderboardsIntent(Action<AN_IntentResult> callback)
Parameters
Type Name Description
Action<AN_IntentResult> callback

Task completion callback.

GetLeaderboardIntent(String, Action<AN_IntentResult>)

Asynchronously loads an Intent to show a leaderboard for a game specified by a leaderboardId. Note that the Intent returned from the Task must be invoked with , so that the identity of the calling package can be established.

Declaration
public void GetLeaderboardIntent(string leaderboardId, Action<AN_IntentResult> callback)
Parameters
Type Name Description
System.String leaderboardId

The ID of the leaderboard to view.

Action<AN_IntentResult> callback

Request async callback

GetLeaderboardIntent(String, AN_Leaderboard.TimeSpan, Action<AN_IntentResult>)

Asynchronously loads an Intent to show a leaderboard for a game specified by a leaderboardId. Note that the Intent returned from the Task must be invoked with , so that the identity of the calling package can be established.

Declaration
public void GetLeaderboardIntent(string leaderboardId, AN_Leaderboard.TimeSpan span, Action<AN_IntentResult> callback)
Parameters
Type Name Description
System.String leaderboardId

The ID of the leaderboard to view.

AN_Leaderboard.TimeSpan span

Time span to retrieve data for.

Action<AN_IntentResult> callback

Request async callback

GetLeaderboardIntent(String, AN_Leaderboard.TimeSpan, AN_Leaderboard.Collection, Action<AN_IntentResult>)

Asynchronously loads an Intent to show a leaderboard for a game specified by a leaderboardId. Note that the Intent returned from the Task must be invoked with , so that the identity of the calling package can be established.

Declaration
public void GetLeaderboardIntent(string leaderboardId, AN_Leaderboard.TimeSpan span, AN_Leaderboard.Collection leaderboardCollection, Action<AN_IntentResult> callback)
Parameters
Type Name Description
System.String leaderboardId

The ID of the leaderboard to view.

AN_Leaderboard.TimeSpan span

Time span to retrieve data for.

AN_Leaderboard.Collection leaderboardCollection

The collection to show by default.

Action<AN_IntentResult> callback

Request async callback

LoadCurrentPlayerLeaderboardScore(String, Action<AN_LinkedObjectResult<AN_LeaderboardScore>>)

Declaration
public void LoadCurrentPlayerLeaderboardScore(string leaderboardId, Action<AN_LinkedObjectResult<AN_LeaderboardScore>> callback)
Parameters
Type Name Description
System.String leaderboardId
Action<AN_LinkedObjectResult<AN_LeaderboardScore>> callback

LoadCurrentPlayerLeaderboardScore(String, AN_Leaderboard.TimeSpan, AN_Leaderboard.Collection, Action<AN_LinkedObjectResult<AN_LeaderboardScore>>)

Asynchronously loads AN_LeaderboardScore result that represents the signed-in player's score for the leaderboard specified by leaderboardId.

Declaration
public void LoadCurrentPlayerLeaderboardScore(string leaderboardId, AN_Leaderboard.TimeSpan span, AN_Leaderboard.Collection leaderboardCollection, Action<AN_LinkedObjectResult<AN_LeaderboardScore>> callback)
Parameters
Type Name Description
System.String leaderboardId

The ID of the leaderboard to view.

AN_Leaderboard.TimeSpan span

Time span to retrieve data for.

AN_Leaderboard.Collection leaderboardCollection

The collection to show by default.

Action<AN_LinkedObjectResult<AN_LeaderboardScore>> callback

Request async callback

LoadLeaderboardMetadata(Boolean, Action<AN_LeaderboardsLoadResult>)

Asynchronously loads AN_LeaderboardsLoadResult that represents a list of leaderboards metadata for this game.

Declaration
public void LoadLeaderboardMetadata(bool forceReload, Action<AN_LeaderboardsLoadResult> callback)
Parameters
Type Name Description
System.Boolean forceReload

If true, this call will clear any locally cached data and attempt to fetch the latest data from the server. This would commonly be used for something like a user-initiated refresh. Normally, this should be set to false to gain advantages of data caching.

Action<AN_LeaderboardsLoadResult> callback

Request async callback

LoadLeaderboardMetadata(String, Boolean, Action<AN_LeaderboardLoadResult>)

Asynchronously loads an AN_LeaderboardLoadResult specified by .

Declaration
public void LoadLeaderboardMetadata(string leaderboardId, bool forceReload, Action<AN_LeaderboardLoadResult> callback)
Parameters
Type Name Description
System.String leaderboardId

ID of the leaderboard to load metadata for.

System.Boolean forceReload

If true, this call will clear any locally cached data and attempt to fetch the latest data from the server. This would commonly be used for something like a user-initiated refresh. Normally, this should be set to false to gain advantages of data caching.

Action<AN_LeaderboardLoadResult> callback

Request async callback

LoadMoreScores(AN_LeaderboardScoreBuffer, Int32, AN_PageDirection, Action<AN_LinkedObjectResult<AN_LeaderboardScores>>)

Asynchronously loads an AN_LeaderboardScores that represents an additional page of score data for the given score buffer. A new score buffer will be delivered that replaces the given buffer.

Declaration
public void LoadMoreScores(AN_LeaderboardScoreBuffer buffer, int maxResults, AN_PageDirection pageDirection, Action<AN_LinkedObjectResult<AN_LeaderboardScores>> callback)
Parameters
Type Name Description
AN_LeaderboardScoreBuffer buffer

The existing buffer that will be expanded. The buffer is allowed to be closed prior to being passed in to this method.

System.Int32 maxResults

The maximum number of scores to fetch per page. Must be between 1 and 25. Note that the number of scores returned here may be greater than this value, depending on how much data is cached on the device.

AN_PageDirection pageDirection

The direction to expand the buffer.

Action<AN_LinkedObjectResult<AN_LeaderboardScores>> callback

Request async callback

LoadPlayerCenteredScores(String, AN_Leaderboard.TimeSpan, AN_Leaderboard.Collection, Int32, Boolean, Action<AN_LinkedObjectResult<AN_LeaderboardScores>>)

Asynchronously loads an AN_LeaderboardScores that represents the player-centered page of scores for the leaderboard specified by specified by . If the player does not have a score on this leaderboard, this call will return the top page instead.

Declaration
public void LoadPlayerCenteredScores(string leaderboardId, AN_Leaderboard.TimeSpan span, AN_Leaderboard.Collection leaderboardCollection, int maxResults, bool forceReload, Action<AN_LinkedObjectResult<AN_LeaderboardScores>> callback)
Parameters
Type Name Description
System.String leaderboardId

ID of the leaderboard.

AN_Leaderboard.TimeSpan span

Time span to retrieve data for.

AN_Leaderboard.Collection leaderboardCollection

The leaderboard collection to retrieve scores for.

System.Int32 maxResults

The maximum number of scores to fetch per page. Must be between 1 and 25.

System.Boolean forceReload

If true, this call will clear any locally cached data and attempt to fetch the latest data from the server. This would commonly be used for something like a user-initiated refresh. Normally, this should be set to false to gain advantages of data caching.

Action<AN_LinkedObjectResult<AN_LeaderboardScores>> callback

Request async callback

LoadPlayerCenteredScores(String, Int32, Action<AN_LinkedObjectResult<AN_LeaderboardScores>>)

Declaration
public void LoadPlayerCenteredScores(string leaderboardId, int maxResults, Action<AN_LinkedObjectResult<AN_LeaderboardScores>> callback)
Parameters
Type Name Description
System.String leaderboardId
System.Int32 maxResults
Action<AN_LinkedObjectResult<AN_LeaderboardScores>> callback

LoadTopScores(String, AN_Leaderboard.TimeSpan, AN_Leaderboard.Collection, Int32, Boolean, Action<AN_LinkedObjectResult<AN_LeaderboardScores>>)

Asynchronously loads an AN_LeaderboardScores that represents represents the top page of scores for a given leaderboard specified by specified by . If the player does not have a score on this leaderboard, this call will return the top page instead.

Declaration
public void LoadTopScores(string leaderboardId, AN_Leaderboard.TimeSpan span, AN_Leaderboard.Collection leaderboardCollection, int maxResults, bool forceReload, Action<AN_LinkedObjectResult<AN_LeaderboardScores>> callback)
Parameters
Type Name Description
System.String leaderboardId

ID of the leaderboard.

AN_Leaderboard.TimeSpan span

Time span to retrieve data for.

AN_Leaderboard.Collection leaderboardCollection

The leaderboard collection to retrieve scores for.

System.Int32 maxResults

The maximum number of scores to fetch per page. Must be between 1 and 25.

System.Boolean forceReload

If true, this call will clear any locally cached data and attempt to fetch the latest data from the server. This would commonly be used for something like a user-initiated refresh. Normally, this should be set to false to gain advantages of data caching.

Action<AN_LinkedObjectResult<AN_LeaderboardScores>> callback

Request async callback

LoadTopScores(String, Int32, Action<AN_LinkedObjectResult<AN_LeaderboardScores>>)

Declaration
public void LoadTopScores(string leaderboardId, int maxResults, Action<AN_LinkedObjectResult<AN_LeaderboardScores>> callback)
Parameters
Type Name Description
System.String leaderboardId
System.Int32 maxResults
Action<AN_LinkedObjectResult<AN_LeaderboardScores>> callback

SubmitScore(String, Int64, String)

Submit a score to a leaderboard for the currently signed-in player. The score is ignored if it is worse (as defined by the leaderboard configuration) than a previously submitted score for the same player.

This form of the API is a fire-and-forget form. Use this if you do not need to be notified of the results of submitting the score, though note that the update may not be sent to the server until the next sync.

The meaning of the score value depends on the formatting of the leaderboard established in the developer console. Leaderboards support the following score formats: Fixed-point: score represents a raw value, and will be formatted based on the number of decimal places configured. A score of 1000 would be formatted as 1000, 100.0, or 10.00 for 0, 1, or 2 decimal places.

Time: score represents an elapsed time in milliseconds. The value will be formatted as an appropriate time value.

Currency: score represents a value in micro units. For example, in USD, a score of 100 would display as $0.0001, while a score of 1000000 would display as $1.00

Declaration
public void SubmitScore(string leaderboardId, long score, string scoreTag = "")
Parameters
Type Name Description
System.String leaderboardId

The leaderboard to submit the score to.

System.Int64 score

The raw score value.

System.String scoreTag

Optional metadata about this score. The value may contain no more than 64 URI-safe characters as defined by section 2.3 of RFC 3986.

SubmitScoreImmediate(String, Int64, String, Action<AN_LinkedObjectResult<AN_ScoreSubmissionData>>)

Asynchronously submits the score to the leaderboard for the currently signed-in player. The score is ignored if it is worse(as defined by the leaderboard configuration) than a previously submitted score or the same player.

This form of the API will attempt to submit the score to the server immediately within the callback, returning a AN_ScoreSubmissionData on success with information about the submission.

The meaning of the score value depends on the formatting of the leaderboard established in the developer console. Leaderboards support the following score formats: Fixed-point: score represents a raw value, and will be formatted based on the number of decimal places configured. A score of 1000 would be formatted as 1000, 100.0, or 10.00 for 0, 1, or 2 decimal places.

Time: score represents an elapsed time in milliseconds. The value will be formatted as an appropriate time value.

Currency: score represents a value in micro units. For example, in USD, a score of 100 would display as $0.0001, while a score of 1000000 would display as $1.00

Declaration
public void SubmitScoreImmediate(string leaderboardId, long score, string scoreTag, Action<AN_LinkedObjectResult<AN_ScoreSubmissionData>> callback)
Parameters
Type Name Description
System.String leaderboardId

The leaderboard to submit the score to.

System.Int64 score

The raw score value.

System.String scoreTag

Optional metadata about this score. The value may contain no more than 64 URI-safe characters as defined by section 2.3 of RFC 3986.

Action<AN_LinkedObjectResult<AN_ScoreSubmissionData>> callback

Request async callback

In This Article
Back to top Generated by DocFX