public void ShowLeaderboardUI() { // Sign In 이 되어있지 않은 상태라면 // Sign In 후 리더보드 UI 표시 요청할 것 //if (Social.localUser.authenticated == false) { if (PlayGamesPlatform.Instance.IsAuthenticated() == false) { PlayGamesPlatform.Instance.Authenticate((bool success) => { //Social.localUser.Authenticate ((bool success) => { if (success) { // Sign In 성공 // 바로 리더보드 UI 표시 요청 //Social.ShowLeaderboardUI (GPGSIds.leaderboard_world_ranking); PlayGamesPlatform.Instance.ShowLeaderboardUI(GPGSIds.leaderboard_world_ranking); return; } else { // Sign In 실패 // 그에 따른 처리 return; } }); } else { #if UNITY_ANDROID PlayGamesPlatform.Instance.ShowLeaderboardUI(GPGSIds.leaderboard_world_ranking); #elif UNITY_IOS GameCenterPlatform.ShowLeaderboardUI("Leaderboard_ID", UnityEngine.SocialPlatforms.TimeScope.AllTime); #endif } }
void OnCollisionStay2D(Collision2D col) { if (outOfBoundsWithoutOrbit) { if (col.gameObject == GameScreenManager.leftWall || col.gameObject == GameScreenManager.rightWall || col.gameObject == GameScreenManager.bottomWall) { if (!coRoutineInProgress) { StartCoroutine(OutOfBoundsEndGameCheck()); coRoutineInProgress = true; } } if (col.gameObject == GameScreenManager.earth) { PlayerExplosion(); SoundFXPlayer.PlayCrashSFX(); GameScreenManager.playerHasCrashed = true; isOutOfBounds = true; #if UNITY_ANDROID PlayGamesPlatform.Instance.ReportProgress("CgkIja6x2owHEAIQDA", 100.0f, (bool success) => { }); #elif UNITY_IOS GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true); Social.ReportProgress("xyz.mattpowell.helios.earthcrash", 100.0f, (bool success) => { }); #endif } } }
//Activate the play games platform void Awake() { //Update the button before self-destruction UpdateButton(); //Check if already active (and destroy if so) if (SocialManager.Instance != this) { Destroy(gameObject); return; } DontDestroyOnLoad(gameObject); busy = false; #if UNITY_ANDROID GooglePlayGames.PlayGamesPlatform.Activate(); //Set up human-readable mappings for (int i = 0; i < NAMES.Length; i++) { ((GooglePlayGames.PlayGamesPlatform)Social.Active).AddIdMapping(NAMES[i], IDS[i]); } #elif UNITY_IPHONE GameCenterPlatform.Activate(); #endif }
/// <summary> /// Initializes the service. This is required before any other actions can be done e.g reporting scores. /// During the initialization process, a login popup will show up if the user hasn't logged in, otherwise /// the process will carry on silently. /// Note that on iOS, the login popup will show up automatically when the app gets focus for the first 3 times /// while subsequent authentication calls will be ignored. /// </summary> public static void Init() { // Authenticate and register a ProcessAuthentication callback // This call needs to be made before we can proceed to other calls in the Social API #if UNITY_IOS GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true); Social.localUser.Authenticate(ProcessAuthentication); #elif UNITY_ANDROID && EM_GPGS if (Social.Active != PlayGamesPlatform.Instance) { PlayGamesPlatform.Activate(); } PlayGamesPlatform.DebugLogEnabled = EM_Settings.GameService.IsGPGSDebug; Social.localUser.Authenticate(ProcessAuthentication); #elif UNITY_ANDROID && !EM_GPGS if (Debug.isDebugBuild) { Debug.LogError("SDK missing. Please import Google Play Games plugin for Unity."); } #else if (Debug.isDebugBuild) { Debug.Log("Init FAILED: platform not supported."); } #endif }
public void ShowLeaderboardUI() { if (Social.localUser.authenticated == false) { Debug.Log("!!!!!! SignIn ShowLeaderboardUI"); Social.localUser.Authenticate((bool success) => { if (success) { // Sign In 성공 // 바로 업적 UI 표시 요청 Debug.Log("!!!!!! SignIn Suc"); Social.ShowLeaderboardUI(); return; } else { Debug.Log("!!!!!! SignIn Fail"); // Sign In 실패 처리 return; } }); } #if UNITY_ANDROID ((PlayGamesPlatform)Social.Active).ShowLeaderboardUI(GPGSIds.leaderboard_score); Debug.Log("!!!!!! ShowLeaderboardUI 2"); #elif UNITY_IOS GameCenterPlatform.ShowLeaderboardUI("Leaderboard_ID", UnityEngine.SocialPlatforms.TimeScope.AllTime); #endif }
public void ShowLeadeboard() { if (Social.localUser.authenticated) { #if UNITY_ANDROID PlayGamesPlatform.Instance.ShowLeaderboardUI(GoogleLeaderboard.leaderboard_high_score); #elif UNITY_IOS GameCenterPlatform.ShowLeaderboardUI(leaderboardID, TimeScope.AllTime); #endif } else { Social.localUser.Authenticate( success => { if (success) { #if UNITY_ANDROID PlayGamesPlatform.Instance.ShowLeaderboardUI(GoogleLeaderboard.leaderboard_high_score); #elif UNITY_IOS GameCenterPlatform.ShowLeaderboardUI(leaderboardID, TimeScope.AllTime); #endif } }); } }
public void ShowTop() { #if UNITY_IOS && !UNITY_EDITOR GameCenterPlatform.ShowLeaderboardUI(iOS_LeaderboardID, UnityEngine.SocialPlatforms.TimeScope.AllTime); //Social.ShowLeaderboardUI(); #endif }
/// <summary> /// Shows the leaderboard UI for the given leaderboard in the specified time scope. /// </summary> /// <param name="leaderboardName">Leaderboard name.</param> /// <param name="timeScope">Time scope to display scores in the leaderboard.</param> public static void ShowLeaderboardUI(string leaderboardName, TimeScope timeScope) { if (!IsInitialized()) { Debug.Log("Couldn't show leaderboard UI: user is not logged in."); return; } Leaderboard ldb = GetLeaderboardByName(leaderboardName); if (ldb == null) { Debug.Log("Couldn't show leaderboard UI: unknown leaderboard name."); return; } #if UNITY_IOS GameCenterPlatform.ShowLeaderboardUI(ldb.Id, timeScope); #elif UNITY_ANDROID && EM_GPGS PlayGamesPlatform.Instance.ShowLeaderboardUI(ldb.Id, ToGpgsLeaderboardTimeSpan(timeScope), null); #else // Fallback Social.ShowLeaderboardUI(); #endif }
void Awake() { MobileAds.Initialize(initStatus => { }); #if UNITY_IPHONE if (!Social.localUser.authenticated) { Social.localUser.Authenticate(ProcessAuthentication); } GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true); #endif #if UNITY_ANDROID // recommended for debugging: // PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder() //// enables saving game progress. //.EnableSavedGames() //.RequestServerAuthCode(false) //// requests an ID token be generated. This OAuth token can be used to //// identify the player to other services such as Firebase. //.RequestIdToken() //.Build(); //PlayGamesPlatform.InitializeInstance(config); PlayGamesPlatform.DebugLogEnabled = true; // Activate the Google Play Games platform PlayGamesPlatform.Activate(); LogIn(); #endif }
/// <summary> /// Shows the native achievement user interface, allowing the player to browse achievements. /// </summary> /// <param name="id">Current platform's ID for the leaderboard.</param> /// <param name="internalID">Internal CloudOnce ID, if available.</param> public void ShowOverlay(string id = "", string internalID = "") { if (!Social.localUser.authenticated) { #if CLOUDONCE_DEBUG Debug.LogWarning("ShowOverlay can only be called after authentication."); #endif return; } if (string.IsNullOrEmpty(id)) { #if CLOUDONCE_DEBUG Debug.Log("Showing leaderboards overlay."); #endif Social.ShowLeaderboardUI(); } else { #if CLOUDONCE_DEBUG Debug.Log(string.Format("Showing {0} ({1}) leaderboard overlay.", internalID, id)); #endif GameCenterPlatform.ShowLeaderboardUI(id, TimeScope.AllTime); } }
public void ShowLeaderboardUI() { // Sign In 이 되어있지 않은 상태라면 // Sign In 후 리더보드 UI 표시 요청할 것 if (Social.localUser.authenticated == false) { Social.localUser.Authenticate((bool success) => { if (success) { // Sign In 성공 // 바로 리더보드 UI 표시 요청 Debug.Log("ShowLeaderboardUI success"); Social.ShowLeaderboardUI(); return; } else { Debug.Log("ShowLeaderboardUI fail"); // Sign In 실패 // 그에 따른 처리 return; } }); } #if UNITY_ANDROID PlayGamesPlatform.Instance.ShowLeaderboardUI(); #elif UNITY_IOS GameCenterPlatform.ShowLeaderboardUI("Leaderboard_ID", UnityEngine.SocialPlatforms.TimeScope.AllTime); #endif }
void Gameover() { Debug.Log("Score is: " + Score.ToString()); //float Best; //Debug.Log("GameOVER"); //Debug.Log("LOADED"); if (Best < Score) { Debug.Log("ENTERED IF"); try { PlayerPrefs.SetFloat("Score", Score); //SavedVariables.SaveVariables(); //Save(); //SaveHighscore(Score); } catch (Exception ex) { Debug.Log(ex.ToString()); } Debug.Log("Saved"); Social.ReportScore(Convert.ToInt64(Score), "HIGHSCORE1.1", result => { if (result) { Debug.Log("Successfully reported score progress"); Social.LoadScores("HIGHSCORE1.1", ProcessLoadedScores); // Make sure to use this. GameCenterPlatform.ShowLeaderboardUI("HIGHSCORE1.1", TimeScope.AllTime); } else { Debug.Log("Failed to report score"); } }); // Debug.Log("SAVED"); Best = Score; Kiip.saveMoment("Achieving a HIGHSCORE !!!", Best); // Debug.Log("Done IF"); } else { if (Score > 10) { Kiip.saveMoment("Doing Great !!!", Score); } //revMob.ShowFullscreen (); } GameOver.SetActive(true); outScore.text = "Score : " + Score; bestScore.text = "Best : " + Best; if (Best == Score) { bestScore.color = Color.magenta; } InGame.gameObject.SetActive(false); isRunning = false; paused = true; //Score = 0; }
//Open Leaderboard UI public void OpenLeaderboards() { if (Social.localUser.authenticated) { GameCenterPlatform.ShowLeaderboardUI(_highScore, UnityEngine.SocialPlatforms.TimeScope.AllTime); } }
public void onClick() { if (Social.localUser.authenticated) { GameCenterPlatform.ShowLeaderboardUI("topscores4", UnityEngine.SocialPlatforms.TimeScope.AllTime); } }
//------------------------------------------------------------------------------------------------ public static void ShowLeaderboardUI(int levelId) { #if UNITY_ANDROID // if (!GoogleGPGS.Instance().IsUserLoggedIn()) // { // GoogleGPGS.Instance().Login(); // } // // // string thisLeaderboardCode = GameCenterWrapper.GetGoogleLevelCode(Globals.g_gameGUI.selectedLevel); // GoogleGPGS.Instance().ShowLeaderboard(thisLeaderboardCode); // if (Globals.g_mainLoop.state == MainLoop.State.kStartScreen) // Social.ShowLeaderboardUI(); // else // GooglePlayGames.PlayGamesPlatform.Instance.ShowLeaderboardUI(thisLeaderboardCode); // Social.ShowLeaderboardUI(); #else if (levelId == -1) { Social.ShowLeaderboardUI(); } else { // string leaderboardString = string leaderboardString = ((Globals.g_world.frontEnd).profile).GetLeaderboardId(levelId); GameCenterPlatform.ShowLeaderboardUI(leaderboardString, TimeScope.AllTime); Social.ShowLeaderboardUI(); } #endif }
public void leaderboardButtonOnClick() { if (Social.localUser.authenticated) { GameCenterPlatform.ShowLeaderboardUI("Total_Experience_Leaderboard", TimeScope.AllTime); } }
void InitializeSettings() { // For now Social settings are only used for Game Center. if (Application.platform == RuntimePlatform.IPhonePlayer) { var settings = LumosPowerups.powerups["social"].settings; var gameCenterKey = "use_game_center"; if (settings != null && settings.ContainsKey(gameCenterKey)) { useGameCenter = System.Convert.ToBoolean(settings[gameCenterKey]); } if (useGameCenter) { gameCenterPlatform = new GameCenterPlatform(); gameCenterPlatform.localUser.Authenticate(success => { if (success) { LumosUnity.Debug.Log("Authenticated with game center."); } }); } } }
public static void Authenticate() { if (authRequest) { return; } if (Social.localUser.authenticated) { return; } authRequest = true; //select social platform bool useOffline = false; #if (UNITY_EDITOR || UNITY_ANDROID || UNITY_WEBPLAYER) useOffline = true; #endif if (Application.internetReachability == NetworkReachability.NotReachable) { useOffline = true; } if (useOffline) { Social.Active = PPrefsSocialPlatform.Instance; Debug.Log("USE_LOCAL_LEADERBOARD"); onlinePlatform = false; } #if UNITY_IPHONE GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true); #endif Debug.Log("SocialAdaptor.Authenticate"); Social.localUser.Authenticate(success => { if (success) { Debug.Log("Authentication successful"); string userInfo = "Username: "******"\nUser ID: " + Social.localUser.id + "\nIsUnderage: " + Social.localUser.underage; Debug.Log(userInfo); //GameObjectUtils.BroadCastMessage("OnAuthenticateSuccess", true); } else { Debug.Log("Authentication Fail"); Social.Active = PPrefsSocialPlatform.Instance; Social.localUser.Authenticate(null); Debug.Log("Authenticate fail, USE_LOCAL_LEADERBOARD"); onlinePlatform = false; //GameObjectUtils.BroadCastMessage("OnAuthenticateSuccess", false); } authRequest = false; }); }
public void LeaderboardButton() { #if UNITY_IOS GameCenterPlatform.ShowLeaderboardUI("Daily_Leaderboard", TimeScope.Today); GameCenterPlatform.ShowLeaderboardUI("Weekly_Leaderboard", TimeScope.Week); GameCenterPlatform.ShowLeaderboardUI("All_Time_Leaderboard", TimeScope.AllTime); #endif }
public void ShowLeaderboardUI() { if (IsUserAuthenticated()) { //Social.ShowLeaderboardUI(); GameCenterPlatform.ShowLeaderboardUI("com.unit9.swip3wear.leaderboard", TimeScope.AllTime); } }
public void ShowLeaderboards() { #if (PLATFORM_IOS == true) GameCenterPlatform.ShowLeaderboardUI(grassChapterLeaderboard, TimeScope.AllTime); #elif (PLATFORM_ANDROID == true) Social.ShowLeaderboardUI(); #endif }
/// <summary> /// Initializes the service. This is required before any other actions can be done e.g reporting scores. /// During the initialization process, a login popup will show up if the user hasn't logged in, otherwise /// the process will carry on silently. /// Note that on iOS, the login popup will show up automatically when the app gets focus for the first 3 times /// while subsequent authentication calls will be ignored. /// </summary> public static void Init() { // Authenticate and register a ProcessAuthentication callback // This call needs to be made before we can proceed to other calls in the Social API #if UNITY_IOS GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true); Social.localUser.Authenticate(ProcessAuthentication); #if EASY_MOBILE_PRO && !UNITY_EDITOR // Register the default GKLocalPlayerListener for invitation delegate if Multiplayer is enabled. // EM Pro only. if (EM_Settings.GameServices.IsMultiplayerEnabled) { RegisterDefaultGKLocalPlayerListener(); } #endif #elif UNITY_ANDROID && EM_GPGS #if EASY_MOBILE_PRO PlayGamesClientConfiguration.Builder gpgsConfigBuilder = new PlayGamesClientConfiguration.Builder(); // Enable Saved Games. if (EM_Settings.GameServices.IsSavedGamesEnabled) { gpgsConfigBuilder.EnableSavedGames(); } // Register an internal invitation delegate and match delegate if Multiplayer is enabled. if (EM_Settings.GameServices.IsMultiplayerEnabled) { gpgsConfigBuilder.WithInvitationDelegate(OnGPGSInvitationReceived); gpgsConfigBuilder.WithMatchDelegate(OnGPGSTBMatchReceived); } // Build the config PlayGamesClientConfiguration gpgsConfig = gpgsConfigBuilder.Build(); // Initialize PlayGamesPlatform PlayGamesPlatform.InitializeInstance(gpgsConfig); #endif // Enable logging if required PlayGamesPlatform.DebugLogEnabled = EM_Settings.GameServices.GgpsDebugLogEnabled; // Set PlayGamesPlatforms as active if (Social.Active != PlayGamesPlatform.Instance) { PlayGamesPlatform.Activate(); } // Now authenticate Social.localUser.Authenticate(ProcessAuthentication); #elif UNITY_ANDROID && !EM_GPGS Debug.LogError("SDK missing. Please import Google Play Games plugin for Unity."); #else Debug.Log("Failed to initialize Game Services module: platform not supported."); #endif }
public static void ResetAchivements() { #if UNITY_IOS GameCenterPlatform.ResetAllAchievements((resetResult) => { Debug.Log((resetResult) ? "Reset done." : "Reset failed."); }); #elif UNITY_ANDROID #endif }
public void Authenticate() { if (!authenticating) { authenticating = true; Social.localUser.Authenticate(AuthenticateUser); GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true); } }
void Start() { // Authenticate and register a ProcessAuthentication callback // This call needs to be made before we can proceed to other calls in the Social API Social.localUser.Authenticate(ProcessAuthentication); // Shows GameCenter banners for iOS GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true); }
public void ShowLeaderBoard() { if (!_didInit) { return; } Debug.Log("GameCenter: Show Leaderboard: " + _config.GameCenter.LeaderboardIds.First().Value); GameCenterPlatform.ShowLeaderboardUI(_config.GameCenter.LeaderboardIds.First().Value, TimeScope.AllTime); }
// Use this for initialization void Start() { #if UNITY_IOS GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true); #elif UNITY_ANDROID PlayGamesPlatform.Activate(); //android #endif ConectarGoogle(); }
IEnumerator Start() { InitPlayerInfo(); notreadytoShow = false; #if UNITY_IPHONE Social.localUser.Authenticate( result => { if (result && showAchievementBanners) { GameCenterPlatform.ShowDefaultAchievementCompletionBanner(showAchievementBanners); Debug.Log("Authenticated " + Social.localUser.userName); } else { Debug.Log("Failed to authenticate " + Social.localUser.userName); } } ); #endif adBanner = GameObject.FindGameObjectWithTag("AdBanner"); gamecode = CalculateMD5Hash(key + databaseID); Debug.Log(gamecode); currentPage = Page.Main; currentSub = LeftGUI.ALL; currentRight = RightGUI.ALL; Debug.Log(Screen.width / baseScreenWidth); DontDestroyOnLoad(gameObject); FB.Init(SetInit, OnHideUnity); locationFound = false; Input.location.Start(); int maxWait = 10; while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0) { yield return(new WaitForSeconds(1)); maxWait--; } if (maxWait < 1) { yield return(false); } if (Input.location.status == LocationServiceStatus.Failed) { yield return(false); //return false; } else { locationFound = true; } Input.location.Stop(); }
public void showLeaderboard() { #if UNITY_ANDROID PlayGamesPlatform.Instance.ShowLeaderboardUI(leaderboardIdToUse); #endif #if UNITY_IOS GameCenterPlatform.ShowLeaderboardUI(leaderboardIdToUse, 0); #endif }
public static void ShowLeaderboardUI() { //how to do in android? #if UNITY_IPHONE GameCenterPlatform.ShowLeaderboardUI(Constants.gamecenterLeaderBoradScoreId, TimeScope.AllTime); #endif // #if UNITY_ANDROID // ((PlayGamesPlatform)Social.Active).ShowLeaderboardUI(Constants.gamecenterLeaderBoradScoreId); // #endif }