コード例 #1
0
        private void InitializeGameServices()
        {
            lock (GameServicesLock)
            {
                if (mServices != null)
                {
                    return;
                }

                using (var builder = GameServicesBuilder.Create())
                {
                    using (var config = clientImpl.CreatePlatformConfiguration())
                    {
                        // We need to make sure that the invitation delegate is registered before the
                        // services object is initialized - otherwise we might miss a callback if
                        // the game was opened because of a user accepting an invitation through
                        // a system notification.
                        RegisterInvitationDelegate(mConfiguration.InvitationDelegate);
                        builder.SetOnAuthFinishedCallback(HandleAuthTransition);
                        builder.SetOnTurnBasedMatchEventCallback((eventType, matchId, match) => mTurnBasedClient.HandleMatchEvent(eventType, matchId, match));
                        builder.SetOnMultiplayerInvitationEventCallback(HandleInvitation);
                        if (mConfiguration.EnableSavedGames)
                        {
                            builder.EnableSnapshots();
                        }
                        if (mConfiguration.RequireGooglePlus)
                        {
                            builder.RequireGooglePlus();
                        }
                        Debug.Log("Building GPG services, implicitly attempts silent auth");
                        mAuthState       = AuthState.SilentPending;
                        mServices        = builder.Build(config);
                        mEventsClient    = new NativeEventClient(new EventManager(mServices));
                        mQuestsClient    = new NativeQuestClient(new QuestManager(mServices));
                        mTurnBasedClient =
                            new NativeTurnBasedMultiplayerClient(this, new TurnBasedManager(mServices));

                        mTurnBasedClient.RegisterMatchDelegate(mConfiguration.MatchDelegate);

                        mRealTimeClient =
                            new NativeRealtimeMultiplayerClient(this, new RealtimeManager(mServices));

                        if (mConfiguration.EnableSavedGames)
                        {
                            mSavedGameClient =
                                new NativeSavedGameClient(new SnapshotManager(mServices));
                        }
                        else
                        {
                            mSavedGameClient = new UnsupportedSavedGamesClient(
                                "You must enable saved games before it can be used. " +
                                "See PlayGamesClientConfiguration.Builder.EnableSavedGames.");
                        }

                        mAuthState   = AuthState.SilentPending;
                        mTokenClient = clientImpl.CreateTokenClient(false);
                    }
                }
            }
        }
コード例 #2
0
ファイル: NativeClient.cs プロジェクト: zunaalabaya/TAC-BOT
 private void InitializeGameServices()
 {
     lock (this.GameServicesLock)
     {
         if (this.mServices != null)
         {
             return;
         }
         using (GameServicesBuilder gameServicesBuilder = GameServicesBuilder.Create())
         {
             using (PlatformConfiguration platformConfiguration = this.clientImpl.CreatePlatformConfiguration())
             {
                 this.RegisterInvitationDelegate(this.mConfiguration.InvitationDelegate);
                 gameServicesBuilder.SetOnAuthFinishedCallback(new GameServicesBuilder.AuthFinishedCallback(this.HandleAuthTransition));
                 gameServicesBuilder.SetOnTurnBasedMatchEventCallback((Action <Types.MultiplayerEvent, string, NativeTurnBasedMatch>)((eventType, matchId, match) => this.mTurnBasedClient.HandleMatchEvent(eventType, matchId, match)));
                 gameServicesBuilder.SetOnMultiplayerInvitationEventCallback(new Action <Types.MultiplayerEvent, string, GooglePlayGames.Native.PInvoke.MultiplayerInvitation>(this.HandleInvitation));
                 if (this.mConfiguration.EnableSavedGames)
                 {
                     gameServicesBuilder.EnableSnapshots();
                 }
                 Debug.Log((object)"Building GPG services, implicitly attempts silent auth");
                 this.mAuthState       = NativeClient.AuthState.SilentPending;
                 this.mServices        = gameServicesBuilder.Build(platformConfiguration);
                 this.mEventsClient    = (IEventsClient) new NativeEventClient(new GooglePlayGames.Native.PInvoke.EventManager(this.mServices));
                 this.mQuestsClient    = (IQuestsClient) new NativeQuestClient(new GooglePlayGames.Native.PInvoke.QuestManager(this.mServices));
                 this.mTurnBasedClient = new NativeTurnBasedMultiplayerClient(this, new TurnBasedManager(this.mServices));
                 this.mTurnBasedClient.RegisterMatchDelegate(this.mConfiguration.MatchDelegate);
                 this.mRealTimeClient  = new NativeRealtimeMultiplayerClient(this, new RealtimeManager(this.mServices));
                 this.mSavedGameClient = !this.mConfiguration.EnableSavedGames ? (ISavedGameClient) new UnsupportedSavedGamesClient("You must enable saved games before it can be used. See PlayGamesClientConfiguration.Builder.EnableSavedGames.") : (ISavedGameClient) new NativeSavedGameClient(new GooglePlayGames.Native.PInvoke.SnapshotManager(this.mServices));
                 this.mAuthState       = NativeClient.AuthState.SilentPending;
                 this.mTokenClient     = this.clientImpl.CreateTokenClient();
             }
         }
     }
 }
コード例 #3
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);
        }
コード例 #4
0
ファイル: NativeClient.cs プロジェクト: timnlupo/Gooth
        private void InitializeGameServices()
        {
            lock (GameServicesLock)
            {
                if (mServices != null)
                {
                    return;
                }

                using (var builder = GameServicesBuilder.Create())
                {
                    using (var config = CreatePlatformConfiguration())
                    {
                        // We need to make sure that the invitation delegate is registered before the
                        // services object is initialized - otherwise we might miss a callback if
                        // the game was opened because of a user accepting an invitation through
                        // a system notification.
                        RegisterInvitationDelegate(mConfiguration.InvitationDelegate);

                        builder.SetOnAuthFinishedCallback(HandleAuthTransition);
                        builder.SetOnTurnBasedMatchEventCallback((eventType, matchId, match) => mTurnBasedClient.HandleMatchEvent(eventType, matchId, match));
                        builder.SetOnMultiplayerInvitationEventCallback(HandleInvitation);
                        if (mConfiguration.EnableSavedGames)
                        {
                            builder.EnableSnapshots();
                        }
                        mServices = builder.Build(config);
                        mEventsClient = new NativeEventClient(new EventManager(mServices));
                        mQuestsClient = new NativeQuestClient(new QuestManager(mServices));
                        mTurnBasedClient =
                        new NativeTurnBasedMultiplayerClient(this, new TurnBasedManager(mServices));

                        mTurnBasedClient.RegisterMatchDelegate(mConfiguration.MatchDelegate);

                        mRealTimeClient =
                        new NativeRealtimeMultiplayerClient(this, new RealtimeManager(mServices));

                        if (mConfiguration.EnableSavedGames)
                        {
                            mSavedGameClient =
                            new NativeSavedGameClient(new SnapshotManager(mServices));
                        }
                        else
                        {
                            mSavedGameClient = new UnsupportedSavedGamesClient(
                                "You must enable saved games before it can be used. " +
                                "See PlayGamesClientConfiguration.Builder.EnableSavedGames.");
                        }

                        mAppStateClient = CreateAppStateClient();
                        mAuthState = AuthState.SilentPending;
                    }
                }
            }
        }
コード例 #5
0
        private void InitializeGameServices()
        {
            lock (GameServicesLock)
            {
                if (mServices != null)
                {
                    return;
                }

                using (var builder = GameServicesBuilder.Create())
                {
                    using (var config = clientImpl.CreatePlatformConfiguration(mConfiguration))
                    {
                        // We need to make sure that the invitation delegate
                        // is registered before the services object is
                        // initialized - otherwise we might miss a callback if
                        // the game was opened because of a user accepting an
                        // invitation through a system notification.
                        RegisterInvitationDelegate(mConfiguration.InvitationDelegate);
                        builder.SetOnAuthFinishedCallback(HandleAuthTransition);
                        builder.SetOnTurnBasedMatchEventCallback(
                            (eventType, matchId, match) =>
                            mTurnBasedClient.HandleMatchEvent(
                                eventType, matchId, match));
                        builder.SetOnMultiplayerInvitationEventCallback(
                            HandleInvitation);
                        if (mConfiguration.EnableSavedGames)
                        {
                            builder.EnableSnapshots();
                        }

                        string[] scopes = mConfiguration.Scopes;
                        for (int i = 0; i < scopes.Length; i++)
                        {
                            builder.AddOauthScope(scopes[i]);
                        }

                        if (mConfiguration.IsHidingPopups)
                        {
                            builder.SetShowConnectingPopup(false);
                        }

                        Debug.Log("Building GPG services, implicitly attempts silent auth");
                        mAuthState       = AuthState.SilentPending;
                        mServices        = builder.Build(config);
                        mEventsClient    = new NativeEventClient(new EventManager(mServices));
                        mQuestsClient    = new NativeQuestClient(new QuestManager(mServices));
                        mVideoClient     = new NativeVideoClient(new VideoManager(mServices));
                        mTurnBasedClient =
                            new NativeTurnBasedMultiplayerClient(this, new TurnBasedManager(mServices));

                        mTurnBasedClient.RegisterMatchDelegate(mConfiguration.MatchDelegate);

                        mRealTimeClient =
                            new NativeRealtimeMultiplayerClient(this, new RealtimeManager(mServices));

                        if (mConfiguration.EnableSavedGames)
                        {
                            mSavedGameClient =
                                new NativeSavedGameClient(new SnapshotManager(mServices));
                        }
                        else
                        {
                            mSavedGameClient = new UnsupportedSavedGamesClient(
                                "You must enable saved games before it can be used. " +
                                "See PlayGamesClientConfiguration.Builder.EnableSavedGames.");
                        }

                        mAuthState   = AuthState.SilentPending;
                        mTokenClient = clientImpl.CreateTokenClient(true);

                        if (!GameInfo.WebClientIdInitialized() &&
                            (mConfiguration.IsRequestingIdToken || mConfiguration.IsRequestingAuthCode))
                        {
                            OurUtils.Logger.e("Server Auth Code and ID Token require web clientId to configured.");
                        }
                        // Set the auth flags in the token client.
                        mTokenClient.SetWebClientId(GameInfo.WebClientId);
                        mTokenClient.SetRequestAuthCode(mConfiguration.IsRequestingAuthCode, mConfiguration.IsForcingRefresh);
                        mTokenClient.SetRequestEmail(mConfiguration.IsRequestingEmail);
                        mTokenClient.SetRequestIdToken(mConfiguration.IsRequestingIdToken);
                        mTokenClient.SetHidePopups(mConfiguration.IsHidingPopups);
                        mTokenClient.AddOauthScopes(scopes);
                        mTokenClient.SetAccountName(mConfiguration.AccountName);
                    }
                }
            }
        }
コード例 #6
0
ファイル: NativeClient.cs プロジェクト: ryan-ash/ld44-coin
        private void InitializeGameServices()
        {
            lock (GameServicesLock)
            {
                if (mServices != null)
                {
                    return;
                }

                using (var builder = GameServicesBuilder.Create())
                {
                    using (var config = clientImpl.CreatePlatformConfiguration(mConfiguration))
                    {
                        // We need to make sure that the invitation delegate
                        // is registered before the services object is
                        // initialized - otherwise we might miss a callback if
                        // the game was opened because of a user accepting an
                        // invitation through a system notification.
                        RegisterInvitationDelegate(mConfiguration.InvitationDelegate);
                        builder.SetOnAuthFinishedCallback(HandleAuthTransition);
                        builder.SetOnTurnBasedMatchEventCallback(
                            (eventType, matchId, match) =>
                            mTurnBasedClient.HandleMatchEvent(
                                eventType, matchId, match));
                        builder.SetOnMultiplayerInvitationEventCallback(
                            HandleInvitation);
                        if (mConfiguration.EnableSavedGames)
                        {
                            builder.EnableSnapshots();
                        }

                        string[] scopes = mConfiguration.Scopes;
                        for (int i = 0; i < scopes.Length; i++)
                        {
                            builder.AddOauthScope(scopes[i]);
                        }

                        if (mConfiguration.IsHidingPopups)
                        {
                            builder.SetShowConnectingPopup(false);
                        }

                        Debug.Log("Building GPG services, implicitly attempts silent auth");
                        mAuthState    = AuthState.SilentPending;
                        mServices     = builder.Build(config);
                        mEventsClient = new NativeEventClient(new EventManager(mServices));
#pragma warning disable 0618 // Warning CS0618  'IQuestMilestone' is obsolete: 'Quests are being removed in 2018.'
                        mQuestsClient = new NativeQuestClient(new QuestManager(mServices));
#pragma warning restore
                        mVideoClient     = new NativeVideoClient(new VideoManager(mServices));
                        mTurnBasedClient =
                            new NativeTurnBasedMultiplayerClient(this, new TurnBasedManager(mServices));

                        mTurnBasedClient.RegisterMatchDelegate(mConfiguration.MatchDelegate);

                        mRealTimeClient =
                            new NativeRealtimeMultiplayerClient(this, new RealtimeManager(mServices));

                        if (mConfiguration.EnableSavedGames)
                        {
                            mSavedGameClient =
                                new NativeSavedGameClient(new SnapshotManager(mServices));
                        }
                        else
                        {
                            mSavedGameClient = new UnsupportedSavedGamesClient(
                                "You must enable saved games before it can be used. " +
                                "See PlayGamesClientConfiguration.Builder.EnableSavedGames.");
                        }

                        mAuthState = AuthState.SilentPending;
                        InitializeTokenClient();
                    }
                }
            }
        }
コード例 #7
0
 private void InitializeGameServices()
 {
     lock (GameServicesLock)
     {
         if (mServices == null)
         {
             using (GameServicesBuilder gameServicesBuilder = GameServicesBuilder.Create())
             {
                 using (PlatformConfiguration configRef = clientImpl.CreatePlatformConfiguration(mConfiguration))
                 {
                     RegisterInvitationDelegate(mConfiguration.InvitationDelegate);
                     gameServicesBuilder.SetOnAuthFinishedCallback(HandleAuthTransition);
                     gameServicesBuilder.SetOnTurnBasedMatchEventCallback(delegate(Types.MultiplayerEvent eventType, string matchId, NativeTurnBasedMatch match)
                     {
                         mTurnBasedClient.HandleMatchEvent(eventType, matchId, match);
                     });
                     gameServicesBuilder.SetOnMultiplayerInvitationEventCallback(HandleInvitation);
                     if (mConfiguration.EnableSavedGames)
                     {
                         gameServicesBuilder.EnableSnapshots();
                     }
                     string[] scopes = mConfiguration.Scopes;
                     for (int i = 0; i < scopes.Length; i++)
                     {
                         gameServicesBuilder.AddOauthScope(scopes[i]);
                     }
                     if (mConfiguration.IsHidingPopups)
                     {
                         gameServicesBuilder.SetShowConnectingPopup(false);
                     }
                     Debug.Log((object)"Building GPG services, implicitly attempts silent auth");
                     mAuthState       = AuthState.SilentPending;
                     mServices        = gameServicesBuilder.Build(configRef);
                     mEventsClient    = new NativeEventClient(new GooglePlayGames.Native.PInvoke.EventManager(mServices));
                     mQuestsClient    = new NativeQuestClient(new GooglePlayGames.Native.PInvoke.QuestManager(mServices));
                     mVideoClient     = new NativeVideoClient(new GooglePlayGames.Native.PInvoke.VideoManager(mServices));
                     mTurnBasedClient = new NativeTurnBasedMultiplayerClient(this, new TurnBasedManager(mServices));
                     mTurnBasedClient.RegisterMatchDelegate(mConfiguration.MatchDelegate);
                     mRealTimeClient = new NativeRealtimeMultiplayerClient(this, new RealtimeManager(mServices));
                     if (mConfiguration.EnableSavedGames)
                     {
                         mSavedGameClient = new NativeSavedGameClient(new GooglePlayGames.Native.PInvoke.SnapshotManager(mServices));
                     }
                     else
                     {
                         mSavedGameClient = new UnsupportedSavedGamesClient("You must enable saved games before it can be used. See PlayGamesClientConfiguration.Builder.EnableSavedGames.");
                     }
                     mAuthState   = AuthState.SilentPending;
                     mTokenClient = clientImpl.CreateTokenClient(true);
                     if (!GameInfo.WebClientIdInitialized() && (mConfiguration.IsRequestingIdToken || mConfiguration.IsRequestingAuthCode))
                     {
                         Logger.e("Server Auth Code and ID Token require web clientId to configured.");
                     }
                     mTokenClient.SetWebClientId("683498632423-6p90updcgm6b67r4ucmhs82nkq1dc1mi.apps.googleusercontent.com");
                     mTokenClient.SetRequestAuthCode(mConfiguration.IsRequestingAuthCode, mConfiguration.IsForcingRefresh);
                     mTokenClient.SetRequestEmail(mConfiguration.IsRequestingEmail);
                     mTokenClient.SetRequestIdToken(mConfiguration.IsRequestingIdToken);
                     mTokenClient.SetHidePopups(mConfiguration.IsHidingPopups);
                     mTokenClient.AddOauthScopes(scopes);
                     mTokenClient.SetAccountName(mConfiguration.AccountName);
                 }
             }
         }
     }
 }