unity3d LootLocker -如何显示本地排名

z9gpfhce  于 2022-11-30  发布在  其他
关注(0)|答案(1)|浏览(202)

在我的游戏中,我可以显示GlobalRank,但是,我也想根据全局结果显示玩家在Ranking中的位置。
因此,在底线,应该有本地(在这个设备上)的结果。
基本上,在左下角,我想从LootLocker获得排名,但我正在努力获得排名...

IEnumerator ShowScores()
{
    yield return new WaitForSeconds(2);

    

        LootLockerSDKManager.GetScoreList(ID, maxScores, (response) =>
        {

            if (response.success)
            {
                LootLockerLeaderboardMember[] scores = response.items;
                for (int i = 0; i < scores.Length; i++)
                {
                    playerNames[i].text     =   (scores[i].member_id        +"");
                    playerScores[i].text    =   (scores[i].score            +"");
                    playerRank[i].text      =   (scores[i].rank             + "");

                    //Rank of the localPlayer
                    Rank.text               =   (scores["here_Should_Be_This_Player_ID"].rank + "");

                    LootLockerSDKManager.GetPlayerName

                    // Entries[i].text = (scores[i].rank + ".       " + scores[i].score + ".      " + scores[i].member_id);
                }
                if (scores.Length < maxScores)
                {
                    for (int i = scores.Length; i < maxScores; i++)
                    {
                       // Entries[i].text = (i + 1).ToString() + ".  none";
                    }
                }


            }

            else
            {

            }

        });


    

}

hmae6n7t

hmae6n7t1#

通过LootLocker支持团队修复了此问题步骤1 -加载LootLocker并获得响应步骤2 -加载排名并获得响应2步骤3 -使用来自LootLocker的“Response2.rank
等级文本=(响应2.等级+“”);

string playerIdentifier = "PlayerNameRecordOnThisDevice";
        LootLockerSDKManager.StartSession(playerIdentifier, (response) =>
        {
            if (response.success)
            {
                
                Debug.Log("session with LootLocker started");
            }
            else
            {
                Debug.Log("failed to start sessions" + response.Error);
            }

            LootLockerSDKManager.GetMemberRank(ID, playerIdentifier, (response2) =>
            {
                if (response2.statusCode == 200)
                {
                    Debug.Log("GetMemberRank Successful");
                }
                else
                {
                    Debug.Log("GetMemberRank failed: " + response2.Error);
                }

                Rank.text = (response2.rank + "");
            });

        }); ```

相关问题