public void Start()
 {
     accountManager = AccountManager.Instance;
     if (accountManager.HuaweiId != null)
     {
         rankingsClient = Games.GetRankingsClient(accountManager.HuaweiId);
     }
 }
Ejemplo n.º 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);
                });
            }
        }