我应该如何应对增加的新成就 [英] How should I deal with adding new incremental achievements

查看:68
本文介绍了我应该如何应对增加的新成就的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在对Google Play游戏服务中的成就如何运作越来越熟悉.这是一个通用示例,我试图弄清楚该如何处理.

I am just now becoming more familiar with how achievements in Google Play Games Services work. Here's a generic example that I'm trying to figure out how I will deal with.

我有以下成就: 杀死5个僵尸,杀死15个僵尸,25、50等.

I have these achievements: Kill 5 Zombies, Kill 15 Zombies, 25, 50, etc.

现在,我计划在杀死僵尸时增加每个成就.因此,杀死1个僵尸,所有4个成就都会增加1.

Right now, I plan to increment each achievement when a zombie is killed. So kill 1 zombie and all 4 achievements are incremented by 1.

我的问题是,当我添加另一个成就(例如杀死100个僵尸)时,其增量计数器将从0开始.假设我杀死了49个僵尸,那么杀死50个僵尸"的计数器将为49 .如何在保持计数器不变的情况下增加更多成就?

My question is, when I add another achievement (kill 100 zombies, for example) its incremental counter will start at 0. Let's say I've killed 49 zombies, so the counter for "Kill 50 zombies" would be at 49. How will I be able to add more achievements while still keeping the counter?

这是否正常是同时增加多个成就?其他游戏会这样做吗?当我添加新成就时,我将如何克服这个问题?我想尽量避免在本地保存,以便对如何充分利用API提出任何建议.

Is this normal to be incrementing multiple achievements at the same time? Do other games do this? How will I overcome this when I add new achievements? I want to try to avoid saving locally so any suggestions on how to fully utilize the API would be appreciated.

我担心本地保存的原因之一是,如果这样做,一个人可以登录,获取他们的成就,然后注销,然后另一个人登录并获得相同的成就.

One of the reasons I'm worried about saving locally is that if I do that, one person can login, get their achievement, then logout and then another person logs in and gets the same achievement unlocked.

推荐答案

好的,这是我的解决方案以及所做的工作.据我所知,这是最好的选择,但我可能是错的.

OK, here's my solution and what I did. As far as I'm aware, this is the best option, but I could be wrong.

我进行了一次杀死僵尸"活动,并将该活动与其他成就联系在一起.每当触发杀死僵尸"事件时,它将增加所有杀死X僵尸"成就.但是,如果我要在开发中添加另一个成就,它将在0处启动其中一个成就.每当用户登录时,我都会调用这两个加载方法,因为这样做实际上没有意义.

I made a "kill zombie" event and linked that event with different achievements. Whenever the "kill zombie" event was fired, it would increment all the "kill X zombies" achievements. However, if I would add another achievement mid-development, it would start one of those achievements at 0. I called these two load methods whenever the user logged in as there's really no point in doing this mid-game.

我通过首先用AchievementsClient#load加载成就,然后添加了一个成功监听器,然后将其称为EventsClient#load,来解决此问题.如果与杀死僵尸有关的任何成就都低于该事件的计数器,它将增加该事件,以便与事件计数器保持最新.

I fixed this by first loading the achievements with AchievementsClient#load then added an on success listener that then called EventsClient#load. If any achievement related to killing zombies was below the counter on said event, it would increment it to get up to date with the event counter.

这是一个不错的选择,因为它可以跨设备使用,并确保每个成就都是最新的.

This is a good option because it works across devices and makes sure that each achievement is up to date.

这篇关于我应该如何应对增加的新成就的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆