Ejemplo n.º 1
0
        public PlatformConfiguration CreatePlatformConfiguration()
        {
            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.
                    var intentRef = AndroidJNI.NewGlobalRef(intent);

                    PlayGamesHelperObject.RunOnGameThread(() =>
                    {
                        try
                        {
                            LaunchBridgeIntent(intentRef);
                        }
                        finally
                        {
                            // Now that we've launched the intent, release the global reference.
                            AndroidJNI.DeleteGlobalRef(intentRef);
                        }
                    });
                });
            }

            return(config);
        }
Ejemplo n.º 2
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();
            }
        }
Ejemplo n.º 3
0
        public PlatformConfiguration CreatePlatformConfiguration()
        {
            AndroidPlatformConfiguration configuration = AndroidPlatformConfiguration.Create();

            using (AndroidJavaObject obj2 = AndroidTokenClient.GetActivity())
            {
                configuration.SetActivity(obj2.GetRawObject());
                if (< > f__am$cache1 == null)
                {
        internal static PlatformConfiguration CreatePlatformConfiguration()
        {
            #if UNITY_ANDROID
            var config = AndroidPlatformConfiguration.Create();
            config.EnableAppState();
            using (var activity = 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);
                        }
                    });
                });
            }

            return(config);
            #endif

            #if UNITY_IPHONE
            if (!GameInfo.IosClientIdInitialized())
            {
                throw new System.InvalidOperationException("Could not locate the OAuth Client ID, " +
                                                           "provide this by navigating to Google Play Games > iOS Setup");
            }

            if (GameInfo.WebClientIdInitialized())
            {
                _GooglePlayEnableProfileScope();
            }

            var config = IosPlatformConfiguration.Create();
            config.SetClientId(GameInfo.IosClientId);
            return(config);
            #endif
        }
Ejemplo n.º 5
0
        public PlatformConfiguration CreatePlatformConfiguration()
        {
            AndroidPlatformConfiguration platformConfiguration = AndroidPlatformConfiguration.Create();

            platformConfiguration.EnableAppState();
            using (AndroidJavaObject activity = AndroidTokenClient.GetActivity())
            {
                platformConfiguration.SetActivity(activity.GetRawObject());
                // ISSUE: object of a compiler-generated type is created
                // ISSUE: reference to a compiler-generated method
                platformConfiguration.SetOptionalIntentHandlerForUI((Action <IntPtr>)(intent => PlayGamesHelperObject.RunOnGameThread(new Action(new AndroidClient.\u003CCreatePlatformConfiguration\u003Ec__AnonStorey100()
                {
                    intentRef = AndroidJNI.NewGlobalRef(intent)
                }.\u003C\u003Em__D))));
            }
            return((PlatformConfiguration)platformConfiguration);
        }