Android Google 玩排行榜
Android Google Play Leaderboard
我开发了一个 android game.I 在我的游戏中使用 Google 玩排行榜。
我的问题是排行榜分数没有显示在应用程序中。排行榜界面出现,但显示 "No leaderboards for this game"。用户分数未显示。
这是分数的保存代码
PendingResult<Leaderboards.LoadPlayerScoreResult> result = Games.Leaderboards.loadCurrentPlayerLeaderboardScore(getApiClient(),getString(R.string.number_guesses_leaderboard), LeaderboardVariant.TIME_SPAN_ALL_TIME, LeaderboardVariant.COLLECTION_PUBLIC);
result.setResultCallback(new ResultCallback<Leaderboards.LoadPlayerScoreResult>() {
@Override
public void onResult(Leaderboards.LoadPlayerScoreResult loadPlayerScoreResult) {
if(loadPlayerScoreResult != null && loadPlayerScoreResult.getScore() != null) {
Games.Leaderboards.submitScore(getApiClient(), getString(R.string.number_guesses_leaderboard), loadPlayerScoreResult.getScore().getRawScore() + value);}
else {
Games.Leaderboards.submitScore(getApiClient(), getString(R.string.number_guesses_leaderboard), value); }
}});
有什么想法吗?我该怎么办?
确保您已在 Google Play 管理中心正确设置排行榜。在那里你会 Create your Leaderboard first and then you will Add Leaderboard to your game.
我开发了一个 android game.I 在我的游戏中使用 Google 玩排行榜。 我的问题是排行榜分数没有显示在应用程序中。排行榜界面出现,但显示 "No leaderboards for this game"。用户分数未显示。
这是分数的保存代码
PendingResult<Leaderboards.LoadPlayerScoreResult> result = Games.Leaderboards.loadCurrentPlayerLeaderboardScore(getApiClient(),getString(R.string.number_guesses_leaderboard), LeaderboardVariant.TIME_SPAN_ALL_TIME, LeaderboardVariant.COLLECTION_PUBLIC);
result.setResultCallback(new ResultCallback<Leaderboards.LoadPlayerScoreResult>() {
@Override
public void onResult(Leaderboards.LoadPlayerScoreResult loadPlayerScoreResult) {
if(loadPlayerScoreResult != null && loadPlayerScoreResult.getScore() != null) {
Games.Leaderboards.submitScore(getApiClient(), getString(R.string.number_guesses_leaderboard), loadPlayerScoreResult.getScore().getRawScore() + value);}
else {
Games.Leaderboards.submitScore(getApiClient(), getString(R.string.number_guesses_leaderboard), value); }
}});
有什么想法吗?我该怎么办?
确保您已在 Google Play 管理中心正确设置排行榜。在那里你会 Create your Leaderboard first and then you will Add Leaderboard to your game.