在“GKAchievementHandler”类中找到“notifyAchievement”,更新为: - (void)notifyAchievement:(GKAchievementDescription *)achievement { GKAchievementNotification *notification = [[GKAchievementNotification alloc] initWithAchievementDescription:achievement]; notification.frame = kGKAchievementFrameStart; notification.handlerDelegate = self; //Adjusting rotation. if ([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationLandscapeLeft) { notification.transform = CGAffineTransformRotate(notification.transform, degreesToRadian(-90)); } else { notification.transform = CGAffineTransformRotate(notification.transform, degreesToRadian(90)); } [_queue addObject:notification]; if ([_queue count] == 1) { [self displayNotification:notification]; } }截图如下:
OpenFeint 是很多iPhone游戏开发者都要用到的社区功能; 一、openfeint中的LeaderBoards 和Achievement的一点体会 2.数据提交的方法 [OFAchievementService unlockAchievement: @"成就ID" onSuccess: OFDelegate() onFailure: OFDelegate()];//解锁成就,如果函数无效,请引入#import “OFAchievementService.h” 3.网络对分数提交的影响 网络不通的情况下,就会出现一点问题: 问题来鸟,在没有网络的情况下,取得了一个分数,然后第一次调用分数提交函数,会提示你得 到了一个高分,存储在本地(我感觉就在本地隐藏信息表中), 问题出现了!当你这时连接网络,分数并不会自动提交,而你自己手动提交(比如点击一个按钮,按钮的功能是提交最高分数)也没有任何的效果。 Q:if a user says no to using openfeint the first time,is there a way that user can change his or her mind to allow openfeint in the future? 也就是说,提交失败,于是我做了个试验,在有网络的情况下,提交一个分数100,只显示 一次,第二次提交100时,没有提示。然后提交101,有提示,第二次提交101,没有提示。说明了本地隐藏信息表中还存储了一个最高分数的提交次数和提交许可,使用一次提交分数的函数,这些内 容就会改变,只有新提交的分数比原来存储的分数大时,本地隐藏信息 表才会允许你向openfeint正式提交,否则,无效,感觉上和retain与release有点像。也就时说,最高的分数在提交的时 候,没有网络,就等于失败,这里应该算是openfeint的一个小bug吧。也是我遇到问题的所在,没找到什么解决办法,大伙有经验的可以提出来。 用 个简单的图来形容下吧。 顺 便说下成就的提交,没有网络,不可解锁成就,也没有存在本地的提示,联网后,同样也不自动解锁,只有再一次达到条件(方才例子中的if成立)时,才会再次 解锁。 以上,是我的部分openfeint基础使用的经验,也许是我的方法不正确,也许有别的解决办法,我能提供给大家的帮助, 先这么多了。 (责任编辑:admin) |