public void LoadLeaderboardsInfo() { if (_WaitingForLeaderboardsData) { return; } _WaitingForLeaderboardsData = true; _LeaderboardsDataEventsCount = 0; _CurrentLeaderboardsEventsCount = 0; switch (Application.platform) { case RuntimePlatform.IPhonePlayer: _LeaderboardsDataEventsCount = UltimateMobileSettings.Instance.Leaderboards.Count; foreach (UM_Leaderboard leaderboard in UltimateMobileSettings.Instance.Leaderboards) { GameCenterManager.LoadLeaderboardInfo(leaderboard.IOSId); } break; case RuntimePlatform.Android: GooglePlayManager.Instance.LoadLeaderBoards(); break; } }
public void LoadLeaderboardsInfo() { if (_WaitingForLeaderboardsData) { return; } _WaitingForLeaderboardsData = true; _LeaderboardsDataEventsCount = 0; _CurrentLeaderboardsEventsCount = 0; switch (Application.platform) { case RuntimePlatform.IPhonePlayer: _LeaderboardsDataEventsCount = UltimateMobileSettings.Instance.Leaderboards.Count; foreach (UM_Leaderboard leaderboard in UltimateMobileSettings.Instance.Leaderboards) { GameCenterManager.LoadLeaderboardInfo(leaderboard.IOSId); } break; case RuntimePlatform.Android: if (UltimateMobileSettings.Instance.PlatformEngine == UM_PlatformDependencies.Amazon) { SA_AmazonGameCircleManager.Instance.RequestLeaderboards(); } else { GooglePlayManager.Instance.LoadLeaderBoards(); } break; } }
//-------------------------------------- // Events //-------------------------------------- private void OnServiceConnected() { if (_IsDataLoaded || _DataEventsCount <= 0) { _IsDataLoaded = true; OnAllLoaded(); return; } switch (Application.platform) { case RuntimePlatform.IPhonePlayer: if (UltimateMobileSettings.Instance.AutoLoadAchievementsInfo) { GameCenterManager.LoadAchievements(); } if (UltimateMobileSettings.Instance.AutoLoadLeaderboardsInfo) { foreach (UM_Leaderboard leaderboard in UltimateMobileSettings.Instance.Leaderboards) { GameCenterManager.LoadLeaderboardInfo(leaderboard.IOSId); } } break; case RuntimePlatform.Android: if (UltimateMobileSettings.Instance.PlatformEngine == UM_PlatformDependencies.Amazon) { Debug.Log("Start To Load Amazon Player"); SA_AmazonGameCircleManager.Instance.RetrieveLocalPlayer(); if (UltimateMobileSettings.Instance.AutoLoadAchievementsInfo) { SA_AmazonGameCircleManager.Instance.RequestAchievements(); } if (UltimateMobileSettings.Instance.AutoLoadLeaderboardsInfo) { SA_AmazonGameCircleManager.Instance.RequestLeaderboards(); } } else { if (UltimateMobileSettings.Instance.AutoLoadAchievementsInfo) { GooglePlayManager.Instance.LoadAchievements(); } if (UltimateMobileSettings.Instance.AutoLoadLeaderboardsInfo) { GooglePlayManager.Instance.LoadLeaderBoards(); } } break; } }
void OnAuthFinished(ISN_Result res) { if (res.IsSucceeded) { IOSNativePopUpManager.showMessage("Player Authed ", "ID: " + GameCenterManager.Player.Id + "\n" + "Alias: " + GameCenterManager.Player.Alias); GameCenterManager.LoadLeaderboardInfo(leaderBoardId_1); } else { IOSNativePopUpManager.showMessage("Game Center ", "Player authentication failed"); } }
void OnAuthFinished(SA.Common.Models.Result res) { if (res.IsSucceeded) { IOSNativePopUpManager.showMessage("Player Authed ", "ID: " + GameCenterManager.Player.Id + "\n" + "Alias: " + GameCenterManager.Player.Alias); GameCenterManager.LoadLeaderboardInfo(TEST_LEADERBOARD_1); } else { IOSNativePopUpManager.showMessage("Game Center ", "Player authentication failed"); } }
//-------------------------------------- // Events //-------------------------------------- private void OnServiceConnected() { if (_IsDataLoaded || _DataEventsCount <= 0) { _IsDataLoaded = true; OnAllLoaded(); return; } switch (Application.platform) { case RuntimePlatform.IPhonePlayer: if (UltimateMobileSettings.Instance.AutoLoadAchievementsInfo) { GameCenterManager.LoadAchievements(); } if (UltimateMobileSettings.Instance.AutoLoadLeaderboardsInfo) { foreach (UM_Leaderboard leaderboard in UltimateMobileSettings.Instance.Leaderboards) { GameCenterManager.LoadLeaderboardInfo(leaderboard.IOSId); } } break; case RuntimePlatform.Android: if (UltimateMobileSettings.Instance.AutoLoadAchievementsInfo) { GooglePlayManager.Instance.LoadAchievements(); } if (UltimateMobileSettings.Instance.AutoLoadLeaderboardsInfo) { GooglePlayManager.Instance.LoadLeaderBoards(); } break; } }
void OnAuthFinished(SA.Common.Models.Result res) { _IsUILocked = true; IOSMessage msg = null; if (res.IsSucceeded) { msg = IOSMessage.Create("Player Authed ", "ID: " + GameCenterManager.Player.Id + "\n" + "Alias: " + GameCenterManager.Player.Alias); GameCenterManager.LoadLeaderboardInfo(TEST_LEADERBOARD_1); } else { msg = IOSMessage.Create("Game Center ", "Player authentication failed"); } msg.OnComplete += delegate { _IsUILocked = false; }; }
//-------------------------------------- // PUBLIC METHODS //-------------------------------------- void OnGUI() { UpdateToStartPos(); if (GameCenterManager.Player != null) { GUI.Label(new Rect(100, 10, Screen.width, 40), "ID: " + GameCenterManager.Player.Id); GUI.Label(new Rect(100, 20, Screen.width, 40), "Name: " + GameCenterManager.Player.DisplayName); GUI.Label(new Rect(100, 30, Screen.width, 40), "Alias: " + GameCenterManager.Player.Alias); //avatar loading will take a while after the user is connectd //so we will draw it only after instantiation to avoid null pointer check //if you whant to know exaxtly when the avatar is loaded, you can subscribe on //GameCenterManager.OnUserInfoLoaded action //and checl for a spesific user ID if (GameCenterManager.Player.SmallPhoto != null) { GUI.DrawTexture(new Rect(10, 10, 75, 75), GameCenterManager.Player.SmallPhoto); } } StartY += YLableStep; StartY += YLableStep; StartY += YLableStep; GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "Game Center Leaderboards", style); StartY += YLableStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Show Leaderboards")) { GameCenterManager.ShowLeaderboards(); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Load Sets Info")) { GameCenterManager.OnLeaderboardSetsInfoLoaded += OnLeaderboardSetsInfoLoaded; GameCenterManager.LoadLeaderboardSetInfo(); } StartX = XStartPos; StartY += YButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Show Leaderboard 1")) { GameCenterManager.ShowLeaderboard(leaderBoardId_1); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Report Score LB 1")) { hiScore++; GameCenterManager.ReportScore(hiScore, leaderBoardId_1); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Get Score LB 1")) { GameCenterManager.LoadLeaderboardInfo(leaderBoardId_1); } StartX = XStartPos; StartY += YButtonStep; StartY += YLableStep; GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "Leaderboard #2, user best score: " + LB2BestScores.ToString(), style); StartY += YLableStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Show Leader Board2")) { GameCenterManager.ShowLeaderboard(leaderBoardId_2); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Show Leaderboard 2 Today")) { GameCenterManager.ShowLeaderboard(leaderBoardId_2, GK_TimeSpan.TODAY); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Report Score LB2")) { hiScore++; GameCenterManager.OnScoreSubmitted += OnScoreSubmitted; GameCenterManager.ReportScore(hiScore, leaderBoardId_2); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Get Score LB 2")) { GameCenterManager.LoadLeaderboardInfo(leaderBoardId_2); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Send Challenge")) { GameCenterManager.IssueLeaderboardChallenge(leaderBoardId_2, "Here's a tiny challenge for you"); } StartX = XStartPos; StartY += YButtonStep; StartY += YLableStep; GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "Game Center Achievements", style); StartY += YLableStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Show Achievements")) { GameCenterManager.ShowAchievements(); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Reset Achievements")) { GameCenterManager.ResetAchievements(); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Submit Achievements1")) { GameCenterManager.SubmitAchievement(GameCenterManager.GetAchievementProgress(TEST_ACHIEVEMENT_1_ID) + 2.432f, TEST_ACHIEVEMENT_1_ID); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Submit Achievements2")) { GameCenterManager.SubmitAchievement(88.66f, TEST_ACHIEVEMENT_2_ID, false); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Send Challenge")) { GameCenterManager.IssueAchievementChallenge(TEST_ACHIEVEMENT_1_ID, "Here's a tiny challenge for you"); } StartX = XStartPos; StartY += YButtonStep; StartY += YLableStep; GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "More", style); StartY += YLableStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Retrieve Signature")) { GameCenterManager.RetrievePlayerSignature(); GameCenterManager.OnPlayerSignatureRetrieveResult += OnPlayerSignatureRetrieveResult; } }