开发者

iOS GameKit Leaderboard - Get the localplayer's score +/- 50 players around him

开发者 https://www.devze.com 2023-03-08 08:25 出处:网络
I\'m programmatically pulling down leaderboard data from g开发者_JS百科ame center and I\'d like to limit my data query to the local player\'s score and the 25 scores above and below him.Is this possib

I'm programmatically pulling down leaderboard data from g开发者_JS百科ame center and I'd like to limit my data query to the local player's score and the 25 scores above and below him. Is this possible. Is there a way to get the local player's current position in the leaderboard?


Once you make a call to [GKLeaderboard loadScoresWithCompletionHandler:] you can use [[GKLeaderboard localPlayerScore] rank] to get the rank of the current user.

So the next time you call loadScoresWithCompletionHandler, set the range around that value like leaderboardRequest.range=NSMakeRange(localPlayerRank-25, 50)

Also make sure you're not querying for a rank less than one!

0

精彩评论

暂无评论...
验证码 换一张
取 消