private static JavaScriptValue ShouldDeprioritizeSubtree( JavaScriptValue callee, bool isconstructcall, JavaScriptValue[] arguments, ushort argumentcount, IntPtr callbackdata) { if (!arguments.ValidateWithType(1, nameof(ShouldDeprioritizeSubtree), JavaScriptValueType.String)) { return(JavaScriptValue.Undefined); } if (!arguments.ValidateWithType(2, nameof(ShouldDeprioritizeSubtree), JavaScriptValueType.Object)) { return(JavaScriptValue.Undefined); } try { var type = arguments[1].ToString(); var props = ComponentMapper.CreateProps(type, arguments[2]); var result = ShouldDeprioritizeSubtree(type, props); return(JavaScriptValue.FromBoolean(result)); } catch (Exception ex) { Debug.LogError(ex); return(JavaScriptValue.Undefined); } }
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); }
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); } }
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)); } return(JavaScriptValue.Undefined); }
private static JavaScriptValue CommitUpdate( JavaScriptValue callee, bool isconstructcall, JavaScriptValue[] arguments, ushort argumentcount, IntPtr callbackdata) { if (!arguments.ValidateWithExternalData <VisualElement>(1, nameof(CommitUpdate))) { return(JavaScriptValue.Undefined); } if (!arguments.ValidateWithExternalData <IComponentProps>(2, nameof(CommitUpdate))) { return(JavaScriptValue.Undefined); } if (!arguments.ValidateWithType(3, nameof(CommitUpdate), JavaScriptValueType.String)) { return(JavaScriptValue.Undefined); } if (!arguments.ValidateWithType(4, nameof(CommitUpdate), JavaScriptValueType.Object)) { return(JavaScriptValue.Undefined); } if (!arguments.ValidateWithType(5, nameof(CommitUpdate), JavaScriptValueType.Object)) { return(JavaScriptValue.Undefined); } try { var instance = arguments[1].ObjectFromJavaScriptValue <VisualElement>(); var type = arguments[3].ToString(); var updatePayload = arguments[2].ObjectFromJavaScriptValue <IComponentProps>(); var oldProps = ComponentMapper.CreateProps(type, arguments[4]); var newProps = ComponentMapper.CreateProps(type, arguments[5]); var result = CommitUpdate(instance, updatePayload, type, oldProps, newProps); return(JavaScriptValue.FromBoolean(result)); } catch (Exception ex) { Debug.LogError(ex); return(JavaScriptValue.Undefined); } }
public static void Register(JavaScriptContext context) { JavaScriptValue BehaviourPrototype; JavaScriptValue BehaviourConstructor = Bridge.CreateConstructor( typeof(UnityEngine.Behaviour), (args) => { throw new System.NotImplementedException(); }, out BehaviourPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .SetProperty("Behaviour", BehaviourConstructor); // Static Fields // Static Property Accessors // Static Methods // Instance Fields // Instance Property Accessors Bridge.DefineGetterSetter( BehaviourPrototype, "enabled", Bridge.WithExternal <UnityEngine.Behaviour>((o, args) => JavaScriptValue.FromBoolean(o.enabled)), Bridge.WithExternal <UnityEngine.Behaviour>((o, args) => { o.enabled = args[1].ToBoolean(); }) ); Bridge.DefineGetter( BehaviourPrototype, "isActiveAndEnabled", Bridge.WithExternal <UnityEngine.Behaviour>((o, args) => JavaScriptValue.FromBoolean(o.isActiveAndEnabled)) ); // Instance Methods }
static JavaScriptValue fun_log(JavaScriptValue callee, bool isConstructCall, JavaScriptValue[] arguments, ushort argumentCount, IntPtr callbackData) { try { if (argumentCount > 0) { var vals = new string[argumentCount - 1]; for (uint i = 1; i < argumentCount; i++) { vals[i - 1] = arguments[i].ConvertToString().ToString(); } string scope_name = "_", key = "", text = ""; switch (vals.Length) { case 1: key = DateTime.Now.ToString("yyMMdd-HHmmss-fff"); text = vals[0]; break; case 2: key = DateTime.Now.ToString("yyMMdd-HHmmss-fff") + "." + vals[0]; text = vals[1]; break; default: scope_name = vals[0]; key = DateTime.Now.ToString("yyMMdd-HHmmss-fff") + "." + vals[1]; text = string.Join(Environment.NewLine + Environment.NewLine, vals.Where((x, i) => i > 1).ToArray()); break; } m_log.write(scope_name, key, text); return(JavaScriptValue.FromBoolean(true)); } } catch { } return(JavaScriptValue.FromBoolean(false)); }
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); }
/// <summary> /// Creates a <see cref="JavaScriptValue"/> representing the bool host type. /// </summary> /// <remarks>This call requires an active context.</remarks> public JavaScriptValue ToJsBoolean(object obj, Type type) { return(JavaScriptValue.FromBoolean((bool)obj)); }
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())); }) ) ); }
public JavaScriptValue CreateQuery(string[] components, JavaScriptValue callback) { Array.Sort(components, StringComparer.InvariantCulture); var key = string.Join("_", components); if (!queryRefs.ContainsKey(key)) { var componentTypes = new ComponentType[components.Length]; var offsetMap = new Dictionary <string, int>(); //First slot is designated for entity reference offsetMap.Add("Entity", 0); var offset = UnsafeUtility.SizeOf <Entity>(); for (var i = 0; i < components.Length; i++) { var factory = JSTypeFactories.GetFactory(components[i]); componentTypes[i] = factory.ReadComponentType; offsetMap.Add(components[i], offset); offset += factory.ComponentSize; } var q = GetEntityQuery(componentTypes); callback.AddRef(); queryRefs.Add(key, new QueryData { HasData = false, Query = q, Components = components, OffsetMap = offsetMap, SlotSize = offset, OnChangeCallback = callback, ComponentTypes = componentTypes }); } var getSizeFunction = JavaScriptValue.CreateFunction("getSize", (callee, call, arguments, count, data) => { var currentQueryData = arguments[0].ObjectFromJavaScriptValue <QueryData>(); return(JavaScriptValue.FromInt32(currentQueryData.Size)); }); var getVersionFunction = JavaScriptValue.CreateFunction("getVersion", (callee, call, arguments, count, data) => { var currentQueryData = arguments[0].ObjectFromJavaScriptValue <QueryData>(); unsafe { var ptr = (int *)currentQueryData.DataPtr; return(JavaScriptValue.FromInt32(*ptr)); } }); var getHasDataFunction = JavaScriptValue.CreateFunction("getHasData", (callee, call, arguments, count, data) => { var currentQueryData = arguments[0].ObjectFromJavaScriptValue <QueryData>(); return(JavaScriptValue.FromBoolean(currentQueryData.HasData)); }); var getElementAtFunction = JavaScriptValue.CreateFunction("getElementAt", (callee, call, arguments, count, data) => { var currentQueryData = arguments[0].ObjectFromJavaScriptValue <QueryData>(); if (arguments.Length < 3 || arguments[1].ValueType != JavaScriptValueType.String || arguments[2].ValueType != JavaScriptValueType.Number || currentQueryData == null || currentQueryData.IsDisposed || !currentQueryData.HasData) { return(JavaScriptValue.Null); } var slot = arguments[1].ToString(); if (!currentQueryData.OffsetMap.ContainsKey(slot)) { return(JavaScriptValue.Null); } if (arguments[2].ToInt32() >= currentQueryData.Size) { return(JavaScriptValue.Null); } var indexInArray = currentQueryData.SlotSize * arguments[2].ToInt32(); var slotIndex = currentQueryData.OffsetMap[slot]; var factory = JSTypeFactories.GetFactory(slot); if (!JavaScriptContext.Current.IsValid) { return(JavaScriptValue.Null); } unsafe { var ptr = (byte *)currentQueryData.DataPtr + HeaderDataOffset + indexInArray + slotIndex; var output = UnsafeUtility.Malloc(factory.ComponentSize, 4, Allocator.Persistent); UnsafeUtility.MemCpy(output, ptr, factory.ComponentSize); return(factory.CreateJsObjectForNative(output, true)); } }); var disposeFunction = JavaScriptValue.CreateFunction("dispose", (callee, call, arguments, count, data) => { var currentQueryData = arguments[0].ObjectFromJavaScriptValue <QueryData>(); currentQueryData.Dispose(); return(JavaScriptValue.Undefined); }); var queryData = queryRefs[key]; var handle = GCHandle.Alloc(queryData); var p = GCHandle.ToIntPtr(handle); var ret = JavaScriptValue.CreateExternalObject(p, Finalizer); ret.SetProperty(JavaScriptPropertyId.FromString("getSize"), getSizeFunction, true); ret.SetProperty(JavaScriptPropertyId.FromString("hasData"), getHasDataFunction, true); ret.SetProperty(JavaScriptPropertyId.FromString("getElementAt"), getElementAtFunction, true); ret.SetProperty(JavaScriptPropertyId.FromString("dispose"), disposeFunction, true); ret.SetProperty(JavaScriptPropertyId.FromString("getVersion"), getVersionFunction, true); return(ret); }
public static void Register(JavaScriptContext context) { JavaScriptValue NetworkManagerPrototype; JavaScriptValue NetworkManagerConstructor = Bridge.CreateConstructor( typeof(UnityEngine.Networking.NetworkManager), (args) => { throw new NotImplementedException(); }, out NetworkManagerPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .GetProperty("Networking") .SetProperty("NetworkManager", NetworkManagerConstructor); // Static Fields Bridge.DefineGetterSetter( NetworkManagerConstructor, "networkSceneName", (args) => JavaScriptValue.FromString(UnityEngine.Networking.NetworkManager.networkSceneName), (args) => { UnityEngine.Networking.NetworkManager.networkSceneName = args[1].ToString(); } ); Bridge.DefineGetterSetter( NetworkManagerConstructor, "singleton", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkManager.singleton), (args) => { UnityEngine.Networking.NetworkManager.singleton = Bridge.GetExternal <UnityEngine.Networking.NetworkManager>(args[1]); } ); // Static Property Accessors // Static Methods NetworkManagerConstructor.SetProperty( "RegisterStartPosition", Bridge.CreateFunction( "RegisterStartPosition", (args) => UnityEngine.Networking.NetworkManager.RegisterStartPosition(Bridge.GetExternal <UnityEngine.Transform>(args[1])) ) ); NetworkManagerConstructor.SetProperty( "UnRegisterStartPosition", Bridge.CreateFunction( "UnRegisterStartPosition", (args) => UnityEngine.Networking.NetworkManager.UnRegisterStartPosition(Bridge.GetExternal <UnityEngine.Transform>(args[1])) ) ); NetworkManagerConstructor.SetProperty( "Shutdown", Bridge.CreateFunction( "Shutdown", (args) => UnityEngine.Networking.NetworkManager.Shutdown() ) ); // Instance Fields Bridge.DefineGetterSetter( NetworkManagerPrototype, "matchName", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromString(o.matchName)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.matchName = args[1].ToString(); }) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "matchSize", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => Bridge.CreateExternalWithPrototype(o.matchSize)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.matchSize = Bridge.GetExternal <System.UInt32>(args[1]); }) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "isNetworkActive", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromBoolean(o.isNetworkActive)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.isNetworkActive = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "client", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => Bridge.CreateExternalWithPrototype(o.client)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.client = Bridge.GetExternal <UnityEngine.Networking.NetworkClient>(args[1]); }) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "matchInfo", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => Bridge.CreateExternalWithPrototype(o.matchInfo)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.matchInfo = Bridge.GetExternal <UnityEngine.Networking.Match.MatchInfo>(args[1]); }) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "matchMaker", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => Bridge.CreateExternalWithPrototype(o.matchMaker)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.matchMaker = Bridge.GetExternal <UnityEngine.Networking.Match.NetworkMatch>(args[1]); }) ); /* * NetworkManager matches * System.Collections.Generic.List`1[UnityEngine.Networking.Match.MatchInfoSnapshot] has generics */ // Instance Property Accessors Bridge.DefineGetterSetter( NetworkManagerPrototype, "networkPort", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromInt32(o.networkPort)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.networkPort = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "serverBindToIP", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromBoolean(o.serverBindToIP)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.serverBindToIP = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "serverBindAddress", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromString(o.serverBindAddress)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.serverBindAddress = args[1].ToString(); }) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "networkAddress", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromString(o.networkAddress)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.networkAddress = args[1].ToString(); }) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "dontDestroyOnLoad", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromBoolean(o.dontDestroyOnLoad)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.dontDestroyOnLoad = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "runInBackground", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromBoolean(o.runInBackground)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.runInBackground = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "scriptCRCCheck", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromBoolean(o.scriptCRCCheck)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.scriptCRCCheck = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "maxDelay", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromDouble(o.maxDelay)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.maxDelay = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "logLevel", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => Bridge.CreateExternalWithPrototype(o.logLevel)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.logLevel = Bridge.GetExternal <UnityEngine.Networking.LogFilter.FilterLevel>(args[1]); }) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "playerPrefab", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => Bridge.CreateExternalWithPrototype(o.playerPrefab)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.playerPrefab = Bridge.GetExternal <UnityEngine.GameObject>(args[1]); }) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "autoCreatePlayer", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromBoolean(o.autoCreatePlayer)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.autoCreatePlayer = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "playerSpawnMethod", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => Bridge.CreateExternalWithPrototype(o.playerSpawnMethod)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.playerSpawnMethod = Bridge.GetExternal <UnityEngine.Networking.PlayerSpawnMethod>(args[1]); }) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "offlineScene", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromString(o.offlineScene)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.offlineScene = args[1].ToString(); }) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "onlineScene", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromString(o.onlineScene)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.onlineScene = args[1].ToString(); }) ); Bridge.DefineGetter( NetworkManagerPrototype, "spawnPrefabs", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => Bridge.CreateExternalWithPrototype(o.spawnPrefabs)) ); Bridge.DefineGetter( NetworkManagerPrototype, "startPositions", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => Bridge.CreateExternalWithPrototype(o.startPositions)) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "customConfig", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromBoolean(o.customConfig)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.customConfig = args[1].ToBoolean(); }) ); Bridge.DefineGetter( NetworkManagerPrototype, "connectionConfig", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => Bridge.CreateExternalWithPrototype(o.connectionConfig)) ); Bridge.DefineGetter( NetworkManagerPrototype, "globalConfig", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => Bridge.CreateExternalWithPrototype(o.globalConfig)) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "maxConnections", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromInt32(o.maxConnections)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.maxConnections = args[1].ToInt32(); }) ); Bridge.DefineGetter( NetworkManagerPrototype, "channels", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => Bridge.CreateExternalWithPrototype(o.channels)) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "secureTunnelEndpoint", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => Bridge.CreateExternalWithPrototype(o.secureTunnelEndpoint)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.secureTunnelEndpoint = Bridge.GetExternal <System.Net.EndPoint>(args[1]); }) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "useWebSockets", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromBoolean(o.useWebSockets)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.useWebSockets = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "useSimulator", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromBoolean(o.useSimulator)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.useSimulator = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "simulatedLatency", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromInt32(o.simulatedLatency)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.simulatedLatency = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "packetLossPercentage", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromDouble(o.packetLossPercentage)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.packetLossPercentage = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "matchHost", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromString(o.matchHost)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.matchHost = args[1].ToString(); }) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "matchPort", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromInt32(o.matchPort)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.matchPort = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( NetworkManagerPrototype, "clientLoadedScene", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromBoolean(o.clientLoadedScene)), WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => { o.clientLoadedScene = args[1].ToBoolean(); }) ); Bridge.DefineGetter( NetworkManagerPrototype, "migrationManager", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => Bridge.CreateExternalWithPrototype(o.migrationManager)) ); Bridge.DefineGetter( NetworkManagerPrototype, "numPlayers", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromInt32(o.numPlayers)) ); // Instance Methods NetworkManagerPrototype.SetProperty( "SetupMigrationManager", Bridge.CreateFunction( "SetupMigrationManager", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.SetupMigrationManager(Bridge.GetExternal <UnityEngine.Networking.NetworkMigrationManager>(args[1]))) ) ); NetworkManagerPrototype.SetProperty( "StartServer", Bridge.CreateFunction( "StartServer", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromBoolean(o.StartServer(Bridge.GetExternal <UnityEngine.Networking.ConnectionConfig>(args[1]), args[2].ToInt32()))) ) ); NetworkManagerPrototype.SetProperty( "StartServer", Bridge.CreateFunction( "StartServer", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromBoolean(o.StartServer())) ) ); NetworkManagerPrototype.SetProperty( "StartServer", Bridge.CreateFunction( "StartServer", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromBoolean(o.StartServer(Bridge.GetExternal <UnityEngine.Networking.Match.MatchInfo>(args[1])))) ) ); NetworkManagerPrototype.SetProperty( "UseExternalClient", Bridge.CreateFunction( "UseExternalClient", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.UseExternalClient(Bridge.GetExternal <UnityEngine.Networking.NetworkClient>(args[1]))) ) ); NetworkManagerPrototype.SetProperty( "StartClient", Bridge.CreateFunction( "StartClient", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => Bridge.CreateExternalWithPrototype(o.StartClient(Bridge.GetExternal <UnityEngine.Networking.Match.MatchInfo>(args[1]), Bridge.GetExternal <UnityEngine.Networking.ConnectionConfig>(args[2]), args[3].ToInt32()))) ) ); NetworkManagerPrototype.SetProperty( "StartClient", Bridge.CreateFunction( "StartClient", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => Bridge.CreateExternalWithPrototype(o.StartClient(Bridge.GetExternal <UnityEngine.Networking.Match.MatchInfo>(args[1])))) ) ); NetworkManagerPrototype.SetProperty( "StartClient", Bridge.CreateFunction( "StartClient", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => Bridge.CreateExternalWithPrototype(o.StartClient())) ) ); NetworkManagerPrototype.SetProperty( "StartClient", Bridge.CreateFunction( "StartClient", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => Bridge.CreateExternalWithPrototype(o.StartClient(Bridge.GetExternal <UnityEngine.Networking.Match.MatchInfo>(args[1]), Bridge.GetExternal <UnityEngine.Networking.ConnectionConfig>(args[2])))) ) ); NetworkManagerPrototype.SetProperty( "StartHost", Bridge.CreateFunction( "StartHost", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => Bridge.CreateExternalWithPrototype(o.StartHost(Bridge.GetExternal <UnityEngine.Networking.ConnectionConfig>(args[1]), args[2].ToInt32()))) ) ); NetworkManagerPrototype.SetProperty( "StartHost", Bridge.CreateFunction( "StartHost", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => Bridge.CreateExternalWithPrototype(o.StartHost(Bridge.GetExternal <UnityEngine.Networking.Match.MatchInfo>(args[1])))) ) ); NetworkManagerPrototype.SetProperty( "StartHost", Bridge.CreateFunction( "StartHost", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => Bridge.CreateExternalWithPrototype(o.StartHost())) ) ); NetworkManagerPrototype.SetProperty( "StopHost", Bridge.CreateFunction( "StopHost", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.StopHost()) ) ); NetworkManagerPrototype.SetProperty( "StopServer", Bridge.CreateFunction( "StopServer", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.StopServer()) ) ); NetworkManagerPrototype.SetProperty( "StopClient", Bridge.CreateFunction( "StopClient", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.StopClient()) ) ); NetworkManagerPrototype.SetProperty( "ServerChangeScene", Bridge.CreateFunction( "ServerChangeScene", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.ServerChangeScene(args[1].ToString())) ) ); NetworkManagerPrototype.SetProperty( "IsClientConnected", Bridge.CreateFunction( "IsClientConnected", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => JavaScriptValue.FromBoolean(o.IsClientConnected())) ) ); NetworkManagerPrototype.SetProperty( "OnServerConnect", Bridge.CreateFunction( "OnServerConnect", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.OnServerConnect(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]))) ) ); NetworkManagerPrototype.SetProperty( "OnServerDisconnect", Bridge.CreateFunction( "OnServerDisconnect", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.OnServerDisconnect(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]))) ) ); NetworkManagerPrototype.SetProperty( "OnServerReady", Bridge.CreateFunction( "OnServerReady", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.OnServerReady(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]))) ) ); NetworkManagerPrototype.SetProperty( "OnServerAddPlayer", Bridge.CreateFunction( "OnServerAddPlayer", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.OnServerAddPlayer(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]), Bridge.GetExternal <System.Int16>(args[2]), Bridge.GetExternal <UnityEngine.Networking.NetworkReader>(args[3]))) ) ); NetworkManagerPrototype.SetProperty( "OnServerAddPlayer", Bridge.CreateFunction( "OnServerAddPlayer", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.OnServerAddPlayer(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]), Bridge.GetExternal <System.Int16>(args[2]))) ) ); NetworkManagerPrototype.SetProperty( "GetStartPosition", Bridge.CreateFunction( "GetStartPosition", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => Bridge.CreateExternalWithPrototype(o.GetStartPosition())) ) ); NetworkManagerPrototype.SetProperty( "OnServerRemovePlayer", Bridge.CreateFunction( "OnServerRemovePlayer", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.OnServerRemovePlayer(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]), Bridge.GetExternal <UnityEngine.Networking.PlayerController>(args[2]))) ) ); NetworkManagerPrototype.SetProperty( "OnServerError", Bridge.CreateFunction( "OnServerError", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.OnServerError(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]), args[2].ToInt32())) ) ); NetworkManagerPrototype.SetProperty( "OnServerSceneChanged", Bridge.CreateFunction( "OnServerSceneChanged", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.OnServerSceneChanged(args[1].ToString())) ) ); NetworkManagerPrototype.SetProperty( "OnClientConnect", Bridge.CreateFunction( "OnClientConnect", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.OnClientConnect(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]))) ) ); NetworkManagerPrototype.SetProperty( "OnClientDisconnect", Bridge.CreateFunction( "OnClientDisconnect", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.OnClientDisconnect(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]))) ) ); NetworkManagerPrototype.SetProperty( "OnClientError", Bridge.CreateFunction( "OnClientError", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.OnClientError(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]), args[2].ToInt32())) ) ); NetworkManagerPrototype.SetProperty( "OnClientNotReady", Bridge.CreateFunction( "OnClientNotReady", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.OnClientNotReady(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]))) ) ); NetworkManagerPrototype.SetProperty( "OnClientSceneChanged", Bridge.CreateFunction( "OnClientSceneChanged", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.OnClientSceneChanged(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]))) ) ); NetworkManagerPrototype.SetProperty( "StartMatchMaker", Bridge.CreateFunction( "StartMatchMaker", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.StartMatchMaker()) ) ); NetworkManagerPrototype.SetProperty( "StopMatchMaker", Bridge.CreateFunction( "StopMatchMaker", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.StopMatchMaker()) ) ); NetworkManagerPrototype.SetProperty( "SetMatchHost", Bridge.CreateFunction( "SetMatchHost", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.SetMatchHost(args[1].ToString(), args[2].ToInt32(), args[3].ToBoolean())) ) ); NetworkManagerPrototype.SetProperty( "OnStartHost", Bridge.CreateFunction( "OnStartHost", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.OnStartHost()) ) ); NetworkManagerPrototype.SetProperty( "OnStartServer", Bridge.CreateFunction( "OnStartServer", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.OnStartServer()) ) ); NetworkManagerPrototype.SetProperty( "OnStartClient", Bridge.CreateFunction( "OnStartClient", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.OnStartClient(Bridge.GetExternal <UnityEngine.Networking.NetworkClient>(args[1]))) ) ); NetworkManagerPrototype.SetProperty( "OnStopServer", Bridge.CreateFunction( "OnStopServer", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.OnStopServer()) ) ); NetworkManagerPrototype.SetProperty( "OnStopClient", Bridge.CreateFunction( "OnStopClient", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.OnStopClient()) ) ); NetworkManagerPrototype.SetProperty( "OnStopHost", Bridge.CreateFunction( "OnStopHost", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.OnStopHost()) ) ); NetworkManagerPrototype.SetProperty( "OnMatchCreate", Bridge.CreateFunction( "OnMatchCreate", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.OnMatchCreate(args[1].ToBoolean(), args[2].ToString(), Bridge.GetExternal <UnityEngine.Networking.Match.MatchInfo>(args[3]))) ) ); /* * NetworkManager OnMatchList * System.Collections.Generic.List`1[UnityEngine.Networking.Match.MatchInfoSnapshot] has generics */ NetworkManagerPrototype.SetProperty( "OnMatchJoined", Bridge.CreateFunction( "OnMatchJoined", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.OnMatchJoined(args[1].ToBoolean(), args[2].ToString(), Bridge.GetExternal <UnityEngine.Networking.Match.MatchInfo>(args[3]))) ) ); NetworkManagerPrototype.SetProperty( "OnDestroyMatch", Bridge.CreateFunction( "OnDestroyMatch", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.OnDestroyMatch(args[1].ToBoolean(), args[2].ToString())) ) ); NetworkManagerPrototype.SetProperty( "OnDropConnection", Bridge.CreateFunction( "OnDropConnection", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.OnDropConnection(args[1].ToBoolean(), args[2].ToString())) ) ); NetworkManagerPrototype.SetProperty( "OnSetMatchAttributes", Bridge.CreateFunction( "OnSetMatchAttributes", WithExternal <UnityEngine.Networking.NetworkManager>((o, args) => o.OnSetMatchAttributes(args[1].ToBoolean(), args[2].ToString())) ) ); }
public static void Register(JavaScriptContext context) { JavaScriptValue BoundsPrototype; JavaScriptValue BoundsConstructor = Bridge.CreateConstructor( typeof(UnityEngine.Bounds), (args) => { throw new System.NotImplementedException(); }, out BoundsPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .SetProperty("Bounds", BoundsConstructor); // Static Fields // Static Property Accessors // Static Methods // Instance Fields // Instance Property Accessors Bridge.DefineGetterSetter( BoundsPrototype, "center", Bridge.WithBoxedExternal <UnityEngine.Bounds>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.center)), Bridge.WithBoxedExternal <UnityEngine.Bounds>((o, args) => { o.wrapped.center = Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( BoundsPrototype, "size", Bridge.WithBoxedExternal <UnityEngine.Bounds>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.size)), Bridge.WithBoxedExternal <UnityEngine.Bounds>((o, args) => { o.wrapped.size = Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( BoundsPrototype, "extents", Bridge.WithBoxedExternal <UnityEngine.Bounds>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.extents)), Bridge.WithBoxedExternal <UnityEngine.Bounds>((o, args) => { o.wrapped.extents = Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( BoundsPrototype, "min", Bridge.WithBoxedExternal <UnityEngine.Bounds>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.min)), Bridge.WithBoxedExternal <UnityEngine.Bounds>((o, args) => { o.wrapped.min = Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( BoundsPrototype, "max", Bridge.WithBoxedExternal <UnityEngine.Bounds>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.max)), Bridge.WithBoxedExternal <UnityEngine.Bounds>((o, args) => { o.wrapped.max = Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped; }) ); // Instance Methods BoundsPrototype.SetProperty( "GetHashCode", Bridge.CreateFunction( "GetHashCode", Bridge.WithBoxedExternal <UnityEngine.Bounds>((o, args) => JavaScriptValue.FromInt32(o.wrapped.GetHashCode())) ) ); BoundsPrototype.SetProperty( "Equals", Bridge.CreateFunction( "Equals", Bridge.WithBoxedExternal <UnityEngine.Bounds>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.Equals(Bridge.GetExternal <System.Object>(args[1])))) ) ); BoundsPrototype.SetProperty( "Equals", Bridge.CreateFunction( "Equals", Bridge.WithBoxedExternal <UnityEngine.Bounds>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.Equals(Bridge.GetBoxedExternal <UnityEngine.Bounds>(args[1]).wrapped))) ) ); BoundsPrototype.SetProperty( "SetMinMax", Bridge.CreateFunction( "SetMinMax", Bridge.WithBoxedExternal <UnityEngine.Bounds>((o, args) => o.wrapped.SetMinMax(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[2]).wrapped)) ) ); BoundsPrototype.SetProperty( "Encapsulate", Bridge.CreateFunction( "Encapsulate", Bridge.WithBoxedExternal <UnityEngine.Bounds>((o, args) => o.wrapped.Encapsulate(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped)) ) ); BoundsPrototype.SetProperty( "Encapsulate", Bridge.CreateFunction( "Encapsulate", Bridge.WithBoxedExternal <UnityEngine.Bounds>((o, args) => o.wrapped.Encapsulate(Bridge.GetBoxedExternal <UnityEngine.Bounds>(args[1]).wrapped)) ) ); BoundsPrototype.SetProperty( "Expand", Bridge.CreateFunction( "Expand", Bridge.WithBoxedExternal <UnityEngine.Bounds>((o, args) => o.wrapped.Expand((float)args[1].ToDouble())) ) ); BoundsPrototype.SetProperty( "Expand", Bridge.CreateFunction( "Expand", Bridge.WithBoxedExternal <UnityEngine.Bounds>((o, args) => o.wrapped.Expand(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped)) ) ); BoundsPrototype.SetProperty( "Intersects", Bridge.CreateFunction( "Intersects", Bridge.WithBoxedExternal <UnityEngine.Bounds>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.Intersects(Bridge.GetBoxedExternal <UnityEngine.Bounds>(args[1]).wrapped))) ) ); BoundsPrototype.SetProperty( "IntersectRay", Bridge.CreateFunction( "IntersectRay", Bridge.WithBoxedExternal <UnityEngine.Bounds>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.IntersectRay(Bridge.GetBoxedExternal <UnityEngine.Ray>(args[1]).wrapped))) ) ); /* * Bounds IntersectRay * parameter distance is out */ BoundsPrototype.SetProperty( "toString", Bridge.CreateFunction( "ToString", Bridge.WithBoxedExternal <UnityEngine.Bounds>((o, args) => { if (args.Length == 1) { return(JavaScriptValue.FromString(o.wrapped.ToString())); } else { return(JavaScriptValue.FromString(o.wrapped.ToString(args[1].ToString()))); } }) ) ); BoundsPrototype.SetProperty( "Contains", Bridge.CreateFunction( "Contains", Bridge.WithBoxedExternal <UnityEngine.Bounds>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.Contains(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))) ) ); BoundsPrototype.SetProperty( "SqrDistance", Bridge.CreateFunction( "SqrDistance", Bridge.WithBoxedExternal <UnityEngine.Bounds>((o, args) => JavaScriptValue.FromDouble(o.wrapped.SqrDistance(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))) ) ); BoundsPrototype.SetProperty( "ClosestPoint", Bridge.CreateFunction( "ClosestPoint", Bridge.WithBoxedExternal <UnityEngine.Bounds>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.ClosestPoint(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))) ) ); }
public static void Register(JavaScriptContext context) { JavaScriptValue NetworkDiscoveryPrototype; JavaScriptValue NetworkDiscoveryConstructor = Bridge.CreateConstructor( typeof(UnityEngine.Networking.NetworkDiscovery), (args) => { throw new NotImplementedException(); }, out NetworkDiscoveryPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .GetProperty("Networking") .SetProperty("NetworkDiscovery", NetworkDiscoveryConstructor); // Static Fields // Static Property Accessors // Static Methods // Instance Fields // Instance Property Accessors Bridge.DefineGetterSetter( NetworkDiscoveryPrototype, "broadcastPort", WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => JavaScriptValue.FromInt32(o.broadcastPort)), WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => { o.broadcastPort = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( NetworkDiscoveryPrototype, "broadcastKey", WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => JavaScriptValue.FromInt32(o.broadcastKey)), WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => { o.broadcastKey = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( NetworkDiscoveryPrototype, "broadcastVersion", WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => JavaScriptValue.FromInt32(o.broadcastVersion)), WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => { o.broadcastVersion = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( NetworkDiscoveryPrototype, "broadcastSubVersion", WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => JavaScriptValue.FromInt32(o.broadcastSubVersion)), WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => { o.broadcastSubVersion = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( NetworkDiscoveryPrototype, "broadcastInterval", WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => JavaScriptValue.FromInt32(o.broadcastInterval)), WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => { o.broadcastInterval = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( NetworkDiscoveryPrototype, "useNetworkManager", WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => JavaScriptValue.FromBoolean(o.useNetworkManager)), WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => { o.useNetworkManager = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( NetworkDiscoveryPrototype, "broadcastData", WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => JavaScriptValue.FromString(o.broadcastData)), WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => { o.broadcastData = args[1].ToString(); }) ); Bridge.DefineGetterSetter( NetworkDiscoveryPrototype, "showGUI", WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => JavaScriptValue.FromBoolean(o.showGUI)), WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => { o.showGUI = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( NetworkDiscoveryPrototype, "offsetX", WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => JavaScriptValue.FromInt32(o.offsetX)), WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => { o.offsetX = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( NetworkDiscoveryPrototype, "offsetY", WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => JavaScriptValue.FromInt32(o.offsetY)), WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => { o.offsetY = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( NetworkDiscoveryPrototype, "hostId", WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => JavaScriptValue.FromInt32(o.hostId)), WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => { o.hostId = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( NetworkDiscoveryPrototype, "running", WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => JavaScriptValue.FromBoolean(o.running)), WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => { o.running = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( NetworkDiscoveryPrototype, "isServer", WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => JavaScriptValue.FromBoolean(o.isServer)), WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => { o.isServer = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( NetworkDiscoveryPrototype, "isClient", WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => JavaScriptValue.FromBoolean(o.isClient)), WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => { o.isClient = args[1].ToBoolean(); }) ); Bridge.DefineGetter( NetworkDiscoveryPrototype, "broadcastsReceived", WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => Bridge.CreateExternalWithPrototype(o.broadcastsReceived)) ); // Instance Methods NetworkDiscoveryPrototype.SetProperty( "Initialize", Bridge.CreateFunction( "Initialize", WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => JavaScriptValue.FromBoolean(o.Initialize())) ) ); NetworkDiscoveryPrototype.SetProperty( "StartAsClient", Bridge.CreateFunction( "StartAsClient", WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => JavaScriptValue.FromBoolean(o.StartAsClient())) ) ); NetworkDiscoveryPrototype.SetProperty( "StartAsServer", Bridge.CreateFunction( "StartAsServer", WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => JavaScriptValue.FromBoolean(o.StartAsServer())) ) ); NetworkDiscoveryPrototype.SetProperty( "StopBroadcast", Bridge.CreateFunction( "StopBroadcast", WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => o.StopBroadcast()) ) ); NetworkDiscoveryPrototype.SetProperty( "OnReceivedBroadcast", Bridge.CreateFunction( "OnReceivedBroadcast", WithExternal <UnityEngine.Networking.NetworkDiscovery>((o, args) => o.OnReceivedBroadcast(args[1].ToString(), args[2].ToString())) ) ); }
public static void Register(JavaScriptContext context) { JavaScriptValue NetworkCRCPrototype; JavaScriptValue NetworkCRCConstructor = Bridge.CreateConstructor( typeof(UnityEngine.Networking.NetworkCRC), (args) => { throw new NotImplementedException(); }, out NetworkCRCPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .GetProperty("Networking") .SetProperty("NetworkCRC", NetworkCRCConstructor); // Static Fields // Static Property Accessors Bridge.DefineGetterSetter( NetworkCRCConstructor, "scriptCRCCheck", (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkCRC.scriptCRCCheck), (args) => { UnityEngine.Networking.NetworkCRC.scriptCRCCheck = args[1].ToBoolean(); } ); // Static Methods NetworkCRCConstructor.SetProperty( "ReinitializeScriptCRCs", Bridge.CreateFunction( "ReinitializeScriptCRCs", (args) => UnityEngine.Networking.NetworkCRC.ReinitializeScriptCRCs(Bridge.GetExternal <System.Reflection.Assembly>(args[1])) ) ); NetworkCRCConstructor.SetProperty( "RegisterBehaviour", Bridge.CreateFunction( "RegisterBehaviour", (args) => UnityEngine.Networking.NetworkCRC.RegisterBehaviour(args[1].ToString(), args[2].ToInt32()) ) ); // Instance Fields // Instance Property Accessors Bridge.DefineGetter( NetworkCRCPrototype, "scripts", WithExternal <UnityEngine.Networking.NetworkCRC>((o, args) => Bridge.CreateExternalWithPrototype(o.scripts)) ); // Instance Methods }
private JavaScriptValue VisitBoolean(JValue token) { return(JavaScriptValue.FromBoolean(token.Value <bool>())); }
public static void Register(JavaScriptContext context) { JavaScriptValue NetworkConnectionPrototype; JavaScriptValue NetworkConnectionConstructor = Bridge.CreateConstructor( typeof(UnityEngine.Networking.NetworkConnection), (args) => { throw new NotImplementedException(); }, out NetworkConnectionPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .GetProperty("Networking") .SetProperty("NetworkConnection", NetworkConnectionConstructor); // Static Fields // Static Property Accessors // Static Methods // Instance Fields Bridge.DefineGetterSetter( NetworkConnectionPrototype, "hostId", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => JavaScriptValue.FromInt32(o.hostId)), WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => { o.hostId = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( NetworkConnectionPrototype, "connectionId", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => JavaScriptValue.FromInt32(o.connectionId)), WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => { o.connectionId = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( NetworkConnectionPrototype, "isReady", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => JavaScriptValue.FromBoolean(o.isReady)), WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => { o.isReady = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( NetworkConnectionPrototype, "address", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => JavaScriptValue.FromString(o.address)), WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => { o.address = args[1].ToString(); }) ); Bridge.DefineGetterSetter( NetworkConnectionPrototype, "lastMessageTime", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => JavaScriptValue.FromDouble(o.lastMessageTime)), WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => { o.lastMessageTime = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( NetworkConnectionPrototype, "logNetworkMessages", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => JavaScriptValue.FromBoolean(o.logNetworkMessages)), WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => { o.logNetworkMessages = args[1].ToBoolean(); }) ); // Instance Property Accessors Bridge.DefineGetter( NetworkConnectionPrototype, "playerControllers", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => Bridge.CreateExternalWithPrototype(o.playerControllers)) ); Bridge.DefineGetter( NetworkConnectionPrototype, "clientOwnedObjects", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => Bridge.CreateExternalWithPrototype(o.clientOwnedObjects)) ); Bridge.DefineGetter( NetworkConnectionPrototype, "isConnected", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => JavaScriptValue.FromBoolean(o.isConnected)) ); Bridge.DefineGetter( NetworkConnectionPrototype, "lastError", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => Bridge.CreateExternalWithPrototype(o.lastError)) // WithExternal<UnityEngine.Networking.NetworkConnection>((o, args) => { o.lastError = Bridge.GetExternal<UnityEngine.Networking.NetworkError>(args[1]); }) ); // Instance Methods NetworkConnectionPrototype.SetProperty( "Initialize", Bridge.CreateFunction( "Initialize", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => o.Initialize(args[1].ToString(), args[2].ToInt32(), args[3].ToInt32(), Bridge.GetExternal <UnityEngine.Networking.HostTopology>(args[4]))) ) ); NetworkConnectionPrototype.SetProperty( "Dispose", Bridge.CreateFunction( "Dispose", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => o.Dispose()) ) ); NetworkConnectionPrototype.SetProperty( "SetChannelOption", Bridge.CreateFunction( "SetChannelOption", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => JavaScriptValue.FromBoolean(o.SetChannelOption(args[1].ToInt32(), Bridge.GetExternal <UnityEngine.Networking.ChannelOption>(args[2]), args[3].ToInt32()))) ) ); NetworkConnectionPrototype.SetProperty( "Disconnect", Bridge.CreateFunction( "Disconnect", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => o.Disconnect()) ) ); NetworkConnectionPrototype.SetProperty( "CheckHandler", Bridge.CreateFunction( "CheckHandler", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => JavaScriptValue.FromBoolean(o.CheckHandler(Bridge.GetExternal <System.Int16>(args[1])))) ) ); NetworkConnectionPrototype.SetProperty( "InvokeHandlerNoData", Bridge.CreateFunction( "InvokeHandlerNoData", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => JavaScriptValue.FromBoolean(o.InvokeHandlerNoData(Bridge.GetExternal <System.Int16>(args[1])))) ) ); NetworkConnectionPrototype.SetProperty( "InvokeHandler", Bridge.CreateFunction( "InvokeHandler", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => JavaScriptValue.FromBoolean(o.InvokeHandler(Bridge.GetExternal <System.Int16>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkReader>(args[2]), args[3].ToInt32()))) ) ); NetworkConnectionPrototype.SetProperty( "InvokeHandler", Bridge.CreateFunction( "InvokeHandler", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => JavaScriptValue.FromBoolean(o.InvokeHandler(Bridge.GetExternal <UnityEngine.Networking.NetworkMessage>(args[1])))) ) ); NetworkConnectionPrototype.SetProperty( "RegisterHandler", Bridge.CreateFunction( "RegisterHandler", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => o.RegisterHandler(Bridge.GetExternal <System.Int16>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkMessageDelegate>(args[2]))) ) ); NetworkConnectionPrototype.SetProperty( "UnregisterHandler", Bridge.CreateFunction( "UnregisterHandler", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => o.UnregisterHandler(Bridge.GetExternal <System.Int16>(args[1]))) ) ); NetworkConnectionPrototype.SetProperty( "FlushChannels", Bridge.CreateFunction( "FlushChannels", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => o.FlushChannels()) ) ); NetworkConnectionPrototype.SetProperty( "SetMaxDelay", Bridge.CreateFunction( "SetMaxDelay", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => o.SetMaxDelay((float)args[1].ToDouble())) ) ); NetworkConnectionPrototype.SetProperty( "Send", Bridge.CreateFunction( "Send", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => JavaScriptValue.FromBoolean(o.Send(Bridge.GetExternal <System.Int16>(args[1]), Bridge.GetExternal <UnityEngine.Networking.MessageBase>(args[2])))) ) ); NetworkConnectionPrototype.SetProperty( "SendUnreliable", Bridge.CreateFunction( "SendUnreliable", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => JavaScriptValue.FromBoolean(o.SendUnreliable(Bridge.GetExternal <System.Int16>(args[1]), Bridge.GetExternal <UnityEngine.Networking.MessageBase>(args[2])))) ) ); NetworkConnectionPrototype.SetProperty( "SendByChannel", Bridge.CreateFunction( "SendByChannel", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => JavaScriptValue.FromBoolean(o.SendByChannel(Bridge.GetExternal <System.Int16>(args[1]), Bridge.GetExternal <UnityEngine.Networking.MessageBase>(args[2]), args[3].ToInt32()))) ) ); NetworkConnectionPrototype.SetProperty( "SendBytes", Bridge.CreateFunction( "SendBytes", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => JavaScriptValue.FromBoolean(o.SendBytes(Bridge.GetExternal <System.Byte[]>(args[1]), args[2].ToInt32(), args[3].ToInt32()))) ) ); NetworkConnectionPrototype.SetProperty( "SendWriter", Bridge.CreateFunction( "SendWriter", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => JavaScriptValue.FromBoolean(o.SendWriter(Bridge.GetExternal <UnityEngine.Networking.NetworkWriter>(args[1]), args[2].ToInt32()))) ) ); NetworkConnectionPrototype.SetProperty( "ResetStats", Bridge.CreateFunction( "ResetStats", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => o.ResetStats()) ) ); /* * NetworkConnection GetStatsOut * parameter numMsgs is out */ /* * NetworkConnection GetStatsIn * parameter numMsgs is out */ NetworkConnectionPrototype.SetProperty( "toString", Bridge.CreateFunction( "ToString", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => JavaScriptValue.FromString(o.ToString())) ) ); NetworkConnectionPrototype.SetProperty( "TransportReceive", Bridge.CreateFunction( "TransportReceive", WithExternal <UnityEngine.Networking.NetworkConnection>((o, args) => o.TransportReceive(Bridge.GetExternal <System.Byte[]>(args[1]), args[2].ToInt32(), args[3].ToInt32())) ) ); /* * NetworkConnection TransportSend * parameter error is out */ }
private void button3_Click(object sender, EventArgs e) { JavaScriptRuntime runtime; JavaScriptContext context; JavaScriptSourceContext currentSourceContext = JavaScriptSourceContext.FromIntPtr(IntPtr.Zero); JavaScriptValue jsValue; string szWelcomMessage; string szWhoamI; JavaScriptValue returnValue; JavaScriptValue myfunc_1; JavaScriptValue myfunc_2; JavaScriptValue myfunc_3; JavaScriptValue myfunc_4; bool bSuccess = false; try { string script = System.IO.File.ReadAllText("C:/Temp/Script/Sample03.js"); runtime = JavaScriptRuntime.Create(); context = runtime.CreateContext(); JavaScriptContext.Current = context; JavaScriptContext.RunScript(script, currentSourceContext++, ""); jsValue = JavaScriptValue.GlobalObject.GetProperty(JavaScriptPropertyId.FromString("szWelcomMessage")); szWelcomMessage = jsValue.ToString(); jsValue = JavaScriptValue.GlobalObject.GetProperty(JavaScriptPropertyId.FromString("szWhoamI")); szWhoamI = jsValue.ToString(); System.Diagnostics.Trace.WriteLine("szWelcomMessage = " + szWelcomMessage); System.Diagnostics.Trace.WriteLine("szWhoamI = " + szWhoamI); // myfunc_1 JavaScriptValue[] args1 = new JavaScriptValue[1] { JavaScriptValue.FromString("self") }; myfunc_1 = JavaScriptValue.GlobalObject.GetProperty(JavaScriptPropertyId.FromString("myfunc_1")); myfunc_1.CallFunction(args1); jsValue = JavaScriptValue.GlobalObject.GetProperty(JavaScriptPropertyId.FromString("szWelcomMessage")); szWelcomMessage = jsValue.ToString(); jsValue = JavaScriptValue.GlobalObject.GetProperty(JavaScriptPropertyId.FromString("szWhoamI")); szWhoamI = jsValue.ToString(); System.Diagnostics.Trace.WriteLine("szWelcomMessage = " + szWelcomMessage); System.Diagnostics.Trace.WriteLine("szWhoamI = " + szWhoamI); // myfunc_2 JavaScriptValue[] args2 = new JavaScriptValue[1] { JavaScriptValue.GlobalObject }; myfunc_2 = JavaScriptValue.GlobalObject.GetProperty(JavaScriptPropertyId.FromString("myfunc_2")); returnValue = myfunc_2.CallFunction(args2); jsValue = JavaScriptValue.GlobalObject.GetProperty(JavaScriptPropertyId.FromString("szWelcomMessage")); szWelcomMessage = jsValue.ToString(); jsValue = JavaScriptValue.GlobalObject.GetProperty(JavaScriptPropertyId.FromString("szWhoamI")); szWhoamI = jsValue.ToString(); System.Diagnostics.Trace.WriteLine("Return Value = " + returnValue.ToString()); System.Diagnostics.Trace.WriteLine("szWelcomMessage = " + szWelcomMessage); System.Diagnostics.Trace.WriteLine("szWhoamI = " + szWhoamI); // myfunc_3 JavaScriptValue[] args3 = new JavaScriptValue[2] { JavaScriptValue.GlobalObject, JavaScriptValue.FromString("myfunc_3") }; myfunc_3 = JavaScriptValue.GlobalObject.GetProperty(JavaScriptPropertyId.FromString("myfunc_3")); returnValue = myfunc_3.CallFunction(args3); jsValue = JavaScriptValue.GlobalObject.GetProperty(JavaScriptPropertyId.FromString("szWelcomMessage")); szWelcomMessage = jsValue.ToString(); jsValue = JavaScriptValue.GlobalObject.GetProperty(JavaScriptPropertyId.FromString("szWhoamI")); szWhoamI = jsValue.ToString(); System.Diagnostics.Trace.WriteLine("Return Value[0] = " + (returnValue.GetIndexedProperty(JavaScriptValue.FromInt32(0))).ToString()); System.Diagnostics.Trace.WriteLine("Return Value[1] = " + (returnValue.GetIndexedProperty(JavaScriptValue.FromInt32(1))).ToBoolean()); System.Diagnostics.Trace.WriteLine("szWelcomMessage = " + szWelcomMessage); System.Diagnostics.Trace.WriteLine("szWhoamI = " + szWhoamI); // myfunc_4 JavaScriptValue[] args4 = new JavaScriptValue[3] { JavaScriptValue.GlobalObject, JavaScriptValue.FromString("myfunc_4"), JavaScriptValue.FromBoolean(false) }; myfunc_4 = JavaScriptValue.GlobalObject.GetProperty(JavaScriptPropertyId.FromString("myfunc_4")); returnValue = myfunc_4.CallFunction(args4); jsValue = JavaScriptValue.GlobalObject.GetProperty(JavaScriptPropertyId.FromString("szWelcomMessage")); szWelcomMessage = jsValue.ToString(); jsValue = JavaScriptValue.GlobalObject.GetProperty(JavaScriptPropertyId.FromString("szWhoamI")); szWhoamI = jsValue.ToString(); System.Diagnostics.Trace.WriteLine("Return Value[0] = " + (returnValue.GetIndexedProperty(JavaScriptValue.FromInt32(0))).ToString()); System.Diagnostics.Trace.WriteLine("Return Value[1] = " + (returnValue.GetIndexedProperty(JavaScriptValue.FromInt32(1))).ToBoolean()); System.Diagnostics.Trace.WriteLine("szWelcomMessage = " + szWelcomMessage); System.Diagnostics.Trace.WriteLine("szWhoamI = " + szWhoamI); bSuccess = true; } finally { if (true == bSuccess) { System.Diagnostics.Trace.WriteLine("Success"); } else { System.Diagnostics.Trace.WriteLine("Error"); } } }
public static void Register(JavaScriptContext context) { JavaScriptValue NetworkServerSimplePrototype; JavaScriptValue NetworkServerSimpleConstructor = Bridge.CreateConstructor( typeof(UnityEngine.Networking.NetworkServerSimple), (args) => { throw new NotImplementedException(); }, out NetworkServerSimplePrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .GetProperty("Networking") .SetProperty("NetworkServerSimple", NetworkServerSimpleConstructor); // Static Fields // Static Property Accessors // Static Methods // Instance Fields // Instance Property Accessors Bridge.DefineGetterSetter( NetworkServerSimplePrototype, "listenPort", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => JavaScriptValue.FromInt32(o.listenPort)), WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => { o.listenPort = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( NetworkServerSimplePrototype, "serverHostId", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => JavaScriptValue.FromInt32(o.serverHostId)), WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => { o.serverHostId = args[1].ToInt32(); }) ); Bridge.DefineGetter( NetworkServerSimplePrototype, "hostTopology", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => Bridge.CreateExternalWithPrototype(o.hostTopology)) ); Bridge.DefineGetterSetter( NetworkServerSimplePrototype, "useWebSockets", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => JavaScriptValue.FromBoolean(o.useWebSockets)), WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => { o.useWebSockets = args[1].ToBoolean(); }) ); Bridge.DefineGetter( NetworkServerSimplePrototype, "connections", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => Bridge.CreateExternalWithPrototype(o.connections)) ); Bridge.DefineGetter( NetworkServerSimplePrototype, "handlers", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => Bridge.CreateExternalWithPrototype(o.handlers)) ); Bridge.DefineGetter( NetworkServerSimplePrototype, "messageBuffer", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => Bridge.CreateExternalWithPrototype(o.messageBuffer)) ); Bridge.DefineGetter( NetworkServerSimplePrototype, "messageReader", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => Bridge.CreateExternalWithPrototype(o.messageReader)) ); Bridge.DefineGetter( NetworkServerSimplePrototype, "networkConnectionClass", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => Bridge.CreateExternalWithPrototype(o.networkConnectionClass)) ); // Instance Methods /* * NetworkServerSimple SetNetworkConnectionClass * method has generics */ NetworkServerSimplePrototype.SetProperty( "Initialize", Bridge.CreateFunction( "Initialize", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => o.Initialize()) ) ); NetworkServerSimplePrototype.SetProperty( "Configure", Bridge.CreateFunction( "Configure", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => JavaScriptValue.FromBoolean(o.Configure(Bridge.GetExternal <UnityEngine.Networking.ConnectionConfig>(args[1]), args[2].ToInt32()))) ) ); NetworkServerSimplePrototype.SetProperty( "Configure", Bridge.CreateFunction( "Configure", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => JavaScriptValue.FromBoolean(o.Configure(Bridge.GetExternal <UnityEngine.Networking.HostTopology>(args[1])))) ) ); NetworkServerSimplePrototype.SetProperty( "Listen", Bridge.CreateFunction( "Listen", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => JavaScriptValue.FromBoolean(o.Listen(args[1].ToString(), args[2].ToInt32()))) ) ); NetworkServerSimplePrototype.SetProperty( "Listen", Bridge.CreateFunction( "Listen", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => JavaScriptValue.FromBoolean(o.Listen(args[1].ToInt32()))) ) ); NetworkServerSimplePrototype.SetProperty( "Listen", Bridge.CreateFunction( "Listen", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => JavaScriptValue.FromBoolean(o.Listen(args[1].ToInt32(), Bridge.GetExternal <UnityEngine.Networking.HostTopology>(args[2])))) ) ); NetworkServerSimplePrototype.SetProperty( "ListenRelay", Bridge.CreateFunction( "ListenRelay", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => o.ListenRelay(args[1].ToString(), args[2].ToInt32(), Bridge.GetExternal <UnityEngine.Networking.Types.NetworkID>(args[3]), Bridge.GetExternal <UnityEngine.Networking.Types.SourceID>(args[4]), Bridge.GetExternal <UnityEngine.Networking.Types.NodeID>(args[5]))) ) ); NetworkServerSimplePrototype.SetProperty( "Stop", Bridge.CreateFunction( "Stop", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => o.Stop()) ) ); NetworkServerSimplePrototype.SetProperty( "RegisterHandler", Bridge.CreateFunction( "RegisterHandler", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => o.RegisterHandler(Bridge.GetExternal <System.Int16>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkMessageDelegate>(args[2]))) ) ); NetworkServerSimplePrototype.SetProperty( "UnregisterHandler", Bridge.CreateFunction( "UnregisterHandler", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => o.UnregisterHandler(Bridge.GetExternal <System.Int16>(args[1]))) ) ); NetworkServerSimplePrototype.SetProperty( "ClearHandlers", Bridge.CreateFunction( "ClearHandlers", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => o.ClearHandlers()) ) ); NetworkServerSimplePrototype.SetProperty( "UpdateConnections", Bridge.CreateFunction( "UpdateConnections", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => o.UpdateConnections()) ) ); NetworkServerSimplePrototype.SetProperty( "Update", Bridge.CreateFunction( "Update", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => o.Update()) ) ); NetworkServerSimplePrototype.SetProperty( "FindConnection", Bridge.CreateFunction( "FindConnection", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => Bridge.CreateExternalWithPrototype(o.FindConnection(args[1].ToInt32()))) ) ); NetworkServerSimplePrototype.SetProperty( "SetConnectionAtIndex", Bridge.CreateFunction( "SetConnectionAtIndex", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => JavaScriptValue.FromBoolean(o.SetConnectionAtIndex(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1])))) ) ); NetworkServerSimplePrototype.SetProperty( "RemoveConnectionAtIndex", Bridge.CreateFunction( "RemoveConnectionAtIndex", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => JavaScriptValue.FromBoolean(o.RemoveConnectionAtIndex(args[1].ToInt32()))) ) ); NetworkServerSimplePrototype.SetProperty( "SendBytesTo", Bridge.CreateFunction( "SendBytesTo", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => o.SendBytesTo(args[1].ToInt32(), Bridge.GetExternal <System.Byte[]>(args[2]), args[3].ToInt32(), args[4].ToInt32())) ) ); NetworkServerSimplePrototype.SetProperty( "SendWriterTo", Bridge.CreateFunction( "SendWriterTo", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => o.SendWriterTo(args[1].ToInt32(), Bridge.GetExternal <UnityEngine.Networking.NetworkWriter>(args[2]), args[3].ToInt32())) ) ); NetworkServerSimplePrototype.SetProperty( "Disconnect", Bridge.CreateFunction( "Disconnect", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => o.Disconnect(args[1].ToInt32())) ) ); NetworkServerSimplePrototype.SetProperty( "DisconnectAllConnections", Bridge.CreateFunction( "DisconnectAllConnections", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => o.DisconnectAllConnections()) ) ); NetworkServerSimplePrototype.SetProperty( "OnConnectError", Bridge.CreateFunction( "OnConnectError", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => o.OnConnectError(args[1].ToInt32(), Bridge.GetExternal <System.Byte>(args[2]))) ) ); NetworkServerSimplePrototype.SetProperty( "OnDataError", Bridge.CreateFunction( "OnDataError", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => o.OnDataError(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]), Bridge.GetExternal <System.Byte>(args[2]))) ) ); NetworkServerSimplePrototype.SetProperty( "OnDisconnectError", Bridge.CreateFunction( "OnDisconnectError", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => o.OnDisconnectError(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]), Bridge.GetExternal <System.Byte>(args[2]))) ) ); NetworkServerSimplePrototype.SetProperty( "OnConnected", Bridge.CreateFunction( "OnConnected", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => o.OnConnected(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]))) ) ); NetworkServerSimplePrototype.SetProperty( "OnDisconnected", Bridge.CreateFunction( "OnDisconnected", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => o.OnDisconnected(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]))) ) ); NetworkServerSimplePrototype.SetProperty( "OnData", Bridge.CreateFunction( "OnData", WithExternal <UnityEngine.Networking.NetworkServerSimple>((o, args) => o.OnData(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]), args[2].ToInt32(), args[3].ToInt32())) ) ); }
public static void Register(JavaScriptContext context) { JavaScriptValue MeshPrototype; JavaScriptValue MeshConstructor = Bridge.CreateConstructor( typeof(UnityEngine.Mesh), (args) => { throw new System.NotImplementedException(); }, out MeshPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .SetProperty("Mesh", MeshConstructor); // Static Fields // Static Property Accessors // Static Methods // Instance Fields // Instance Property Accessors Bridge.DefineGetterSetter( MeshPrototype, "indexFormat", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.indexFormat)), Bridge.WithExternal <UnityEngine.Mesh>((o, args) => { o.indexFormat = Bridge.GetExternal <UnityEngine.Rendering.IndexFormat>(args[1]); }) ); Bridge.DefineGetter( MeshPrototype, "vertexBufferCount", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => JavaScriptValue.FromInt32(o.vertexBufferCount)) ); Bridge.DefineGetter( MeshPrototype, "blendShapeCount", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => JavaScriptValue.FromInt32(o.blendShapeCount)) ); Bridge.DefineGetterSetter( MeshPrototype, "boneWeights", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.boneWeights)), Bridge.WithExternal <UnityEngine.Mesh>((o, args) => { o.boneWeights = Bridge.GetExternal <UnityEngine.BoneWeight[]>(args[1]); }) ); Bridge.DefineGetterSetter( MeshPrototype, "bindposes", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.bindposes)), Bridge.WithExternal <UnityEngine.Mesh>((o, args) => { o.bindposes = Bridge.GetExternal <UnityEngine.Matrix4x4[]>(args[1]); }) ); Bridge.DefineGetter( MeshPrototype, "isReadable", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => JavaScriptValue.FromBoolean(o.isReadable)) ); Bridge.DefineGetter( MeshPrototype, "vertexCount", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => JavaScriptValue.FromInt32(o.vertexCount)) ); Bridge.DefineGetterSetter( MeshPrototype, "subMeshCount", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => JavaScriptValue.FromInt32(o.subMeshCount)), Bridge.WithExternal <UnityEngine.Mesh>((o, args) => { o.subMeshCount = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( MeshPrototype, "bounds", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.bounds)), Bridge.WithExternal <UnityEngine.Mesh>((o, args) => { o.bounds = Bridge.GetBoxedExternal <UnityEngine.Bounds>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( MeshPrototype, "vertices", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.vertices)), Bridge.WithExternal <UnityEngine.Mesh>((o, args) => { o.vertices = Bridge.GetExternal <UnityEngine.Vector3[]>(args[1]); }) ); Bridge.DefineGetterSetter( MeshPrototype, "normals", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.normals)), Bridge.WithExternal <UnityEngine.Mesh>((o, args) => { o.normals = Bridge.GetExternal <UnityEngine.Vector3[]>(args[1]); }) ); Bridge.DefineGetterSetter( MeshPrototype, "tangents", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.tangents)), Bridge.WithExternal <UnityEngine.Mesh>((o, args) => { o.tangents = Bridge.GetExternal <UnityEngine.Vector4[]>(args[1]); }) ); Bridge.DefineGetterSetter( MeshPrototype, "uv", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.uv)), Bridge.WithExternal <UnityEngine.Mesh>((o, args) => { o.uv = Bridge.GetExternal <UnityEngine.Vector2[]>(args[1]); }) ); Bridge.DefineGetterSetter( MeshPrototype, "uv2", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.uv2)), Bridge.WithExternal <UnityEngine.Mesh>((o, args) => { o.uv2 = Bridge.GetExternal <UnityEngine.Vector2[]>(args[1]); }) ); Bridge.DefineGetterSetter( MeshPrototype, "uv3", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.uv3)), Bridge.WithExternal <UnityEngine.Mesh>((o, args) => { o.uv3 = Bridge.GetExternal <UnityEngine.Vector2[]>(args[1]); }) ); Bridge.DefineGetterSetter( MeshPrototype, "uv4", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.uv4)), Bridge.WithExternal <UnityEngine.Mesh>((o, args) => { o.uv4 = Bridge.GetExternal <UnityEngine.Vector2[]>(args[1]); }) ); Bridge.DefineGetterSetter( MeshPrototype, "uv5", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.uv5)), Bridge.WithExternal <UnityEngine.Mesh>((o, args) => { o.uv5 = Bridge.GetExternal <UnityEngine.Vector2[]>(args[1]); }) ); Bridge.DefineGetterSetter( MeshPrototype, "uv6", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.uv6)), Bridge.WithExternal <UnityEngine.Mesh>((o, args) => { o.uv6 = Bridge.GetExternal <UnityEngine.Vector2[]>(args[1]); }) ); Bridge.DefineGetterSetter( MeshPrototype, "uv7", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.uv7)), Bridge.WithExternal <UnityEngine.Mesh>((o, args) => { o.uv7 = Bridge.GetExternal <UnityEngine.Vector2[]>(args[1]); }) ); Bridge.DefineGetterSetter( MeshPrototype, "uv8", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.uv8)), Bridge.WithExternal <UnityEngine.Mesh>((o, args) => { o.uv8 = Bridge.GetExternal <UnityEngine.Vector2[]>(args[1]); }) ); Bridge.DefineGetterSetter( MeshPrototype, "colors", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.colors)), Bridge.WithExternal <UnityEngine.Mesh>((o, args) => { o.colors = Bridge.GetExternal <UnityEngine.Color[]>(args[1]); }) ); Bridge.DefineGetterSetter( MeshPrototype, "colors32", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.colors32)), Bridge.WithExternal <UnityEngine.Mesh>((o, args) => { o.colors32 = Bridge.GetExternal <UnityEngine.Color32[]>(args[1]); }) ); Bridge.DefineGetterSetter( MeshPrototype, "triangles", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.triangles)), Bridge.WithExternal <UnityEngine.Mesh>((o, args) => { o.triangles = Bridge.GetExternal <System.Int32[]>(args[1]); }) ); // Instance Methods MeshPrototype.SetProperty( "GetNativeVertexBufferPtr", Bridge.CreateFunction( "GetNativeVertexBufferPtr", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.GetNativeVertexBufferPtr(args[1].ToInt32()))) ) ); MeshPrototype.SetProperty( "GetNativeIndexBufferPtr", Bridge.CreateFunction( "GetNativeIndexBufferPtr", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.GetNativeIndexBufferPtr())) ) ); MeshPrototype.SetProperty( "ClearBlendShapes", Bridge.CreateFunction( "ClearBlendShapes", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => o.ClearBlendShapes()) ) ); MeshPrototype.SetProperty( "GetBlendShapeName", Bridge.CreateFunction( "GetBlendShapeName", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => JavaScriptValue.FromString(o.GetBlendShapeName(args[1].ToInt32()))) ) ); MeshPrototype.SetProperty( "GetBlendShapeIndex", Bridge.CreateFunction( "GetBlendShapeIndex", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => JavaScriptValue.FromInt32(o.GetBlendShapeIndex(args[1].ToString()))) ) ); MeshPrototype.SetProperty( "GetBlendShapeFrameCount", Bridge.CreateFunction( "GetBlendShapeFrameCount", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => JavaScriptValue.FromInt32(o.GetBlendShapeFrameCount(args[1].ToInt32()))) ) ); MeshPrototype.SetProperty( "GetBlendShapeFrameWeight", Bridge.CreateFunction( "GetBlendShapeFrameWeight", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => JavaScriptValue.FromDouble(o.GetBlendShapeFrameWeight(args[1].ToInt32(), args[2].ToInt32()))) ) ); MeshPrototype.SetProperty( "GetBlendShapeFrameVertices", Bridge.CreateFunction( "GetBlendShapeFrameVertices", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => o.GetBlendShapeFrameVertices(args[1].ToInt32(), args[2].ToInt32(), Bridge.GetExternal <UnityEngine.Vector3[]>(args[3]), Bridge.GetExternal <UnityEngine.Vector3[]>(args[4]), Bridge.GetExternal <UnityEngine.Vector3[]>(args[5]))) ) ); MeshPrototype.SetProperty( "AddBlendShapeFrame", Bridge.CreateFunction( "AddBlendShapeFrame", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => o.AddBlendShapeFrame(args[1].ToString(), (float)args[2].ToDouble(), Bridge.GetExternal <UnityEngine.Vector3[]>(args[3]), Bridge.GetExternal <UnityEngine.Vector3[]>(args[4]), Bridge.GetExternal <UnityEngine.Vector3[]>(args[5]))) ) ); MeshPrototype.SetProperty( "GetUVDistributionMetric", Bridge.CreateFunction( "GetUVDistributionMetric", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => JavaScriptValue.FromDouble(o.GetUVDistributionMetric(args[1].ToInt32()))) ) ); /* * Mesh GetVertices * System.Collections.Generic.List`1[UnityEngine.Vector3] has generics */ /* * Mesh SetVertices * System.Collections.Generic.List`1[UnityEngine.Vector3] has generics */ /* * Mesh GetNormals * System.Collections.Generic.List`1[UnityEngine.Vector3] has generics */ /* * Mesh SetNormals * System.Collections.Generic.List`1[UnityEngine.Vector3] has generics */ /* * Mesh GetTangents * System.Collections.Generic.List`1[UnityEngine.Vector4] has generics */ /* * Mesh SetTangents * System.Collections.Generic.List`1[UnityEngine.Vector4] has generics */ /* * Mesh GetColors * System.Collections.Generic.List`1[UnityEngine.Color] has generics */ /* * Mesh SetColors * System.Collections.Generic.List`1[UnityEngine.Color] has generics */ /* * Mesh GetColors * System.Collections.Generic.List`1[UnityEngine.Color32] has generics */ /* * Mesh SetColors * System.Collections.Generic.List`1[UnityEngine.Color32] has generics */ /* * Mesh SetUVs * System.Collections.Generic.List`1[UnityEngine.Vector2] has generics */ /* * Mesh SetUVs * System.Collections.Generic.List`1[UnityEngine.Vector3] has generics */ /* * Mesh SetUVs * System.Collections.Generic.List`1[UnityEngine.Vector4] has generics */ /* * Mesh GetUVs * System.Collections.Generic.List`1[UnityEngine.Vector2] has generics */ /* * Mesh GetUVs * System.Collections.Generic.List`1[UnityEngine.Vector3] has generics */ /* * Mesh GetUVs * System.Collections.Generic.List`1[UnityEngine.Vector4] has generics */ MeshPrototype.SetProperty( "GetTriangles", Bridge.CreateFunction( "GetTriangles", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.GetTriangles(args[1].ToInt32()))) ) ); MeshPrototype.SetProperty( "GetTriangles", Bridge.CreateFunction( "GetTriangles", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.GetTriangles(args[1].ToInt32(), args[2].ToBoolean()))) ) ); /* * Mesh GetTriangles * System.Collections.Generic.List`1[System.Int32] has generics */ /* * Mesh GetTriangles * System.Collections.Generic.List`1[System.Int32] has generics */ MeshPrototype.SetProperty( "GetIndices", Bridge.CreateFunction( "GetIndices", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.GetIndices(args[1].ToInt32()))) ) ); MeshPrototype.SetProperty( "GetIndices", Bridge.CreateFunction( "GetIndices", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.GetIndices(args[1].ToInt32(), args[2].ToBoolean()))) ) ); /* * Mesh GetIndices * System.Collections.Generic.List`1[System.Int32] has generics */ /* * Mesh GetIndices * System.Collections.Generic.List`1[System.Int32] has generics */ MeshPrototype.SetProperty( "GetIndexStart", Bridge.CreateFunction( "GetIndexStart", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.GetIndexStart(args[1].ToInt32()))) ) ); MeshPrototype.SetProperty( "GetIndexCount", Bridge.CreateFunction( "GetIndexCount", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.GetIndexCount(args[1].ToInt32()))) ) ); MeshPrototype.SetProperty( "GetBaseVertex", Bridge.CreateFunction( "GetBaseVertex", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.GetBaseVertex(args[1].ToInt32()))) ) ); MeshPrototype.SetProperty( "SetTriangles", Bridge.CreateFunction( "SetTriangles", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => o.SetTriangles(Bridge.GetExternal <System.Int32[]>(args[1]), args[2].ToInt32())) ) ); MeshPrototype.SetProperty( "SetTriangles", Bridge.CreateFunction( "SetTriangles", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => o.SetTriangles(Bridge.GetExternal <System.Int32[]>(args[1]), args[2].ToInt32(), args[3].ToBoolean())) ) ); MeshPrototype.SetProperty( "SetTriangles", Bridge.CreateFunction( "SetTriangles", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => o.SetTriangles(Bridge.GetExternal <System.Int32[]>(args[1]), args[2].ToInt32(), args[3].ToBoolean(), args[4].ToInt32())) ) ); /* * Mesh SetTriangles * System.Collections.Generic.List`1[System.Int32] has generics */ /* * Mesh SetTriangles * System.Collections.Generic.List`1[System.Int32] has generics */ /* * Mesh SetTriangles * System.Collections.Generic.List`1[System.Int32] has generics */ MeshPrototype.SetProperty( "SetIndices", Bridge.CreateFunction( "SetIndices", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => o.SetIndices(Bridge.GetExternal <System.Int32[]>(args[1]), Bridge.GetExternal <UnityEngine.MeshTopology>(args[2]), args[3].ToInt32())) ) ); MeshPrototype.SetProperty( "SetIndices", Bridge.CreateFunction( "SetIndices", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => o.SetIndices(Bridge.GetExternal <System.Int32[]>(args[1]), Bridge.GetExternal <UnityEngine.MeshTopology>(args[2]), args[3].ToInt32(), args[4].ToBoolean())) ) ); MeshPrototype.SetProperty( "SetIndices", Bridge.CreateFunction( "SetIndices", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => o.SetIndices(Bridge.GetExternal <System.Int32[]>(args[1]), Bridge.GetExternal <UnityEngine.MeshTopology>(args[2]), args[3].ToInt32(), args[4].ToBoolean(), args[5].ToInt32())) ) ); /* * Mesh GetBindposes * System.Collections.Generic.List`1[UnityEngine.Matrix4x4] has generics */ /* * Mesh GetBoneWeights * System.Collections.Generic.List`1[UnityEngine.BoneWeight] has generics */ MeshPrototype.SetProperty( "Clear", Bridge.CreateFunction( "Clear", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => o.Clear(args[1].ToBoolean())) ) ); MeshPrototype.SetProperty( "Clear", Bridge.CreateFunction( "Clear", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => o.Clear()) ) ); MeshPrototype.SetProperty( "RecalculateBounds", Bridge.CreateFunction( "RecalculateBounds", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => o.RecalculateBounds()) ) ); MeshPrototype.SetProperty( "RecalculateNormals", Bridge.CreateFunction( "RecalculateNormals", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => o.RecalculateNormals()) ) ); MeshPrototype.SetProperty( "RecalculateTangents", Bridge.CreateFunction( "RecalculateTangents", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => o.RecalculateTangents()) ) ); MeshPrototype.SetProperty( "MarkDynamic", Bridge.CreateFunction( "MarkDynamic", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => o.MarkDynamic()) ) ); MeshPrototype.SetProperty( "UploadMeshData", Bridge.CreateFunction( "UploadMeshData", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => o.UploadMeshData(args[1].ToBoolean())) ) ); MeshPrototype.SetProperty( "GetTopology", Bridge.CreateFunction( "GetTopology", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => Bridge.CreateExternalWithPrototype(o.GetTopology(args[1].ToInt32()))) ) ); MeshPrototype.SetProperty( "CombineMeshes", Bridge.CreateFunction( "CombineMeshes", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => o.CombineMeshes(Bridge.GetExternal <UnityEngine.CombineInstance[]>(args[1]), args[2].ToBoolean(), args[3].ToBoolean(), args[4].ToBoolean())) ) ); MeshPrototype.SetProperty( "CombineMeshes", Bridge.CreateFunction( "CombineMeshes", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => o.CombineMeshes(Bridge.GetExternal <UnityEngine.CombineInstance[]>(args[1]), args[2].ToBoolean(), args[3].ToBoolean())) ) ); MeshPrototype.SetProperty( "CombineMeshes", Bridge.CreateFunction( "CombineMeshes", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => o.CombineMeshes(Bridge.GetExternal <UnityEngine.CombineInstance[]>(args[1]), args[2].ToBoolean())) ) ); MeshPrototype.SetProperty( "CombineMeshes", Bridge.CreateFunction( "CombineMeshes", Bridge.WithExternal <UnityEngine.Mesh>((o, args) => o.CombineMeshes(Bridge.GetExternal <UnityEngine.CombineInstance[]>(args[1]))) ) ); }
public static void Register(JavaScriptContext context) { JavaScriptValue GameObjectPrototype; JavaScriptValue GameObjectConstructor = Bridge.CreateConstructor( typeof(UnityEngine.GameObject), (args) => { GameObject obj; if (args.Length > 1 && args[1].ValueType == JavaScriptValueType.String) { obj = new GameObject(args[1].ToString()); } else { obj = new GameObject(); } return(Bridge.CreateExternalWithPrototype(obj)); }, out GameObjectPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .SetProperty("GameObject", GameObjectConstructor); // Static Fields // Static Property Accessors // Static Methods GameObjectConstructor.SetProperty( "CreatePrimitive", Bridge.CreateFunction( "CreatePrimitive", (args) => { PrimitiveType type; switch (args[1].ToString().ToLower()) // TODO lowercase? can these collide? { case "capsule": type = PrimitiveType.Capsule; break; case "cube": type = PrimitiveType.Cube; break; case "cylinder": type = PrimitiveType.Cylinder; break; case "plane": type = PrimitiveType.Plane; break; case "quad": type = PrimitiveType.Quad; break; case "sphere": type = PrimitiveType.Sphere; break; default: throw new System.Exception("invalid type"); } return(Bridge.CreateExternalWithPrototype(GameObject.CreatePrimitive(type), GameObjectPrototype)); } ) ); GameObjectConstructor.SetProperty( "FindWithTag", Bridge.CreateFunction( "FindWithTag", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.GameObject.FindWithTag(args[1].ToString())) ) ); GameObjectConstructor.SetProperty( "FindGameObjectWithTag", Bridge.CreateFunction( "FindGameObjectWithTag", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.GameObject.FindGameObjectWithTag(args[1].ToString())) ) ); GameObjectConstructor.SetProperty( "FindGameObjectsWithTag", Bridge.CreateFunction( "FindGameObjectsWithTag", (args) => { // TODO make an array creator helper GameObject[] foundObjects = UnityEngine.GameObject.FindGameObjectsWithTag(args[1].ToString()); JavaScriptValue jsArray = JavaScriptValue.CreateArray(0); for (int i = 0; i < foundObjects.Length; i++) { jsArray.SetIndexedProperty(i, Bridge.CreateExternalWithPrototype(foundObjects[i])); } return(jsArray); } ) ); GameObjectConstructor.SetProperty( "Find", Bridge.CreateFunction( "Find", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.GameObject.Find(args[1].ToString())) ) ); // Instance Fields // Instance Property Accessors Bridge.DefineGetter( GameObjectPrototype, "transform", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => Bridge.CreateExternalWithPrototype(o.transform)) ); Bridge.DefineGetterSetter( GameObjectPrototype, "layer", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => JavaScriptValue.FromInt32(o.layer)), Bridge.WithExternal <UnityEngine.GameObject>((o, args) => { o.layer = args[1].ToInt32(); }) ); Bridge.DefineGetter( GameObjectPrototype, "activeSelf", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => JavaScriptValue.FromBoolean(o.activeSelf)) ); Bridge.DefineGetter( GameObjectPrototype, "activeInHierarchy", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => JavaScriptValue.FromBoolean(o.activeInHierarchy)) ); Bridge.DefineGetterSetter( GameObjectPrototype, "isStatic", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => JavaScriptValue.FromBoolean(o.isStatic)), Bridge.WithExternal <UnityEngine.GameObject>((o, args) => { o.isStatic = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( GameObjectPrototype, "tag", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => JavaScriptValue.FromString(o.tag)), Bridge.WithExternal <UnityEngine.GameObject>((o, args) => { o.tag = args[1].ToString(); }) ); Bridge.DefineGetter( GameObjectPrototype, "scene", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => Bridge.CreateExternalWithPrototype(o.scene)) ); Bridge.DefineGetter( GameObjectPrototype, "gameObject", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => Bridge.CreateExternalWithPrototype(o.gameObject)) ); // Instance Methods GameObjectPrototype.SetProperty("GetComponent", Bridge.CreateFunction(Bridge.WithExternal <UnityEngine.GameObject>((o, args) => { string typeName; if (args[1].ValueType == JavaScriptValueType.Function) { typeName = args[1].GetProperty("name").ToString(); } else if (args[1].ValueType == JavaScriptValueType.String) { typeName = args[1].ToString(); } else { throw new System.Exception("Argument passed to GetComponent must be a class or string"); } System.Type type = Bridge.GetType(typeName); JavaScriptValue prototype = Bridge.GetPrototype(typeName); return(Bridge.CreateExternalWithPrototype( o.GetComponent(type), prototype )); }))); GameObjectPrototype.SetProperty( "GetComponentInChildren", Bridge.CreateFunction( "GetComponentInChildren", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => { string typeName = args[1].GetProperty("name").ToString(); System.Type type = Bridge.GetType(typeName); JavaScriptValue prototype = Bridge.GetPrototype(typeName); if (args.Length == 2) { return(Bridge.CreateExternalWithPrototype( o.GetComponentInChildren(type), prototype )); } else { return(Bridge.CreateExternalWithPrototype( o.GetComponentInChildren(type, args[2].ToBoolean()), prototype )); } }) ) ); GameObjectPrototype.SetProperty( "GetComponentInParent", Bridge.CreateFunction( "GetComponentInParent", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => { string typeName = args[1].GetProperty("name").ToString(); System.Type type = Bridge.GetType(typeName); JavaScriptValue prototype = Bridge.GetPrototype(typeName); return(Bridge.CreateExternalWithPrototype( o.GetComponentInParent(type), prototype )); }) ) ); GameObjectPrototype.SetProperty( "GetComponents", Bridge.CreateFunction( "GetComponents", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => { string typeName = args[1].GetProperty("name").ToString(); System.Type type = Bridge.GetType(typeName); JavaScriptValue prototype = Bridge.GetPrototype(typeName); JavaScriptValue array = JavaScriptValue.CreateArray(0); foreach (var component in o.GetComponents(type)) { array.GetProperty("push").CallFunction(array, Bridge.CreateExternalWithPrototype( component, prototype )); } return(array); }) ) ); GameObjectPrototype.SetProperty( "GetComponentsInChildren", Bridge.CreateFunction( "GetComponentsInChildren", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => { string typeName = args[1].GetProperty("name").ToString(); System.Type type = Bridge.GetType(typeName); JavaScriptValue prototype = Bridge.GetPrototype(typeName); bool includeInactive = args.Length == 3 ? args[2].ToBoolean() : false; JavaScriptValue array = JavaScriptValue.CreateArray(0); foreach (var component in o.GetComponentsInChildren(type, includeInactive)) { array.GetProperty("push").CallFunction(array, Bridge.CreateExternalWithPrototype( component, prototype )); } return(array); }) ) ); GameObjectPrototype.SetProperty( "GetComponentsInParent", Bridge.CreateFunction( "GetComponentsInParent", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => { string typeName = args[1].GetProperty("name").ToString(); System.Type type = Bridge.GetType(typeName); JavaScriptValue prototype = Bridge.GetPrototype(typeName); bool includeInactive = args.Length == 3 ? args[2].ToBoolean() : false; JavaScriptValue array = JavaScriptValue.CreateArray(0); foreach (var component in o.GetComponentsInParent(type, includeInactive)) { array.GetProperty("push").CallFunction(array, Bridge.CreateExternalWithPrototype( component, prototype )); } return(array); }) ) ); GameObjectPrototype.SetProperty( "SendMessageUpwards", Bridge.CreateFunction( "SendMessageUpwards", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => o.SendMessageUpwards(args[1].ToString(), Bridge.GetExternal <UnityEngine.SendMessageOptions>(args[2]))) ) ); GameObjectPrototype.SetProperty( "SendMessage", Bridge.CreateFunction( "SendMessage", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => o.SendMessage(args[1].ToString(), Bridge.GetExternal <UnityEngine.SendMessageOptions>(args[2]))) ) ); GameObjectPrototype.SetProperty( "BroadcastMessage", Bridge.CreateFunction( "BroadcastMessage", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => o.BroadcastMessage(args[1].ToString(), Bridge.GetExternal <UnityEngine.SendMessageOptions>(args[2]))) ) ); GameObjectPrototype.SetProperty( "AddComponent", Bridge.CreateFunction( "AddComponent", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => { string typeName = args[1].GetProperty("name").ToString(); System.Type type = Bridge.GetType(typeName); JavaScriptValue prototype = Bridge.GetPrototype(typeName); return(Bridge.CreateExternalWithPrototype(o.AddComponent(type), prototype)); }) ) ); /* * GameObject AddComponent * method has generics */ GameObjectPrototype.SetProperty( "SetActive", Bridge.CreateFunction( "SetActive", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => o.SetActive(args[1].ToBoolean())) ) ); GameObjectPrototype.SetProperty( "CompareTag", Bridge.CreateFunction( "CompareTag", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => JavaScriptValue.FromBoolean(o.CompareTag(args[1].ToString()))) ) ); GameObjectPrototype.SetProperty( "SendMessageUpwards", Bridge.CreateFunction( "SendMessageUpwards", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => o.SendMessageUpwards(args[1].ToString(), Bridge.GetExternal <System.Object>(args[2]), Bridge.GetExternal <UnityEngine.SendMessageOptions>(args[3]))) ) ); GameObjectPrototype.SetProperty( "SendMessageUpwards", Bridge.CreateFunction( "SendMessageUpwards", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => o.SendMessageUpwards(args[1].ToString(), Bridge.GetExternal <System.Object>(args[2]))) ) ); GameObjectPrototype.SetProperty( "SendMessageUpwards", Bridge.CreateFunction( "SendMessageUpwards", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => o.SendMessageUpwards(args[1].ToString())) ) ); GameObjectPrototype.SetProperty( "SendMessage", Bridge.CreateFunction( "SendMessage", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => o.SendMessage(args[1].ToString(), Bridge.GetExternal <System.Object>(args[2]), Bridge.GetExternal <UnityEngine.SendMessageOptions>(args[3]))) ) ); GameObjectPrototype.SetProperty( "SendMessage", Bridge.CreateFunction( "SendMessage", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => o.SendMessage(args[1].ToString(), Bridge.GetExternal <System.Object>(args[2]))) ) ); GameObjectPrototype.SetProperty( "SendMessage", Bridge.CreateFunction( "SendMessage", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => o.SendMessage(args[1].ToString())) ) ); GameObjectPrototype.SetProperty( "BroadcastMessage", Bridge.CreateFunction( "BroadcastMessage", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => o.BroadcastMessage(args[1].ToString(), Bridge.GetExternal <System.Object>(args[2]), Bridge.GetExternal <UnityEngine.SendMessageOptions>(args[3]))) ) ); GameObjectPrototype.SetProperty( "BroadcastMessage", Bridge.CreateFunction( "BroadcastMessage", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => o.BroadcastMessage(args[1].ToString(), Bridge.GetExternal <System.Object>(args[2]))) ) ); GameObjectPrototype.SetProperty( "BroadcastMessage", Bridge.CreateFunction( "BroadcastMessage", Bridge.WithExternal <UnityEngine.GameObject>((o, args) => o.BroadcastMessage(args[1].ToString())) ) ); }
public static void Register(JavaScriptContext context) { JavaScriptValue ObjectPrototype; JavaScriptValue ObjectConstructor = Bridge.CreateConstructor( typeof(UnityEngine.Object), (args) => { throw new System.NotImplementedException(); }, out ObjectPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .SetProperty("Object", ObjectConstructor); // Static Fields // Static Property Accessors // Static Methods ObjectConstructor.SetProperty( "Instantiate", Bridge.CreateFunction( "Instantiate", (args) => { switch (args.Length) { case 2: return(Bridge.CreateExternalWithPrototype(UnityEngine.Object.Instantiate(Bridge.GetExternal <UnityEngine.Object>(args[1])))); case 3: return(Bridge.CreateExternalWithPrototype(UnityEngine.Object.Instantiate(Bridge.GetExternal <UnityEngine.Object>(args[1]), Bridge.GetExternal <UnityEngine.Transform>(args[2])))); case 4: if (args[3].ValueType == JavaScriptValueType.Boolean) { return(Bridge.CreateExternalWithPrototype(UnityEngine.Object.Instantiate(Bridge.GetExternal <UnityEngine.Object>(args[1]), Bridge.GetExternal <UnityEngine.Transform>(args[2]), args[3].ToBoolean()))); } else { return(Bridge.CreateExternalWithPrototype(UnityEngine.Object.Instantiate(Bridge.GetExternal <UnityEngine.Object>(args[1]), Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[2]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Quaternion>(args[3]).wrapped))); } case 5: return(Bridge.CreateExternalWithPrototype(UnityEngine.Object.Instantiate(Bridge.GetExternal <UnityEngine.Object>(args[1]), Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[2]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Quaternion>(args[3]).wrapped, Bridge.GetExternal <UnityEngine.Transform>(args[4])))); default: throw new System.Exception("no such overload"); } } ) ); /* * Object Instantiate * method has generics */ /* * Object Instantiate * method has generics */ /* * Object Instantiate * method has generics */ /* * Object Instantiate * method has generics */ /* * Object Instantiate * method has generics */ ObjectConstructor.SetProperty( "Destroy", Bridge.CreateFunction( "Destroy", (args) => { if (args.Length == 2) { UnityEngine.Object.Destroy(Bridge.GetExternal <UnityEngine.Object>(args[1])); } else { UnityEngine.Object.Destroy(Bridge.GetExternal <UnityEngine.Object>(args[1]), (float)args[2].ToDouble()); } } ) ); ObjectConstructor.SetProperty( "DestroyImmediate", Bridge.CreateFunction( "DestroyImmediate", (args) => { if (args.Length == 2) { UnityEngine.Object.DestroyImmediate(Bridge.GetExternal <UnityEngine.Object>(args[1])); } else { UnityEngine.Object.DestroyImmediate(Bridge.GetExternal <UnityEngine.Object>(args[1]), args[2].ToBoolean()); } } ) ); ObjectConstructor.SetProperty( "FindObjectsOfType", Bridge.CreateFunction( "FindObjectsOfType", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Object.FindObjectsOfType(Bridge.GetExternal <System.Type>(args[1]))) ) ); ObjectConstructor.SetProperty( "DontDestroyOnLoad", Bridge.CreateFunction( "DontDestroyOnLoad", (args) => UnityEngine.Object.DontDestroyOnLoad(Bridge.GetExternal <UnityEngine.Object>(args[1])) ) ); /* * Object FindObjectsOfType * method has generics */ /* * Object FindObjectOfType * method has generics */ ObjectConstructor.SetProperty( "FindObjectOfType", Bridge.CreateFunction( "FindObjectOfType", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Object.FindObjectOfType(Bridge.GetExternal <System.Type>(args[1]))) ) ); // Instance Fields // Instance Property Accessors Bridge.DefineGetterSetter( ObjectPrototype, "name", Bridge.WithExternal <UnityEngine.Object>((o, args) => JavaScriptValue.FromString(o.name)), Bridge.WithExternal <UnityEngine.Object>((o, args) => { o.name = args[1].ToString(); }) ); Bridge.DefineGetterSetter( ObjectPrototype, "hideFlags", Bridge.WithExternal <UnityEngine.Object>((o, args) => Bridge.CreateExternalWithPrototype(o.hideFlags)), Bridge.WithExternal <UnityEngine.Object>((o, args) => { o.hideFlags = Bridge.GetExternal <UnityEngine.HideFlags>(args[1]); }) ); // Instance Methods ObjectPrototype.SetProperty( "GetInstanceID", Bridge.CreateFunction( "GetInstanceID", Bridge.WithExternal <UnityEngine.Object>((o, args) => JavaScriptValue.FromInt32(o.GetInstanceID())) ) ); ObjectPrototype.SetProperty( "GetHashCode", Bridge.CreateFunction( "GetHashCode", Bridge.WithExternal <UnityEngine.Object>((o, args) => JavaScriptValue.FromInt32(o.GetHashCode())) ) ); ObjectPrototype.SetProperty( "Equals", Bridge.CreateFunction( "Equals", Bridge.WithExternal <UnityEngine.Object>((o, args) => JavaScriptValue.FromBoolean(o.Equals(Bridge.GetExternal <System.Object>(args[1])))) ) ); ObjectPrototype.SetProperty( "toString", Bridge.CreateFunction( "ToString", Bridge.WithExternal <UnityEngine.Object>((o, args) => JavaScriptValue.FromString(o.ToString())) ) ); }
public static void Register(JavaScriptContext context) { JavaScriptValue ScreenPrototype; JavaScriptValue ScreenConstructor = Bridge.CreateConstructor( typeof(UnityEngine.Screen), (args) => { throw new System.NotImplementedException(); }, out ScreenPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .SetProperty("Screen", ScreenConstructor); // Static Fields // Static Property Accessors Bridge.DefineGetter( ScreenConstructor, "width", (args) => JavaScriptValue.FromInt32(UnityEngine.Screen.width) ); Bridge.DefineGetter( ScreenConstructor, "height", (args) => JavaScriptValue.FromInt32(UnityEngine.Screen.height) ); Bridge.DefineGetter( ScreenConstructor, "dpi", (args) => JavaScriptValue.FromDouble(UnityEngine.Screen.dpi) ); Bridge.DefineGetterSetter( ScreenConstructor, "orientation", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Screen.orientation), (args) => { UnityEngine.Screen.orientation = Bridge.GetExternal <UnityEngine.ScreenOrientation>(args[1]); } ); Bridge.DefineGetterSetter( ScreenConstructor, "sleepTimeout", (args) => JavaScriptValue.FromInt32(UnityEngine.Screen.sleepTimeout), (args) => { UnityEngine.Screen.sleepTimeout = args[1].ToInt32(); } ); Bridge.DefineGetterSetter( ScreenConstructor, "autorotateToPortrait", (args) => JavaScriptValue.FromBoolean(UnityEngine.Screen.autorotateToPortrait), (args) => { UnityEngine.Screen.autorotateToPortrait = args[1].ToBoolean(); } ); Bridge.DefineGetterSetter( ScreenConstructor, "autorotateToPortraitUpsideDown", (args) => JavaScriptValue.FromBoolean(UnityEngine.Screen.autorotateToPortraitUpsideDown), (args) => { UnityEngine.Screen.autorotateToPortraitUpsideDown = args[1].ToBoolean(); } ); Bridge.DefineGetterSetter( ScreenConstructor, "autorotateToLandscapeLeft", (args) => JavaScriptValue.FromBoolean(UnityEngine.Screen.autorotateToLandscapeLeft), (args) => { UnityEngine.Screen.autorotateToLandscapeLeft = args[1].ToBoolean(); } ); Bridge.DefineGetterSetter( ScreenConstructor, "autorotateToLandscapeRight", (args) => JavaScriptValue.FromBoolean(UnityEngine.Screen.autorotateToLandscapeRight), (args) => { UnityEngine.Screen.autorotateToLandscapeRight = args[1].ToBoolean(); } ); Bridge.DefineGetter( ScreenConstructor, "currentResolution", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Screen.currentResolution) ); Bridge.DefineGetterSetter( ScreenConstructor, "fullScreen", (args) => JavaScriptValue.FromBoolean(UnityEngine.Screen.fullScreen), (args) => { UnityEngine.Screen.fullScreen = args[1].ToBoolean(); } ); Bridge.DefineGetterSetter( ScreenConstructor, "fullScreenMode", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Screen.fullScreenMode), (args) => { UnityEngine.Screen.fullScreenMode = Bridge.GetExternal <UnityEngine.FullScreenMode>(args[1]); } ); Bridge.DefineGetter( ScreenConstructor, "safeArea", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Screen.safeArea) ); Bridge.DefineGetter( ScreenConstructor, "resolutions", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Screen.resolutions) ); // Static Methods ScreenConstructor.SetProperty( "SetResolution", Bridge.CreateFunction( "SetResolution", (args) => UnityEngine.Screen.SetResolution(args[1].ToInt32(), args[2].ToInt32(), Bridge.GetExternal <UnityEngine.FullScreenMode>(args[3]), args[4].ToInt32()) ) ); ScreenConstructor.SetProperty( "SetResolution", Bridge.CreateFunction( "SetResolution", (args) => UnityEngine.Screen.SetResolution(args[1].ToInt32(), args[2].ToInt32(), Bridge.GetExternal <UnityEngine.FullScreenMode>(args[3])) ) ); ScreenConstructor.SetProperty( "SetResolution", Bridge.CreateFunction( "SetResolution", (args) => UnityEngine.Screen.SetResolution(args[1].ToInt32(), args[2].ToInt32(), args[3].ToBoolean(), args[4].ToInt32()) ) ); ScreenConstructor.SetProperty( "SetResolution", Bridge.CreateFunction( "SetResolution", (args) => UnityEngine.Screen.SetResolution(args[1].ToInt32(), args[2].ToInt32(), args[3].ToBoolean()) ) ); // Instance Fields // Instance Property Accessors // Instance Methods }
public static void Register(JavaScriptContext context) { JavaScriptValue AbstractEventDataPrototype; JavaScriptValue AbstractEventDataConstructor = Bridge.CreateConstructor( typeof(UnityEngine.EventSystems.AbstractEventData), (args) => { throw new NotImplementedException(); }, out AbstractEventDataPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .GetProperty("EventSystems") .SetProperty("AbstractEventData", AbstractEventDataConstructor); // Static Fields // Static Property Accessors // Static Methods // Instance Fields // Instance Property Accessors Bridge.DefineGetter( AbstractEventDataPrototype, "used", WithExternal <UnityEngine.EventSystems.AbstractEventData>((o, args) => JavaScriptValue.FromBoolean(o.used)) ); // Instance Methods AbstractEventDataPrototype.SetProperty( "Reset", Bridge.CreateFunction( "Reset", WithExternal <UnityEngine.EventSystems.AbstractEventData>((o, args) => o.Reset()) ) ); AbstractEventDataPrototype.SetProperty( "Use", Bridge.CreateFunction( "Use", WithExternal <UnityEngine.EventSystems.AbstractEventData>((o, args) => o.Use()) ) ); }
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 */ }
public static void Register(JavaScriptContext context) { JavaScriptValue NetworkBehaviourPrototype; JavaScriptValue NetworkBehaviourConstructor = Bridge.CreateConstructor( typeof(UnityEngine.Networking.NetworkBehaviour), (args) => { throw new NotImplementedException(); }, out NetworkBehaviourPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .GetProperty("Networking") .SetProperty("NetworkBehaviour", NetworkBehaviourConstructor); // Static Fields // Static Property Accessors // Static Methods // Instance Fields // Instance Property Accessors Bridge.DefineGetter( NetworkBehaviourPrototype, "localPlayerAuthority", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => JavaScriptValue.FromBoolean(o.localPlayerAuthority)) ); Bridge.DefineGetter( NetworkBehaviourPrototype, "isServer", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => JavaScriptValue.FromBoolean(o.isServer)) ); Bridge.DefineGetter( NetworkBehaviourPrototype, "isClient", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => JavaScriptValue.FromBoolean(o.isClient)) ); Bridge.DefineGetter( NetworkBehaviourPrototype, "isLocalPlayer", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => JavaScriptValue.FromBoolean(o.isLocalPlayer)) ); Bridge.DefineGetter( NetworkBehaviourPrototype, "hasAuthority", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => JavaScriptValue.FromBoolean(o.hasAuthority)) ); Bridge.DefineGetter( NetworkBehaviourPrototype, "netId", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => Bridge.CreateExternalWithPrototype(o.netId)) ); Bridge.DefineGetter( NetworkBehaviourPrototype, "connectionToServer", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => Bridge.CreateExternalWithPrototype(o.connectionToServer)) ); Bridge.DefineGetter( NetworkBehaviourPrototype, "connectionToClient", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => Bridge.CreateExternalWithPrototype(o.connectionToClient)) ); Bridge.DefineGetter( NetworkBehaviourPrototype, "playerControllerId", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => Bridge.CreateExternalWithPrototype(o.playerControllerId)) ); // Instance Methods NetworkBehaviourPrototype.SetProperty( "InvokeCommand", Bridge.CreateFunction( "InvokeCommand", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => JavaScriptValue.FromBoolean(o.InvokeCommand(args[1].ToInt32(), Bridge.GetExternal <UnityEngine.Networking.NetworkReader>(args[2])))) ) ); NetworkBehaviourPrototype.SetProperty( "InvokeRPC", Bridge.CreateFunction( "InvokeRPC", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => JavaScriptValue.FromBoolean(o.InvokeRPC(args[1].ToInt32(), Bridge.GetExternal <UnityEngine.Networking.NetworkReader>(args[2])))) ) ); NetworkBehaviourPrototype.SetProperty( "InvokeSyncEvent", Bridge.CreateFunction( "InvokeSyncEvent", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => JavaScriptValue.FromBoolean(o.InvokeSyncEvent(args[1].ToInt32(), Bridge.GetExternal <UnityEngine.Networking.NetworkReader>(args[2])))) ) ); NetworkBehaviourPrototype.SetProperty( "InvokeSyncList", Bridge.CreateFunction( "InvokeSyncList", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => JavaScriptValue.FromBoolean(o.InvokeSyncList(args[1].ToInt32(), Bridge.GetExternal <UnityEngine.Networking.NetworkReader>(args[2])))) ) ); NetworkBehaviourPrototype.SetProperty( "SetDirtyBit", Bridge.CreateFunction( "SetDirtyBit", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => o.SetDirtyBit(Bridge.GetExternal <System.UInt32>(args[1]))) ) ); NetworkBehaviourPrototype.SetProperty( "ClearAllDirtyBits", Bridge.CreateFunction( "ClearAllDirtyBits", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => o.ClearAllDirtyBits()) ) ); NetworkBehaviourPrototype.SetProperty( "OnSerialize", Bridge.CreateFunction( "OnSerialize", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => JavaScriptValue.FromBoolean(o.OnSerialize(Bridge.GetExternal <UnityEngine.Networking.NetworkWriter>(args[1]), args[2].ToBoolean()))) ) ); NetworkBehaviourPrototype.SetProperty( "OnDeserialize", Bridge.CreateFunction( "OnDeserialize", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => o.OnDeserialize(Bridge.GetExternal <UnityEngine.Networking.NetworkReader>(args[1]), args[2].ToBoolean())) ) ); NetworkBehaviourPrototype.SetProperty( "PreStartClient", Bridge.CreateFunction( "PreStartClient", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => o.PreStartClient()) ) ); NetworkBehaviourPrototype.SetProperty( "OnNetworkDestroy", Bridge.CreateFunction( "OnNetworkDestroy", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => o.OnNetworkDestroy()) ) ); NetworkBehaviourPrototype.SetProperty( "OnStartServer", Bridge.CreateFunction( "OnStartServer", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => o.OnStartServer()) ) ); NetworkBehaviourPrototype.SetProperty( "OnStartClient", Bridge.CreateFunction( "OnStartClient", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => o.OnStartClient()) ) ); NetworkBehaviourPrototype.SetProperty( "OnStartLocalPlayer", Bridge.CreateFunction( "OnStartLocalPlayer", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => o.OnStartLocalPlayer()) ) ); NetworkBehaviourPrototype.SetProperty( "OnStartAuthority", Bridge.CreateFunction( "OnStartAuthority", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => o.OnStartAuthority()) ) ); NetworkBehaviourPrototype.SetProperty( "OnStopAuthority", Bridge.CreateFunction( "OnStopAuthority", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => o.OnStopAuthority()) ) ); /* * NetworkBehaviour OnRebuildObservers * System.Collections.Generic.HashSet`1[UnityEngine.Networking.NetworkConnection] has generics */ NetworkBehaviourPrototype.SetProperty( "OnSetLocalVisibility", Bridge.CreateFunction( "OnSetLocalVisibility", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => o.OnSetLocalVisibility(args[1].ToBoolean())) ) ); NetworkBehaviourPrototype.SetProperty( "OnCheckObserver", Bridge.CreateFunction( "OnCheckObserver", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => JavaScriptValue.FromBoolean(o.OnCheckObserver(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1])))) ) ); NetworkBehaviourPrototype.SetProperty( "GetNetworkChannel", Bridge.CreateFunction( "GetNetworkChannel", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => JavaScriptValue.FromInt32(o.GetNetworkChannel())) ) ); NetworkBehaviourPrototype.SetProperty( "GetNetworkSendInterval", Bridge.CreateFunction( "GetNetworkSendInterval", WithExternal <UnityEngine.Networking.NetworkBehaviour>((o, args) => JavaScriptValue.FromDouble(o.GetNetworkSendInterval())) ) ); }
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 }
public static void Register(JavaScriptContext context) { JavaScriptValue SystemInfoPrototype; JavaScriptValue SystemInfoConstructor = Bridge.CreateConstructor( typeof(UnityEngine.SystemInfo), (args) => { throw new System.NotImplementedException(); }, out SystemInfoPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .SetProperty("SystemInfo", SystemInfoConstructor); // Static Fields SystemInfoConstructor.SetProperty( "unsupportedIdentifier", JavaScriptValue.FromString(UnityEngine.SystemInfo.unsupportedIdentifier) ); // Static Property Accessors Bridge.DefineGetter( SystemInfoConstructor, "batteryLevel", (args) => JavaScriptValue.FromDouble(UnityEngine.SystemInfo.batteryLevel) ); Bridge.DefineGetter( SystemInfoConstructor, "batteryStatus", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.SystemInfo.batteryStatus) ); Bridge.DefineGetter( SystemInfoConstructor, "operatingSystem", (args) => JavaScriptValue.FromString(UnityEngine.SystemInfo.operatingSystem) ); Bridge.DefineGetter( SystemInfoConstructor, "operatingSystemFamily", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.SystemInfo.operatingSystemFamily) ); Bridge.DefineGetter( SystemInfoConstructor, "processorType", (args) => JavaScriptValue.FromString(UnityEngine.SystemInfo.processorType) ); Bridge.DefineGetter( SystemInfoConstructor, "processorFrequency", (args) => JavaScriptValue.FromInt32(UnityEngine.SystemInfo.processorFrequency) ); Bridge.DefineGetter( SystemInfoConstructor, "processorCount", (args) => JavaScriptValue.FromInt32(UnityEngine.SystemInfo.processorCount) ); Bridge.DefineGetter( SystemInfoConstructor, "systemMemorySize", (args) => JavaScriptValue.FromInt32(UnityEngine.SystemInfo.systemMemorySize) ); Bridge.DefineGetter( SystemInfoConstructor, "deviceUniqueIdentifier", (args) => JavaScriptValue.FromString(UnityEngine.SystemInfo.deviceUniqueIdentifier) ); Bridge.DefineGetter( SystemInfoConstructor, "deviceName", (args) => JavaScriptValue.FromString(UnityEngine.SystemInfo.deviceName) ); Bridge.DefineGetter( SystemInfoConstructor, "deviceModel", (args) => JavaScriptValue.FromString(UnityEngine.SystemInfo.deviceModel) ); Bridge.DefineGetter( SystemInfoConstructor, "supportsAccelerometer", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.supportsAccelerometer) ); Bridge.DefineGetter( SystemInfoConstructor, "supportsGyroscope", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.supportsGyroscope) ); Bridge.DefineGetter( SystemInfoConstructor, "supportsLocationService", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.supportsLocationService) ); Bridge.DefineGetter( SystemInfoConstructor, "supportsVibration", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.supportsVibration) ); Bridge.DefineGetter( SystemInfoConstructor, "supportsAudio", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.supportsAudio) ); Bridge.DefineGetter( SystemInfoConstructor, "deviceType", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.SystemInfo.deviceType) ); Bridge.DefineGetter( SystemInfoConstructor, "graphicsMemorySize", (args) => JavaScriptValue.FromInt32(UnityEngine.SystemInfo.graphicsMemorySize) ); Bridge.DefineGetter( SystemInfoConstructor, "graphicsDeviceName", (args) => JavaScriptValue.FromString(UnityEngine.SystemInfo.graphicsDeviceName) ); Bridge.DefineGetter( SystemInfoConstructor, "graphicsDeviceVendor", (args) => JavaScriptValue.FromString(UnityEngine.SystemInfo.graphicsDeviceVendor) ); Bridge.DefineGetter( SystemInfoConstructor, "graphicsDeviceID", (args) => JavaScriptValue.FromInt32(UnityEngine.SystemInfo.graphicsDeviceID) ); Bridge.DefineGetter( SystemInfoConstructor, "graphicsDeviceVendorID", (args) => JavaScriptValue.FromInt32(UnityEngine.SystemInfo.graphicsDeviceVendorID) ); Bridge.DefineGetter( SystemInfoConstructor, "graphicsDeviceType", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.SystemInfo.graphicsDeviceType) ); Bridge.DefineGetter( SystemInfoConstructor, "graphicsUVStartsAtTop", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.graphicsUVStartsAtTop) ); Bridge.DefineGetter( SystemInfoConstructor, "graphicsDeviceVersion", (args) => JavaScriptValue.FromString(UnityEngine.SystemInfo.graphicsDeviceVersion) ); Bridge.DefineGetter( SystemInfoConstructor, "graphicsShaderLevel", (args) => JavaScriptValue.FromInt32(UnityEngine.SystemInfo.graphicsShaderLevel) ); Bridge.DefineGetter( SystemInfoConstructor, "graphicsMultiThreaded", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.graphicsMultiThreaded) ); Bridge.DefineGetter( SystemInfoConstructor, "supportsShadows", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.supportsShadows) ); Bridge.DefineGetter( SystemInfoConstructor, "supportsRawShadowDepthSampling", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.supportsRawShadowDepthSampling) ); Bridge.DefineGetter( SystemInfoConstructor, "supportsMotionVectors", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.supportsMotionVectors) ); Bridge.DefineGetter( SystemInfoConstructor, "supportsRenderToCubemap", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.supportsRenderToCubemap) ); Bridge.DefineGetter( SystemInfoConstructor, "supportsImageEffects", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.supportsImageEffects) ); Bridge.DefineGetter( SystemInfoConstructor, "supports3DTextures", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.supports3DTextures) ); Bridge.DefineGetter( SystemInfoConstructor, "supports2DArrayTextures", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.supports2DArrayTextures) ); Bridge.DefineGetter( SystemInfoConstructor, "supports3DRenderTextures", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.supports3DRenderTextures) ); Bridge.DefineGetter( SystemInfoConstructor, "supportsCubemapArrayTextures", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.supportsCubemapArrayTextures) ); Bridge.DefineGetter( SystemInfoConstructor, "copyTextureSupport", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.SystemInfo.copyTextureSupport) ); Bridge.DefineGetter( SystemInfoConstructor, "supportsComputeShaders", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.supportsComputeShaders) ); Bridge.DefineGetter( SystemInfoConstructor, "supportsInstancing", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.supportsInstancing) ); Bridge.DefineGetter( SystemInfoConstructor, "supportsHardwareQuadTopology", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.supportsHardwareQuadTopology) ); Bridge.DefineGetter( SystemInfoConstructor, "supports32bitsIndexBuffer", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.supports32bitsIndexBuffer) ); Bridge.DefineGetter( SystemInfoConstructor, "supportsSparseTextures", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.supportsSparseTextures) ); Bridge.DefineGetter( SystemInfoConstructor, "supportedRenderTargetCount", (args) => JavaScriptValue.FromInt32(UnityEngine.SystemInfo.supportedRenderTargetCount) ); Bridge.DefineGetter( SystemInfoConstructor, "supportsMultisampledTextures", (args) => JavaScriptValue.FromInt32(UnityEngine.SystemInfo.supportsMultisampledTextures) ); Bridge.DefineGetter( SystemInfoConstructor, "supportsMultisampleAutoResolve", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.supportsMultisampleAutoResolve) ); Bridge.DefineGetter( SystemInfoConstructor, "supportsTextureWrapMirrorOnce", (args) => JavaScriptValue.FromInt32(UnityEngine.SystemInfo.supportsTextureWrapMirrorOnce) ); Bridge.DefineGetter( SystemInfoConstructor, "usesReversedZBuffer", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.usesReversedZBuffer) ); Bridge.DefineGetter( SystemInfoConstructor, "npotSupport", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.SystemInfo.npotSupport) ); Bridge.DefineGetter( SystemInfoConstructor, "maxTextureSize", (args) => JavaScriptValue.FromInt32(UnityEngine.SystemInfo.maxTextureSize) ); Bridge.DefineGetter( SystemInfoConstructor, "maxCubemapSize", (args) => JavaScriptValue.FromInt32(UnityEngine.SystemInfo.maxCubemapSize) ); Bridge.DefineGetter( SystemInfoConstructor, "supportsAsyncCompute", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.supportsAsyncCompute) ); Bridge.DefineGetter( SystemInfoConstructor, "supportsGPUFence", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.supportsGPUFence) ); Bridge.DefineGetter( SystemInfoConstructor, "supportsAsyncGPUReadback", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.supportsAsyncGPUReadback) ); Bridge.DefineGetter( SystemInfoConstructor, "supportsMipStreaming", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.supportsMipStreaming) ); // Static Methods SystemInfoConstructor.SetProperty( "SupportsRenderTextureFormat", Bridge.CreateFunction( "SupportsRenderTextureFormat", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.SupportsRenderTextureFormat(Bridge.GetExternal <UnityEngine.RenderTextureFormat>(args[1]))) ) ); SystemInfoConstructor.SetProperty( "SupportsBlendingOnRenderTextureFormat", Bridge.CreateFunction( "SupportsBlendingOnRenderTextureFormat", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.SupportsBlendingOnRenderTextureFormat(Bridge.GetExternal <UnityEngine.RenderTextureFormat>(args[1]))) ) ); SystemInfoConstructor.SetProperty( "SupportsTextureFormat", Bridge.CreateFunction( "SupportsTextureFormat", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.SupportsTextureFormat(Bridge.GetExternal <UnityEngine.TextureFormat>(args[1]))) ) ); SystemInfoConstructor.SetProperty( "IsFormatSupported", Bridge.CreateFunction( "IsFormatSupported", (args) => JavaScriptValue.FromBoolean(UnityEngine.SystemInfo.IsFormatSupported(Bridge.GetExternal <UnityEngine.Experimental.Rendering.GraphicsFormat>(args[1]), Bridge.GetExternal <UnityEngine.Experimental.Rendering.FormatUsage>(args[2]))) ) ); // Instance Fields // Instance Property Accessors // Instance Methods }
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()))); } }) ) ); }
public static void Register(JavaScriptContext context) { JavaScriptValue PointerEventDataPrototype; JavaScriptValue PointerEventDataConstructor = Bridge.CreateConstructor( typeof(UnityEngine.EventSystems.PointerEventData), (args) => { throw new NotImplementedException(); }, out PointerEventDataPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .GetProperty("EventSystems") .SetProperty("PointerEventData", PointerEventDataConstructor); // Static Fields // Static Property Accessors // Static Methods // Instance Fields /* * PointerEventData hovered * System.Collections.Generic.List`1[UnityEngine.GameObject] has generics */ // Instance Property Accessors Bridge.DefineGetterSetter( PointerEventDataPrototype, "pointerEnter", WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => Bridge.CreateExternalWithPrototype(o.pointerEnter)), WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => { o.pointerEnter = Bridge.GetExternal <UnityEngine.GameObject>(args[1]); }) ); Bridge.DefineGetter( PointerEventDataPrototype, "lastPress", WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => Bridge.CreateExternalWithPrototype(o.lastPress)) ); Bridge.DefineGetterSetter( PointerEventDataPrototype, "rawPointerPress", WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => Bridge.CreateExternalWithPrototype(o.rawPointerPress)), WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => { o.rawPointerPress = Bridge.GetExternal <UnityEngine.GameObject>(args[1]); }) ); Bridge.DefineGetterSetter( PointerEventDataPrototype, "pointerDrag", WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => Bridge.CreateExternalWithPrototype(o.pointerDrag)), WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => { o.pointerDrag = Bridge.GetExternal <UnityEngine.GameObject>(args[1]); }) ); Bridge.DefineGetterSetter( PointerEventDataPrototype, "pointerCurrentRaycast", WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => Bridge.CreateExternalWithPrototype(o.pointerCurrentRaycast)), WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => { o.pointerCurrentRaycast = Bridge.GetExternal <UnityEngine.EventSystems.RaycastResult>(args[1]); }) ); Bridge.DefineGetterSetter( PointerEventDataPrototype, "pointerPressRaycast", WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => Bridge.CreateExternalWithPrototype(o.pointerPressRaycast)), WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => { o.pointerPressRaycast = Bridge.GetExternal <UnityEngine.EventSystems.RaycastResult>(args[1]); }) ); Bridge.DefineGetterSetter( PointerEventDataPrototype, "eligibleForClick", WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => JavaScriptValue.FromBoolean(o.eligibleForClick)), WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => { o.eligibleForClick = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( PointerEventDataPrototype, "pointerId", WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => JavaScriptValue.FromInt32(o.pointerId)), WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => { o.pointerId = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( PointerEventDataPrototype, "position", WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => Bridge.CreateExternalWithPrototype(o.position)), WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => { o.position = Bridge.GetExternal <UnityEngine.Vector2>(args[1]); }) ); Bridge.DefineGetterSetter( PointerEventDataPrototype, "delta", WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => Bridge.CreateExternalWithPrototype(o.delta)), WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => { o.delta = Bridge.GetExternal <UnityEngine.Vector2>(args[1]); }) ); Bridge.DefineGetterSetter( PointerEventDataPrototype, "pressPosition", WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => Bridge.CreateExternalWithPrototype(o.pressPosition)), WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => { o.pressPosition = Bridge.GetExternal <UnityEngine.Vector2>(args[1]); }) ); Bridge.DefineGetterSetter( PointerEventDataPrototype, "clickTime", WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => JavaScriptValue.FromDouble(o.clickTime)), WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => { o.clickTime = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( PointerEventDataPrototype, "clickCount", WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => JavaScriptValue.FromInt32(o.clickCount)), WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => { o.clickCount = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( PointerEventDataPrototype, "scrollDelta", WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => Bridge.CreateExternalWithPrototype(o.scrollDelta)), WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => { o.scrollDelta = Bridge.GetExternal <UnityEngine.Vector2>(args[1]); }) ); Bridge.DefineGetterSetter( PointerEventDataPrototype, "useDragThreshold", WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => JavaScriptValue.FromBoolean(o.useDragThreshold)), WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => { o.useDragThreshold = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( PointerEventDataPrototype, "dragging", WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => JavaScriptValue.FromBoolean(o.dragging)), WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => { o.dragging = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( PointerEventDataPrototype, "button", WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => Bridge.CreateExternalWithPrototype(o.button)), WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => { o.button = Bridge.GetExternal <UnityEngine.EventSystems.PointerEventData.InputButton>(args[1]); }) ); Bridge.DefineGetter( PointerEventDataPrototype, "enterEventCamera", WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => Bridge.CreateExternalWithPrototype(o.enterEventCamera)) ); Bridge.DefineGetter( PointerEventDataPrototype, "pressEventCamera", WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => Bridge.CreateExternalWithPrototype(o.pressEventCamera)) ); Bridge.DefineGetterSetter( PointerEventDataPrototype, "pointerPress", WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => Bridge.CreateExternalWithPrototype(o.pointerPress)), WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => { o.pointerPress = Bridge.GetExternal <UnityEngine.GameObject>(args[1]); }) ); // Instance Methods PointerEventDataPrototype.SetProperty( "IsPointerMoving", Bridge.CreateFunction( "IsPointerMoving", WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => JavaScriptValue.FromBoolean(o.IsPointerMoving())) ) ); PointerEventDataPrototype.SetProperty( "IsScrolling", Bridge.CreateFunction( "IsScrolling", WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => JavaScriptValue.FromBoolean(o.IsScrolling())) ) ); PointerEventDataPrototype.SetProperty( "ToString", Bridge.CreateFunction( "ToString", WithExternal <UnityEngine.EventSystems.PointerEventData>((o, args) => JavaScriptValue.FromString(o.ToString())) ) ); }