Example #1
0
        public PlatformConfiguration CreatePlatformConfiguration(PlayGamesClientConfiguration clientConfig)
        {
            AndroidPlatformConfiguration androidPlatformConfiguration = AndroidPlatformConfiguration.Create();
            AndroidJavaObject            activity = AndroidTokenClient.GetActivity();

            try
            {
                androidPlatformConfiguration.SetActivity(activity.GetRawObject());
                androidPlatformConfiguration.SetOptionalIntentHandlerForUI(delegate(IntPtr intent)
                {
                    IntPtr intentRef = AndroidJNI.NewGlobalRef(intent);
                    PlayGamesHelperObject.RunOnGameThread(delegate
                    {
                        try
                        {
                            LaunchBridgeIntent(intentRef);
                        }
                        finally
                        {
                            AndroidJNI.DeleteGlobalRef(intentRef);
                        }
                    });
                });
                if (!clientConfig.IsHidingPopups)
                {
                    return(androidPlatformConfiguration);
                }
                androidPlatformConfiguration.SetOptionalViewForPopups(CreateHiddenView(activity.GetRawObject()));
                return(androidPlatformConfiguration);
            }
            finally
            {
                ((IDisposable)activity)?.Dispose();
            }
        }
Example #2
0
 internal NativeClient(PlayGamesClientConfiguration configuration,
                       IClientImpl clientImpl)
 {
     PlayGamesHelperObject.CreateObject();
     this.mConfiguration = Misc.CheckNotNull(configuration);
     this.clientImpl     = clientImpl;
 }
 private PlayGamesPlatform(PlayGamesClientConfiguration configuration)
 {
     this.mIdMap = new Dictionary<string, string>();
     Logger.w("Creating new PlayGamesPlatform");
     this.mLocalUser = new PlayGamesLocalUser(this);
     this.mConfiguration = configuration;
 }
Example #4
0
 internal PlayGamesPlatform(IPlayGamesClient client)
 {
     this.mIdMap         = new Dictionary <string, string>();
     this.mClient        = Misc.CheckNotNull <IPlayGamesClient>(client);
     this.mLocalUser     = new PlayGamesLocalUser(this);
     this.mConfiguration = PlayGamesClientConfiguration.DefaultConfiguration;
 }
Example #5
0
        public PlatformConfiguration CreatePlatformConfiguration(PlayGamesClientConfiguration clientConfig)
        {
            var config = AndroidPlatformConfiguration.Create();
            using (var activity = AndroidTokenClient.GetActivity())
            {
                config.SetActivity(activity.GetRawObject());
                config.SetOptionalIntentHandlerForUI((intent) =>
                    {
                        // Capture a global reference to the intent we are to show. This is required
                        // since we are launching the intent from the game thread, and this callback
                        // will return before this happens. If we do not hold onto a durable reference,
                        // the code calling us will clean up the intent before we have a chance to display
                        // it.
                        IntPtr intentRef = AndroidJNI.NewGlobalRef(intent);

                        PlayGamesHelperObject.RunOnGameThread(() =>
                            {
                                try
                                {
                                    LaunchBridgeIntent(intentRef);
                                }
                                finally
                                {
                                    // Now that we've launched the intent, release the global reference.
                                    AndroidJNI.DeleteGlobalRef(intentRef);
                                }
                            });
                    });
                if (clientConfig.IsHidingPopups)
                {
                    config.SetOptionalViewForPopups(CreateHiddenView(activity.GetRawObject()));
                }
            }
            return config;
        }
Example #6
0
 public void Init()
 {
     config = new PlayGamesClientConfiguration.Builder().Build();
     PlayGamesPlatform.DebugLogEnabled = true;
     PlayGamesPlatform.InitializeInstance(config);
     PlayGamesPlatform.Activate();
 }
Example #7
0
        /// <summary>
        /// Initializes the service. This is required before any other actions can be done e.g reporting scores.
        /// During the initialization process, a login popup will show up if the user hasn't logged in, otherwise
        /// the process will carry on silently.
        /// Note that on iOS, the login popup will show up automatically when the app gets focus for the first 3 times
        /// while subsequent authentication calls will be ignored.
        /// </summary>
        public static void Init()
        {
            // Authenticate and register a ProcessAuthentication callback
            // This call needs to be made before we can proceed to other calls in the Social API
#if UNITY_IOS
            GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
            Social.localUser.Authenticate(ProcessAuthentication);

#if EASY_MOBILE_PRO && !UNITY_EDITOR
            // Register the default GKLocalPlayerListener for invitation delegate if Multiplayer is enabled.
            // EM Pro only.
            if (EM_Settings.GameServices.IsMultiplayerEnabled)
            {
                RegisterDefaultGKLocalPlayerListener();
            }
#endif
#elif UNITY_ANDROID && EM_GPGS
#if EASY_MOBILE_PRO
            PlayGamesClientConfiguration.Builder gpgsConfigBuilder = new PlayGamesClientConfiguration.Builder();

            // Enable Saved Games.
            if (EM_Settings.GameServices.IsSavedGamesEnabled)
            {
                gpgsConfigBuilder.EnableSavedGames();
            }

            // Register an internal invitation delegate and match delegate if Multiplayer is enabled.
            if (EM_Settings.GameServices.IsMultiplayerEnabled)
            {
                gpgsConfigBuilder.WithInvitationDelegate(OnGPGSInvitationReceived);
                gpgsConfigBuilder.WithMatchDelegate(OnGPGSTBMatchReceived);
            }

            // Build the config
            PlayGamesClientConfiguration gpgsConfig = gpgsConfigBuilder.Build();

            // Initialize PlayGamesPlatform
            PlayGamesPlatform.InitializeInstance(gpgsConfig);
#endif

            // Enable logging if required
            PlayGamesPlatform.DebugLogEnabled = EM_Settings.GameServices.GgpsDebugLogEnabled;

            // Set PlayGamesPlatforms as active
            if (Social.Active != PlayGamesPlatform.Instance)
            {
                PlayGamesPlatform.Activate();
            }

            // Now authenticate
            Social.localUser.Authenticate(ProcessAuthentication);
#elif UNITY_ANDROID && !EM_GPGS
            Debug.LogError("SDK missing. Please import Google Play Games plugin for Unity.");
#else
            Debug.Log("Failed to initialize Game Services module: platform not supported.");
#endif
        }
        public PlatformConfiguration CreatePlatformConfiguration(PlayGamesClientConfiguration clientConfig)
        {
            AndroidPlatformConfiguration configuration = AndroidPlatformConfiguration.Create();

            using (AndroidJavaObject obj2 = AndroidTokenClient.GetActivity())
            {
                configuration.SetActivity(obj2.GetRawObject());
                if (< > f__am$cache0 == null)
                {
Example #9
0
        public static void InitializeInstance(PlayGamesClientConfiguration configuration)
        {
            if (sInstance != null)
            {
                Logger.w("PlayGamesPlatform already initialized. Ignoring this call.");
                return;
            }

            sInstance = new PlayGamesPlatform(configuration);
        }
 internal static IPlayGamesClient GetPlatformPlayGamesClient(PlayGamesClientConfiguration config)
 {
     if (Application.isEditor)
     {
         Logger.d("Creating IPlayGamesClient in editor, using DummyClient.");
         return(new DummyClient());
     }
     Logger.d("Creating Android IPlayGamesClient Client");
     return(new NativeClient(config, new AndroidClient()));
 }
Example #11
0
 internal NativeClient(PlayGamesClientConfiguration configuration,
                       IClientImpl clientImpl)
 {
     PlayGamesHelperObject.CreateObject();
     this.mConfiguration = Misc.CheckNotNull(configuration);
     this.clientImpl     = clientImpl;
     this.rationale      = configuration.PermissionRationale;
     if (string.IsNullOrEmpty(this.rationale))
     {
         this.rationale = "Select email address to send to this game or hit cancel to not share.";
     }
 }
Example #12
0
 public SocialAndroid()
 {
     #if UNITY_ANDROID
     config = new PlayGamesClientConfiguration.Builder()
              .EnableSavedGames()
              .RequestEmail()
              .Build();
     PlayGamesPlatform.InitializeInstance(config);
     PlayGamesPlatform.DebugLogEnabled = true;
     playGamesPlatform = PlayGamesPlatform.Activate();
     //LeaderBoard
     #endif
 }
Example #13
0
    /// <summary>
    /// Initializes Google Play Service
    /// </summary>
    public void Init()
    {
        // Enables saving game progress.
        config = new PlayGamesClientConfiguration.Builder()
                 .EnableSavedGames()
                 .WithInvitationDelegate(GPMPController.GetInstance().OnInvitationReceived)
                 .Build();
        PlayGamesPlatform.InitializeInstance(config);

        PlayGamesPlatform.DebugLogEnabled = true;

        // Set Google Play Service as Social platform
        PlayGamesPlatform.Activate();

        isInitialized = true;
    }
        internal static IPlayGamesClient GetPlatformPlayGamesClient(
            PlayGamesClientConfiguration config)
        {
            if (Application.isEditor)
            {
                Logger.d("Creating IPlayGamesClient in editor, using DummyClient.");
                return(new GooglePlayGames.BasicApi.DummyClient());
            }
#if (UNITY_ANDROID || UNITY_IPHONE)
            Logger.d("Creating real IPlayGamesClient");
            return(new GooglePlayGames.Native.NativeClient(config));
#else
            Logger.d("Cannot create IPlayGamesClient for unknown platform, returning DummyClient");
            return(new GooglePlayGames.BasicApi.DummyClient());
#endif
        }
        internal static IPlayGamesClient GetPlatformPlayGamesClient(
            PlayGamesClientConfiguration config)
        {
            if (Application.isEditor)
            {
                GooglePlayGames.OurUtils.Logger.d("Creating IPlayGamesClient in editor, using DummyClient.");
                return(new GooglePlayGames.BasicApi.DummyClient());
            }
#if UNITY_ANDROID
            GooglePlayGames.OurUtils.Logger.d("Creating Android IPlayGamesClient Client");
            return(new GooglePlayGames.Android.AndroidClient(config));
#else
            GooglePlayGames.OurUtils.Logger.d("Cannot create IPlayGamesClient for unknown platform, returning DummyClient");
            return(new GooglePlayGames.BasicApi.DummyClient());
#endif
        }
Example #16
0
    void Start()
    {
        UnityInitializer.AttachToGameObject(this.gameObject);
        AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest;

        _playerInfo = SyncManager.OpenOrCreateDataset("Player1");

        _playerInfo.OnSyncSuccess += OnSyncSuccess;
        _playerInfo.OnSyncFailure += OnSyncFailed;

        PlayGamesClientConfiguration config = new PlayGamesClientConfiguration();

        if (!FB.IsInitialized)
        {
            FB.Init(() => { Debug.Log("Facebook Init successfully"); });
        }
    }
Example #17
0
        /// <summary>
        /// Google Play SDK 初始化
        /// </summary>
        /// <param name="initData">初始化参数</param>
        /// <param name="callback">初始化成功回调</param>
        public void InitializeSDK(object initData, Action <string, bool> callback)
        {
            EB.Debug.Log("GoogleSDKManager.InitializeSDK");
            clientConfig = new PlayGamesClientConfiguration.Builder().RequestServerAuthCode(false).RequestIdToken()
                           .Build();
            PlayGamesPlatform.InitializeInstance(clientConfig);
            PlayGamesPlatform.DebugLogEnabled = true;
            PlayGamesPlatform.Activate();

            //
            callback(null, true);

            mInitialized        = true;
            Hub.RunInBackground = false;
            mGoogleStore        = new GameObject("Google_SDK_listener").AddComponent <SparxGoogleSDKManagerMono>();
            EB.Debug.Log("GoogleSDKManager.InitializeSDK End");
        }
Example #18
0
        public PsdkSocialService(IPsdkServiceManager sm)
        {
                        #if UNITY_IPHONE
            UnityEngine.SocialPlatforms.GameCenter.GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
                        #endif
                        #if UNITY_ANDROID
            PlayGamesClientConfiguration.Builder configBuilder = new PlayGamesClientConfiguration.Builder();

            if (PSDKMgr.Instance.GetCrossDevicePersistency() != null)
            {
                configBuilder.AddOauthScope("https://www.googleapis.com/auth/drive.appdata");
                configBuilder.AddOauthScope("https://www.googleapis.com/auth/drive.file");
            }

            PlayGamesClientConfiguration config = configBuilder.Build();
            PlayGamesPlatform.InitializeInstance(config);
            PlayGamesPlatform.DebugLogEnabled = true;
            PlayGamesPlatform.Activate();
                        #endif
        }
Example #19
0
 internal static IPlayGamesClient GetPlatformPlayGamesClient(
     PlayGamesClientConfiguration config)
 {
     if (Application.isEditor)
     {
         Logger.d("Creating IPlayGamesClient in editor, using DummyClient.");
         return(new GooglePlayGames.BasicApi.DummyClient());
     }
     #if UNITY_ANDROID
     Logger.d("Creating Android IPlayGamesClient Client");
     return(new GooglePlayGames.Native.NativeClient(config,
                                                    new GooglePlayGames.Android.AndroidClient()));
     #elif (UNITY_IPHONE && !NO_GPGS)
     Logger.d("Creating IOS IPlayGamesClient");
     return(new GooglePlayGames.Native.NativeClient(config,
                                                    new GooglePlayGames.IOS.IOSClient()));
     #else
     Logger.d("Cannot create IPlayGamesClient for unknown platform, returning DummyClient");
     return(new GooglePlayGames.BasicApi.DummyClient());
     #endif
 }
Example #20
0
        /// <summary>
        /// Initializes the service. This is required before any other actions can be done e.g reporting scores.
        /// During the initialization process, a login popup will show up if the user hasn't logged in, otherwise
        /// the process will carry on silently.
        /// Note that on iOS, the login popup will show up automatically when the app gets focus for the first 3 times
        /// while subsequent authentication calls will be ignored.
        /// </summary>
        public static void Init()
        {
            // Authenticate and register a ProcessAuthentication callback
            // This call needs to be made before we can proceed to other calls in the Social API
            #if UNITY_IOS
            GameCenterPlatform.ShowDefaultAchievementCompletionBanner(true);
            Social.localUser.Authenticate(ProcessAuthentication);
            #elif UNITY_ANDROID && EM_GPGS
            #if EASY_MOBILE_PRO
            PlayGamesClientConfiguration.Builder gpgsConfigBuilder = new PlayGamesClientConfiguration.Builder();

            if (EM_Settings.GameServices.IsSavedGamesEnabled)
            {
                gpgsConfigBuilder.EnableSavedGames();
            }

            // Build the config
            PlayGamesClientConfiguration gpgsConfig = gpgsConfigBuilder.Build();

            // Initialize PlayGamesPlatform
            PlayGamesPlatform.InitializeInstance(gpgsConfig);
            #endif

            // Enable logging if required
            PlayGamesPlatform.DebugLogEnabled = EM_Settings.GameServices.IsGPGSDebug;

            // Set PlayGamesPlatforms as active
            if (Social.Active != PlayGamesPlatform.Instance)
            {
                PlayGamesPlatform.Activate();
            }

            // Now authenticate
            Social.localUser.Authenticate(ProcessAuthentication);
            #elif UNITY_ANDROID && !EM_GPGS
            Debug.LogError("SDK missing. Please import Google Play Games plugin for Unity.");
            #else
            Debug.Log("Failed to initialize Game Services module: platform not supported.");
            #endif
        }
Example #21
0
        internal void DoAuthenticate(SignInInteractivity interactivity, PlayGamesClientConfiguration configuration)
        {
            SetStandBy("Authenticating...");
            ClientConfiguration = configuration;
            PlayGamesPlatform.InitializeInstance(ClientConfiguration);
            PlayGamesPlatform.Activate();
            PlayGamesPlatform.Instance.Authenticate(interactivity, (code) =>
            {
                EndStandBy();
                if (code == SignInStatus.Success)
                {
                    Status = "Authenticated. Hello, " + Social.localUser.userName + " (" +
                             Social.localUser.id + ")";
                }
                else
                {
                    Status = "*** Failed to authenticate with " + code;
                }

                ShowEffect(code == SignInStatus.Success);
            });
        }
 private PlayGamesPlatform(PlayGamesClientConfiguration configuration)
 {
     Logger.w("Creating new PlayGamesPlatform");
     mLocalUser     = new PlayGamesLocalUser(this);
     mConfiguration = configuration;
 }
Example #23
0
 internal PlayGamesPlatform(IPlayGamesClient client)
 {
     this.mClient        = Misc.CheckNotNull(client);
     this.mLocalUser     = new PlayGamesLocalUser(this);
     this.mConfiguration = PlayGamesClientConfiguration.DefaultConfiguration;
 }
Example #24
0
 private PlayGamesPlatform(PlayGamesClientConfiguration configuration)
 {
     this.mLocalUser     = new PlayGamesLocalUser(this);
     this.mConfiguration = configuration;
 }
Example #25
0
 internal void DoAuthenticate(PlayGamesClientConfiguration configuration)
 {
     DoAuthenticate(SignInInteractivity.CanPromptAlways, configuration);
 }
 public NativeClient(PlayGamesClientConfiguration configuration)
 {
     PlayGamesHelperObject.CreateObject();
     this.mConfiguration = Misc.CheckNotNull(configuration);
 }
Example #27
0
        private readonly int mLeaderboardMaxResults = 25; // can be from 1 to 25

        internal AndroidClient(PlayGamesClientConfiguration configuration)
        {
            PlayGamesHelperObject.CreateObject();
            this.mConfiguration = Misc.CheckNotNull(configuration);
            RegisterInvitationDelegate(configuration.InvitationDelegate);
        }
Example #28
0
 public PlatformConfiguration CreatePlatformConfiguration(PlayGamesClientConfiguration clientConfig)
 {
     return(CreatePlatformConfiguration());
 }