예제 #1
0
 public void SignIn()
 {
     authService.StartSignIn((authId) =>
     {
         HuaweiId = authId;
         LoginSuccess?.Invoke(authId);
     }, (error) =>
     {
         HuaweiId = null;
         LoginFailed?.Invoke(error);
     });
 }
 public void SignIn()
 {
     Debug.Log("[HMS]: Sign in " + authService);
     authService.StartSignIn((authId) =>
     {
         HuaweiId = authId;
         OnSignInSuccess?.Invoke(authId);
     }, (error) =>
     {
         HuaweiId = null;
         OnSignInFailed?.Invoke(error);
     });
 }
 private void SignIn(Action <AuthServiceResult> callback)
 {
     Debug.Log("AppGalleryService -> Start SignIn");
     m_authService.StartSignIn(authId =>
     {
         TimeController.instance.CallFromMainThread(() =>
         {
             Debug.Log($"AppGalleryService -> SignIn Success {authId.DisplayName}");
             m_isLoggedIn = true;
             callback?.Invoke(new AuthServiceResult(true, authId.DisplayName));
         });
     }, error =>
     {
         TimeController.instance.CallFromMainThread(() =>
         {
             Debug.Log($"AppGalleryService -> SignIn Error {error.Message}");
             callback?.Invoke(new AuthServiceResult(false));
         });
     });
 }
예제 #4
0
        public void AuthenticateUser(Action <bool> callback = null)
        {
            if (!IsAuthenticated())
            {
                _authService.StartSignIn(authId =>
                {
                    Debug.Log(TAG + ": Signed In Succesfully!");

                    commonAuthUser = new CommonAuthUser
                    {
                        email    = authId.Email,
                        name     = authId.DisplayName,
                        id       = authId.OpenId,
                        photoUrl = authId.AvatarUriString
                    };

                    PlayerPrefs.SetInt("autoLogin", 1);

                    HuaweiId = authId;
                    Debug.Log(TAG + ": HuaweiIdToken is " + HuaweiId.IdToken);

                    //Load IJosAppClient for HMS
                    HuaweiMobileServicesUtil.SetApplication();
                    IJosAppsClient josAppsClient = JosApps.GetJosAppsClient(HuaweiId);
                    josAppsClient.Init();


                    _rankingClient     = Games.GetRankingsClient(HuaweiId);
                    _achievementClient = Games.GetAchievementsClient(HuaweiId);

                    callback?.Invoke(true);
                }, (error) =>
                {
                    commonAuthUser = null;
                    callback?.Invoke(false);
                });
            }
        }
예제 #5
0
        private void Init()
        {
            Debug.Log("HMS GAMES init");
            authService = accountManager.GetGameAuthService();

            ITask <AuthHuaweiId> taskAuthHuaweiId = authService.SilentSignIn();

            taskAuthHuaweiId.AddOnSuccessListener((result) =>
            {
                accountManager.HuaweiId = result;
                Debug.Log("HMS GAMES: Setted app");
                IJosAppsClient josAppsClient = JosApps.GetJosAppsClient(accountManager.HuaweiId);
                Debug.Log("HMS GAMES: jossClient");
                josAppsClient.Init();
                Debug.Log("HMS GAMES: jossClient init");
                InitGameMAnagers();
            }).AddOnFailureListener((exception) =>
            {
                Debug.Log("HMS GAMES: The app has not been authorized");
                authService.StartSignIn(SignInSuccess, SignInFailure);
                InitGameMAnagers();
            });
        }