GPGLeaderboard Class Reference

GPGLeaderboard Class Reference

Overview

A single leaderboard.

Leaderboard objects must be created with a leaderboard ID. Once a leaderboard object is created, you may interact with it using the provided set of actions.

Public Member Functions

Actions
(void) - loadScoresWithCompletionHandler:
 Loads the scores for this leaderboard with the configured filters.
(void) - loadScoresFromDataSource:completionHandler:
 Loads the scores for this leaderboard with the configured filters.
(void) - loadNextPageOfScoresWithCompletionHandler:
 Loads the next page of scores if there are any.
(void) - loadPreviousPageOfScoresWithCompletionHandler:
 Loads the previous page of scores if there are any.
(void) - resetScoreWithCompletionHandler:
 Resets the scores in the current leaderboard.

Properties

Constant Properties
NSString * leaderboardId
 The unique identifier for this leaderboard object.
Configurable Properties
BOOL personalWindow
 Whether this leaderboard fetches scores surrounding the current player or the top players.
GPGLeaderboardTimeScope timeScope
 The time scope for which to fetch the scores for this leaderboard.
BOOL social
 Whether or not this leaderboard should fetch social scores.
In-Flight Status
BOOL loading
BOOL loadingPreviousPage
BOOL loadingNextPage
Post-Load Results
NSArray * scores
 The loaded scores for this leaderboard.
GPGLocalPlayerScorelocalPlayerScore
 The local player's best score for the given time span.
NSString * name
 The leaderboard's name.
BOOL hasPreviousPage
 Whether or not the leaderboard has a previous page.
BOOL hasNextPage
 Whether or not the leaderboard has a next page.

Initialization

(instancetype) - initWithLeaderboardId:
 Initializes a newly allocated leaderboard object with the given leaderboard identifier.
(instancetype) + leaderboardWithId:
 Convenience method for initWithLeaderboardId:.

Member Function Documentation

- (instancetype) initWithLeaderboardId: (NSString *)  leaderboardId

Initializes a newly allocated leaderboard object with the given leaderboard identifier.

This is the designated initializer.

Returns:
The GPGLeaderboard object initialized with the given leaderboard identifier. Designated initializer.
+ (instancetype) leaderboardWithId: (NSString *)  leaderboardId

Convenience method for initWithLeaderboardId:.

Returns:
A newly allocated and initialized GPGLeaderboard object.
- (void) loadScoresWithCompletionHandler: (GPGLeaderboardLoadScoresBlock)  completionHandler

Loads the scores for this leaderboard with the configured filters.

If the new request is successful, replaces the old scores property with the newly fetched values.

Parameters:
completionHandler(optional) A block of the form: ^(NSArray *scores, NSError *error).
- (void) loadScoresFromDataSource: (GPGDataSource)  dataSource
completionHandler: (GPGLeaderboardLoadScoresBlock)  completionHandler 

Loads the scores for this leaderboard with the configured filters.

Cancels any other requests and removes all scores from the scores property before starting the new request.

Parameters:
dataSourceThe data source from where to load.
completionHandler(optional) A block of the form: ^(NSArray *scores, NSError *error).
- (void) loadNextPageOfScoresWithCompletionHandler: (GPGLeaderboardLoadScoresBlock)  completionHandler

Loads the next page of scores if there are any.

Calls the completionHandler with nil data and nil error if there are no more pages to load.

Only works for public leaderboards (i.e. isSocial == NO).

Parameters:
completionHandler(optional) A block of the form: ^(NSArray *scores, NSError *error).
- (void) loadPreviousPageOfScoresWithCompletionHandler: (GPGLeaderboardLoadScoresBlock)  completionHandler

Loads the previous page of scores if there are any.

Calls the completionHandler with an error if there are no more pages to load.

Only works for public leaderboards (i.e. isSocial == NO).

Parameters:
completionHandler(optional) A block of the form: ^(NSArray *scores, NSError *error).
- (void) resetScoreWithCompletionHandler: (GPGScoreResetBlock)  completionHandler

Resets the scores in the current leaderboard.

After the scores are reset, the completion handler is called.

This can only be called if the calling player is a trusted tester of the game.

Parameters:
completionHandler(optional) A block of the form: ^(NSError *error).

Property Documentation

- (NSString*) leaderboardId [read, copy]

The unique identifier for this leaderboard object.

- (BOOL) personalWindow [read, write, assign]

Whether this leaderboard fetches scores surrounding the current player or the top players.

Default value: NO default: NO. NO means the window is focused around top players.

- (GPGLeaderboardTimeScope) timeScope [read, write, assign]

The time scope for which to fetch the scores for this leaderboard.

Default value: GPGLeaderboardTimeScopeAllTime default: GPGLeaderboardTimeScopeAllTime

- (BOOL) social [read, write, assign]

Whether or not this leaderboard should fetch social scores.

A social leaderboard is a public leaderboard filtered by people within the local player's circles.

A non-social leaderboard is simply the public leaderboard.

Default value: NO default: NO. NO means load the public leaderboard.

- (BOOL) loading [read, assign]
Returns:
YES if the leaderboard is currently loading any scores.
- (BOOL) loadingPreviousPage [read, assign]
Returns:
YES if the leaderboard is currently loading the previous page of scores.
- (BOOL) loadingNextPage [read, assign]
Returns:
YES if the leaderboard is currently loading the next page of scores.
- (NSArray*) scores [read, copy]

The loaded scores for this leaderboard.

These scores will be sorted based on the order setting for the leaderboard. [GPGScore,...]

The local player's best score for the given time span.

- (NSString*) name [read, copy]

The leaderboard's name.

- (BOOL) hasPreviousPage [read, assign]

Whether or not the leaderboard has a previous page.

- (BOOL) hasNextPage [read, assign]

Whether or not the leaderboard has a next page.

Оставить отзыв о...

Текущей странице
Play Games Services for iOS
Play Games Services for iOS