예제 #1
0
 // Invoke an instance method with an default value for a named argument.
 static bool TestInvokeInstanceMethodWithNamedArgDefault()
 {
     return(CheckValue("Hello There Helen, my name is Sam",
                       (string)VersionHandler.InvokeInstanceMethod(
                           new Greeter("Sam"), "HelloWithCustomerNameAndPronoun",
                           new object[] { "Helen" }, null)));
 }
예제 #2
0
 // Invoke an instance method with a named argument.
 static bool TestInvokeInstanceMethodWithNamedArg()
 {
     return(CheckValue("Hello Mrs Smith, my name is Sam",
                       (string)VersionHandler.InvokeInstanceMethod(
                           new Greeter("Sam"), "HelloWithCustomerNameAndPronoun",
                           new object[] { "Smith" },
                           new Dictionary <string, object> {
         { "pronoun", "Mrs" }
     })));
 }
예제 #3
0
 // Invoke an instance method with no args.
 static bool TestInvokeInstanceMethodWithNoArgs()
 {
     return(CheckValue("Hello, my name is Sam",
                       (string)VersionHandler.InvokeInstanceMethod(new Greeter("Sam"), "Hello",
                                                                   null, null)));
 }
예제 #4
0
        /// <summary>
        /// Registers the dependencies.
        /// </summary>
        public static void RegisterDependencies()
        {
            // Setup the resolver using reflection as the module may not be
            // available at compile time.
            Type playServicesSupport = VersionHandler.FindClass(
                "Google.JarResolver", "Google.JarResolver.PlayServicesSupport");

            if (playServicesSupport == null)
            {
                return;
            }

            if (svcSupport == null)
            {
                svcSupport = (PlayServicesSupport)VersionHandler.InvokeStaticMethod(
                    playServicesSupport, "CreateInstance",
                    new object[]
                {
                    "GooglePlayGames",
                    EditorPrefs.GetString("AndroidSdkRoot"),
                    "ProjectSettings"
                });
            }

            VersionHandler.InvokeInstanceMethod(
                svcSupport, "DependOn",
                new object[]
            {
                "com.google.android.gms", "play-services-games",
                PluginVersion.PlayServicesVersionConstraint
            },
                new Dictionary <string, object>
            {
                { "packageIds", new[] { "extra-google-m2repository" } }
            });

            VersionHandler.InvokeInstanceMethod(
                svcSupport, "DependOn",
                new object[]
            {
                "com.google.android.gms", "play-services-nearby",
                PluginVersion.PlayServicesVersionConstraint
            },
                new Dictionary <string, object>
            {
                { "packageIds", new[] { "extra-google-m2repository" } }
            });

            // Auth is needed for getting the token and email.
            VersionHandler.InvokeInstanceMethod(
                svcSupport, "DependOn",
                new object[]
            {
                "com.google.android.gms", "play-services-auth",
                PluginVersion.PlayServicesVersionConstraint
            },
                new Dictionary <string, object>
            {
                { "packageIds", new[] { "extra-google-m2repository" } }
            });

            // if google+ is needed, add it
            if (GameInfo.RequireGooglePlus())
            {
                VersionHandler.InvokeInstanceMethod(
                    svcSupport, "DependOn",
                    new object[]
                {
                    "com.google.android.gms", "play-services-plus",
                    PluginVersion.PlayServicesVersionConstraint
                },
                    new Dictionary <string, object>
                {
                    { "packageIds", new[] { "extra-google-m2repository" } }
                });
            }

            VersionHandler.InvokeInstanceMethod(
                svcSupport, "DependOn",
                new object[] { "com.android.support", "support-v4", "23.1+" },
                new Dictionary <string, object>
            {
                { "packageIds", new[] { "extra-android-m2repository" } }
            });
        }