cgisca / PGSGP

Play Games Services plugin for Godot Game Engine - Android
MIT License
217 stars 61 forks source link

Add possibility to set absolute achievement progress #29

Closed RandomShaper closed 4 years ago

RandomShaper commented 4 years ago

This is useful to avoid having to track the current value. It also makes easier having a common API in your game that wraps both this and the iOS Game Center integration, which doesn't have an increment method.

I take the opportunity to thank you for this project! It's excellent, very well done and has saved me a lot of time.

cgisca commented 4 years ago

Hi @RandomShaper , for what is the step used for? is it similar to increment?

RandomShaper commented 4 years ago

It's similar, but has an important difference: instead of adding some value to the current count, this one sets the final value regardless the current one. It's closer to what you achieve in iOS' Game Center with this: https://docs.godotengine.org/en/stable/tutorials/platform/services_for_ios.html#award-achievement

RandomShaper commented 4 years ago

From https://developers.google.com/android/reference/com/google/android/gms/games/AchievementsClient#public-abstract-void-setsteps-string-id,-int-numsteps:

Sets an achievement to have at least the given number of steps completed. Calling this method while the achievement already has more steps than the provided value is a no-op. Once the achievement reaches the maximum number of steps, the achievement will automatically be unlocked, and any further mutation operations will be ignored.

cgisca commented 4 years ago

Sounds good to me. Merged