如何在GameCenter Unity IOS中编写最佳成绩?

时间:2018-09-04 15:01:43

标签: unity3d

我想在游戏中做排行榜。 我创建了它,但是当我使用LeaderBoard按钮打开时,没有写下来。

private void Start () {

    Social.localUser.Authenticate (success => {
        if (success) {
            Debug.Log ("Authenticated, checking achievements");

            // Request loaded scores, and register a callback for processing them
            ILeaderboard leaderboard = Social.CreateLeaderboard();
            leaderboard.id = "secretID";
            leaderboard.LoadScores(result => {
                Debug.Log("Received " + leaderboard.scores.Length + " scores");
            });
        }
        else
            Debug.Log ("Failed to authenticate");
    });
}


public void OpenLeaderboard() {
    Social.ReportScore (15, "secretID", result => {
            Debug.Log(result ? "Reported score successfully" : "Failed to report score");
    });

    UnityEngine.SocialPlatforms.GameCenter.GameCenterPlatform.ShowLeaderboardUI ("grp.warior.game", TimeScope.Week);
}

0 个答案:

没有答案