Esempio n. 1
0
 public void Start()
 {
     Debug.Log("HMS GAMES: Achievements init");
     accountManager = AccountManager.Instance;
     if (accountManager.HuaweiId != null)
     {
         achievementsClient = Games.GetAchievementsClient(accountManager.HuaweiId);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Creates a new <see cref="Gw2WebApiV2Client"/>.
        /// </summary>
        /// <param name="connection">The connection used to make requests, see <see cref="IConnection"/>.</param>
        /// <param name="gw2Client">The Guild Wars 2 client.</param>
        /// <exception cref="ArgumentNullException"><paramref name="connection"/> or <paramref name="gw2Client"/> is <c>null</c>.</exception>
        protected internal Gw2WebApiV2Client(IConnection connection, IGw2Client gw2Client)
            : base(connection, gw2Client)
        {
            if (connection == null)
            {
                throw new ArgumentNullException(nameof(connection));
            }
            if (gw2Client == null)
            {
                throw new ArgumentNullException(nameof(gw2Client));
            }

            this.account        = new AccountClient(connection, gw2Client);
            this.achievements   = new AchievementsClient(connection, gw2Client);
            this.backstory      = new BackstoryClient(connection, gw2Client);
            this.build          = new BuildClient(connection, gw2Client);
            this.characters     = new CharactersClient(connection, gw2Client);
            this.colors         = new ColorsClient(connection, gw2Client);
            this.commerce       = new CommerceClient(connection, gw2Client);
            this.continents     = new ContinentsClient(connection, gw2Client);
            this.createSubtoken = new CreateSubtokenClient(connection, gw2Client);
            this.currencies     = new CurrenciesClient(connection, gw2Client);
            this.dailyCrafting  = new DailyCraftingClient(connection, gw2Client);
            this.dungeons       = new DungeonsClient(connection, gw2Client);
            this.emblem         = new EmblemClient(connection, gw2Client);
            this.emotes         = new EmotesClient(connection, gw2Client);
            this.files          = new FilesClient(connection, gw2Client);
            this.finishers      = new FinishersClient(connection, gw2Client);
            this.gliders        = new GlidersClient(connection, gw2Client);
            this.guild          = new GuildClient(connection, gw2Client);
            this.home           = new HomeClient(connection, gw2Client);
            this.items          = new ItemsClient(connection, gw2Client);
            this.itemstats      = new ItemstatsClient(connection, gw2Client);
            this.legends        = new LegendsClient(connection, gw2Client);
            this.mailCarriers   = new MailCarriersClient(connection, gw2Client);
            this.mapChests      = new MapChestsClient(connection, gw2Client);
            this.maps           = new MapsClient(connection, gw2Client);
            this.masteries      = new MasteriesClient(connection, gw2Client);
            this.materials      = new MaterialsClient(connection, gw2Client);
            this.minis          = new MinisClient(connection, gw2Client);
            this.mounts         = new MountsClient(connection, gw2Client);
            this.novelties      = new NoveltiesClient(connection, gw2Client);
            this.outfits        = new OutfitsClient(connection, gw2Client);
            this.pets           = new PetsClient(connection, gw2Client);
            this.professions    = new ProfessionsClient(connection, gw2Client);
            this.pvp            = new PvpClient(connection, gw2Client);
            this.quaggans       = new QuaggansClient(connection, gw2Client);
            this.quests         = new QuestsClient(connection, gw2Client);
            this.races          = new RacesClient(connection, gw2Client);
            this.raids          = new RaidsClient(connection, gw2Client);
            this.recipes        = new RecipesClient(connection, gw2Client);
            this.skills         = new SkillsClient(connection, gw2Client);
            this.tokenInfo      = new TokenInfoClient(connection, gw2Client);
            this.worldBosses    = new WorldBossesClient(connection, gw2Client);
        }
 public void ShowAchievements()
 {
     if (HMSAccountManager.Instance.HuaweiId != null)
     {
         IAchievementsClient achievementsClient = Games.GetAchievementsClient();
         achievementsClient.ShowAchievementList(() =>
         {
             Debug.Log("[HMS GAMES:] ShowAchievements SUCCESS");
             OnShowAchievementsSuccess?.Invoke();
         }, (exception) =>
         {
             Debug.Log("[HMS GAMES:] ShowAchievements ERROR");
             OnShowAchievementsFailure?.Invoke(exception);
         });
     }
 }
 public void ShowAchievements()
 {
     if (HMSAccountManager.Instance.HuaweiId != null)
     {
         IAchievementsClient achievementsClient = Games.GetAchievementsClient();
         achievementsClient.ShowAchievementList(() =>
         {
             Debug.Log("[HMS GAMES:] ShowAchievements SUCCESS");
             OnShowAchievementsSuccess?.Invoke();
         }, (exception) =>
         {
             Debug.LogError("[HMSAchievementsManager]: Show Achievements failed. CauseMessage: " + exception.WrappedCauseMessage + ", ExceptionMessage: " + exception.WrappedExceptionMessage);
             OnShowAchievementsFailure?.Invoke(exception);
         });
     }
 }
Esempio n. 5
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);
                });
            }
        }