排行榜得分提交

时间:2016-08-20 02:18:16

标签: android leaderboard

我在Android上有一个游戏,它似乎是分数提交的一个问题:它不知何故忽略了一个高分(我有一个基于时间的leaberboard:最低的时间是最好的)。这是我的代码:

public void submitScore(int difficulty, long time) {
    Log.e(TAG, "difficulty: " + difficulty + "; api connected: " + getApiClient().isConnected() + "; time: " + time);
    if (getApiClient().isConnected()) {
        time = time * 1000;
        if (difficulty == Constants.DIFFICULTY_EASY) {
            Games.Leaderboards.submitScoreImmediate(getApiClient(), Constants.LEADERBOARD_ID_EASY, time).setResultCallback(new MyLeaderBoardSubmitScoreCallback());
        } else if (difficulty == Constants.DIFFICULTY_MEDIUM) {
            Games.Leaderboards.submitScoreImmediate(getApiClient(), Constants.LEADERBOARD_ID_MEDIUM, time).setResultCallback(new MyLeaderBoardSubmitScoreCallback());
        } else if (difficulty == Constants.DIFFICULTY_HARD) {
            Games.Leaderboards.submitScoreImmediate(getApiClient(), Constants.LEADERBOARD_ID_HARD, time).setResultCallback(new MyLeaderBoardSubmitScoreCallback());
        } else if (difficulty == Constants.DIFFICULTY_IMPOSSIBLE) {
            Games.Leaderboards.submitScoreImmediate(getApiClient(), Constants.LEADERBOARD_ID_IMPOSSIBLE, time).setResultCallback(new MyLeaderBoardSubmitScoreCallback());
        }
    }
}

 class MyLeaderBoardSubmitScoreCallback implements ResultCallback<Leaderboards.SubmitScoreResult> {
    @Override
    public void onResult(Leaderboards.SubmitScoreResult res) {
        if (res.getStatus().getStatusCode() == 0) {
            Log.e("TAG", "score submitted successfully: " + res.getScoreData().toString());
        } else{
            Log.e("TAG", "error submitting score: " + res.getScoreData().toString());
        }
    }
}

以下是回调打印的内容:

得分成功提交:ScoreSubmissionData {PlayerId = xxxxxxxxxxxxxxxxxx,StatusCode = 0,TimesSpan = DAILY,Result = Result {RawScore = 70000,FormattedScore = 1:10,ScoreTag = null,NewBest = false},TimesSpan = WEEKLY,Result =结果{RawScore = 73000,FormattedScore = 1:13,ScoreTag = null,NewBest = false},TimesSpan = ALL_TIME,Result = Result {RawScore = 135000,FormattedScore = 2:15,ScoreTag = null,NewBest = false}}

我的新分数是35秒,所以我提交了35000 ...

我做错了吗? 因为如果我从我的应用程序中查看高分,我的最佳时间是02:15(135秒)...那么这些每周每日时间跨度是多少?

0 个答案:

没有答案