iPhone游戏中心提交最高分?
我正在使用以下功能将分数提交到游戏中心。如何修改下面的代码,以便仅当分数高于已提交的分数时我才能发送分数?而且我不想在本地维护分数。有什么帮助吗?
- (void) reportScore: (int64_t) score forCategory: (NSString*) category
{
GKScore *scoreReporter = [[[GKScore alloc] initWithCategory:category] autorelease];
scoreReporter.value = score;
[scoreReporter reportScoreWithCompletionHandler: ^(NSError *error)
{
[self callDelegateOnMainThread: @selector(scoreReported:) withArg: NULL error: error];
}];
}
谢谢。
编辑:我刚刚发现它仅由游戏中心处理...只有最高分会显示在游戏中心应用程序上。
I am using below function to submit score to game center. How to modify below code so that I can send the score only if it is highest than already submitted score? And I dont want to maintain the scores locally. Any help?
- (void) reportScore: (int64_t) score forCategory: (NSString*) category
{
GKScore *scoreReporter = [[[GKScore alloc] initWithCategory:category] autorelease];
scoreReporter.value = score;
[scoreReporter reportScoreWithCompletionHandler: ^(NSError *error)
{
[self callDelegateOnMainThread: @selector(scoreReported:) withArg: NULL error: error];
}];
}
Thanks.
Edit : I just found that it is handled by the game center only... Only the top score will displayed on the gamecenter app.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用获取更多信息来检索之前的分数
Apple GameKit 编程指南
You can retrieve the previous score using
Get more information on Apple GameKit Programming Guide