[英]scoreloop get score of current user not working
I want to get the score of the current user in scoreloop . 我想在scoreloop中获取当前用户的分数。 but i don't know how is the logic. 但我不知道逻辑如何。
I tried : 我试过了 :
scoresController.setRangeLength(1);
scoresController.loadRangeForUser(Session.getCurrentSession().getUser());
But it don't get the current user. 但是它没有获得当前用户。 it returned someone else. 它返回了其他人。 as i undestand the setRangeLength return the number of users i need and loadRangeForUser is where i put the userID . 因为我不理解setRangeLength返回我需要的用户数,而loadRangeForUser是我放置userID的地方。
//Score for single user
final RequestControllerObserver observer2 = new RequestControllerObserver() {
public void requestControllerDidReceiveResponse(final RequestController requestController) {
// get the scores from our controller
ScoresController scoresController = (ScoresController) requestController;
List<Score> scores = scoresController.getScores();
if(scores!=null){
for (Score score2 : scores) {
PointsText.setText(" "+ScoreFormatter.format(score2));
RankText.setText(" "+score2.getRank());
}
// we're done!
dismissDialog(DIALOG_PROGRESS);
}
}
public void requestControllerDidFail(final RequestController aRequestController, final Exception anException) {
dismissDialog(DIALOG_PROGRESS);
}
};
// set up a ScoresController with our observer
ScoresController scoresController = new ScoresController(null,observer2);
showDialog(DIALOG_PROGRESS);
scoresController.setMode(0);
scoresController.setRangeLength(1);
scoresController.loadRangeForUser(Session.getCurrentSession().getUser());
}
ScoresController scoresController = (ScoresController) requestController;
ScoresController scoresController = new ScoresController(null,observer2);
these are not the same, you are creating a local ScoresController
in the first one. 这些不一样,您要在第一个中创建一个本地ScoresController
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.