保存游戏进度的最佳位置在哪里?

发布于 2024-12-07 01:48:07 字数 130 浏览 1 评论 0原文

我正在开发一个问答游戏,我想保存进度...实际上我使用共享设置,既简单又快速,但是用户可以删除程序文件并丢失进度。数据库也会发生同样的情况。我应该使用文件吗?我唯一感兴趣的是为每个问题保存一个布尔值:“是否正确回答?”

谢谢你!!

I'm developing a quiz game and I want to save the progress... Actually I use sharedsettings, is easy and fast, but the user can delete program files and lose the progress. Same happens with a database. I should use a file? I'm only interesting to save a boolean for each question: "correct answered or not?"

Thank you!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

月亮邮递员 2024-12-14 01:48:07

共享设置。而且你已经在使用它了。将用户从他/她自己手中拯救出来是非常困难的。如果它在设备上,那么它可能会被愚蠢或恶意地破坏。并且不要忘记,一切都是文件,并且您可以在设备上放置任何东西来防止黑客/白痴的攻击。

解决这个问题的唯一方法是通过 Web 服务(和支持数据库)之类的方式将用户设置存储在设备之外。但我想说,如果您使用 SharedSettings...则没问题。就这样吧。如果您预计跟踪的问题数量会增长到非常大并且希望对数据有更多控制,我只会考虑使用特定于应用程序的数据库。

SharedSettings. And you're already using it. It's very difficult to save a user from his/herself. If it's on the device then it can be destroyed either stupidly or maliciously. And don't forget that everything is a file and there's nothing you can put on the device that will be hack/idiot proof.

The only way to get around this would be to store user settings off the device via something like a web service (and backing database.) But I would say that if you're using SharedSettings... you're OK. Leave it at that. I would only consider using an app-specific db if you expect the number of question you track to grow to a very large size and want more control over the data.

2024-12-14 01:48:07

代码逻辑在哪里?

一般来说,最好在 onPause 时保存所有 UI 首选项。 Android 设计希望你永远不要有“保存”按钮,而是不断保存。

就每个问题而言,我猜你回答每个问题后都会保存?

Where in code logic?

In general, it's best to save any UI preferences at onPause. Android design wants you to never have a "save" button, rather save constantly.

As far as at each question, i guess you would save after answering each question?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文