Game Development Reference
In-Depth Information
The score value is of type int64_t , which is the same as long long . That's right,
long long . The long data type is a 32-bit integer value whereas long long
means it's a 64-bit integer value, so it can store an incredibly large number—one with
19 digits. That allows for more than 4 billion times greater values than a regular 32-bit
integer can represent!
A temporary GKScore object is created and initialized with a leaderboard category
identifier, which you define in iTunes Connect. In this case, the category ID is Play-
time . The GKScore object also gets the score assigned, and then its reportS-
coreWithCompletionHandler method is called, which will transmit the score to
the Game Center server and to the correct leaderboard.
The delegate receives the onScoresSubmitted message and subsequently calls the
retrieveTopTenAllTimeGlobalScores method to get the top ten scores:
-(void) onScoresSubmitted:(bool)success
{
if (success)
{
GameKitHelper* gkHelper = [GameKitHelper sharedGameKitHelper];
[gkHelper retrieveTopTenAllTimeGlobalScores];
}
}
The GameKitHelper class's retrieveTopTenAllTimeGlobalScores
simply wraps the call to retrieveScoresForPlayers and feeds it with precon-
figured parameters:
-(void) retrieveTopTenAllTimeGlobalScores
{
[self retrieveScoresForPlayers:nil
category:nil
range:NSMakeRange(1, 10)
playerScope:GKLeaderboardPlayerScopeGlobal
timeScope:GKLeaderboardTimeScopeAllTime];
}
Search Nedrilad ::




Custom Search