Пример #1
0
 // Make sure user already signed in!
 public void Start()
 {
     Debug.Log("HMS GAMES: Game init");
     HuaweiMobileServicesUtil.SetApplication();
     accountManager = AccountManager.Instance;
     Init();
 }
Пример #2
0
 public void Start()
 {
     HuaweiMobileServicesUtil.SetApplication();
     if (HMSGameServiceSettings.Instance.Settings.GetBool(HMSGameServiceSettings.InitializeOnStart))
     {
         Init();
     }
 }
Пример #3
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);
                });
            }
        }