gpt4 book ai didi

android - Libgdx 最高分。谷歌播放服务

转载 作者:行者123 更新时间:2023-11-29 19:21:31 25 4
gpt4 key购买 nike

我使用此代码从排行榜中获得最高分,但我不断获得

java.lang.IllegalStateException

LeaderboardScore lbs = arg0.getScores().get(0);

我不知道哪里出了问题。它在我之前的项目中有效

public void updateTops() {
Games.Leaderboards.loadTopScores(client, getString(R.string.leaderboard_score),
LeaderboardVariant.TIME_SPAN_ALL_TIME, LeaderboardVariant.COLLECTION_PUBLIC, 2, true).
setResultCallback(new ResultCallback<Leaderboards.LoadScoresResult>() {
@Override
public void onResult(final Leaderboards.LoadScoresResult arg0) {
System.out.println("SUKA " + score);
LeaderboardScore lbs = arg0.getScores().get(0);
score = lbs.getDisplayScore();
name = lbs.getScoreHolderDisplayName();
arg0.getScores().close();
}
});
}

最佳答案

这样试试:

 Games.Leaderboards.loadTopScores(mGamesClint,LEADERBOARD_ID, LeaderboardVariant.TIME_SPAN_ALL_TIME, LeaderboardVariant.COLLECTION_PUBLIC, 5).setResultCallback(new ResultCallback<Leaderboards.LoadScoresResult>() {

public void onResult(LoadScoresResult arg0) {

if(arg0 != null) {
if (arg0.getStatus().getStatusCode() == GamesStatusCodes.STATUS_OK) {

int size = arg0.getScores().getCount();
LeaderboardScoreBuffer scoreBuffer = arg0.getScores();
Iterator<LeaderboardScore> it = scoreBuffer.iterator();
while(it.hasNext()){
LeaderboardScore temp = it.next();
Log.d("PlayGames", "player"+temp.getScoreHolderDisplayName()+" score:"+temp.getDisplayScore());
}
}
}
}

关于android - Libgdx 最高分。谷歌播放服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42320355/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com