using UnityEngine; using System.Collections; namespace UnityEngine.SocialPlatforms.GameCenter { public class GCLeaderBoard : MonoBehaviour { private const string _leaderBoardID = "SANTA_BEST_SCORE"; private static bool _authDone; private static bool _authProcess; // Use this for initialization void Start() { if (!_authProcess) { Social.localUser.Authenticate (OnAuth); _authProcess = true; } Debug.Log("GCLeaderBoard::Started"); } private static void OnSummitScore(bool done) { Debug.Log ("OnSummitScore " + done); } private void OnAuth(bool done) { Debug.Log ("OnAuth " + done); _authDone = done; _authProcess = false; } public static void Show() { if (Social.localUser.authenticated) { Social.ShowLeaderboardUI(); } else { Social.localUser.Authenticate(OnAuthAndShow); } } private static void OnAuthAndShow(bool done) { Social.ShowLeaderboardUI(); Debug.Log("OnAuthAndShow " + done); } public static void SummitScore(long score) { if (_authDone) { Social.ReportScore(score, _leaderBoardID, OnSummitScore); } /* else { _lastScore = score; Social.localUser.Authenticate(OnAuthAndSummitScore); }*/ } /* private static long _lastScore; private static void OnAuthAndSummitScore(bool done) { Social.ShowLeaderboardUI(); Debug.Log("OnAuthAndSummitScore " + done); Social.ReportScore(_lastScore, _leaderBoardID, OnAuthAndSummitScore); }*/ } }