/// <summary> /// Removes if exist. /// </summary> /// <param name="id">The identifier.</param> //private void removeIfExist(int id) //{ // if (id != 0) // { // JSApi.removeByID(id); // } //} //private void removeMemberFunction() //{ // // ATTENSION // // same script have same idAwake idStart ... values // // if these lines are executed in OnDestroy (for example for gameObject A) // // other gameObjects (for example B) with the same script // // will also miss these functions // // // // and if another C (with the same script) is born later // // it will re-get these values but they are new values // // // // // // but if they are not removed in OnDestroy // // C valueMap may grow to a very big size // // // // removeIfExist(idAwake); // // removeIfExist(idStart); // // removeIfExist(idFixedUpdate); // // removeIfExist(idUpdate); // // removeIfExist(idOnDestroy); // // removeIfExist(idOnGUI); // // removeIfExist(idOnEnable); // // removeIfExist(idOnTriggerEnter2D); // // removeIfExist(idOnTriggerStay); // // removeIfExist(idOnTriggerExit); // // removeIfExist(idOnAnimatorMove); // // removeIfExist(idOnAnimatorIK); // // removeIfExist(idDestroyChildGameObject); // // removeIfExist(idDisableChildGameObject); // // removeIfExist(idDestroyGameObject); //} //protected void callIfExist(int funID) //{ // if (funID > 0) // { // JSMgr.vCall.CallJSFunctionValue(jsObjID, funID); // } //} //protected void callIfExist(int funID, params object[] args) //{ // if (funID > 0) // { // JSMgr.vCall.CallJSFunctionValue(jsObjID, funID, args); // } //} public void initJS() { if (jsFail || jsSuccess) { return; } if (string.IsNullOrEmpty(jsClassName)) { jsFail = true; return; } // ATTENSION // cannot use createJSClassObject here // because we have to call ctor, to run initialization code // this object will not have finalizeOp jsObjID = JSApi.newJSClassObject(jsClassName); JSApi.setTraceS(jsObjID, true); if (jsObjID == 0) { Debug.LogError("New MonoBehaviour \"" + jsClassName + "\" failed. Did you forget to export that class?"); jsFail = true; return; } JSMgr.addJSCSRel(jsObjID, this); initMemberFunction(); jsSuccess = true; }
public void initJS() { if (jsFail || jsSuccess) { return; } if (string.IsNullOrEmpty(jsClassName)) { jsFail = true; return; } // 注意 // 这里不能用 createJSClassObject // because we have to call ctor, to run initialization code // 这个对象不会有 finalizeOp jsObjID = JSApi.newJSClassObject(this.jsClassName); if (jsObjID == 0) { Debug.LogError("New MonoBehaviour \"" + this.jsClassName + "\" failed. Did you forget to export that class?"); jsFail = true; return; } jsb.M_Mgr.CreateMessages(jsClassName, gameObject); JSApi.setTraceS(jsObjID, true); JSMgr.addJSCSRel(jsObjID, this); initMemberFunction(); jsSuccess = true; }
static bool DictionaryA2_DictionaryA26(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.attachFinalizerObject(_this); --argc; ConstructorInfo constructor = JSDataExchangeMgr.makeGenericConstructor(typeof(System.Collections.Generic.Dictionary <,>), constructorID5); if (constructor == null) { return(true); } int len = argc - 2; if (len == 2) { System.Int32 arg0 = (System.Int32)JSApi.getInt32((int)JSApi.GetType.Arg); object arg1 = (object)JSMgr.datax.getObject((int)JSApi.GetType.Arg); JSMgr.addJSCSRel(_this, constructor.Invoke(null, new object[] { arg0, arg1 })); } return(true); }
static bool RenderTargetSetup_RenderTargetSetup8(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.attachFinalizerObject(_this); --argc; int len = argc; if (len == 4) { UnityEngine.RenderBuffer[] arg0 = JSDataExchangeMgr.GetJSArg <UnityEngine.RenderBuffer[]>(() => { int jsObjID = JSApi.getObject((int)JSApi.GetType.Arg); int length = JSApi.getArrayLength(jsObjID); var ret = new UnityEngine.RenderBuffer[length]; for (var i = 0; i < length; i++) { JSApi.getElement(jsObjID, i); ret[i] = (UnityEngine.RenderBuffer)JSMgr.datax.getObject((int)JSApi.GetType.SaveAndRemove); } return(ret); }); UnityEngine.RenderBuffer arg1 = (UnityEngine.RenderBuffer)JSMgr.datax.getObject((int)JSApi.GetType.Arg); System.Int32 arg2 = (System.Int32)JSApi.getInt32((int)JSApi.GetType.Arg); UnityEngine.CubemapFace arg3 = (UnityEngine.CubemapFace)JSApi.getEnum((int)JSApi.GetType.Arg); JSMgr.addJSCSRel(_this, new UnityEngine.RenderTargetSetup(arg0, arg1, arg2, arg3)); } return(true); }
static bool GameObject_GameObject3(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.attachFinalizerObject(_this); --argc; int len = argc; if (len == 2) { System.String arg0 = (System.String)JSApi.getStringS((int)JSApi.GetType.Arg); System.Type[] arg1 = JSDataExchangeMgr.GetJSArg <System.Type[]>(() => { int jsObjID = JSApi.getObject((int)JSApi.GetType.Arg); int length = JSApi.getArrayLength(jsObjID); var ret = new System.Type[length]; for (var i = 0; i < length; i++) { JSApi.getElement(jsObjID, i); ret[i] = (System.Type)JSDataExchangeMgr.GetTypeByJsParam((int)JSApi.GetType.SaveAndRemove); } return(ret); }); JSMgr.addJSCSRel(_this, new UnityEngine.GameObject(arg0, arg1)); } return(true); }
static bool LOD_LOD2(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.attachFinalizerObject(_this); --argc; int len = argc; if (len == 2) { System.Single arg0 = (System.Single)JSApi.getSingle((int)JSApi.GetType.Arg); UnityEngine.Renderer[] arg1 = JSDataExchangeMgr.GetJSArg <UnityEngine.Renderer[]>(() => { int jsObjID = JSApi.getObject((int)JSApi.GetType.Arg); int length = JSApi.getArrayLength(jsObjID); var ret = new UnityEngine.Renderer[length]; for (var i = 0; i < length; i++) { JSApi.getElement(jsObjID, i); ret[i] = (UnityEngine.Renderer)JSMgr.datax.getObject((int)JSApi.GetType.SaveAndRemove); } return(ret); }); JSMgr.addJSCSRel(_this, new UnityEngine.LOD(arg0, arg1)); } return(true); }
// don't create this object directly, should use JSDataExchangeMgr.getObject public CSRepresentedObject(int jsObjID, bool bFunction = false) { this.jsEngineRound = JSMgr.jsEngineRound; this.jsObjID = jsObjID; this.bFunction = bFunction; JSMgr.addJSCSRel(jsObjID, this, true); if (bFunction) { s_funCount++; } else { s_objCount++; } // ! // refCount may > 1 after inc, because: // WeakReference may == null in getCSObj, which means ~CSRepresentedObject has not been called yet // we continue to create a new CSRepresentedObject, so refCount > 1 //int refCount = JSApi.incRefCount(jsObjID); //Debug.Log(new StringBuilder().AppendFormat("+ CSRepresentedObject {0} Ref[{1}] Fun[{1}]", jsObjID, refCount, bFunction ? 1 : 0)); }
static bool WaitWhile_WaitWhile1(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.attachFinalizerObject(_this); --argc; int len = argc; if (len == 1) { Func <System.Boolean> arg0 = JSDataExchangeMgr.GetJSArg <Func <System.Boolean> >(() => { if (JSApi.isFunctionS((int)JSApi.GetType.Arg)) { return(WaitWhile__ctor_GetDelegate_member0_arg0(JSApi.getFunctionS((int)JSApi.GetType.Arg))); } else { return((Func <System.Boolean>)JSMgr.datax.getObject((int)JSApi.GetType.Arg)); } }); JSMgr.addJSCSRel(_this, new UnityEngine.WaitWhile(arg0)); } return(true); }
static bool WWW_WWW4(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.attachFinalizerObject(_this); --argc; int len = argc; if (len == 3) { System.String arg0 = (System.String)JSApi.getStringS((int)JSApi.GetType.Arg); System.Byte[] arg1 = JSDataExchangeMgr.GetJSArg <System.Byte[]>(() => { int jsObjID = JSApi.getObject((int)JSApi.GetType.Arg); int length = JSApi.getArrayLength(jsObjID); var ret = new System.Byte[length]; for (var i = 0; i < length; i++) { JSApi.getElement(jsObjID, i); ret[i] = (System.Byte)JSApi.getByte((int)JSApi.GetType.SaveAndRemove); } return(ret); }); Dictionary <System.String, System.String> arg2 = (Dictionary <System.String, System.String>)JSMgr.datax.getObject((int)JSApi.GetType.Arg); JSMgr.addJSCSRel(_this, new UnityEngine.WWW(arg0, arg1, arg2)); } return(true); }
////////////////////// VerticalScope /////////////////////////////////////// // constructors static bool VerticalScope_VerticalScope1(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.attachFinalizerObject(_this); --argc; int len = argc; if (len == 1) { UnityEngine.GUILayoutOption[] arg0 = JSDataExchangeMgr.GetJSArg <UnityEngine.GUILayoutOption[]>(() => { int jsObjID = JSApi.getObject((int)JSApi.GetType.Arg); int length = JSApi.getArrayLength(jsObjID); var ret = new UnityEngine.GUILayoutOption[length]; for (var i = 0; i < length; i++) { JSApi.getElement(jsObjID, i); ret[i] = (UnityEngine.GUILayoutOption)JSMgr.datax.getObject((int)JSApi.GetType.SaveAndRemove); } return(ret); }); JSMgr.addJSCSRel(_this, new UnityEngine.GUILayout.VerticalScope(arg0)); } return(true); }
static bool HorizontalScope_HorizontalScope3(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.attachFinalizerObject(_this); --argc; int len = argc; if (len == 3) { System.String arg0 = (System.String)JSApi.getStringS((int)JSApi.GetType.Arg); UnityEngine.GUIStyle arg1 = (UnityEngine.GUIStyle)JSMgr.datax.getObject((int)JSApi.GetType.Arg); UnityEngine.GUILayoutOption[] arg2 = JSDataExchangeMgr.GetJSArg <UnityEngine.GUILayoutOption[]>(() => { int jsObjID = JSApi.getObject((int)JSApi.GetType.Arg); int length = JSApi.getArrayLength(jsObjID); var ret = new UnityEngine.GUILayoutOption[length]; for (var i = 0; i < length; i++) { JSApi.getElement(jsObjID, i); ret[i] = (UnityEngine.GUILayoutOption)JSMgr.datax.getObject((int)JSApi.GetType.SaveAndRemove); } return(ret); }); JSMgr.addJSCSRel(_this, new UnityEngine.GUILayout.HorizontalScope(arg0, arg1, arg2)); } return(true); }
static bool ScrollViewScope_ScrollViewScope2(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.attachFinalizerObject(_this); --argc; int len = argc; if (len == 4) { UnityEngine.Vector2 arg0 = (UnityEngine.Vector2)JSApi.getVector2S((int)JSApi.GetType.Arg); System.Boolean arg1 = (System.Boolean)JSApi.getBooleanS((int)JSApi.GetType.Arg); System.Boolean arg2 = (System.Boolean)JSApi.getBooleanS((int)JSApi.GetType.Arg); UnityEngine.GUILayoutOption[] arg3 = JSDataExchangeMgr.GetJSArg <UnityEngine.GUILayoutOption[]>(() => { int jsObjID = JSApi.getObject((int)JSApi.GetType.Arg); int length = JSApi.getArrayLength(jsObjID); var ret = new UnityEngine.GUILayoutOption[length]; for (var i = 0; i < length; i++) { JSApi.getElement(jsObjID, i); ret[i] = (UnityEngine.GUILayoutOption)JSMgr.datax.getObject((int)JSApi.GetType.SaveAndRemove); } return(ret); }); JSMgr.addJSCSRel(_this, new UnityEngine.GUILayout.ScrollViewScope(arg0, arg1, arg2, arg3)); } return(true); }
static bool KeyValuePairA2_KeyValuePairA22(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.attachFinalizerObject(_this); --argc; ConstructorInfo constructor = JSDataExchangeMgr.makeGenericConstructor(typeof(System.Collections.Generic.KeyValuePair <,>), constructorID1); if (constructor == null) { return(true); } int len = argc - 2; if (len == 2) { object arg0 = (object)JSMgr.datax.getWhatever((int)JSApi.GetType.Arg); object arg1 = (object)JSMgr.datax.getWhatever((int)JSApi.GetType.Arg); JSMgr.addJSCSRel(_this, constructor.Invoke(null, new object[] { arg0, arg1 })); } return(true); }
// public static bool operator !=(CSRepresentedObject x, CSRepresentedObject y) // { // return !(x == y); // } // public static bool operator ==(CSRepresentedObject x, CSRepresentedObject y) // { // // If both are null, or both are same instance, return true. // if (System.Object.ReferenceEquals(x, y)) // { // return true; // } // return x.jsObjID == y.jsObjID; // } // public override bool Equals(object obj) // { // // If parameter is null return false. // if (obj == null) // { // return false; // } // // // If parameter cannot be cast to Point return false. // CSRepresentedObject p = obj as CSRepresentedObject; // if ((System.Object)p == null) // { // return false; // } // return this.jsObjID == p.jsObjID; // } // don't create this object directly, should use JSDataExchangeMgr.getObject public CSRepresentedObject(int jsObjID, bool bFunction = false) { this.jsEngineRound = JSMgr.jsEngineRound; this.jsObjID = jsObjID; this.bFunction = bFunction; JSMgr.addJSCSRel(jsObjID, this, true); if (bFunction) { s_funCount++; } else { s_objCount++; } // ! // inc 之后 refCount 可能 > 1 // getCSObj 可能检查 WeakReference.Target == null,表明 ~CSRepresentedObject 未被调用 // 此时我们继续创建另一个 CSRepresentedObject 对象 // 那么 refCount 就会 > 1 //int refCount = JSApi.incRefCount(jsObjID); //Debug.Log(new StringBuilder().AppendFormat("+ CSRepresentedObject {0} Ref[{1}] Fun[{1}]", jsObjID, refCount, bFunction ? 1 : 0)); }
////////////////////// Joint /////////////////////////////////////// // constructors static bool Joint_Joint1(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.attachFinalizerObject(_this); --argc; int len = argc; if (len == 0) { JSMgr.addJSCSRel(_this, new UnityEngine.Joint()); } return true; }
////////////////////// ComputeShader /////////////////////////////////////// // constructors static bool ComputeShader_ComputeShader1(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.attachFinalizerObject(_this); --argc; int len = argc; if (len == 0) { JSMgr.addJSCSRel(_this, new UnityEngine.ComputeShader()); } return(true); }
static bool AnimatorClipInfo_AnimatorClipInfo1(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.attachFinalizerObject(_this); --argc; int len = argc; if (len == 0) { JSMgr.addJSCSRel(_this, new UnityEngine.AnimatorClipInfo()); } return(true); }
////////////////////// MaterialPropertyBlock /////////////////////////////////////// // constructors static bool MaterialPropertyBlock_MaterialPropertyBlock1(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.attachFinalizerObject(_this); --argc; int len = argc; if (len == 0) { JSMgr.addJSCSRel(_this, new UnityEngine.MaterialPropertyBlock()); } return(true); }
static bool ClothSkinningCoefficient_ClothSkinningCoefficient1(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.attachFinalizerObject(_this); --argc; int len = argc; if (len == 0) { JSMgr.addJSCSRel(_this, new UnityEngine.ClothSkinningCoefficient()); } return(true); }
////////////////////// RuntimeAnimatorController /////////////////////////////////////// // constructors static bool RuntimeAnimatorController_RuntimeAnimatorController1(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.attachFinalizerObject(_this); --argc; int len = argc; if (len == 0) { JSMgr.addJSCSRel(_this, new UnityEngine.RuntimeAnimatorController()); } return(true); }
static bool Burst_Burst1(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.attachFinalizerObject(_this); --argc; int len = argc; if (len == 0) { JSMgr.addJSCSRel(_this, new UnityEngine.ParticleSystem.Burst()); } return(true); }
////////////////////// NavMeshObstacle /////////////////////////////////////// // constructors static bool NavMeshObstacle_NavMeshObstacle1(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.attachFinalizerObject(_this); --argc; int len = argc; if (len == 0) { JSMgr.addJSCSRel(_this, new UnityEngine.NavMeshObstacle()); } return(true); }
////////////////////// StackTraceUtility /////////////////////////////////////// // constructors static bool StackTraceUtility_StackTraceUtility1(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.attachFinalizerObject(_this); --argc; int len = argc; if (len == 0) { JSMgr.addJSCSRel(_this, new UnityEngine.StackTraceUtility()); } return(true); }
////////////////////// AudioSettings /////////////////////////////////////// // constructors static bool AudioSettings_AudioSettings1(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.attachFinalizerObject(_this); --argc; int len = argc; if (len == 0) { JSMgr.addJSCSRel(_this, new UnityEngine.AudioSettings()); } return(true); }
static bool WebCamTexture_WebCamTexture6(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.attachFinalizerObject(_this); --argc; int len = argc; if (len == 0) { JSMgr.addJSCSRel(_this, new UnityEngine.WebCamTexture()); } return(true); }
static bool HumanDescription_HumanDescription1(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.attachFinalizerObject(_this); --argc; int len = argc; if (len == 0) { JSMgr.addJSCSRel(_this, new UnityEngine.HumanDescription()); } return(true); }
////////////////////// PolygonCollider2D /////////////////////////////////////// // constructors static bool PolygonCollider2D_PolygonCollider2D1(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.attachFinalizerObject(_this); --argc; int len = argc; if (len == 0) { JSMgr.addJSCSRel(_this, new UnityEngine.PolygonCollider2D()); } return(true); }
////////////////////// InteractiveCloth /////////////////////////////////////// // constructors static bool InteractiveCloth_InteractiveCloth1(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.attachFinalizerObject(_this); --argc; int len = argc; if (len == 0) { JSMgr.addJSCSRel(_this, new UnityEngine.InteractiveCloth()); } return(true); }
////////////////////// VersionControl /////////////////////////////////////// // constructors static bool VersionControl_VersionControl1(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.attachFinalizerObject(_this); --argc; int len = argc; if (len == 0) { JSMgr.addJSCSRel(_this, new VersionControl()); } return(true); }
////////////////////// UnassignedReferenceException /////////////////////////////////////// // constructors static bool UnassignedReferenceException_UnassignedReferenceException1(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.attachFinalizerObject(_this); --argc; int len = argc; if (len == 0) { JSMgr.addJSCSRel(_this, new UnityEngine.UnassignedReferenceException()); } return(true); }