Exemplo n.º 1
0
 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();
             }
         }
     }
 }
Exemplo n.º 2
0
 internal LeaderboardManager(GameServices services)
 {
     mServices = bubble.CheckNotNull(services);
 }
Exemplo n.º 3
0
 internal RealtimeManager(GameServices gameServices) {
     this.mGameServices = Misc.CheckNotNull(gameServices);
 }
Exemplo n.º 4
0
 internal PlayerManager(GameServices services)
 {
     this.mGameServices = Misc.CheckNotNull <GameServices>(services);
 }
Exemplo n.º 5
0
 internal PlayerManager (GameServices services) {
     mGameServices = Misc.CheckNotNull(services);
 }
Exemplo n.º 6
0
 internal SnapshotManager(GameServices services)
 {
     this.mServices = Misc.CheckNotNull <GameServices>(services);
 }
 internal SnapshotManager(GameServices services)
 {
     mServices = Misc.CheckNotNull(services);
 }
Exemplo n.º 8
0
    private void InitializeGameServices() {
        lock (GameServicesLock) {
            if (mServices != null) {
                return;
            }

            using (var builder = GameServicesBuilder.Create()) {
                using (var config = CreatePlatformConfiguration(builder)) {
                    builder.SetOnAuthFinishedCallback(HandleAuthTransition);
                    builder.SetOnTurnBasedMatchEventCallback((eventType, matchId, match)
                        => mTurnBasedClient.HandleMatchEvent(eventType, matchId, match));
                    builder.SetOnMultiplayerInvitationEventCallback(HandleInvitation);
                    mServices = builder.Build(config);
                    mTurnBasedClient =
                        new NativeTurnBasedMultiplayerClient(this, new TurnBasedManager(mServices));
                    mRealTimeClient =
                        new NativeRealtimeMultiplayerClient(this, new RealtimeManager(mServices));
                    mAppStateClient = CreateAppStateClient();
                    mAuthState = AuthState.SilentPending;
                }
            }
        }
    }
Exemplo n.º 9
0
 internal VideoManager(GameServices services)
 {
     this.mServices = Misc.CheckNotNull <GameServices>(services);
 }
Exemplo n.º 10
0
 internal void StartAuthorizationUI()
 {
     GameServices.GameServices_StartAuthorizationUI(base.SelfPtr());
 }
Exemplo n.º 11
0
 internal void SignOut()
 {
     GameServices.GameServices_SignOut(base.SelfPtr());
 }
Exemplo n.º 12
0
 internal bool IsAuthenticated() =>
 GameServices.GameServices_IsAuthorized(base.SelfPtr());
Exemplo n.º 13
0
 protected override void CallDispose(HandleRef selfPointer)
 {
     GameServices.GameServices_Dispose(selfPointer);
 }
Exemplo n.º 14
0
 internal AchievementManager(GameServices services)
 {
     this.mServices = Misc.CheckNotNull <GameServices>(services);
 }
Exemplo n.º 15
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);
                 }
             }
         }
     }
 }
Exemplo n.º 16
0
 internal QuestManager(GameServices services)
 {
     mServices = Misc.CheckNotNull(services);
 }
Exemplo n.º 17
0
 internal LeaderboardManager(GameServices services)
 {
     mServices = Misc.CheckNotNull(services);
 }
Exemplo n.º 18
0
 internal VideoManager(GameServices services)
 {
     mServices = Misc.CheckNotNull(services);
 }
Exemplo n.º 19
0
 internal EventManager(GameServices services)
 {
     mServices = bubble.CheckNotNull(services);
 }
Exemplo n.º 20
0
 internal TurnBasedManager(GameServices services)
 {
     this.mGameServices = services;
 }
 internal QuestManager(GameServices services)
 {
     mServices = Misc.CheckNotNull(services);
 }
Exemplo n.º 22
0
 internal StatsManager(GameServices services)
 {
     mServices = Misc.CheckNotNull(services);
 }
Exemplo n.º 23
0
 internal OnStateResultProxy(GameServices services, OnStateLoadedListener listener)
     : base(ResultCallbackClassname) {
     mServices = Misc.CheckNotNull(services);
     mListener = listener;
 }
Exemplo n.º 24
0
    private void InitializeGameServices() {
        lock (GameServicesLock) {
            if (mServices != null) {
                return;
            }

            using (var builder = GameServicesBuilder.Create()) {
                using (var config = CreatePlatformConfiguration(builder)) {
                    // 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);
                    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;
                }
            }
        }
    }
Exemplo n.º 25
0
 internal AndroidAppStateClient(GameServices services) {
     mServices = Misc.CheckNotNull(services);
 }
Exemplo n.º 26
0
 internal AchievementManager(GameServices services)
 {
     mServices = Misc.CheckNotNull(services);
 }
Exemplo n.º 27
0
 private static AndroidJavaObject GetApiClient(GameServices services) {
     return JavaUtils.JavaObjectFromPointer(C.InternalHooks_GetApiClient(services.AsHandle()));
 }
Exemplo n.º 28
0
 internal SnapshotManager(GameServices services) {
     mServices = Misc.CheckNotNull(services);
 }
Exemplo n.º 29
0
 internal LeaderboardManager(GameServices services)
 {
     this.mServices = Misc.CheckNotNull <GameServices>(services);
 }
Exemplo n.º 30
0
 internal RealtimeManager(GameServices gameServices)
 {
     this.mGameServices = Misc.CheckNotNull(gameServices);
 }
Exemplo n.º 31
0
 internal PlayerManager(GameServices services)
 {
     mGameServices = Misc.CheckNotNull(services);
 }