1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- 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);
- }*/
- }
- }
|