OpenFeint成就表现
我决定将 OpenFeint 集成到我的新游戏中以获得成就和排行榜。
游戏是动态的,我希望用户能够立即因为一些成功的结果而获得奖励,但在我看来,OpenFeint 的成就有点迟缓,只有在收到服务器的确认时才会显示视觉通知。
如果成就尚未解锁,是否可以更改设置中的某些内容或稍微修改一下,以便在仅检查本地数据库时立即显示通知?
I've decided to integrate OpenFeint into my new game to have achievements and leaderboards.
The game is dynamic and I would like user to be rewarded immediately for some successful results, but as it seems for me, OpenFeint's achievements are a bit sluggish and it shows visual notification only when it receives confirmation from the server.
Is it possible to change something in settings or hack it a little bit to show notification immediately as soon as it checks only local database if the achievement has not been unlocked it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以采取多种措施来更严格地控制这些通知的时间。我将解释一种方法,您可以以此为起点自行进一步探索。这些建议特别适用于 iOS 应用程序。需要注意的是,这些建议涉及 iOS 版 OFSDK 2.8 中的内部 API,通常不建议用于高级使用,并且可能会在未来版本中发生更改。
我建议的第一件事是您使用自己的产品密钥构建示例应用程序。在将结果应用到您自己的代码之前,请使用标准示例应用程序进行试验。
通过将通知弹出 UI 与提交成就的过程分开,您将获得最快速的响应。这样,您就不必担心陷入决定提交是仅发送到本地数据库还是对异步网络事务进行完整确认的逻辑中。
请参阅“OFNotification.h”中“showAchievementNotice”的声明。在示例应用程序中执行搜索,您将看到这是用于在获得成就时显示成就弹出窗口的内部 API。它实际上并不提交成就。您可以直接调用此方法,因为它是从“OFAchievementService.mm”调用的,以直接控制消息何时出现。然后,您可以使用以下文章来禁用在实际提交发生时调用弹出窗口:
这使您可以完全自由地在以后调用提交,前提是您跟踪需要这样做。例如,您可以在关卡完成后或下次应用程序启动时在本地序列化一个标志来处理实际提交。不要忘记,用户可能会在没有干净地完成关卡的情况下退出游戏。
There are several things you can do to more tightly control the timing of these notifications. I'll explain one approach and you can use this as a starting point to explore further on your own. These suggestions apply specifically to iOS apps. One caveat is that these suggestions refer to internal APIs in OFSDK 2.8 for iOS and not ordinarily recommended for high level use and subject to change in future versions.
The first thing I recommend is that you build the sample app with your own product key. Use the standard sample app to experiment before applying the result to your own code.
You are going to get the snappiest response by separating the notification pop-up UI from the process of submitting the achievement. This way you don't have to worry about getting wrapped up in the logic for deciding whether the submission is going just to the local db or is doing the full confirmation on an async network transaction.
See the declaration of "showAchievementNotice" in "OFNotification.h". Performing a search in the sample app, you will see that this is the internal API used for displaying the achievement pop-up when an achievement is earned. It does not actually submit the achievement. You can call this method directly as it is called from "OFAchievementService.mm" to directly control when the message appears. You can then use the following article to disable the pop-up from being called when the actual submission occurs:
This gives you complete freedom to call the submission at a later time provided you keep track of the need to do so. For example, you could locally serialize a flag to take care of the actual submission either after the level is done or the next time the app starts up. Don't forget that the user could quit out of a game without cleanly finishing a level.
不确定这是否与 Android 版本的 SDK 有关(看起来更慢),但我们不知道如何让它更快。它的速度慢得令人无法接受,因此我们开始开发自己的框架来修复 open feint 的大部分缺点以及其他一些缺点。查看 Swarm,它可能更适合您的需求。
Not sure if this relates to the Android version of the SDK (which seems even slower), but we couldn't figure out how to make it faster. It was so unacceptably slow that we started developing our own framework that fixes most of open feint's shortcomings and then some. Check out Swarm, it might fit your needs better.