Example #1
0
//     public static int getFunctionS(int e)
//     {
//         int funID = JSApi.getFunction(e);
//         if (JSEngine.inst != null && JSEngine.inst.forceProtectJSFunction)
//         {
//             if (!JSApi.isTracedS(funID))
//             {
//                 protectedFunCount++;
//                 JSApi.setTraceS(funID, true);
//             }
//         }
//         return funID;
//     }
    /// <summary>
    /// Gets the JavaScript function.
    /// it's wrapped with CSRepresentedObject.
    /// This function is almost the same as JSDataMgr.getObject
    /// </summary>
    /// <param name="e">The e.</param>
    /// <returns></returns>
    public static CSRepresentedObject getFunctionS(int e)
    {
        int    funID = JSApi.getFunction(e);
        object obj   = JSMgr.getCSObj(funID);

        if (obj == null)
        {
            obj = new CSRepresentedObject(funID, true);
        }
        return((CSRepresentedObject)obj);
    }
    void Start()
    {
        string n  = "jsb.Test.Logic.TestCallFromCs";
        int    id = getJsObj(n);

        //1---------------------------------------------------------------
        // 调用全局函数,使用 id 0
        JSMgr.vCall.CallJSFunctionName(id, "CreateJSBindingInfo");

        object obj = JSMgr.datax.getObject((int)JSApi.GetType.JSFunRet);
        CSRepresentedObject csObj = (CSRepresentedObject)obj;

        PrintJSBindingInfo(csObj.jsObjID);
    }
    public object getObject(int e)
    {
        int jsObjID = JSApi.getObject(e);

        if (jsObjID == 0)
        {
            // no error
            return(null);
        }

        object csObj = JSMgr.getCSObj(jsObjID);

        if (csObj == null)
        {
            csObj = new CSRepresentedObject(jsObjID);
        }
        return(csObj);
    }
    public static System.Action APIExportTest_AddDelegate_GetDelegate_member1_arg0(CSRepresentedObject objFunction)
    {
        if (objFunction == null || objFunction.jsObjID == 0)
        {
            return(null);
        }
        var action = JSMgr.getJSFunCSDelegateRel <System.Action>(objFunction.jsObjID);

        if (action == null)
        {
            action = () =>
            {
                JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID);
            };
            JSMgr.addJSFunCSDelegateRel(objFunction.jsObjID, action);
        }
        return(action);
    }
Example #5
0
    // Use this for initialization
    void Start()
    {
        //1---------------------------------------------------------------
        // 调用全局函数,使用 id 0
        JSMgr.vCall.CallJSFunctionName(0, "CreateJSBindingInfo");

        object obj = JSMgr.datax.getObject((int)JSApi.GetType.JSFunRet);

        if (obj != null)
        {
            CSRepresentedObject csObj = (CSRepresentedObject)obj;
            PrintJSBindingInfo(csObj.jsObjID);
        }
        else
        {
            Debug.Log("obj is null");
        }
    }
    public static Predicate <T> HashSetA1_RemoveWhere_GetDelegate_member17_arg0 <T>(CSRepresentedObject objFunction)
    {
        if (objFunction == null || objFunction.jsObjID == 0)
        {
            return(null);
        }
        var action = JSMgr.getJSFunCSDelegateRel <Predicate <T> >(objFunction.jsObjID);

        if (action == null)
        {
            action = (obj) =>
            {
                JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID, obj);
                return((System.Boolean)JSApi.getBooleanS((int)JSApi.GetType.JSFunRet));
            };
            JSMgr.addJSFunCSDelegateRel(objFunction.jsObjID, action);
        }
        return(action);
    }
Example #7
0
////////////////////// WaitWhile ///////////////////////////////////////
// constructors
    public static Func <System.Boolean> WaitWhile__ctor_GetDelegate_member0_arg0(CSRepresentedObject objFunction)
    {
        if (objFunction == null || objFunction.jsObjID == 0)
        {
            return(null);
        }
        var action = JSMgr.getJSFunCSDelegateRel <Func <System.Boolean> >(objFunction.jsObjID);

        if (action == null)
        {
            action = () =>
            {
                JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID);
                return((System.Boolean)JSApi.getBooleanS((int)JSApi.GetType.JSFunRet));
            };
            JSMgr.addJSFunCSDelegateRel(objFunction.jsObjID, action);
        }
        return(action);
    }
    public static TweenCallback <System.Int32> TweenParams_OnWaypointChange_GetDelegate_member8_arg0(CSRepresentedObject objFunction)
    {
        if (objFunction == null || objFunction.jsObjID == 0)
        {
            return(null);
        }
        var action = JSMgr.getJSFunCSDelegateRel <TweenCallback <System.Int32> >(objFunction.jsObjID);

        if (action == null)
        {
            action = (value) =>
            {
                JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID, value);
            };
            JSMgr.addJSFunCSDelegateRel(objFunction.jsObjID, action);
        }
        return(action);
    }
    public static UnityEngine.Display.DisplaysUpdatedDelegate Display_remove_onDisplaysUpdated_GetDelegate_member3_arg0(CSRepresentedObject objFunction)
    {
        if (objFunction == null || objFunction.jsObjID == 0)
        {
            return(null);
        }
        var action = JSMgr.getJSFunCSDelegateRel <UnityEngine.Display.DisplaysUpdatedDelegate>(objFunction.jsObjID);

        if (action == null)
        {
            action = () =>
            {
                JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID);
            };
            JSMgr.addJSFunCSDelegateRel(objFunction.jsObjID, action);
        }
        return(action);
    }
Example #10
0
    public static UnityEngine.AudioClip.PCMReaderCallback AudioClip_Create_GetDelegate_member3_arg6(CSRepresentedObject objFunction)
    {
        if (objFunction == null || objFunction.jsObjID == 0)
        {
            return(null);
        }
        var action = JSMgr.getJSFunCSDelegateRel <UnityEngine.AudioClip.PCMReaderCallback>(objFunction.jsObjID);

        if (action == null)
        {
            action = (data) =>
            {
                JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID, data);
            };
            JSMgr.addJSFunCSDelegateRel(objFunction.jsObjID, action);
        }
        return(action);
    }
    public static Action <UnityEngine.MonoBehaviour> APIExportTest_RemoveEvent_GetDelegate_member5_arg0(CSRepresentedObject objFunction)
    {
        if (objFunction == null || objFunction.jsObjID == 0)
        {
            return(null);
        }
        var action = JSMgr.getJSFunCSDelegateRel <Action <UnityEngine.MonoBehaviour> >(objFunction.jsObjID);

        if (action == null)
        {
            action = (obj) =>
            {
                JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID, obj);
            };
            JSMgr.addJSFunCSDelegateRel(objFunction.jsObjID, action);
        }
        return(action);
    }
Example #12
0
    public static UnityEngine.Camera.CameraCallback Camera_onPreRender_GetDelegate_member1_arg0(CSRepresentedObject objFunction)
    {
        if (objFunction == null || objFunction.jsObjID == 0)
        {
            return(null);
        }
        var action = JSMgr.getJSFunCSDelegateRel <UnityEngine.Camera.CameraCallback>(objFunction.jsObjID);

        if (action == null)
        {
            action = (cam) =>
            {
                JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID, cam);
            };
            JSMgr.addJSFunCSDelegateRel(objFunction.jsObjID, action);
        }
        return(action);
    }
    public static UnityEngine.Application.LogCallback Application_remove_logMessageReceivedThreaded_GetDelegate_member15_arg0(CSRepresentedObject objFunction)
    {
        if (objFunction == null || objFunction.jsObjID == 0)
        {
            return(null);
        }
        var action = JSMgr.getJSFunCSDelegateRel <UnityEngine.Application.LogCallback>(objFunction.jsObjID);

        if (action == null)
        {
            action = (condition, stackTrace, type) =>
            {
                JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID, condition, stackTrace, type);
            };
            JSMgr.addJSFunCSDelegateRel(objFunction.jsObjID, action);
        }
        return(action);
    }
Example #14
0
//     public static int getFunctionS(int e)
//     {
//         int funID = JSApi.getFunction(e);
//         if (JSEngine.inst != null && JSEngine.inst.forceProtectJSFunction)
//         {
//             if (!JSApi.isTracedS(funID))
//             {
//                 protectedFunCount++;
//                 JSApi.setTraceS(funID, true);
//             }
//         }
//         return funID;
//     }
    /// <summary>
    /// Gets the JavaScript function.
    /// it's wrapped with CSRepresentedObject.
    /// This function is almost the same as JSDataMgr.getObject
    /// </summary>
    /// <param name="e">The e.</param>
    /// <returns></returns>
    public static CSRepresentedObject getFunctionS(int e)
    {
        int funID = JSApi.getFunction(e);
        object obj = JSMgr.getCSObj(funID);
        if (obj == null)
            obj = new CSRepresentedObject(funID, true);
        return (CSRepresentedObject)obj;
    }
Example #15
0
    public static Action <UnityEngine.Font> Font_remove_textureRebuilt_GetDelegate_member9_arg0(CSRepresentedObject objFunction)
    {
        if (objFunction == null || objFunction.jsObjID == 0)
        {
            return(null);
        }
        var action = JSMgr.getJSFunCSDelegateRel <Action <UnityEngine.Font> >(objFunction.jsObjID);

        if (action == null)
        {
            action = (obj) =>
            {
                JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID, obj);
            };
            JSMgr.addJSFunCSDelegateRel(objFunction.jsObjID, action);
        }
        return(action);
    }
    public static System.Text.RegularExpressions.MatchEvaluator Regex_Replace_GetDelegate_member34_arg2(CSRepresentedObject objFunction)
    {
        if (objFunction == null || objFunction.jsObjID == 0)
        {
            return(null);
        }
        var action = JSMgr.getJSFunCSDelegateRel <System.Text.RegularExpressions.MatchEvaluator>(objFunction.jsObjID);

        if (action == null)
        {
            action = (match) =>
            {
                JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID, match);
                return((System.String)JSApi.getStringS((int)JSApi.GetType.JSFunRet));
            };
            JSMgr.addJSFunCSDelegateRel(objFunction.jsObjID, action);
        }
        return(action);
    }
    public static DG.Tweening.EaseFunction TweenParams_SetEase_GetDelegate_member13_arg0(CSRepresentedObject objFunction)
    {
        if (objFunction == null || objFunction.jsObjID == 0)
        {
            return(null);
        }
        var action = JSMgr.getJSFunCSDelegateRel <DG.Tweening.EaseFunction>(objFunction.jsObjID);

        if (action == null)
        {
            action = (time, duration, overshootOrAmplitude, period) =>
            {
                JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID, time, duration, overshootOrAmplitude, period);
                return((System.Single)JSApi.getSingle((int)JSApi.GetType.JSFunRet));
            };
            JSMgr.addJSFunCSDelegateRel(objFunction.jsObjID, action);
        }
        return(action);
    }
    public static DG.Tweening.TweenCallback TweenParams_OnComplete_GetDelegate_member1_arg0(CSRepresentedObject objFunction)
    {
        if (objFunction == null || objFunction.jsObjID == 0)
        {
            return(null);
        }
        var action = JSMgr.getJSFunCSDelegateRel <DG.Tweening.TweenCallback>(objFunction.jsObjID);

        if (action == null)
        {
            action = () =>
            {
                JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID);
            };
            JSMgr.addJSFunCSDelegateRel(objFunction.jsObjID, action);
        }
        return(action);
    }
////////////////////// DOVirtual ///////////////////////////////////////
// constructors

// fields

// properties

// methods
    public static DG.Tweening.TweenCallback DOVirtual_DelayedCall_GetDelegate_member0_arg1(CSRepresentedObject objFunction)
    {
        if (objFunction == null || objFunction.jsObjID == 0)
        {
            return(null);
        }
        var action = JSMgr.getJSFunCSDelegateRel <DG.Tweening.TweenCallback>(objFunction.jsObjID);

        if (action == null)
        {
            action = () =>
            {
                JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID);
            };
            JSMgr.addJSFunCSDelegateRel(objFunction.jsObjID, action);
        }
        return(action);
    }
    public static UnityEngine.Application.AdvertisingIdentifierCallback Application_RequestAdvertisingIdentifierAsync_GetDelegate_member16_arg0(CSRepresentedObject objFunction)
    {
        if (objFunction == null || objFunction.jsObjID == 0)
        {
            return(null);
        }
        var action = JSMgr.getJSFunCSDelegateRel <UnityEngine.Application.AdvertisingIdentifierCallback>(objFunction.jsObjID);

        if (action == null)
        {
            action = (advertisingId, trackingEnabled, errorMsg) =>
            {
                JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID, advertisingId, trackingEnabled, errorMsg);
            };
            JSMgr.addJSFunCSDelegateRel(objFunction.jsObjID, action);
        }
        return(action);
    }
// fields

// properties
    public static UnityEngine.CullingGroup.StateChanged CullingGroup_onStateChanged_GetDelegate_member0_arg0(CSRepresentedObject objFunction)
    {
        if (objFunction == null || objFunction.jsObjID == 0)
        {
            return(null);
        }
        var action = JSMgr.getJSFunCSDelegateRel <UnityEngine.CullingGroup.StateChanged>(objFunction.jsObjID);

        if (action == null)
        {
            action = (sphere) =>
            {
                JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID, sphere);
            };
            JSMgr.addJSFunCSDelegateRel(objFunction.jsObjID, action);
        }
        return(action);
    }
// methods
    public static UnityEngine.AudioSettings.AudioConfigurationChangeHandler AudioSettings_add_OnAudioConfigurationChanged_GetDelegate_member0_arg0(CSRepresentedObject objFunction)
    {
        if (objFunction == null || objFunction.jsObjID == 0)
        {
            return(null);
        }
        var action = JSMgr.getJSFunCSDelegateRel <UnityEngine.AudioSettings.AudioConfigurationChangeHandler>(objFunction.jsObjID);

        if (action == null)
        {
            action = (deviceWasChanged) =>
            {
                JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID, deviceWasChanged);
            };
            JSMgr.addJSFunCSDelegateRel(objFunction.jsObjID, action);
        }
        return(action);
    }
    public static TweenCallback <System.Single> DOVirtual_Float_GetDelegate_member5_arg3(CSRepresentedObject objFunction)
    {
        if (objFunction == null || objFunction.jsObjID == 0)
        {
            return(null);
        }
        var action = JSMgr.getJSFunCSDelegateRel <TweenCallback <System.Single> >(objFunction.jsObjID);

        if (action == null)
        {
            action = (value) =>
            {
                JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID, value);
            };
            JSMgr.addJSFunCSDelegateRel(objFunction.jsObjID, action);
        }
        return(action);
    }