从谷歌排行榜前5分 [英] Top 5 scores from google leaderboard

查看:257
本文介绍了从谷歌排行榜前5分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的要求是得到前5分从排行榜和我的应用程序中显示。

My requirement is to get top 5 scores from leaderboard and display it in my app.

有一种方法loadTopScores但它示出了在它自己的UI我想的分数。

There is a method loadTopScores but it shows the scores in its own UI i guess.

mGamesClint.loadTopScores(new OnLeaderboardScoresLoadedListener() {

            public void onLeaderboardScoresLoaded(int arg0, LeaderboardBuffer arg1,
                    LeaderboardScoreBuffer arg2) {
                // TODO Auto-generated method stub




            }
        }, LEADERBOARD_ID,LeaderboardVariant.TIME_SPAN_ALL_TIME  , LeaderboardVariant.COLLECTION_PUBLIC, 5, true);

那么,有什么办法可以让个人数据,如姓名和分数..?

So is there any way I can get individual data like Name and score..?

名称1:最佳射手1名 比分1:分数的最佳射手1

Name 1 : Name of the top scorer 1 score 1 : score of the top scorer 1

名称2:最佳射手2名 比分2:成绩最佳射手2

Name 2 : Name of the top scorer 2 score 2 : score of the top scorer 2

......等等

我只想名字符串和分数整数,这样我可以在我的游戏中使用它。

I just want name string and score integer so that I can use it in my game.

请给我建议一些想法

推荐答案

我的解决方案,它的工作如下:这是最新的游戏服务。

My Solution which worked is as follows which is for the latest game play services.

  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) {
            // TODO Auto-generated method stub

            int size = arg0.getScores().getCount();



            for ( int i = 0; i < 3; i++ )  {

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

                String name = lbs.getScoreHolderDisplayName();

                String score = lbs.getDisplayScore();

                Uri urlimage = lbs.getScoreHolderHiResImageUri();

                 }

 }

您可以从排行榜这里的用户包括高分辨率的图像,即所有的数据。资料图片。 希望你在这里得到的想法。

you can get all the data from leaderboard users here including high resolution image ie. profile picture. Hope you get the idea here.

这篇关于从谷歌排行榜前5分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆