我需要从Game Center检索经过身份验证的玩家提交的分数。我使用此代码获取分数,但它只获取最高分(排行榜上的最佳分数而不是指定玩家的分数)。如何检索已验证玩家的分数?
- (void) retrievePlayersScore {
GKLeaderboard *leaderboardRequest = [[GKLeaderboard alloc] init];
if (leaderboardRequest != nil) {
leaderboardRequest.playerScope = GKLeaderboardPlayerScopeGlobal;
leaderboardRequest.timeScope = GKLeaderboardTimeScopeAllTime;
leaderboardRequest.range = NSMakeRange(1,1);
[leaderboardRequest loadScoresWithCompletionHandler: ^(NSArray *scores, NSError *error) {
if (error != nil) {
// handle the error. if (scores != nil)
}
if (scores != nil){
// process the score information.
CCLOG(@"My Score: %d", ((GKScore*)[scores objectAtIndex:0]).value);
}
}];
}
}