0

我想在 scoreloop 中获取当前用户的分数。但我不知道逻辑如何。

我试过了 :

scoresController.setRangeLength(1);  
scoresController.loadRangeForUser(Session.getCurrentSession().getUser());

但它没有得到当前用户。它返回了另一个人。因为我不明白 setRangeLength 返回我需要的用户数量,而 loadRangeForUser 是我放置用户 ID 的位置。

//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());



}
4

1 回答 1

0
ScoresController scoresController = (ScoresController) requestController;

ScoresController scoresController = new ScoresController(null,observer2);

这些不一样,您ScoresController在第一个中创建本地。

于 2012-12-01T15:17:15.143 回答