public static void Register(JavaScriptContext context) { JavaScriptValue ColorPrototype; JavaScriptValue ColorConstructor = Bridge.CreateConstructor( typeof(UnityEngine.Color), (args) => { throw new System.NotImplementedException(); }, out ColorPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .SetProperty("Color", ColorConstructor); // Static Fields // Static Property Accessors Bridge.DefineGetter( ColorConstructor, "red", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Color.red) ); Bridge.DefineGetter( ColorConstructor, "green", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Color.green) ); Bridge.DefineGetter( ColorConstructor, "blue", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Color.blue) ); Bridge.DefineGetter( ColorConstructor, "white", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Color.white) ); Bridge.DefineGetter( ColorConstructor, "black", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Color.black) ); Bridge.DefineGetter( ColorConstructor, "yellow", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Color.yellow) ); Bridge.DefineGetter( ColorConstructor, "cyan", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Color.cyan) ); Bridge.DefineGetter( ColorConstructor, "magenta", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Color.magenta) ); Bridge.DefineGetter( ColorConstructor, "gray", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Color.gray) ); Bridge.DefineGetter( ColorConstructor, "grey", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Color.grey) ); Bridge.DefineGetter( ColorConstructor, "clear", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Color.clear) ); // Static Methods ColorConstructor.SetProperty( "Lerp", Bridge.CreateFunction( "Lerp", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Color.Lerp(Bridge.GetBoxedExternal <UnityEngine.Color>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Color>(args[2]).wrapped, (float)args[3].ToDouble())) ) ); ColorConstructor.SetProperty( "LerpUnclamped", Bridge.CreateFunction( "LerpUnclamped", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Color.LerpUnclamped(Bridge.GetBoxedExternal <UnityEngine.Color>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Color>(args[2]).wrapped, (float)args[3].ToDouble())) ) ); /* * Color RGBToHSV * parameter H is out */ ColorConstructor.SetProperty( "HSVToRGB", Bridge.CreateFunction( "HSVToRGB", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Color.HSVToRGB((float)args[1].ToDouble(), (float)args[2].ToDouble(), (float)args[3].ToDouble())) ) ); ColorConstructor.SetProperty( "HSVToRGB", Bridge.CreateFunction( "HSVToRGB", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Color.HSVToRGB((float)args[1].ToDouble(), (float)args[2].ToDouble(), (float)args[3].ToDouble(), args[4].ToBoolean())) ) ); // Instance Fields Bridge.DefineGetterSetter( ColorPrototype, "r", Bridge.WithBoxedExternal <UnityEngine.Color>((o, args) => JavaScriptValue.FromDouble(o.wrapped.r)), Bridge.WithBoxedExternal <UnityEngine.Color>((o, args) => { o.wrapped.r = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( ColorPrototype, "g", Bridge.WithBoxedExternal <UnityEngine.Color>((o, args) => JavaScriptValue.FromDouble(o.wrapped.g)), Bridge.WithBoxedExternal <UnityEngine.Color>((o, args) => { o.wrapped.g = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( ColorPrototype, "b", Bridge.WithBoxedExternal <UnityEngine.Color>((o, args) => JavaScriptValue.FromDouble(o.wrapped.b)), Bridge.WithBoxedExternal <UnityEngine.Color>((o, args) => { o.wrapped.b = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( ColorPrototype, "a", Bridge.WithBoxedExternal <UnityEngine.Color>((o, args) => JavaScriptValue.FromDouble(o.wrapped.a)), Bridge.WithBoxedExternal <UnityEngine.Color>((o, args) => { o.wrapped.a = (float)args[1].ToDouble(); }) ); // Instance Property Accessors Bridge.DefineGetter( ColorPrototype, "grayscale", Bridge.WithBoxedExternal <UnityEngine.Color>((o, args) => JavaScriptValue.FromDouble(o.wrapped.grayscale)) ); Bridge.DefineGetter( ColorPrototype, "linear", Bridge.WithBoxedExternal <UnityEngine.Color>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.linear)) ); Bridge.DefineGetter( ColorPrototype, "gamma", Bridge.WithBoxedExternal <UnityEngine.Color>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.gamma)) ); Bridge.DefineGetter( ColorPrototype, "maxColorComponent", Bridge.WithBoxedExternal <UnityEngine.Color>((o, args) => JavaScriptValue.FromDouble(o.wrapped.maxColorComponent)) ); // Instance Methods ColorPrototype.SetProperty( "toString", Bridge.CreateFunction( "ToString", Bridge.WithBoxedExternal <UnityEngine.Color>((o, args) => { if (args.Length == 1) { return(JavaScriptValue.FromString(o.wrapped.ToString())); } else { return(JavaScriptValue.FromString(o.wrapped.ToString(args[1].ToString()))); } }) ) ); ColorPrototype.SetProperty( "GetHashCode", Bridge.CreateFunction( "GetHashCode", Bridge.WithBoxedExternal <UnityEngine.Color>((o, args) => JavaScriptValue.FromInt32(o.wrapped.GetHashCode())) ) ); // ColorPrototype.SetProperty( // "Equals", // Bridge.CreateFunction( // "Equals", // Bridge.WithBoxedExternal<UnityEngine.Color>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.Equals(Bridge.GetExternal<System.Object>(args[1])))) // ) // ); ColorPrototype.SetProperty( "Equals", Bridge.CreateFunction( "Equals", Bridge.WithBoxedExternal <UnityEngine.Color>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.Equals(Bridge.GetBoxedExternal <UnityEngine.Color>(args[1]).wrapped))) ) ); ColorPrototype.SetProperty( "ToColor32", Bridge.CreateFunction( "ToColor32", Bridge.WithBoxedExternal <UnityEngine.Color>((o, args) => { UnityEngine.Color32 asColor32 = o.wrapped; return(Bridge.CreateExternalWithPrototype(asColor32)); }) ) ); }
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 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())) ) ); }
static JavaScriptValue FromValue(object o) { if (o == null) { return(JavaScriptValue.Null); } switch (Type.GetTypeCode(o.GetType())) { case TypeCode.Boolean: return(JavaScriptValue.FromBoolean((bool)o)); case TypeCode.Char: return(JavaScriptValue.FromString(new string((char)o, 1))); case TypeCode.DateTime: return(JavaScriptValue.Null); case TypeCode.DBNull: case TypeCode.Empty: return(JavaScriptValue.Null); case TypeCode.Single: return(JavaScriptValue.FromDouble((double)(float)o)); case TypeCode.Double: return(JavaScriptValue.FromDouble((double)o)); case TypeCode.SByte: return(JavaScriptValue.FromInt32((int)(sbyte)o)); case TypeCode.Int16: return(JavaScriptValue.FromInt32((int)(Int16)o)); case TypeCode.Int32: return(JavaScriptValue.FromInt32((int)(Int32)o)); case TypeCode.Int64: return(JavaScriptValue.FromDouble((double)(Int64)o)); case TypeCode.Byte: return(JavaScriptValue.FromInt32((int)(byte)o)); case TypeCode.UInt16: return(JavaScriptValue.FromInt32((int)(UInt16)o)); case TypeCode.UInt32: return(JavaScriptValue.FromDouble((double)(UInt32)o)); case TypeCode.UInt64: return(JavaScriptValue.FromDouble((double)(UInt64)o)); case TypeCode.Decimal: return(JavaScriptValue.FromDouble((double)(decimal)o)); case TypeCode.String: return(JavaScriptValue.FromString((string)o)); case TypeCode.Object: if (o is JavaScriptNativeFunction) { var dg = (JavaScriptNativeFunction)o; GCHandle.Alloc(dg); return(JavaScriptValue.CreateFunction(dg)); } else if (o is Delegate) { return(Port.Util.WrapDelegate((Delegate)o)); } else if (o is JavaScriptValue) { return((JavaScriptValue)o); } else if (o is JSValue) { return(((JSValue)o).rawvalue); } else if (o is Type) { var wrapped = Port.TypeWrapper.Wrap((Type)o); return(wrapped.constructorValue); } else { var wrapped = Port.TypeWrapper.Wrap(o.GetType()); var rawvalue = JavaScriptValue.CreateExternalObject(GCHandle.ToIntPtr(GCHandle.Alloc(o)), HandleFinalizeDg); rawvalue.Prototype = wrapped.prototypeValue; return(rawvalue); } default: return(JavaScriptValue.Undefined); } }
public static void Register(JavaScriptContext context) { JavaScriptValue AsyncOperationPrototype; JavaScriptValue AsyncOperationConstructor = Bridge.CreateConstructor( typeof(UnityEngine.AsyncOperation), (args) => { throw new System.NotImplementedException(); }, out AsyncOperationPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .SetProperty("AsyncOperation", AsyncOperationConstructor); // Static Fields // Static Property Accessors // Static Methods // Instance Fields // Instance Property Accessors Bridge.DefineGetter( AsyncOperationPrototype, "isDone", Bridge.WithExternal <UnityEngine.AsyncOperation>((o, args) => JavaScriptValue.FromBoolean(o.isDone)) ); Bridge.DefineGetter( AsyncOperationPrototype, "progress", Bridge.WithExternal <UnityEngine.AsyncOperation>((o, args) => JavaScriptValue.FromDouble(o.progress)) ); Bridge.DefineGetterSetter( AsyncOperationPrototype, "priority", Bridge.WithExternal <UnityEngine.AsyncOperation>((o, args) => JavaScriptValue.FromInt32(o.priority)), Bridge.WithExternal <UnityEngine.AsyncOperation>((o, args) => { o.priority = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( AsyncOperationPrototype, "allowSceneActivation", Bridge.WithExternal <UnityEngine.AsyncOperation>((o, args) => JavaScriptValue.FromBoolean(o.allowSceneActivation)), Bridge.WithExternal <UnityEngine.AsyncOperation>((o, args) => { o.allowSceneActivation = args[1].ToBoolean(); }) ); // Instance Methods }
public static void Register(JavaScriptContext context) { JavaScriptValue MeshColliderPrototype; JavaScriptValue MeshColliderConstructor = Bridge.CreateConstructor( typeof(UnityEngine.MeshCollider), (args) => { throw new System.NotImplementedException(); }, out MeshColliderPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .SetProperty("MeshCollider", MeshColliderConstructor); // Static Fields // Static Property Accessors // Static Methods // Instance Fields // Instance Property Accessors Bridge.DefineGetterSetter( MeshColliderPrototype, "sharedMesh", Bridge.WithExternal <UnityEngine.MeshCollider>((o, args) => Bridge.CreateExternalWithPrototype(o.sharedMesh)), Bridge.WithExternal <UnityEngine.MeshCollider>((o, args) => { o.sharedMesh = Bridge.GetExternal <UnityEngine.Mesh>(args[1]); }) ); Bridge.DefineGetterSetter( MeshColliderPrototype, "convex", Bridge.WithExternal <UnityEngine.MeshCollider>((o, args) => JavaScriptValue.FromBoolean(o.convex)), Bridge.WithExternal <UnityEngine.MeshCollider>((o, args) => { o.convex = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( MeshColliderPrototype, "inflateMesh", Bridge.WithExternal <UnityEngine.MeshCollider>((o, args) => JavaScriptValue.FromBoolean(o.inflateMesh)), Bridge.WithExternal <UnityEngine.MeshCollider>((o, args) => { o.inflateMesh = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( MeshColliderPrototype, "cookingOptions", Bridge.WithExternal <UnityEngine.MeshCollider>((o, args) => Bridge.CreateExternalWithPrototype(o.cookingOptions)), Bridge.WithExternal <UnityEngine.MeshCollider>((o, args) => { o.cookingOptions = Bridge.GetExternal <UnityEngine.MeshColliderCookingOptions>(args[1]); }) ); Bridge.DefineGetterSetter( MeshColliderPrototype, "skinWidth", Bridge.WithExternal <UnityEngine.MeshCollider>((o, args) => JavaScriptValue.FromDouble(o.skinWidth)), Bridge.WithExternal <UnityEngine.MeshCollider>((o, args) => { o.skinWidth = (float)args[1].ToDouble(); }) ); // Instance Methods }
public static void Register(JavaScriptContext context) { JavaScriptValue FrustumPlanesPrototype; JavaScriptValue FrustumPlanesConstructor = Bridge.CreateConstructor( typeof(UnityEngine.FrustumPlanes), (args) => { throw new System.NotImplementedException(); }, out FrustumPlanesPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .SetProperty("FrustumPlanes", FrustumPlanesConstructor); // Static Fields // Static Property Accessors // Static Methods // Instance Fields Bridge.DefineGetterSetter( FrustumPlanesPrototype, "left", Bridge.WithBoxedExternal <UnityEngine.FrustumPlanes>((o, args) => JavaScriptValue.FromDouble(o.wrapped.left)), Bridge.WithBoxedExternal <UnityEngine.FrustumPlanes>((o, args) => { o.wrapped.left = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( FrustumPlanesPrototype, "right", Bridge.WithBoxedExternal <UnityEngine.FrustumPlanes>((o, args) => JavaScriptValue.FromDouble(o.wrapped.right)), Bridge.WithBoxedExternal <UnityEngine.FrustumPlanes>((o, args) => { o.wrapped.right = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( FrustumPlanesPrototype, "bottom", Bridge.WithBoxedExternal <UnityEngine.FrustumPlanes>((o, args) => JavaScriptValue.FromDouble(o.wrapped.bottom)), Bridge.WithBoxedExternal <UnityEngine.FrustumPlanes>((o, args) => { o.wrapped.bottom = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( FrustumPlanesPrototype, "top", Bridge.WithBoxedExternal <UnityEngine.FrustumPlanes>((o, args) => JavaScriptValue.FromDouble(o.wrapped.top)), Bridge.WithBoxedExternal <UnityEngine.FrustumPlanes>((o, args) => { o.wrapped.top = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( FrustumPlanesPrototype, "zNear", Bridge.WithBoxedExternal <UnityEngine.FrustumPlanes>((o, args) => JavaScriptValue.FromDouble(o.wrapped.zNear)), Bridge.WithBoxedExternal <UnityEngine.FrustumPlanes>((o, args) => { o.wrapped.zNear = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( FrustumPlanesPrototype, "zFar", Bridge.WithBoxedExternal <UnityEngine.FrustumPlanes>((o, args) => JavaScriptValue.FromDouble(o.wrapped.zFar)), Bridge.WithBoxedExternal <UnityEngine.FrustumPlanes>((o, args) => { o.wrapped.zFar = (float)args[1].ToDouble(); }) ); // Instance Property Accessors // Instance Methods }
public static void Register(JavaScriptContext context) { JavaScriptValue RigidbodyPrototype; JavaScriptValue RigidbodyConstructor = Bridge.CreateConstructor( typeof(UnityEngine.Rigidbody), (args) => { throw new System.NotImplementedException(); }, out RigidbodyPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .SetProperty("Rigidbody", RigidbodyConstructor); // Static Fields // Static Property Accessors // Static Methods // Instance Fields // Instance Property Accessors Bridge.DefineGetterSetter( RigidbodyPrototype, "velocity", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => Bridge.CreateExternalWithPrototype(o.velocity)), Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => { o.velocity = Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( RigidbodyPrototype, "angularVelocity", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => Bridge.CreateExternalWithPrototype(o.angularVelocity)), Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => { o.angularVelocity = Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( RigidbodyPrototype, "drag", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => JavaScriptValue.FromDouble(o.drag)), Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => { o.drag = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( RigidbodyPrototype, "angularDrag", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => JavaScriptValue.FromDouble(o.angularDrag)), Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => { o.angularDrag = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( RigidbodyPrototype, "mass", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => JavaScriptValue.FromDouble(o.mass)), Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => { o.mass = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( RigidbodyPrototype, "useGravity", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => JavaScriptValue.FromBoolean(o.useGravity)), Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => { o.useGravity = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( RigidbodyPrototype, "maxDepenetrationVelocity", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => JavaScriptValue.FromDouble(o.maxDepenetrationVelocity)), Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => { o.maxDepenetrationVelocity = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( RigidbodyPrototype, "isKinematic", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => JavaScriptValue.FromBoolean(o.isKinematic)), Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => { o.isKinematic = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( RigidbodyPrototype, "freezeRotation", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => JavaScriptValue.FromBoolean(o.freezeRotation)), Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => { o.freezeRotation = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( RigidbodyPrototype, "constraints", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => Bridge.CreateExternalWithPrototype(o.constraints)), Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => { o.constraints = Bridge.GetExternal <UnityEngine.RigidbodyConstraints>(args[1]); }) ); Bridge.DefineGetterSetter( RigidbodyPrototype, "collisionDetectionMode", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => Bridge.CreateExternalWithPrototype(o.collisionDetectionMode)), Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => { o.collisionDetectionMode = Bridge.GetExternal <UnityEngine.CollisionDetectionMode>(args[1]); }) ); Bridge.DefineGetterSetter( RigidbodyPrototype, "centerOfMass", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => Bridge.CreateExternalWithPrototype(o.centerOfMass)), Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => { o.centerOfMass = Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped; }) ); Bridge.DefineGetter( RigidbodyPrototype, "worldCenterOfMass", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => Bridge.CreateExternalWithPrototype(o.worldCenterOfMass)) ); Bridge.DefineGetterSetter( RigidbodyPrototype, "inertiaTensorRotation", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => Bridge.CreateExternalWithPrototype(o.inertiaTensorRotation)), Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => { o.inertiaTensorRotation = Bridge.GetBoxedExternal <UnityEngine.Quaternion>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( RigidbodyPrototype, "inertiaTensor", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => Bridge.CreateExternalWithPrototype(o.inertiaTensor)), Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => { o.inertiaTensor = Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( RigidbodyPrototype, "detectCollisions", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => JavaScriptValue.FromBoolean(o.detectCollisions)), Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => { o.detectCollisions = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( RigidbodyPrototype, "position", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => Bridge.CreateExternalWithPrototype(o.position)), Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => { o.position = Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( RigidbodyPrototype, "rotation", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => Bridge.CreateExternalWithPrototype(o.rotation)), Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => { o.rotation = Bridge.GetBoxedExternal <UnityEngine.Quaternion>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( RigidbodyPrototype, "interpolation", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => Bridge.CreateExternalWithPrototype(o.interpolation)), Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => { o.interpolation = Bridge.GetExternal <UnityEngine.RigidbodyInterpolation>(args[1]); }) ); Bridge.DefineGetterSetter( RigidbodyPrototype, "solverIterations", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => JavaScriptValue.FromInt32(o.solverIterations)), Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => { o.solverIterations = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( RigidbodyPrototype, "sleepThreshold", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => JavaScriptValue.FromDouble(o.sleepThreshold)), Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => { o.sleepThreshold = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( RigidbodyPrototype, "maxAngularVelocity", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => JavaScriptValue.FromDouble(o.maxAngularVelocity)), Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => { o.maxAngularVelocity = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( RigidbodyPrototype, "solverVelocityIterations", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => JavaScriptValue.FromInt32(o.solverVelocityIterations)), Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => { o.solverVelocityIterations = args[1].ToInt32(); }) ); // Instance Methods RigidbodyPrototype.SetProperty( "SetDensity", Bridge.CreateFunction( "SetDensity", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.SetDensity((float)args[1].ToDouble())) ) ); RigidbodyPrototype.SetProperty( "MovePosition", Bridge.CreateFunction( "MovePosition", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.MovePosition(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped)) ) ); RigidbodyPrototype.SetProperty( "MoveRotation", Bridge.CreateFunction( "MoveRotation", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.MoveRotation(Bridge.GetBoxedExternal <UnityEngine.Quaternion>(args[1]).wrapped)) ) ); RigidbodyPrototype.SetProperty( "Sleep", Bridge.CreateFunction( "Sleep", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.Sleep()) ) ); RigidbodyPrototype.SetProperty( "IsSleeping", Bridge.CreateFunction( "IsSleeping", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => JavaScriptValue.FromBoolean(o.IsSleeping())) ) ); RigidbodyPrototype.SetProperty( "WakeUp", Bridge.CreateFunction( "WakeUp", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.WakeUp()) ) ); RigidbodyPrototype.SetProperty( "ResetCenterOfMass", Bridge.CreateFunction( "ResetCenterOfMass", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.ResetCenterOfMass()) ) ); RigidbodyPrototype.SetProperty( "ResetInertiaTensor", Bridge.CreateFunction( "ResetInertiaTensor", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.ResetInertiaTensor()) ) ); RigidbodyPrototype.SetProperty( "GetRelativePointVelocity", Bridge.CreateFunction( "GetRelativePointVelocity", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => Bridge.CreateExternalWithPrototype(o.GetRelativePointVelocity(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))) ) ); RigidbodyPrototype.SetProperty( "GetPointVelocity", Bridge.CreateFunction( "GetPointVelocity", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => Bridge.CreateExternalWithPrototype(o.GetPointVelocity(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))) ) ); RigidbodyPrototype.SetProperty( "AddForce", Bridge.CreateFunction( "AddForce", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.AddForce(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.ForceMode>(args[2]))) ) ); RigidbodyPrototype.SetProperty( "AddForce", Bridge.CreateFunction( "AddForce", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.AddForce(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped)) ) ); RigidbodyPrototype.SetProperty( "AddForce", Bridge.CreateFunction( "AddForce", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.AddForce((float)args[1].ToDouble(), (float)args[2].ToDouble(), (float)args[3].ToDouble(), Bridge.GetExternal <UnityEngine.ForceMode>(args[4]))) ) ); RigidbodyPrototype.SetProperty( "AddForce", Bridge.CreateFunction( "AddForce", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.AddForce((float)args[1].ToDouble(), (float)args[2].ToDouble(), (float)args[3].ToDouble())) ) ); RigidbodyPrototype.SetProperty( "AddRelativeForce", Bridge.CreateFunction( "AddRelativeForce", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.AddRelativeForce(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.ForceMode>(args[2]))) ) ); RigidbodyPrototype.SetProperty( "AddRelativeForce", Bridge.CreateFunction( "AddRelativeForce", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.AddRelativeForce(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped)) ) ); RigidbodyPrototype.SetProperty( "AddRelativeForce", Bridge.CreateFunction( "AddRelativeForce", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.AddRelativeForce((float)args[1].ToDouble(), (float)args[2].ToDouble(), (float)args[3].ToDouble(), Bridge.GetExternal <UnityEngine.ForceMode>(args[4]))) ) ); RigidbodyPrototype.SetProperty( "AddRelativeForce", Bridge.CreateFunction( "AddRelativeForce", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.AddRelativeForce((float)args[1].ToDouble(), (float)args[2].ToDouble(), (float)args[3].ToDouble())) ) ); RigidbodyPrototype.SetProperty( "AddTorque", Bridge.CreateFunction( "AddTorque", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.AddTorque(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.ForceMode>(args[2]))) ) ); RigidbodyPrototype.SetProperty( "AddTorque", Bridge.CreateFunction( "AddTorque", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.AddTorque(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped)) ) ); RigidbodyPrototype.SetProperty( "AddTorque", Bridge.CreateFunction( "AddTorque", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.AddTorque((float)args[1].ToDouble(), (float)args[2].ToDouble(), (float)args[3].ToDouble(), Bridge.GetExternal <UnityEngine.ForceMode>(args[4]))) ) ); RigidbodyPrototype.SetProperty( "AddTorque", Bridge.CreateFunction( "AddTorque", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.AddTorque((float)args[1].ToDouble(), (float)args[2].ToDouble(), (float)args[3].ToDouble())) ) ); RigidbodyPrototype.SetProperty( "AddRelativeTorque", Bridge.CreateFunction( "AddRelativeTorque", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.AddRelativeTorque(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.ForceMode>(args[2]))) ) ); RigidbodyPrototype.SetProperty( "AddRelativeTorque", Bridge.CreateFunction( "AddRelativeTorque", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.AddRelativeTorque(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped)) ) ); RigidbodyPrototype.SetProperty( "AddRelativeTorque", Bridge.CreateFunction( "AddRelativeTorque", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.AddRelativeTorque((float)args[1].ToDouble(), (float)args[2].ToDouble(), (float)args[3].ToDouble(), Bridge.GetExternal <UnityEngine.ForceMode>(args[4]))) ) ); RigidbodyPrototype.SetProperty( "AddRelativeTorque", Bridge.CreateFunction( "AddRelativeTorque", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.AddRelativeTorque((float)args[1].ToDouble(), (float)args[2].ToDouble(), (float)args[3].ToDouble())) ) ); RigidbodyPrototype.SetProperty( "AddForceAtPosition", Bridge.CreateFunction( "AddForceAtPosition", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.AddForceAtPosition(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[2]).wrapped, Bridge.GetExternal <UnityEngine.ForceMode>(args[3]))) ) ); RigidbodyPrototype.SetProperty( "AddForceAtPosition", Bridge.CreateFunction( "AddForceAtPosition", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.AddForceAtPosition(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[2]).wrapped)) ) ); RigidbodyPrototype.SetProperty( "AddExplosionForce", Bridge.CreateFunction( "AddExplosionForce", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.AddExplosionForce((float)args[1].ToDouble(), Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[2]).wrapped, (float)args[3].ToDouble(), (float)args[4].ToDouble(), Bridge.GetExternal <UnityEngine.ForceMode>(args[5]))) ) ); RigidbodyPrototype.SetProperty( "AddExplosionForce", Bridge.CreateFunction( "AddExplosionForce", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.AddExplosionForce((float)args[1].ToDouble(), Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[2]).wrapped, (float)args[3].ToDouble(), (float)args[4].ToDouble())) ) ); RigidbodyPrototype.SetProperty( "AddExplosionForce", Bridge.CreateFunction( "AddExplosionForce", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => o.AddExplosionForce((float)args[1].ToDouble(), Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[2]).wrapped, (float)args[3].ToDouble())) ) ); RigidbodyPrototype.SetProperty( "ClosestPointOnBounds", Bridge.CreateFunction( "ClosestPointOnBounds", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => Bridge.CreateExternalWithPrototype(o.ClosestPointOnBounds(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))) ) ); /* * Rigidbody SweepTest * parameter hitInfo is out */ /* * Rigidbody SweepTest * parameter hitInfo is out */ /* * Rigidbody SweepTest * parameter hitInfo is out */ RigidbodyPrototype.SetProperty( "SweepTestAll", Bridge.CreateFunction( "SweepTestAll", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => Bridge.CreateExternalWithPrototype(o.SweepTestAll(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, (float)args[2].ToDouble(), Bridge.GetExternal <UnityEngine.QueryTriggerInteraction>(args[3])))) ) ); RigidbodyPrototype.SetProperty( "SweepTestAll", Bridge.CreateFunction( "SweepTestAll", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => Bridge.CreateExternalWithPrototype(o.SweepTestAll(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, (float)args[2].ToDouble()))) ) ); RigidbodyPrototype.SetProperty( "SweepTestAll", Bridge.CreateFunction( "SweepTestAll", Bridge.WithExternal <UnityEngine.Rigidbody>((o, args) => Bridge.CreateExternalWithPrototype(o.SweepTestAll(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))) ) ); }
public static void Register(JavaScriptContext context) { JavaScriptValue NetworkTransformPrototype; JavaScriptValue NetworkTransformConstructor = Bridge.CreateConstructor( typeof(UnityEngine.Networking.NetworkTransform), (args) => { throw new NotImplementedException(); }, out NetworkTransformPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .GetProperty("Networking") .SetProperty("NetworkTransform", NetworkTransformConstructor); // Static Fields // Static Property Accessors // Static Methods NetworkTransformConstructor.SetProperty( "HandleTransform", Bridge.CreateFunction( "HandleTransform", (args) => UnityEngine.Networking.NetworkTransform.HandleTransform(Bridge.GetExternal <UnityEngine.Networking.NetworkMessage>(args[1])) ) ); NetworkTransformConstructor.SetProperty( "SerializeVelocity3D", Bridge.CreateFunction( "SerializeVelocity3D", (args) => UnityEngine.Networking.NetworkTransform.SerializeVelocity3D(Bridge.GetExternal <UnityEngine.Networking.NetworkWriter>(args[1]), Bridge.GetExternal <UnityEngine.Vector3>(args[2]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[3])) ) ); NetworkTransformConstructor.SetProperty( "SerializeVelocity2D", Bridge.CreateFunction( "SerializeVelocity2D", (args) => UnityEngine.Networking.NetworkTransform.SerializeVelocity2D(Bridge.GetExternal <UnityEngine.Networking.NetworkWriter>(args[1]), Bridge.GetExternal <UnityEngine.Vector2>(args[2]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[3])) ) ); NetworkTransformConstructor.SetProperty( "SerializeRotation3D", Bridge.CreateFunction( "SerializeRotation3D", (args) => UnityEngine.Networking.NetworkTransform.SerializeRotation3D(Bridge.GetExternal <UnityEngine.Networking.NetworkWriter>(args[1]), Bridge.GetExternal <UnityEngine.Quaternion>(args[2]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.AxisSyncMode>(args[3]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[4])) ) ); NetworkTransformConstructor.SetProperty( "SerializeRotation2D", Bridge.CreateFunction( "SerializeRotation2D", (args) => UnityEngine.Networking.NetworkTransform.SerializeRotation2D(Bridge.GetExternal <UnityEngine.Networking.NetworkWriter>(args[1]), (float)args[2].ToDouble(), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[3])) ) ); NetworkTransformConstructor.SetProperty( "SerializeSpin3D", Bridge.CreateFunction( "SerializeSpin3D", (args) => UnityEngine.Networking.NetworkTransform.SerializeSpin3D(Bridge.GetExternal <UnityEngine.Networking.NetworkWriter>(args[1]), Bridge.GetExternal <UnityEngine.Vector3>(args[2]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.AxisSyncMode>(args[3]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[4])) ) ); NetworkTransformConstructor.SetProperty( "SerializeSpin2D", Bridge.CreateFunction( "SerializeSpin2D", (args) => UnityEngine.Networking.NetworkTransform.SerializeSpin2D(Bridge.GetExternal <UnityEngine.Networking.NetworkWriter>(args[1]), (float)args[2].ToDouble(), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[3])) ) ); NetworkTransformConstructor.SetProperty( "UnserializeVelocity3D", Bridge.CreateFunction( "UnserializeVelocity3D", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkTransform.UnserializeVelocity3D(Bridge.GetExternal <UnityEngine.Networking.NetworkReader>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[2]))) ) ); NetworkTransformConstructor.SetProperty( "UnserializeVelocity2D", Bridge.CreateFunction( "UnserializeVelocity2D", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkTransform.UnserializeVelocity2D(Bridge.GetExternal <UnityEngine.Networking.NetworkReader>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[2]))) ) ); NetworkTransformConstructor.SetProperty( "UnserializeRotation3D", Bridge.CreateFunction( "UnserializeRotation3D", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkTransform.UnserializeRotation3D(Bridge.GetExternal <UnityEngine.Networking.NetworkReader>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.AxisSyncMode>(args[2]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[3]))) ) ); NetworkTransformConstructor.SetProperty( "UnserializeRotation2D", Bridge.CreateFunction( "UnserializeRotation2D", (args) => JavaScriptValue.FromDouble(UnityEngine.Networking.NetworkTransform.UnserializeRotation2D(Bridge.GetExternal <UnityEngine.Networking.NetworkReader>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[2]))) ) ); NetworkTransformConstructor.SetProperty( "UnserializeSpin3D", Bridge.CreateFunction( "UnserializeSpin3D", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkTransform.UnserializeSpin3D(Bridge.GetExternal <UnityEngine.Networking.NetworkReader>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.AxisSyncMode>(args[2]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[3]))) ) ); NetworkTransformConstructor.SetProperty( "UnserializeSpin2D", Bridge.CreateFunction( "UnserializeSpin2D", (args) => JavaScriptValue.FromDouble(UnityEngine.Networking.NetworkTransform.UnserializeSpin2D(Bridge.GetExternal <UnityEngine.Networking.NetworkReader>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[2]))) ) ); // Instance Fields // Instance Property Accessors Bridge.DefineGetterSetter( NetworkTransformPrototype, "transformSyncMode", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => Bridge.CreateExternalWithPrototype(o.transformSyncMode)), WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => { o.transformSyncMode = Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.TransformSyncMode>(args[1]); }) ); Bridge.DefineGetterSetter( NetworkTransformPrototype, "sendInterval", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => JavaScriptValue.FromDouble(o.sendInterval)), WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => { o.sendInterval = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( NetworkTransformPrototype, "syncRotationAxis", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => Bridge.CreateExternalWithPrototype(o.syncRotationAxis)), WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => { o.syncRotationAxis = Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.AxisSyncMode>(args[1]); }) ); Bridge.DefineGetterSetter( NetworkTransformPrototype, "rotationSyncCompression", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => Bridge.CreateExternalWithPrototype(o.rotationSyncCompression)), WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => { o.rotationSyncCompression = Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[1]); }) ); Bridge.DefineGetterSetter( NetworkTransformPrototype, "syncSpin", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => JavaScriptValue.FromBoolean(o.syncSpin)), WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => { o.syncSpin = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( NetworkTransformPrototype, "movementTheshold", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => JavaScriptValue.FromDouble(o.movementTheshold)), WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => { o.movementTheshold = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( NetworkTransformPrototype, "velocityThreshold", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => JavaScriptValue.FromDouble(o.velocityThreshold)), WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => { o.velocityThreshold = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( NetworkTransformPrototype, "snapThreshold", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => JavaScriptValue.FromDouble(o.snapThreshold)), WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => { o.snapThreshold = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( NetworkTransformPrototype, "interpolateRotation", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => JavaScriptValue.FromDouble(o.interpolateRotation)), WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => { o.interpolateRotation = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( NetworkTransformPrototype, "interpolateMovement", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => JavaScriptValue.FromDouble(o.interpolateMovement)), WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => { o.interpolateMovement = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( NetworkTransformPrototype, "clientMoveCallback3D", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => Bridge.CreateExternalWithPrototype(o.clientMoveCallback3D)), WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => { o.clientMoveCallback3D = Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.ClientMoveCallback3D>(args[1]); }) ); Bridge.DefineGetterSetter( NetworkTransformPrototype, "clientMoveCallback2D", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => Bridge.CreateExternalWithPrototype(o.clientMoveCallback2D)), WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => { o.clientMoveCallback2D = Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.ClientMoveCallback2D>(args[1]); }) ); Bridge.DefineGetter( NetworkTransformPrototype, "characterContoller", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => Bridge.CreateExternalWithPrototype(o.characterContoller)) ); Bridge.DefineGetter( NetworkTransformPrototype, "rigidbody3D", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => Bridge.CreateExternalWithPrototype(o.rigidbody3D)) ); Bridge.DefineGetter( NetworkTransformPrototype, "rigidbody2D", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => Bridge.CreateExternalWithPrototype(o.rigidbody2D)) ); Bridge.DefineGetter( NetworkTransformPrototype, "lastSyncTime", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => JavaScriptValue.FromDouble(o.lastSyncTime)) ); Bridge.DefineGetter( NetworkTransformPrototype, "targetSyncPosition", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => Bridge.CreateExternalWithPrototype(o.targetSyncPosition)) ); Bridge.DefineGetter( NetworkTransformPrototype, "targetSyncVelocity", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => Bridge.CreateExternalWithPrototype(o.targetSyncVelocity)) ); Bridge.DefineGetter( NetworkTransformPrototype, "targetSyncRotation3D", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => Bridge.CreateExternalWithPrototype(o.targetSyncRotation3D)) ); Bridge.DefineGetter( NetworkTransformPrototype, "targetSyncRotation2D", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => JavaScriptValue.FromDouble(o.targetSyncRotation2D)) ); Bridge.DefineGetterSetter( NetworkTransformPrototype, "grounded", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => JavaScriptValue.FromBoolean(o.grounded)), WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => { o.grounded = args[1].ToBoolean(); }) ); // Instance Methods NetworkTransformPrototype.SetProperty( "OnStartServer", Bridge.CreateFunction( "OnStartServer", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => o.OnStartServer()) ) ); NetworkTransformPrototype.SetProperty( "OnSerialize", Bridge.CreateFunction( "OnSerialize", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => JavaScriptValue.FromBoolean(o.OnSerialize(Bridge.GetExternal <UnityEngine.Networking.NetworkWriter>(args[1]), args[2].ToBoolean()))) ) ); NetworkTransformPrototype.SetProperty( "OnDeserialize", Bridge.CreateFunction( "OnDeserialize", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => o.OnDeserialize(Bridge.GetExternal <UnityEngine.Networking.NetworkReader>(args[1]), args[2].ToBoolean())) ) ); NetworkTransformPrototype.SetProperty( "GetNetworkChannel", Bridge.CreateFunction( "GetNetworkChannel", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => JavaScriptValue.FromInt32(o.GetNetworkChannel())) ) ); NetworkTransformPrototype.SetProperty( "GetNetworkSendInterval", Bridge.CreateFunction( "GetNetworkSendInterval", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => JavaScriptValue.FromDouble(o.GetNetworkSendInterval())) ) ); NetworkTransformPrototype.SetProperty( "OnStartAuthority", Bridge.CreateFunction( "OnStartAuthority", WithExternal <UnityEngine.Networking.NetworkTransform>((o, args) => o.OnStartAuthority()) ) ); }
public static void Register(JavaScriptContext context) { JavaScriptValue CharacterControllerPrototype; JavaScriptValue CharacterControllerConstructor = Bridge.CreateConstructor( typeof(UnityEngine.CharacterController), (args) => { throw new System.NotImplementedException(); }, out CharacterControllerPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .SetProperty("CharacterController", CharacterControllerConstructor); // Static Fields // Static Property Accessors // Static Methods // Instance Fields // Instance Property Accessors Bridge.DefineGetter( CharacterControllerPrototype, "velocity", Bridge.WithExternal <UnityEngine.CharacterController>((o, args) => Bridge.CreateExternalWithPrototype(o.velocity)) ); Bridge.DefineGetter( CharacterControllerPrototype, "isGrounded", Bridge.WithExternal <UnityEngine.CharacterController>((o, args) => JavaScriptValue.FromBoolean(o.isGrounded)) ); Bridge.DefineGetter( CharacterControllerPrototype, "collisionFlags", Bridge.WithExternal <UnityEngine.CharacterController>((o, args) => Bridge.CreateExternalWithPrototype(o.collisionFlags)) ); Bridge.DefineGetterSetter( CharacterControllerPrototype, "radius", Bridge.WithExternal <UnityEngine.CharacterController>((o, args) => JavaScriptValue.FromDouble(o.radius)), Bridge.WithExternal <UnityEngine.CharacterController>((o, args) => { o.radius = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( CharacterControllerPrototype, "height", Bridge.WithExternal <UnityEngine.CharacterController>((o, args) => JavaScriptValue.FromDouble(o.height)), Bridge.WithExternal <UnityEngine.CharacterController>((o, args) => { o.height = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( CharacterControllerPrototype, "center", Bridge.WithExternal <UnityEngine.CharacterController>((o, args) => Bridge.CreateExternalWithPrototype(o.center)), Bridge.WithExternal <UnityEngine.CharacterController>((o, args) => { o.center = Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( CharacterControllerPrototype, "slopeLimit", Bridge.WithExternal <UnityEngine.CharacterController>((o, args) => JavaScriptValue.FromDouble(o.slopeLimit)), Bridge.WithExternal <UnityEngine.CharacterController>((o, args) => { o.slopeLimit = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( CharacterControllerPrototype, "stepOffset", Bridge.WithExternal <UnityEngine.CharacterController>((o, args) => JavaScriptValue.FromDouble(o.stepOffset)), Bridge.WithExternal <UnityEngine.CharacterController>((o, args) => { o.stepOffset = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( CharacterControllerPrototype, "skinWidth", Bridge.WithExternal <UnityEngine.CharacterController>((o, args) => JavaScriptValue.FromDouble(o.skinWidth)), Bridge.WithExternal <UnityEngine.CharacterController>((o, args) => { o.skinWidth = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( CharacterControllerPrototype, "minMoveDistance", Bridge.WithExternal <UnityEngine.CharacterController>((o, args) => JavaScriptValue.FromDouble(o.minMoveDistance)), Bridge.WithExternal <UnityEngine.CharacterController>((o, args) => { o.minMoveDistance = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( CharacterControllerPrototype, "detectCollisions", Bridge.WithExternal <UnityEngine.CharacterController>((o, args) => JavaScriptValue.FromBoolean(o.detectCollisions)), Bridge.WithExternal <UnityEngine.CharacterController>((o, args) => { o.detectCollisions = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( CharacterControllerPrototype, "enableOverlapRecovery", Bridge.WithExternal <UnityEngine.CharacterController>((o, args) => JavaScriptValue.FromBoolean(o.enableOverlapRecovery)), Bridge.WithExternal <UnityEngine.CharacterController>((o, args) => { o.enableOverlapRecovery = args[1].ToBoolean(); }) ); // Instance Methods CharacterControllerPrototype.SetProperty( "SimpleMove", Bridge.CreateFunction( "SimpleMove", Bridge.WithExternal <UnityEngine.CharacterController>((o, args) => JavaScriptValue.FromBoolean(o.SimpleMove(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))) ) ); CharacterControllerPrototype.SetProperty( "Move", Bridge.CreateFunction( "Move", Bridge.WithExternal <UnityEngine.CharacterController>((o, args) => Bridge.CreateExternalWithPrototype(o.Move(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))) ) ); }
public static void Register(JavaScriptContext context) { JavaScriptValue MaterialPrototype; JavaScriptValue MaterialConstructor = Bridge.CreateConstructor( typeof(UnityEngine.Material), (args) => { throw new System.NotImplementedException(); }, out MaterialPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .SetProperty("Material", MaterialConstructor); // Static Fields // Static Property Accessors // Static Methods // Instance Fields // Instance Property Accessors Bridge.DefineGetterSetter( MaterialPrototype, "shader", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.shader)), Bridge.WithExternal <UnityEngine.Material>((o, args) => { o.shader = Bridge.GetExternal <UnityEngine.Shader>(args[1]); }) ); Bridge.DefineGetterSetter( MaterialPrototype, "color", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.color)), Bridge.WithExternal <UnityEngine.Material>((o, args) => { o.color = Bridge.GetBoxedExternal <UnityEngine.Color>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( MaterialPrototype, "mainTexture", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.mainTexture)), Bridge.WithExternal <UnityEngine.Material>((o, args) => { o.mainTexture = Bridge.GetExternal <UnityEngine.Texture>(args[1]); }) ); Bridge.DefineGetterSetter( MaterialPrototype, "mainTextureOffset", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.mainTextureOffset)), Bridge.WithExternal <UnityEngine.Material>((o, args) => { o.mainTextureOffset = Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( MaterialPrototype, "mainTextureScale", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.mainTextureScale)), Bridge.WithExternal <UnityEngine.Material>((o, args) => { o.mainTextureScale = Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( MaterialPrototype, "renderQueue", Bridge.WithExternal <UnityEngine.Material>((o, args) => JavaScriptValue.FromInt32(o.renderQueue)), Bridge.WithExternal <UnityEngine.Material>((o, args) => { o.renderQueue = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( MaterialPrototype, "globalIlluminationFlags", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.globalIlluminationFlags)), Bridge.WithExternal <UnityEngine.Material>((o, args) => { o.globalIlluminationFlags = Bridge.GetExternal <UnityEngine.MaterialGlobalIlluminationFlags>(args[1]); }) ); Bridge.DefineGetterSetter( MaterialPrototype, "doubleSidedGI", Bridge.WithExternal <UnityEngine.Material>((o, args) => JavaScriptValue.FromBoolean(o.doubleSidedGI)), Bridge.WithExternal <UnityEngine.Material>((o, args) => { o.doubleSidedGI = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( MaterialPrototype, "enableInstancing", Bridge.WithExternal <UnityEngine.Material>((o, args) => JavaScriptValue.FromBoolean(o.enableInstancing)), Bridge.WithExternal <UnityEngine.Material>((o, args) => { o.enableInstancing = args[1].ToBoolean(); }) ); Bridge.DefineGetter( MaterialPrototype, "passCount", Bridge.WithExternal <UnityEngine.Material>((o, args) => JavaScriptValue.FromInt32(o.passCount)) ); Bridge.DefineGetterSetter( MaterialPrototype, "shaderKeywords", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.shaderKeywords)), Bridge.WithExternal <UnityEngine.Material>((o, args) => { o.shaderKeywords = Bridge.GetExternal <System.String[]>(args[1]); }) ); // Instance Methods MaterialPrototype.SetProperty( "GetTexturePropertyNames", Bridge.CreateFunction( "GetTexturePropertyNames", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.GetTexturePropertyNames())) ) ); MaterialPrototype.SetProperty( "GetTexturePropertyNameIDs", Bridge.CreateFunction( "GetTexturePropertyNameIDs", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.GetTexturePropertyNameIDs())) ) ); /* * Material GetTexturePropertyNames * System.Collections.Generic.List`1[System.String] has generics */ /* * Material GetTexturePropertyNameIDs * System.Collections.Generic.List`1[System.Int32] has generics */ MaterialPrototype.SetProperty( "HasProperty", Bridge.CreateFunction( "HasProperty", Bridge.WithExternal <UnityEngine.Material>((o, args) => JavaScriptValue.FromBoolean(o.HasProperty(args[1].ToInt32()))) ) ); MaterialPrototype.SetProperty( "HasProperty", Bridge.CreateFunction( "HasProperty", Bridge.WithExternal <UnityEngine.Material>((o, args) => JavaScriptValue.FromBoolean(o.HasProperty(args[1].ToString()))) ) ); MaterialPrototype.SetProperty( "EnableKeyword", Bridge.CreateFunction( "EnableKeyword", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.EnableKeyword(args[1].ToString())) ) ); MaterialPrototype.SetProperty( "DisableKeyword", Bridge.CreateFunction( "DisableKeyword", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.DisableKeyword(args[1].ToString())) ) ); MaterialPrototype.SetProperty( "IsKeywordEnabled", Bridge.CreateFunction( "IsKeywordEnabled", Bridge.WithExternal <UnityEngine.Material>((o, args) => JavaScriptValue.FromBoolean(o.IsKeywordEnabled(args[1].ToString()))) ) ); MaterialPrototype.SetProperty( "SetShaderPassEnabled", Bridge.CreateFunction( "SetShaderPassEnabled", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetShaderPassEnabled(args[1].ToString(), args[2].ToBoolean())) ) ); MaterialPrototype.SetProperty( "GetShaderPassEnabled", Bridge.CreateFunction( "GetShaderPassEnabled", Bridge.WithExternal <UnityEngine.Material>((o, args) => JavaScriptValue.FromBoolean(o.GetShaderPassEnabled(args[1].ToString()))) ) ); MaterialPrototype.SetProperty( "GetPassName", Bridge.CreateFunction( "GetPassName", Bridge.WithExternal <UnityEngine.Material>((o, args) => JavaScriptValue.FromString(o.GetPassName(args[1].ToInt32()))) ) ); MaterialPrototype.SetProperty( "FindPass", Bridge.CreateFunction( "FindPass", Bridge.WithExternal <UnityEngine.Material>((o, args) => JavaScriptValue.FromInt32(o.FindPass(args[1].ToString()))) ) ); MaterialPrototype.SetProperty( "SetOverrideTag", Bridge.CreateFunction( "SetOverrideTag", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetOverrideTag(args[1].ToString(), args[2].ToString())) ) ); MaterialPrototype.SetProperty( "GetTag", Bridge.CreateFunction( "GetTag", Bridge.WithExternal <UnityEngine.Material>((o, args) => JavaScriptValue.FromString(o.GetTag(args[1].ToString(), args[2].ToBoolean(), args[3].ToString()))) ) ); MaterialPrototype.SetProperty( "GetTag", Bridge.CreateFunction( "GetTag", Bridge.WithExternal <UnityEngine.Material>((o, args) => JavaScriptValue.FromString(o.GetTag(args[1].ToString(), args[2].ToBoolean()))) ) ); MaterialPrototype.SetProperty( "Lerp", Bridge.CreateFunction( "Lerp", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.Lerp(Bridge.GetExternal <UnityEngine.Material>(args[1]), Bridge.GetExternal <UnityEngine.Material>(args[2]), (float)args[3].ToDouble())) ) ); MaterialPrototype.SetProperty( "SetPass", Bridge.CreateFunction( "SetPass", Bridge.WithExternal <UnityEngine.Material>((o, args) => JavaScriptValue.FromBoolean(o.SetPass(args[1].ToInt32()))) ) ); MaterialPrototype.SetProperty( "CopyPropertiesFromMaterial", Bridge.CreateFunction( "CopyPropertiesFromMaterial", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.CopyPropertiesFromMaterial(Bridge.GetExternal <UnityEngine.Material>(args[1]))) ) ); MaterialPrototype.SetProperty( "SetFloat", Bridge.CreateFunction( "SetFloat", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetFloat(args[1].ToString(), (float)args[2].ToDouble())) ) ); MaterialPrototype.SetProperty( "SetFloat", Bridge.CreateFunction( "SetFloat", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetFloat(args[1].ToInt32(), (float)args[2].ToDouble())) ) ); MaterialPrototype.SetProperty( "SetInt", Bridge.CreateFunction( "SetInt", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetInt(args[1].ToString(), args[2].ToInt32())) ) ); MaterialPrototype.SetProperty( "SetInt", Bridge.CreateFunction( "SetInt", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetInt(args[1].ToInt32(), args[2].ToInt32())) ) ); MaterialPrototype.SetProperty( "SetColor", Bridge.CreateFunction( "SetColor", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetColor(args[1].ToString(), Bridge.GetBoxedExternal <UnityEngine.Color>(args[2]).wrapped)) ) ); MaterialPrototype.SetProperty( "SetColor", Bridge.CreateFunction( "SetColor", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetColor(args[1].ToInt32(), Bridge.GetBoxedExternal <UnityEngine.Color>(args[2]).wrapped)) ) ); MaterialPrototype.SetProperty( "SetVector", Bridge.CreateFunction( "SetVector", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetVector(args[1].ToString(), Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[2]).wrapped)) ) ); MaterialPrototype.SetProperty( "SetVector", Bridge.CreateFunction( "SetVector", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetVector(args[1].ToInt32(), Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[2]).wrapped)) ) ); MaterialPrototype.SetProperty( "SetMatrix", Bridge.CreateFunction( "SetMatrix", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetMatrix(args[1].ToString(), Bridge.GetBoxedExternal <UnityEngine.Matrix4x4>(args[2]).wrapped)) ) ); MaterialPrototype.SetProperty( "SetMatrix", Bridge.CreateFunction( "SetMatrix", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetMatrix(args[1].ToInt32(), Bridge.GetBoxedExternal <UnityEngine.Matrix4x4>(args[2]).wrapped)) ) ); MaterialPrototype.SetProperty( "SetTexture", Bridge.CreateFunction( "SetTexture", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetTexture(args[1].ToString(), Bridge.GetExternal <UnityEngine.Texture>(args[2]))) ) ); MaterialPrototype.SetProperty( "SetTexture", Bridge.CreateFunction( "SetTexture", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetTexture(args[1].ToInt32(), Bridge.GetExternal <UnityEngine.Texture>(args[2]))) ) ); MaterialPrototype.SetProperty( "SetBuffer", Bridge.CreateFunction( "SetBuffer", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetBuffer(args[1].ToString(), Bridge.GetExternal <UnityEngine.ComputeBuffer>(args[2]))) ) ); MaterialPrototype.SetProperty( "SetBuffer", Bridge.CreateFunction( "SetBuffer", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetBuffer(args[1].ToInt32(), Bridge.GetExternal <UnityEngine.ComputeBuffer>(args[2]))) ) ); /* * Material SetFloatArray * System.Collections.Generic.List`1[System.Single] has generics */ /* * Material SetFloatArray * System.Collections.Generic.List`1[System.Single] has generics */ MaterialPrototype.SetProperty( "SetFloatArray", Bridge.CreateFunction( "SetFloatArray", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetFloatArray(args[1].ToString(), Bridge.GetExternal <System.Single[]>(args[2]))) ) ); MaterialPrototype.SetProperty( "SetFloatArray", Bridge.CreateFunction( "SetFloatArray", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetFloatArray(args[1].ToInt32(), Bridge.GetExternal <System.Single[]>(args[2]))) ) ); /* * Material SetColorArray * System.Collections.Generic.List`1[UnityEngine.Color] has generics */ /* * Material SetColorArray * System.Collections.Generic.List`1[UnityEngine.Color] has generics */ MaterialPrototype.SetProperty( "SetColorArray", Bridge.CreateFunction( "SetColorArray", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetColorArray(args[1].ToString(), Bridge.GetExternal <UnityEngine.Color[]>(args[2]))) ) ); MaterialPrototype.SetProperty( "SetColorArray", Bridge.CreateFunction( "SetColorArray", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetColorArray(args[1].ToInt32(), Bridge.GetExternal <UnityEngine.Color[]>(args[2]))) ) ); /* * Material SetVectorArray * System.Collections.Generic.List`1[UnityEngine.Vector4] has generics */ /* * Material SetVectorArray * System.Collections.Generic.List`1[UnityEngine.Vector4] has generics */ MaterialPrototype.SetProperty( "SetVectorArray", Bridge.CreateFunction( "SetVectorArray", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetVectorArray(args[1].ToString(), Bridge.GetExternal <UnityEngine.Vector4[]>(args[2]))) ) ); MaterialPrototype.SetProperty( "SetVectorArray", Bridge.CreateFunction( "SetVectorArray", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetVectorArray(args[1].ToInt32(), Bridge.GetExternal <UnityEngine.Vector4[]>(args[2]))) ) ); /* * Material SetMatrixArray * System.Collections.Generic.List`1[UnityEngine.Matrix4x4] has generics */ /* * Material SetMatrixArray * System.Collections.Generic.List`1[UnityEngine.Matrix4x4] has generics */ MaterialPrototype.SetProperty( "SetMatrixArray", Bridge.CreateFunction( "SetMatrixArray", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetMatrixArray(args[1].ToString(), Bridge.GetExternal <UnityEngine.Matrix4x4[]>(args[2]))) ) ); MaterialPrototype.SetProperty( "SetMatrixArray", Bridge.CreateFunction( "SetMatrixArray", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetMatrixArray(args[1].ToInt32(), Bridge.GetExternal <UnityEngine.Matrix4x4[]>(args[2]))) ) ); MaterialPrototype.SetProperty( "GetFloat", Bridge.CreateFunction( "GetFloat", Bridge.WithExternal <UnityEngine.Material>((o, args) => JavaScriptValue.FromDouble(o.GetFloat(args[1].ToString()))) ) ); MaterialPrototype.SetProperty( "GetFloat", Bridge.CreateFunction( "GetFloat", Bridge.WithExternal <UnityEngine.Material>((o, args) => JavaScriptValue.FromDouble(o.GetFloat(args[1].ToInt32()))) ) ); MaterialPrototype.SetProperty( "GetInt", Bridge.CreateFunction( "GetInt", Bridge.WithExternal <UnityEngine.Material>((o, args) => JavaScriptValue.FromInt32(o.GetInt(args[1].ToString()))) ) ); MaterialPrototype.SetProperty( "GetInt", Bridge.CreateFunction( "GetInt", Bridge.WithExternal <UnityEngine.Material>((o, args) => JavaScriptValue.FromInt32(o.GetInt(args[1].ToInt32()))) ) ); MaterialPrototype.SetProperty( "GetColor", Bridge.CreateFunction( "GetColor", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.GetColor(args[1].ToString()))) ) ); MaterialPrototype.SetProperty( "GetColor", Bridge.CreateFunction( "GetColor", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.GetColor(args[1].ToInt32()))) ) ); MaterialPrototype.SetProperty( "GetVector", Bridge.CreateFunction( "GetVector", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.GetVector(args[1].ToString()))) ) ); MaterialPrototype.SetProperty( "GetVector", Bridge.CreateFunction( "GetVector", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.GetVector(args[1].ToInt32()))) ) ); MaterialPrototype.SetProperty( "GetMatrix", Bridge.CreateFunction( "GetMatrix", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.GetMatrix(args[1].ToString()))) ) ); MaterialPrototype.SetProperty( "GetMatrix", Bridge.CreateFunction( "GetMatrix", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.GetMatrix(args[1].ToInt32()))) ) ); MaterialPrototype.SetProperty( "GetTexture", Bridge.CreateFunction( "GetTexture", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.GetTexture(args[1].ToString()))) ) ); MaterialPrototype.SetProperty( "GetTexture", Bridge.CreateFunction( "GetTexture", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.GetTexture(args[1].ToInt32()))) ) ); MaterialPrototype.SetProperty( "GetFloatArray", Bridge.CreateFunction( "GetFloatArray", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.GetFloatArray(args[1].ToString()))) ) ); MaterialPrototype.SetProperty( "GetFloatArray", Bridge.CreateFunction( "GetFloatArray", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.GetFloatArray(args[1].ToInt32()))) ) ); MaterialPrototype.SetProperty( "GetColorArray", Bridge.CreateFunction( "GetColorArray", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.GetColorArray(args[1].ToString()))) ) ); MaterialPrototype.SetProperty( "GetColorArray", Bridge.CreateFunction( "GetColorArray", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.GetColorArray(args[1].ToInt32()))) ) ); MaterialPrototype.SetProperty( "GetVectorArray", Bridge.CreateFunction( "GetVectorArray", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.GetVectorArray(args[1].ToString()))) ) ); MaterialPrototype.SetProperty( "GetVectorArray", Bridge.CreateFunction( "GetVectorArray", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.GetVectorArray(args[1].ToInt32()))) ) ); MaterialPrototype.SetProperty( "GetMatrixArray", Bridge.CreateFunction( "GetMatrixArray", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.GetMatrixArray(args[1].ToString()))) ) ); MaterialPrototype.SetProperty( "GetMatrixArray", Bridge.CreateFunction( "GetMatrixArray", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.GetMatrixArray(args[1].ToInt32()))) ) ); /* * Material GetFloatArray * System.Collections.Generic.List`1[System.Single] has generics */ /* * Material GetFloatArray * System.Collections.Generic.List`1[System.Single] has generics */ /* * Material GetColorArray * System.Collections.Generic.List`1[UnityEngine.Color] has generics */ /* * Material GetColorArray * System.Collections.Generic.List`1[UnityEngine.Color] has generics */ /* * Material GetVectorArray * System.Collections.Generic.List`1[UnityEngine.Vector4] has generics */ /* * Material GetVectorArray * System.Collections.Generic.List`1[UnityEngine.Vector4] has generics */ /* * Material GetMatrixArray * System.Collections.Generic.List`1[UnityEngine.Matrix4x4] has generics */ /* * Material GetMatrixArray * System.Collections.Generic.List`1[UnityEngine.Matrix4x4] has generics */ MaterialPrototype.SetProperty( "SetTextureOffset", Bridge.CreateFunction( "SetTextureOffset", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetTextureOffset(args[1].ToString(), Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[2]).wrapped)) ) ); MaterialPrototype.SetProperty( "SetTextureOffset", Bridge.CreateFunction( "SetTextureOffset", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetTextureOffset(args[1].ToInt32(), Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[2]).wrapped)) ) ); MaterialPrototype.SetProperty( "SetTextureScale", Bridge.CreateFunction( "SetTextureScale", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetTextureScale(args[1].ToString(), Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[2]).wrapped)) ) ); MaterialPrototype.SetProperty( "SetTextureScale", Bridge.CreateFunction( "SetTextureScale", Bridge.WithExternal <UnityEngine.Material>((o, args) => o.SetTextureScale(args[1].ToInt32(), Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[2]).wrapped)) ) ); MaterialPrototype.SetProperty( "GetTextureOffset", Bridge.CreateFunction( "GetTextureOffset", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.GetTextureOffset(args[1].ToString()))) ) ); MaterialPrototype.SetProperty( "GetTextureOffset", Bridge.CreateFunction( "GetTextureOffset", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.GetTextureOffset(args[1].ToInt32()))) ) ); MaterialPrototype.SetProperty( "GetTextureScale", Bridge.CreateFunction( "GetTextureScale", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.GetTextureScale(args[1].ToString()))) ) ); MaterialPrototype.SetProperty( "GetTextureScale", Bridge.CreateFunction( "GetTextureScale", Bridge.WithExternal <UnityEngine.Material>((o, args) => Bridge.CreateExternalWithPrototype(o.GetTextureScale(args[1].ToInt32()))) ) ); }
public static void Register(JavaScriptContext context) { JavaScriptValue InputPrototype; JavaScriptValue InputConstructor = Bridge.CreateConstructor( typeof(UnityEngine.Input), (args) => { throw new System.NotImplementedException(); }, out InputPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .SetProperty("Input", InputConstructor); // Static Fields // Static Property Accessors Bridge.DefineGetterSetter( InputConstructor, "compensateSensors", (args) => JavaScriptValue.FromBoolean(UnityEngine.Input.compensateSensors), (args) => { UnityEngine.Input.compensateSensors = args[1].ToBoolean(); } ); Bridge.DefineGetter( InputConstructor, "gyro", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Input.gyro) ); Bridge.DefineGetter( InputConstructor, "mousePosition", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Input.mousePosition) ); Bridge.DefineGetter( InputConstructor, "mouseScrollDelta", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Input.mouseScrollDelta) ); Bridge.DefineGetter( InputConstructor, "mousePresent", (args) => JavaScriptValue.FromBoolean(UnityEngine.Input.mousePresent) ); Bridge.DefineGetterSetter( InputConstructor, "simulateMouseWithTouches", (args) => JavaScriptValue.FromBoolean(UnityEngine.Input.simulateMouseWithTouches), (args) => { UnityEngine.Input.simulateMouseWithTouches = args[1].ToBoolean(); } ); Bridge.DefineGetter( InputConstructor, "anyKey", (args) => JavaScriptValue.FromBoolean(UnityEngine.Input.anyKey) ); Bridge.DefineGetter( InputConstructor, "anyKeyDown", (args) => JavaScriptValue.FromBoolean(UnityEngine.Input.anyKeyDown) ); Bridge.DefineGetter( InputConstructor, "inputString", (args) => JavaScriptValue.FromString(UnityEngine.Input.inputString) ); Bridge.DefineGetter( InputConstructor, "acceleration", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Input.acceleration) ); Bridge.DefineGetter( InputConstructor, "accelerationEvents", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Input.accelerationEvents) ); Bridge.DefineGetter( InputConstructor, "accelerationEventCount", (args) => JavaScriptValue.FromInt32(UnityEngine.Input.accelerationEventCount) ); Bridge.DefineGetter( InputConstructor, "touches", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Input.touches) ); Bridge.DefineGetter( InputConstructor, "touchCount", (args) => JavaScriptValue.FromInt32(UnityEngine.Input.touchCount) ); Bridge.DefineGetter( InputConstructor, "touchPressureSupported", (args) => JavaScriptValue.FromBoolean(UnityEngine.Input.touchPressureSupported) ); Bridge.DefineGetter( InputConstructor, "stylusTouchSupported", (args) => JavaScriptValue.FromBoolean(UnityEngine.Input.stylusTouchSupported) ); Bridge.DefineGetter( InputConstructor, "touchSupported", (args) => JavaScriptValue.FromBoolean(UnityEngine.Input.touchSupported) ); Bridge.DefineGetterSetter( InputConstructor, "multiTouchEnabled", (args) => JavaScriptValue.FromBoolean(UnityEngine.Input.multiTouchEnabled), (args) => { UnityEngine.Input.multiTouchEnabled = args[1].ToBoolean(); } ); Bridge.DefineGetter( InputConstructor, "location", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Input.location) ); Bridge.DefineGetter( InputConstructor, "compass", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Input.compass) ); Bridge.DefineGetter( InputConstructor, "deviceOrientation", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Input.deviceOrientation) ); Bridge.DefineGetterSetter( InputConstructor, "imeCompositionMode", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Input.imeCompositionMode), (args) => { UnityEngine.Input.imeCompositionMode = Bridge.GetExternal <UnityEngine.IMECompositionMode>(args[1]); } ); Bridge.DefineGetter( InputConstructor, "compositionString", (args) => JavaScriptValue.FromString(UnityEngine.Input.compositionString) ); Bridge.DefineGetter( InputConstructor, "imeIsSelected", (args) => JavaScriptValue.FromBoolean(UnityEngine.Input.imeIsSelected) ); Bridge.DefineGetterSetter( InputConstructor, "compositionCursorPos", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Input.compositionCursorPos), (args) => { UnityEngine.Input.compositionCursorPos = Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[1]).wrapped; } ); Bridge.DefineGetterSetter( InputConstructor, "backButtonLeavesApp", (args) => JavaScriptValue.FromBoolean(UnityEngine.Input.backButtonLeavesApp), (args) => { UnityEngine.Input.backButtonLeavesApp = args[1].ToBoolean(); } ); // Static Methods InputConstructor.SetProperty( "GetAxis", Bridge.CreateFunction( "GetAxis", (args) => JavaScriptValue.FromDouble(UnityEngine.Input.GetAxis(args[1].ToString())) ) ); InputConstructor.SetProperty( "GetAxisRaw", Bridge.CreateFunction( "GetAxisRaw", (args) => JavaScriptValue.FromDouble(UnityEngine.Input.GetAxisRaw(args[1].ToString())) ) ); InputConstructor.SetProperty( "GetButton", Bridge.CreateFunction( "GetButton", (args) => JavaScriptValue.FromBoolean(UnityEngine.Input.GetButton(args[1].ToString())) ) ); InputConstructor.SetProperty( "GetButtonDown", Bridge.CreateFunction( "GetButtonDown", (args) => JavaScriptValue.FromBoolean(UnityEngine.Input.GetButtonDown(args[1].ToString())) ) ); InputConstructor.SetProperty( "GetButtonUp", Bridge.CreateFunction( "GetButtonUp", (args) => JavaScriptValue.FromBoolean(UnityEngine.Input.GetButtonUp(args[1].ToString())) ) ); InputConstructor.SetProperty( "GetKey", Bridge.CreateFunction( "GetKey", (args) => { if (args[1].ValueType == JavaScriptValueType.String) { return(JavaScriptValue.FromBoolean(UnityEngine.Input.GetKey(args[1].ToString()))); } else { return(JavaScriptValue.FromBoolean(UnityEngine.Input.GetKey(Bridge.GetExternal <UnityEngine.KeyCode>(args[1])))); } } ) ); InputConstructor.SetProperty( "GetKeyDown", Bridge.CreateFunction( "GetKeyDown", (args) => { if (args[1].ValueType == JavaScriptValueType.String) { return(JavaScriptValue.FromBoolean(UnityEngine.Input.GetKeyDown(args[1].ToString()))); } else { return(JavaScriptValue.FromBoolean(UnityEngine.Input.GetKeyDown(Bridge.GetExternal <UnityEngine.KeyCode>(args[1])))); } } ) ); InputConstructor.SetProperty( "GetKeyUp", Bridge.CreateFunction( "GetKeyUp", (args) => { if (args[1].ValueType == JavaScriptValueType.String) { return(JavaScriptValue.FromBoolean(UnityEngine.Input.GetKeyUp(args[1].ToString()))); } else { return(JavaScriptValue.FromBoolean(UnityEngine.Input.GetKeyUp(Bridge.GetExternal <UnityEngine.KeyCode>(args[1])))); } } ) ); InputConstructor.SetProperty( "GetJoystickNames", Bridge.CreateFunction( "GetJoystickNames", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Input.GetJoystickNames()) ) ); #if UNITY_EDITOR InputConstructor.SetProperty( "IsJoystickPreconfigured", Bridge.CreateFunction( "IsJoystickPreconfigured", (args) => JavaScriptValue.FromBoolean(UnityEngine.Input.IsJoystickPreconfigured(args[1].ToString())) ) ); #endif InputConstructor.SetProperty( "GetMouseButton", Bridge.CreateFunction( "GetMouseButton", (args) => JavaScriptValue.FromBoolean(UnityEngine.Input.GetMouseButton(args[1].ToInt32())) ) ); InputConstructor.SetProperty( "GetMouseButtonDown", Bridge.CreateFunction( "GetMouseButtonDown", (args) => JavaScriptValue.FromBoolean(UnityEngine.Input.GetMouseButtonDown(args[1].ToInt32())) ) ); InputConstructor.SetProperty( "GetMouseButtonUp", Bridge.CreateFunction( "GetMouseButtonUp", (args) => JavaScriptValue.FromBoolean(UnityEngine.Input.GetMouseButtonUp(args[1].ToInt32())) ) ); InputConstructor.SetProperty( "ResetInputAxes", Bridge.CreateFunction( "ResetInputAxes", (args) => UnityEngine.Input.ResetInputAxes() ) ); InputConstructor.SetProperty( "GetAccelerationEvent", Bridge.CreateFunction( "GetAccelerationEvent", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Input.GetAccelerationEvent(args[1].ToInt32())) ) ); InputConstructor.SetProperty( "GetTouch", Bridge.CreateFunction( "GetTouch", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Input.GetTouch(args[1].ToInt32())) ) ); // Instance Fields // Instance Property Accessors // Instance Methods }
public static void Register(JavaScriptContext context) { JavaScriptValue ColliderPrototype; JavaScriptValue ColliderConstructor = Bridge.CreateConstructor( typeof(UnityEngine.Collider), (args) => { throw new System.NotImplementedException(); }, out ColliderPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .SetProperty("Collider", ColliderConstructor); // Static Fields // Static Property Accessors // Static Methods // Instance Fields // Instance Property Accessors Bridge.DefineGetterSetter( ColliderPrototype, "enabled", Bridge.WithExternal <UnityEngine.Collider>((o, args) => JavaScriptValue.FromBoolean(o.enabled)), Bridge.WithExternal <UnityEngine.Collider>((o, args) => { o.enabled = args[1].ToBoolean(); }) ); Bridge.DefineGetter( ColliderPrototype, "attachedRigidbody", Bridge.WithExternal <UnityEngine.Collider>((o, args) => Bridge.CreateExternalWithPrototype(o.attachedRigidbody)) ); Bridge.DefineGetterSetter( ColliderPrototype, "isTrigger", Bridge.WithExternal <UnityEngine.Collider>((o, args) => JavaScriptValue.FromBoolean(o.isTrigger)), Bridge.WithExternal <UnityEngine.Collider>((o, args) => { o.isTrigger = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( ColliderPrototype, "contactOffset", Bridge.WithExternal <UnityEngine.Collider>((o, args) => JavaScriptValue.FromDouble(o.contactOffset)), Bridge.WithExternal <UnityEngine.Collider>((o, args) => { o.contactOffset = (float)args[1].ToDouble(); }) ); Bridge.DefineGetter( ColliderPrototype, "bounds", Bridge.WithExternal <UnityEngine.Collider>((o, args) => Bridge.CreateExternalWithPrototype(o.bounds)) ); Bridge.DefineGetterSetter( ColliderPrototype, "sharedMaterial", Bridge.WithExternal <UnityEngine.Collider>((o, args) => Bridge.CreateExternalWithPrototype(o.sharedMaterial)), Bridge.WithExternal <UnityEngine.Collider>((o, args) => { o.sharedMaterial = Bridge.GetExternal <UnityEngine.PhysicMaterial>(args[1]); }) ); Bridge.DefineGetterSetter( ColliderPrototype, "material", Bridge.WithExternal <UnityEngine.Collider>((o, args) => Bridge.CreateExternalWithPrototype(o.material)), Bridge.WithExternal <UnityEngine.Collider>((o, args) => { o.material = Bridge.GetExternal <UnityEngine.PhysicMaterial>(args[1]); }) ); // Instance Methods ColliderPrototype.SetProperty( "ClosestPoint", Bridge.CreateFunction( "ClosestPoint", Bridge.WithExternal <UnityEngine.Collider>((o, args) => Bridge.CreateExternalWithPrototype(o.ClosestPoint(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))) ) ); /* * Collider Raycast * parameter hitInfo is out */ ColliderPrototype.SetProperty( "ClosestPointOnBounds", Bridge.CreateFunction( "ClosestPointOnBounds", Bridge.WithExternal <UnityEngine.Collider>((o, args) => Bridge.CreateExternalWithPrototype(o.ClosestPointOnBounds(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))) ) ); }
public static void Register(JavaScriptContext context) { JavaScriptValue PlanePrototype; JavaScriptValue PlaneConstructor = Bridge.CreateConstructor( typeof(UnityEngine.Plane), (args) => { throw new System.NotImplementedException(); }, out PlanePrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .SetProperty("Plane", PlaneConstructor); // Static Fields // Static Property Accessors // Static Methods PlaneConstructor.SetProperty( "Translate", Bridge.CreateFunction( "Translate", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Plane.Translate(Bridge.GetBoxedExternal <UnityEngine.Plane>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[2]).wrapped)) ) ); // Instance Fields // Instance Property Accessors Bridge.DefineGetterSetter( PlanePrototype, "normal", Bridge.WithBoxedExternal <UnityEngine.Plane>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.normal)), Bridge.WithBoxedExternal <UnityEngine.Plane>((o, args) => { o.wrapped.normal = Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( PlanePrototype, "distance", Bridge.WithBoxedExternal <UnityEngine.Plane>((o, args) => JavaScriptValue.FromDouble(o.wrapped.distance)), Bridge.WithBoxedExternal <UnityEngine.Plane>((o, args) => { o.wrapped.distance = (float)args[1].ToDouble(); }) ); Bridge.DefineGetter( PlanePrototype, "flipped", Bridge.WithBoxedExternal <UnityEngine.Plane>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.flipped)) ); // Instance Methods PlanePrototype.SetProperty( "SetNormalAndPosition", Bridge.CreateFunction( "SetNormalAndPosition", Bridge.WithBoxedExternal <UnityEngine.Plane>((o, args) => o.wrapped.SetNormalAndPosition(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[2]).wrapped)) ) ); PlanePrototype.SetProperty( "Set3Points", Bridge.CreateFunction( "Set3Points", Bridge.WithBoxedExternal <UnityEngine.Plane>((o, args) => o.wrapped.Set3Points(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[2]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[3]).wrapped)) ) ); PlanePrototype.SetProperty( "Flip", Bridge.CreateFunction( "Flip", Bridge.WithBoxedExternal <UnityEngine.Plane>((o, args) => o.wrapped.Flip()) ) ); PlanePrototype.SetProperty( "Translate", Bridge.CreateFunction( "Translate", Bridge.WithBoxedExternal <UnityEngine.Plane>((o, args) => o.wrapped.Translate(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped)) ) ); PlanePrototype.SetProperty( "ClosestPointOnPlane", Bridge.CreateFunction( "ClosestPointOnPlane", Bridge.WithBoxedExternal <UnityEngine.Plane>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.ClosestPointOnPlane(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))) ) ); PlanePrototype.SetProperty( "GetDistanceToPoint", Bridge.CreateFunction( "GetDistanceToPoint", Bridge.WithBoxedExternal <UnityEngine.Plane>((o, args) => JavaScriptValue.FromDouble(o.wrapped.GetDistanceToPoint(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))) ) ); PlanePrototype.SetProperty( "GetSide", Bridge.CreateFunction( "GetSide", Bridge.WithBoxedExternal <UnityEngine.Plane>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.GetSide(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))) ) ); PlanePrototype.SetProperty( "SameSide", Bridge.CreateFunction( "SameSide", Bridge.WithBoxedExternal <UnityEngine.Plane>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.SameSide(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[2]).wrapped))) ) ); /* * Plane Raycast * parameter enter is out */ PlanePrototype.SetProperty( "toString", Bridge.CreateFunction( "ToString", Bridge.WithBoxedExternal <UnityEngine.Plane>((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 NetworkTransformChildPrototype; JavaScriptValue NetworkTransformChildConstructor = Bridge.CreateConstructor( typeof(UnityEngine.Networking.NetworkTransformChild), (args) => { throw new NotImplementedException(); }, out NetworkTransformChildPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .GetProperty("Networking") .SetProperty("NetworkTransformChild", NetworkTransformChildConstructor); // Static Fields // Static Property Accessors // Static Methods // Instance Fields // Instance Property Accessors Bridge.DefineGetterSetter( NetworkTransformChildPrototype, "target", WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => Bridge.CreateExternalWithPrototype(o.target)), WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => { o.target = Bridge.GetExternal <UnityEngine.Transform>(args[1]); }) ); Bridge.DefineGetter( NetworkTransformChildPrototype, "childIndex", WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => Bridge.CreateExternalWithPrototype(o.childIndex)) ); Bridge.DefineGetterSetter( NetworkTransformChildPrototype, "sendInterval", WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => JavaScriptValue.FromDouble(o.sendInterval)), WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => { o.sendInterval = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( NetworkTransformChildPrototype, "syncRotationAxis", WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => Bridge.CreateExternalWithPrototype(o.syncRotationAxis)), WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => { o.syncRotationAxis = Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.AxisSyncMode>(args[1]); }) ); Bridge.DefineGetterSetter( NetworkTransformChildPrototype, "rotationSyncCompression", WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => Bridge.CreateExternalWithPrototype(o.rotationSyncCompression)), WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => { o.rotationSyncCompression = Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.CompressionSyncMode>(args[1]); }) ); Bridge.DefineGetterSetter( NetworkTransformChildPrototype, "movementThreshold", WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => JavaScriptValue.FromDouble(o.movementThreshold)), WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => { o.movementThreshold = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( NetworkTransformChildPrototype, "interpolateRotation", WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => JavaScriptValue.FromDouble(o.interpolateRotation)), WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => { o.interpolateRotation = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( NetworkTransformChildPrototype, "interpolateMovement", WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => JavaScriptValue.FromDouble(o.interpolateMovement)), WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => { o.interpolateMovement = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( NetworkTransformChildPrototype, "clientMoveCallback3D", WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => Bridge.CreateExternalWithPrototype(o.clientMoveCallback3D)), WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => { o.clientMoveCallback3D = Bridge.GetExternal <UnityEngine.Networking.NetworkTransform.ClientMoveCallback3D>(args[1]); }) ); Bridge.DefineGetter( NetworkTransformChildPrototype, "lastSyncTime", WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => JavaScriptValue.FromDouble(o.lastSyncTime)) ); Bridge.DefineGetter( NetworkTransformChildPrototype, "targetSyncPosition", WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => Bridge.CreateExternalWithPrototype(o.targetSyncPosition)) ); Bridge.DefineGetter( NetworkTransformChildPrototype, "targetSyncRotation3D", WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => Bridge.CreateExternalWithPrototype(o.targetSyncRotation3D)) ); // Instance Methods NetworkTransformChildPrototype.SetProperty( "OnSerialize", Bridge.CreateFunction( "OnSerialize", WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => JavaScriptValue.FromBoolean(o.OnSerialize(Bridge.GetExternal <UnityEngine.Networking.NetworkWriter>(args[1]), args[2].ToBoolean()))) ) ); NetworkTransformChildPrototype.SetProperty( "OnDeserialize", Bridge.CreateFunction( "OnDeserialize", WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => o.OnDeserialize(Bridge.GetExternal <UnityEngine.Networking.NetworkReader>(args[1]), args[2].ToBoolean())) ) ); NetworkTransformChildPrototype.SetProperty( "GetNetworkChannel", Bridge.CreateFunction( "GetNetworkChannel", WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => JavaScriptValue.FromInt32(o.GetNetworkChannel())) ) ); NetworkTransformChildPrototype.SetProperty( "GetNetworkSendInterval", Bridge.CreateFunction( "GetNetworkSendInterval", WithExternal <UnityEngine.Networking.NetworkTransformChild>((o, args) => JavaScriptValue.FromDouble(o.GetNetworkSendInterval())) ) ); }
public static void Register(JavaScriptContext context) { JavaScriptValue CameraPrototype; JavaScriptValue CameraConstructor = Bridge.CreateConstructor( typeof(UnityEngine.Camera), (args) => { throw new System.NotImplementedException(); }, out CameraPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .SetProperty("Camera", CameraConstructor); // Static Fields Bridge.DefineGetterSetter( CameraConstructor, "onPreCull", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Camera.onPreCull), (args) => { UnityEngine.Camera.onPreCull = Bridge.GetExternal <UnityEngine.Camera.CameraCallback>(args[1]); } ); Bridge.DefineGetterSetter( CameraConstructor, "onPreRender", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Camera.onPreRender), (args) => { UnityEngine.Camera.onPreRender = Bridge.GetExternal <UnityEngine.Camera.CameraCallback>(args[1]); } ); Bridge.DefineGetterSetter( CameraConstructor, "onPostRender", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Camera.onPostRender), (args) => { UnityEngine.Camera.onPostRender = Bridge.GetExternal <UnityEngine.Camera.CameraCallback>(args[1]); } ); // Static Property Accessors Bridge.DefineGetter( CameraConstructor, "main", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Camera.main) ); Bridge.DefineGetter( CameraConstructor, "current", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Camera.current) ); Bridge.DefineGetter( CameraConstructor, "allCamerasCount", (args) => JavaScriptValue.FromInt32(UnityEngine.Camera.allCamerasCount) ); Bridge.DefineGetter( CameraConstructor, "allCameras", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Camera.allCameras) ); // Static Methods CameraConstructor.SetProperty( "FocalLengthToFOV", Bridge.CreateFunction( "FocalLengthToFOV", (args) => JavaScriptValue.FromDouble(UnityEngine.Camera.FocalLengthToFOV((float)args[1].ToDouble(), (float)args[2].ToDouble())) ) ); CameraConstructor.SetProperty( "FOVToFocalLength", Bridge.CreateFunction( "FOVToFocalLength", (args) => JavaScriptValue.FromDouble(UnityEngine.Camera.FOVToFocalLength((float)args[1].ToDouble(), (float)args[2].ToDouble())) ) ); CameraConstructor.SetProperty( "GetAllCameras", Bridge.CreateFunction( "GetAllCameras", (args) => JavaScriptValue.FromInt32(UnityEngine.Camera.GetAllCameras(Bridge.GetExternal <UnityEngine.Camera[]>(args[1]))) ) ); CameraConstructor.SetProperty( "SetupCurrent", Bridge.CreateFunction( "SetupCurrent", (args) => UnityEngine.Camera.SetupCurrent(Bridge.GetExternal <UnityEngine.Camera>(args[1])) ) ); // Instance Fields // Instance Property Accessors Bridge.DefineGetterSetter( CameraPrototype, "nearClipPlane", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromDouble(o.nearClipPlane)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.nearClipPlane = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( CameraPrototype, "farClipPlane", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromDouble(o.farClipPlane)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.farClipPlane = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( CameraPrototype, "fieldOfView", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromDouble(o.fieldOfView)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.fieldOfView = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( CameraPrototype, "renderingPath", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.renderingPath)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.renderingPath = Bridge.GetExternal <UnityEngine.RenderingPath>(args[1]); }) ); Bridge.DefineGetter( CameraPrototype, "actualRenderingPath", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.actualRenderingPath)) ); Bridge.DefineGetterSetter( CameraPrototype, "allowHDR", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.allowHDR)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.allowHDR = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( CameraPrototype, "allowMSAA", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.allowMSAA)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.allowMSAA = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( CameraPrototype, "allowDynamicResolution", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.allowDynamicResolution)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.allowDynamicResolution = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( CameraPrototype, "forceIntoRenderTexture", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.forceIntoRenderTexture)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.forceIntoRenderTexture = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( CameraPrototype, "orthographicSize", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromDouble(o.orthographicSize)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.orthographicSize = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( CameraPrototype, "orthographic", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.orthographic)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.orthographic = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( CameraPrototype, "opaqueSortMode", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.opaqueSortMode)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.opaqueSortMode = Bridge.GetExternal <UnityEngine.Rendering.OpaqueSortMode>(args[1]); }) ); Bridge.DefineGetterSetter( CameraPrototype, "transparencySortMode", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.transparencySortMode)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.transparencySortMode = Bridge.GetExternal <UnityEngine.TransparencySortMode>(args[1]); }) ); Bridge.DefineGetterSetter( CameraPrototype, "transparencySortAxis", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.transparencySortAxis)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.transparencySortAxis = Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( CameraPrototype, "depth", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromDouble(o.depth)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.depth = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( CameraPrototype, "aspect", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromDouble(o.aspect)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.aspect = (float)args[1].ToDouble(); }) ); Bridge.DefineGetter( CameraPrototype, "velocity", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.velocity)) ); Bridge.DefineGetterSetter( CameraPrototype, "cullingMask", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromInt32(o.cullingMask)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.cullingMask = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( CameraPrototype, "eventMask", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromInt32(o.eventMask)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.eventMask = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( CameraPrototype, "layerCullSpherical", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.layerCullSpherical)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.layerCullSpherical = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( CameraPrototype, "cameraType", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.cameraType)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.cameraType = Bridge.GetExternal <UnityEngine.CameraType>(args[1]); }) ); Bridge.DefineGetterSetter( CameraPrototype, "layerCullDistances", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.layerCullDistances)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.layerCullDistances = Bridge.GetExternal <System.Single[]>(args[1]); }) ); Bridge.DefineGetterSetter( CameraPrototype, "useOcclusionCulling", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.useOcclusionCulling)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.useOcclusionCulling = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( CameraPrototype, "cullingMatrix", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.cullingMatrix)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.cullingMatrix = Bridge.GetBoxedExternal <UnityEngine.Matrix4x4>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( CameraPrototype, "backgroundColor", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.backgroundColor)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.backgroundColor = Bridge.GetBoxedExternal <UnityEngine.Color>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( CameraPrototype, "clearFlags", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.clearFlags)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.clearFlags = Bridge.GetExternal <UnityEngine.CameraClearFlags>(args[1]); }) ); Bridge.DefineGetterSetter( CameraPrototype, "depthTextureMode", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.depthTextureMode)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.depthTextureMode = Bridge.GetExternal <UnityEngine.DepthTextureMode>(args[1]); }) ); Bridge.DefineGetterSetter( CameraPrototype, "clearStencilAfterLightingPass", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.clearStencilAfterLightingPass)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.clearStencilAfterLightingPass = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( CameraPrototype, "usePhysicalProperties", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.usePhysicalProperties)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.usePhysicalProperties = args[1].ToBoolean(); }) ); Bridge.DefineGetterSetter( CameraPrototype, "sensorSize", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.sensorSize)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.sensorSize = Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( CameraPrototype, "lensShift", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.lensShift)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.lensShift = Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( CameraPrototype, "focalLength", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromDouble(o.focalLength)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.focalLength = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( CameraPrototype, "rect", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.rect)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.rect = Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( CameraPrototype, "pixelRect", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.pixelRect)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.pixelRect = Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped; }) ); Bridge.DefineGetter( CameraPrototype, "pixelWidth", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromInt32(o.pixelWidth)) ); Bridge.DefineGetter( CameraPrototype, "pixelHeight", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromInt32(o.pixelHeight)) ); Bridge.DefineGetter( CameraPrototype, "scaledPixelWidth", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromInt32(o.scaledPixelWidth)) ); Bridge.DefineGetter( CameraPrototype, "scaledPixelHeight", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromInt32(o.scaledPixelHeight)) ); Bridge.DefineGetterSetter( CameraPrototype, "targetTexture", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.targetTexture)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.targetTexture = Bridge.GetExternal <UnityEngine.RenderTexture>(args[1]); }) ); Bridge.DefineGetter( CameraPrototype, "activeTexture", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.activeTexture)) ); Bridge.DefineGetterSetter( CameraPrototype, "targetDisplay", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromInt32(o.targetDisplay)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.targetDisplay = args[1].ToInt32(); }) ); Bridge.DefineGetter( CameraPrototype, "cameraToWorldMatrix", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.cameraToWorldMatrix)) ); Bridge.DefineGetterSetter( CameraPrototype, "worldToCameraMatrix", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.worldToCameraMatrix)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.worldToCameraMatrix = Bridge.GetBoxedExternal <UnityEngine.Matrix4x4>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( CameraPrototype, "projectionMatrix", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.projectionMatrix)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.projectionMatrix = Bridge.GetBoxedExternal <UnityEngine.Matrix4x4>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( CameraPrototype, "nonJitteredProjectionMatrix", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.nonJitteredProjectionMatrix)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.nonJitteredProjectionMatrix = Bridge.GetBoxedExternal <UnityEngine.Matrix4x4>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( CameraPrototype, "useJitteredProjectionMatrixForTransparentRendering", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.useJitteredProjectionMatrixForTransparentRendering)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.useJitteredProjectionMatrixForTransparentRendering = args[1].ToBoolean(); }) ); Bridge.DefineGetter( CameraPrototype, "previousViewProjectionMatrix", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.previousViewProjectionMatrix)) ); Bridge.DefineGetterSetter( CameraPrototype, "scene", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.scene)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.scene = Bridge.GetBoxedExternal <UnityEngine.SceneManagement.Scene>(args[1]).wrapped; }) ); Bridge.DefineGetter( CameraPrototype, "stereoEnabled", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.stereoEnabled)) ); Bridge.DefineGetterSetter( CameraPrototype, "stereoSeparation", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromDouble(o.stereoSeparation)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.stereoSeparation = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( CameraPrototype, "stereoConvergence", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromDouble(o.stereoConvergence)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.stereoConvergence = (float)args[1].ToDouble(); }) ); Bridge.DefineGetter( CameraPrototype, "areVRStereoViewMatricesWithinSingleCullTolerance", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.areVRStereoViewMatricesWithinSingleCullTolerance)) ); Bridge.DefineGetterSetter( CameraPrototype, "stereoTargetEye", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.stereoTargetEye)), Bridge.WithExternal <UnityEngine.Camera>((o, args) => { o.stereoTargetEye = Bridge.GetExternal <UnityEngine.StereoTargetEyeMask>(args[1]); }) ); Bridge.DefineGetter( CameraPrototype, "stereoActiveEye", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.stereoActiveEye)) ); Bridge.DefineGetter( CameraPrototype, "commandBufferCount", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromInt32(o.commandBufferCount)) ); // Instance Methods CameraPrototype.SetProperty( "GetCommandBuffers", Bridge.CreateFunction( "GetCommandBuffers", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.GetCommandBuffers(Bridge.GetExternal <UnityEngine.Rendering.CameraEvent>(args[1])))) ) ); CameraPrototype.SetProperty( "Reset", Bridge.CreateFunction( "Reset", Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.Reset()) ) ); CameraPrototype.SetProperty( "ResetTransparencySortSettings", Bridge.CreateFunction( "ResetTransparencySortSettings", Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.ResetTransparencySortSettings()) ) ); CameraPrototype.SetProperty( "ResetAspect", Bridge.CreateFunction( "ResetAspect", Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.ResetAspect()) ) ); CameraPrototype.SetProperty( "ResetCullingMatrix", Bridge.CreateFunction( "ResetCullingMatrix", Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.ResetCullingMatrix()) ) ); CameraPrototype.SetProperty( "SetReplacementShader", Bridge.CreateFunction( "SetReplacementShader", Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.SetReplacementShader(Bridge.GetExternal <UnityEngine.Shader>(args[1]), args[2].ToString())) ) ); CameraPrototype.SetProperty( "ResetReplacementShader", Bridge.CreateFunction( "ResetReplacementShader", Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.ResetReplacementShader()) ) ); CameraPrototype.SetProperty( "SetTargetBuffers", Bridge.CreateFunction( "SetTargetBuffers", Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.SetTargetBuffers(Bridge.GetBoxedExternal <UnityEngine.RenderBuffer>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.RenderBuffer>(args[2]).wrapped)) ) ); CameraPrototype.SetProperty( "SetTargetBuffers", Bridge.CreateFunction( "SetTargetBuffers", Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.SetTargetBuffers(Bridge.GetExternal <UnityEngine.RenderBuffer[]>(args[1]), Bridge.GetBoxedExternal <UnityEngine.RenderBuffer>(args[2]).wrapped)) ) ); CameraPrototype.SetProperty( "ResetWorldToCameraMatrix", Bridge.CreateFunction( "ResetWorldToCameraMatrix", Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.ResetWorldToCameraMatrix()) ) ); CameraPrototype.SetProperty( "ResetProjectionMatrix", Bridge.CreateFunction( "ResetProjectionMatrix", Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.ResetProjectionMatrix()) ) ); CameraPrototype.SetProperty( "CalculateObliqueMatrix", Bridge.CreateFunction( "CalculateObliqueMatrix", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.CalculateObliqueMatrix(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped))) ) ); CameraPrototype.SetProperty( "WorldToScreenPoint", Bridge.CreateFunction( "WorldToScreenPoint", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.WorldToScreenPoint(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Camera.MonoOrStereoscopicEye>(args[2])))) ) ); CameraPrototype.SetProperty( "WorldToViewportPoint", Bridge.CreateFunction( "WorldToViewportPoint", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.WorldToViewportPoint(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Camera.MonoOrStereoscopicEye>(args[2])))) ) ); CameraPrototype.SetProperty( "ViewportToWorldPoint", Bridge.CreateFunction( "ViewportToWorldPoint", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.ViewportToWorldPoint(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Camera.MonoOrStereoscopicEye>(args[2])))) ) ); CameraPrototype.SetProperty( "ScreenToWorldPoint", Bridge.CreateFunction( "ScreenToWorldPoint", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.ScreenToWorldPoint(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Camera.MonoOrStereoscopicEye>(args[2])))) ) ); CameraPrototype.SetProperty( "WorldToScreenPoint", Bridge.CreateFunction( "WorldToScreenPoint", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.WorldToScreenPoint(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))) ) ); CameraPrototype.SetProperty( "WorldToViewportPoint", Bridge.CreateFunction( "WorldToViewportPoint", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.WorldToViewportPoint(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))) ) ); CameraPrototype.SetProperty( "ViewportToWorldPoint", Bridge.CreateFunction( "ViewportToWorldPoint", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.ViewportToWorldPoint(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))) ) ); CameraPrototype.SetProperty( "ScreenToWorldPoint", Bridge.CreateFunction( "ScreenToWorldPoint", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.ScreenToWorldPoint(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))) ) ); CameraPrototype.SetProperty( "ScreenToViewportPoint", Bridge.CreateFunction( "ScreenToViewportPoint", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.ScreenToViewportPoint(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))) ) ); CameraPrototype.SetProperty( "ViewportToScreenPoint", Bridge.CreateFunction( "ViewportToScreenPoint", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.ViewportToScreenPoint(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))) ) ); CameraPrototype.SetProperty( "ViewportPointToRay", Bridge.CreateFunction( "ViewportPointToRay", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.ViewportPointToRay(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Camera.MonoOrStereoscopicEye>(args[2])))) ) ); CameraPrototype.SetProperty( "ViewportPointToRay", Bridge.CreateFunction( "ViewportPointToRay", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.ViewportPointToRay(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))) ) ); CameraPrototype.SetProperty( "ScreenPointToRay", Bridge.CreateFunction( "ScreenPointToRay", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.ScreenPointToRay(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetExternal <UnityEngine.Camera.MonoOrStereoscopicEye>(args[2])))) ) ); CameraPrototype.SetProperty( "ScreenPointToRay", Bridge.CreateFunction( "ScreenPointToRay", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.ScreenPointToRay(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))) ) ); CameraPrototype.SetProperty( "CalculateFrustumCorners", Bridge.CreateFunction( "CalculateFrustumCorners", Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.CalculateFrustumCorners(Bridge.GetBoxedExternal <UnityEngine.Rect>(args[1]).wrapped, (float)args[2].ToDouble(), Bridge.GetExternal <UnityEngine.Camera.MonoOrStereoscopicEye>(args[3]), Bridge.GetExternal <UnityEngine.Vector3[]>(args[4]))) ) ); CameraPrototype.SetProperty( "GetStereoNonJitteredProjectionMatrix", Bridge.CreateFunction( "GetStereoNonJitteredProjectionMatrix", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.GetStereoNonJitteredProjectionMatrix(Bridge.GetExternal <UnityEngine.Camera.StereoscopicEye>(args[1])))) ) ); CameraPrototype.SetProperty( "GetStereoViewMatrix", Bridge.CreateFunction( "GetStereoViewMatrix", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.GetStereoViewMatrix(Bridge.GetExternal <UnityEngine.Camera.StereoscopicEye>(args[1])))) ) ); CameraPrototype.SetProperty( "CopyStereoDeviceProjectionMatrixToNonJittered", Bridge.CreateFunction( "CopyStereoDeviceProjectionMatrixToNonJittered", Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.CopyStereoDeviceProjectionMatrixToNonJittered(Bridge.GetExternal <UnityEngine.Camera.StereoscopicEye>(args[1]))) ) ); CameraPrototype.SetProperty( "GetStereoProjectionMatrix", Bridge.CreateFunction( "GetStereoProjectionMatrix", Bridge.WithExternal <UnityEngine.Camera>((o, args) => Bridge.CreateExternalWithPrototype(o.GetStereoProjectionMatrix(Bridge.GetExternal <UnityEngine.Camera.StereoscopicEye>(args[1])))) ) ); CameraPrototype.SetProperty( "SetStereoProjectionMatrix", Bridge.CreateFunction( "SetStereoProjectionMatrix", Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.SetStereoProjectionMatrix(Bridge.GetExternal <UnityEngine.Camera.StereoscopicEye>(args[1]), Bridge.GetBoxedExternal <UnityEngine.Matrix4x4>(args[2]).wrapped)) ) ); CameraPrototype.SetProperty( "ResetStereoProjectionMatrices", Bridge.CreateFunction( "ResetStereoProjectionMatrices", Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.ResetStereoProjectionMatrices()) ) ); CameraPrototype.SetProperty( "SetStereoViewMatrix", Bridge.CreateFunction( "SetStereoViewMatrix", Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.SetStereoViewMatrix(Bridge.GetExternal <UnityEngine.Camera.StereoscopicEye>(args[1]), Bridge.GetBoxedExternal <UnityEngine.Matrix4x4>(args[2]).wrapped)) ) ); CameraPrototype.SetProperty( "ResetStereoViewMatrices", Bridge.CreateFunction( "ResetStereoViewMatrices", Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.ResetStereoViewMatrices()) ) ); CameraPrototype.SetProperty( "RenderToCubemap", Bridge.CreateFunction( "RenderToCubemap", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.RenderToCubemap(Bridge.GetExternal <UnityEngine.Cubemap>(args[1]), args[2].ToInt32()))) ) ); CameraPrototype.SetProperty( "RenderToCubemap", Bridge.CreateFunction( "RenderToCubemap", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.RenderToCubemap(Bridge.GetExternal <UnityEngine.Cubemap>(args[1])))) ) ); CameraPrototype.SetProperty( "RenderToCubemap", Bridge.CreateFunction( "RenderToCubemap", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.RenderToCubemap(Bridge.GetExternal <UnityEngine.RenderTexture>(args[1]), args[2].ToInt32()))) ) ); CameraPrototype.SetProperty( "RenderToCubemap", Bridge.CreateFunction( "RenderToCubemap", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.RenderToCubemap(Bridge.GetExternal <UnityEngine.RenderTexture>(args[1])))) ) ); CameraPrototype.SetProperty( "RenderToCubemap", Bridge.CreateFunction( "RenderToCubemap", Bridge.WithExternal <UnityEngine.Camera>((o, args) => JavaScriptValue.FromBoolean(o.RenderToCubemap(Bridge.GetExternal <UnityEngine.RenderTexture>(args[1]), args[2].ToInt32(), Bridge.GetExternal <UnityEngine.Camera.MonoOrStereoscopicEye>(args[3])))) ) ); CameraPrototype.SetProperty( "Render", Bridge.CreateFunction( "Render", Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.Render()) ) ); CameraPrototype.SetProperty( "RenderWithShader", Bridge.CreateFunction( "RenderWithShader", Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.RenderWithShader(Bridge.GetExternal <UnityEngine.Shader>(args[1]), args[2].ToString())) ) ); CameraPrototype.SetProperty( "RenderDontRestore", Bridge.CreateFunction( "RenderDontRestore", Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.RenderDontRestore()) ) ); CameraPrototype.SetProperty( "CopyFrom", Bridge.CreateFunction( "CopyFrom", Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.CopyFrom(Bridge.GetExternal <UnityEngine.Camera>(args[1]))) ) ); CameraPrototype.SetProperty( "RemoveCommandBuffers", Bridge.CreateFunction( "RemoveCommandBuffers", Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.RemoveCommandBuffers(Bridge.GetExternal <UnityEngine.Rendering.CameraEvent>(args[1]))) ) ); CameraPrototype.SetProperty( "RemoveAllCommandBuffers", Bridge.CreateFunction( "RemoveAllCommandBuffers", Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.RemoveAllCommandBuffers()) ) ); CameraPrototype.SetProperty( "AddCommandBuffer", Bridge.CreateFunction( "AddCommandBuffer", Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.AddCommandBuffer(Bridge.GetExternal <UnityEngine.Rendering.CameraEvent>(args[1]), Bridge.GetExternal <UnityEngine.Rendering.CommandBuffer>(args[2]))) ) ); CameraPrototype.SetProperty( "AddCommandBufferAsync", Bridge.CreateFunction( "AddCommandBufferAsync", Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.AddCommandBufferAsync(Bridge.GetExternal <UnityEngine.Rendering.CameraEvent>(args[1]), Bridge.GetExternal <UnityEngine.Rendering.CommandBuffer>(args[2]), Bridge.GetExternal <UnityEngine.Rendering.ComputeQueueType>(args[3]))) ) ); CameraPrototype.SetProperty( "RemoveCommandBuffer", Bridge.CreateFunction( "RemoveCommandBuffer", Bridge.WithExternal <UnityEngine.Camera>((o, args) => o.RemoveCommandBuffer(Bridge.GetExternal <UnityEngine.Rendering.CameraEvent>(args[1]), Bridge.GetExternal <UnityEngine.Rendering.CommandBuffer>(args[2]))) ) ); }
public static void Register(JavaScriptContext context) { JavaScriptValue RaycastResultPrototype; JavaScriptValue RaycastResultConstructor = Bridge.CreateConstructor( typeof(UnityEngine.EventSystems.RaycastResult), (args) => { throw new NotImplementedException(); }, out RaycastResultPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .GetProperty("EventSystems") .SetProperty("RaycastResult", RaycastResultConstructor); // Static Fields // Static Property Accessors // Static Methods // Instance Fields Bridge.DefineGetterSetter( RaycastResultPrototype, "module", WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => Bridge.CreateExternalWithPrototype(o.module)), WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => { o.module = Bridge.GetExternal <UnityEngine.EventSystems.BaseRaycaster>(args[1]); }) ); Bridge.DefineGetterSetter( RaycastResultPrototype, "distance", WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => JavaScriptValue.FromDouble(o.distance)), WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => { o.distance = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( RaycastResultPrototype, "index", WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => JavaScriptValue.FromDouble(o.index)), WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => { o.index = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( RaycastResultPrototype, "depth", WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => JavaScriptValue.FromInt32(o.depth)), WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => { o.depth = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( RaycastResultPrototype, "sortingLayer", WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => JavaScriptValue.FromInt32(o.sortingLayer)), WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => { o.sortingLayer = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( RaycastResultPrototype, "sortingOrder", WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => JavaScriptValue.FromInt32(o.sortingOrder)), WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => { o.sortingOrder = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( RaycastResultPrototype, "worldPosition", WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => Bridge.CreateExternalWithPrototype(o.worldPosition)), WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => { o.worldPosition = Bridge.GetExternal <UnityEngine.Vector3>(args[1]); }) ); Bridge.DefineGetterSetter( RaycastResultPrototype, "worldNormal", WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => Bridge.CreateExternalWithPrototype(o.worldNormal)), WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => { o.worldNormal = Bridge.GetExternal <UnityEngine.Vector3>(args[1]); }) ); Bridge.DefineGetterSetter( RaycastResultPrototype, "screenPosition", WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => Bridge.CreateExternalWithPrototype(o.screenPosition)), WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => { o.screenPosition = Bridge.GetExternal <UnityEngine.Vector2>(args[1]); }) ); // Instance Property Accessors Bridge.DefineGetterSetter( RaycastResultPrototype, "gameObject", WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => Bridge.CreateExternalWithPrototype(o.gameObject)), WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => { o.gameObject = Bridge.GetExternal <UnityEngine.GameObject>(args[1]); }) ); Bridge.DefineGetter( RaycastResultPrototype, "isValid", WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => JavaScriptValue.FromBoolean(o.isValid)) ); // Instance Methods RaycastResultPrototype.SetProperty( "Clear", Bridge.CreateFunction( "Clear", WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => o.Clear()) ) ); RaycastResultPrototype.SetProperty( "ToString", Bridge.CreateFunction( "ToString", WithExternal <UnityEngine.EventSystems.RaycastResult>((o, args) => JavaScriptValue.FromString(o.ToString())) ) ); }
public static void Register(JavaScriptContext context) { JavaScriptValue PhysicMaterialPrototype; JavaScriptValue PhysicMaterialConstructor = Bridge.CreateConstructor( typeof(UnityEngine.PhysicMaterial), (args) => { throw new System.NotImplementedException(); }, out PhysicMaterialPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .SetProperty("PhysicMaterial", PhysicMaterialConstructor); // Static Fields // Static Property Accessors // Static Methods // Instance Fields // Instance Property Accessors Bridge.DefineGetterSetter( PhysicMaterialPrototype, "bounciness", Bridge.WithExternal <UnityEngine.PhysicMaterial>((o, args) => JavaScriptValue.FromDouble(o.bounciness)), Bridge.WithExternal <UnityEngine.PhysicMaterial>((o, args) => { o.bounciness = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( PhysicMaterialPrototype, "dynamicFriction", Bridge.WithExternal <UnityEngine.PhysicMaterial>((o, args) => JavaScriptValue.FromDouble(o.dynamicFriction)), Bridge.WithExternal <UnityEngine.PhysicMaterial>((o, args) => { o.dynamicFriction = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( PhysicMaterialPrototype, "staticFriction", Bridge.WithExternal <UnityEngine.PhysicMaterial>((o, args) => JavaScriptValue.FromDouble(o.staticFriction)), Bridge.WithExternal <UnityEngine.PhysicMaterial>((o, args) => { o.staticFriction = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( PhysicMaterialPrototype, "frictionCombine", Bridge.WithExternal <UnityEngine.PhysicMaterial>((o, args) => Bridge.CreateExternalWithPrototype(o.frictionCombine)), Bridge.WithExternal <UnityEngine.PhysicMaterial>((o, args) => { o.frictionCombine = Bridge.GetExternal <UnityEngine.PhysicMaterialCombine>(args[1]); }) ); Bridge.DefineGetterSetter( PhysicMaterialPrototype, "bounceCombine", Bridge.WithExternal <UnityEngine.PhysicMaterial>((o, args) => Bridge.CreateExternalWithPrototype(o.bounceCombine)), Bridge.WithExternal <UnityEngine.PhysicMaterial>((o, args) => { o.bounceCombine = Bridge.GetExternal <UnityEngine.PhysicMaterialCombine>(args[1]); }) ); // Instance Methods }
public static void Register(JavaScriptContext context) { JavaScriptValue BoneWeightPrototype; JavaScriptValue BoneWeightConstructor = Bridge.CreateConstructor( typeof(UnityEngine.BoneWeight), (args) => { throw new System.NotImplementedException(); }, out BoneWeightPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .SetProperty("BoneWeight", BoneWeightConstructor); // Static Fields // Static Property Accessors // Static Methods // Instance Fields // Instance Property Accessors Bridge.DefineGetterSetter( BoneWeightPrototype, "weight0", Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => JavaScriptValue.FromDouble(o.wrapped.weight0)), Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => { o.wrapped.weight0 = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( BoneWeightPrototype, "weight1", Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => JavaScriptValue.FromDouble(o.wrapped.weight1)), Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => { o.wrapped.weight1 = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( BoneWeightPrototype, "weight2", Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => JavaScriptValue.FromDouble(o.wrapped.weight2)), Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => { o.wrapped.weight2 = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( BoneWeightPrototype, "weight3", Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => JavaScriptValue.FromDouble(o.wrapped.weight3)), Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => { o.wrapped.weight3 = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( BoneWeightPrototype, "boneIndex0", Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => JavaScriptValue.FromInt32(o.wrapped.boneIndex0)), Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => { o.wrapped.boneIndex0 = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( BoneWeightPrototype, "boneIndex1", Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => JavaScriptValue.FromInt32(o.wrapped.boneIndex1)), Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => { o.wrapped.boneIndex1 = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( BoneWeightPrototype, "boneIndex2", Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => JavaScriptValue.FromInt32(o.wrapped.boneIndex2)), Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => { o.wrapped.boneIndex2 = args[1].ToInt32(); }) ); Bridge.DefineGetterSetter( BoneWeightPrototype, "boneIndex3", Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => JavaScriptValue.FromInt32(o.wrapped.boneIndex3)), Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => { o.wrapped.boneIndex3 = args[1].ToInt32(); }) ); // Instance Methods BoneWeightPrototype.SetProperty( "GetHashCode", Bridge.CreateFunction( "GetHashCode", Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => JavaScriptValue.FromInt32(o.wrapped.GetHashCode())) ) ); BoneWeightPrototype.SetProperty( "Equals", Bridge.CreateFunction( "Equals", Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.Equals(Bridge.GetExternal <System.Object>(args[1])))) ) ); BoneWeightPrototype.SetProperty( "Equals", Bridge.CreateFunction( "Equals", Bridge.WithBoxedExternal <UnityEngine.BoneWeight>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.Equals(Bridge.GetBoxedExternal <UnityEngine.BoneWeight>(args[1]).wrapped))) ) ); }
public static void Register(JavaScriptContext context) { JavaScriptValue Vector4Prototype; JavaScriptValue Vector4Constructor = Bridge.CreateConstructor( typeof(UnityEngine.Vector4), (args) => { throw new System.NotImplementedException(); }, out Vector4Prototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .SetProperty("Vector4", Vector4Constructor); // Static Fields Vector4Constructor.SetProperty( "kEpsilon", JavaScriptValue.FromDouble(UnityEngine.Vector4.kEpsilon) ); // Static Property Accessors Bridge.DefineGetter( Vector4Constructor, "zero", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector4.zero) ); Bridge.DefineGetter( Vector4Constructor, "one", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector4.one) ); Bridge.DefineGetter( Vector4Constructor, "positiveInfinity", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector4.positiveInfinity) ); Bridge.DefineGetter( Vector4Constructor, "negativeInfinity", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector4.negativeInfinity) ); // Static Methods Vector4Constructor.SetProperty( "Lerp", Bridge.CreateFunction( "Lerp", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector4.Lerp(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[2]).wrapped, (float)args[3].ToDouble())) ) ); Vector4Constructor.SetProperty( "LerpUnclamped", Bridge.CreateFunction( "LerpUnclamped", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector4.LerpUnclamped(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[2]).wrapped, (float)args[3].ToDouble())) ) ); Vector4Constructor.SetProperty( "MoveTowards", Bridge.CreateFunction( "MoveTowards", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector4.MoveTowards(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[2]).wrapped, (float)args[3].ToDouble())) ) ); Vector4Constructor.SetProperty( "Scale", Bridge.CreateFunction( "Scale", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector4.Scale(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[2]).wrapped)) ) ); Vector4Constructor.SetProperty( "Normalize", Bridge.CreateFunction( "Normalize", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector4.Normalize(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped)) ) ); Vector4Constructor.SetProperty( "Dot", Bridge.CreateFunction( "Dot", (args) => JavaScriptValue.FromDouble(UnityEngine.Vector4.Dot(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[2]).wrapped)) ) ); Vector4Constructor.SetProperty( "Project", Bridge.CreateFunction( "Project", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector4.Project(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[2]).wrapped)) ) ); Vector4Constructor.SetProperty( "Distance", Bridge.CreateFunction( "Distance", (args) => JavaScriptValue.FromDouble(UnityEngine.Vector4.Distance(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[2]).wrapped)) ) ); Vector4Constructor.SetProperty( "Magnitude", Bridge.CreateFunction( "Magnitude", (args) => JavaScriptValue.FromDouble(UnityEngine.Vector4.Magnitude(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped)) ) ); Vector4Constructor.SetProperty( "Min", Bridge.CreateFunction( "Min", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector4.Min(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[2]).wrapped)) ) ); Vector4Constructor.SetProperty( "Max", Bridge.CreateFunction( "Max", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector4.Max(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[2]).wrapped)) ) ); Vector4Constructor.SetProperty( "SqrMagnitude", Bridge.CreateFunction( "SqrMagnitude", (args) => JavaScriptValue.FromDouble(UnityEngine.Vector4.SqrMagnitude(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped)) ) ); // Instance Fields Bridge.DefineGetterSetter( Vector4Prototype, "x", Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.x)), Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => { o.wrapped.x = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( Vector4Prototype, "y", Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.y)), Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => { o.wrapped.y = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( Vector4Prototype, "z", Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.z)), Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => { o.wrapped.z = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( Vector4Prototype, "w", Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.w)), Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => { o.wrapped.w = (float)args[1].ToDouble(); }) ); // Instance Property Accessors Bridge.DefineGetter( Vector4Prototype, "normalized", Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.normalized)) ); Bridge.DefineGetter( Vector4Prototype, "magnitude", Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.magnitude)) ); Bridge.DefineGetter( Vector4Prototype, "sqrMagnitude", Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.sqrMagnitude)) ); // Instance Methods Vector4Prototype.SetProperty( "Set", Bridge.CreateFunction( "Set", Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => o.wrapped.Set((float)args[1].ToDouble(), (float)args[2].ToDouble(), (float)args[3].ToDouble(), (float)args[4].ToDouble())) ) ); Vector4Prototype.SetProperty( "Scale", Bridge.CreateFunction( "Scale", Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => o.wrapped.Scale(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped)) ) ); Vector4Prototype.SetProperty( "GetHashCode", Bridge.CreateFunction( "GetHashCode", Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => JavaScriptValue.FromInt32(o.wrapped.GetHashCode())) ) ); Vector4Prototype.SetProperty( "Equals", Bridge.CreateFunction( "Equals", Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.Equals(Bridge.GetExternal <System.Object>(args[1])))) ) ); Vector4Prototype.SetProperty( "Equals", Bridge.CreateFunction( "Equals", Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.Equals(Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[1]).wrapped))) ) ); Vector4Prototype.SetProperty( "Normalize", Bridge.CreateFunction( "Normalize", Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => o.wrapped.Normalize()) ) ); Vector4Prototype.SetProperty( "toString", Bridge.CreateFunction( "ToString", Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => { if (args.Length == 1) { return(JavaScriptValue.FromString(o.wrapped.ToString())); } else { return(JavaScriptValue.FromString(o.wrapped.ToString(args[1].ToString()))); } }) ) ); Vector4Prototype.SetProperty( "SqrMagnitude", Bridge.CreateFunction( "SqrMagnitude", Bridge.WithBoxedExternal <UnityEngine.Vector4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.SqrMagnitude())) ) ); }
public static void Register(JavaScriptContext context) { JavaScriptValue Vector2Prototype; JavaScriptValue Vector2Constructor = Bridge.CreateConstructor( typeof(UnityEngine.Vector2), (args) => { throw new System.NotImplementedException(); }, out Vector2Prototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .SetProperty("Vector2", Vector2Constructor); // Static Fields Vector2Constructor.SetProperty( "kEpsilon", JavaScriptValue.FromDouble(UnityEngine.Vector2.kEpsilon) ); Vector2Constructor.SetProperty( "kEpsilonNormalSqrt", JavaScriptValue.FromDouble(UnityEngine.Vector2.kEpsilonNormalSqrt) ); // Static Property Accessors Bridge.DefineGetter( Vector2Constructor, "zero", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector2.zero) ); Bridge.DefineGetter( Vector2Constructor, "one", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector2.one) ); Bridge.DefineGetter( Vector2Constructor, "up", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector2.up) ); Bridge.DefineGetter( Vector2Constructor, "down", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector2.down) ); Bridge.DefineGetter( Vector2Constructor, "left", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector2.left) ); Bridge.DefineGetter( Vector2Constructor, "right", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector2.right) ); Bridge.DefineGetter( Vector2Constructor, "positiveInfinity", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector2.positiveInfinity) ); Bridge.DefineGetter( Vector2Constructor, "negativeInfinity", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector2.negativeInfinity) ); // Static Methods Vector2Constructor.SetProperty( "Lerp", Bridge.CreateFunction( "Lerp", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector2.Lerp(Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[2]).wrapped, (float)args[3].ToDouble())) ) ); Vector2Constructor.SetProperty( "LerpUnclamped", Bridge.CreateFunction( "LerpUnclamped", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector2.LerpUnclamped(Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[2]).wrapped, (float)args[3].ToDouble())) ) ); Vector2Constructor.SetProperty( "MoveTowards", Bridge.CreateFunction( "MoveTowards", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector2.MoveTowards(Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[2]).wrapped, (float)args[3].ToDouble())) ) ); Vector2Constructor.SetProperty( "Scale", Bridge.CreateFunction( "Scale", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector2.Scale(Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[2]).wrapped)) ) ); Vector2Constructor.SetProperty( "Reflect", Bridge.CreateFunction( "Reflect", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector2.Reflect(Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[2]).wrapped)) ) ); Vector2Constructor.SetProperty( "Perpendicular", Bridge.CreateFunction( "Perpendicular", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector2.Perpendicular(Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[1]).wrapped)) ) ); Vector2Constructor.SetProperty( "Dot", Bridge.CreateFunction( "Dot", (args) => JavaScriptValue.FromDouble(UnityEngine.Vector2.Dot(Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[2]).wrapped)) ) ); Vector2Constructor.SetProperty( "Angle", Bridge.CreateFunction( "Angle", (args) => JavaScriptValue.FromDouble(UnityEngine.Vector2.Angle(Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[2]).wrapped)) ) ); Vector2Constructor.SetProperty( "SignedAngle", Bridge.CreateFunction( "SignedAngle", (args) => JavaScriptValue.FromDouble(UnityEngine.Vector2.SignedAngle(Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[2]).wrapped)) ) ); Vector2Constructor.SetProperty( "Distance", Bridge.CreateFunction( "Distance", (args) => JavaScriptValue.FromDouble(UnityEngine.Vector2.Distance(Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[2]).wrapped)) ) ); Vector2Constructor.SetProperty( "ClampMagnitude", Bridge.CreateFunction( "ClampMagnitude", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector2.ClampMagnitude(Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[1]).wrapped, (float)args[2].ToDouble())) ) ); Vector2Constructor.SetProperty( "SqrMagnitude", Bridge.CreateFunction( "SqrMagnitude", (args) => JavaScriptValue.FromDouble(UnityEngine.Vector2.SqrMagnitude(Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[1]).wrapped)) ) ); Vector2Constructor.SetProperty( "Min", Bridge.CreateFunction( "Min", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector2.Min(Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[2]).wrapped)) ) ); Vector2Constructor.SetProperty( "Max", Bridge.CreateFunction( "Max", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Vector2.Max(Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[2]).wrapped)) ) ); /* * Vector2 SmoothDamp * parameter currentVelocity is ref */ /* * Vector2 SmoothDamp * parameter currentVelocity is ref */ /* * Vector2 SmoothDamp * parameter currentVelocity is ref */ // Instance Fields Bridge.DefineGetterSetter( Vector2Prototype, "x", Bridge.WithBoxedExternal <UnityEngine.Vector2>((o, args) => JavaScriptValue.FromDouble(o.wrapped.x)), Bridge.WithBoxedExternal <UnityEngine.Vector2>((o, args) => { o.wrapped.x = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( Vector2Prototype, "y", Bridge.WithBoxedExternal <UnityEngine.Vector2>((o, args) => JavaScriptValue.FromDouble(o.wrapped.y)), Bridge.WithBoxedExternal <UnityEngine.Vector2>((o, args) => { o.wrapped.y = (float)args[1].ToDouble(); }) ); // Instance Property Accessors Bridge.DefineGetter( Vector2Prototype, "normalized", Bridge.WithBoxedExternal <UnityEngine.Vector2>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.normalized)) ); Bridge.DefineGetter( Vector2Prototype, "magnitude", Bridge.WithBoxedExternal <UnityEngine.Vector2>((o, args) => JavaScriptValue.FromDouble(o.wrapped.magnitude)) ); Bridge.DefineGetter( Vector2Prototype, "sqrMagnitude", Bridge.WithBoxedExternal <UnityEngine.Vector2>((o, args) => JavaScriptValue.FromDouble(o.wrapped.sqrMagnitude)) ); // Instance Methods Vector2Prototype.SetProperty( "Set", Bridge.CreateFunction( "Set", Bridge.WithBoxedExternal <UnityEngine.Vector2>((o, args) => o.wrapped.Set((float)args[1].ToDouble(), (float)args[2].ToDouble())) ) ); Vector2Prototype.SetProperty( "Scale", Bridge.CreateFunction( "Scale", Bridge.WithBoxedExternal <UnityEngine.Vector2>((o, args) => o.wrapped.Scale(Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[1]).wrapped)) ) ); Vector2Prototype.SetProperty( "Normalize", Bridge.CreateFunction( "Normalize", Bridge.WithBoxedExternal <UnityEngine.Vector2>((o, args) => o.wrapped.Normalize()) ) ); Vector2Prototype.SetProperty( "toString", Bridge.CreateFunction( "ToString", Bridge.WithBoxedExternal <UnityEngine.Vector2>((o, args) => { if (args.Length == 1) { return(JavaScriptValue.FromString(o.wrapped.ToString())); } else { return(JavaScriptValue.FromString(o.wrapped.ToString(args[1].ToString()))); } }) ) ); Vector2Prototype.SetProperty( "GetHashCode", Bridge.CreateFunction( "GetHashCode", Bridge.WithBoxedExternal <UnityEngine.Vector2>((o, args) => JavaScriptValue.FromInt32(o.wrapped.GetHashCode())) ) ); Vector2Prototype.SetProperty( "Equals", Bridge.CreateFunction( "Equals", Bridge.WithBoxedExternal <UnityEngine.Vector2>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.Equals(Bridge.GetExternal <System.Object>(args[1])))) ) ); Vector2Prototype.SetProperty( "Equals", Bridge.CreateFunction( "Equals", Bridge.WithBoxedExternal <UnityEngine.Vector2>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.Equals(Bridge.GetBoxedExternal <UnityEngine.Vector2>(args[1]).wrapped))) ) ); Vector2Prototype.SetProperty( "SqrMagnitude", Bridge.CreateFunction( "SqrMagnitude", Bridge.WithBoxedExternal <UnityEngine.Vector2>((o, args) => JavaScriptValue.FromDouble(o.wrapped.SqrMagnitude())) ) ); }
public static void Register(JavaScriptContext context) { JavaScriptValue NetworkServerPrototype; JavaScriptValue NetworkServerConstructor = Bridge.CreateConstructor( typeof(UnityEngine.Networking.NetworkServer), (args) => { throw new NotImplementedException(); }, out NetworkServerPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .GetProperty("Networking") .SetProperty("NetworkServer", NetworkServerConstructor); // Static Fields // Static Property Accessors Bridge.DefineGetter( NetworkServerConstructor, "localConnections", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkServer.localConnections) ); Bridge.DefineGetter( NetworkServerConstructor, "listenPort", (args) => JavaScriptValue.FromInt32(UnityEngine.Networking.NetworkServer.listenPort) ); Bridge.DefineGetter( NetworkServerConstructor, "serverHostId", (args) => JavaScriptValue.FromInt32(UnityEngine.Networking.NetworkServer.serverHostId) ); Bridge.DefineGetter( NetworkServerConstructor, "connections", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkServer.connections) ); Bridge.DefineGetter( NetworkServerConstructor, "handlers", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkServer.handlers) ); Bridge.DefineGetter( NetworkServerConstructor, "hostTopology", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkServer.hostTopology) ); Bridge.DefineGetter( NetworkServerConstructor, "objects", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkServer.objects) ); Bridge.DefineGetterSetter( NetworkServerConstructor, "dontListen", (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.dontListen), (args) => { UnityEngine.Networking.NetworkServer.dontListen = args[1].ToBoolean(); } ); Bridge.DefineGetterSetter( NetworkServerConstructor, "useWebSockets", (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.useWebSockets), (args) => { UnityEngine.Networking.NetworkServer.useWebSockets = args[1].ToBoolean(); } ); Bridge.DefineGetter( NetworkServerConstructor, "active", (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.active) ); Bridge.DefineGetter( NetworkServerConstructor, "localClientActive", (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.localClientActive) ); Bridge.DefineGetter( NetworkServerConstructor, "numChannels", (args) => JavaScriptValue.FromInt32(UnityEngine.Networking.NetworkServer.numChannels) ); Bridge.DefineGetterSetter( NetworkServerConstructor, "maxDelay", (args) => JavaScriptValue.FromDouble(UnityEngine.Networking.NetworkServer.maxDelay), (args) => { UnityEngine.Networking.NetworkServer.maxDelay = (float)args[1].ToDouble(); } ); Bridge.DefineGetter( NetworkServerConstructor, "networkConnectionClass", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkServer.networkConnectionClass) ); // Static Methods /* * NetworkServer SetNetworkConnectionClass * method has generics */ NetworkServerConstructor.SetProperty( "Configure", Bridge.CreateFunction( "Configure", (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.Configure(Bridge.GetExternal <UnityEngine.Networking.ConnectionConfig>(args[1]), args[2].ToInt32())) ) ); NetworkServerConstructor.SetProperty( "Configure", Bridge.CreateFunction( "Configure", (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.Configure(Bridge.GetExternal <UnityEngine.Networking.HostTopology>(args[1]))) ) ); NetworkServerConstructor.SetProperty( "Reset", Bridge.CreateFunction( "Reset", (args) => UnityEngine.Networking.NetworkServer.Reset() ) ); NetworkServerConstructor.SetProperty( "Shutdown", Bridge.CreateFunction( "Shutdown", (args) => UnityEngine.Networking.NetworkServer.Shutdown() ) ); NetworkServerConstructor.SetProperty( "Listen", Bridge.CreateFunction( "Listen", (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.Listen(Bridge.GetExternal <UnityEngine.Networking.Match.MatchInfo>(args[1]), args[2].ToInt32())) ) ); NetworkServerConstructor.SetProperty( "ListenRelay", Bridge.CreateFunction( "ListenRelay", (args) => UnityEngine.Networking.NetworkServer.ListenRelay(args[1].ToString(), args[2].ToInt32(), Bridge.GetExternal <UnityEngine.Networking.Types.NetworkID>(args[3]), Bridge.GetExternal <UnityEngine.Networking.Types.SourceID>(args[4]), Bridge.GetExternal <UnityEngine.Networking.Types.NodeID>(args[5])) ) ); NetworkServerConstructor.SetProperty( "Listen", Bridge.CreateFunction( "Listen", (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.Listen(args[1].ToInt32())) ) ); NetworkServerConstructor.SetProperty( "Listen", Bridge.CreateFunction( "Listen", (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.Listen(args[1].ToString(), args[2].ToInt32())) ) ); NetworkServerConstructor.SetProperty( "BecomeHost", Bridge.CreateFunction( "BecomeHost", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkServer.BecomeHost(Bridge.GetExternal <UnityEngine.Networking.NetworkClient>(args[1]), args[2].ToInt32(), Bridge.GetExternal <UnityEngine.Networking.Match.MatchInfo>(args[3]), args[4].ToInt32(), Bridge.GetExternal <UnityEngine.Networking.NetworkSystem.PeerInfoMessage[]>(args[5]))) ) ); NetworkServerConstructor.SetProperty( "SendToAll", Bridge.CreateFunction( "SendToAll", (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.SendToAll(Bridge.GetExternal <System.Int16>(args[1]), Bridge.GetExternal <UnityEngine.Networking.MessageBase>(args[2]))) ) ); NetworkServerConstructor.SetProperty( "SendToReady", Bridge.CreateFunction( "SendToReady", (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.SendToReady(Bridge.GetExternal <UnityEngine.GameObject>(args[1]), Bridge.GetExternal <System.Int16>(args[2]), Bridge.GetExternal <UnityEngine.Networking.MessageBase>(args[3]))) ) ); NetworkServerConstructor.SetProperty( "SendWriterToReady", Bridge.CreateFunction( "SendWriterToReady", (args) => UnityEngine.Networking.NetworkServer.SendWriterToReady(Bridge.GetExternal <UnityEngine.GameObject>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkWriter>(args[2]), args[3].ToInt32()) ) ); NetworkServerConstructor.SetProperty( "SendBytesToReady", Bridge.CreateFunction( "SendBytesToReady", (args) => UnityEngine.Networking.NetworkServer.SendBytesToReady(Bridge.GetExternal <UnityEngine.GameObject>(args[1]), Bridge.GetExternal <System.Byte[]>(args[2]), args[3].ToInt32(), args[4].ToInt32()) ) ); NetworkServerConstructor.SetProperty( "SendBytesToPlayer", Bridge.CreateFunction( "SendBytesToPlayer", (args) => UnityEngine.Networking.NetworkServer.SendBytesToPlayer(Bridge.GetExternal <UnityEngine.GameObject>(args[1]), Bridge.GetExternal <System.Byte[]>(args[2]), args[3].ToInt32(), args[4].ToInt32()) ) ); NetworkServerConstructor.SetProperty( "SendUnreliableToAll", Bridge.CreateFunction( "SendUnreliableToAll", (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.SendUnreliableToAll(Bridge.GetExternal <System.Int16>(args[1]), Bridge.GetExternal <UnityEngine.Networking.MessageBase>(args[2]))) ) ); NetworkServerConstructor.SetProperty( "SendUnreliableToReady", Bridge.CreateFunction( "SendUnreliableToReady", (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.SendUnreliableToReady(Bridge.GetExternal <UnityEngine.GameObject>(args[1]), Bridge.GetExternal <System.Int16>(args[2]), Bridge.GetExternal <UnityEngine.Networking.MessageBase>(args[3]))) ) ); NetworkServerConstructor.SetProperty( "SendByChannelToAll", Bridge.CreateFunction( "SendByChannelToAll", (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.SendByChannelToAll(Bridge.GetExternal <System.Int16>(args[1]), Bridge.GetExternal <UnityEngine.Networking.MessageBase>(args[2]), args[3].ToInt32())) ) ); NetworkServerConstructor.SetProperty( "SendByChannelToReady", Bridge.CreateFunction( "SendByChannelToReady", (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.SendByChannelToReady(Bridge.GetExternal <UnityEngine.GameObject>(args[1]), Bridge.GetExternal <System.Int16>(args[2]), Bridge.GetExternal <UnityEngine.Networking.MessageBase>(args[3]), args[4].ToInt32())) ) ); NetworkServerConstructor.SetProperty( "DisconnectAll", Bridge.CreateFunction( "DisconnectAll", (args) => UnityEngine.Networking.NetworkServer.DisconnectAll() ) ); NetworkServerConstructor.SetProperty( "RegisterHandler", Bridge.CreateFunction( "RegisterHandler", (args) => UnityEngine.Networking.NetworkServer.RegisterHandler(Bridge.GetExternal <System.Int16>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkMessageDelegate>(args[2])) ) ); NetworkServerConstructor.SetProperty( "UnregisterHandler", Bridge.CreateFunction( "UnregisterHandler", (args) => UnityEngine.Networking.NetworkServer.UnregisterHandler(Bridge.GetExternal <System.Int16>(args[1])) ) ); NetworkServerConstructor.SetProperty( "ClearHandlers", Bridge.CreateFunction( "ClearHandlers", (args) => UnityEngine.Networking.NetworkServer.ClearHandlers() ) ); NetworkServerConstructor.SetProperty( "ClearSpawners", Bridge.CreateFunction( "ClearSpawners", (args) => UnityEngine.Networking.NetworkServer.ClearSpawners() ) ); /* * NetworkServer GetStatsOut * parameter numMsgs is out */ /* * NetworkServer GetStatsIn * parameter numMsgs is out */ NetworkServerConstructor.SetProperty( "SendToClientOfPlayer", Bridge.CreateFunction( "SendToClientOfPlayer", (args) => UnityEngine.Networking.NetworkServer.SendToClientOfPlayer(Bridge.GetExternal <UnityEngine.GameObject>(args[1]), Bridge.GetExternal <System.Int16>(args[2]), Bridge.GetExternal <UnityEngine.Networking.MessageBase>(args[3])) ) ); NetworkServerConstructor.SetProperty( "SendToClient", Bridge.CreateFunction( "SendToClient", (args) => UnityEngine.Networking.NetworkServer.SendToClient(args[1].ToInt32(), Bridge.GetExternal <System.Int16>(args[2]), Bridge.GetExternal <UnityEngine.Networking.MessageBase>(args[3])) ) ); NetworkServerConstructor.SetProperty( "ReplacePlayerForConnection", Bridge.CreateFunction( "ReplacePlayerForConnection", (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.ReplacePlayerForConnection(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]), Bridge.GetExternal <UnityEngine.GameObject>(args[2]), Bridge.GetExternal <System.Int16>(args[3]), Bridge.GetExternal <UnityEngine.Networking.NetworkHash128>(args[4]))) ) ); NetworkServerConstructor.SetProperty( "ReplacePlayerForConnection", Bridge.CreateFunction( "ReplacePlayerForConnection", (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.ReplacePlayerForConnection(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]), Bridge.GetExternal <UnityEngine.GameObject>(args[2]), Bridge.GetExternal <System.Int16>(args[3]))) ) ); NetworkServerConstructor.SetProperty( "AddPlayerForConnection", Bridge.CreateFunction( "AddPlayerForConnection", (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.AddPlayerForConnection(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]), Bridge.GetExternal <UnityEngine.GameObject>(args[2]), Bridge.GetExternal <System.Int16>(args[3]), Bridge.GetExternal <UnityEngine.Networking.NetworkHash128>(args[4]))) ) ); NetworkServerConstructor.SetProperty( "AddPlayerForConnection", Bridge.CreateFunction( "AddPlayerForConnection", (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.AddPlayerForConnection(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]), Bridge.GetExternal <UnityEngine.GameObject>(args[2]), Bridge.GetExternal <System.Int16>(args[3]))) ) ); NetworkServerConstructor.SetProperty( "SetClientReady", Bridge.CreateFunction( "SetClientReady", (args) => UnityEngine.Networking.NetworkServer.SetClientReady(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1])) ) ); NetworkServerConstructor.SetProperty( "SetAllClientsNotReady", Bridge.CreateFunction( "SetAllClientsNotReady", (args) => UnityEngine.Networking.NetworkServer.SetAllClientsNotReady() ) ); NetworkServerConstructor.SetProperty( "SetClientNotReady", Bridge.CreateFunction( "SetClientNotReady", (args) => UnityEngine.Networking.NetworkServer.SetClientNotReady(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1])) ) ); NetworkServerConstructor.SetProperty( "DestroyPlayersForConnection", Bridge.CreateFunction( "DestroyPlayersForConnection", (args) => UnityEngine.Networking.NetworkServer.DestroyPlayersForConnection(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1])) ) ); NetworkServerConstructor.SetProperty( "ClearLocalObjects", Bridge.CreateFunction( "ClearLocalObjects", (args) => UnityEngine.Networking.NetworkServer.ClearLocalObjects() ) ); NetworkServerConstructor.SetProperty( "Spawn", Bridge.CreateFunction( "Spawn", (args) => UnityEngine.Networking.NetworkServer.Spawn(Bridge.GetExternal <UnityEngine.GameObject>(args[1])) ) ); NetworkServerConstructor.SetProperty( "SpawnWithClientAuthority", Bridge.CreateFunction( "SpawnWithClientAuthority", (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.SpawnWithClientAuthority(Bridge.GetExternal <UnityEngine.GameObject>(args[1]), Bridge.GetExternal <UnityEngine.GameObject>(args[2]))) ) ); NetworkServerConstructor.SetProperty( "SpawnWithClientAuthority", Bridge.CreateFunction( "SpawnWithClientAuthority", (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.SpawnWithClientAuthority(Bridge.GetExternal <UnityEngine.GameObject>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[2]))) ) ); NetworkServerConstructor.SetProperty( "SpawnWithClientAuthority", Bridge.CreateFunction( "SpawnWithClientAuthority", (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.SpawnWithClientAuthority(Bridge.GetExternal <UnityEngine.GameObject>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkHash128>(args[2]), Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[3]))) ) ); NetworkServerConstructor.SetProperty( "Spawn", Bridge.CreateFunction( "Spawn", (args) => UnityEngine.Networking.NetworkServer.Spawn(Bridge.GetExternal <UnityEngine.GameObject>(args[1]), Bridge.GetExternal <UnityEngine.Networking.NetworkHash128>(args[2])) ) ); NetworkServerConstructor.SetProperty( "Destroy", Bridge.CreateFunction( "Destroy", (args) => UnityEngine.Networking.NetworkServer.Destroy(Bridge.GetExternal <UnityEngine.GameObject>(args[1])) ) ); NetworkServerConstructor.SetProperty( "UnSpawn", Bridge.CreateFunction( "UnSpawn", (args) => UnityEngine.Networking.NetworkServer.UnSpawn(Bridge.GetExternal <UnityEngine.GameObject>(args[1])) ) ); NetworkServerConstructor.SetProperty( "FindLocalObject", Bridge.CreateFunction( "FindLocalObject", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkServer.FindLocalObject(Bridge.GetExternal <UnityEngine.Networking.NetworkInstanceId>(args[1]))) ) ); NetworkServerConstructor.SetProperty( "GetConnectionStats", Bridge.CreateFunction( "GetConnectionStats", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Networking.NetworkServer.GetConnectionStats()) ) ); NetworkServerConstructor.SetProperty( "ResetConnectionStats", Bridge.CreateFunction( "ResetConnectionStats", (args) => UnityEngine.Networking.NetworkServer.ResetConnectionStats() ) ); NetworkServerConstructor.SetProperty( "AddExternalConnection", Bridge.CreateFunction( "AddExternalConnection", (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.AddExternalConnection(Bridge.GetExternal <UnityEngine.Networking.NetworkConnection>(args[1]))) ) ); NetworkServerConstructor.SetProperty( "RemoveExternalConnection", Bridge.CreateFunction( "RemoveExternalConnection", (args) => UnityEngine.Networking.NetworkServer.RemoveExternalConnection(args[1].ToInt32()) ) ); NetworkServerConstructor.SetProperty( "SpawnObjects", Bridge.CreateFunction( "SpawnObjects", (args) => JavaScriptValue.FromBoolean(UnityEngine.Networking.NetworkServer.SpawnObjects()) ) ); // Instance Fields // Instance Property Accessors // Instance Methods }
public static void Register(JavaScriptContext context) { JavaScriptValue NetworkReaderPrototype; JavaScriptValue NetworkReaderConstructor = Bridge.CreateConstructor( typeof(UnityEngine.Networking.NetworkReader), (args) => { throw new NotImplementedException(); }, out NetworkReaderPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .GetProperty("Networking") .SetProperty("NetworkReader", NetworkReaderConstructor); // Static Fields // Static Property Accessors // Static Methods // Instance Fields // Instance Property Accessors Bridge.DefineGetter( NetworkReaderPrototype, "Position", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.Position)) ); Bridge.DefineGetter( NetworkReaderPrototype, "Length", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => JavaScriptValue.FromInt32(o.Length)) ); // Instance Methods NetworkReaderPrototype.SetProperty( "SeekZero", Bridge.CreateFunction( "SeekZero", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => o.SeekZero()) ) ); NetworkReaderPrototype.SetProperty( "ReadPackedUInt32", Bridge.CreateFunction( "ReadPackedUInt32", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadPackedUInt32())) ) ); NetworkReaderPrototype.SetProperty( "ReadPackedUInt64", Bridge.CreateFunction( "ReadPackedUInt64", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadPackedUInt64())) ) ); NetworkReaderPrototype.SetProperty( "ReadNetworkId", Bridge.CreateFunction( "ReadNetworkId", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadNetworkId())) ) ); NetworkReaderPrototype.SetProperty( "ReadSceneId", Bridge.CreateFunction( "ReadSceneId", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadSceneId())) ) ); NetworkReaderPrototype.SetProperty( "ReadByte", Bridge.CreateFunction( "ReadByte", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadByte())) ) ); NetworkReaderPrototype.SetProperty( "ReadSByte", Bridge.CreateFunction( "ReadSByte", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadSByte())) ) ); NetworkReaderPrototype.SetProperty( "ReadInt16", Bridge.CreateFunction( "ReadInt16", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadInt16())) ) ); NetworkReaderPrototype.SetProperty( "ReadUInt16", Bridge.CreateFunction( "ReadUInt16", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadUInt16())) ) ); NetworkReaderPrototype.SetProperty( "ReadInt32", Bridge.CreateFunction( "ReadInt32", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => JavaScriptValue.FromInt32(o.ReadInt32())) ) ); NetworkReaderPrototype.SetProperty( "ReadUInt32", Bridge.CreateFunction( "ReadUInt32", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadUInt32())) ) ); NetworkReaderPrototype.SetProperty( "ReadInt64", Bridge.CreateFunction( "ReadInt64", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadInt64())) ) ); NetworkReaderPrototype.SetProperty( "ReadUInt64", Bridge.CreateFunction( "ReadUInt64", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadUInt64())) ) ); NetworkReaderPrototype.SetProperty( "ReadDecimal", Bridge.CreateFunction( "ReadDecimal", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadDecimal())) ) ); NetworkReaderPrototype.SetProperty( "ReadSingle", Bridge.CreateFunction( "ReadSingle", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => JavaScriptValue.FromDouble(o.ReadSingle())) ) ); NetworkReaderPrototype.SetProperty( "ReadDouble", Bridge.CreateFunction( "ReadDouble", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => JavaScriptValue.FromDouble(o.ReadDouble())) ) ); NetworkReaderPrototype.SetProperty( "ReadString", Bridge.CreateFunction( "ReadString", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => JavaScriptValue.FromString(o.ReadString())) ) ); NetworkReaderPrototype.SetProperty( "ReadChar", Bridge.CreateFunction( "ReadChar", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadChar())) ) ); NetworkReaderPrototype.SetProperty( "ReadBoolean", Bridge.CreateFunction( "ReadBoolean", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => JavaScriptValue.FromBoolean(o.ReadBoolean())) ) ); NetworkReaderPrototype.SetProperty( "ReadBytes", Bridge.CreateFunction( "ReadBytes", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadBytes(args[1].ToInt32()))) ) ); NetworkReaderPrototype.SetProperty( "ReadBytesAndSize", Bridge.CreateFunction( "ReadBytesAndSize", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadBytesAndSize())) ) ); NetworkReaderPrototype.SetProperty( "ReadVector2", Bridge.CreateFunction( "ReadVector2", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadVector2())) ) ); NetworkReaderPrototype.SetProperty( "ReadVector3", Bridge.CreateFunction( "ReadVector3", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadVector3())) ) ); NetworkReaderPrototype.SetProperty( "ReadVector4", Bridge.CreateFunction( "ReadVector4", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadVector4())) ) ); NetworkReaderPrototype.SetProperty( "ReadColor", Bridge.CreateFunction( "ReadColor", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadColor())) ) ); NetworkReaderPrototype.SetProperty( "ReadColor32", Bridge.CreateFunction( "ReadColor32", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadColor32())) ) ); NetworkReaderPrototype.SetProperty( "ReadQuaternion", Bridge.CreateFunction( "ReadQuaternion", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadQuaternion())) ) ); NetworkReaderPrototype.SetProperty( "ReadRect", Bridge.CreateFunction( "ReadRect", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadRect())) ) ); NetworkReaderPrototype.SetProperty( "ReadPlane", Bridge.CreateFunction( "ReadPlane", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadPlane())) ) ); NetworkReaderPrototype.SetProperty( "ReadRay", Bridge.CreateFunction( "ReadRay", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadRay())) ) ); NetworkReaderPrototype.SetProperty( "ReadMatrix4x4", Bridge.CreateFunction( "ReadMatrix4x4", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadMatrix4x4())) ) ); NetworkReaderPrototype.SetProperty( "ReadNetworkHash128", Bridge.CreateFunction( "ReadNetworkHash128", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadNetworkHash128())) ) ); NetworkReaderPrototype.SetProperty( "ReadTransform", Bridge.CreateFunction( "ReadTransform", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadTransform())) ) ); NetworkReaderPrototype.SetProperty( "ReadGameObject", Bridge.CreateFunction( "ReadGameObject", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadGameObject())) ) ); NetworkReaderPrototype.SetProperty( "ReadNetworkIdentity", Bridge.CreateFunction( "ReadNetworkIdentity", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => Bridge.CreateExternalWithPrototype(o.ReadNetworkIdentity())) ) ); NetworkReaderPrototype.SetProperty( "toString", Bridge.CreateFunction( "ToString", WithExternal <UnityEngine.Networking.NetworkReader>((o, args) => JavaScriptValue.FromString(o.ToString())) ) ); /* * NetworkReader ReadMessage * method has generics */ }
private JavaScriptValue VisitFloat(JValue token) { return(AddRef(JavaScriptValue.FromDouble(token.Value <double>()))); }
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 RaycastHitPrototype; JavaScriptValue RaycastHitConstructor = Bridge.CreateConstructor( typeof(UnityEngine.RaycastHit), (args) => { throw new System.NotImplementedException(); }, out RaycastHitPrototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .SetProperty("RaycastHit", RaycastHitConstructor); // Static Fields // Static Property Accessors // Static Methods // Instance Fields // Instance Property Accessors Bridge.DefineGetter( RaycastHitPrototype, "collider", Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.collider)) ); Bridge.DefineGetterSetter( RaycastHitPrototype, "point", Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.point)), Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => { o.wrapped.point = Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( RaycastHitPrototype, "normal", Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.normal)), Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => { o.wrapped.normal = Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( RaycastHitPrototype, "barycentricCoordinate", Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.barycentricCoordinate)), Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => { o.wrapped.barycentricCoordinate = Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped; }) ); Bridge.DefineGetterSetter( RaycastHitPrototype, "distance", Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => JavaScriptValue.FromDouble(o.wrapped.distance)), Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => { o.wrapped.distance = (float)args[1].ToDouble(); }) ); Bridge.DefineGetter( RaycastHitPrototype, "triangleIndex", Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => JavaScriptValue.FromInt32(o.wrapped.triangleIndex)) ); Bridge.DefineGetter( RaycastHitPrototype, "textureCoord", Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.textureCoord)) ); Bridge.DefineGetter( RaycastHitPrototype, "textureCoord2", Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.textureCoord2)) ); Bridge.DefineGetter( RaycastHitPrototype, "transform", Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.transform)) ); Bridge.DefineGetter( RaycastHitPrototype, "rigidbody", Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.rigidbody)) ); Bridge.DefineGetter( RaycastHitPrototype, "lightmapCoord", Bridge.WithBoxedExternal <UnityEngine.RaycastHit>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.lightmapCoord)) ); // Instance Methods }
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 Matrix4x4Prototype; JavaScriptValue Matrix4x4Constructor = Bridge.CreateConstructor( typeof(UnityEngine.Matrix4x4), (args) => { throw new System.NotImplementedException(); }, out Matrix4x4Prototype ); JavaScriptValue .GlobalObject .GetProperty("UnityEngine") .SetProperty("Matrix4x4", Matrix4x4Constructor); // Static Fields // Static Property Accessors Bridge.DefineGetter( Matrix4x4Constructor, "zero", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Matrix4x4.zero) ); Bridge.DefineGetter( Matrix4x4Constructor, "identity", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Matrix4x4.identity) ); // Static Methods Matrix4x4Constructor.SetProperty( "Determinant", Bridge.CreateFunction( "Determinant", (args) => JavaScriptValue.FromDouble(UnityEngine.Matrix4x4.Determinant(Bridge.GetBoxedExternal <UnityEngine.Matrix4x4>(args[1]).wrapped)) ) ); Matrix4x4Constructor.SetProperty( "TRS", Bridge.CreateFunction( "TRS", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Matrix4x4.TRS(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Quaternion>(args[2]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[3]).wrapped)) ) ); Matrix4x4Constructor.SetProperty( "Inverse", Bridge.CreateFunction( "Inverse", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Matrix4x4.Inverse(Bridge.GetBoxedExternal <UnityEngine.Matrix4x4>(args[1]).wrapped)) ) ); Matrix4x4Constructor.SetProperty( "Transpose", Bridge.CreateFunction( "Transpose", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Matrix4x4.Transpose(Bridge.GetBoxedExternal <UnityEngine.Matrix4x4>(args[1]).wrapped)) ) ); Matrix4x4Constructor.SetProperty( "Ortho", Bridge.CreateFunction( "Ortho", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Matrix4x4.Ortho((float)args[1].ToDouble(), (float)args[2].ToDouble(), (float)args[3].ToDouble(), (float)args[4].ToDouble(), (float)args[5].ToDouble(), (float)args[6].ToDouble())) ) ); Matrix4x4Constructor.SetProperty( "Perspective", Bridge.CreateFunction( "Perspective", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Matrix4x4.Perspective((float)args[1].ToDouble(), (float)args[2].ToDouble(), (float)args[3].ToDouble(), (float)args[4].ToDouble())) ) ); Matrix4x4Constructor.SetProperty( "LookAt", Bridge.CreateFunction( "LookAt", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Matrix4x4.LookAt(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[2]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[3]).wrapped)) ) ); Matrix4x4Constructor.SetProperty( "Frustum", Bridge.CreateFunction( "Frustum", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Matrix4x4.Frustum((float)args[1].ToDouble(), (float)args[2].ToDouble(), (float)args[3].ToDouble(), (float)args[4].ToDouble(), (float)args[5].ToDouble(), (float)args[6].ToDouble())) ) ); Matrix4x4Constructor.SetProperty( "Frustum", Bridge.CreateFunction( "Frustum", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Matrix4x4.Frustum(Bridge.GetBoxedExternal <UnityEngine.FrustumPlanes>(args[1]).wrapped)) ) ); Matrix4x4Constructor.SetProperty( "Scale", Bridge.CreateFunction( "Scale", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Matrix4x4.Scale(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped)) ) ); Matrix4x4Constructor.SetProperty( "Translate", Bridge.CreateFunction( "Translate", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Matrix4x4.Translate(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped)) ) ); Matrix4x4Constructor.SetProperty( "Rotate", Bridge.CreateFunction( "Rotate", (args) => Bridge.CreateExternalWithPrototype(UnityEngine.Matrix4x4.Rotate(Bridge.GetBoxedExternal <UnityEngine.Quaternion>(args[1]).wrapped)) ) ); // Instance Fields Bridge.DefineGetterSetter( Matrix4x4Prototype, "m00", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m00)), Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m00 = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( Matrix4x4Prototype, "m10", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m10)), Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m10 = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( Matrix4x4Prototype, "m20", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m20)), Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m20 = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( Matrix4x4Prototype, "m30", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m30)), Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m30 = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( Matrix4x4Prototype, "m01", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m01)), Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m01 = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( Matrix4x4Prototype, "m11", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m11)), Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m11 = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( Matrix4x4Prototype, "m21", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m21)), Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m21 = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( Matrix4x4Prototype, "m31", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m31)), Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m31 = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( Matrix4x4Prototype, "m02", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m02)), Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m02 = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( Matrix4x4Prototype, "m12", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m12)), Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m12 = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( Matrix4x4Prototype, "m22", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m22)), Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m22 = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( Matrix4x4Prototype, "m32", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m32)), Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m32 = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( Matrix4x4Prototype, "m03", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m03)), Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m03 = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( Matrix4x4Prototype, "m13", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m13)), Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m13 = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( Matrix4x4Prototype, "m23", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m23)), Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m23 = (float)args[1].ToDouble(); }) ); Bridge.DefineGetterSetter( Matrix4x4Prototype, "m33", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.m33)), Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { o.wrapped.m33 = (float)args[1].ToDouble(); }) ); // Instance Property Accessors Bridge.DefineGetter( Matrix4x4Prototype, "rotation", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.rotation)) ); Bridge.DefineGetter( Matrix4x4Prototype, "lossyScale", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.lossyScale)) ); Bridge.DefineGetter( Matrix4x4Prototype, "isIdentity", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.isIdentity)) ); Bridge.DefineGetter( Matrix4x4Prototype, "determinant", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromDouble(o.wrapped.determinant)) ); Bridge.DefineGetter( Matrix4x4Prototype, "decomposeProjection", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.decomposeProjection)) ); Bridge.DefineGetter( Matrix4x4Prototype, "inverse", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.inverse)) ); Bridge.DefineGetter( Matrix4x4Prototype, "transpose", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.transpose)) ); // Instance Methods Matrix4x4Prototype.SetProperty( "ValidTRS", Bridge.CreateFunction( "ValidTRS", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.ValidTRS())) ) ); Matrix4x4Prototype.SetProperty( "SetTRS", Bridge.CreateFunction( "SetTRS", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => o.wrapped.SetTRS(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Quaternion>(args[2]).wrapped, Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[3]).wrapped)) ) ); Matrix4x4Prototype.SetProperty( "GetHashCode", Bridge.CreateFunction( "GetHashCode", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromInt32(o.wrapped.GetHashCode())) ) ); Matrix4x4Prototype.SetProperty( "Equals", Bridge.CreateFunction( "Equals", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.Equals(Bridge.GetExternal <System.Object>(args[1])))) ) ); Matrix4x4Prototype.SetProperty( "Equals", Bridge.CreateFunction( "Equals", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => JavaScriptValue.FromBoolean(o.wrapped.Equals(Bridge.GetBoxedExternal <UnityEngine.Matrix4x4>(args[1]).wrapped))) ) ); Matrix4x4Prototype.SetProperty( "GetColumn", Bridge.CreateFunction( "GetColumn", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.GetColumn(args[1].ToInt32()))) ) ); Matrix4x4Prototype.SetProperty( "GetRow", Bridge.CreateFunction( "GetRow", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.GetRow(args[1].ToInt32()))) ) ); Matrix4x4Prototype.SetProperty( "SetColumn", Bridge.CreateFunction( "SetColumn", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => o.wrapped.SetColumn(args[1].ToInt32(), Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[2]).wrapped)) ) ); Matrix4x4Prototype.SetProperty( "SetRow", Bridge.CreateFunction( "SetRow", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => o.wrapped.SetRow(args[1].ToInt32(), Bridge.GetBoxedExternal <UnityEngine.Vector4>(args[2]).wrapped)) ) ); Matrix4x4Prototype.SetProperty( "MultiplyPoint", Bridge.CreateFunction( "MultiplyPoint", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.MultiplyPoint(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))) ) ); Matrix4x4Prototype.SetProperty( "MultiplyPoint3x4", Bridge.CreateFunction( "MultiplyPoint3x4", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.MultiplyPoint3x4(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))) ) ); Matrix4x4Prototype.SetProperty( "MultiplyVector", Bridge.CreateFunction( "MultiplyVector", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.MultiplyVector(Bridge.GetBoxedExternal <UnityEngine.Vector3>(args[1]).wrapped))) ) ); Matrix4x4Prototype.SetProperty( "TransformPlane", Bridge.CreateFunction( "TransformPlane", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => Bridge.CreateExternalWithPrototype(o.wrapped.TransformPlane(Bridge.GetBoxedExternal <UnityEngine.Plane>(args[1]).wrapped))) ) ); Matrix4x4Prototype.SetProperty( "toString", Bridge.CreateFunction( "ToString", Bridge.WithBoxedExternal <UnityEngine.Matrix4x4>((o, args) => { if (args.Length == 1) { return(JavaScriptValue.FromString(o.wrapped.ToString())); } else { return(JavaScriptValue.FromString(o.wrapped.ToString(args[1].ToString()))); } }) ) ); }
private JavaScriptValue VisitInteger(JValue token) { return(JavaScriptValue.FromDouble(token.Value <double>())); }
private JavaScriptContext CreateHostContext(JavaScriptRuntime runtime, HttpListenerRequest request) { // Create the context. Note that if we had wanted to start debugging from the very // beginning, we would have called JsStartDebugging right after context is created. JavaScriptContext context = runtime.CreateContext(); // Now set the execution context as being the current one on this thread. using (new JavaScriptContext.Scope(context)) { // Create the host object the script will use. JavaScriptValue hostObject = JavaScriptValue.CreateObject(); // Get the global object JavaScriptValue globalObject = JavaScriptValue.GlobalObject; // Get the name of the property ("host") that we're going to set on the global object. JavaScriptPropertyId hostPropertyId = JavaScriptPropertyId.FromString("host"); // Set the property. globalObject.SetProperty(hostPropertyId, hostObject, true); // Now create the host callbacks that we're going to expose to the script. DefineHostCallback(hostObject, "echo", echoDelegate, IntPtr.Zero); DefineHostCallback(hostObject, "runScript", runScriptDelegate, IntPtr.Zero); DefineHostCallback(hostObject, "readFile", readFileDelegate, IntPtr.Zero); DefineHostCallback(hostObject, "writeFile", writeFileDelegate, IntPtr.Zero); // Create an object for request. JavaScriptValue requestParams = JavaScriptValue.CreateObject(); if (request.RawUrl != null) { requestParams.SetProperty(JavaScriptPropertyId.FromString("rawUrl"), JavaScriptValue.FromString(request.RawUrl), true); } if (request.UserAgent != null) { requestParams.SetProperty(JavaScriptPropertyId.FromString("userAgent"), JavaScriptValue.FromString(request.UserAgent), true); } if (request.UserHostName != null) { requestParams.SetProperty(JavaScriptPropertyId.FromString("userHostName"), JavaScriptValue.FromString(request.UserHostName), true); } if (request.UserHostAddress != null) { requestParams.SetProperty(JavaScriptPropertyId.FromString("userHostAddress"), JavaScriptValue.FromString(request.UserHostAddress), true); } if (request.ServiceName != null) { requestParams.SetProperty(JavaScriptPropertyId.FromString("serviceName"), JavaScriptValue.FromString(request.ServiceName), true); } if (request.HttpMethod != null) { requestParams.SetProperty(JavaScriptPropertyId.FromString("httpMethod"), JavaScriptValue.FromString(request.HttpMethod), true); } if (request.ContentType != null) { requestParams.SetProperty(JavaScriptPropertyId.FromString("contentType"), JavaScriptValue.FromString(request.ContentType), true); } if (request.ContentEncoding != null) { requestParams.SetProperty(JavaScriptPropertyId.FromString("contentEncoding"), JavaScriptValue.FromString(request.ContentEncoding.WebName), true); } requestParams.SetProperty(JavaScriptPropertyId.FromString("keepAlive"), JavaScriptValue.FromBoolean(request.KeepAlive), true); requestParams.SetProperty(JavaScriptPropertyId.FromString("isWebSocketRequest"), JavaScriptValue.FromBoolean(request.IsWebSocketRequest), true); requestParams.SetProperty(JavaScriptPropertyId.FromString("isSecureConnection"), JavaScriptValue.FromBoolean(request.IsSecureConnection), true); requestParams.SetProperty(JavaScriptPropertyId.FromString("isLocal"), JavaScriptValue.FromBoolean(request.IsLocal), true); requestParams.SetProperty(JavaScriptPropertyId.FromString("isAuthenticated"), JavaScriptValue.FromBoolean(request.IsAuthenticated), true); requestParams.SetProperty(JavaScriptPropertyId.FromString("hasEntityBody"), JavaScriptValue.FromBoolean(request.HasEntityBody), true); requestParams.SetProperty(JavaScriptPropertyId.FromString("contentLength64"), JavaScriptValue.FromDouble(request.ContentLength64), true); // need to call begingetclientcertificate //requestParams.SetProperty(JavaScriptPropertyId.FromString("clientCertificateError"), JavaScriptValue.FromInt32(request.ClientCertificateError), true); if (request.UrlReferrer != null) { requestParams.SetProperty(JavaScriptPropertyId.FromString("urlReferrer"), JavaScriptValue.FromString(request.UrlReferrer.ToString()), true); } if (request.RequestTraceIdentifier != null) { requestParams.SetProperty(JavaScriptPropertyId.FromString("requestTraceIdentifier"), JavaScriptValue.FromString(request.RequestTraceIdentifier.ToString()), true); } if (request.RemoteEndPoint != null) { requestParams.SetProperty(JavaScriptPropertyId.FromString("remoteEndPoint"), JavaScriptValue.FromString(request.RemoteEndPoint.ToString()), true); } if (request.ProtocolVersion != null) { requestParams.SetProperty(JavaScriptPropertyId.FromString("protocolVersion"), JavaScriptValue.FromString(request.ProtocolVersion.ToString()), true); } if (request.LocalEndPoint != null) { requestParams.SetProperty(JavaScriptPropertyId.FromString("localEndPoint"), JavaScriptValue.FromString(request.LocalEndPoint.ToString()), true); } if (request.UserLanguages != null) { JavaScriptValue userLanguages = JavaScriptValue.CreateArray((uint)request.UserLanguages.Length); for (int i = 0; i < request.UserLanguages.Length; i++) { userLanguages.SetIndexedProperty(JavaScriptValue.FromInt32(i), JavaScriptValue.FromString(request.UserLanguages[i])); } requestParams.SetProperty(JavaScriptPropertyId.FromString("userLanguages"), userLanguages, true); } if (request.AcceptTypes != null) { JavaScriptValue acceptTypes = JavaScriptValue.CreateArray((uint)request.AcceptTypes.Length); for (int i = 0; i < request.AcceptTypes.Length; i++) { acceptTypes.SetIndexedProperty(JavaScriptValue.FromInt32(i), JavaScriptValue.FromString(request.AcceptTypes[i])); } requestParams.SetProperty(JavaScriptPropertyId.FromString("acceptTypes"), acceptTypes, true); } if (request.QueryString != null) { JavaScriptValue queryString = JavaScriptValue.CreateArray((uint)request.QueryString.Count); for (int i = 0; i < request.QueryString.Count; i++) { JavaScriptValue qsItem = JavaScriptValue.CreateObject(); qsItem.SetProperty(JavaScriptPropertyId.FromString("name"), JavaScriptValue.FromString(request.QueryString.GetKey(i) ?? string.Empty), false); qsItem.SetProperty(JavaScriptPropertyId.FromString("value"), JavaScriptValue.FromString(request.QueryString[i] ?? string.Empty), false); queryString.SetIndexedProperty(JavaScriptValue.FromInt32(i), qsItem); } requestParams.SetProperty(JavaScriptPropertyId.FromString("queryString"), queryString, true); } if (request.Headers != null) { JavaScriptValue headers = JavaScriptValue.CreateArray((uint)request.Headers.Count); for (int i = 0; i < request.Headers.Count; i++) { JavaScriptValue headerItem = JavaScriptValue.CreateObject(); headerItem.SetProperty(JavaScriptPropertyId.FromString("name"), JavaScriptValue.FromString(request.Headers.GetKey(i) ?? string.Empty), false); headerItem.SetProperty(JavaScriptPropertyId.FromString("value"), JavaScriptValue.FromString(request.Headers[i] ?? string.Empty), false); headers.SetIndexedProperty(JavaScriptValue.FromInt32(i), headerItem); } requestParams.SetProperty(JavaScriptPropertyId.FromString("headers"), headers, true); } // #todo // Stream InputStream // CookieCollection Cookies hostObject.SetProperty(JavaScriptPropertyId.FromString("request"), requestParams, true); } return(context); }