Esempio 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();
             }
         }
     }
 }
Esempio n. 2
0
    public void OpenSavedGame(string filename)
    {
        ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;

        savedGameClient.OpenWithAutomaticConflictResolution(filename, DataSource.ReadCacheOrNetwork,
                                                            ConflictResolutionStrategy.UseLastKnownGood, OnSavedGameOpened);
    }
    public void ShowSaveSelectUI()
    {
#if UNITY_ANDROID
        if (!Social.localUser.authenticated)
        {
            UIManager.Instance.Set_Google_Txt();
            UIManager.Instance.PushPopup(UIManager.Instance.GooglePopup);
        }
        else
        {
            UIManager.Instance.Set_Google_Txt();

            uint maxNumToDisplay = 5;
            bool allowCreateNew  = true;
            bool allowDelete     = true;

            ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;
            savedGameClient.ShowSelectSavedGameUI("Select saved game",
                                                  maxNumToDisplay,
                                                  allowCreateNew,
                                                  allowDelete,
                                                  OnSavedGameSelected);
        }
#else
#endif
    }
Esempio n. 4
0
    private static void LoadFromGooglePlay(ISavedGameMetadata game)
    {
        // Debug.Log("LoadfromGP");
        ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;

        savedGameClient.ReadBinaryData(game, OnSavedGameDataRead);
    }
Esempio n. 5
0
    static public void SaveGame(ISavedGameMetadata game, byte[] savedData, TimeSpan totalPlaytime, Action <SavedGameRequestStatus, ISavedGameMetadata> onSavedGameWritten, string description = "")
    {
        ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;

        if (string.IsNullOrEmpty(description))
        {
            description = "Saved at " + DateTime.Now;
        }

        SavedGameMetadataUpdate.Builder builder = new SavedGameMetadataUpdate.Builder();
        builder = builder
                  .WithUpdatedPlayedTime(totalPlaytime)
                  .WithUpdatedDescription(description);

        SavedGameMetadataUpdate updatedMetadata = builder.Build();

        savedGameClient.CommitUpdate(game, updatedMetadata, savedData, (status, data) =>
        {
            if (status != SavedGameRequestStatus.Success)
            {
                PlayerLoggedIn = false;
            }

            if (onSavedGameWritten != null)
            {
                onSavedGameWritten.Invoke(status, data);
            }
        });
    }
Esempio n. 6
0
    //데이터 읽기를 시도합니다.
    static void LoadGameData(ISavedGameMetadata game)
    {
#if UNITY_ANDROID && !UNITY_EDITOR
        ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;
        savedGameClient.ReadBinaryData(game, OnSavedGameDataRead);
#endif
    }
Esempio n. 7
0
    public void OpenSavedGame(string filename, bool isLoad = false, LoadDelegate loadFailCB = null)
    {
        _loadFailCallback = loadFailCB;

        if (!bLogin)
        {
            LoginGPGS();
        }

        if (bLogin)
        {
            ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;

            if (isLoad)
            {
                savedGameClient.OpenWithAutomaticConflictResolution(filename, DataSource.ReadCacheOrNetwork,
                                                                    ConflictResolutionStrategy.UseLongestPlaytime, OnSavedGameOpenedForLoad);
            }
            else // is Save
            {
                savedGameClient.OpenWithAutomaticConflictResolution(filename, DataSource.ReadCacheOrNetwork,
                                                                    ConflictResolutionStrategy.UseLongestPlaytime, OnSavedGameOpenedForSave);
            }
        }
        else if (isLoad && loadFailCB != null)
        {
            LoadRoutineEndCallBack(success: false);
        }
    }
Esempio n. 8
0
    void WriteSaveGameData(ISavedGameMetadata game)
    {
        try
        {
            ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;

            SavedGameMetadataUpdate.Builder builder = new SavedGameMetadataUpdate.Builder();
            builder = builder
                      .WithUpdatedPlayedTime(game.TotalTimePlayed)
                      .WithUpdatedDescription("Saved game at " + DateTime.Now);

            SavedGameMetadataUpdate updatedMetadata = builder.Build();

            SaveData saveData = new SaveData
            {
                CountCoins       = PlayerPrefs.GetInt(VariablesSaveOnPlayerPrefs.CountCollectedCoins),
                CurrentLevel     = PlayerPrefs.GetInt(VariablesSaveOnPlayerPrefs.CurrentLevel),
                TimeSession      = PlayerPrefs.GetInt(VariablesSaveOnPlayerPrefs.MaxTimeGameSession),
                CountKillEnemies = PlayerPrefs.GetInt(VariablesSaveOnPlayerPrefs.CountKillEnemies),
                HighScore        = PlayerPrefs.GetInt(VariablesSaveOnPlayerPrefs.HighScore)
            };

            string json = JsonUtility.ToJson(saveData);
            savedGameClient.CommitUpdate(game, updatedMetadata, JsonStringToByteArray(json), OnSavedGameWritten);
        }
        catch (Exception e)
        {
            Debug.Log(e);
        }
    }
Esempio n. 9
0
    //displays savefiles in the cloud. This will only include one savefile if the m_saveName hasn't been changed
    private void ShowSaveSystemUI(ILocalUser user, Action <SelectUIStatus, ISavedGameMetadata> callback)
    {
        uint maxNumToDisplay = 3;
        bool allowCreateNew  = true;
        bool allowDelete     = true;

        ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;

        if (savedGameClient != null)
        {
            savedGameClient.ShowSelectSavedGameUI(user.userName + "\u0027s saves",
                                                  maxNumToDisplay,
                                                  allowCreateNew,
                                                  allowDelete,
                                                  (SelectUIStatus status, ISavedGameMetadata saveGame) => {
                // some error occured, just show window again
                if (status != SelectUIStatus.SavedGameSelected)
                {
                    ShowSaveSystemUI(user, callback);
                    return;
                }

                if (callback != null)
                {
                    callback.Invoke(status, saveGame);
                }
            });
        }
        else
        {
            // this is usually due to incorrect APP ID
            Debug.LogError("Save Game client is null...");
        }
    }
Esempio n. 10
0
    public static PlayerData LoadData()
    {
        Debug.Log("path: " + Application.persistentDataPath);
        saving = false;
        if (PlayGamesPlatform.Instance.IsAuthenticated())
        {
            //  Debug.Log("Try to load from GP");
            ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;

            savedGameClient.OpenWithAutomaticConflictResolution(saveName, DataSource.ReadCacheOrNetwork,
                                                                ConflictResolutionStrategy.UseLongestPlaytime, OnSavedGameOpened);
        }
        if (loadedData == null)
        {
            return(LoadLocal());
        }
        else
        {
            if (String.IsNullOrEmpty(loadedData.playerName))
            {
                PhotonNetwork.NickName = PlayGamesPlatform.Instance.GetUserId();
            }
        }
        return(loadedData);
    }
Esempio n. 11
0
    public void SavePlayerDataCloud(SavedGameRequestStatus status, ISavedGameMetadata meta)
    {
        if (status == SavedGameRequestStatus.Success)
        {
            if (isSaving)
            {
                ISavedGameClient savedGameClient        = PlayGamesPlatform.Instance.SavedGame;
                SavedGameMetadataUpdate.Builder builder = new SavedGameMetadataUpdate.Builder();
                builder = builder
                          .WithUpdatedPlayedTime(meta.TotalTimePlayed.Add(new TimeSpan(0, 0, (int)Time.realtimeSinceStartup)));
                SavedGameMetadataUpdate update = builder.Build();

                savedGameClient.CommitUpdate(meta, update, ObjectToByteArray(GameManager.singleton.playerData), SaveUpdate);
            }
            else
            {
                ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;
                savedGameClient.ReadBinaryData(meta, SaveReadPlayerData);
            }
        }
        else
        {
            Debug.Log("Not succeed! Save Player Data Cloud!");
        }
    }
Esempio n. 12
0
    void OpenSavedGameForLoad(string filename)
    {
        ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;

        savedGameClient.OpenWithAutomaticConflictResolution(filename, DataSource.ReadCacheOrNetwork,
                                                            ConflictResolutionStrategy.UseLongestPlaytime, LoadGameData);
    }
Esempio n. 13
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);
                    }
                }
            }
        }
 public void Read()
 {
     System.Action action = () =>
     {
         ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;
         savedGameClient.OpenWithAutomaticConflictResolution(Globals.GetFilename <GameData>(), DataSource.ReadCacheOrNetwork, ConflictResolutionStrategy.UseMostRecentlySaved,
                                                             (status, game) =>
         {
             if (status == SavedGameRequestStatus.Success)
             {
                 savedGameClient.ReadBinaryData(game, (s, b) =>
                 {
                     if (s == SavedGameRequestStatus.Success)
                     {
                         Extensions.Log(GetType(), $"Google Play reading completed. Status: {s}; Filename: {game.Filename}; Description: {game.Description};");
                         var value = b.Deserialize <GameData>();
                         OnSavedGameRead(new SavedGameEventArgs(value));
                     }
                     else
                     {
                         Extensions.Log(GetType(), $"Google Play reading failed. Status: {s};");
                     }
                 });
             }
             else
             {
                 Extensions.Log(GetType(), $"Couldn't open saved game. Status: {status};");
             }
         });
     };
     PerformAction(action);
 }
 public void Write(GameData value)
 {
     System.Action action = () =>
     {
         ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;
         savedGameClient.OpenWithAutomaticConflictResolution(Globals.GetFilename <GameData>(), DataSource.ReadCacheOrNetwork, ConflictResolutionStrategy.UseMostRecentlySaved,
                                                             (status, game) =>
         {
             if (status == SavedGameRequestStatus.Success)
             {
                 byte[] binaryData = value.Serialize();
                 SavedGameMetadataUpdate.Builder builder = new SavedGameMetadataUpdate.Builder();
                 builder = builder.WithUpdatedDescription($"Saved at {DateTime.Now}");
                 SavedGameMetadataUpdate updatedMetadata = builder.Build();
                 savedGameClient.CommitUpdate(game, updatedMetadata, binaryData, (s, g) =>
                 {
                     if (s == SavedGameRequestStatus.Success)
                     {
                         Extensions.Log(GetType(), $"Google Play writing completed. Status: {s}; Filename: {g.Filename}; Description: {g.Description};");
                     }
                     else
                     {
                         Extensions.Log(GetType(), $"Google Play writing failed. Status: {s};");
                     }
                 });
             }
             else
             {
                 Extensions.Log(GetType(), $"Couldn't open saved game. Status: {status};");
             }
         });
     };
     PerformAction(action);
 }
Esempio n. 16
0
    public static void OpenSavedGame(string filename, Action <SavedGameRequestStatus, ISavedGameMetadata> callback)
    {
        ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;

        savedGameClient.OpenWithAutomaticConflictResolution(filename, DataSource.ReadCacheOrNetwork,
                                                            ConflictResolutionStrategy.UseLongestPlaytime, callback);
    }
Esempio n. 17
0
    public void SaveGame(ISavedGameMetadata game, byte[] savedData, TimeSpan totalPlaytime)
    {
        ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;

        SavedGameMetadataUpdate.Builder builder = new SavedGameMetadataUpdate.Builder();
        builder = builder
                  .WithUpdatedPlayedTime(totalPlaytime)
                  .WithUpdatedDescription("Saved game at " + DateTime.Now);

        // my customization
        Texture2D savedImage = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>().saveGameImage;

        // end my customization

        if (savedImage != null)
        {
            // This assumes that savedImage is an instance of Texture2D
            // and that you have already called a function equivalent to
            // getScreenshot() to set savedImage
            // NOTE: see sample definition of getScreenshot() method below
            byte[] pngData = savedImage.EncodeToPNG();
            builder = builder.WithUpdatedPngCoverImage(pngData);
        }
        SavedGameMetadataUpdate updatedMetadata = builder.Build();

        savedGameClient.CommitUpdate(game, updatedMetadata, savedData, OnSavedGameWritten);
    }
    public void LoadGameData(ISavedGameMetadata _data)
    {
#if UNITY_ANDROID
        ISavedGameClient savedGame = PlayGamesPlatform.Instance.SavedGame;

        savedGame.ReadBinaryData(_data, OnSacedGameRead);
#endif
    }
Esempio n. 19
0
    /// <summary>
    /// Load savegame data from Google Play Service
    /// </summary>
    /// <param name="game"></param>
    public void LoadGameData(ISavedGameMetadata game)
    {
        isLoading = false;
        Debug.Log(DEBUG_KEY + "Read save binary");
        ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;

        savedGameClient.ReadBinaryData(game, OnSavedGameDataRead);
    }
Esempio n. 20
0
        static void OpenSavedGame(string filename)
        {
            Debug.Log("Name " + filename);
            ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;

            savedGameClient.OpenWithAutomaticConflictResolution(filename, DataSource.ReadCacheOrNetwork,
                                                                ConflictResolutionStrategy.UseLongestPlaytime, OnSavedGameOpened);
        }
Esempio n. 21
0
    /// <summary>
    /// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///
    ///     DELETE GAME SAVE
    ///
    /// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// </summary>

    /// Delete Game Data
    void DeleteGameData(string filename)
    {
        // Open the file to get the metadata.
        ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;

        savedGameClient.OpenWithAutomaticConflictResolution(filename, DataSource.ReadCacheOrNetwork,
                                                            ConflictResolutionStrategy.UseLongestPlaytime, DeleteSavedGame);
    }
Esempio n. 22
0
        private void WriteGame(ISavedGameMetadata game, byte[] savedData)
        {
            ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;

            SavedGameMetadataUpdate.Builder builder = new SavedGameMetadataUpdate.Builder();
            builder = builder.WithUpdatedDescription("Saved game at " + System.DateTime.Now);
            SavedGameMetadataUpdate updatedMetadata = builder.Build();
            savedGameClient.CommitUpdate(game, updatedMetadata, savedData, OnSavedGameWritten);
        }
Esempio n. 23
0
    //wczytywanie stanu gry z migawki
    #region LoadGameState
    void LoadGameData(ISavedGameMetadata game)
    {
        ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;

        savedGameClient.ReadBinaryData(
            game,
            OnSavedGameDataRead // callback
            );
    }
Esempio n. 24
0
        private static void ReadSavedGame(string filename)
        {
            ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;

            savedGameClient.OpenWithAutomaticConflictResolution(
                filename,
                DataSource.ReadCacheOrNetwork,
                ConflictResolutionStrategy.UseLongestPlaytime,
                OnReadSavedGamesComplete);
        }
Esempio n. 25
0
    public void WriteSaveGame(ISavedGameMetadata game, byte[] saveData, Action <SavedGameRequestStatus, ISavedGameMetadata> callback)
    {
        if (m_bLogin)
        {
            SavedGameMetadataUpdate updateMetData = new SavedGameMetadataUpdate.Builder().WithUpdatedPlayedTime(TimeSpan.FromMinutes(game.TotalTimePlayed.Minutes + 1)).WithUpdatedDescription("Save at : " + DateTime.Now).Build();

            ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;
            savedGameClient.CommitUpdate(game, updateMetData, saveData, callback);
        }
    }
Esempio n. 26
0
    /*
     * Shows the saved game interface.
     * */
    public void showSavedGame()
    {
        uint maxNumToDisplay = 5;
        bool allowCreateNew  = false;
        bool allowDelete     = true;

        ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;

        savedGameClient.ShowSelectSavedGameUI("Select Saved Game", maxNumToDisplay, allowCreateNew, allowDelete, OnSavedGameSelected);
    }
    //Load From Cloud Saved Data
    private void ReadSavedGame(string filename,
                               Action <SavedGameRequestStatus, ISavedGameMetadata> callback)
    {
        ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;

        savedGameClient.OpenWithAutomaticConflictResolution(filename,
                                                            DataSource.ReadNetworkOnly, //キャッシュは読まない
                                                            ConflictResolutionStrategy.UseLongestPlaytime,
                                                            callback);
    }
Esempio n. 28
0
    void DeleteSavedGame(string filename)
    {
        ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;

        savedGameClient.OpenWithManualConflictResolution(
            filename,
            DataSource.ReadCacheOrNetwork, true,
            ResolveConflict,
            OnDeleteSavedGame);
    }
        private void OpenSavedGame(string saveId, Action <SavedGameRequestStatus, ISavedGameMetadata> onSavedGameOpened)
        {
            ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;

            savedGameClient.OpenWithAutomaticConflictResolution(
                saveId,
                DataSource.ReadCacheOrNetwork,
                ConflictResolutionStrategy.UseLongestPlaytime,
                onSavedGameOpened
                );
        }
Esempio n. 30
0
 public static void Auth(Action <bool> onAuth)
 {
     Social.localUser.Authenticate((success) =>
     {
         if (success)
         {
             savedGameClient = PlayGamesPlatform.Instance.SavedGame;
         }
         onAuth(success);
     });
 }
Esempio n. 31
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;
                }
            }
        }
    }