public static void TryAuthentication(bool forceMode = false) { if (instanceExists && instance.debugMode) { Debug.LogFormat("PlayGameCenterManager:TryAuthentication({0}) - isAuthenticated={1}, isLastAuthenticationFailed={2}", forceMode, isAuthenticated, isLastAuthenticationFailed); } if (IsSingedIn()) // If already logined, skip here { return; } if (isLastAuthenticationFailed && !forceMode) // If last login failed, don't do it again (unless in forceMode) { return; } _isForcingAuthentication = forceMode; #if UNITY_IOS GameCenterBinding.authenticateLocalPlayer(forceMode); // Authenticate the player #elif UNITY_ANDROID && !CHS if (forceMode) { PlayGameServices.authenticate(); // Authenticate with UI } else { PlayGameServices.attemptSilentAuthentication(); // Authenticate Silently (with no UI) } #endif }
protected override void Setup(APIWrapperSettings settings) { #if UNITY_ANDROID if (!PlayGameServices.isSignedIn() && !PlayerDataManager.Instance.GameCenterLoginRequested) { ZedLogger.Log("trying to authenticate local player (silently)"); PlayGameServices.attemptSilentAuthentication(); } #endif }
//============================================================================= public void Login() { #if UNITY_IPHONE if ((IsLoggedIn() == false) && (m_ManagerState == eManagerState.Idle)) { GameCenterBinding.authenticateLocalPlayer(); m_ManagerState = eManagerState.Login; } else { if (LoginFailEvent != null) { LoginFailEvent("Error - Already logged in or manager busy"); } } #endif #if UNITY_ANDROID if ((IsLoggedIn() == false) && (m_ManagerState == eManagerState.Idle)) { if (PlayerPrefs.GetInt("GCGPAutoLogin", 0) > 0) { PlayGameServices.attemptSilentAuthentication(); } else { PlayGameServices.authenticate(); } m_ManagerState = eManagerState.Login; } else { if (LoginFailEvent != null) { LoginFailEvent("Error - Already logged in or manager busy"); } } #endif }