Пример #1
0
 JavaScriptValue ObjectToJavaScriptValue(Object parameter)
 {
     if (parameter == null)
     {
         return(JavaScriptValue.Null);
     }
     else if (parameter is String)
     {
         return(JavaScriptValue.FromString(parameter.ToString()));
     }
     else if (parameter is Boolean)
     {
         return(JavaScriptValue.FromBoolean((Boolean)parameter));
     }
     else if (parameter is Int32)
     {
         return(JavaScriptValue.FromInt32((Int32)parameter));
     }
     else if (parameter is Double)
     {
         return(JavaScriptValue.FromDouble((Int32)parameter));
     }
     else if (parameter is Object)
     {
         String json  = JsonConvert.SerializeObject(parameter);
         var    glob  = JavaScriptValue.GlobalObject.GetProperty(JavaScriptPropertyId.FromString("JSON"));
         var    parse = glob.GetProperty(JavaScriptPropertyId.FromString("parse"));
         return(parse.CallFunction(JavaScriptValue.Undefined, JavaScriptValue.FromString(json)));
     }
     return(JavaScriptValue.Undefined);
 }
        /// <summary>
        /// Invoke the JavaScript callback.
        /// </summary>
        /// <param name="callbackId">The callback identifier.</param>
        /// <param name="arguments">The arguments.</param>
        /// <returns>The flushed queue of native operations.</returns>
        public JToken InvokeCallbackAndReturnFlushedQueue(int callbackId, JArray arguments)
        {
            if (arguments == null)
            {
                throw new ArgumentNullException(nameof(arguments));
            }

            var callbackIdValue = JavaScriptValue.FromInt32(callbackId);

            callbackIdValue.AddRef();
            var argumentsValue = ConvertJson(arguments);

            argumentsValue.AddRef();

            var callArguments = new JavaScriptValue[3];

            callArguments[0] = EnsureGlobalObject();
            callArguments[1] = callbackIdValue;
            callArguments[2] = argumentsValue;
            var method       = EnsureInvokeFunction();
            var flushedQueue = ConvertJson(method.CallFunction(callArguments));

            argumentsValue.Release();
            callbackIdValue.Release();

            return(flushedQueue);
        }
Пример #3
0
        public static JavaScriptValue DoCustomStuff(
            JavaScriptValue callee,
            bool isconstructcall,
            JavaScriptValue[] arguments,
            ushort argumentcount,
            IntPtr callbackdata)
        {
            Debug.Log("Calling custom function");

            return(JavaScriptValue.FromInt32(42));
        }
Пример #4
0
 public JSValue this[int key]
 {
     get
     {
         return(JSValue.Make(rawvalue.GetIndexedProperty(JavaScriptValue.FromInt32(key))));
     }
     set
     {
         rawvalue.SetIndexedProperty(JavaScriptValue.FromInt32(key), value.rawvalue);
     }
 }
Пример #5
0
        /// <summary>
        /// Creates a <see cref="JavaScriptValue"/> representing the specific number host type.
        /// </summary>
        /// <remarks>This call requires an active context.</remarks>
        public JavaScriptValue ToJsNumber(object obj, Type type)
        {
            if (type == typeof(byte))
            {
                return(JavaScriptValue.FromInt32((byte)obj));
            }

            if (type == typeof(sbyte))
            {
                return(JavaScriptValue.FromInt32((sbyte)obj));
            }

            if (type == typeof(short))
            {
                return(JavaScriptValue.FromInt32((short)obj));
            }
            if (type == typeof(ushort))
            {
                return(JavaScriptValue.FromInt32((ushort)obj));
            }

            if (type == typeof(int) || type == typeof(uint))
            {
                return(JavaScriptValue.FromInt32((int)obj));
            }

            if (type == typeof(decimal))
            {
                return(JavaScriptValue.FromDouble((double)(decimal)obj));
            }

            if (type == typeof(float))
            {
                return(JavaScriptValue.FromDouble((float)obj));
            }

            if (type == typeof(double))
            {
                return(JavaScriptValue.FromDouble((double)obj));
            }

            if (type == typeof(long))
            {
                return(JavaScriptValue.FromDouble((long)obj));
            }

            if (type == typeof(ulong))
            {
                return(JavaScriptValue.FromDouble((ulong)obj));
            }

            throw new Exception($"Cannot convert type: {type} into JS Number");
        }
        private JavaScriptValue JSGetPushClients(JavaScriptValue callee, bool isConstructCall, JavaScriptValue[] arguments, ushort argumentCount, IntPtr callbackData)
        {
            List <string>   clientIds = new List <string>(this.WebSocketClients.GetAll().Keys);
            JavaScriptValue outValue  = JavaScriptValue.CreateArray((uint)clientIds.Count);

            for (int i = 0; i < clientIds.Count; i++)
            {
                outValue.SetIndexedProperty(JavaScriptValue.FromInt32(i), JavaScriptValue.FromString(clientIds[i]));
            }

            return(outValue);
        }
Пример #7
0
        public static JavaScriptValue CreateQuery(JavaScriptValue callee, bool isconstructcall, JavaScriptValue[] arguments, ushort argumentcount, IntPtr callbackdata)
        {
            if (arguments.Length < 3 ||
                arguments[1].ValueType != JavaScriptValueType.Array ||
                arguments[2].ValueType != JavaScriptValueType.Function)
            {
                return(JavaScriptValue.Undefined);
            }

            var length = arguments[1].GetProperty(JavaScriptPropertyId.FromString("length")).ToInt32();

            var components = new List <string>();

            for (var i = 0; i < length; i++)
            {
                if (arguments[1].HasIndexedProperty(JavaScriptValue.FromInt32(i)))
                {
                    var prop = arguments[1].GetIndexedProperty(JavaScriptValue.FromInt32(i));

                    if (prop.ValueType != JavaScriptValueType.String)
                    {
                        continue;
                    }

                    components.Add(prop.ToString());
                }
            }

            var querySystemType = typeof(ReactComponentQuerySystem);

            var systems = AppDomain.CurrentDomain.GetAssemblies()
                          .SelectMany(e => e.GetTypes())
                          .Where(e => querySystemType.IsAssignableFrom(e) && e != querySystemType)
                          .ToList();

            if (systems.Count > 1)
            {
                Debug.LogError("There can be only one definition of JSBindingSystem");
                return(JavaScriptValue.Undefined);
            }

            if (systems.Count == 0)
            {
                Debug.LogWarning("There is no definition JSBindingSystem. Queries towards ECS won't work'");
                return(JavaScriptValue.Undefined);
            }

            var system = systems.Single();

            var querySystem = (ReactComponentQuerySystem)World.DefaultGameObjectInjectionWorld.GetOrCreateSystem(system);

            return(querySystem.CreateQuery(components.ToArray(), arguments[2]));
        }
        public static JavaScriptValue JsConstructor(JavaScriptValue callee, bool isConstructCall, JavaScriptValue[] arguments, ushort argumentCount, IntPtr callbackData)
        {
            if (!isConstructCall)
            {
                return(JavaScriptValue.Invalid);
            }

            IntPtr objId;

            do
            {
                objId = new IntPtr(new Random().Next());
            } while(instances.ContainsKey(objId));
            var jsObj     = JavaScriptValue.CreateExternalObject(objId, null);
            var actualObj = new JsXmlHttpRequest(jsObj);

            instances.Add(objId, actualObj);

            // Properties
            jsObj.SetProperty(JavaScriptPropertyId.FromString("readyState"), JavaScriptValue.FromInt32((int)ReadyStates.Unsent), true);
            jsObj.SetProperty(JavaScriptPropertyId.FromString("response"), JavaScriptValue.FromString(""), true);
            jsObj.SetProperty(JavaScriptPropertyId.FromString("responseText"), JavaScriptValue.FromString(""), true);
            jsObj.SetProperty(JavaScriptPropertyId.FromString("responseType"), JavaScriptValue.FromString(""), true);
            jsObj.SetProperty(JavaScriptPropertyId.FromString("responseUrl"), JavaScriptValue.FromString(""), true);
            //jsObj.SetProperty(JavaScriptPropertyId.FromString("responseXML"), JavaScriptValue.Null, true);
            jsObj.SetProperty(JavaScriptPropertyId.FromString("status"), JavaScriptValue.FromInt32(0), true);
            jsObj.SetProperty(JavaScriptPropertyId.FromString("statusText"), JavaScriptValue.FromString(""), true);
            //jsObj.SetProperty(JavaScriptPropertyId.FromString("timeout"), JavaScriptValue.FromInt32(0), true);
            //jsObj.SetProperty(JavaScriptPropertyId.FromString("upload"), JavaScriptValue.Null, true);
            //jsObj.SetProperty(JavaScriptPropertyId.FromString("withCredentials"), JavaScriptValue.FromBoolean(false), true);

            // Event properties
            //jsObj.SetProperty(JavaScriptPropertyId.FromString("onabort"), JavaScriptValue.Null, true);
            jsObj.SetProperty(JavaScriptPropertyId.FromString("onerror"), JavaScriptValue.Null, true);
            jsObj.SetProperty(JavaScriptPropertyId.FromString("onload"), JavaScriptValue.Null, true);
            //jsObj.SetProperty(JavaScriptPropertyId.FromString("onloadstart"), JavaScriptValue.Null, true);
            //jsObj.SetProperty(JavaScriptPropertyId.FromString("onprogress"), JavaScriptValue.Null, true);
            //jsObj.SetProperty(JavaScriptPropertyId.FromString("ontimeout"), JavaScriptValue.Null, true);
            //jsObj.SetProperty(JavaScriptPropertyId.FromString("onloadend"), JavaScriptValue.Null, true);
            jsObj.SetProperty(JavaScriptPropertyId.FromString("onreadystatechange"), JavaScriptValue.Null, true);
            //jsObj.SetProperty(JavaScriptPropertyId.FromString("ontimeout"), JavaScriptValue.Null, true);

            // Methods
            //jsObj.SetProperty(JavaScriptPropertyId.FromString("abort"), JavaScriptValue.CreateFunction(functions["abort"]), true);
            //jsObj.SetProperty(JavaScriptPropertyId.FromString("getAllResponseHeaders"), JavaScriptValue.CreateFunction(functions["getAllResponseHeaders"]), true);
            jsObj.SetProperty(JavaScriptPropertyId.FromString("open"), JavaScriptValue.CreateFunction(functions["open"]), true);
            //jsObj.SetProperty(JavaScriptPropertyId.FromString("overrideMimeType"), JavaScriptValue.CreateFunction(functions["overrideMimeType"]), true);
            jsObj.SetProperty(JavaScriptPropertyId.FromString("send"), JavaScriptValue.CreateFunction(functions["send"]), true);
            jsObj.SetProperty(JavaScriptPropertyId.FromString("setRequestHeader"), JavaScriptValue.CreateFunction(functions["setRequestHeader"]), true);

            return(jsObj);
        }
Пример #9
0
        private JavaScriptValue VisitArray(JArray token)
        {
            var n     = token.Count;
            var array = JavaScriptValue.CreateArray((uint)n);

            for (var i = 0; i < n; ++i)
            {
                var element = Visit(token[i]);
                array.SetIndexedProperty(JavaScriptValue.FromInt32(i), element);
            }

            return(array);
        }
Пример #10
0
        private JavaScriptValue VisitArray(JArray token)
        {
            var n     = token.Count;
            var array = AddRef(JavaScriptValue.CreateArray((uint)n));

            for (var i = 0; i < n; ++i)
            {
                var value = Visit(token[i]);
                array.SetIndexedProperty(JavaScriptValue.FromInt32(i), value);
                value.Release();
            }

            return(array);
        }
Пример #11
0
        public object GetAtIndex(object instance, int index)
        {
            if (!(instance is JavaScriptValue javaScriptValue))
            {
                return(null);
            }

            if (javaScriptValue.ValueType != JavaScriptValueType.Array)
            {
                return(null);
            }

            return(javaScriptValue.GetIndexedProperty(JavaScriptValue.FromInt32(index)).ToNative());
        }
Пример #12
0
        public async void ProcessFrame(FrameData frame)
        {
            if (callbacks.Count == 0 || busy)
            {
                return;
            }
            else
            {
                busy = true;
            }

            var bitmap = frame.bitmap;

            if (!FaceDetector.IsBitmapPixelFormatSupported(bitmap.BitmapPixelFormat))
            {
                bitmap = SoftwareBitmap.Convert(bitmap, BitmapPixelFormat.Gray8);
            }

            var detectedFaces = await faceDetector.DetectFacesAsync(bitmap);

            int frameKey = -1;

            if (detectedFaces.Count > 0)
            {
                frameKey = SceneCameraManager.Inst.AddFrameToCache(frame);
            }

            ProjectRuntime.Inst.DispatchRuntimeCode(() => {
                var jsImg = JavaScriptValue.CreateObject();
                jsImg.SetProperty(JavaScriptPropertyId.FromString("id"), JavaScriptValue.FromInt32(frameKey), true);
                Native.JsSetObjectBeforeCollectCallback(jsImg, IntPtr.Zero, jsObjectCallback);

                var faces    = JavaScriptValue.CreateArray(0);
                var pushFunc = faces.GetProperty(JavaScriptPropertyId.FromString("push"));
                foreach (var face in detectedFaces)
                {
                    var pos    = GetEstimatedPositionFromFaceBounds(face.FaceBox, frame.bitmap);
                    var jsFace = JavaScriptContext.RunScript($"new Face(new Position({pos.X}, {pos.Y}, {pos.Z}), {0});");
                    jsFace.SetProperty(JavaScriptPropertyId.FromString("frame"), jsImg, true);
                    jsFace.SetProperty(JavaScriptPropertyId.FromString("bounds"), face.FaceBox.ToJavaScriptValue(), true);
                    pushFunc.CallFunction(faces, jsFace);
                }
                foreach (var callback in callbacks)
                {
                    callback.CallFunction(callback, faces);
                }
            });

            busy = false;
        }
Пример #13
0
        /// <summary>
        /// Converts a host object to a javascript value.
        /// </summary>
        public JavaScriptValue ToJsObject(object obj, Type type)
        {
            if (null == obj)
            {
                return(JavaScriptValue.Null);
            }

            if (JsConversions.IsVoidType(type))
            {
                return(ToJsVoid(obj, type));
            }

            if (JsConversions.IsNumberType(type))
            {
                return(ToJsNumber(obj, type));
            }

            if (JsConversions.IsStringType(type))
            {
                return(ToJsString(obj, type));
            }

            if (JsConversions.IsBoolType(type))
            {
                return(ToJsBoolean(obj, type));
            }

            if (JsConversions.IsFunctionType(type))
            {
                return(ToJsFunction(obj, type));
            }

            if (type.IsArray)
            {
                var underlyingType = type.GetElementType();
                var hostArray      = (Array)obj;
                var newArr         = JavaScriptValue.CreateArray((uint)hostArray.Length);

                for (int i = 0; i < hostArray.Length; ++i)
                {
                    var jsValue = ToJsObject(hostArray.GetValue(i), underlyingType);
                    newArr.SetIndexedProperty(JavaScriptValue.FromInt32(i), jsValue);
                }

                return(newArr);
            }

            // Attempt to bind the object and return it
            return(ToBoundJsObject(obj, type));
        }
Пример #14
0
        public JavaScriptValue UpdateBarplot(JavaScriptValue callee, bool isConstructCall, JavaScriptValue[] arguments, ushort argumentCount, IntPtr callbackData)
        {
            if (argumentCount != 4)
            {
                return(JavaScriptValue.Invalid);
            }

            var graphID  = arguments[1].ToString();
            var position = arguments[2].ToVector3();

            var plotCount = arguments[3].GetProperty(JavaScriptPropertyId.FromString("length")).ConvertToNumber().ToInt32();
            var plotData  = new List <Bargraph.BarData>(plotCount);

            for (int i = 0; i < plotCount; ++i)
            {
                var row = arguments[3].GetIndexedProperty(JavaScriptValue.FromInt32(i));

                if (!row.Has("value"))
                {
                    continue;
                }

                var label = row.Has("label") ? row.Get("label").ToString() : null;
                var value = (float)row.Get("value").ConvertToNumber().ToDouble();
                var color = row.Has("color") ? row.Get("color").ToColor() : (Color?)null;

                plotData.Add(new Bargraph.BarData()
                {
                    Label = label,
                    Value = value,
                    Color = color
                });
            }

            if (bargraphDict.ContainsKey(graphID))
            {
                bargraphDict[graphID].Update(plotData);
                bargraphDict[graphID].Position = position;
            }
            else
            {
                var graph = new Bargraph();
                graph.Update(plotData);
                graph.Position        = position;
                bargraphDict[graphID] = graph;
            }

            return(JavaScriptValue.Invalid);
        }
        private JToken VisitArray(JavaScriptValue value)
        {
            var array      = new JArray();
            var propertyId = JavaScriptPropertyId.FromString("length");
            var length     = (int)value.GetProperty(propertyId).ToDouble();

            for (var i = 0; i < length; ++i)
            {
                var index   = JavaScriptValue.FromInt32(i);
                var element = value.GetIndexedProperty(index);
                array.Add(Visit(element));
            }

            return(array);
        }
Пример #16
0
        public static void Add(JavaScriptValue objectContext, int a, int b)
        {
            var jsArgs = new[]
            {
                objectContext,
                JavaScriptValue.FromInt32(a),
                JavaScriptValue.FromInt32(b)
            };

            Native.JsCallFunction(
                objectContext.GetProperty(JavaScriptPropertyId.FromString("add")), jsArgs,
                (ushort)jsArgs.Length, out var functionValue);

            Console.WriteLine(JsValueAsString(functionValue));
        }
Пример #17
0
        public static JavaScriptValue ToJavaScriptValue(this object it)
        {
            switch (it)
            {
            case JavaScriptValue javaScriptValue:
                return(javaScriptValue);

            case bool value:
                return(JavaScriptValue.FromBoolean(value));

            case string value:
                return(JavaScriptValue.FromString(value));

            case int value:
                return(JavaScriptValue.FromInt32(value));

            case double value:
                return(JavaScriptValue.FromDouble(value));

            case float value:
                return(JavaScriptValue.FromDouble(value));

            case decimal value:
                return(JavaScriptValue.FromDouble(Convert.ToDouble(value)));

            case null:
                return(JavaScriptValue.Null);

            default:
                ITypeConversion converter = null;
                var             type      = it.GetType();
                foreach (var item in Conversions)
                {
                    if (item.ObjectType == type)
                    {
                        converter = item;
                        break;
                    }

                    if (item.ObjectType.IsAssignableFrom(type))
                    {
                        converter = item;
                    }
                }

                return(converter?.ToJsValue?.Invoke(it) ?? JavaScriptValue.Invalid);
            }
        }
        public JavaScriptValue Sum(JavaScriptValue callee, [MarshalAs(UnmanagedType.U1)] bool isConstructCall, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] JavaScriptValue[] arguments, ushort argumentCount, IntPtr callbackData)
        {
            int nSum   = 0;
            int nStart = 0;
            int nEnd   = 0;

            System.Diagnostics.Trace.WriteLine("Enter Sum");

            nStart = (int)arguments[1].ToDouble();
            nEnd   = (int)arguments[2].ToDouble();

            for (int nIndex = nStart; nIndex <= nEnd; nIndex++)
            {
                nSum += nIndex;
            }

            return(JavaScriptValue.FromInt32(nSum));
        }
Пример #19
0
        /// <summary>
        /// Converts a <see cref="JavaScriptValue"/> array into a host array.
        /// </summary>
        public object ToHostArray(JavaScriptValue arg, Type toType)
        {
            if (!toType.IsArray)
            {
                throw new Exception($"Cannot convert javascript array to type: {toType}");
            }

            var elementType = toType.GetElementType();
            var length      = arg.GetProperty(JavaScriptPropertyId.FromString("length")).ToInt32();
            var resultArray = Array.CreateInstance(elementType, length);

            for (int i = 0; i < length; ++i)
            {
                var atIndex = arg.GetIndexedProperty(JavaScriptValue.FromInt32(i));
                resultArray.SetValue(ToHostObject(atIndex, elementType), i);
            }

            return(resultArray);
        }
Пример #20
0
        private JavaScriptValue VisitArray(JArray token)
        {
            var n      = token.Count;
            var values = new JavaScriptValue[n];

            for (var i = 0; i < n; ++i)
            {
                values[i] = Visit(token[i]);
            }

            var array = JavaScriptValue.CreateArray((uint)n);

            for (var i = 0; i < n; ++i)
            {
                array.SetIndexedProperty(JavaScriptValue.FromInt32(i), values[i]);
            }

            return(array);
        }
Пример #21
0
 public void Benchmark9()
 {
     using (var c = ControllerTests.MakeController())
     {
         c.Global["f"] = (Action <int, int>)(nativefun1);
         var f  = c.Evaluate("f");
         var vs = new JavaScriptValue[] {
             JavaScriptValue.Null,
             JavaScriptValue.FromInt32(1),
             JavaScriptValue.FromInt32(1)
         };
         Go(() =>
         {
             for (var i = 0; i < 10000; i++)
             {
                 f.Call(vs);
             }
         });
         Console.WriteLine(i);
     }
 }
Пример #22
0
        /// <summary>
        /// Determines whether or not the <see cref="Type"/> is a valid JS type for array conversions.
        /// </summary>
        private static bool IsArrayType(JavaScriptValue value, JsBinder bindingData, Type type)
        {
            if (!type.IsArray)
            {
                return(false);
            }

            // Check length, if empty, we can assume it matches any of the array types
            var length = value.GetProperty(JavaScriptPropertyId.FromString("length")).ToInt32();

            if (length <= 0)
            {
                return(true);
            }

            // Look at the first element, type check against the host array element type
            var firstElement = value.GetIndexedProperty(JavaScriptValue.FromInt32(0));
            var elementType  = type.GetElementType();

            return(IsAssignable(firstElement, bindingData, elementType));
        }
        public static JavaScriptValue ToJavaScriptValue <T>(this T x) where T : struct
        {
            var jsObj = JavaScriptValue.CreateObject();

            foreach (var field in x.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance))
            {
                var name  = JavaScriptPropertyId.FromString(field.Name.ToLower());
                var value = field.GetValue(x);
                switch (value)
                {
                case uint i:
                    jsObj.SetProperty(name, JavaScriptValue.FromInt32((int)i), true);
                    break;

                case int i:
                    jsObj.SetProperty(name, JavaScriptValue.FromInt32(i), true);
                    break;

                case float f:
                    jsObj.SetProperty(name, JavaScriptValue.FromDouble(f), true);
                    break;

                case double d:
                    jsObj.SetProperty(name, JavaScriptValue.FromDouble(d), true);
                    break;

                case string s:
                    jsObj.SetProperty(name, JavaScriptValue.FromString(s), true);
                    break;

                case bool b:
                    jsObj.SetProperty(name, JavaScriptValue.FromBoolean(b), true);
                    break;
                }
            }
            return(jsObj);
        }
Пример #24
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 called JsStartDebugging right after context is created.
            //

            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);
        }
Пример #25
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue QuaternionPrototype;
            JavaScriptValue QuaternionConstructor = Bridge.CreateConstructor(
                typeof(UnityEngine.Quaternion),
                (args) => {
                if (args.Length == 1)
                {
                    return(Bridge.CreateExternalWithPrototype(new UnityEngine.Quaternion()));
                }

                return(Bridge.CreateExternalWithPrototype(new UnityEngine.Quaternion(
                                                              (float)args[1].ToDouble(),
                                                              (float)args[2].ToDouble(),
                                                              (float)args[3].ToDouble(),
                                                              (float)args[4].ToDouble()
                                                              )));
            },
                out QuaternionPrototype
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("UnityEngine")
            .SetProperty("Quaternion", QuaternionConstructor);


            // Static Fields

            QuaternionConstructor.SetProperty(
                "kEpsilon",
                JavaScriptValue.FromDouble(UnityEngine.Quaternion.kEpsilon)
                );


            // Static Property Accessors

            Bridge.DefineGetter(
                QuaternionConstructor,
                "identity",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Quaternion.identity)
                );


            // Static Methods

            QuaternionConstructor.SetProperty(
                "FromToRotation",
                Bridge.CreateFunction(
                    "FromToRotation",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Quaternion.FromToRotation(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[2]).wrapped))
                    )
                );


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


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


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


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


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


            QuaternionConstructor.SetProperty(
                "AngleAxis",
                Bridge.CreateFunction(
                    "AngleAxis",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Quaternion.AngleAxis((float)args[1].ToDouble(), Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[2]).wrapped))
                    )
                );


            QuaternionConstructor.SetProperty(
                "LookRotation",
                Bridge.CreateFunction(
                    "LookRotation",
                    (args) => {
                if (args.Length == 2)
                {
                    return(Bridge.CreateExternalWithPrototype(UnityEngine.Quaternion.LookRotation(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped)));
                }
                else
                {
                    return(Bridge.CreateExternalWithPrototype(UnityEngine.Quaternion.LookRotation(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[2]).wrapped)));
                }
            }
                    )
                );


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


            QuaternionConstructor.SetProperty(
                "Angle",
                Bridge.CreateFunction(
                    "Angle",
                    (args) => JavaScriptValue.FromDouble(UnityEngine.Quaternion.Angle(Bridge.GetBoxedExternal <UnityEngine.Quaternion>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Quaternion>(args[2]).wrapped))
                    )
                );


            QuaternionConstructor.SetProperty(
                "Euler",
                Bridge.CreateFunction(
                    "Euler",
                    (args) => {
                if (args.Length == 2)
                {
                    return(Bridge.CreateExternalWithPrototype(UnityEngine.Quaternion.Euler(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped)));
                }
                else
                {
                    return(Bridge.CreateExternalWithPrototype(UnityEngine.Quaternion.Euler((float)args[1].ToDouble(), (float)args[2].ToDouble(), (float)args[3].ToDouble())));
                }
            }
                    )
                );


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


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


            // Instance Fields

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


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


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


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


            // Instance Property Accessors

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


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


            // Instance Methods

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


            QuaternionPrototype.SetProperty(
                "SetLookRotation",
                Bridge.CreateFunction(
                    "SetLookRotation",
                    Bridge.WithBoxedExternal <UnityEngine.Quaternion>((o, args) => {
                if (args.Length == 2)
                {
                    o.wrapped.SetLookRotation(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped);
                }
                else
                {
                    o.wrapped.SetLookRotation(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[2]).wrapped);
                }
            })
                    )
                );


            /*
             * Quaternion ToAngleAxis
             * parameter angle is out
             */


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


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


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


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


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


            QuaternionPrototype.SetProperty(
                "toString",
                Bridge.CreateFunction(
                    "ToString",
                    Bridge.WithBoxedExternal <UnityEngine.Quaternion>((o, args) => {
                if (args.Length == 1)
                {
                    return(JavaScriptValue.FromString(o.wrapped.ToString()));
                }
                else
                {
                    return(JavaScriptValue.FromString(o.wrapped.ToString(args[1].ToString())));
                }
            })
                    )
                );
        }
Пример #26
0
        /// <summary>
        /// Attempts to infer the host type based on the javscript type.
        /// </summary>
        public bool TryInferType(JavaScriptValue arg, out Type type)
        {
            // TODO: This method should be used as a last line of effort to try and build a host
            // TODO: type of method call from JS objects. Would love to get rid of it altogether.
            type = null;
            switch (arg.ValueType)
            {
            case JavaScriptValueType.Undefined: return(true);

            case JavaScriptValueType.Null: return(true);

            case JavaScriptValueType.Array:
            case JavaScriptValueType.TypedArray:
            {
                var length = arg.GetProperty(JavaScriptPropertyId.FromString("length")).ToInt32();
                if (length <= 0)
                {
                    type = typeof(object[]);
                    return(true);
                }

                Type innerType;
                var  firstElement = arg.GetIndexedProperty(JavaScriptValue.FromInt32(0));
                if (TryInferType(firstElement, out innerType))
                {
                    type = innerType.MakeArrayType();
                    return(true);
                }

                type = typeof(object[]);
                return(true);
            }

            case JavaScriptValueType.Boolean:
            {
                type = typeof(bool);
                return(true);
            }

            case JavaScriptValueType.Number:
            {
                type = typeof(double);
                return(true);
            }

            case JavaScriptValueType.String:
            {
                type = typeof(string);
                return(true);
            }

            case JavaScriptValueType.Function:
            {
                type = typeof(IJsCallback);
                return(true);
            }

            case JavaScriptValueType.Object:
            {
                try
                {
                    var hostObject = ToHostBoundObject(arg, typeof(void));
                    type = hostObject.GetType();
                    return(true);
                }
                catch
                {
                    type = typeof(object);
                    return(true);
                }
            }
            }

            return(false);
        }
Пример #27
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue RendererPrototype;
            JavaScriptValue RendererConstructor = Bridge.CreateConstructor(
                typeof(UnityEngine.Renderer),
                (args) => { throw new System.NotImplementedException(); },
                out RendererPrototype
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("UnityEngine")
            .SetProperty("Renderer", RendererConstructor);


            // Static Fields


            // Static Property Accessors


            // Static Methods


            // Instance Fields


            // Instance Property Accessors

            Bridge.DefineGetter(
                RendererPrototype,
                "bounds",
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => Bridge.CreateExternalWithPrototype(o.bounds))
                );


            Bridge.DefineGetterSetter(
                RendererPrototype,
                "enabled",
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => JavaScriptValue.FromBoolean(o.enabled)),
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => { o.enabled = args[1].ToBoolean(); })
                );


            Bridge.DefineGetter(
                RendererPrototype,
                "isVisible",
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => JavaScriptValue.FromBoolean(o.isVisible))
                );


            Bridge.DefineGetterSetter(
                RendererPrototype,
                "shadowCastingMode",
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => Bridge.CreateExternalWithPrototype(o.shadowCastingMode)),
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => { o.shadowCastingMode = Bridge.GetExternal <UnityEngine.Rendering.ShadowCastingMode>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                RendererPrototype,
                "receiveShadows",
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => JavaScriptValue.FromBoolean(o.receiveShadows)),
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => { o.receiveShadows = args[1].ToBoolean(); })
                );


            Bridge.DefineGetterSetter(
                RendererPrototype,
                "motionVectorGenerationMode",
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => Bridge.CreateExternalWithPrototype(o.motionVectorGenerationMode)),
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => { o.motionVectorGenerationMode = Bridge.GetExternal <UnityEngine.MotionVectorGenerationMode>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                RendererPrototype,
                "lightProbeUsage",
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => Bridge.CreateExternalWithPrototype(o.lightProbeUsage)),
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => { o.lightProbeUsage = Bridge.GetExternal <UnityEngine.Rendering.LightProbeUsage>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                RendererPrototype,
                "reflectionProbeUsage",
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => Bridge.CreateExternalWithPrototype(o.reflectionProbeUsage)),
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => { o.reflectionProbeUsage = Bridge.GetExternal <UnityEngine.Rendering.ReflectionProbeUsage>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                RendererPrototype,
                "renderingLayerMask",
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => Bridge.CreateExternalWithPrototype(o.renderingLayerMask)),
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => { o.renderingLayerMask = Bridge.GetBoxedExternal <System.UInt32>(args[1]).wrapped; })
                );


            Bridge.DefineGetterSetter(
                RendererPrototype,
                "sortingLayerName",
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => JavaScriptValue.FromString(o.sortingLayerName)),
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => { o.sortingLayerName = args[1].ToString(); })
                );


            Bridge.DefineGetterSetter(
                RendererPrototype,
                "sortingLayerID",
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => JavaScriptValue.FromInt32(o.sortingLayerID)),
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => { o.sortingLayerID = args[1].ToInt32(); })
                );


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


            Bridge.DefineGetterSetter(
                RendererPrototype,
                "allowOcclusionWhenDynamic",
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => JavaScriptValue.FromBoolean(o.allowOcclusionWhenDynamic)),
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => { o.allowOcclusionWhenDynamic = args[1].ToBoolean(); })
                );


            Bridge.DefineGetter(
                RendererPrototype,
                "isPartOfStaticBatch",
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => JavaScriptValue.FromBoolean(o.isPartOfStaticBatch))
                );


            Bridge.DefineGetter(
                RendererPrototype,
                "worldToLocalMatrix",
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => Bridge.CreateExternalWithPrototype(o.worldToLocalMatrix))
                );


            Bridge.DefineGetter(
                RendererPrototype,
                "localToWorldMatrix",
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => Bridge.CreateExternalWithPrototype(o.localToWorldMatrix))
                );


            Bridge.DefineGetterSetter(
                RendererPrototype,
                "lightProbeProxyVolumeOverride",
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => Bridge.CreateExternalWithPrototype(o.lightProbeProxyVolumeOverride)),
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => { o.lightProbeProxyVolumeOverride = Bridge.GetExternal <UnityEngine.GameObject>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                RendererPrototype,
                "probeAnchor",
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => Bridge.CreateExternalWithPrototype(o.probeAnchor)),
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => { o.probeAnchor = Bridge.GetExternal <UnityEngine.Transform>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                RendererPrototype,
                "lightmapIndex",
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => JavaScriptValue.FromInt32(o.lightmapIndex)),
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => { o.lightmapIndex = args[1].ToInt32(); })
                );


            Bridge.DefineGetterSetter(
                RendererPrototype,
                "realtimeLightmapIndex",
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => JavaScriptValue.FromInt32(o.realtimeLightmapIndex)),
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => { o.realtimeLightmapIndex = args[1].ToInt32(); })
                );


            Bridge.DefineGetterSetter(
                RendererPrototype,
                "lightmapScaleOffset",
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => Bridge.CreateExternalWithPrototype(o.lightmapScaleOffset)),
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => { o.lightmapScaleOffset = Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped; })
                );


            Bridge.DefineGetterSetter(
                RendererPrototype,
                "realtimeLightmapScaleOffset",
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => Bridge.CreateExternalWithPrototype(o.realtimeLightmapScaleOffset)),
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => { o.realtimeLightmapScaleOffset = Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped; })
                );


            Bridge.DefineGetterSetter(
                RendererPrototype,
                "materials",
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => Bridge.CreateExternalWithPrototype(o.materials)),
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => { o.materials = Bridge.GetExternal <UnityEngine.Material[]>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                RendererPrototype,
                "material",
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => Bridge.CreateExternalWithPrototype(o.material)),
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => { o.material = Bridge.GetExternal <UnityEngine.Material>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                RendererPrototype,
                "sharedMaterial",
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => Bridge.CreateExternalWithPrototype(o.sharedMaterial)),
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => { o.sharedMaterial = Bridge.GetExternal <UnityEngine.Material>(args[1]); })
                );


            Bridge.DefineGetterSetter(
                RendererPrototype,
                "sharedMaterials",
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => Bridge.CreateExternalWithPrototype(o.sharedMaterials)),
                Bridge.WithExternal <UnityEngine.Renderer>((o, args) => { o.sharedMaterials = Bridge.GetExternal <UnityEngine.Material[]>(args[1]); })
                );


            // Instance Methods

            RendererPrototype.SetProperty(
                "HasPropertyBlock",
                Bridge.CreateFunction(
                    "HasPropertyBlock",
                    Bridge.WithExternal <UnityEngine.Renderer>((o, args) => JavaScriptValue.FromBoolean(o.HasPropertyBlock()))
                    )
                );


            RendererPrototype.SetProperty(
                "SetPropertyBlock",
                Bridge.CreateFunction(
                    "SetPropertyBlock",
                    Bridge.WithExternal <UnityEngine.Renderer>((o, args) => o.SetPropertyBlock(Bridge.GetExternal <UnityEngine.MaterialPropertyBlock>(args[1])))
                    )
                );


            RendererPrototype.SetProperty(
                "SetPropertyBlock",
                Bridge.CreateFunction(
                    "SetPropertyBlock",
                    Bridge.WithExternal <UnityEngine.Renderer>((o, args) => o.SetPropertyBlock(Bridge.GetExternal <UnityEngine.MaterialPropertyBlock>(args[1]), args[2].ToInt32()))
                    )
                );


            RendererPrototype.SetProperty(
                "GetPropertyBlock",
                Bridge.CreateFunction(
                    "GetPropertyBlock",
                    Bridge.WithExternal <UnityEngine.Renderer>((o, args) => o.GetPropertyBlock(Bridge.GetExternal <UnityEngine.MaterialPropertyBlock>(args[1])))
                    )
                );


            RendererPrototype.SetProperty(
                "GetPropertyBlock",
                Bridge.CreateFunction(
                    "GetPropertyBlock",
                    Bridge.WithExternal <UnityEngine.Renderer>((o, args) => o.GetPropertyBlock(Bridge.GetExternal <UnityEngine.MaterialPropertyBlock>(args[1]), args[2].ToInt32()))
                    )
                );


            /*
             * Renderer GetMaterials
             * System.Collections.Generic.List`1[UnityEngine.Material] has generics
             */


            /*
             * Renderer GetSharedMaterials
             * System.Collections.Generic.List`1[UnityEngine.Material] has generics
             */


            /*
             * Renderer GetClosestReflectionProbes
             * System.Collections.Generic.List`1[UnityEngine.Rendering.ReflectionProbeBlendInfo] has generics
             */
        }
Пример #28
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue ResolutionPrototype;
            JavaScriptValue ResolutionConstructor = Bridge.CreateConstructor(
                typeof(UnityEngine.Resolution),
                (args) => { throw new System.NotImplementedException(); },
                out ResolutionPrototype
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("UnityEngine")
            .SetProperty("Resolution", ResolutionConstructor);


            // Static Fields


            // Static Property Accessors


            // Static Methods


            // Instance Fields


            // Instance Property Accessors

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


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


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


            // Instance Methods

            ResolutionPrototype.SetProperty(
                "toString",
                Bridge.CreateFunction(
                    "ToString",
                    Bridge.WithBoxedExternal <UnityEngine.Resolution>((o, args) => JavaScriptValue.FromString(o.wrapped.ToString()))
                    )
                );
        }
Пример #29
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue GUIPrototype;
            JavaScriptValue GUIConstructor = Bridge.CreateConstructor(
                typeof(UnityEngine.GUI),
                (args) => { throw new System.NotImplementedException(); },
                out GUIPrototype
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("UnityEngine")
            .SetProperty("GUI", GUIConstructor);


            // Static Fields


            // Static Property Accessors

            Bridge.DefineGetterSetter(
                GUIConstructor,
                "color",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.GUI.color),
                (args) => { UnityEngine.GUI.color = Bridge.GetBoxedExternal <UnityEngine.Color>(args[1]).wrapped; }
                );


            Bridge.DefineGetterSetter(
                GUIConstructor,
                "backgroundColor",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.GUI.backgroundColor),
                (args) => { UnityEngine.GUI.backgroundColor = Bridge.GetBoxedExternal <UnityEngine.Color>(args[1]).wrapped; }
                );


            Bridge.DefineGetterSetter(
                GUIConstructor,
                "contentColor",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.GUI.contentColor),
                (args) => { UnityEngine.GUI.contentColor = Bridge.GetBoxedExternal <UnityEngine.Color>(args[1]).wrapped; }
                );


            Bridge.DefineGetterSetter(
                GUIConstructor,
                "changed",
                (args) => JavaScriptValue.FromBoolean(UnityEngine.GUI.changed),
                (args) => { UnityEngine.GUI.changed = args[1].ToBoolean(); }
                );


            Bridge.DefineGetterSetter(
                GUIConstructor,
                "enabled",
                (args) => JavaScriptValue.FromBoolean(UnityEngine.GUI.enabled),
                (args) => { UnityEngine.GUI.enabled = args[1].ToBoolean(); }
                );


            Bridge.DefineGetterSetter(
                GUIConstructor,
                "depth",
                (args) => JavaScriptValue.FromInt32(UnityEngine.GUI.depth),
                (args) => { UnityEngine.GUI.depth = args[1].ToInt32(); }
                );


            Bridge.DefineGetterSetter(
                GUIConstructor,
                "skin",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.GUI.skin),
                (args) => { UnityEngine.GUI.skin = Bridge.GetExternal <UnityEngine.GUISkin>(args[1]); }
                );


            Bridge.DefineGetterSetter(
                GUIConstructor,
                "matrix",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.GUI.matrix),
                (args) => { UnityEngine.GUI.matrix = Bridge.GetBoxedExternal <UnityEngine.Matrix4x4>(args[1]).wrapped; }
                );


            Bridge.DefineGetterSetter(
                GUIConstructor,
                "tooltip",
                (args) => JavaScriptValue.FromString(UnityEngine.GUI.tooltip),
                (args) => { UnityEngine.GUI.tooltip = args[1].ToString(); }
                );


            // Static Methods

            GUIConstructor.SetProperty(
                "SetNextControlName",
                Bridge.CreateFunction(
                    "SetNextControlName",
                    (args) => UnityEngine.GUI.SetNextControlName(args[1].ToString())
                    )
                );


            GUIConstructor.SetProperty(
                "GetNameOfFocusedControl",
                Bridge.CreateFunction(
                    "GetNameOfFocusedControl",
                    (args) => JavaScriptValue.FromString(UnityEngine.GUI.GetNameOfFocusedControl())
                    )
                );


            GUIConstructor.SetProperty(
                "FocusControl",
                Bridge.CreateFunction(
                    "FocusControl",
                    (args) => UnityEngine.GUI.FocusControl(args[1].ToString())
                    )
                );


            GUIConstructor.SetProperty(
                "DragWindow",
                Bridge.CreateFunction(
                    "DragWindow",
                    (args) => UnityEngine.GUI.DragWindow(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped)
                    )
                );


            GUIConstructor.SetProperty(
                "BringWindowToFront",
                Bridge.CreateFunction(
                    "BringWindowToFront",
                    (args) => UnityEngine.GUI.BringWindowToFront(args[1].ToInt32())
                    )
                );


            GUIConstructor.SetProperty(
                "BringWindowToBack",
                Bridge.CreateFunction(
                    "BringWindowToBack",
                    (args) => UnityEngine.GUI.BringWindowToBack(args[1].ToInt32())
                    )
                );


            GUIConstructor.SetProperty(
                "FocusWindow",
                Bridge.CreateFunction(
                    "FocusWindow",
                    (args) => UnityEngine.GUI.FocusWindow(args[1].ToInt32())
                    )
                );


            GUIConstructor.SetProperty(
                "UnfocusWindow",
                Bridge.CreateFunction(
                    "UnfocusWindow",
                    (args) => UnityEngine.GUI.UnfocusWindow()
                    )
                );


            GUIConstructor.SetProperty(
                "Label",
                Bridge.CreateFunction(
                    "Label",
                    (args) => UnityEngine.GUI.Label(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToString())
                    )
                );


            GUIConstructor.SetProperty(
                "Label",
                Bridge.CreateFunction(
                    "Label",
                    (args) => UnityEngine.GUI.Label(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Texture>(args[2]))
                    )
                );


            GUIConstructor.SetProperty(
                "Label",
                Bridge.CreateFunction(
                    "Label",
                    (args) => UnityEngine.GUI.Label(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.GUIContent>(args[2]))
                    )
                );


            GUIConstructor.SetProperty(
                "Label",
                Bridge.CreateFunction(
                    "Label",
                    (args) => UnityEngine.GUI.Label(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToString(), Bridge.GetExternal <UnityEngine.GUIStyle>(args[3]))
                    )
                );


            GUIConstructor.SetProperty(
                "Label",
                Bridge.CreateFunction(
                    "Label",
                    (args) => UnityEngine.GUI.Label(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Texture>(args[2]), Bridge.GetExternal <UnityEngine.GUIStyle>(args[3]))
                    )
                );


            GUIConstructor.SetProperty(
                "Label",
                Bridge.CreateFunction(
                    "Label",
                    (args) => UnityEngine.GUI.Label(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.GUIContent>(args[2]), Bridge.GetExternal <UnityEngine.GUIStyle>(args[3]))
                    )
                );


            GUIConstructor.SetProperty(
                "DrawTexture",
                Bridge.CreateFunction(
                    "DrawTexture",
                    (args) => UnityEngine.GUI.DrawTexture(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Texture>(args[2]))
                    )
                );


            GUIConstructor.SetProperty(
                "DrawTexture",
                Bridge.CreateFunction(
                    "DrawTexture",
                    (args) => UnityEngine.GUI.DrawTexture(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Texture>(args[2]), Bridge.GetExternal <UnityEngine.ScaleMode>(args[3]))
                    )
                );


            GUIConstructor.SetProperty(
                "DrawTexture",
                Bridge.CreateFunction(
                    "DrawTexture",
                    (args) => UnityEngine.GUI.DrawTexture(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Texture>(args[2]), Bridge.GetExternal <UnityEngine.ScaleMode>(args[3]), args[4].ToBoolean())
                    )
                );


            GUIConstructor.SetProperty(
                "DrawTexture",
                Bridge.CreateFunction(
                    "DrawTexture",
                    (args) => UnityEngine.GUI.DrawTexture(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Texture>(args[2]), Bridge.GetExternal <UnityEngine.ScaleMode>(args[3]), args[4].ToBoolean(), (float)args[5].ToDouble())
                    )
                );


            GUIConstructor.SetProperty(
                "DrawTexture",
                Bridge.CreateFunction(
                    "DrawTexture",
                    (args) => UnityEngine.GUI.DrawTexture(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Texture>(args[2]), Bridge.GetExternal <UnityEngine.ScaleMode>(args[3]), args[4].ToBoolean(), (float)args[5].ToDouble(), Bridge.GetBoxedExternal <UnityEngine.Color>(args[6]).wrapped, (float)args[7].ToDouble(), (float)args[8].ToDouble())
                    )
                );


            GUIConstructor.SetProperty(
                "DrawTexture",
                Bridge.CreateFunction(
                    "DrawTexture",
                    (args) => UnityEngine.GUI.DrawTexture(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Texture>(args[2]), Bridge.GetExternal <UnityEngine.ScaleMode>(args[3]), args[4].ToBoolean(), (float)args[5].ToDouble(), Bridge.GetBoxedExternal <UnityEngine.Color>(args[6]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[7]).wrapped, (float)args[8].ToDouble())
                    )
                );


            GUIConstructor.SetProperty(
                "DrawTexture",
                Bridge.CreateFunction(
                    "DrawTexture",
                    (args) => UnityEngine.GUI.DrawTexture(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Texture>(args[2]), Bridge.GetExternal <UnityEngine.ScaleMode>(args[3]), args[4].ToBoolean(), (float)args[5].ToDouble(), Bridge.GetBoxedExternal <UnityEngine.Color>(args[6]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[7]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[8]).wrapped)
                    )
                );


            GUIConstructor.SetProperty(
                "DrawTextureWithTexCoords",
                Bridge.CreateFunction(
                    "DrawTextureWithTexCoords",
                    (args) => UnityEngine.GUI.DrawTextureWithTexCoords(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Texture>(args[2]), Bridge.GetBoxedExternal <UnityEngine.Rect>(args[3]).wrapped)
                    )
                );


            GUIConstructor.SetProperty(
                "DrawTextureWithTexCoords",
                Bridge.CreateFunction(
                    "DrawTextureWithTexCoords",
                    (args) => UnityEngine.GUI.DrawTextureWithTexCoords(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Texture>(args[2]), Bridge.GetBoxedExternal <UnityEngine.Rect>(args[3]).wrapped, args[4].ToBoolean())
                    )
                );


            GUIConstructor.SetProperty(
                "Box",
                Bridge.CreateFunction(
                    "Box",
                    (args) => UnityEngine.GUI.Box(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToString())
                    )
                );


            GUIConstructor.SetProperty(
                "Box",
                Bridge.CreateFunction(
                    "Box",
                    (args) => UnityEngine.GUI.Box(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Texture>(args[2]))
                    )
                );


            GUIConstructor.SetProperty(
                "Box",
                Bridge.CreateFunction(
                    "Box",
                    (args) => UnityEngine.GUI.Box(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.GUIContent>(args[2]))
                    )
                );


            GUIConstructor.SetProperty(
                "Box",
                Bridge.CreateFunction(
                    "Box",
                    (args) => UnityEngine.GUI.Box(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToString(), Bridge.GetExternal <UnityEngine.GUIStyle>(args[3]))
                    )
                );


            GUIConstructor.SetProperty(
                "Box",
                Bridge.CreateFunction(
                    "Box",
                    (args) => UnityEngine.GUI.Box(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Texture>(args[2]), Bridge.GetExternal <UnityEngine.GUIStyle>(args[3]))
                    )
                );


            GUIConstructor.SetProperty(
                "Box",
                Bridge.CreateFunction(
                    "Box",
                    (args) => UnityEngine.GUI.Box(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.GUIContent>(args[2]), Bridge.GetExternal <UnityEngine.GUIStyle>(args[3]))
                    )
                );


            GUIConstructor.SetProperty(
                "Button",
                Bridge.CreateFunction(
                    "Button",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.GUI.Button(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToString()))
                    )
                );


            GUIConstructor.SetProperty(
                "Button",
                Bridge.CreateFunction(
                    "Button",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.GUI.Button(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Texture>(args[2])))
                    )
                );


            GUIConstructor.SetProperty(
                "Button",
                Bridge.CreateFunction(
                    "Button",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.GUI.Button(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.GUIContent>(args[2])))
                    )
                );


            GUIConstructor.SetProperty(
                "Button",
                Bridge.CreateFunction(
                    "Button",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.GUI.Button(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToString(), Bridge.GetExternal <UnityEngine.GUIStyle>(args[3])))
                    )
                );


            GUIConstructor.SetProperty(
                "Button",
                Bridge.CreateFunction(
                    "Button",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.GUI.Button(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Texture>(args[2]), Bridge.GetExternal <UnityEngine.GUIStyle>(args[3])))
                    )
                );


            GUIConstructor.SetProperty(
                "Button",
                Bridge.CreateFunction(
                    "Button",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.GUI.Button(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.GUIContent>(args[2]), Bridge.GetExternal <UnityEngine.GUIStyle>(args[3])))
                    )
                );


            GUIConstructor.SetProperty(
                "RepeatButton",
                Bridge.CreateFunction(
                    "RepeatButton",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.GUI.RepeatButton(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToString()))
                    )
                );


            GUIConstructor.SetProperty(
                "RepeatButton",
                Bridge.CreateFunction(
                    "RepeatButton",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.GUI.RepeatButton(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Texture>(args[2])))
                    )
                );


            GUIConstructor.SetProperty(
                "RepeatButton",
                Bridge.CreateFunction(
                    "RepeatButton",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.GUI.RepeatButton(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.GUIContent>(args[2])))
                    )
                );


            GUIConstructor.SetProperty(
                "RepeatButton",
                Bridge.CreateFunction(
                    "RepeatButton",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.GUI.RepeatButton(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToString(), Bridge.GetExternal <UnityEngine.GUIStyle>(args[3])))
                    )
                );


            GUIConstructor.SetProperty(
                "RepeatButton",
                Bridge.CreateFunction(
                    "RepeatButton",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.GUI.RepeatButton(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Texture>(args[2]), Bridge.GetExternal <UnityEngine.GUIStyle>(args[3])))
                    )
                );


            GUIConstructor.SetProperty(
                "RepeatButton",
                Bridge.CreateFunction(
                    "RepeatButton",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.GUI.RepeatButton(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.GUIContent>(args[2]), Bridge.GetExternal <UnityEngine.GUIStyle>(args[3])))
                    )
                );


            GUIConstructor.SetProperty(
                "TextField",
                Bridge.CreateFunction(
                    "TextField",
                    (args) => JavaScriptValue.FromString(UnityEngine.GUI.TextField(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToString()))
                    )
                );


            GUIConstructor.SetProperty(
                "TextField",
                Bridge.CreateFunction(
                    "TextField",
                    (args) => JavaScriptValue.FromString(UnityEngine.GUI.TextField(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToString(), args[3].ToInt32()))
                    )
                );


            GUIConstructor.SetProperty(
                "TextField",
                Bridge.CreateFunction(
                    "TextField",
                    (args) => JavaScriptValue.FromString(UnityEngine.GUI.TextField(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToString(), Bridge.GetExternal <UnityEngine.GUIStyle>(args[3])))
                    )
                );


            GUIConstructor.SetProperty(
                "TextField",
                Bridge.CreateFunction(
                    "TextField",
                    (args) => JavaScriptValue.FromString(UnityEngine.GUI.TextField(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToString(), args[3].ToInt32(), Bridge.GetExternal <UnityEngine.GUIStyle>(args[4])))
                    )
                );


            GUIConstructor.SetProperty(
                "PasswordField",
                Bridge.CreateFunction(
                    "PasswordField",
                    (args) => JavaScriptValue.FromString(UnityEngine.GUI.PasswordField(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToString(), Bridge.GetBoxedExternal <System.Char>(args[3]).wrapped))
                    )
                );


            GUIConstructor.SetProperty(
                "PasswordField",
                Bridge.CreateFunction(
                    "PasswordField",
                    (args) => JavaScriptValue.FromString(UnityEngine.GUI.PasswordField(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToString(), Bridge.GetBoxedExternal <System.Char>(args[3]).wrapped, args[4].ToInt32()))
                    )
                );


            GUIConstructor.SetProperty(
                "PasswordField",
                Bridge.CreateFunction(
                    "PasswordField",
                    (args) => JavaScriptValue.FromString(UnityEngine.GUI.PasswordField(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToString(), Bridge.GetBoxedExternal <System.Char>(args[3]).wrapped, Bridge.GetExternal <UnityEngine.GUIStyle>(args[4])))
                    )
                );


            GUIConstructor.SetProperty(
                "PasswordField",
                Bridge.CreateFunction(
                    "PasswordField",
                    (args) => JavaScriptValue.FromString(UnityEngine.GUI.PasswordField(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToString(), Bridge.GetBoxedExternal <System.Char>(args[3]).wrapped, args[4].ToInt32(), Bridge.GetExternal <UnityEngine.GUIStyle>(args[5])))
                    )
                );


            GUIConstructor.SetProperty(
                "TextArea",
                Bridge.CreateFunction(
                    "TextArea",
                    (args) => JavaScriptValue.FromString(UnityEngine.GUI.TextArea(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToString()))
                    )
                );


            GUIConstructor.SetProperty(
                "TextArea",
                Bridge.CreateFunction(
                    "TextArea",
                    (args) => JavaScriptValue.FromString(UnityEngine.GUI.TextArea(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToString(), args[3].ToInt32()))
                    )
                );


            GUIConstructor.SetProperty(
                "TextArea",
                Bridge.CreateFunction(
                    "TextArea",
                    (args) => JavaScriptValue.FromString(UnityEngine.GUI.TextArea(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToString(), Bridge.GetExternal <UnityEngine.GUIStyle>(args[3])))
                    )
                );


            GUIConstructor.SetProperty(
                "TextArea",
                Bridge.CreateFunction(
                    "TextArea",
                    (args) => JavaScriptValue.FromString(UnityEngine.GUI.TextArea(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToString(), args[3].ToInt32(), Bridge.GetExternal <UnityEngine.GUIStyle>(args[4])))
                    )
                );


            GUIConstructor.SetProperty(
                "Toggle",
                Bridge.CreateFunction(
                    "Toggle",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.GUI.Toggle(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToBoolean(), args[3].ToString()))
                    )
                );


            GUIConstructor.SetProperty(
                "Toggle",
                Bridge.CreateFunction(
                    "Toggle",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.GUI.Toggle(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToBoolean(), Bridge.GetExternal <UnityEngine.Texture>(args[3])))
                    )
                );


            GUIConstructor.SetProperty(
                "Toggle",
                Bridge.CreateFunction(
                    "Toggle",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.GUI.Toggle(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToBoolean(), Bridge.GetExternal <UnityEngine.GUIContent>(args[3])))
                    )
                );


            GUIConstructor.SetProperty(
                "Toggle",
                Bridge.CreateFunction(
                    "Toggle",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.GUI.Toggle(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToBoolean(), args[3].ToString(), Bridge.GetExternal <UnityEngine.GUIStyle>(args[4])))
                    )
                );


            GUIConstructor.SetProperty(
                "Toggle",
                Bridge.CreateFunction(
                    "Toggle",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.GUI.Toggle(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToBoolean(), Bridge.GetExternal <UnityEngine.Texture>(args[3]), Bridge.GetExternal <UnityEngine.GUIStyle>(args[4])))
                    )
                );


            GUIConstructor.SetProperty(
                "Toggle",
                Bridge.CreateFunction(
                    "Toggle",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.GUI.Toggle(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToBoolean(), Bridge.GetExternal <UnityEngine.GUIContent>(args[3]), Bridge.GetExternal <UnityEngine.GUIStyle>(args[4])))
                    )
                );


            GUIConstructor.SetProperty(
                "Toggle",
                Bridge.CreateFunction(
                    "Toggle",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.GUI.Toggle(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToInt32(), args[3].ToBoolean(), Bridge.GetExternal <UnityEngine.GUIContent>(args[4]), Bridge.GetExternal <UnityEngine.GUIStyle>(args[5])))
                    )
                );


            GUIConstructor.SetProperty(
                "Toolbar",
                Bridge.CreateFunction(
                    "Toolbar",
                    (args) => JavaScriptValue.FromInt32(UnityEngine.GUI.Toolbar(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToInt32(), Bridge.GetExternal <System.String[]>(args[3])))
                    )
                );


            GUIConstructor.SetProperty(
                "Toolbar",
                Bridge.CreateFunction(
                    "Toolbar",
                    (args) => JavaScriptValue.FromInt32(UnityEngine.GUI.Toolbar(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToInt32(), Bridge.GetExternal <UnityEngine.Texture[]>(args[3])))
                    )
                );


            GUIConstructor.SetProperty(
                "Toolbar",
                Bridge.CreateFunction(
                    "Toolbar",
                    (args) => JavaScriptValue.FromInt32(UnityEngine.GUI.Toolbar(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToInt32(), Bridge.GetExternal <UnityEngine.GUIContent[]>(args[3])))
                    )
                );


            GUIConstructor.SetProperty(
                "Toolbar",
                Bridge.CreateFunction(
                    "Toolbar",
                    (args) => JavaScriptValue.FromInt32(UnityEngine.GUI.Toolbar(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToInt32(), Bridge.GetExternal <System.String[]>(args[3]), Bridge.GetExternal <UnityEngine.GUIStyle>(args[4])))
                    )
                );


            GUIConstructor.SetProperty(
                "Toolbar",
                Bridge.CreateFunction(
                    "Toolbar",
                    (args) => JavaScriptValue.FromInt32(UnityEngine.GUI.Toolbar(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToInt32(), Bridge.GetExternal <UnityEngine.Texture[]>(args[3]), Bridge.GetExternal <UnityEngine.GUIStyle>(args[4])))
                    )
                );


            GUIConstructor.SetProperty(
                "Toolbar",
                Bridge.CreateFunction(
                    "Toolbar",
                    (args) => JavaScriptValue.FromInt32(UnityEngine.GUI.Toolbar(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToInt32(), Bridge.GetExternal <UnityEngine.GUIContent[]>(args[3]), Bridge.GetExternal <UnityEngine.GUIStyle>(args[4])))
                    )
                );


            GUIConstructor.SetProperty(
                "Toolbar",
                Bridge.CreateFunction(
                    "Toolbar",
                    (args) => JavaScriptValue.FromInt32(UnityEngine.GUI.Toolbar(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToInt32(), Bridge.GetExternal <UnityEngine.GUIContent[]>(args[3]), Bridge.GetExternal <UnityEngine.GUIStyle>(args[4]), Bridge.GetExternal <UnityEngine.GUI.ToolbarButtonSize>(args[5])))
                    )
                );


            GUIConstructor.SetProperty(
                "SelectionGrid",
                Bridge.CreateFunction(
                    "SelectionGrid",
                    (args) => JavaScriptValue.FromInt32(UnityEngine.GUI.SelectionGrid(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToInt32(), Bridge.GetExternal <System.String[]>(args[3]), args[4].ToInt32()))
                    )
                );


            GUIConstructor.SetProperty(
                "SelectionGrid",
                Bridge.CreateFunction(
                    "SelectionGrid",
                    (args) => JavaScriptValue.FromInt32(UnityEngine.GUI.SelectionGrid(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToInt32(), Bridge.GetExternal <UnityEngine.Texture[]>(args[3]), args[4].ToInt32()))
                    )
                );


            GUIConstructor.SetProperty(
                "SelectionGrid",
                Bridge.CreateFunction(
                    "SelectionGrid",
                    (args) => JavaScriptValue.FromInt32(UnityEngine.GUI.SelectionGrid(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToInt32(), Bridge.GetExternal <UnityEngine.GUIContent[]>(args[3]), args[4].ToInt32()))
                    )
                );


            GUIConstructor.SetProperty(
                "SelectionGrid",
                Bridge.CreateFunction(
                    "SelectionGrid",
                    (args) => JavaScriptValue.FromInt32(UnityEngine.GUI.SelectionGrid(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToInt32(), Bridge.GetExternal <System.String[]>(args[3]), args[4].ToInt32(), Bridge.GetExternal <UnityEngine.GUIStyle>(args[5])))
                    )
                );


            GUIConstructor.SetProperty(
                "SelectionGrid",
                Bridge.CreateFunction(
                    "SelectionGrid",
                    (args) => JavaScriptValue.FromInt32(UnityEngine.GUI.SelectionGrid(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToInt32(), Bridge.GetExternal <UnityEngine.Texture[]>(args[3]), args[4].ToInt32(), Bridge.GetExternal <UnityEngine.GUIStyle>(args[5])))
                    )
                );


            GUIConstructor.SetProperty(
                "SelectionGrid",
                Bridge.CreateFunction(
                    "SelectionGrid",
                    (args) => JavaScriptValue.FromInt32(UnityEngine.GUI.SelectionGrid(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToInt32(), Bridge.GetExternal <UnityEngine.GUIContent[]>(args[3]), args[4].ToInt32(), Bridge.GetExternal <UnityEngine.GUIStyle>(args[5])))
                    )
                );


            GUIConstructor.SetProperty(
                "HorizontalSlider",
                Bridge.CreateFunction(
                    "HorizontalSlider",
                    (args) => JavaScriptValue.FromDouble(UnityEngine.GUI.HorizontalSlider(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, (float)args[2].ToDouble(), (float)args[3].ToDouble(), (float)args[4].ToDouble()))
                    )
                );


            GUIConstructor.SetProperty(
                "HorizontalSlider",
                Bridge.CreateFunction(
                    "HorizontalSlider",
                    (args) => JavaScriptValue.FromDouble(UnityEngine.GUI.HorizontalSlider(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, (float)args[2].ToDouble(), (float)args[3].ToDouble(), (float)args[4].ToDouble(), Bridge.GetExternal <UnityEngine.GUIStyle>(args[5]), Bridge.GetExternal <UnityEngine.GUIStyle>(args[6])))
                    )
                );


            GUIConstructor.SetProperty(
                "VerticalSlider",
                Bridge.CreateFunction(
                    "VerticalSlider",
                    (args) => JavaScriptValue.FromDouble(UnityEngine.GUI.VerticalSlider(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, (float)args[2].ToDouble(), (float)args[3].ToDouble(), (float)args[4].ToDouble()))
                    )
                );


            GUIConstructor.SetProperty(
                "VerticalSlider",
                Bridge.CreateFunction(
                    "VerticalSlider",
                    (args) => JavaScriptValue.FromDouble(UnityEngine.GUI.VerticalSlider(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, (float)args[2].ToDouble(), (float)args[3].ToDouble(), (float)args[4].ToDouble(), Bridge.GetExternal <UnityEngine.GUIStyle>(args[5]), Bridge.GetExternal <UnityEngine.GUIStyle>(args[6])))
                    )
                );


            GUIConstructor.SetProperty(
                "Slider",
                Bridge.CreateFunction(
                    "Slider",
                    (args) => JavaScriptValue.FromDouble(UnityEngine.GUI.Slider(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, (float)args[2].ToDouble(), (float)args[3].ToDouble(), (float)args[4].ToDouble(), (float)args[5].ToDouble(), Bridge.GetExternal <UnityEngine.GUIStyle>(args[6]), Bridge.GetExternal <UnityEngine.GUIStyle>(args[7]), args[8].ToBoolean(), args[9].ToInt32()))
                    )
                );


            GUIConstructor.SetProperty(
                "HorizontalScrollbar",
                Bridge.CreateFunction(
                    "HorizontalScrollbar",
                    (args) => JavaScriptValue.FromDouble(UnityEngine.GUI.HorizontalScrollbar(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, (float)args[2].ToDouble(), (float)args[3].ToDouble(), (float)args[4].ToDouble(), (float)args[5].ToDouble()))
                    )
                );


            GUIConstructor.SetProperty(
                "HorizontalScrollbar",
                Bridge.CreateFunction(
                    "HorizontalScrollbar",
                    (args) => JavaScriptValue.FromDouble(UnityEngine.GUI.HorizontalScrollbar(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, (float)args[2].ToDouble(), (float)args[3].ToDouble(), (float)args[4].ToDouble(), (float)args[5].ToDouble(), Bridge.GetExternal <UnityEngine.GUIStyle>(args[6])))
                    )
                );


            GUIConstructor.SetProperty(
                "VerticalScrollbar",
                Bridge.CreateFunction(
                    "VerticalScrollbar",
                    (args) => JavaScriptValue.FromDouble(UnityEngine.GUI.VerticalScrollbar(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, (float)args[2].ToDouble(), (float)args[3].ToDouble(), (float)args[4].ToDouble(), (float)args[5].ToDouble()))
                    )
                );


            GUIConstructor.SetProperty(
                "VerticalScrollbar",
                Bridge.CreateFunction(
                    "VerticalScrollbar",
                    (args) => JavaScriptValue.FromDouble(UnityEngine.GUI.VerticalScrollbar(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, (float)args[2].ToDouble(), (float)args[3].ToDouble(), (float)args[4].ToDouble(), (float)args[5].ToDouble(), Bridge.GetExternal <UnityEngine.GUIStyle>(args[6])))
                    )
                );


            GUIConstructor.SetProperty(
                "BeginClip",
                Bridge.CreateFunction(
                    "BeginClip",
                    (args) => UnityEngine.GUI.BeginClip(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[2]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[3]).wrapped, args[4].ToBoolean())
                    )
                );


            GUIConstructor.SetProperty(
                "BeginGroup",
                Bridge.CreateFunction(
                    "BeginGroup",
                    (args) => UnityEngine.GUI.BeginGroup(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped)
                    )
                );


            GUIConstructor.SetProperty(
                "BeginGroup",
                Bridge.CreateFunction(
                    "BeginGroup",
                    (args) => UnityEngine.GUI.BeginGroup(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToString())
                    )
                );


            GUIConstructor.SetProperty(
                "BeginGroup",
                Bridge.CreateFunction(
                    "BeginGroup",
                    (args) => UnityEngine.GUI.BeginGroup(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Texture>(args[2]))
                    )
                );


            GUIConstructor.SetProperty(
                "BeginGroup",
                Bridge.CreateFunction(
                    "BeginGroup",
                    (args) => UnityEngine.GUI.BeginGroup(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.GUIContent>(args[2]))
                    )
                );


            GUIConstructor.SetProperty(
                "BeginGroup",
                Bridge.CreateFunction(
                    "BeginGroup",
                    (args) => UnityEngine.GUI.BeginGroup(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.GUIStyle>(args[2]))
                    )
                );


            GUIConstructor.SetProperty(
                "BeginGroup",
                Bridge.CreateFunction(
                    "BeginGroup",
                    (args) => UnityEngine.GUI.BeginGroup(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, args[2].ToString(), Bridge.GetExternal <UnityEngine.GUIStyle>(args[3]))
                    )
                );


            GUIConstructor.SetProperty(
                "BeginGroup",
                Bridge.CreateFunction(
                    "BeginGroup",
                    (args) => UnityEngine.GUI.BeginGroup(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Texture>(args[2]), Bridge.GetExternal <UnityEngine.GUIStyle>(args[3]))
                    )
                );


            GUIConstructor.SetProperty(
                "BeginGroup",
                Bridge.CreateFunction(
                    "BeginGroup",
                    (args) => UnityEngine.GUI.BeginGroup(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.GUIContent>(args[2]), Bridge.GetExternal <UnityEngine.GUIStyle>(args[3]))
                    )
                );


            GUIConstructor.SetProperty(
                "EndGroup",
                Bridge.CreateFunction(
                    "EndGroup",
                    (args) => UnityEngine.GUI.EndGroup()
                    )
                );


            GUIConstructor.SetProperty(
                "BeginClip",
                Bridge.CreateFunction(
                    "BeginClip",
                    (args) => UnityEngine.GUI.BeginClip(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped)
                    )
                );


            GUIConstructor.SetProperty(
                "EndClip",
                Bridge.CreateFunction(
                    "EndClip",
                    (args) => UnityEngine.GUI.EndClip()
                    )
                );


            GUIConstructor.SetProperty(
                "BeginScrollView",
                Bridge.CreateFunction(
                    "BeginScrollView",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.GUI.BeginScrollView(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[2]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Rect>(args[3]).wrapped))
                    )
                );


            GUIConstructor.SetProperty(
                "BeginScrollView",
                Bridge.CreateFunction(
                    "BeginScrollView",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.GUI.BeginScrollView(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[2]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Rect>(args[3]).wrapped, args[4].ToBoolean(), args[5].ToBoolean()))
                    )
                );


            GUIConstructor.SetProperty(
                "BeginScrollView",
                Bridge.CreateFunction(
                    "BeginScrollView",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.GUI.BeginScrollView(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[2]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Rect>(args[3]).wrapped, Bridge.GetExternal <UnityEngine.GUIStyle>(args[4]), Bridge.GetExternal <UnityEngine.GUIStyle>(args[5])))
                    )
                );


            GUIConstructor.SetProperty(
                "BeginScrollView",
                Bridge.CreateFunction(
                    "BeginScrollView",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.GUI.BeginScrollView(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[2]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Rect>(args[3]).wrapped, args[4].ToBoolean(), args[5].ToBoolean(), Bridge.GetExternal <UnityEngine.GUIStyle>(args[6]), Bridge.GetExternal <UnityEngine.GUIStyle>(args[7])))
                    )
                );


            GUIConstructor.SetProperty(
                "EndScrollView",
                Bridge.CreateFunction(
                    "EndScrollView",
                    (args) => UnityEngine.GUI.EndScrollView()
                    )
                );


            GUIConstructor.SetProperty(
                "EndScrollView",
                Bridge.CreateFunction(
                    "EndScrollView",
                    (args) => UnityEngine.GUI.EndScrollView(args[1].ToBoolean())
                    )
                );


            GUIConstructor.SetProperty(
                "ScrollTo",
                Bridge.CreateFunction(
                    "ScrollTo",
                    (args) => UnityEngine.GUI.ScrollTo(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped)
                    )
                );


            GUIConstructor.SetProperty(
                "ScrollTowards",
                Bridge.CreateFunction(
                    "ScrollTowards",
                    (args) => JavaScriptValue.FromBoolean(UnityEngine.GUI.ScrollTowards(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, (float)args[2].ToDouble()))
                    )
                );


            GUIConstructor.SetProperty(
                "Window",
                Bridge.CreateFunction(
                    "Window",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.GUI.Window(args[1].ToInt32(), Bridge.GetBoxedExternal <UnityEngine.Rect>(args[2]).wrapped, Bridge.GetExternal <UnityEngine.GUI.WindowFunction>(args[3]), args[4].ToString()))
                    )
                );


            GUIConstructor.SetProperty(
                "Window",
                Bridge.CreateFunction(
                    "Window",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.GUI.Window(args[1].ToInt32(), Bridge.GetBoxedExternal <UnityEngine.Rect>(args[2]).wrapped, Bridge.GetExternal <UnityEngine.GUI.WindowFunction>(args[3]), Bridge.GetExternal <UnityEngine.Texture>(args[4])))
                    )
                );


            GUIConstructor.SetProperty(
                "Window",
                Bridge.CreateFunction(
                    "Window",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.GUI.Window(args[1].ToInt32(), Bridge.GetBoxedExternal <UnityEngine.Rect>(args[2]).wrapped, Bridge.GetExternal <UnityEngine.GUI.WindowFunction>(args[3]), Bridge.GetExternal <UnityEngine.GUIContent>(args[4])))
                    )
                );


            GUIConstructor.SetProperty(
                "Window",
                Bridge.CreateFunction(
                    "Window",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.GUI.Window(args[1].ToInt32(), Bridge.GetBoxedExternal <UnityEngine.Rect>(args[2]).wrapped, Bridge.GetExternal <UnityEngine.GUI.WindowFunction>(args[3]), args[4].ToString(), Bridge.GetExternal <UnityEngine.GUIStyle>(args[5])))
                    )
                );


            GUIConstructor.SetProperty(
                "Window",
                Bridge.CreateFunction(
                    "Window",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.GUI.Window(args[1].ToInt32(), Bridge.GetBoxedExternal <UnityEngine.Rect>(args[2]).wrapped, Bridge.GetExternal <UnityEngine.GUI.WindowFunction>(args[3]), Bridge.GetExternal <UnityEngine.Texture>(args[4]), Bridge.GetExternal <UnityEngine.GUIStyle>(args[5])))
                    )
                );


            GUIConstructor.SetProperty(
                "Window",
                Bridge.CreateFunction(
                    "Window",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.GUI.Window(args[1].ToInt32(), Bridge.GetBoxedExternal <UnityEngine.Rect>(args[2]).wrapped, Bridge.GetExternal <UnityEngine.GUI.WindowFunction>(args[3]), Bridge.GetExternal <UnityEngine.GUIContent>(args[4]), Bridge.GetExternal <UnityEngine.GUIStyle>(args[5])))
                    )
                );


            GUIConstructor.SetProperty(
                "ModalWindow",
                Bridge.CreateFunction(
                    "ModalWindow",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.GUI.ModalWindow(args[1].ToInt32(), Bridge.GetBoxedExternal <UnityEngine.Rect>(args[2]).wrapped, Bridge.GetExternal <UnityEngine.GUI.WindowFunction>(args[3]), args[4].ToString()))
                    )
                );


            GUIConstructor.SetProperty(
                "ModalWindow",
                Bridge.CreateFunction(
                    "ModalWindow",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.GUI.ModalWindow(args[1].ToInt32(), Bridge.GetBoxedExternal <UnityEngine.Rect>(args[2]).wrapped, Bridge.GetExternal <UnityEngine.GUI.WindowFunction>(args[3]), Bridge.GetExternal <UnityEngine.Texture>(args[4])))
                    )
                );


            GUIConstructor.SetProperty(
                "ModalWindow",
                Bridge.CreateFunction(
                    "ModalWindow",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.GUI.ModalWindow(args[1].ToInt32(), Bridge.GetBoxedExternal <UnityEngine.Rect>(args[2]).wrapped, Bridge.GetExternal <UnityEngine.GUI.WindowFunction>(args[3]), Bridge.GetExternal <UnityEngine.GUIContent>(args[4])))
                    )
                );


            GUIConstructor.SetProperty(
                "ModalWindow",
                Bridge.CreateFunction(
                    "ModalWindow",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.GUI.ModalWindow(args[1].ToInt32(), Bridge.GetBoxedExternal <UnityEngine.Rect>(args[2]).wrapped, Bridge.GetExternal <UnityEngine.GUI.WindowFunction>(args[3]), args[4].ToString(), Bridge.GetExternal <UnityEngine.GUIStyle>(args[5])))
                    )
                );


            GUIConstructor.SetProperty(
                "ModalWindow",
                Bridge.CreateFunction(
                    "ModalWindow",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.GUI.ModalWindow(args[1].ToInt32(), Bridge.GetBoxedExternal <UnityEngine.Rect>(args[2]).wrapped, Bridge.GetExternal <UnityEngine.GUI.WindowFunction>(args[3]), Bridge.GetExternal <UnityEngine.Texture>(args[4]), Bridge.GetExternal <UnityEngine.GUIStyle>(args[5])))
                    )
                );


            GUIConstructor.SetProperty(
                "ModalWindow",
                Bridge.CreateFunction(
                    "ModalWindow",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.GUI.ModalWindow(args[1].ToInt32(), Bridge.GetBoxedExternal <UnityEngine.Rect>(args[2]).wrapped, Bridge.GetExternal <UnityEngine.GUI.WindowFunction>(args[3]), Bridge.GetExternal <UnityEngine.GUIContent>(args[4]), Bridge.GetExternal <UnityEngine.GUIStyle>(args[5])))
                    )
                );


            GUIConstructor.SetProperty(
                "DragWindow",
                Bridge.CreateFunction(
                    "DragWindow",
                    (args) => UnityEngine.GUI.DragWindow()
                    )
                );


            // Instance Fields


            // Instance Property Accessors


            // Instance Methods
        }
Пример #30
0
        public static void Register(JavaScriptContext context)
        {
            JavaScriptValue Vector3Prototype;
            JavaScriptValue Vector3Constructor = Bridge.CreateConstructor(
                typeof(UnityEngine.Vector3),
                (args) => {
                if (args.Length == 1)
                {
                    return(Bridge.CreateExternalWithPrototype(new UnityEngine.Vector3()));
                }

                return(Bridge.CreateExternalWithPrototype(
                           new UnityEngine.Vector3(
                               (float)args[1].ToDouble(),
                               (float)args[2].ToDouble(),
                               (float)args[3].ToDouble()
                               )
                           ));
            },
                out Vector3Prototype
                );

            JavaScriptValue
            .GlobalObject
            .GetProperty("UnityEngine")
            .SetProperty("Vector3", Vector3Constructor);


            // Static Fields

            Vector3Constructor.SetProperty(
                "kEpsilon",
                JavaScriptValue.FromDouble(UnityEngine.Vector3.kEpsilon)
                );


            Vector3Constructor.SetProperty(
                "kEpsilonNormalSqrt",
                JavaScriptValue.FromDouble(UnityEngine.Vector3.kEpsilonNormalSqrt)
                );


            // Static Property Accessors

            Bridge.DefineGetter(
                Vector3Constructor,
                "zero",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector3.zero)
                );


            Bridge.DefineGetter(
                Vector3Constructor,
                "one",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector3.one)
                );


            Bridge.DefineGetter(
                Vector3Constructor,
                "forward",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector3.forward)
                );


            Bridge.DefineGetter(
                Vector3Constructor,
                "back",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector3.back)
                );


            Bridge.DefineGetter(
                Vector3Constructor,
                "up",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector3.up)
                );


            Bridge.DefineGetter(
                Vector3Constructor,
                "down",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector3.down)
                );


            Bridge.DefineGetter(
                Vector3Constructor,
                "left",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector3.left)
                );


            Bridge.DefineGetter(
                Vector3Constructor,
                "right",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector3.right)
                );


            Bridge.DefineGetter(
                Vector3Constructor,
                "positiveInfinity",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector3.positiveInfinity)
                );


            Bridge.DefineGetter(
                Vector3Constructor,
                "negativeInfinity",
                (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector3.negativeInfinity)
                );


            // Static Methods

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


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


            /*
             * Vector3 OrthoNormalize
             * parameter normal is ref
             */


            /*
             * Vector3 OrthoNormalize
             * parameter normal is ref
             */


            Vector3Constructor.SetProperty(
                "RotateTowards",
                Bridge.CreateFunction(
                    "RotateTowards",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector3.RotateTowards(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[2]).wrapped, (float)args[3].ToDouble(), (float)args[4].ToDouble()))
                    )
                );


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


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


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


            /*
             * Vector3 SmoothDamp
             * parameter currentVelocity is ref
             */


            /*
             * Vector3 SmoothDamp
             * parameter currentVelocity is ref
             */


            /*
             * Vector3 SmoothDamp
             * parameter currentVelocity is ref
             */


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


            Vector3Constructor.SetProperty(
                "Cross",
                Bridge.CreateFunction(
                    "Cross",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector3.Cross(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[2]).wrapped))
                    )
                );


            Vector3Constructor.SetProperty(
                "Reflect",
                Bridge.CreateFunction(
                    "Reflect",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector3.Reflect(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[2]).wrapped))
                    )
                );


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


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


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


            Vector3Constructor.SetProperty(
                "ProjectOnPlane",
                Bridge.CreateFunction(
                    "ProjectOnPlane",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector3.ProjectOnPlane(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[2]).wrapped))
                    )
                );


            Vector3Constructor.SetProperty(
                "Angle",
                Bridge.CreateFunction(
                    "Angle",
                    (args) => JavaScriptValue.FromDouble(UnityEngine.Vector3.Angle(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[2]).wrapped))
                    )
                );


            Vector3Constructor.SetProperty(
                "SignedAngle",
                Bridge.CreateFunction(
                    "SignedAngle",
                    (args) => JavaScriptValue.FromDouble(UnityEngine.Vector3.SignedAngle(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[2]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[3]).wrapped))
                    )
                );


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


            Vector3Constructor.SetProperty(
                "ClampMagnitude",
                Bridge.CreateFunction(
                    "ClampMagnitude",
                    (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector3.ClampMagnitude(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, (float)args[2].ToDouble()))
                    )
                );


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


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


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


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


            // Instance Fields

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


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


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


            // Instance Property Accessors

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


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


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


            // Instance Methods

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


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


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


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


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


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


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


            Vector3Prototype.SetProperty(
                "add",
                Bridge.CreateFunction(
                    "add",
                    Bridge.WithBoxedExternal <UnityEngine.Vector3>((o, args) => {
                return(Bridge.CreateExternalWithPrototype(o.wrapped + Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped));
            })
                    )
                );

            Vector3Prototype.SetProperty(
                "neg",
                Bridge.CreateFunction(
                    "neg",
                    Bridge.WithBoxedExternal <UnityEngine.Vector3>((o, args) => {
                return(Bridge.CreateExternalWithPrototype(-o.wrapped));
            })
                    )
                );

            Vector3Prototype.SetProperty(
                "sub",
                Bridge.CreateFunction(
                    "sub",
                    Bridge.WithBoxedExternal <UnityEngine.Vector3>((o, args) => {
                return(Bridge.CreateExternalWithPrototype(o.wrapped - Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped));
            })
                    )
                );

            Vector3Prototype.SetProperty(
                "mul",
                Bridge.CreateFunction(
                    "mul",
                    Bridge.WithBoxedExternal <UnityEngine.Vector3>((o, args) => {
                return(Bridge.CreateExternalWithPrototype(o.wrapped * (float)args[1].ToDouble()));
            })
                    )
                );

            Vector3Prototype.SetProperty(
                "div",
                Bridge.CreateFunction(
                    "div",
                    Bridge.WithBoxedExternal <UnityEngine.Vector3>((o, args) => {
                return(Bridge.CreateExternalWithPrototype(o.wrapped / (float)args[1].ToDouble()));
            })
                    )
                );
        }