从排行榜获取分数和玩家信息

发布于 2025-01-07 05:45:33 字数 452 浏览 0 评论 0原文

我希望能够显示我的游戏中各个级别的前十名左右的分数列表。我查看了一下,发现 openfeint 有一个回调方法,

Leaderboard.getScores(Leaderboard.GetScoresCB cb)

我不确定如何实现这个方法,所以我尝试

 public static void getScores(){
     Leaderboard l = new Leaderboard(getRightLB(level, section));
     float score = l.getScores(Leaderboard.GetScoresCB cb)
 }

在该方法的第二行出现错误的构造错误。 android 版本的佯攻的实现似乎很差,有谁知道实现这个的正确方法。

另外,是否还可以获取用户名和个人资料图片以及分数数据?

I want to be able to show a list of the top ten or so scores for the levels in my game. I looked and I found that openfeint had a callback method for this

Leaderboard.getScores(Leaderboard.GetScoresCB cb)

I was not sure how to implement this so I tried

 public static void getScores(){
     Leaderboard l = new Leaderboard(getRightLB(level, section));
     float score = l.getScores(Leaderboard.GetScoresCB cb)
 }

I got a misplaced constructs error on the second line of the method.
Implementation for the android version of feint seems pretty poor, does anyone know the correct way to implement this.

Also is it possible to also get user names and profile pics along with the score data?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

终止放荡 2025-01-14 05:45:33

回答

就像提交乐谱一样进行设置,呵呵!

public static void getScores(){
     Leaderboard l = new Leaderboard("KEY");
     l.getScores(new Leaderboard.GetScoresCB() {

        @Override
        public void onSuccess(List<Score> scorelist) {
            // TODO Auto-generated method stub

        }
    });
 }

编辑:我已经解决了用户名/个人资料图片的问题。

事实证明,Score 对象与其他信息以及分数的数值捆绑在一起。

获取数值分值:

scorelist.get(i).score;

对应的用户名:

scorelist.get(i).user.name;

以及头像的url:

scorelist.get(i).user.profilePictureUrl;

Answer

Set it up just like you were submitting a score, Duh!

public static void getScores(){
     Leaderboard l = new Leaderboard("KEY");
     l.getScores(new Leaderboard.GetScoresCB() {

        @Override
        public void onSuccess(List<Score> scorelist) {
            // TODO Auto-generated method stub

        }
    });
 }

EDIT: I've worked out the user name/profile picture thing.

Turns out that the Score object comes bundled with other information as well as just the numerical value of the score.

To get the numerical score value:

scorelist.get(i).score;

The corresponding username:

scorelist.get(i).user.name;

And the url of the profile picture:

scorelist.get(i).user.profilePictureUrl;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文