android - 如何将 XP 积分添加到 Google Play 游戏?
问题描述
我添加了两个成就用于测试。我有一个名为longScore1的Long变量。我可以保存分数,但是用户没有获得XP。我的目标是给用户XP。这是我的代码;
GamesClient gamesClient = Games.getGamesClient(MainActivity.this, GoogleSignIn.getLastSignedInAccount(this));
gamesClient.setViewForPopups(findViewById(R.id.container_pop_up));
Games.getAchievementsClient(this, GoogleSignIn.getLastSignedInAccount(this))
.unlock(getString(R.string.achievement_paaaa));
longScore1+=80;
解决方案
XP 点数作为“成就”处理,并且成就必须注册到 google play 控制台。
https://developers.google.com/games/services/common/concepts/achievements#creating_an_achievement
请参考此 API 文档
推荐阅读
- javascript - 使 chrome 扩展能够查询浏览器页面的窗口
- macos - Spotlight 货币转换器未更新
- dafny - 断言和集合基数
- html - HTML5画布可动线
- swift - CGContext.draw(), CGContext.makeImage() 给我双倍的预期分辨率
- android-studio - 在 Android Studio 中配置导入顺序?
- javascript - 如何在client.js中访问登录表单的输入标签值(名称)
- javascript - 如何在 jsdoc 函数参数中指定 Date 对象?
- python-3.x - Python UDP服务器多次接收/输出每个字符
- c++ - 我可以在没有 Visual Studio 的情况下获得 wxWidgets 吗?