コード例 #1
0
 public void AuthenticateUser(Action <bool> callback = null)
 {
     if (!IsAuthenticated())
     {
         Social.localUser.Authenticate(result =>
         {
             if (result)
             {
                 Debug.Log(TAG + " Authenticate is successfull! UserName is " + Social.localUser.userName);
                 commonAuthUser = new CommonAuthUser
                 {
                     email = Social.localUser.userName,
                     name  = Social.localUser.userName,
                     id    = Social.localUser.id
                 };
                 PlayerPrefs.SetInt("autoLogin", 1);
             }
             else
             {
                 Debug.Log(TAG + " Authenticate is failed!");
             }
             callback?.Invoke(result);
         });
     }
 }
コード例 #2
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);
                });
            }
        }
コード例 #3
0
 public void SignOut()
 {
     commonAuthUser = null;
     _authService.SignOut();
 }
コード例 #4
0
 public void SignOut()
 {
     commonAuthUser = null;
     _platform?.SignOut();
 }