Google Play游戏排行榜定制

问题描述 投票:0回答:1

我想实现这个“我的排名:前13%(25034排名)”

我试过的↓

Social.LoadScores("CgkI1...", scores => {...})

:“scores.Length”最多只返回25。

ILeaderboard lb = Social.CreateLeaderboard();
lb.id = "CgkI1...";
uint max_player = lb.maxRange;

:失败..

我不知道排行榜球员数和我的排名。请帮帮我,我该怎么办..

unity3d google-play-games
1个回答
0
投票

我自己成功了:

        ILeaderboard lb =  PlayGamesPlatform.Instance.CreateLeaderboard();
        lb.id = "CgkI1...";
        lb.userScope = UserScope.Global;
        lb.range = new Range(1,10);
        lb.timeScope = TimeScope.AllTime;


        lb.LoadScores(scores =>
        {
            uint all_player = lb.maxRange;
            int my_rank = lb.localUserScore.rank;
            decimal percent = (decimal)my_rank / (decimal)all_player;

            text.text = scores.ToString() + "\nAllPlayer: " + all_player + "\nMyRank: " + my_rank + "\nMyScore: " +lb.localUserScore.value.ToString() + "\nPercent: " + percent + "%";
        });

t

© www.soinside.com 2019 - 2024. All rights reserved.