更新分数时,Play游戏排行榜无法正常工作

时间:2019-03-01 16:55:26

标签: java android google-play-games google-play-services

我无法使自己的排行榜适合我的游戏。我的应用程序可以登录,显示成就和排行榜,也可以完成成就,但是当我将分数更新到排行榜然后再检查时,它会打开,但显示“嗯,Play服务出现了问题”。有人知道是什么原因造成的吗?

这是我用来更新成就和排行榜的代码:

if(GoogleSignIn.getLastSignedInAccount(PlayActivity.this)!=null){
                switch (pasos){
                    case 100:
                        Games.getAchievementsClient(PlayActivity.this, GoogleSignIn.getLastSignedInAccount(PlayActivity.this))
                                .unlock(getString(R.string.achievement_100_pasos));
                        break;
                    case 250:
                        Games.getAchievementsClient(PlayActivity.this, GoogleSignIn.getLastSignedInAccount(PlayActivity.this))
                                .unlock(getString(R.string.achievement_250_pasos));
                        break;
                    case 500:
                        Games.getAchievementsClient(PlayActivity.this, GoogleSignIn.getLastSignedInAccount(PlayActivity.this))
                                .unlock(getString(R.string.achievement_500_pasos));
                        break;
                    case 1000:
                        Games.getAchievementsClient(PlayActivity.this, GoogleSignIn.getLastSignedInAccount(PlayActivity.this))
                                .unlock(getString(R.string.achievement_1000_pasos));
                        break;
                    case 1500:
                        Games.getAchievementsClient(PlayActivity.this, GoogleSignIn.getLastSignedInAccount(PlayActivity.this))
                                .unlock(getString(R.string.achievement_1500_pasos));
                        break;
                    case 2500:
                        Games.getAchievementsClient(PlayActivity.this, GoogleSignIn.getLastSignedInAccount(PlayActivity.this))
                                .unlock(getString(R.string.achievement_2500_pasos));
                        break;
                    case 5000:
                        Games.getAchievementsClient(PlayActivity.this, GoogleSignIn.getLastSignedInAccount(PlayActivity.this))
                                .unlock(getString(R.string.achievement_5000_pasos));
                        break;
                    case 10000:
                        Games.getAchievementsClient(PlayActivity.this, GoogleSignIn.getLastSignedInAccount(PlayActivity.this))
                                .unlock(getString(R.string.achievement_10000_pasos));
                        break;
                    case 50000:
                        Games.getAchievementsClient(PlayActivity.this, GoogleSignIn.getLastSignedInAccount(PlayActivity.this))
                                .unlock(getString(R.string.achievement_50000_pasos));
                        break;
                    case 100000:
                        Games.getAchievementsClient(PlayActivity.this, GoogleSignIn.getLastSignedInAccount(PlayActivity.this))
                                .unlock(getString(R.string.achievement_100000_pasos));
                        break;
                    case 1000000:
                        Games.getAchievementsClient(PlayActivity.this, GoogleSignIn.getLastSignedInAccount(PlayActivity.this))
                                .unlock(getString(R.string.achievement_caminante_no_hay_camino));
                        break;
                    default:

                        break;
                }

                Games.getLeaderboardsClient(PlayActivity.this, GoogleSignIn.getLastSignedInAccount(PlayActivity.this)).submitScore("fgfjghfhjgfjh", pasos);
            }

0 个答案:

没有答案