Пример #1
0
    IEnumerator doLogin(LeaderboardAPI api)
    {
        bool success = false;

        yield return(api.logInPlayer("james", "password1", () => {
            Debug.Log("Success! We logged in as james.");
            success = true;
        }, logFailure));

        if (!success)
        {
            yield break;
        }
        yield return(api.submitScore(6000, LeaderboardAPI.MatchType.OneMinuteAR, () => {
            Debug.Log("Score submitted successfully.");
        }, logFailure));

        yield return(api.getLeaderboard(0, (scores) => {
            foreach (LeaderboardAPI.LeaderboardScore score in scores)
            {
                Debug.Log("Retrieved a new score: " + score.score + " for match type " + score.type.ToString());
            }
        }, logFailure));
    }
Пример #2
0
 void SubmitScore()
 {
     LeaderboardAPI.RecordScore(leaderboardId, "Brad Keys", System.Convert.ToInt32(GameManager.player.score.val), OnScoreRecorded);
 }
Пример #3
0
 void SubmitScore()
 {
     LeaderboardAPI.RecordScore(leaderboardId, userName, System.Convert.ToInt32(score), OnScoreRecorded);
 }
Пример #4
0
 // Use this for initialization
 void Start()
 {
     PlayerPrefs.DeleteAll();
     api = FindObjectOfType <LeaderboardAPI> ();
     StartCoroutine(doLogin(api));
 }