Exemplo n.º 1
0
        private static JavaScriptContext CreateHostContext(JavaScriptRuntime runtime, string[] arguments, int argumentsStart)
        {
            //
            // Create the context. Note that if we had wanted to start debugging from the very
            // beginning, we would have passed in an IDebugApplication pointer here.
            //

            JavaScriptContext context = runtime.CreateContext();

            //
            // Now set the execution context as being the current one on this thread.
            //

            using (new JavaScriptContext.Scope(context))
            {
                //
                // Create the host object the script will use.
                //

                JavaScriptValue hostObject = JavaScriptValue.CreateObject();

                //
                // Get the global object
                //

                JavaScriptValue globalObject = JavaScriptValue.GlobalObject;

                //
                // Get the name of the property ("host") that we're going to set on the global object.
                //

                JavaScriptPropertyId hostPropertyId = JavaScriptPropertyId.FromString("host");

                //
                // Set the property.
                //

                globalObject.SetProperty(hostPropertyId, hostObject, true);

                //
                // Now create the host callbacks that we're going to expose to the script.
                //

                DefineHostCallback(hostObject, "echo", echoDelegate, IntPtr.Zero);
                DefineHostCallback(hostObject, "runScript", runScriptDelegate, IntPtr.Zero);

                //
                // Create an array for arguments.
                //

                JavaScriptValue hostArguments = JavaScriptValue.CreateArray((uint)(arguments.Length - argumentsStart));

                for (int index = argumentsStart; index < arguments.Length; index++)
                {
                    //
                    // Create the argument value.
                    //

                    JavaScriptValue argument = JavaScriptValue.FromString(arguments[index]);

                    //
                    // Create the index.
                    //

                    JavaScriptValue indexValue = JavaScriptValue.FromInt32(index - argumentsStart);

                    //
                    // Set the value.
                    //

                    hostArguments.SetIndexedProperty(indexValue, argument);
                }

                //
                // Get the name of the property that we're going to set on the host object.
                //

                JavaScriptPropertyId argumentsPropertyId = JavaScriptPropertyId.FromString("arguments");

                //
                // Set the arguments property.
                //

                hostObject.SetProperty(argumentsPropertyId, hostArguments, true);
            }

            return(context);
        }
Exemplo n.º 2
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue PlayerControllerPrototype;
            JavaScriptValue PlayerControllerConstructor = Bridge.CreateConstructor(
                typeof(UnityEngine.Networking.PlayerController),
                (args) => { throw new NotImplementedException(); },
                out PlayerControllerPrototype
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("UnityEngine")
            .GetProperty("Networking")
            .SetProperty("PlayerController", PlayerControllerConstructor);


            // Static Fields

            PlayerControllerConstructor.SetProperty(
                "MaxPlayersPerClient",
                JavaScriptValue.FromInt32(UnityEngine.Networking.PlayerController.MaxPlayersPerClient)
                );


            // Static Property Accessors


            // Static Methods


            // Instance Fields

            Bridge.DefineGetterSetter(
                PlayerControllerPrototype,
                "playerControllerId",
                WithExternal <UnityEngine.Networking.PlayerController>((o, args) => Bridge.CreateExternalWithPrototype(o.playerControllerId)),
                WithExternal <UnityEngine.Networking.PlayerController>((o, args) => { o.playerControllerId = Bridge.GetExternal <System.Int16>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                PlayerControllerPrototype,
                "unetView",
                WithExternal <UnityEngine.Networking.PlayerController>((o, args) => Bridge.CreateExternalWithPrototype(o.unetView)),
                WithExternal <UnityEngine.Networking.PlayerController>((o, args) => { o.unetView = Bridge.GetExternal <UnityEngine.Networking.NetworkIdentity>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                PlayerControllerPrototype,
                "gameObject",
                WithExternal <UnityEngine.Networking.PlayerController>((o, args) => Bridge.CreateExternalWithPrototype(o.gameObject)),
                WithExternal <UnityEngine.Networking.PlayerController>((o, args) => { o.gameObject = Bridge.GetExternal <UnityEngine.GameObject>(args[1]); })
                );


            // Instance Property Accessors

            Bridge.DefineGetter(
                PlayerControllerPrototype,
                "IsValid",
                WithExternal <UnityEngine.Networking.PlayerController>((o, args) => JavaScriptValue.FromBoolean(o.IsValid))
                );


            // Instance Methods

            PlayerControllerPrototype.SetProperty(
                "toString",
                Bridge.CreateFunction(
                    "ToString",
                    WithExternal <UnityEngine.Networking.PlayerController>((o, args) => JavaScriptValue.FromString(o.ToString()))
                    )
                );
        }
        public async Task <GenerateResult> GenerateDocumentAsync(string code, object model, IResourceManager resourceManager = null, CancellationToken cancellationToken = default)
        {
            // Multiple contexts can share a runtime, but only one thread can access the runtime at a time
            var context = JavaScriptContext.CreateContext(_runtime);

            context.AddRef();
            ModuleLease rootModuleLease = null;

            try
            {
                using var loader = new CustomLoader(context, _dispatcher, _resourceScriptFactory, resourceManager);
                var tcs = new TaskCompletionSource <JavaScriptValue>(TaskCreationOptions.RunContinuationsAsynchronously);

                _dispatcher.Invoke(() =>
                {
                    using (context.GetScope())
                    {
                        Native.ThrowIfError(Native.JsSetPromiseContinuationCallback(_promiseContinuationCallback, IntPtr.Zero));

                        // Load polyfill's
                        JavaScriptContext.RunScript("const globalThis = this;");
                        JavaScriptContext.RunScript(PolyfillScripts.Get("ImageData"));

                        var rootModule = JavaScriptModuleRecord.Initialize();
                        rootModule.AddRef();
                        rootModule.HostUrl = "<host>"; // Only for debugging

                        loader.RootModule = rootModule;
                        rootModule.FetchImportedModuleCallBack = loader.LoadModule;
                        rootModule.NotifyModuleReadyCallback   = loader.ModuleLoaded;
                        rootModuleLease = new ModuleLease(rootModule);

                        loader.AddPreload("main", code);
                    }
                });

                // Add callback that will be run when the root module has been evaluated,
                // at which time its rootModule.Namespace becomes valid.
                loader.OnRootModuleEvaluated = () =>
                {
                    using (context.GetScope())
                    {
                        var build = rootModuleLease.Module.Namespace.GetProperty("build");
                        build.AddRef();

                        var modelJson = JavaScriptValue.FromString(JsonSerializer.Serialize(model));
                        modelJson.AddRef();

                        var resultPromise = build.CallFunction(JavaScriptValue.GlobalObject, modelJson);
                        resultPromise.AddRef();

                        FunctionLease resolve = default;
                        FunctionLease reject  = default;
                        FunctionLease always  = default;

                        resolve = new FunctionLease((callee, isConstructCall, arguments, argumentCount, callbackState) =>
                        {
                            var result = arguments[1];

                            result.AddRef();
                            tcs.SetResult(result);

                            return(callee);
                        });

                        reject = new FunctionLease((callee, isConstructCall, arguments, argumentCount, callbackState) =>
                        {
                            JavaScriptException exception;

                            if (arguments.Length >= 2)
                            {
                                var reason = arguments[1];
                                if (reason.ValueType == JavaScriptValueType.Error)
                                {
                                    exception = new JavaScriptException(JavaScriptErrorCode.ScriptException, reason.GetProperty("message").ToString());
                                }
                                else
                                {
                                    exception = new JavaScriptException(JavaScriptErrorCode.ScriptException, reason.ConvertToString().ToString());
                                }
                            }
                            else
                            {
                                exception = new JavaScriptException(JavaScriptErrorCode.ScriptException);
                            }

                            tcs.SetException(exception);

                            return(callee);
                        });

                        always = new FunctionLease((callee, isConstructCall, arguments, argumentCount, callbackState) =>
                        {
                            build.Release();
                            modelJson.Release();
                            resultPromise.Release();

                            resolve.Dispose();
                            reject.Dispose();
                            always.Dispose();

                            return(callee);
                        });

                        resultPromise
                        .GetProperty("then").CallFunction(resultPromise, resolve.Function)
                        .GetProperty("catch").CallFunction(resultPromise, reject.Function)
                        .GetProperty("finally").CallFunction(resultPromise, always.Function);
                    }
                };
                loader.OnResourceLoadError = e => tcs.SetException(e);

                _dispatcher.Invoke(() =>
                {
                    using (context.GetScope())
                    {
                        rootModuleLease.Module.ParseSource(@"
import Builder from 'main';

const builder = new Builder();
const build = async (modelJson) => {
const model = JSON.parse(modelJson);
const content = await Promise.resolve(builder.build(model));
try {
const { contentType } = await import('main');
return { content, contentType };
} catch (error) {
return { content };
}
};

export { build };
");
                    }
                });

                var result = await tcs.Task;

                return(_dispatcher.Invoke(() =>
                {
                    using (context.GetScope())
                    {
                        _runtime.CollectGarbage();

                        var content = result.GetProperty("content");
                        var contentTypeValue = result.GetProperty("contentType");
                        var contentType = contentTypeValue.ValueType == JavaScriptValueType.String ? contentTypeValue.ToString() : null;

                        switch (content.ValueType)
                        {
                        case JavaScriptValueType.String: return new GenerateResult()
                            {
                                Content = Encoding.UTF8.GetBytes(content.ToString()), ContentType = contentType ?? "text/plain"
                            };

                        case JavaScriptValueType.TypedArray:
                            {
                                content.GetTypedArrayInfo(out var arrayType, out var buffer, out var byteOffset, out var byteLength);

                                if (arrayType != JavaScriptTypedArrayType.Uint8)
                                {
                                    throw new NotSupportedException("Typed array must be Uint8Array");
                                }

                                var bufferPointer = buffer.GetArrayBufferStorage(out var bufferLength);
                                var array = new byte[byteLength];
                                Marshal.Copy(IntPtr.Add(bufferPointer, (int)byteOffset), array, 0, (int)byteLength);

                                return new GenerateResult()
                                {
                                    Content = array, ContentType = contentType ?? "application/octet-stream"
                                };
                            }

                        case JavaScriptValueType.Array:
                            {
                                var list = content.ToList();
                                var array = new byte[list.Count];
                                for (var i = 0; i < list.Count; i++)
                                {
                                    array[i] = (byte)list[i].ToInt32();
                                }

                                return new GenerateResult()
                                {
                                    Content = array, ContentType = contentType ?? "application/octet-stream"
                                };
                            }

                        default: throw new NotSupportedException("Build did not produce a supported result");
                        }
                    }
                }));
            }
            finally
            {
                _dispatcher.Invoke(() =>
                {
                    using (context.GetScope())
                    {
                        rootModuleLease?.Dispose();
                    }
                });
                context.Release();
            }
        }
Exemplo n.º 4
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue ApplicationPrototype;
            JavaScriptValue ApplicationConstructor = Bridge.CreateConstructor(
                typeof(UnityEngine.Application),
                (args) => { throw new System.NotImplementedException(); },
                out ApplicationPrototype
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("UnityEngine")
            .SetProperty("Application", ApplicationConstructor);


            // Static Fields


            // Static Property Accessors

            Bridge.DefineGetter(
                ApplicationConstructor,
                "isPlaying",
                (args) => JavaScriptValue.FromBoolean(UnityEngine.Application.isPlaying)
                );


            Bridge.DefineGetter(
                ApplicationConstructor,
                "isFocused",
                (args) => JavaScriptValue.FromBoolean(UnityEngine.Application.isFocused)
                );


            Bridge.DefineGetter(
                ApplicationConstructor,
                "platform",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Application.platform)
                );


            Bridge.DefineGetter(
                ApplicationConstructor,
                "buildGUID",
                (args) => JavaScriptValue.FromString(UnityEngine.Application.buildGUID)
                );


            Bridge.DefineGetter(
                ApplicationConstructor,
                "isMobilePlatform",
                (args) => JavaScriptValue.FromBoolean(UnityEngine.Application.isMobilePlatform)
                );


            Bridge.DefineGetter(
                ApplicationConstructor,
                "isConsolePlatform",
                (args) => JavaScriptValue.FromBoolean(UnityEngine.Application.isConsolePlatform)
                );


            Bridge.DefineGetterSetter(
                ApplicationConstructor,
                "runInBackground",
                (args) => JavaScriptValue.FromBoolean(UnityEngine.Application.runInBackground),
                (args) => { UnityEngine.Application.runInBackground = args[1].ToBoolean(); }
                );


            Bridge.DefineGetter(
                ApplicationConstructor,
                "isBatchMode",
                (args) => JavaScriptValue.FromBoolean(UnityEngine.Application.isBatchMode)
                );


            Bridge.DefineGetter(
                ApplicationConstructor,
                "dataPath",
                (args) => JavaScriptValue.FromString(UnityEngine.Application.dataPath)
                );


            Bridge.DefineGetter(
                ApplicationConstructor,
                "streamingAssetsPath",
                (args) => JavaScriptValue.FromString(UnityEngine.Application.streamingAssetsPath)
                );


            Bridge.DefineGetter(
                ApplicationConstructor,
                "persistentDataPath",
                (args) => JavaScriptValue.FromString(UnityEngine.Application.persistentDataPath)
                );


            Bridge.DefineGetter(
                ApplicationConstructor,
                "temporaryCachePath",
                (args) => JavaScriptValue.FromString(UnityEngine.Application.temporaryCachePath)
                );


            Bridge.DefineGetter(
                ApplicationConstructor,
                "absoluteURL",
                (args) => JavaScriptValue.FromString(UnityEngine.Application.absoluteURL)
                );


            Bridge.DefineGetter(
                ApplicationConstructor,
                "unityVersion",
                (args) => JavaScriptValue.FromString(UnityEngine.Application.unityVersion)
                );


            Bridge.DefineGetter(
                ApplicationConstructor,
                "version",
                (args) => JavaScriptValue.FromString(UnityEngine.Application.version)
                );


            Bridge.DefineGetter(
                ApplicationConstructor,
                "installerName",
                (args) => JavaScriptValue.FromString(UnityEngine.Application.installerName)
                );


            Bridge.DefineGetter(
                ApplicationConstructor,
                "identifier",
                (args) => JavaScriptValue.FromString(UnityEngine.Application.identifier)
                );


            Bridge.DefineGetter(
                ApplicationConstructor,
                "installMode",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Application.installMode)
                );


            Bridge.DefineGetter(
                ApplicationConstructor,
                "sandboxType",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Application.sandboxType)
                );


            Bridge.DefineGetter(
                ApplicationConstructor,
                "productName",
                (args) => JavaScriptValue.FromString(UnityEngine.Application.productName)
                );


            Bridge.DefineGetter(
                ApplicationConstructor,
                "companyName",
                (args) => JavaScriptValue.FromString(UnityEngine.Application.companyName)
                );


            Bridge.DefineGetter(
                ApplicationConstructor,
                "cloudProjectId",
                (args) => JavaScriptValue.FromString(UnityEngine.Application.cloudProjectId)
                );


            Bridge.DefineGetterSetter(
                ApplicationConstructor,
                "targetFrameRate",
                (args) => JavaScriptValue.FromInt32(UnityEngine.Application.targetFrameRate),
                (args) => { UnityEngine.Application.targetFrameRate = args[1].ToInt32(); }
                );


            Bridge.DefineGetter(
                ApplicationConstructor,
                "systemLanguage",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Application.systemLanguage)
                );


            Bridge.DefineGetterSetter(
                ApplicationConstructor,
                "backgroundLoadingPriority",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Application.backgroundLoadingPriority),
                (args) => { UnityEngine.Application.backgroundLoadingPriority = Bridge.GetExternal <UnityEngine.ThreadPriority>(args[1]); }
                );


            Bridge.DefineGetter(
                ApplicationConstructor,
                "internetReachability",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Application.internetReachability)
                );


            Bridge.DefineGetter(
                ApplicationConstructor,
                "genuine",
                (args) => JavaScriptValue.FromBoolean(UnityEngine.Application.genuine)
                );


            Bridge.DefineGetter(
                ApplicationConstructor,
                "genuineCheckAvailable",
                (args) => JavaScriptValue.FromBoolean(UnityEngine.Application.genuineCheckAvailable)
                );


            Bridge.DefineGetter(
                ApplicationConstructor,
                "isEditor",
                (args) => JavaScriptValue.FromBoolean(UnityEngine.Application.isEditor)
                );


            // Static Methods

            ApplicationConstructor.SetProperty(
                "Quit",
                Bridge.CreateFunction(
                    "Quit",
                    (args) => UnityEngine.Application.Quit()
                    )
                );


            ApplicationConstructor.SetProperty(
                "Unload",
                Bridge.CreateFunction(
                    "Unload",
                    (args) => UnityEngine.Application.Unload()
                    )
                );


            ApplicationConstructor.SetProperty(
                "CanStreamedLevelBeLoaded",
                Bridge.CreateFunction(
                    "CanStreamedLevelBeLoaded",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.Application.CanStreamedLevelBeLoaded(args[1].ToInt32()))
                    )
                );


            ApplicationConstructor.SetProperty(
                "CanStreamedLevelBeLoaded",
                Bridge.CreateFunction(
                    "CanStreamedLevelBeLoaded",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.Application.CanStreamedLevelBeLoaded(args[1].ToString()))
                    )
                );


            ApplicationConstructor.SetProperty(
                "GetBuildTags",
                Bridge.CreateFunction(
                    "GetBuildTags",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Application.GetBuildTags())
                    )
                );


            ApplicationConstructor.SetProperty(
                "SetBuildTags",
                Bridge.CreateFunction(
                    "SetBuildTags",
                    (args) => UnityEngine.Application.SetBuildTags(Bridge.GetExternal <System.String[]>(args[1]))
                    )
                );


            ApplicationConstructor.SetProperty(
                "HasProLicense",
                Bridge.CreateFunction(
                    "HasProLicense",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.Application.HasProLicense())
                    )
                );


            ApplicationConstructor.SetProperty(
                "RequestAdvertisingIdentifierAsync",
                Bridge.CreateFunction(
                    "RequestAdvertisingIdentifierAsync",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.Application.RequestAdvertisingIdentifierAsync(Bridge.GetExternal <UnityEngine.Application.AdvertisingIdentifierCallback>(args[1])))
                    )
                );


            ApplicationConstructor.SetProperty(
                "OpenURL",
                Bridge.CreateFunction(
                    "OpenURL",
                    (args) => UnityEngine.Application.OpenURL(args[1].ToString())
                    )
                );


            ApplicationConstructor.SetProperty(
                "GetStackTraceLogType",
                Bridge.CreateFunction(
                    "GetStackTraceLogType",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Application.GetStackTraceLogType(Bridge.GetExternal <UnityEngine.LogType>(args[1])))
                    )
                );


            ApplicationConstructor.SetProperty(
                "SetStackTraceLogType",
                Bridge.CreateFunction(
                    "SetStackTraceLogType",
                    (args) => UnityEngine.Application.SetStackTraceLogType(Bridge.GetExternal <UnityEngine.LogType>(args[1]), Bridge.GetExternal <UnityEngine.StackTraceLogType>(args[2]))
                    )
                );


            ApplicationConstructor.SetProperty(
                "RequestUserAuthorization",
                Bridge.CreateFunction(
                    "RequestUserAuthorization",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Application.RequestUserAuthorization(Bridge.GetExternal <UnityEngine.UserAuthorization>(args[1])))
                    )
                );


            ApplicationConstructor.SetProperty(
                "HasUserAuthorization",
                Bridge.CreateFunction(
                    "HasUserAuthorization",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.Application.HasUserAuthorization(Bridge.GetExternal <UnityEngine.UserAuthorization>(args[1])))
                    )
                );


            // Instance Fields


            // Instance Property Accessors


            // Instance Methods
        }
Exemplo n.º 5
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue Color32Prototype;
            JavaScriptValue Color32Constructor = Bridge.CreateConstructor(
                typeof(UnityEngine.Color32),
                (args) => Bridge.CreateExternalWithPrototype(
                    new UnityEngine.Color32(
                        (byte)args[1].ToInt32(),
                        (byte)args[2].ToInt32(),
                        (byte)args[3].ToInt32(),
                        (byte)args[4].ToInt32()
                        )
                    ),
                out Color32Prototype
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("UnityEngine")
            .SetProperty("Color32", Color32Constructor);


            // Static Fields


            // Static Property Accessors


            // Static Methods

            Color32Constructor.SetProperty(
                "Lerp",
                Bridge.CreateFunction(
                    "Lerp",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Color32.Lerp(Bridge.GetBoxedExternal <UnityEngine.Color32>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Color32>(args[2]).wrapped, (float)args[3].ToDouble()))
                    )
                );


            Color32Constructor.SetProperty(
                "LerpUnclamped",
                Bridge.CreateFunction(
                    "LerpUnclamped",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Color32.LerpUnclamped(Bridge.GetBoxedExternal <UnityEngine.Color32>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Color32>(args[2]).wrapped, (float)args[3].ToDouble()))
                    )
                );


            // Instance Fields

            Bridge.DefineGetterSetter(
                Color32Prototype,
                "r",
                Bridge.WithBoxedExternal <UnityEngine.Color32>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.r)),
                Bridge.WithBoxedExternal <UnityEngine.Color32>((o, args) => { o.wrapped.r = Bridge.GetBoxedExternal <System.Byte>(args[1]).wrapped; })
                );


            Bridge.DefineGetterSetter(
                Color32Prototype,
                "g",
                Bridge.WithBoxedExternal <UnityEngine.Color32>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.g)),
                Bridge.WithBoxedExternal <UnityEngine.Color32>((o, args) => { o.wrapped.g = Bridge.GetBoxedExternal <System.Byte>(args[1]).wrapped; })
                );


            Bridge.DefineGetterSetter(
                Color32Prototype,
                "b",
                Bridge.WithBoxedExternal <UnityEngine.Color32>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.b)),
                Bridge.WithBoxedExternal <UnityEngine.Color32>((o, args) => { o.wrapped.b = Bridge.GetBoxedExternal <System.Byte>(args[1]).wrapped; })
                );


            Bridge.DefineGetterSetter(
                Color32Prototype,
                "a",
                Bridge.WithBoxedExternal <UnityEngine.Color32>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.a)),
                Bridge.WithBoxedExternal <UnityEngine.Color32>((o, args) => { o.wrapped.a = Bridge.GetBoxedExternal <System.Byte>(args[1]).wrapped; })
                );


            // Instance Property Accessors


            // Instance Methods

            Color32Prototype.SetProperty(
                "toString",
                Bridge.CreateFunction(
                    "ToString",
                    Bridge.WithBoxedExternal <UnityEngine.Color32>((o, args) => {
                if (args.Length == 1)
                {
                    return(JavaScriptValue.FromString(o.wrapped.ToString()));
                }
                else
                {
                    return(JavaScriptValue.FromString(o.wrapped.ToString(args[1].ToString())));
                }
            })
                    )
                );


            Color32Prototype.SetProperty(
                "ToColor",
                Bridge.CreateFunction(
                    "ToColor",
                    Bridge.WithBoxedExternal <UnityEngine.Color32>((o, args) => {
                UnityEngine.Color asColor = o.wrapped;
                return(Bridge.CreateExternalWithPrototype(asColor));
            })
                    )
                );
        }
Exemplo n.º 6
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue MeshColliderPrototype;
            JavaScriptValue MeshColliderConstructor = Bridge.CreateConstructor(
                typeof(UnityEngine.MeshCollider),
                (args) => { throw new System.NotImplementedException(); },
                out MeshColliderPrototype
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("UnityEngine")
            .SetProperty("MeshCollider", MeshColliderConstructor);


            // Static Fields


            // Static Property Accessors


            // Static Methods


            // Instance Fields


            // Instance Property Accessors

            Bridge.DefineGetterSetter(
                MeshColliderPrototype,
                "sharedMesh",
                Bridge.WithExternal <UnityEngine.MeshCollider>((o, args) => Bridge.CreateExternalWithPrototype(o.sharedMesh)),
                Bridge.WithExternal <UnityEngine.MeshCollider>((o, args) => { o.sharedMesh = Bridge.GetExternal <UnityEngine.Mesh>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                MeshColliderPrototype,
                "convex",
                Bridge.WithExternal <UnityEngine.MeshCollider>((o, args) => JavaScriptValue.FromBoolean(o.convex)),
                Bridge.WithExternal <UnityEngine.MeshCollider>((o, args) => { o.convex = args[1].ToBoolean(); })
                );


            Bridge.DefineGetterSetter(
                MeshColliderPrototype,
                "inflateMesh",
                Bridge.WithExternal <UnityEngine.MeshCollider>((o, args) => JavaScriptValue.FromBoolean(o.inflateMesh)),
                Bridge.WithExternal <UnityEngine.MeshCollider>((o, args) => { o.inflateMesh = args[1].ToBoolean(); })
                );


            Bridge.DefineGetterSetter(
                MeshColliderPrototype,
                "cookingOptions",
                Bridge.WithExternal <UnityEngine.MeshCollider>((o, args) => Bridge.CreateExternalWithPrototype(o.cookingOptions)),
                Bridge.WithExternal <UnityEngine.MeshCollider>((o, args) => { o.cookingOptions = Bridge.GetExternal <UnityEngine.MeshColliderCookingOptions>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                MeshColliderPrototype,
                "skinWidth",
                Bridge.WithExternal <UnityEngine.MeshCollider>((o, args) => JavaScriptValue.FromDouble(o.skinWidth)),
                Bridge.WithExternal <UnityEngine.MeshCollider>((o, args) => { o.skinWidth = (float)args[1].ToDouble(); })
                );


            // Instance Methods
        }
Exemplo n.º 7
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue Vector4Prototype;
            JavaScriptValue Vector4Constructor = Bridge.CreateConstructor(
                typeof(UnityEngine.Vector4),
                (args) => { throw new System.NotImplementedException(); },
                out Vector4Prototype
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("UnityEngine")
            .SetProperty("Vector4", Vector4Constructor);


            // Static Fields

            Vector4Constructor.SetProperty(
                "kEpsilon",
                JavaScriptValue.FromDouble(UnityEngine.Vector4.kEpsilon)
                );


            // Static Property Accessors

            Bridge.DefineGetter(
                Vector4Constructor,
                "zero",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector4.zero)
                );


            Bridge.DefineGetter(
                Vector4Constructor,
                "one",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector4.one)
                );


            Bridge.DefineGetter(
                Vector4Constructor,
                "positiveInfinity",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector4.positiveInfinity)
                );


            Bridge.DefineGetter(
                Vector4Constructor,
                "negativeInfinity",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector4.negativeInfinity)
                );


            // Static Methods

            Vector4Constructor.SetProperty(
                "Lerp",
                Bridge.CreateFunction(
                    "Lerp",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector4.Lerp(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[2]).wrapped, (float)args[3].ToDouble()))
                    )
                );


            Vector4Constructor.SetProperty(
                "LerpUnclamped",
                Bridge.CreateFunction(
                    "LerpUnclamped",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector4.LerpUnclamped(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[2]).wrapped, (float)args[3].ToDouble()))
                    )
                );


            Vector4Constructor.SetProperty(
                "MoveTowards",
                Bridge.CreateFunction(
                    "MoveTowards",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector4.MoveTowards(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[2]).wrapped, (float)args[3].ToDouble()))
                    )
                );


            Vector4Constructor.SetProperty(
                "Scale",
                Bridge.CreateFunction(
                    "Scale",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector4.Scale(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[2]).wrapped))
                    )
                );


            Vector4Constructor.SetProperty(
                "Normalize",
                Bridge.CreateFunction(
                    "Normalize",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector4.Normalize(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped))
                    )
                );


            Vector4Constructor.SetProperty(
                "Dot",
                Bridge.CreateFunction(
                    "Dot",
                    (args) => JavaScriptValue.FromDouble(UnityEngine.Vector4.Dot(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[2]).wrapped))
                    )
                );


            Vector4Constructor.SetProperty(
                "Project",
                Bridge.CreateFunction(
                    "Project",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector4.Project(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[2]).wrapped))
                    )
                );


            Vector4Constructor.SetProperty(
                "Distance",
                Bridge.CreateFunction(
                    "Distance",
                    (args) => JavaScriptValue.FromDouble(UnityEngine.Vector4.Distance(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[2]).wrapped))
                    )
                );


            Vector4Constructor.SetProperty(
                "Magnitude",
                Bridge.CreateFunction(
                    "Magnitude",
                    (args) => JavaScriptValue.FromDouble(UnityEngine.Vector4.Magnitude(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped))
                    )
                );


            Vector4Constructor.SetProperty(
                "Min",
                Bridge.CreateFunction(
                    "Min",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector4.Min(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[2]).wrapped))
                    )
                );


            Vector4Constructor.SetProperty(
                "Max",
                Bridge.CreateFunction(
                    "Max",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector4.Max(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[2]).wrapped))
                    )
                );


            Vector4Constructor.SetProperty(
                "SqrMagnitude",
                Bridge.CreateFunction(
                    "SqrMagnitude",
                    (args) => JavaScriptValue.FromDouble(UnityEngine.Vector4.SqrMagnitude(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped))
                    )
                );


            // Instance Fields

            Bridge.DefineGetterSetter(
                Vector4Prototype,
                "x",
                Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.x)),
                Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => { o.wrapped.x = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                Vector4Prototype,
                "y",
                Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.y)),
                Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => { o.wrapped.y = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                Vector4Prototype,
                "z",
                Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.z)),
                Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => { o.wrapped.z = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                Vector4Prototype,
                "w",
                Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.w)),
                Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => { o.wrapped.w = (float)args[1].ToDouble(); })
                );


            // Instance Property Accessors

            Bridge.DefineGetter(
                Vector4Prototype,
                "normalized",
                Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.normalized))
                );


            Bridge.DefineGetter(
                Vector4Prototype,
                "magnitude",
                Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.magnitude))
                );


            Bridge.DefineGetter(
                Vector4Prototype,
                "sqrMagnitude",
                Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.sqrMagnitude))
                );


            // Instance Methods

            Vector4Prototype.SetProperty(
                "Set",
                Bridge.CreateFunction(
                    "Set",
                    Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => o.wrapped.Set((float)args[1].ToDouble(), (float)args[2].ToDouble(), (float)args[3].ToDouble(), (float)args[4].ToDouble()))
                    )
                );


            Vector4Prototype.SetProperty(
                "Scale",
                Bridge.CreateFunction(
                    "Scale",
                    Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => o.wrapped.Scale(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped))
                    )
                );


            Vector4Prototype.SetProperty(
                "GetHashCode",
                Bridge.CreateFunction(
                    "GetHashCode",
                    Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => JavaScriptValue.FromInt32(o.wrapped.GetHashCode()))
                    )
                );


            Vector4Prototype.SetProperty(
                "Equals",
                Bridge.CreateFunction(
                    "Equals",
                    Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.Equals(Bridge.GetExternal <System.Object>(args[1]))))
                    )
                );


            Vector4Prototype.SetProperty(
                "Equals",
                Bridge.CreateFunction(
                    "Equals",
                    Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.Equals(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped)))
                    )
                );


            Vector4Prototype.SetProperty(
                "Normalize",
                Bridge.CreateFunction(
                    "Normalize",
                    Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => o.wrapped.Normalize())
                    )
                );


            Vector4Prototype.SetProperty(
                "toString",
                Bridge.CreateFunction(
                    "ToString",
                    Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => {
                if (args.Length == 1)
                {
                    return(JavaScriptValue.FromString(o.wrapped.ToString()));
                }
                else
                {
                    return(JavaScriptValue.FromString(o.wrapped.ToString(args[1].ToString())));
                }
            })
                    )
                );


            Vector4Prototype.SetProperty(
                "SqrMagnitude",
                Bridge.CreateFunction(
                    "SqrMagnitude",
                    Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.SqrMagnitude()))
                    )
                );
        }
Exemplo n.º 8
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue CameraPrototype;
            JavaScriptValue CameraConstructor = Bridge.CreateConstructor(
                typeof(UnityEngine.Camera),
                (args) => { throw new System.NotImplementedException(); },
                out CameraPrototype
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("UnityEngine")
            .SetProperty("Camera", CameraConstructor);


            // Static Fields

            Bridge.DefineGetterSetter(
                CameraConstructor,
                "onPreCull",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Camera.onPreCull),
                (args) => { UnityEngine.Camera.onPreCull = Bridge.GetExternal <UnityEngine.Camera.CameraCallback>(args[1]); }
                );


            Bridge.DefineGetterSetter(
                CameraConstructor,
                "onPreRender",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Camera.onPreRender),
                (args) => { UnityEngine.Camera.onPreRender = Bridge.GetExternal <UnityEngine.Camera.CameraCallback>(args[1]); }
                );


            Bridge.DefineGetterSetter(
                CameraConstructor,
                "onPostRender",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Camera.onPostRender),
                (args) => { UnityEngine.Camera.onPostRender = Bridge.GetExternal <UnityEngine.Camera.CameraCallback>(args[1]); }
                );


            // Static Property Accessors

            Bridge.DefineGetter(
                CameraConstructor,
                "main",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Camera.main)
                );


            Bridge.DefineGetter(
                CameraConstructor,
                "current",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Camera.current)
                );


            Bridge.DefineGetter(
                CameraConstructor,
                "allCamerasCount",
                (args) => JavaScriptValue.FromInt32(UnityEngine.Camera.allCamerasCount)
                );


            Bridge.DefineGetter(
                CameraConstructor,
                "allCameras",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Camera.allCameras)
                );


            // Static Methods

            CameraConstructor.SetProperty(
                "FocalLengthToFOV",
                Bridge.CreateFunction(
                    "FocalLengthToFOV",
                    (args) => JavaScriptValue.FromDouble(UnityEngine.Camera.FocalLengthToFOV((float)args[1].ToDouble(), (float)args[2].ToDouble()))
                    )
                );


            CameraConstructor.SetProperty(
                "FOVToFocalLength",
                Bridge.CreateFunction(
                    "FOVToFocalLength",
                    (args) => JavaScriptValue.FromDouble(UnityEngine.Camera.FOVToFocalLength((float)args[1].ToDouble(), (float)args[2].ToDouble()))
                    )
                );


            CameraConstructor.SetProperty(
                "GetAllCameras",
                Bridge.CreateFunction(
                    "GetAllCameras",
                    (args) => JavaScriptValue.FromInt32(UnityEngine.Camera.GetAllCameras(Bridge.GetExternal <UnityEngine.Camera[]>(args[1])))
                    )
                );


            CameraConstructor.SetProperty(
                "SetupCurrent",
                Bridge.CreateFunction(
                    "SetupCurrent",
                    (args) => UnityEngine.Camera.SetupCurrent(Bridge.GetExternal <UnityEngine.Camera>(args[1]))
                    )
                );


            // Instance Fields


            // Instance Property Accessors

            Bridge.DefineGetterSetter(
                CameraPrototype,
                "nearClipPlane",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromDouble(o.nearClipPlane)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.nearClipPlane = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "farClipPlane",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromDouble(o.farClipPlane)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.farClipPlane = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "fieldOfView",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromDouble(o.fieldOfView)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.fieldOfView = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "renderingPath",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.renderingPath)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.renderingPath = Bridge.GetExternal <UnityEngine.RenderingPath>(args[1]); })
                );


            Bridge.DefineGetter(
                CameraPrototype,
                "actualRenderingPath",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.actualRenderingPath))
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "allowHDR",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.allowHDR)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.allowHDR = args[1].ToBoolean(); })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "allowMSAA",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.allowMSAA)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.allowMSAA = args[1].ToBoolean(); })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "allowDynamicResolution",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.allowDynamicResolution)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.allowDynamicResolution = args[1].ToBoolean(); })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "forceIntoRenderTexture",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.forceIntoRenderTexture)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.forceIntoRenderTexture = args[1].ToBoolean(); })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "orthographicSize",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromDouble(o.orthographicSize)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.orthographicSize = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "orthographic",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.orthographic)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.orthographic = args[1].ToBoolean(); })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "opaqueSortMode",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.opaqueSortMode)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.opaqueSortMode = Bridge.GetExternal <UnityEngine.Rendering.OpaqueSortMode>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "transparencySortMode",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.transparencySortMode)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.transparencySortMode = Bridge.GetExternal <UnityEngine.TransparencySortMode>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "transparencySortAxis",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.transparencySortAxis)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.transparencySortAxis = Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped; })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "depth",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromDouble(o.depth)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.depth = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "aspect",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromDouble(o.aspect)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.aspect = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetter(
                CameraPrototype,
                "velocity",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.velocity))
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "cullingMask",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromInt32(o.cullingMask)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.cullingMask = args[1].ToInt32(); })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "eventMask",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromInt32(o.eventMask)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.eventMask = args[1].ToInt32(); })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "layerCullSpherical",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.layerCullSpherical)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.layerCullSpherical = args[1].ToBoolean(); })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "cameraType",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.cameraType)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.cameraType = Bridge.GetExternal <UnityEngine.CameraType>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "layerCullDistances",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.layerCullDistances)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.layerCullDistances = Bridge.GetExternal <System.Single[]>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "useOcclusionCulling",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.useOcclusionCulling)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.useOcclusionCulling = args[1].ToBoolean(); })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "cullingMatrix",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.cullingMatrix)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.cullingMatrix = Bridge.GetBoxedExternal <UnityEngine.Matrix4x4>(args[1]).wrapped; })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "backgroundColor",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.backgroundColor)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.backgroundColor = Bridge.GetBoxedExternal <UnityEngine.Color>(args[1]).wrapped; })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "clearFlags",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.clearFlags)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.clearFlags = Bridge.GetExternal <UnityEngine.CameraClearFlags>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "depthTextureMode",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.depthTextureMode)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.depthTextureMode = Bridge.GetExternal <UnityEngine.DepthTextureMode>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "clearStencilAfterLightingPass",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.clearStencilAfterLightingPass)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.clearStencilAfterLightingPass = args[1].ToBoolean(); })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "usePhysicalProperties",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.usePhysicalProperties)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.usePhysicalProperties = args[1].ToBoolean(); })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "sensorSize",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.sensorSize)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.sensorSize = Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[1]).wrapped; })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "lensShift",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.lensShift)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.lensShift = Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[1]).wrapped; })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "focalLength",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromDouble(o.focalLength)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.focalLength = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "rect",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.rect)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.rect = Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped; })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "pixelRect",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.pixelRect)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.pixelRect = Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped; })
                );


            Bridge.DefineGetter(
                CameraPrototype,
                "pixelWidth",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromInt32(o.pixelWidth))
                );


            Bridge.DefineGetter(
                CameraPrototype,
                "pixelHeight",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromInt32(o.pixelHeight))
                );


            Bridge.DefineGetter(
                CameraPrototype,
                "scaledPixelWidth",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromInt32(o.scaledPixelWidth))
                );


            Bridge.DefineGetter(
                CameraPrototype,
                "scaledPixelHeight",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromInt32(o.scaledPixelHeight))
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "targetTexture",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.targetTexture)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.targetTexture = Bridge.GetExternal <UnityEngine.RenderTexture>(args[1]); })
                );


            Bridge.DefineGetter(
                CameraPrototype,
                "activeTexture",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.activeTexture))
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "targetDisplay",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromInt32(o.targetDisplay)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.targetDisplay = args[1].ToInt32(); })
                );


            Bridge.DefineGetter(
                CameraPrototype,
                "cameraToWorldMatrix",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.cameraToWorldMatrix))
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "worldToCameraMatrix",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.worldToCameraMatrix)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.worldToCameraMatrix = Bridge.GetBoxedExternal <UnityEngine.Matrix4x4>(args[1]).wrapped; })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "projectionMatrix",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.projectionMatrix)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.projectionMatrix = Bridge.GetBoxedExternal <UnityEngine.Matrix4x4>(args[1]).wrapped; })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "nonJitteredProjectionMatrix",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.nonJitteredProjectionMatrix)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.nonJitteredProjectionMatrix = Bridge.GetBoxedExternal <UnityEngine.Matrix4x4>(args[1]).wrapped; })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "useJitteredProjectionMatrixForTransparentRendering",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.useJitteredProjectionMatrixForTransparentRendering)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.useJitteredProjectionMatrixForTransparentRendering = args[1].ToBoolean(); })
                );


            Bridge.DefineGetter(
                CameraPrototype,
                "previousViewProjectionMatrix",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.previousViewProjectionMatrix))
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "scene",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.scene)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.scene = Bridge.GetBoxedExternal <UnityEngine.SceneManagement.Scene>(args[1]).wrapped; })
                );


            Bridge.DefineGetter(
                CameraPrototype,
                "stereoEnabled",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.stereoEnabled))
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "stereoSeparation",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromDouble(o.stereoSeparation)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.stereoSeparation = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "stereoConvergence",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromDouble(o.stereoConvergence)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.stereoConvergence = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetter(
                CameraPrototype,
                "areVRStereoViewMatricesWithinSingleCullTolerance",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.areVRStereoViewMatricesWithinSingleCullTolerance))
                );


            Bridge.DefineGetterSetter(
                CameraPrototype,
                "stereoTargetEye",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.stereoTargetEye)),
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.stereoTargetEye = Bridge.GetExternal <UnityEngine.StereoTargetEyeMask>(args[1]); })
                );


            Bridge.DefineGetter(
                CameraPrototype,
                "stereoActiveEye",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.stereoActiveEye))
                );


            Bridge.DefineGetter(
                CameraPrototype,
                "commandBufferCount",
                Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromInt32(o.commandBufferCount))
                );


            // Instance Methods

            CameraPrototype.SetProperty(
                "GetCommandBuffers",
                Bridge.CreateFunction(
                    "GetCommandBuffers",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.GetCommandBuffers(Bridge.GetExternal <UnityEngine.Rendering.CameraEvent>(args[1]))))
                    )
                );


            CameraPrototype.SetProperty(
                "Reset",
                Bridge.CreateFunction(
                    "Reset",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.Reset())
                    )
                );


            CameraPrototype.SetProperty(
                "ResetTransparencySortSettings",
                Bridge.CreateFunction(
                    "ResetTransparencySortSettings",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.ResetTransparencySortSettings())
                    )
                );


            CameraPrototype.SetProperty(
                "ResetAspect",
                Bridge.CreateFunction(
                    "ResetAspect",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.ResetAspect())
                    )
                );


            CameraPrototype.SetProperty(
                "ResetCullingMatrix",
                Bridge.CreateFunction(
                    "ResetCullingMatrix",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.ResetCullingMatrix())
                    )
                );


            CameraPrototype.SetProperty(
                "SetReplacementShader",
                Bridge.CreateFunction(
                    "SetReplacementShader",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.SetReplacementShader(Bridge.GetExternal <UnityEngine.Shader>(args[1]), args[2].ToString()))
                    )
                );


            CameraPrototype.SetProperty(
                "ResetReplacementShader",
                Bridge.CreateFunction(
                    "ResetReplacementShader",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.ResetReplacementShader())
                    )
                );


            CameraPrototype.SetProperty(
                "SetTargetBuffers",
                Bridge.CreateFunction(
                    "SetTargetBuffers",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.SetTargetBuffers(Bridge.GetBoxedExternal <UnityEngine.RenderBuffer>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.RenderBuffer>(args[2]).wrapped))
                    )
                );


            CameraPrototype.SetProperty(
                "SetTargetBuffers",
                Bridge.CreateFunction(
                    "SetTargetBuffers",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.SetTargetBuffers(Bridge.GetExternal <UnityEngine.RenderBuffer[]>(args[1]), Bridge.GetBoxedExternal <UnityEngine.RenderBuffer>(args[2]).wrapped))
                    )
                );


            CameraPrototype.SetProperty(
                "ResetWorldToCameraMatrix",
                Bridge.CreateFunction(
                    "ResetWorldToCameraMatrix",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.ResetWorldToCameraMatrix())
                    )
                );


            CameraPrototype.SetProperty(
                "ResetProjectionMatrix",
                Bridge.CreateFunction(
                    "ResetProjectionMatrix",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.ResetProjectionMatrix())
                    )
                );


            CameraPrototype.SetProperty(
                "CalculateObliqueMatrix",
                Bridge.CreateFunction(
                    "CalculateObliqueMatrix",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.CalculateObliqueMatrix(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped)))
                    )
                );


            CameraPrototype.SetProperty(
                "WorldToScreenPoint",
                Bridge.CreateFunction(
                    "WorldToScreenPoint",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.WorldToScreenPoint(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Camera.MonoOrStereoscopicEye>(args[2]))))
                    )
                );


            CameraPrototype.SetProperty(
                "WorldToViewportPoint",
                Bridge.CreateFunction(
                    "WorldToViewportPoint",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.WorldToViewportPoint(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Camera.MonoOrStereoscopicEye>(args[2]))))
                    )
                );


            CameraPrototype.SetProperty(
                "ViewportToWorldPoint",
                Bridge.CreateFunction(
                    "ViewportToWorldPoint",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.ViewportToWorldPoint(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Camera.MonoOrStereoscopicEye>(args[2]))))
                    )
                );


            CameraPrototype.SetProperty(
                "ScreenToWorldPoint",
                Bridge.CreateFunction(
                    "ScreenToWorldPoint",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.ScreenToWorldPoint(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Camera.MonoOrStereoscopicEye>(args[2]))))
                    )
                );


            CameraPrototype.SetProperty(
                "WorldToScreenPoint",
                Bridge.CreateFunction(
                    "WorldToScreenPoint",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.WorldToScreenPoint(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped)))
                    )
                );


            CameraPrototype.SetProperty(
                "WorldToViewportPoint",
                Bridge.CreateFunction(
                    "WorldToViewportPoint",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.WorldToViewportPoint(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped)))
                    )
                );


            CameraPrototype.SetProperty(
                "ViewportToWorldPoint",
                Bridge.CreateFunction(
                    "ViewportToWorldPoint",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.ViewportToWorldPoint(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped)))
                    )
                );


            CameraPrototype.SetProperty(
                "ScreenToWorldPoint",
                Bridge.CreateFunction(
                    "ScreenToWorldPoint",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.ScreenToWorldPoint(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped)))
                    )
                );


            CameraPrototype.SetProperty(
                "ScreenToViewportPoint",
                Bridge.CreateFunction(
                    "ScreenToViewportPoint",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.ScreenToViewportPoint(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped)))
                    )
                );


            CameraPrototype.SetProperty(
                "ViewportToScreenPoint",
                Bridge.CreateFunction(
                    "ViewportToScreenPoint",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.ViewportToScreenPoint(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped)))
                    )
                );


            CameraPrototype.SetProperty(
                "ViewportPointToRay",
                Bridge.CreateFunction(
                    "ViewportPointToRay",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.ViewportPointToRay(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Camera.MonoOrStereoscopicEye>(args[2]))))
                    )
                );


            CameraPrototype.SetProperty(
                "ViewportPointToRay",
                Bridge.CreateFunction(
                    "ViewportPointToRay",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.ViewportPointToRay(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped)))
                    )
                );


            CameraPrototype.SetProperty(
                "ScreenPointToRay",
                Bridge.CreateFunction(
                    "ScreenPointToRay",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.ScreenPointToRay(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Camera.MonoOrStereoscopicEye>(args[2]))))
                    )
                );


            CameraPrototype.SetProperty(
                "ScreenPointToRay",
                Bridge.CreateFunction(
                    "ScreenPointToRay",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.ScreenPointToRay(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped)))
                    )
                );


            CameraPrototype.SetProperty(
                "CalculateFrustumCorners",
                Bridge.CreateFunction(
                    "CalculateFrustumCorners",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.CalculateFrustumCorners(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, (float)args[2].ToDouble(), Bridge.GetExternal <UnityEngine.Camera.MonoOrStereoscopicEye>(args[3]), Bridge.GetExternal <UnityEngine.Vector3[]>(args[4])))
                    )
                );


            CameraPrototype.SetProperty(
                "GetStereoNonJitteredProjectionMatrix",
                Bridge.CreateFunction(
                    "GetStereoNonJitteredProjectionMatrix",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.GetStereoNonJitteredProjectionMatrix(Bridge.GetExternal <UnityEngine.Camera.StereoscopicEye>(args[1]))))
                    )
                );


            CameraPrototype.SetProperty(
                "GetStereoViewMatrix",
                Bridge.CreateFunction(
                    "GetStereoViewMatrix",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.GetStereoViewMatrix(Bridge.GetExternal <UnityEngine.Camera.StereoscopicEye>(args[1]))))
                    )
                );


            CameraPrototype.SetProperty(
                "CopyStereoDeviceProjectionMatrixToNonJittered",
                Bridge.CreateFunction(
                    "CopyStereoDeviceProjectionMatrixToNonJittered",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.CopyStereoDeviceProjectionMatrixToNonJittered(Bridge.GetExternal <UnityEngine.Camera.StereoscopicEye>(args[1])))
                    )
                );


            CameraPrototype.SetProperty(
                "GetStereoProjectionMatrix",
                Bridge.CreateFunction(
                    "GetStereoProjectionMatrix",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.GetStereoProjectionMatrix(Bridge.GetExternal <UnityEngine.Camera.StereoscopicEye>(args[1]))))
                    )
                );


            CameraPrototype.SetProperty(
                "SetStereoProjectionMatrix",
                Bridge.CreateFunction(
                    "SetStereoProjectionMatrix",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.SetStereoProjectionMatrix(Bridge.GetExternal <UnityEngine.Camera.StereoscopicEye>(args[1]), Bridge.GetBoxedExternal <UnityEngine.Matrix4x4>(args[2]).wrapped))
                    )
                );


            CameraPrototype.SetProperty(
                "ResetStereoProjectionMatrices",
                Bridge.CreateFunction(
                    "ResetStereoProjectionMatrices",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.ResetStereoProjectionMatrices())
                    )
                );


            CameraPrototype.SetProperty(
                "SetStereoViewMatrix",
                Bridge.CreateFunction(
                    "SetStereoViewMatrix",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.SetStereoViewMatrix(Bridge.GetExternal <UnityEngine.Camera.StereoscopicEye>(args[1]), Bridge.GetBoxedExternal <UnityEngine.Matrix4x4>(args[2]).wrapped))
                    )
                );


            CameraPrototype.SetProperty(
                "ResetStereoViewMatrices",
                Bridge.CreateFunction(
                    "ResetStereoViewMatrices",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.ResetStereoViewMatrices())
                    )
                );


            CameraPrototype.SetProperty(
                "RenderToCubemap",
                Bridge.CreateFunction(
                    "RenderToCubemap",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.RenderToCubemap(Bridge.GetExternal <UnityEngine.Cubemap>(args[1]), args[2].ToInt32())))
                    )
                );


            CameraPrototype.SetProperty(
                "RenderToCubemap",
                Bridge.CreateFunction(
                    "RenderToCubemap",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.RenderToCubemap(Bridge.GetExternal <UnityEngine.Cubemap>(args[1]))))
                    )
                );


            CameraPrototype.SetProperty(
                "RenderToCubemap",
                Bridge.CreateFunction(
                    "RenderToCubemap",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.RenderToCubemap(Bridge.GetExternal <UnityEngine.RenderTexture>(args[1]), args[2].ToInt32())))
                    )
                );


            CameraPrototype.SetProperty(
                "RenderToCubemap",
                Bridge.CreateFunction(
                    "RenderToCubemap",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.RenderToCubemap(Bridge.GetExternal <UnityEngine.RenderTexture>(args[1]))))
                    )
                );


            CameraPrototype.SetProperty(
                "RenderToCubemap",
                Bridge.CreateFunction(
                    "RenderToCubemap",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.RenderToCubemap(Bridge.GetExternal <UnityEngine.RenderTexture>(args[1]), args[2].ToInt32(), Bridge.GetExternal <UnityEngine.Camera.MonoOrStereoscopicEye>(args[3]))))
                    )
                );


            CameraPrototype.SetProperty(
                "Render",
                Bridge.CreateFunction(
                    "Render",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.Render())
                    )
                );


            CameraPrototype.SetProperty(
                "RenderWithShader",
                Bridge.CreateFunction(
                    "RenderWithShader",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.RenderWithShader(Bridge.GetExternal <UnityEngine.Shader>(args[1]), args[2].ToString()))
                    )
                );


            CameraPrototype.SetProperty(
                "RenderDontRestore",
                Bridge.CreateFunction(
                    "RenderDontRestore",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.RenderDontRestore())
                    )
                );


            CameraPrototype.SetProperty(
                "CopyFrom",
                Bridge.CreateFunction(
                    "CopyFrom",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.CopyFrom(Bridge.GetExternal <UnityEngine.Camera>(args[1])))
                    )
                );


            CameraPrototype.SetProperty(
                "RemoveCommandBuffers",
                Bridge.CreateFunction(
                    "RemoveCommandBuffers",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.RemoveCommandBuffers(Bridge.GetExternal <UnityEngine.Rendering.CameraEvent>(args[1])))
                    )
                );


            CameraPrototype.SetProperty(
                "RemoveAllCommandBuffers",
                Bridge.CreateFunction(
                    "RemoveAllCommandBuffers",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.RemoveAllCommandBuffers())
                    )
                );


            CameraPrototype.SetProperty(
                "AddCommandBuffer",
                Bridge.CreateFunction(
                    "AddCommandBuffer",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.AddCommandBuffer(Bridge.GetExternal <UnityEngine.Rendering.CameraEvent>(args[1]), Bridge.GetExternal <UnityEngine.Rendering.CommandBuffer>(args[2])))
                    )
                );


            CameraPrototype.SetProperty(
                "AddCommandBufferAsync",
                Bridge.CreateFunction(
                    "AddCommandBufferAsync",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.AddCommandBufferAsync(Bridge.GetExternal <UnityEngine.Rendering.CameraEvent>(args[1]), Bridge.GetExternal <UnityEngine.Rendering.CommandBuffer>(args[2]), Bridge.GetExternal <UnityEngine.Rendering.ComputeQueueType>(args[3])))
                    )
                );


            CameraPrototype.SetProperty(
                "RemoveCommandBuffer",
                Bridge.CreateFunction(
                    "RemoveCommandBuffer",
                    Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.RemoveCommandBuffer(Bridge.GetExternal <UnityEngine.Rendering.CameraEvent>(args[1]), Bridge.GetExternal <UnityEngine.Rendering.CommandBuffer>(args[2])))
                    )
                );
        }
Exemplo n.º 9
0
        public static string js_chakra_run_2(object p = null)
        {
            //if (p == null || string.IsNullOrWhiteSpace(p.ToString())) return string.Empty;
            //string body_function = p.ToString();

            string v = "";
            //string script = "(()=>{ try{ " + body_function + " }catch(e){ return 'ERR:'+e.message; } })()";
            //var result = JavaScriptContext.RunScript(script, js_currentSourceContext++, string.Empty);
            //string v = result.ConvertToString().ToString();


            //int returnValue = 1;
            CommandLineArguments commandLineArguments;

            commandLineArguments.ArgumentsStart = 0;
            string[] arguments = new string[] { "chakrahost", "test.js", "12345" };

            using (JavaScriptRuntime runtime = JavaScriptRuntime.Create())
            {
                //
                // Similarly, create a single execution context. Note that we're putting it on the stack here,
                // so it will stay alive through the entire run.
                //

                JavaScriptContext context = CreateHostContext(runtime, arguments, commandLineArguments.ArgumentsStart);

                //
                // Now set the execution context as being the current one on this thread.
                //

                using (new JavaScriptContext.Scope(context))
                {
                    //
                    // Load the script from the disk.
                    //

                    //string script = File.ReadAllText(arguments[commandLineArguments.ArgumentsStart]);
                    string script = "(()=>{ var val = host.echo('Hello world'); return val; })()";

                    //
                    // Run the script.
                    //

                    JavaScriptValue result = new JavaScriptValue();
                    try
                    {
                        result = JavaScriptContext.RunScript(script, currentSourceContext++, arguments[commandLineArguments.ArgumentsStart]);
                    }
                    catch (JavaScriptScriptException e)
                    {
                        PrintScriptException(e.Error);
                    }
                    catch (Exception e)
                    {
                        Console.Error.WriteLine("chakrahost: failed to run script: {0}", e.Message);
                    }

                    //
                    // Convert the return value.
                    //

                    //JavaScriptValue numberResult = result.ConvertToNumber();
                    //double doubleResult = numberResult.ToDouble();
                    //returnValue = (int)doubleResult;
                    //v = returnValue.ToString();

                    v = result.ConvertToString().ToString();
                }
            }

            return(v);
        }
Exemplo n.º 10
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue ObjectPrototype;
            JavaScriptValue ObjectConstructor = Bridge.CreateConstructor(
                typeof(System.Object),
                (args) => { throw new System.NotImplementedException(); },
                out ObjectPrototype,
                dontExtend: true
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("System")
            .SetProperty("Object", ObjectConstructor);


            // Static Fields


            // Static Property Accessors


            // Static Methods

            ObjectConstructor.SetProperty(
                "Equals",
                Bridge.CreateFunction(
                    "Equals",
                    (args) => JavaScriptValue.FromBoolean(System.Object.Equals(Bridge.GetExternal <System.Object>(args[1]), Bridge.GetExternal <System.Object>(args[2])))
                    )
                );


            ObjectConstructor.SetProperty(
                "ReferenceEquals",
                Bridge.CreateFunction(
                    "ReferenceEquals",
                    (args) => JavaScriptValue.FromBoolean(System.Object.ReferenceEquals(Bridge.GetExternal <System.Object>(args[1]), Bridge.GetExternal <System.Object>(args[2])))
                    )
                );


            // Instance Fields


            // Instance Property Accessors


            // Instance Methods

            ObjectPrototype.SetProperty(
                "Equals",
                Bridge.CreateFunction(
                    "Equals",
                    Bridge.WithExternal <System.Object>((o, args) => JavaScriptValue.FromBoolean(o.Equals(Bridge.GetExternal <System.Object>(args[1]))))
                    )
                );


            ObjectPrototype.SetProperty(
                "GetHashCode",
                Bridge.CreateFunction(
                    "GetHashCode",
                    Bridge.WithExternal <System.Object>((o, args) => JavaScriptValue.FromInt32(o.GetHashCode()))
                    )
                );


            ObjectPrototype.SetProperty(
                "GetType",
                Bridge.CreateFunction(
                    "GetType",
                    Bridge.WithExternal <System.Object>((o, args) => Bridge.CreateExternalWithPrototype(o.GetType()))
                    )
                );


            ObjectPrototype.SetProperty(
                "toString",
                Bridge.CreateFunction(
                    "ToString",
                    Bridge.WithExternal <System.Object>((o, args) => JavaScriptValue.FromString(o.ToString()))
                    )
                );
        }
Exemplo n.º 11
0
 private static void StartDebugging()
 {
     JavaScriptContext.StartDebugging();
 }
Exemplo n.º 12
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue PhysicMaterialPrototype;
            JavaScriptValue PhysicMaterialConstructor = Bridge.CreateConstructor(
                typeof(UnityEngine.PhysicMaterial),
                (args) => { throw new System.NotImplementedException(); },
                out PhysicMaterialPrototype
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("UnityEngine")
            .SetProperty("PhysicMaterial", PhysicMaterialConstructor);


            // Static Fields


            // Static Property Accessors


            // Static Methods


            // Instance Fields


            // Instance Property Accessors

            Bridge.DefineGetterSetter(
                PhysicMaterialPrototype,
                "bounciness",
                Bridge.WithExternal <UnityEngine.PhysicMaterial>((o, args) => JavaScriptValue.FromDouble(o.bounciness)),
                Bridge.WithExternal <UnityEngine.PhysicMaterial>((o, args) => { o.bounciness = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                PhysicMaterialPrototype,
                "dynamicFriction",
                Bridge.WithExternal <UnityEngine.PhysicMaterial>((o, args) => JavaScriptValue.FromDouble(o.dynamicFriction)),
                Bridge.WithExternal <UnityEngine.PhysicMaterial>((o, args) => { o.dynamicFriction = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                PhysicMaterialPrototype,
                "staticFriction",
                Bridge.WithExternal <UnityEngine.PhysicMaterial>((o, args) => JavaScriptValue.FromDouble(o.staticFriction)),
                Bridge.WithExternal <UnityEngine.PhysicMaterial>((o, args) => { o.staticFriction = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                PhysicMaterialPrototype,
                "frictionCombine",
                Bridge.WithExternal <UnityEngine.PhysicMaterial>((o, args) => Bridge.CreateExternalWithPrototype(o.frictionCombine)),
                Bridge.WithExternal <UnityEngine.PhysicMaterial>((o, args) => { o.frictionCombine = Bridge.GetExternal <UnityEngine.PhysicMaterialCombine>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                PhysicMaterialPrototype,
                "bounceCombine",
                Bridge.WithExternal <UnityEngine.PhysicMaterial>((o, args) => Bridge.CreateExternalWithPrototype(o.bounceCombine)),
                Bridge.WithExternal <UnityEngine.PhysicMaterial>((o, args) => { o.bounceCombine = Bridge.GetExternal <UnityEngine.PhysicMaterialCombine>(args[1]); })
                );


            // Instance Methods
        }
Exemplo n.º 13
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue NetworkHash128Prototype;
            JavaScriptValue NetworkHash128Constructor = Bridge.CreateConstructor(
                typeof(UnityEngine.Networking.NetworkHash128),
                (args) => { throw new NotImplementedException(); },
                out NetworkHash128Prototype
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("UnityEngine")
            .GetProperty("Networking")
            .SetProperty("NetworkHash128", NetworkHash128Constructor);


            // Static Fields


            // Static Property Accessors


            // Static Methods

            NetworkHash128Constructor.SetProperty(
                "Parse",
                Bridge.CreateFunction(
                    "Parse",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkHash128.Parse(args[1].ToString()))
                    )
                );


            // Instance Fields

            Bridge.DefineGetterSetter(
                NetworkHash128Prototype,
                "i0",
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => Bridge.CreateExternalWithPrototype(o.i0)),
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => { o.i0 = Bridge.GetExternal <System.Byte>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                NetworkHash128Prototype,
                "i1",
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => Bridge.CreateExternalWithPrototype(o.i1)),
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => { o.i1 = Bridge.GetExternal <System.Byte>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                NetworkHash128Prototype,
                "i2",
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => Bridge.CreateExternalWithPrototype(o.i2)),
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => { o.i2 = Bridge.GetExternal <System.Byte>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                NetworkHash128Prototype,
                "i3",
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => Bridge.CreateExternalWithPrototype(o.i3)),
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => { o.i3 = Bridge.GetExternal <System.Byte>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                NetworkHash128Prototype,
                "i4",
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => Bridge.CreateExternalWithPrototype(o.i4)),
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => { o.i4 = Bridge.GetExternal <System.Byte>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                NetworkHash128Prototype,
                "i5",
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => Bridge.CreateExternalWithPrototype(o.i5)),
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => { o.i5 = Bridge.GetExternal <System.Byte>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                NetworkHash128Prototype,
                "i6",
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => Bridge.CreateExternalWithPrototype(o.i6)),
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => { o.i6 = Bridge.GetExternal <System.Byte>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                NetworkHash128Prototype,
                "i7",
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => Bridge.CreateExternalWithPrototype(o.i7)),
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => { o.i7 = Bridge.GetExternal <System.Byte>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                NetworkHash128Prototype,
                "i8",
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => Bridge.CreateExternalWithPrototype(o.i8)),
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => { o.i8 = Bridge.GetExternal <System.Byte>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                NetworkHash128Prototype,
                "i9",
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => Bridge.CreateExternalWithPrototype(o.i9)),
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => { o.i9 = Bridge.GetExternal <System.Byte>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                NetworkHash128Prototype,
                "i10",
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => Bridge.CreateExternalWithPrototype(o.i10)),
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => { o.i10 = Bridge.GetExternal <System.Byte>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                NetworkHash128Prototype,
                "i11",
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => Bridge.CreateExternalWithPrototype(o.i11)),
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => { o.i11 = Bridge.GetExternal <System.Byte>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                NetworkHash128Prototype,
                "i12",
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => Bridge.CreateExternalWithPrototype(o.i12)),
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => { o.i12 = Bridge.GetExternal <System.Byte>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                NetworkHash128Prototype,
                "i13",
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => Bridge.CreateExternalWithPrototype(o.i13)),
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => { o.i13 = Bridge.GetExternal <System.Byte>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                NetworkHash128Prototype,
                "i14",
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => Bridge.CreateExternalWithPrototype(o.i14)),
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => { o.i14 = Bridge.GetExternal <System.Byte>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                NetworkHash128Prototype,
                "i15",
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => Bridge.CreateExternalWithPrototype(o.i15)),
                WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => { o.i15 = Bridge.GetExternal <System.Byte>(args[1]); })
                );


            // Instance Property Accessors


            // Instance Methods

            NetworkHash128Prototype.SetProperty(
                "Reset",
                Bridge.CreateFunction(
                    "Reset",
                    WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => o.Reset())
                    )
                );


            NetworkHash128Prototype.SetProperty(
                "IsValid",
                Bridge.CreateFunction(
                    "IsValid",
                    WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => JavaScriptValue.FromBoolean(o.IsValid()))
                    )
                );


            NetworkHash128Prototype.SetProperty(
                "toString",
                Bridge.CreateFunction(
                    "ToString",
                    WithExternal <UnityEngine.Networking.NetworkHash128>((o, args) => JavaScriptValue.FromString(o.ToString()))
                    )
                );
        }
Exemplo n.º 14
0
 internal static extern JavaScriptErrorCode JsCreateContext(JavaScriptRuntime runtime, out JavaScriptContext newContext);
Exemplo n.º 15
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue NetworkIdentityPrototype;
            JavaScriptValue NetworkIdentityConstructor = Bridge.CreateConstructor(
                typeof(UnityEngine.Networking.NetworkIdentity),
                (args) => { throw new NotImplementedException(); },
                out NetworkIdentityPrototype
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("UnityEngine")
            .GetProperty("Networking")
            .SetProperty("NetworkIdentity", NetworkIdentityConstructor);


            // Static Fields

            Bridge.DefineGetterSetter(
                NetworkIdentityConstructor,
                "clientAuthorityCallback",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkIdentity.clientAuthorityCallback),
                (args) => { UnityEngine.Networking.NetworkIdentity.clientAuthorityCallback = Bridge.GetExternal <UnityEngine.Networking.NetworkIdentity.ClientAuthorityCallback>(args[1]); }
                );


            // Static Property Accessors


            // Static Methods


            // Instance Fields


            // Instance Property Accessors

            Bridge.DefineGetter(
                NetworkIdentityPrototype,
                "isClient",
                WithExternal <UnityEngine.Networking.NetworkIdentity>((o, args) => JavaScriptValue.FromBoolean(o.isClient))
                );


            Bridge.DefineGetter(
                NetworkIdentityPrototype,
                "isServer",
                WithExternal <UnityEngine.Networking.NetworkIdentity>((o, args) => JavaScriptValue.FromBoolean(o.isServer))
                );


            Bridge.DefineGetter(
                NetworkIdentityPrototype,
                "hasAuthority",
                WithExternal <UnityEngine.Networking.NetworkIdentity>((o, args) => JavaScriptValue.FromBoolean(o.hasAuthority))
                );


            Bridge.DefineGetter(
                NetworkIdentityPrototype,
                "netId",
                WithExternal <UnityEngine.Networking.NetworkIdentity>((o, args) => Bridge.CreateExternalWithPrototype(o.netId))
                );


            Bridge.DefineGetter(
                NetworkIdentityPrototype,
                "sceneId",
                WithExternal <UnityEngine.Networking.NetworkIdentity>((o, args) => Bridge.CreateExternalWithPrototype(o.sceneId))
                );


            Bridge.DefineGetterSetter(
                NetworkIdentityPrototype,
                "serverOnly",
                WithExternal <UnityEngine.Networking.NetworkIdentity>((o, args) => JavaScriptValue.FromBoolean(o.serverOnly)),
                WithExternal <UnityEngine.Networking.NetworkIdentity>((o, args) => { o.serverOnly = args[1].ToBoolean(); })
                );


            Bridge.DefineGetterSetter(
                NetworkIdentityPrototype,
                "localPlayerAuthority",
                WithExternal <UnityEngine.Networking.NetworkIdentity>((o, args) => JavaScriptValue.FromBoolean(o.localPlayerAuthority)),
                WithExternal <UnityEngine.Networking.NetworkIdentity>((o, args) => { o.localPlayerAuthority = args[1].ToBoolean(); })
                );


            Bridge.DefineGetter(
                NetworkIdentityPrototype,
                "clientAuthorityOwner",
                WithExternal <UnityEngine.Networking.NetworkIdentity>((o, args) => Bridge.CreateExternalWithPrototype(o.clientAuthorityOwner))
                );


            Bridge.DefineGetter(
                NetworkIdentityPrototype,
                "assetId",
                WithExternal <UnityEngine.Networking.NetworkIdentity>((o, args) => Bridge.CreateExternalWithPrototype(o.assetId))
                );


            Bridge.DefineGetter(
                NetworkIdentityPrototype,
                "isLocalPlayer",
                WithExternal <UnityEngine.Networking.NetworkIdentity>((o, args) => JavaScriptValue.FromBoolean(o.isLocalPlayer))
                );


            Bridge.DefineGetter(
                NetworkIdentityPrototype,
                "playerControllerId",
                WithExternal <UnityEngine.Networking.NetworkIdentity>((o, args) => Bridge.CreateExternalWithPrototype(o.playerControllerId))
                );


            Bridge.DefineGetter(
                NetworkIdentityPrototype,
                "connectionToServer",
                WithExternal <UnityEngine.Networking.NetworkIdentity>((o, args) => Bridge.CreateExternalWithPrototype(o.connectionToServer))
                );


            Bridge.DefineGetter(
                NetworkIdentityPrototype,
                "connectionToClient",
                WithExternal <UnityEngine.Networking.NetworkIdentity>((o, args) => Bridge.CreateExternalWithPrototype(o.connectionToClient))
                );


            Bridge.DefineGetter(
                NetworkIdentityPrototype,
                "observers",
                WithExternal <UnityEngine.Networking.NetworkIdentity>((o, args) => Bridge.CreateExternalWithPrototype(o.observers))
                );


            // Instance Methods

            NetworkIdentityPrototype.SetProperty(
                "ForceSceneId",
                Bridge.CreateFunction(
                    "ForceSceneId",
                    WithExternal <UnityEngine.Networking.NetworkIdentity>((o, args) => o.ForceSceneId(args[1].ToInt32()))
                    )
                );


            NetworkIdentityPrototype.SetProperty(
                "RebuildObservers",
                Bridge.CreateFunction(
                    "RebuildObservers",
                    WithExternal <UnityEngine.Networking.NetworkIdentity>((o, args) => o.RebuildObservers(args[1].ToBoolean()))
                    )
                );


            NetworkIdentityPrototype.SetProperty(
                "RemoveClientAuthority",
                Bridge.CreateFunction(
                    "RemoveClientAuthority",
                    WithExternal <UnityEngine.Networking.NetworkIdentity>((o, args) => JavaScriptValue.FromBoolean(o.RemoveClientAuthority(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]))))
                    )
                );


            NetworkIdentityPrototype.SetProperty(
                "AssignClientAuthority",
                Bridge.CreateFunction(
                    "AssignClientAuthority",
                    WithExternal <UnityEngine.Networking.NetworkIdentity>((o, args) => JavaScriptValue.FromBoolean(o.AssignClientAuthority(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]))))
                    )
                );
        }
Exemplo n.º 16
0
 internal static extern JavaScriptErrorCode JsSetCurrentContext(JavaScriptContext context);
Exemplo n.º 17
0
 void CreateContext()
 {
     _context = _runtime.CreateContext();
     _scope   = new JavaScriptContext.Scope(_context);
 }
Exemplo n.º 18
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue PlayerConnectionPrototype;
            JavaScriptValue PlayerConnectionConstructor = Bridge.CreateConstructor(
                typeof(UnityEngine.Networking.PlayerConnection.PlayerConnection),
                (args) => { throw new NotImplementedException(); },
                out PlayerConnectionPrototype // extends TODO
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("UnityEngine")
            .GetProperty("Networking")
            .GetProperty("PlayerConnection")
            .SetProperty("PlayerConnection", PlayerConnectionConstructor);


            // Static Fields


            // Static Property Accessors

            Bridge.DefineGetter(
                PlayerConnectionConstructor,
                "instance",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.PlayerConnection.PlayerConnection.instance)
                );


            // Static Methods


            // Instance Fields


            // Instance Property Accessors

            Bridge.DefineGetter(
                PlayerConnectionPrototype,
                "isConnected",
                WithExternal <UnityEngine.Networking.PlayerConnection.PlayerConnection>((o, args) => JavaScriptValue.FromBoolean(o.isConnected))
                );


            // Instance Methods

            PlayerConnectionPrototype.SetProperty(
                "OnEnable",
                Bridge.CreateFunction(
                    "OnEnable",
                    WithExternal <UnityEngine.Networking.PlayerConnection.PlayerConnection>((o, args) => o.OnEnable())
                    )
                );


            /*
             * PlayerConnection Register
             * UnityEngine.Events.UnityAction`1[UnityEngine.Networking.PlayerConnection.MessageEventArgs] has generics
             */


            /*
             * PlayerConnection Unregister
             * UnityEngine.Events.UnityAction`1[UnityEngine.Networking.PlayerConnection.MessageEventArgs] has generics
             */


            /*
             * PlayerConnection RegisterConnection
             * UnityEngine.Events.UnityAction`1[System.Int32] has generics
             */


            /*
             * PlayerConnection RegisterDisconnection
             * UnityEngine.Events.UnityAction`1[System.Int32] has generics
             */


            PlayerConnectionPrototype.SetProperty(
                "Send",
                Bridge.CreateFunction(
                    "Send",
                    WithExternal <UnityEngine.Networking.PlayerConnection.PlayerConnection>((o, args) => o.Send(Bridge.GetExternal <System.Guid>(args[1]), Bridge.GetExternal <System.Byte[]>(args[2])))
                    )
                );


            PlayerConnectionPrototype.SetProperty(
                "BlockUntilRecvMsg",
                Bridge.CreateFunction(
                    "BlockUntilRecvMsg",
                    WithExternal <UnityEngine.Networking.PlayerConnection.PlayerConnection>((o, args) => JavaScriptValue.FromBoolean(o.BlockUntilRecvMsg(Bridge.GetExternal <System.Guid>(args[1]), args[2].ToInt32())))
                    )
                );


            PlayerConnectionPrototype.SetProperty(
                "DisconnectAll",
                Bridge.CreateFunction(
                    "DisconnectAll",
                    WithExternal <UnityEngine.Networking.PlayerConnection.PlayerConnection>((o, args) => o.DisconnectAll())
                    )
                );
        }
Exemplo n.º 19
0
 public void Reset()
 {
     Dispose();
     runtime = JavaScriptRuntime.Create();
     context = runtime.CreateContext();
 }
Exemplo n.º 20
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue RaycastResultPrototype;
            JavaScriptValue RaycastResultConstructor = Bridge.CreateConstructor(
                typeof(UnityEngine.EventSystems.RaycastResult),
                (args) => { throw new NotImplementedException(); },
                out RaycastResultPrototype
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("UnityEngine")
            .GetProperty("EventSystems")
            .SetProperty("RaycastResult", RaycastResultConstructor);


            // Static Fields


            // Static Property Accessors


            // Static Methods


            // Instance Fields

            Bridge.DefineGetterSetter(
                RaycastResultPrototype,
                "module",
                WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => Bridge.CreateExternalWithPrototype(o.module)),
                WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => { o.module = Bridge.GetExternal <UnityEngine.EventSystems.BaseRaycaster>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                RaycastResultPrototype,
                "distance",
                WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => JavaScriptValue.FromDouble(o.distance)),
                WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => { o.distance = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                RaycastResultPrototype,
                "index",
                WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => JavaScriptValue.FromDouble(o.index)),
                WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => { o.index = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                RaycastResultPrototype,
                "depth",
                WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => JavaScriptValue.FromInt32(o.depth)),
                WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => { o.depth = args[1].ToInt32(); })
                );


            Bridge.DefineGetterSetter(
                RaycastResultPrototype,
                "sortingLayer",
                WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => JavaScriptValue.FromInt32(o.sortingLayer)),
                WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => { o.sortingLayer = args[1].ToInt32(); })
                );


            Bridge.DefineGetterSetter(
                RaycastResultPrototype,
                "sortingOrder",
                WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => JavaScriptValue.FromInt32(o.sortingOrder)),
                WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => { o.sortingOrder = args[1].ToInt32(); })
                );


            Bridge.DefineGetterSetter(
                RaycastResultPrototype,
                "worldPosition",
                WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => Bridge.CreateExternalWithPrototype(o.worldPosition)),
                WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => { o.worldPosition = Bridge.GetExternal <UnityEngine.Vector3>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                RaycastResultPrototype,
                "worldNormal",
                WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => Bridge.CreateExternalWithPrototype(o.worldNormal)),
                WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => { o.worldNormal = Bridge.GetExternal <UnityEngine.Vector3>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                RaycastResultPrototype,
                "screenPosition",
                WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => Bridge.CreateExternalWithPrototype(o.screenPosition)),
                WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => { o.screenPosition = Bridge.GetExternal <UnityEngine.Vector2>(args[1]); })
                );


            // Instance Property Accessors

            Bridge.DefineGetterSetter(
                RaycastResultPrototype,
                "gameObject",
                WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => Bridge.CreateExternalWithPrototype(o.gameObject)),
                WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => { o.gameObject = Bridge.GetExternal <UnityEngine.GameObject>(args[1]); })
                );


            Bridge.DefineGetter(
                RaycastResultPrototype,
                "isValid",
                WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => JavaScriptValue.FromBoolean(o.isValid))
                );


            // Instance Methods

            RaycastResultPrototype.SetProperty(
                "Clear",
                Bridge.CreateFunction(
                    "Clear",
                    WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => o.Clear())
                    )
                );


            RaycastResultPrototype.SetProperty(
                "ToString",
                Bridge.CreateFunction(
                    "ToString",
                    WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => JavaScriptValue.FromString(o.ToString()))
                    )
                );
        }
Exemplo n.º 21
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue NetworkServerPrototype;
            JavaScriptValue NetworkServerConstructor = Bridge.CreateConstructor(
                typeof(UnityEngine.Networking.NetworkServer),
                (args) => { throw new NotImplementedException(); },
                out NetworkServerPrototype
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("UnityEngine")
            .GetProperty("Networking")
            .SetProperty("NetworkServer", NetworkServerConstructor);


            // Static Fields


            // Static Property Accessors

            Bridge.DefineGetter(
                NetworkServerConstructor,
                "localConnections",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkServer.localConnections)
                );


            Bridge.DefineGetter(
                NetworkServerConstructor,
                "listenPort",
                (args) => JavaScriptValue.FromInt32(UnityEngine.Networking.NetworkServer.listenPort)
                );


            Bridge.DefineGetter(
                NetworkServerConstructor,
                "serverHostId",
                (args) => JavaScriptValue.FromInt32(UnityEngine.Networking.NetworkServer.serverHostId)
                );


            Bridge.DefineGetter(
                NetworkServerConstructor,
                "connections",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkServer.connections)
                );


            Bridge.DefineGetter(
                NetworkServerConstructor,
                "handlers",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkServer.handlers)
                );


            Bridge.DefineGetter(
                NetworkServerConstructor,
                "hostTopology",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkServer.hostTopology)
                );


            Bridge.DefineGetter(
                NetworkServerConstructor,
                "objects",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkServer.objects)
                );


            Bridge.DefineGetterSetter(
                NetworkServerConstructor,
                "dontListen",
                (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.dontListen),
                (args) => { UnityEngine.Networking.NetworkServer.dontListen = args[1].ToBoolean(); }
                );


            Bridge.DefineGetterSetter(
                NetworkServerConstructor,
                "useWebSockets",
                (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.useWebSockets),
                (args) => { UnityEngine.Networking.NetworkServer.useWebSockets = args[1].ToBoolean(); }
                );


            Bridge.DefineGetter(
                NetworkServerConstructor,
                "active",
                (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.active)
                );


            Bridge.DefineGetter(
                NetworkServerConstructor,
                "localClientActive",
                (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.localClientActive)
                );


            Bridge.DefineGetter(
                NetworkServerConstructor,
                "numChannels",
                (args) => JavaScriptValue.FromInt32(UnityEngine.Networking.NetworkServer.numChannels)
                );


            Bridge.DefineGetterSetter(
                NetworkServerConstructor,
                "maxDelay",
                (args) => JavaScriptValue.FromDouble(UnityEngine.Networking.NetworkServer.maxDelay),
                (args) => { UnityEngine.Networking.NetworkServer.maxDelay = (float)args[1].ToDouble(); }
                );


            Bridge.DefineGetter(
                NetworkServerConstructor,
                "networkConnectionClass",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkServer.networkConnectionClass)
                );


            // Static Methods

            /*
             * NetworkServer SetNetworkConnectionClass
             * method has generics
             */


            NetworkServerConstructor.SetProperty(
                "Configure",
                Bridge.CreateFunction(
                    "Configure",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.Configure(Bridge.GetExternal <UnityEngine.Networking.ConnectionConfig>(args[1]), args[2].ToInt32()))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "Configure",
                Bridge.CreateFunction(
                    "Configure",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.Configure(Bridge.GetExternal <UnityEngine.Networking.HostTopology>(args[1])))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "Reset",
                Bridge.CreateFunction(
                    "Reset",
                    (args) => UnityEngine.Networking.NetworkServer.Reset()
                    )
                );


            NetworkServerConstructor.SetProperty(
                "Shutdown",
                Bridge.CreateFunction(
                    "Shutdown",
                    (args) => UnityEngine.Networking.NetworkServer.Shutdown()
                    )
                );


            NetworkServerConstructor.SetProperty(
                "Listen",
                Bridge.CreateFunction(
                    "Listen",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.Listen(Bridge.GetExternal <UnityEngine.Networking.Match.MatchInfo>(args[1]), args[2].ToInt32()))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "ListenRelay",
                Bridge.CreateFunction(
                    "ListenRelay",
                    (args) => UnityEngine.Networking.NetworkServer.ListenRelay(args[1].ToString(), args[2].ToInt32(), Bridge.GetExternal <UnityEngine.Networking.Types.NetworkID>(args[3]), Bridge.GetExternal <UnityEngine.Networking.Types.SourceID>(args[4]), Bridge.GetExternal <UnityEngine.Networking.Types.NodeID>(args[5]))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "Listen",
                Bridge.CreateFunction(
                    "Listen",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.Listen(args[1].ToInt32()))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "Listen",
                Bridge.CreateFunction(
                    "Listen",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.Listen(args[1].ToString(), args[2].ToInt32()))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "BecomeHost",
                Bridge.CreateFunction(
                    "BecomeHost",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkServer.BecomeHost(Bridge.GetExternal <UnityEngine.Networking.NetworkClient>(args[1]), args[2].ToInt32(), Bridge.GetExternal <UnityEngine.Networking.Match.MatchInfo>(args[3]), args[4].ToInt32(), Bridge.GetExternal <UnityEngine.Networking.NetworkSystem.PeerInfoMessage[]>(args[5])))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "SendToAll",
                Bridge.CreateFunction(
                    "SendToAll",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.SendToAll(Bridge.GetExternal <System.Int16>(args[1]), Bridge.GetExternal <UnityEngine.Networking.MessageBase>(args[2])))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "SendToReady",
                Bridge.CreateFunction(
                    "SendToReady",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.SendToReady(Bridge.GetExternal <UnityEngine.GameObject>(args[1]), Bridge.GetExternal <System.Int16>(args[2]), Bridge.GetExternal <UnityEngine.Networking.MessageBase>(args[3])))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "SendWriterToReady",
                Bridge.CreateFunction(
                    "SendWriterToReady",
                    (args) => UnityEngine.Networking.NetworkServer.SendWriterToReady(Bridge.GetExternal <UnityEngine.GameObject>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkWriter>(args[2]), args[3].ToInt32())
                    )
                );


            NetworkServerConstructor.SetProperty(
                "SendBytesToReady",
                Bridge.CreateFunction(
                    "SendBytesToReady",
                    (args) => UnityEngine.Networking.NetworkServer.SendBytesToReady(Bridge.GetExternal <UnityEngine.GameObject>(args[1]), Bridge.GetExternal <System.Byte[]>(args[2]), args[3].ToInt32(), args[4].ToInt32())
                    )
                );


            NetworkServerConstructor.SetProperty(
                "SendBytesToPlayer",
                Bridge.CreateFunction(
                    "SendBytesToPlayer",
                    (args) => UnityEngine.Networking.NetworkServer.SendBytesToPlayer(Bridge.GetExternal <UnityEngine.GameObject>(args[1]), Bridge.GetExternal <System.Byte[]>(args[2]), args[3].ToInt32(), args[4].ToInt32())
                    )
                );


            NetworkServerConstructor.SetProperty(
                "SendUnreliableToAll",
                Bridge.CreateFunction(
                    "SendUnreliableToAll",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.SendUnreliableToAll(Bridge.GetExternal <System.Int16>(args[1]), Bridge.GetExternal <UnityEngine.Networking.MessageBase>(args[2])))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "SendUnreliableToReady",
                Bridge.CreateFunction(
                    "SendUnreliableToReady",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.SendUnreliableToReady(Bridge.GetExternal <UnityEngine.GameObject>(args[1]), Bridge.GetExternal <System.Int16>(args[2]), Bridge.GetExternal <UnityEngine.Networking.MessageBase>(args[3])))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "SendByChannelToAll",
                Bridge.CreateFunction(
                    "SendByChannelToAll",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.SendByChannelToAll(Bridge.GetExternal <System.Int16>(args[1]), Bridge.GetExternal <UnityEngine.Networking.MessageBase>(args[2]), args[3].ToInt32()))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "SendByChannelToReady",
                Bridge.CreateFunction(
                    "SendByChannelToReady",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.SendByChannelToReady(Bridge.GetExternal <UnityEngine.GameObject>(args[1]), Bridge.GetExternal <System.Int16>(args[2]), Bridge.GetExternal <UnityEngine.Networking.MessageBase>(args[3]), args[4].ToInt32()))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "DisconnectAll",
                Bridge.CreateFunction(
                    "DisconnectAll",
                    (args) => UnityEngine.Networking.NetworkServer.DisconnectAll()
                    )
                );


            NetworkServerConstructor.SetProperty(
                "RegisterHandler",
                Bridge.CreateFunction(
                    "RegisterHandler",
                    (args) => UnityEngine.Networking.NetworkServer.RegisterHandler(Bridge.GetExternal <System.Int16>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkMessageDelegate>(args[2]))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "UnregisterHandler",
                Bridge.CreateFunction(
                    "UnregisterHandler",
                    (args) => UnityEngine.Networking.NetworkServer.UnregisterHandler(Bridge.GetExternal <System.Int16>(args[1]))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "ClearHandlers",
                Bridge.CreateFunction(
                    "ClearHandlers",
                    (args) => UnityEngine.Networking.NetworkServer.ClearHandlers()
                    )
                );


            NetworkServerConstructor.SetProperty(
                "ClearSpawners",
                Bridge.CreateFunction(
                    "ClearSpawners",
                    (args) => UnityEngine.Networking.NetworkServer.ClearSpawners()
                    )
                );


            /*
             * NetworkServer GetStatsOut
             * parameter numMsgs is out
             */


            /*
             * NetworkServer GetStatsIn
             * parameter numMsgs is out
             */


            NetworkServerConstructor.SetProperty(
                "SendToClientOfPlayer",
                Bridge.CreateFunction(
                    "SendToClientOfPlayer",
                    (args) => UnityEngine.Networking.NetworkServer.SendToClientOfPlayer(Bridge.GetExternal <UnityEngine.GameObject>(args[1]), Bridge.GetExternal <System.Int16>(args[2]), Bridge.GetExternal <UnityEngine.Networking.MessageBase>(args[3]))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "SendToClient",
                Bridge.CreateFunction(
                    "SendToClient",
                    (args) => UnityEngine.Networking.NetworkServer.SendToClient(args[1].ToInt32(), Bridge.GetExternal <System.Int16>(args[2]), Bridge.GetExternal <UnityEngine.Networking.MessageBase>(args[3]))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "ReplacePlayerForConnection",
                Bridge.CreateFunction(
                    "ReplacePlayerForConnection",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.ReplacePlayerForConnection(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]), Bridge.GetExternal <UnityEngine.GameObject>(args[2]), Bridge.GetExternal <System.Int16>(args[3]), Bridge.GetExternal <UnityEngine.Networking.NetworkHash128>(args[4])))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "ReplacePlayerForConnection",
                Bridge.CreateFunction(
                    "ReplacePlayerForConnection",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.ReplacePlayerForConnection(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]), Bridge.GetExternal <UnityEngine.GameObject>(args[2]), Bridge.GetExternal <System.Int16>(args[3])))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "AddPlayerForConnection",
                Bridge.CreateFunction(
                    "AddPlayerForConnection",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.AddPlayerForConnection(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]), Bridge.GetExternal <UnityEngine.GameObject>(args[2]), Bridge.GetExternal <System.Int16>(args[3]), Bridge.GetExternal <UnityEngine.Networking.NetworkHash128>(args[4])))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "AddPlayerForConnection",
                Bridge.CreateFunction(
                    "AddPlayerForConnection",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.AddPlayerForConnection(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]), Bridge.GetExternal <UnityEngine.GameObject>(args[2]), Bridge.GetExternal <System.Int16>(args[3])))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "SetClientReady",
                Bridge.CreateFunction(
                    "SetClientReady",
                    (args) => UnityEngine.Networking.NetworkServer.SetClientReady(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "SetAllClientsNotReady",
                Bridge.CreateFunction(
                    "SetAllClientsNotReady",
                    (args) => UnityEngine.Networking.NetworkServer.SetAllClientsNotReady()
                    )
                );


            NetworkServerConstructor.SetProperty(
                "SetClientNotReady",
                Bridge.CreateFunction(
                    "SetClientNotReady",
                    (args) => UnityEngine.Networking.NetworkServer.SetClientNotReady(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "DestroyPlayersForConnection",
                Bridge.CreateFunction(
                    "DestroyPlayersForConnection",
                    (args) => UnityEngine.Networking.NetworkServer.DestroyPlayersForConnection(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "ClearLocalObjects",
                Bridge.CreateFunction(
                    "ClearLocalObjects",
                    (args) => UnityEngine.Networking.NetworkServer.ClearLocalObjects()
                    )
                );


            NetworkServerConstructor.SetProperty(
                "Spawn",
                Bridge.CreateFunction(
                    "Spawn",
                    (args) => UnityEngine.Networking.NetworkServer.Spawn(Bridge.GetExternal <UnityEngine.GameObject>(args[1]))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "SpawnWithClientAuthority",
                Bridge.CreateFunction(
                    "SpawnWithClientAuthority",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.SpawnWithClientAuthority(Bridge.GetExternal <UnityEngine.GameObject>(args[1]), Bridge.GetExternal <UnityEngine.GameObject>(args[2])))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "SpawnWithClientAuthority",
                Bridge.CreateFunction(
                    "SpawnWithClientAuthority",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.SpawnWithClientAuthority(Bridge.GetExternal <UnityEngine.GameObject>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[2])))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "SpawnWithClientAuthority",
                Bridge.CreateFunction(
                    "SpawnWithClientAuthority",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.SpawnWithClientAuthority(Bridge.GetExternal <UnityEngine.GameObject>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkHash128>(args[2]), Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[3])))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "Spawn",
                Bridge.CreateFunction(
                    "Spawn",
                    (args) => UnityEngine.Networking.NetworkServer.Spawn(Bridge.GetExternal <UnityEngine.GameObject>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkHash128>(args[2]))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "Destroy",
                Bridge.CreateFunction(
                    "Destroy",
                    (args) => UnityEngine.Networking.NetworkServer.Destroy(Bridge.GetExternal <UnityEngine.GameObject>(args[1]))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "UnSpawn",
                Bridge.CreateFunction(
                    "UnSpawn",
                    (args) => UnityEngine.Networking.NetworkServer.UnSpawn(Bridge.GetExternal <UnityEngine.GameObject>(args[1]))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "FindLocalObject",
                Bridge.CreateFunction(
                    "FindLocalObject",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkServer.FindLocalObject(Bridge.GetExternal <UnityEngine.Networking.NetworkInstanceId>(args[1])))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "GetConnectionStats",
                Bridge.CreateFunction(
                    "GetConnectionStats",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkServer.GetConnectionStats())
                    )
                );


            NetworkServerConstructor.SetProperty(
                "ResetConnectionStats",
                Bridge.CreateFunction(
                    "ResetConnectionStats",
                    (args) => UnityEngine.Networking.NetworkServer.ResetConnectionStats()
                    )
                );


            NetworkServerConstructor.SetProperty(
                "AddExternalConnection",
                Bridge.CreateFunction(
                    "AddExternalConnection",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.AddExternalConnection(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1])))
                    )
                );


            NetworkServerConstructor.SetProperty(
                "RemoveExternalConnection",
                Bridge.CreateFunction(
                    "RemoveExternalConnection",
                    (args) => UnityEngine.Networking.NetworkServer.RemoveExternalConnection(args[1].ToInt32())
                    )
                );


            NetworkServerConstructor.SetProperty(
                "SpawnObjects",
                Bridge.CreateFunction(
                    "SpawnObjects",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.SpawnObjects())
                    )
                );


            // Instance Fields


            // Instance Property Accessors


            // Instance Methods
        }
Exemplo n.º 22
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue MeshTopologyPrototype;
            JavaScriptValue MeshTopologyConstructor = Bridge.CreateConstructor(
                typeof(UnityEngine.MeshTopology),
                (args) => { throw new System.NotImplementedException(); },
                out MeshTopologyPrototype
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("UnityEngine")
            .SetProperty("MeshTopology", MeshTopologyConstructor);


            // Static Fields

            MeshTopologyConstructor.SetProperty(
                "Triangles",
                Bridge.CreateExternalWithPrototype(UnityEngine.MeshTopology.Triangles)
                );


            MeshTopologyConstructor.SetProperty(
                "Quads",
                Bridge.CreateExternalWithPrototype(UnityEngine.MeshTopology.Quads)
                );


            MeshTopologyConstructor.SetProperty(
                "Lines",
                Bridge.CreateExternalWithPrototype(UnityEngine.MeshTopology.Lines)
                );


            MeshTopologyConstructor.SetProperty(
                "LineStrip",
                Bridge.CreateExternalWithPrototype(UnityEngine.MeshTopology.LineStrip)
                );


            MeshTopologyConstructor.SetProperty(
                "Points",
                Bridge.CreateExternalWithPrototype(UnityEngine.MeshTopology.Points)
                );


            // Static Property Accessors


            // Static Methods


            // Instance Fields


            // Instance Property Accessors


            // Instance Methods
        }
Exemplo n.º 23
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue NetworkEventTypePrototype;
            JavaScriptValue NetworkEventTypeConstructor = Bridge.CreateConstructor(
                typeof(UnityEngine.Networking.NetworkEventType),
                (args) => { throw new NotImplementedException(); },
                out NetworkEventTypePrototype
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("UnityEngine")
            .GetProperty("Networking")
            .SetProperty("NetworkEventType", NetworkEventTypeConstructor);


            // Static Fields

            NetworkEventTypeConstructor.SetProperty(
                "DataEvent",
                Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkEventType.DataEvent)
                );


            NetworkEventTypeConstructor.SetProperty(
                "ConnectEvent",
                Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkEventType.ConnectEvent)
                );


            NetworkEventTypeConstructor.SetProperty(
                "DisconnectEvent",
                Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkEventType.DisconnectEvent)
                );


            NetworkEventTypeConstructor.SetProperty(
                "Nothing",
                Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkEventType.Nothing)
                );


            NetworkEventTypeConstructor.SetProperty(
                "BroadcastEvent",
                Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkEventType.BroadcastEvent)
                );


            // Static Property Accessors


            // Static Methods


            // Instance Fields


            // Instance Property Accessors


            // Instance Methods
        }
Exemplo n.º 24
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue BoneWeightPrototype;
            JavaScriptValue BoneWeightConstructor = Bridge.CreateConstructor(
                typeof(UnityEngine.BoneWeight),
                (args) => { throw new System.NotImplementedException(); },
                out BoneWeightPrototype
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("UnityEngine")
            .SetProperty("BoneWeight", BoneWeightConstructor);


            // Static Fields


            // Static Property Accessors


            // Static Methods


            // Instance Fields


            // Instance Property Accessors

            Bridge.DefineGetterSetter(
                BoneWeightPrototype,
                "weight0",
                Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => JavaScriptValue.FromDouble(o.wrapped.weight0)),
                Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => { o.wrapped.weight0 = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                BoneWeightPrototype,
                "weight1",
                Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => JavaScriptValue.FromDouble(o.wrapped.weight1)),
                Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => { o.wrapped.weight1 = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                BoneWeightPrototype,
                "weight2",
                Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => JavaScriptValue.FromDouble(o.wrapped.weight2)),
                Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => { o.wrapped.weight2 = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                BoneWeightPrototype,
                "weight3",
                Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => JavaScriptValue.FromDouble(o.wrapped.weight3)),
                Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => { o.wrapped.weight3 = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                BoneWeightPrototype,
                "boneIndex0",
                Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => JavaScriptValue.FromInt32(o.wrapped.boneIndex0)),
                Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => { o.wrapped.boneIndex0 = args[1].ToInt32(); })
                );


            Bridge.DefineGetterSetter(
                BoneWeightPrototype,
                "boneIndex1",
                Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => JavaScriptValue.FromInt32(o.wrapped.boneIndex1)),
                Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => { o.wrapped.boneIndex1 = args[1].ToInt32(); })
                );


            Bridge.DefineGetterSetter(
                BoneWeightPrototype,
                "boneIndex2",
                Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => JavaScriptValue.FromInt32(o.wrapped.boneIndex2)),
                Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => { o.wrapped.boneIndex2 = args[1].ToInt32(); })
                );


            Bridge.DefineGetterSetter(
                BoneWeightPrototype,
                "boneIndex3",
                Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => JavaScriptValue.FromInt32(o.wrapped.boneIndex3)),
                Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => { o.wrapped.boneIndex3 = args[1].ToInt32(); })
                );


            // Instance Methods

            BoneWeightPrototype.SetProperty(
                "GetHashCode",
                Bridge.CreateFunction(
                    "GetHashCode",
                    Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => JavaScriptValue.FromInt32(o.wrapped.GetHashCode()))
                    )
                );


            BoneWeightPrototype.SetProperty(
                "Equals",
                Bridge.CreateFunction(
                    "Equals",
                    Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.Equals(Bridge.GetExternal <System.Object>(args[1]))))
                    )
                );


            BoneWeightPrototype.SetProperty(
                "Equals",
                Bridge.CreateFunction(
                    "Equals",
                    Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.Equals(Bridge.GetBoxedExternal <UnityEngine.BoneWeight>(args[1]).wrapped)))
                    )
                );
        }
Exemplo n.º 25
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue RaycastHitPrototype;
            JavaScriptValue RaycastHitConstructor = Bridge.CreateConstructor(
                typeof(UnityEngine.RaycastHit),
                (args) => { throw new System.NotImplementedException(); },
                out RaycastHitPrototype
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("UnityEngine")
            .SetProperty("RaycastHit", RaycastHitConstructor);


            // Static Fields


            // Static Property Accessors


            // Static Methods


            // Instance Fields


            // Instance Property Accessors

            Bridge.DefineGetter(
                RaycastHitPrototype,
                "collider",
                Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.collider))
                );


            Bridge.DefineGetterSetter(
                RaycastHitPrototype,
                "point",
                Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.point)),
                Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => { o.wrapped.point = Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped; })
                );


            Bridge.DefineGetterSetter(
                RaycastHitPrototype,
                "normal",
                Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.normal)),
                Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => { o.wrapped.normal = Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped; })
                );


            Bridge.DefineGetterSetter(
                RaycastHitPrototype,
                "barycentricCoordinate",
                Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.barycentricCoordinate)),
                Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => { o.wrapped.barycentricCoordinate = Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped; })
                );


            Bridge.DefineGetterSetter(
                RaycastHitPrototype,
                "distance",
                Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => JavaScriptValue.FromDouble(o.wrapped.distance)),
                Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => { o.wrapped.distance = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetter(
                RaycastHitPrototype,
                "triangleIndex",
                Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => JavaScriptValue.FromInt32(o.wrapped.triangleIndex))
                );


            Bridge.DefineGetter(
                RaycastHitPrototype,
                "textureCoord",
                Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.textureCoord))
                );


            Bridge.DefineGetter(
                RaycastHitPrototype,
                "textureCoord2",
                Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.textureCoord2))
                );


            Bridge.DefineGetter(
                RaycastHitPrototype,
                "transform",
                Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.transform))
                );


            Bridge.DefineGetter(
                RaycastHitPrototype,
                "rigidbody",
                Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.rigidbody))
                );


            Bridge.DefineGetter(
                RaycastHitPrototype,
                "lightmapCoord",
                Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.lightmapCoord))
                );


            // Instance Methods
        }
Exemplo n.º 26
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue CursorPrototype;
            JavaScriptValue CursorConstructor = Bridge.CreateConstructor(
                typeof(UnityEngine.Cursor),
                (args) => { throw new System.NotImplementedException(); },
                out CursorPrototype
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("UnityEngine")
            .SetProperty("Cursor", CursorConstructor);


            // Static Fields


            // Static Property Accessors

            Bridge.DefineGetterSetter(
                CursorConstructor,
                "visible",
                (args) => JavaScriptValue.FromBoolean(UnityEngine.Cursor.visible),
                (args) => { UnityEngine.Cursor.visible = args[1].ToBoolean(); }
                );


            Bridge.DefineGetterSetter(
                CursorConstructor,
                "lockState",
                (args) => {
                var lockState = UnityEngine.Cursor.lockState;
                var enumName  = "";
                switch (UnityEngine.Cursor.lockState)
                {
                case UnityEngine.CursorLockMode.None:
                    enumName = "None";
                    break;

                case UnityEngine.CursorLockMode.Locked:
                    enumName = "Locked";
                    break;

                case UnityEngine.CursorLockMode.Confined:
                    enumName = "Confined";
                    break;
                }

                // We return the CursorLockMode object from the JS side so that the
                // values are `===` to each other in JS-side checks.
                return(JavaScriptValue
                       .GlobalObject
                       .GetProperty("UnityEngine")
                       .GetProperty("CursorLockMode").GetProperty(enumName));
            },
                (args) => { UnityEngine.Cursor.lockState = Bridge.GetExternal <UnityEngine.CursorLockMode>(args[1]); }
                );


            // Static Methods

            CursorConstructor.SetProperty(
                "SetCursor",
                Bridge.CreateFunction(
                    "SetCursor",
                    (args) => UnityEngine.Cursor.SetCursor(Bridge.GetExternal <UnityEngine.Texture2D>(args[1]), Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[2]).wrapped, Bridge.GetExternal <UnityEngine.CursorMode>(args[3]))
                    )
                );


            // Instance Fields


            // Instance Property Accessors


            // Instance Methods
        }
Exemplo n.º 27
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue NetworkClientPrototype;
            JavaScriptValue NetworkClientConstructor = Bridge.CreateConstructor(
                typeof(UnityEngine.Networking.NetworkClient),
                (args) => { throw new NotImplementedException(); },
                out NetworkClientPrototype
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("UnityEngine")
            .GetProperty("Networking")
            .SetProperty("NetworkClient", NetworkClientConstructor);


            // Static Fields


            // Static Property Accessors

            Bridge.DefineGetter(
                NetworkClientConstructor,
                "allClients",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkClient.allClients)
                );


            Bridge.DefineGetter(
                NetworkClientConstructor,
                "active",
                (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkClient.active)
                );


            // Static Methods

            NetworkClientConstructor.SetProperty(
                "GetTotalConnectionStats",
                Bridge.CreateFunction(
                    "GetTotalConnectionStats",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkClient.GetTotalConnectionStats())
                    )
                );


            NetworkClientConstructor.SetProperty(
                "ShutdownAll",
                Bridge.CreateFunction(
                    "ShutdownAll",
                    (args) => UnityEngine.Networking.NetworkClient.ShutdownAll()
                    )
                );


            // Instance Fields


            // Instance Property Accessors

            Bridge.DefineGetter(
                NetworkClientPrototype,
                "serverIp",
                WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => JavaScriptValue.FromString(o.serverIp))
                );


            Bridge.DefineGetter(
                NetworkClientPrototype,
                "serverPort",
                WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => JavaScriptValue.FromInt32(o.serverPort))
                );


            Bridge.DefineGetter(
                NetworkClientPrototype,
                "connection",
                WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => Bridge.CreateExternalWithPrototype(o.connection))
                );


            Bridge.DefineGetter(
                NetworkClientPrototype,
                "handlers",
                WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => Bridge.CreateExternalWithPrototype(o.handlers))
                );


            Bridge.DefineGetter(
                NetworkClientPrototype,
                "numChannels",
                WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => JavaScriptValue.FromInt32(o.numChannels))
                );


            Bridge.DefineGetter(
                NetworkClientPrototype,
                "hostTopology",
                WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => Bridge.CreateExternalWithPrototype(o.hostTopology))
                );


            Bridge.DefineGetterSetter(
                NetworkClientPrototype,
                "hostPort",
                WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => JavaScriptValue.FromInt32(o.hostPort)),
                WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => { o.hostPort = args[1].ToInt32(); })
                );


            Bridge.DefineGetter(
                NetworkClientPrototype,
                "isConnected",
                WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => JavaScriptValue.FromBoolean(o.isConnected))
                );


            Bridge.DefineGetter(
                NetworkClientPrototype,
                "networkConnectionClass",
                WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => Bridge.CreateExternalWithPrototype(o.networkConnectionClass))
                );


            // Instance Methods

            /*
             * NetworkClient SetNetworkConnectionClass
             * method has generics
             */


            NetworkClientPrototype.SetProperty(
                "Configure",
                Bridge.CreateFunction(
                    "Configure",
                    WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => JavaScriptValue.FromBoolean(o.Configure(Bridge.GetExternal <UnityEngine.Networking.ConnectionConfig>(args[1]), args[2].ToInt32())))
                    )
                );


            NetworkClientPrototype.SetProperty(
                "Configure",
                Bridge.CreateFunction(
                    "Configure",
                    WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => JavaScriptValue.FromBoolean(o.Configure(Bridge.GetExternal <UnityEngine.Networking.HostTopology>(args[1]))))
                    )
                );


            NetworkClientPrototype.SetProperty(
                "Connect",
                Bridge.CreateFunction(
                    "Connect",
                    WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => o.Connect(Bridge.GetExternal <UnityEngine.Networking.Match.MatchInfo>(args[1])))
                    )
                );


            NetworkClientPrototype.SetProperty(
                "ReconnectToNewHost",
                Bridge.CreateFunction(
                    "ReconnectToNewHost",
                    WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => JavaScriptValue.FromBoolean(o.ReconnectToNewHost(args[1].ToString(), args[2].ToInt32())))
                    )
                );


            NetworkClientPrototype.SetProperty(
                "ReconnectToNewHost",
                Bridge.CreateFunction(
                    "ReconnectToNewHost",
                    WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => JavaScriptValue.FromBoolean(o.ReconnectToNewHost(Bridge.GetExternal <System.Net.EndPoint>(args[1]))))
                    )
                );


            NetworkClientPrototype.SetProperty(
                "ConnectWithSimulator",
                Bridge.CreateFunction(
                    "ConnectWithSimulator",
                    WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => o.ConnectWithSimulator(args[1].ToString(), args[2].ToInt32(), args[3].ToInt32(), (float)args[4].ToDouble()))
                    )
                );


            NetworkClientPrototype.SetProperty(
                "Connect",
                Bridge.CreateFunction(
                    "Connect",
                    WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => o.Connect(args[1].ToString(), args[2].ToInt32()))
                    )
                );


            NetworkClientPrototype.SetProperty(
                "Connect",
                Bridge.CreateFunction(
                    "Connect",
                    WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => o.Connect(Bridge.GetExternal <System.Net.EndPoint>(args[1])))
                    )
                );


            NetworkClientPrototype.SetProperty(
                "Disconnect",
                Bridge.CreateFunction(
                    "Disconnect",
                    WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => o.Disconnect())
                    )
                );


            NetworkClientPrototype.SetProperty(
                "Send",
                Bridge.CreateFunction(
                    "Send",
                    WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => JavaScriptValue.FromBoolean(o.Send(Bridge.GetExternal <System.Int16>(args[1]), Bridge.GetExternal <UnityEngine.Networking.MessageBase>(args[2]))))
                    )
                );


            NetworkClientPrototype.SetProperty(
                "SendWriter",
                Bridge.CreateFunction(
                    "SendWriter",
                    WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => JavaScriptValue.FromBoolean(o.SendWriter(Bridge.GetExternal <UnityEngine.Networking.NetworkWriter>(args[1]), args[2].ToInt32())))
                    )
                );


            NetworkClientPrototype.SetProperty(
                "SendBytes",
                Bridge.CreateFunction(
                    "SendBytes",
                    WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => JavaScriptValue.FromBoolean(o.SendBytes(Bridge.GetExternal <System.Byte[]>(args[1]), args[2].ToInt32(), args[3].ToInt32())))
                    )
                );


            NetworkClientPrototype.SetProperty(
                "SendUnreliable",
                Bridge.CreateFunction(
                    "SendUnreliable",
                    WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => JavaScriptValue.FromBoolean(o.SendUnreliable(Bridge.GetExternal <System.Int16>(args[1]), Bridge.GetExternal <UnityEngine.Networking.MessageBase>(args[2]))))
                    )
                );


            NetworkClientPrototype.SetProperty(
                "SendByChannel",
                Bridge.CreateFunction(
                    "SendByChannel",
                    WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => JavaScriptValue.FromBoolean(o.SendByChannel(Bridge.GetExternal <System.Int16>(args[1]), Bridge.GetExternal <UnityEngine.Networking.MessageBase>(args[2]), args[3].ToInt32())))
                    )
                );


            NetworkClientPrototype.SetProperty(
                "SetMaxDelay",
                Bridge.CreateFunction(
                    "SetMaxDelay",
                    WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => o.SetMaxDelay((float)args[1].ToDouble()))
                    )
                );


            NetworkClientPrototype.SetProperty(
                "Shutdown",
                Bridge.CreateFunction(
                    "Shutdown",
                    WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => o.Shutdown())
                    )
                );


            /*
             * NetworkClient GetStatsOut
             * parameter numMsgs is out
             */


            /*
             * NetworkClient GetStatsIn
             * parameter numMsgs is out
             */


            NetworkClientPrototype.SetProperty(
                "GetConnectionStats",
                Bridge.CreateFunction(
                    "GetConnectionStats",
                    WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => Bridge.CreateExternalWithPrototype(o.GetConnectionStats()))
                    )
                );


            NetworkClientPrototype.SetProperty(
                "ResetConnectionStats",
                Bridge.CreateFunction(
                    "ResetConnectionStats",
                    WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => o.ResetConnectionStats())
                    )
                );


            NetworkClientPrototype.SetProperty(
                "GetRTT",
                Bridge.CreateFunction(
                    "GetRTT",
                    WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => JavaScriptValue.FromInt32(o.GetRTT()))
                    )
                );


            NetworkClientPrototype.SetProperty(
                "RegisterHandler",
                Bridge.CreateFunction(
                    "RegisterHandler",
                    WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => o.RegisterHandler(Bridge.GetExternal <System.Int16>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkMessageDelegate>(args[2])))
                    )
                );


            NetworkClientPrototype.SetProperty(
                "RegisterHandlerSafe",
                Bridge.CreateFunction(
                    "RegisterHandlerSafe",
                    WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => o.RegisterHandlerSafe(Bridge.GetExternal <System.Int16>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkMessageDelegate>(args[2])))
                    )
                );


            NetworkClientPrototype.SetProperty(
                "UnregisterHandler",
                Bridge.CreateFunction(
                    "UnregisterHandler",
                    WithExternal <UnityEngine.Networking.NetworkClient>((o, args) => o.UnregisterHandler(Bridge.GetExternal <System.Int16>(args[1])))
                    )
                );
        }
Exemplo n.º 28
0
        //
        // The main entry point for the host.
        //
        public static int Main(string[] arguments)
        {
            int returnValue = 1;
            CommandLineArguments commandLineArguments = ProcessArguments(arguments);

            if (arguments.Length - commandLineArguments.ArgumentsStart < 0)
            {
                Console.Error.WriteLine("usage: chakrahost [-debug] [-profile] <script name> <arguments>");
                return(returnValue);
            }

            try
            {
                //
                // Create the runtime. We're only going to use one runtime for this host.
                //

                using (JavaScriptRuntime runtime = JavaScriptRuntime.Create())
                {
                    //
                    // Similarly, create a single execution context. Note that we're putting it on the stack here,
                    // so it will stay alive through the entire run.
                    //

                    JavaScriptContext context = CreateHostContext(runtime, arguments, commandLineArguments.ArgumentsStart);

                    //
                    // Now set the execution context as being the current one on this thread.
                    //

                    using (new JavaScriptContext.Scope(context))
                    {
                        //
                        // Start debugging if requested.
                        //

                        if (commandLineArguments.Debug)
                        {
                            StartDebugging();
                        }

                        //
                        // Start profiling if requested.
                        //

                        if (commandLineArguments.Profile)
                        {
                            var profiler = new Profiler();
                            JavaScriptContext.StartProfiling(profiler, Native.ProfilerEventMask.TraceAll, 0);
                        }

                        //
                        // Load the script from the disk.
                        //

                        string script = File.ReadAllText(arguments[commandLineArguments.ArgumentsStart]);

                        //
                        // Run the script.
                        //

                        JavaScriptValue result;
                        try
                        {
                            result = JavaScriptContext.RunScript(script, currentSourceContext++, arguments[commandLineArguments.ArgumentsStart]);
                        }
                        catch (JavaScriptScriptException e)
                        {
                            PrintScriptException(e.Error);
                            return(1);
                        }
                        catch (Exception e)
                        {
                            Console.Error.WriteLine("chakrahost: failed to run script: {0}", e.Message);
                            return(1);
                        }

                        //
                        // Convert the return value.
                        //

                        JavaScriptValue numberResult = result.ConvertToNumber();
                        double          doubleResult = numberResult.ToDouble();
                        returnValue = (int)doubleResult;

                        //
                        // Stop profiling.
                        //

                        if (commandLineArguments.Profile)
                        {
                            JavaScriptContext.StopProfiling(0);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.Error.WriteLine("chakrahost: fatal error: internal error: {0}.", e.Message);
            }

            return(returnValue);
        }
Exemplo n.º 29
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue Matrix4x4Prototype;
            JavaScriptValue Matrix4x4Constructor = Bridge.CreateConstructor(
                typeof(UnityEngine.Matrix4x4),
                (args) => { throw new System.NotImplementedException(); },
                out Matrix4x4Prototype
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("UnityEngine")
            .SetProperty("Matrix4x4", Matrix4x4Constructor);


            // Static Fields


            // Static Property Accessors

            Bridge.DefineGetter(
                Matrix4x4Constructor,
                "zero",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Matrix4x4.zero)
                );


            Bridge.DefineGetter(
                Matrix4x4Constructor,
                "identity",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Matrix4x4.identity)
                );


            // Static Methods

            Matrix4x4Constructor.SetProperty(
                "Determinant",
                Bridge.CreateFunction(
                    "Determinant",
                    (args) => JavaScriptValue.FromDouble(UnityEngine.Matrix4x4.Determinant(Bridge.GetBoxedExternal <UnityEngine.Matrix4x4>(args[1]).wrapped))
                    )
                );


            Matrix4x4Constructor.SetProperty(
                "TRS",
                Bridge.CreateFunction(
                    "TRS",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Matrix4x4.TRS(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Quaternion>(args[2]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[3]).wrapped))
                    )
                );


            Matrix4x4Constructor.SetProperty(
                "Inverse",
                Bridge.CreateFunction(
                    "Inverse",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Matrix4x4.Inverse(Bridge.GetBoxedExternal <UnityEngine.Matrix4x4>(args[1]).wrapped))
                    )
                );


            Matrix4x4Constructor.SetProperty(
                "Transpose",
                Bridge.CreateFunction(
                    "Transpose",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Matrix4x4.Transpose(Bridge.GetBoxedExternal <UnityEngine.Matrix4x4>(args[1]).wrapped))
                    )
                );


            Matrix4x4Constructor.SetProperty(
                "Ortho",
                Bridge.CreateFunction(
                    "Ortho",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Matrix4x4.Ortho((float)args[1].ToDouble(), (float)args[2].ToDouble(), (float)args[3].ToDouble(), (float)args[4].ToDouble(), (float)args[5].ToDouble(), (float)args[6].ToDouble()))
                    )
                );


            Matrix4x4Constructor.SetProperty(
                "Perspective",
                Bridge.CreateFunction(
                    "Perspective",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Matrix4x4.Perspective((float)args[1].ToDouble(), (float)args[2].ToDouble(), (float)args[3].ToDouble(), (float)args[4].ToDouble()))
                    )
                );


            Matrix4x4Constructor.SetProperty(
                "LookAt",
                Bridge.CreateFunction(
                    "LookAt",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Matrix4x4.LookAt(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[2]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[3]).wrapped))
                    )
                );


            Matrix4x4Constructor.SetProperty(
                "Frustum",
                Bridge.CreateFunction(
                    "Frustum",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Matrix4x4.Frustum((float)args[1].ToDouble(), (float)args[2].ToDouble(), (float)args[3].ToDouble(), (float)args[4].ToDouble(), (float)args[5].ToDouble(), (float)args[6].ToDouble()))
                    )
                );


            Matrix4x4Constructor.SetProperty(
                "Frustum",
                Bridge.CreateFunction(
                    "Frustum",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Matrix4x4.Frustum(Bridge.GetBoxedExternal <UnityEngine.FrustumPlanes>(args[1]).wrapped))
                    )
                );


            Matrix4x4Constructor.SetProperty(
                "Scale",
                Bridge.CreateFunction(
                    "Scale",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Matrix4x4.Scale(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))
                    )
                );


            Matrix4x4Constructor.SetProperty(
                "Translate",
                Bridge.CreateFunction(
                    "Translate",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Matrix4x4.Translate(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))
                    )
                );


            Matrix4x4Constructor.SetProperty(
                "Rotate",
                Bridge.CreateFunction(
                    "Rotate",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Matrix4x4.Rotate(Bridge.GetBoxedExternal <UnityEngine.Quaternion>(args[1]).wrapped))
                    )
                );


            // Instance Fields

            Bridge.DefineGetterSetter(
                Matrix4x4Prototype,
                "m00",
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m00)),
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m00 = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                Matrix4x4Prototype,
                "m10",
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m10)),
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m10 = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                Matrix4x4Prototype,
                "m20",
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m20)),
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m20 = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                Matrix4x4Prototype,
                "m30",
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m30)),
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m30 = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                Matrix4x4Prototype,
                "m01",
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m01)),
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m01 = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                Matrix4x4Prototype,
                "m11",
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m11)),
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m11 = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                Matrix4x4Prototype,
                "m21",
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m21)),
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m21 = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                Matrix4x4Prototype,
                "m31",
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m31)),
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m31 = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                Matrix4x4Prototype,
                "m02",
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m02)),
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m02 = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                Matrix4x4Prototype,
                "m12",
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m12)),
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m12 = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                Matrix4x4Prototype,
                "m22",
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m22)),
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m22 = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                Matrix4x4Prototype,
                "m32",
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m32)),
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m32 = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                Matrix4x4Prototype,
                "m03",
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m03)),
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m03 = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                Matrix4x4Prototype,
                "m13",
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m13)),
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m13 = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                Matrix4x4Prototype,
                "m23",
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m23)),
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m23 = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                Matrix4x4Prototype,
                "m33",
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m33)),
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m33 = (float)args[1].ToDouble(); })
                );


            // Instance Property Accessors

            Bridge.DefineGetter(
                Matrix4x4Prototype,
                "rotation",
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.rotation))
                );


            Bridge.DefineGetter(
                Matrix4x4Prototype,
                "lossyScale",
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.lossyScale))
                );


            Bridge.DefineGetter(
                Matrix4x4Prototype,
                "isIdentity",
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.isIdentity))
                );


            Bridge.DefineGetter(
                Matrix4x4Prototype,
                "determinant",
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.determinant))
                );


            Bridge.DefineGetter(
                Matrix4x4Prototype,
                "decomposeProjection",
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.decomposeProjection))
                );


            Bridge.DefineGetter(
                Matrix4x4Prototype,
                "inverse",
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.inverse))
                );


            Bridge.DefineGetter(
                Matrix4x4Prototype,
                "transpose",
                Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.transpose))
                );


            // Instance Methods

            Matrix4x4Prototype.SetProperty(
                "ValidTRS",
                Bridge.CreateFunction(
                    "ValidTRS",
                    Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.ValidTRS()))
                    )
                );


            Matrix4x4Prototype.SetProperty(
                "SetTRS",
                Bridge.CreateFunction(
                    "SetTRS",
                    Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => o.wrapped.SetTRS(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Quaternion>(args[2]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[3]).wrapped))
                    )
                );


            Matrix4x4Prototype.SetProperty(
                "GetHashCode",
                Bridge.CreateFunction(
                    "GetHashCode",
                    Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromInt32(o.wrapped.GetHashCode()))
                    )
                );


            Matrix4x4Prototype.SetProperty(
                "Equals",
                Bridge.CreateFunction(
                    "Equals",
                    Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.Equals(Bridge.GetExternal <System.Object>(args[1]))))
                    )
                );


            Matrix4x4Prototype.SetProperty(
                "Equals",
                Bridge.CreateFunction(
                    "Equals",
                    Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.Equals(Bridge.GetBoxedExternal <UnityEngine.Matrix4x4>(args[1]).wrapped)))
                    )
                );


            Matrix4x4Prototype.SetProperty(
                "GetColumn",
                Bridge.CreateFunction(
                    "GetColumn",
                    Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.GetColumn(args[1].ToInt32())))
                    )
                );


            Matrix4x4Prototype.SetProperty(
                "GetRow",
                Bridge.CreateFunction(
                    "GetRow",
                    Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.GetRow(args[1].ToInt32())))
                    )
                );


            Matrix4x4Prototype.SetProperty(
                "SetColumn",
                Bridge.CreateFunction(
                    "SetColumn",
                    Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => o.wrapped.SetColumn(args[1].ToInt32(), Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[2]).wrapped))
                    )
                );


            Matrix4x4Prototype.SetProperty(
                "SetRow",
                Bridge.CreateFunction(
                    "SetRow",
                    Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => o.wrapped.SetRow(args[1].ToInt32(), Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[2]).wrapped))
                    )
                );


            Matrix4x4Prototype.SetProperty(
                "MultiplyPoint",
                Bridge.CreateFunction(
                    "MultiplyPoint",
                    Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.MultiplyPoint(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped)))
                    )
                );


            Matrix4x4Prototype.SetProperty(
                "MultiplyPoint3x4",
                Bridge.CreateFunction(
                    "MultiplyPoint3x4",
                    Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.MultiplyPoint3x4(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped)))
                    )
                );


            Matrix4x4Prototype.SetProperty(
                "MultiplyVector",
                Bridge.CreateFunction(
                    "MultiplyVector",
                    Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.MultiplyVector(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped)))
                    )
                );


            Matrix4x4Prototype.SetProperty(
                "TransformPlane",
                Bridge.CreateFunction(
                    "TransformPlane",
                    Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.TransformPlane(Bridge.GetBoxedExternal <UnityEngine.Plane>(args[1]).wrapped)))
                    )
                );


            Matrix4x4Prototype.SetProperty(
                "toString",
                Bridge.CreateFunction(
                    "ToString",
                    Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => {
                if (args.Length == 1)
                {
                    return(JavaScriptValue.FromString(o.wrapped.ToString()));
                }
                else
                {
                    return(JavaScriptValue.FromString(o.wrapped.ToString(args[1].ToString())));
                }
            })
                    )
                );
        }
Exemplo n.º 30
0
 internal static extern JavaScriptErrorCode JsContextRelease(JavaScriptContext reference, out uint count);
Exemplo n.º 31
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue IEnumerablePrototype;
            JavaScriptValue IEnumerableConstructor = Bridge.CreateConstructor(
                typeof(System.Collections.IEnumerable),
                (args) => { throw new System.NotImplementedException(); },
                out IEnumerablePrototype
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("System")
            .GetProperty("Collections")
            .SetProperty("IEnumerable", IEnumerableConstructor);


            // Static Fields


            // Static Property Accessors


            // Static Methods


            // Instance Fields


            // Instance Property Accessors


            // Instance Methods

            IEnumerablePrototype.SetProperty(
                "GetEnumerator",
                Bridge.CreateFunction(
                    "GetEnumerator",
                    Bridge.WithExternal <System.Collections.IEnumerable>((o, args) => Bridge.CreateExternalWithPrototype(o.GetEnumerator()))
                    )
                );


            IEnumerablePrototype.SetProperty(
                JavaScriptValue.GlobalObject.GetProperty("Symbol").GetProperty("iterator").GetPropertyIdFromSymbol(),
                Bridge.CreateFunction(
                    "Iterator",
                    Bridge.WithExternal <System.Collections.IEnumerable>((o, args) => {
                JavaScriptValue iteratorObj = Bridge.CreateExternalWithPrototype(o.GetEnumerator());

                iteratorObj.SetProperty("next", Bridge.CreateFunction(Bridge.WithExternal <System.Collections.IEnumerator>((enumerator, nextArgs) => {
                    // returns { value: "h", done: false }
                    JavaScriptValue nextObj = JavaScriptValue.CreateObject();

                    bool more = enumerator.MoveNext();
                    nextObj.SetProperty("done", JavaScriptValue.FromBoolean(!more));

                    JavaScriptValue value = JavaScriptValue.Undefined;
                    if (more)
                    {
                        value = Bridge.CreateExternalWithPrototype(enumerator.Current);
                    }
                    nextObj.SetProperty("value", value);

                    return(nextObj);
                })));

                return(iteratorObj);
            })
                    )
                );
        }
Exemplo n.º 32
0
 internal static extern JavaScriptErrorCode JsGetCurrentContext(out JavaScriptContext currentContext);
Exemplo n.º 33
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue NetworkTransformChildPrototype;
            JavaScriptValue NetworkTransformChildConstructor = Bridge.CreateConstructor(
                typeof(UnityEngine.Networking.NetworkTransformChild),
                (args) => { throw new NotImplementedException(); },
                out NetworkTransformChildPrototype
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("UnityEngine")
            .GetProperty("Networking")
            .SetProperty("NetworkTransformChild", NetworkTransformChildConstructor);


            // Static Fields


            // Static Property Accessors


            // Static Methods


            // Instance Fields


            // Instance Property Accessors

            Bridge.DefineGetterSetter(
                NetworkTransformChildPrototype,
                "target",
                WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => Bridge.CreateExternalWithPrototype(o.target)),
                WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => { o.target = Bridge.GetExternal <UnityEngine.Transform>(args[1]); })
                );


            Bridge.DefineGetter(
                NetworkTransformChildPrototype,
                "childIndex",
                WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => Bridge.CreateExternalWithPrototype(o.childIndex))
                );


            Bridge.DefineGetterSetter(
                NetworkTransformChildPrototype,
                "sendInterval",
                WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => JavaScriptValue.FromDouble(o.sendInterval)),
                WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => { o.sendInterval = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                NetworkTransformChildPrototype,
                "syncRotationAxis",
                WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => Bridge.CreateExternalWithPrototype(o.syncRotationAxis)),
                WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => { o.syncRotationAxis = Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.AxisSyncMode>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                NetworkTransformChildPrototype,
                "rotationSyncCompression",
                WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => Bridge.CreateExternalWithPrototype(o.rotationSyncCompression)),
                WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => { o.rotationSyncCompression = Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                NetworkTransformChildPrototype,
                "movementThreshold",
                WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => JavaScriptValue.FromDouble(o.movementThreshold)),
                WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => { o.movementThreshold = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                NetworkTransformChildPrototype,
                "interpolateRotation",
                WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => JavaScriptValue.FromDouble(o.interpolateRotation)),
                WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => { o.interpolateRotation = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                NetworkTransformChildPrototype,
                "interpolateMovement",
                WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => JavaScriptValue.FromDouble(o.interpolateMovement)),
                WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => { o.interpolateMovement = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                NetworkTransformChildPrototype,
                "clientMoveCallback3D",
                WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => Bridge.CreateExternalWithPrototype(o.clientMoveCallback3D)),
                WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => { o.clientMoveCallback3D = Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.ClientMoveCallback3D>(args[1]); })
                );


            Bridge.DefineGetter(
                NetworkTransformChildPrototype,
                "lastSyncTime",
                WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => JavaScriptValue.FromDouble(o.lastSyncTime))
                );


            Bridge.DefineGetter(
                NetworkTransformChildPrototype,
                "targetSyncPosition",
                WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => Bridge.CreateExternalWithPrototype(o.targetSyncPosition))
                );


            Bridge.DefineGetter(
                NetworkTransformChildPrototype,
                "targetSyncRotation3D",
                WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => Bridge.CreateExternalWithPrototype(o.targetSyncRotation3D))
                );


            // Instance Methods

            NetworkTransformChildPrototype.SetProperty(
                "OnSerialize",
                Bridge.CreateFunction(
                    "OnSerialize",
                    WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => JavaScriptValue.FromBoolean(o.OnSerialize(Bridge.GetExternal <UnityEngine.Networking.NetworkWriter>(args[1]), args[2].ToBoolean())))
                    )
                );


            NetworkTransformChildPrototype.SetProperty(
                "OnDeserialize",
                Bridge.CreateFunction(
                    "OnDeserialize",
                    WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => o.OnDeserialize(Bridge.GetExternal <UnityEngine.Networking.NetworkReader>(args[1]), args[2].ToBoolean()))
                    )
                );


            NetworkTransformChildPrototype.SetProperty(
                "GetNetworkChannel",
                Bridge.CreateFunction(
                    "GetNetworkChannel",
                    WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => JavaScriptValue.FromInt32(o.GetNetworkChannel()))
                    )
                );


            NetworkTransformChildPrototype.SetProperty(
                "GetNetworkSendInterval",
                Bridge.CreateFunction(
                    "GetNetworkSendInterval",
                    WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => JavaScriptValue.FromDouble(o.GetNetworkSendInterval()))
                    )
                );
        }
Exemplo n.º 34
0
 internal static extern JavaScriptErrorCode JsGetRuntime(JavaScriptContext context, out JavaScriptRuntime runtime);
Exemplo n.º 35
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue NetworkTransformPrototype;
            JavaScriptValue NetworkTransformConstructor = Bridge.CreateConstructor(
                typeof(UnityEngine.Networking.NetworkTransform),
                (args) => { throw new NotImplementedException(); },
                out NetworkTransformPrototype
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("UnityEngine")
            .GetProperty("Networking")
            .SetProperty("NetworkTransform", NetworkTransformConstructor);


            // Static Fields


            // Static Property Accessors


            // Static Methods

            NetworkTransformConstructor.SetProperty(
                "HandleTransform",
                Bridge.CreateFunction(
                    "HandleTransform",
                    (args) => UnityEngine.Networking.NetworkTransform.HandleTransform(Bridge.GetExternal <UnityEngine.Networking.NetworkMessage>(args[1]))
                    )
                );


            NetworkTransformConstructor.SetProperty(
                "SerializeVelocity3D",
                Bridge.CreateFunction(
                    "SerializeVelocity3D",
                    (args) => UnityEngine.Networking.NetworkTransform.SerializeVelocity3D(Bridge.GetExternal <UnityEngine.Networking.NetworkWriter>(args[1]), Bridge.GetExternal <UnityEngine.Vector3>(args[2]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[3]))
                    )
                );


            NetworkTransformConstructor.SetProperty(
                "SerializeVelocity2D",
                Bridge.CreateFunction(
                    "SerializeVelocity2D",
                    (args) => UnityEngine.Networking.NetworkTransform.SerializeVelocity2D(Bridge.GetExternal <UnityEngine.Networking.NetworkWriter>(args[1]), Bridge.GetExternal <UnityEngine.Vector2>(args[2]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[3]))
                    )
                );


            NetworkTransformConstructor.SetProperty(
                "SerializeRotation3D",
                Bridge.CreateFunction(
                    "SerializeRotation3D",
                    (args) => UnityEngine.Networking.NetworkTransform.SerializeRotation3D(Bridge.GetExternal <UnityEngine.Networking.NetworkWriter>(args[1]), Bridge.GetExternal <UnityEngine.Quaternion>(args[2]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.AxisSyncMode>(args[3]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[4]))
                    )
                );


            NetworkTransformConstructor.SetProperty(
                "SerializeRotation2D",
                Bridge.CreateFunction(
                    "SerializeRotation2D",
                    (args) => UnityEngine.Networking.NetworkTransform.SerializeRotation2D(Bridge.GetExternal <UnityEngine.Networking.NetworkWriter>(args[1]), (float)args[2].ToDouble(), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[3]))
                    )
                );


            NetworkTransformConstructor.SetProperty(
                "SerializeSpin3D",
                Bridge.CreateFunction(
                    "SerializeSpin3D",
                    (args) => UnityEngine.Networking.NetworkTransform.SerializeSpin3D(Bridge.GetExternal <UnityEngine.Networking.NetworkWriter>(args[1]), Bridge.GetExternal <UnityEngine.Vector3>(args[2]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.AxisSyncMode>(args[3]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[4]))
                    )
                );


            NetworkTransformConstructor.SetProperty(
                "SerializeSpin2D",
                Bridge.CreateFunction(
                    "SerializeSpin2D",
                    (args) => UnityEngine.Networking.NetworkTransform.SerializeSpin2D(Bridge.GetExternal <UnityEngine.Networking.NetworkWriter>(args[1]), (float)args[2].ToDouble(), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[3]))
                    )
                );


            NetworkTransformConstructor.SetProperty(
                "UnserializeVelocity3D",
                Bridge.CreateFunction(
                    "UnserializeVelocity3D",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkTransform.UnserializeVelocity3D(Bridge.GetExternal <UnityEngine.Networking.NetworkReader>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[2])))
                    )
                );


            NetworkTransformConstructor.SetProperty(
                "UnserializeVelocity2D",
                Bridge.CreateFunction(
                    "UnserializeVelocity2D",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkTransform.UnserializeVelocity2D(Bridge.GetExternal <UnityEngine.Networking.NetworkReader>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[2])))
                    )
                );


            NetworkTransformConstructor.SetProperty(
                "UnserializeRotation3D",
                Bridge.CreateFunction(
                    "UnserializeRotation3D",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkTransform.UnserializeRotation3D(Bridge.GetExternal <UnityEngine.Networking.NetworkReader>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.AxisSyncMode>(args[2]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[3])))
                    )
                );


            NetworkTransformConstructor.SetProperty(
                "UnserializeRotation2D",
                Bridge.CreateFunction(
                    "UnserializeRotation2D",
                    (args) => JavaScriptValue.FromDouble(UnityEngine.Networking.NetworkTransform.UnserializeRotation2D(Bridge.GetExternal <UnityEngine.Networking.NetworkReader>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[2])))
                    )
                );


            NetworkTransformConstructor.SetProperty(
                "UnserializeSpin3D",
                Bridge.CreateFunction(
                    "UnserializeSpin3D",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkTransform.UnserializeSpin3D(Bridge.GetExternal <UnityEngine.Networking.NetworkReader>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.AxisSyncMode>(args[2]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[3])))
                    )
                );


            NetworkTransformConstructor.SetProperty(
                "UnserializeSpin2D",
                Bridge.CreateFunction(
                    "UnserializeSpin2D",
                    (args) => JavaScriptValue.FromDouble(UnityEngine.Networking.NetworkTransform.UnserializeSpin2D(Bridge.GetExternal <UnityEngine.Networking.NetworkReader>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[2])))
                    )
                );


            // Instance Fields


            // Instance Property Accessors

            Bridge.DefineGetterSetter(
                NetworkTransformPrototype,
                "transformSyncMode",
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => Bridge.CreateExternalWithPrototype(o.transformSyncMode)),
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => { o.transformSyncMode = Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.TransformSyncMode>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                NetworkTransformPrototype,
                "sendInterval",
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => JavaScriptValue.FromDouble(o.sendInterval)),
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => { o.sendInterval = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                NetworkTransformPrototype,
                "syncRotationAxis",
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => Bridge.CreateExternalWithPrototype(o.syncRotationAxis)),
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => { o.syncRotationAxis = Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.AxisSyncMode>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                NetworkTransformPrototype,
                "rotationSyncCompression",
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => Bridge.CreateExternalWithPrototype(o.rotationSyncCompression)),
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => { o.rotationSyncCompression = Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                NetworkTransformPrototype,
                "syncSpin",
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => JavaScriptValue.FromBoolean(o.syncSpin)),
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => { o.syncSpin = args[1].ToBoolean(); })
                );


            Bridge.DefineGetterSetter(
                NetworkTransformPrototype,
                "movementTheshold",
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => JavaScriptValue.FromDouble(o.movementTheshold)),
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => { o.movementTheshold = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                NetworkTransformPrototype,
                "velocityThreshold",
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => JavaScriptValue.FromDouble(o.velocityThreshold)),
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => { o.velocityThreshold = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                NetworkTransformPrototype,
                "snapThreshold",
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => JavaScriptValue.FromDouble(o.snapThreshold)),
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => { o.snapThreshold = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                NetworkTransformPrototype,
                "interpolateRotation",
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => JavaScriptValue.FromDouble(o.interpolateRotation)),
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => { o.interpolateRotation = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                NetworkTransformPrototype,
                "interpolateMovement",
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => JavaScriptValue.FromDouble(o.interpolateMovement)),
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => { o.interpolateMovement = (float)args[1].ToDouble(); })
                );


            Bridge.DefineGetterSetter(
                NetworkTransformPrototype,
                "clientMoveCallback3D",
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => Bridge.CreateExternalWithPrototype(o.clientMoveCallback3D)),
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => { o.clientMoveCallback3D = Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.ClientMoveCallback3D>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                NetworkTransformPrototype,
                "clientMoveCallback2D",
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => Bridge.CreateExternalWithPrototype(o.clientMoveCallback2D)),
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => { o.clientMoveCallback2D = Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.ClientMoveCallback2D>(args[1]); })
                );


            Bridge.DefineGetter(
                NetworkTransformPrototype,
                "characterContoller",
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => Bridge.CreateExternalWithPrototype(o.characterContoller))
                );


            Bridge.DefineGetter(
                NetworkTransformPrototype,
                "rigidbody3D",
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => Bridge.CreateExternalWithPrototype(o.rigidbody3D))
                );


            Bridge.DefineGetter(
                NetworkTransformPrototype,
                "rigidbody2D",
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => Bridge.CreateExternalWithPrototype(o.rigidbody2D))
                );


            Bridge.DefineGetter(
                NetworkTransformPrototype,
                "lastSyncTime",
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => JavaScriptValue.FromDouble(o.lastSyncTime))
                );


            Bridge.DefineGetter(
                NetworkTransformPrototype,
                "targetSyncPosition",
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => Bridge.CreateExternalWithPrototype(o.targetSyncPosition))
                );


            Bridge.DefineGetter(
                NetworkTransformPrototype,
                "targetSyncVelocity",
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => Bridge.CreateExternalWithPrototype(o.targetSyncVelocity))
                );


            Bridge.DefineGetter(
                NetworkTransformPrototype,
                "targetSyncRotation3D",
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => Bridge.CreateExternalWithPrototype(o.targetSyncRotation3D))
                );


            Bridge.DefineGetter(
                NetworkTransformPrototype,
                "targetSyncRotation2D",
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => JavaScriptValue.FromDouble(o.targetSyncRotation2D))
                );


            Bridge.DefineGetterSetter(
                NetworkTransformPrototype,
                "grounded",
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => JavaScriptValue.FromBoolean(o.grounded)),
                WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => { o.grounded = args[1].ToBoolean(); })
                );


            // Instance Methods

            NetworkTransformPrototype.SetProperty(
                "OnStartServer",
                Bridge.CreateFunction(
                    "OnStartServer",
                    WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => o.OnStartServer())
                    )
                );


            NetworkTransformPrototype.SetProperty(
                "OnSerialize",
                Bridge.CreateFunction(
                    "OnSerialize",
                    WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => JavaScriptValue.FromBoolean(o.OnSerialize(Bridge.GetExternal <UnityEngine.Networking.NetworkWriter>(args[1]), args[2].ToBoolean())))
                    )
                );


            NetworkTransformPrototype.SetProperty(
                "OnDeserialize",
                Bridge.CreateFunction(
                    "OnDeserialize",
                    WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => o.OnDeserialize(Bridge.GetExternal <UnityEngine.Networking.NetworkReader>(args[1]), args[2].ToBoolean()))
                    )
                );


            NetworkTransformPrototype.SetProperty(
                "GetNetworkChannel",
                Bridge.CreateFunction(
                    "GetNetworkChannel",
                    WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => JavaScriptValue.FromInt32(o.GetNetworkChannel()))
                    )
                );


            NetworkTransformPrototype.SetProperty(
                "GetNetworkSendInterval",
                Bridge.CreateFunction(
                    "GetNetworkSendInterval",
                    WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => JavaScriptValue.FromDouble(o.GetNetworkSendInterval()))
                    )
                );


            NetworkTransformPrototype.SetProperty(
                "OnStartAuthority",
                Bridge.CreateFunction(
                    "OnStartAuthority",
                    WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => o.OnStartAuthority())
                    )
                );
        }