static int set_onClickEvent(IntPtr L)
    {
        try
        {
            TestEventListener obj  = (TestEventListener)ToLua.CheckObject(L, 1, typeof(TestEventListener));
            EventObject       arg0 = null;

            if (LuaDLL.lua_isuserdata(L, 2) != 0)
            {
                arg0 = (EventObject)ToLua.ToObject(L, 2);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "The event 'TestEventListener.onClickEvent' can only appear on the left hand side of += or -= when used outside of the type 'TestEventListener'"));
            }

            if (arg0.op == EventOp.Add)
            {
                TestEventListener.OnClick ev = (TestEventListener.OnClick) DelegateTraits <TestEventListener.OnClick> .Create(arg0.func);

                obj.onClickEvent += ev;
            }
            else if (arg0.op == EventOp.Sub)
            {
                TestEventListener.OnClick ev = (TestEventListener.OnClick)LuaMisc.GetEventHandler(obj, typeof(TestEventListener), "onClickEvent");
                Delegate[] ds    = ev.GetInvocationList();
                LuaState   state = LuaState.Get(L);

                for (int i = 0; i < ds.Length; i++)
                {
                    ev = (TestEventListener.OnClick)ds[i];
                    LuaDelegate ld = ev.Target as LuaDelegate;

                    if (ld != null && ld.func == arg0.func)
                    {
                        obj.onClickEvent -= ev;
                        state.DelayDispose(ld.func);
                        break;
                    }
                }

                arg0.func.Dispose();
            }

            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #2
0
    static int set_Finished(IntPtr L)
    {
        try
        {
            Task        obj  = (Task)ToLua.CheckObject(L, 1, typeof(Task));
            EventObject arg0 = null;

            if (LuaDLL.lua_isuserdata(L, 2) != 0)
            {
                arg0 = (EventObject)ToLua.ToObject(L, 2);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "The event 'Task.Finished' can only appear on the left hand side of += or -= when used outside of the type 'Task'"));
            }

            if (arg0.op == EventOp.Add)
            {
                Task.FinishedHandler ev = (Task.FinishedHandler)DelegateFactory.CreateDelegate(typeof(Task.FinishedHandler), arg0.func);
                obj.Finished += ev;
            }
            else if (arg0.op == EventOp.Sub)
            {
                Task.FinishedHandler ev    = (Task.FinishedHandler)LuaMisc.GetEventHandler(obj, typeof(Task), "Finished");
                Delegate[]           ds    = ev.GetInvocationList();
                LuaState             state = LuaState.Get(L);

                for (int i = 0; i < ds.Length; i++)
                {
                    ev = (Task.FinishedHandler)ds[i];
                    LuaDelegate ld = ev.Target as LuaDelegate;

                    if (ld != null && ld.func == arg0.func)
                    {
                        obj.Finished -= ev;
                        state.DelayDispose(ld.func);
                        break;
                    }
                }

                arg0.func.Dispose();
            }

            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #3
0
    static int set_onBeforeRender(IntPtr L)
    {
        try
        {
            EventObject arg0 = null;

            if (LuaDLL.lua_isuserdata(L, 2) != 0)
            {
                arg0 = (EventObject)ToLua.ToObject(L, 2);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "The event 'UnityEngine.Application.onBeforeRender' can only appear on the left hand side of += or -= when used outside of the type 'UnityEngine.Application'"));
            }

            if (arg0.op == EventOp.Add)
            {
                UnityEngine.Events.UnityAction ev = (UnityEngine.Events.UnityAction) DelegateTraits <UnityEngine.Events.UnityAction> .Create(arg0.func);

                UnityEngine.Application.onBeforeRender += ev;
            }
            else if (arg0.op == EventOp.Sub)
            {
                UnityEngine.Events.UnityAction ev = (UnityEngine.Events.UnityAction)LuaMisc.GetEventHandler(null, typeof(UnityEngine.Application), "onBeforeRender");
                Delegate[] ds    = ev.GetInvocationList();
                LuaState   state = LuaState.Get(L);

                for (int i = 0; i < ds.Length; i++)
                {
                    ev = (UnityEngine.Events.UnityAction)ds[i];
                    LuaDelegate ld = ev.Target as LuaDelegate;

                    if (ld != null && ld.func == arg0.func)
                    {
                        UnityEngine.Application.onBeforeRender -= ev;
                        state.DelayDispose(ld.func);
                        break;
                    }
                }

                arg0.func.Dispose();
            }

            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #4
0
    static int set_OnUpdate(IntPtr L)
    {
        try
        {
            EventObject arg0 = null;

            if (LuaDLL.lua_isuserdata(L, 2) != 0)
            {
                arg0 = (EventObject)ToLua.ToObject(L, 2);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "The event 'SceneLoader.OnUpdate' can only appear on the left hand side of += or -= when used outside of the type 'SceneLoader'"));
            }

            if (arg0.op == EventOp.Add)
            {
                System.Action <float> ev = (System.Action <float>)DelegateFactory.CreateDelegate(typeof(System.Action <float>), arg0.func);
                SceneLoader.OnUpdate += ev;
            }
            else if (arg0.op == EventOp.Sub)
            {
                System.Action <float> ev = (System.Action <float>)LuaMisc.GetEventHandler(null, typeof(SceneLoader), "OnUpdate");
                Delegate[]            ds = ev.GetInvocationList();
                LuaState state           = LuaState.Get(L);

                for (int i = 0; i < ds.Length; i++)
                {
                    ev = (System.Action <float>)ds[i];
                    LuaDelegate ld = ev.Target as LuaDelegate;

                    if (ld != null && ld.func == arg0.func)
                    {
                        SceneLoader.OnUpdate -= ev;
                        state.DelayDispose(ld.func);
                        break;
                    }
                }

                arg0.func.Dispose();
            }

            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    private static int set_onClickEvent(IntPtr L)
    {
        int result;

        try
        {
            TestEventListener testEventListener = (TestEventListener)ToLua.CheckObject(L, 1, typeof(TestEventListener));
            if (LuaDLL.lua_isuserdata(L, 2) != 0)
            {
                EventObject eventObject = (EventObject)ToLua.ToObject(L, 2);
                if (eventObject.op == EventOp.Add)
                {
                    TestEventListener.OnClick value = (TestEventListener.OnClick)DelegateFactory.CreateDelegate(typeof(TestEventListener.OnClick), eventObject.func);
                    testEventListener.onClickEvent += value;
                }
                else if (eventObject.op == EventOp.Sub)
                {
                    TestEventListener.OnClick onClick = (TestEventListener.OnClick)LuaMisc.GetEventHandler(testEventListener, typeof(TestEventListener), "onClickEvent");
                    Delegate[] invocationList         = onClick.GetInvocationList();
                    LuaState   luaState = LuaState.Get(L);
                    for (int i = 0; i < invocationList.Length; i++)
                    {
                        onClick = (TestEventListener.OnClick)invocationList[i];
                        LuaDelegate luaDelegate = onClick.Target as LuaDelegate;
                        if (luaDelegate != null && luaDelegate.func == eventObject.func)
                        {
                            testEventListener.onClickEvent -= onClick;
                            luaState.DelayDispose(luaDelegate.func);
                            break;
                        }
                    }
                    eventObject.func.Dispose();
                }
                result = 0;
            }
            else
            {
                result = LuaDLL.luaL_throw(L, "The event 'TestEventListener.onClickEvent' can only appear on the left hand side of += or -= when used outside of the type 'TestEventListener'");
            }
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
    private static int set_logMessageReceivedThreaded(IntPtr L)
    {
        int result;

        try
        {
            if (LuaDLL.lua_isuserdata(L, 2) != 0)
            {
                EventObject eventObject = (EventObject)ToLua.ToObject(L, 2);
                if (eventObject.op == EventOp.Add)
                {
                    Application.LogCallback logCallback = (Application.LogCallback)DelegateFactory.CreateDelegate(typeof(Application.LogCallback), eventObject.func);
                    Application.add_logMessageReceivedThreaded(logCallback);
                }
                else if (eventObject.op == EventOp.Sub)
                {
                    Application.LogCallback logCallback2 = (Application.LogCallback)LuaMisc.GetEventHandler(null, typeof(Application), "logMessageReceivedThreaded");
                    Delegate[] invocationList            = logCallback2.GetInvocationList();
                    LuaState   luaState = LuaState.Get(L);
                    for (int i = 0; i < invocationList.Length; i++)
                    {
                        logCallback2 = (Application.LogCallback)invocationList[i];
                        LuaDelegate luaDelegate = logCallback2.get_Target() as LuaDelegate;
                        if (luaDelegate != null && luaDelegate.func == eventObject.func)
                        {
                            Application.remove_logMessageReceivedThreaded(logCallback2);
                            luaState.DelayDispose(luaDelegate.func);
                            break;
                        }
                    }
                    eventObject.func.Dispose();
                }
                result = 0;
            }
            else
            {
                result = LuaDLL.luaL_throw(L, "The event 'UnityEngine.Application.logMessageReceivedThreaded' can only appear on the left hand side of += or -= when used outside of the type 'UnityEngine.Application'");
            }
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
예제 #7
0
    static int set_StateChanged(IntPtr L)
    {
        MyFrameWork.BaseUI obj  = (MyFrameWork.BaseUI)ToLua.CheckObject(L, 1, typeof(MyFrameWork.BaseUI));
        EventObject        arg0 = null;

        if (LuaDLL.lua_isuserdata(L, 2) != 0)
        {
            arg0 = (EventObject)ToLua.ToObject(L, 2);
        }
        else
        {
            return(LuaDLL.luaL_error(L, "The event 'MyFrameWork.BaseUI.StateChanged' can only appear on the left hand side of += or -= when used outside of the type 'MyFrameWork.BaseUI'"));
        }

        if (arg0.op == EventOp.Add)
        {
            MyFrameWork.StateChangedEvent ev = (MyFrameWork.StateChangedEvent)DelegateFactory.CreateDelegate(typeof(MyFrameWork.StateChangedEvent), arg0.func);
            obj.StateChanged += ev;
        }
        else if (arg0.op == EventOp.Sub)
        {
            MyFrameWork.StateChangedEvent ev = (MyFrameWork.StateChangedEvent)LuaMisc.GetEventHandler(obj, typeof(MyFrameWork.BaseUI), "StateChanged");
            Delegate[] ds    = ev.GetInvocationList();
            LuaState   state = LuaState.Get(L);

            for (int i = 0; i < ds.Length; i++)
            {
                ev = (MyFrameWork.StateChangedEvent)ds[i];
                LuaDelegate ld = ev.Target as LuaDelegate;

                if (ld != null && ld.func == arg0.func)
                {
                    obj.StateChanged -= ev;
                    state.DelayDispose(ld.func);
                    break;
                }
            }

            arg0.func.Dispose();
        }

        return(0);
    }
    private static int set_reapplyDrivenProperties(IntPtr L)
    {
        int result;

        try
        {
            if (LuaDLL.lua_isuserdata(L, 2) != 0)
            {
                EventObject eventObject = (EventObject)ToLua.ToObject(L, 2);
                if (eventObject.op == EventOp.Add)
                {
                    RectTransform.ReapplyDrivenProperties value = (RectTransform.ReapplyDrivenProperties)DelegateFactory.CreateDelegate(typeof(RectTransform.ReapplyDrivenProperties), eventObject.func);
                    RectTransform.reapplyDrivenProperties += value;
                }
                else if (eventObject.op == EventOp.Sub)
                {
                    RectTransform.ReapplyDrivenProperties reapplyDrivenProperties = (RectTransform.ReapplyDrivenProperties)LuaMisc.GetEventHandler(null, typeof(RectTransform), "reapplyDrivenProperties");
                    Delegate[] invocationList = reapplyDrivenProperties.GetInvocationList();
                    LuaState   luaState       = LuaState.Get(L);
                    for (int i = 0; i < invocationList.Length; i++)
                    {
                        reapplyDrivenProperties = (RectTransform.ReapplyDrivenProperties)invocationList[i];
                        LuaDelegate luaDelegate = reapplyDrivenProperties.Target as LuaDelegate;
                        if (luaDelegate != null && luaDelegate.func == eventObject.func)
                        {
                            RectTransform.reapplyDrivenProperties -= reapplyDrivenProperties;
                            luaState.DelayDispose(luaDelegate.func);
                            break;
                        }
                    }
                    eventObject.func.Dispose();
                }
                result = 0;
            }
            else
            {
                result = LuaDLL.luaL_throw(L, "The event 'UnityEngine.RectTransform.reapplyDrivenProperties' can only appear on the left hand side of += or -= when used outside of the type 'UnityEngine.RectTransform'");
            }
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
예제 #9
0
    static int set_willRenderCanvases(IntPtr L)
    {
        try
        {
            EventObject arg0 = null;

            if (LuaDLL.lua_isuserdata(L, 2) != 0)
            {
                arg0 = (EventObject)ToLua.ToObject(L, 2);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "The event 'UnityEngine.Canvas.willRenderCanvases' can only appear on the left hand side of += or -= when used outside of the type 'UnityEngine.Canvas'"));
            }

            if (arg0.op == EventOp.Add)
            {
                UnityEngine.Canvas.WillRenderCanvases ev = (UnityEngine.Canvas.WillRenderCanvases)DelegateFactory.CreateDelegate(typeof(UnityEngine.Canvas.WillRenderCanvases), arg0.func);
                UnityEngine.Canvas.willRenderCanvases += ev;
            }
            else if (arg0.op == EventOp.Sub)
            {
                UnityEngine.Canvas.WillRenderCanvases ev = (UnityEngine.Canvas.WillRenderCanvases)LuaMisc.GetEventHandler(null, typeof(UnityEngine.Canvas), "willRenderCanvases");
                Delegate[] ds    = ev.GetInvocationList();
                LuaState   state = LuaState.Get(L);

                for (int i = 0; i < ds.Length; i++)
                {
                    ev = (UnityEngine.Canvas.WillRenderCanvases)ds[i];
                    LuaDelegate ld = ev.Target as LuaDelegate;

                    if (ld != null && ld.func == arg0.func)
                    {
                        UnityEngine.Canvas.willRenderCanvases -= ev;
                        state.DelayDispose(ld.func);
                        break;
                    }
                }

                arg0.func.Dispose();
            }

            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #10
0
    static int set_logMessageReceivedThreaded(IntPtr L)
    {
        try
        {
            EventObject arg0 = null;

            if (LuaDLL.lua_isuserdata(L, 2) != 0)
            {
                arg0 = (EventObject)ToLua.ToObject(L, 2);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "The event 'UnityEngine.Application.logMessageReceivedThreaded' can only appear on the left hand side of += or -= when used outside of the type 'UnityEngine.Application'"));
            }

            if (arg0.op == EventOp.Add)
            {
                UnityEngine.Application.LogCallback ev = (UnityEngine.Application.LogCallback)DelegateFactory.CreateDelegate(typeof(UnityEngine.Application.LogCallback), arg0.func);
                UnityEngine.Application.logMessageReceivedThreaded += ev;
            }
            else if (arg0.op == EventOp.Sub)
            {
                UnityEngine.Application.LogCallback ev = (UnityEngine.Application.LogCallback)LuaMisc.GetEventHandler(null, typeof(UnityEngine.Application), "logMessageReceivedThreaded");
                Delegate[] ds    = ev.GetInvocationList();
                LuaState   state = LuaState.Get(L);

                for (int i = 0; i < ds.Length; i++)
                {
                    ev = (UnityEngine.Application.LogCallback)ds[i];
                    LuaDelegate ld = ev.Target as LuaDelegate;

                    if (ld != null && ld.func == arg0.func)
                    {
                        UnityEngine.Application.logMessageReceivedThreaded -= ev;
                        state.DelayDispose(ld.func);
                        break;
                    }
                }

                arg0.func.Dispose();
            }

            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #11
0
    static int set_Interrupt(IntPtr L)
    {
        try
        {
            Spine.TrackEntry obj  = (Spine.TrackEntry)ToLua.CheckObject(L, 1, typeof(Spine.TrackEntry));
            EventObject      arg0 = null;

            if (LuaDLL.lua_isuserdata(L, 2) != 0)
            {
                arg0 = (EventObject)ToLua.ToObject(L, 2);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "The event 'Spine.TrackEntry.Interrupt' can only appear on the left hand side of += or -= when used outside of the type 'Spine.TrackEntry'"));
            }

            if (arg0.op == EventOp.Add)
            {
                Spine.AnimationState.TrackEntryDelegate ev = (Spine.AnimationState.TrackEntryDelegate)DelegateFactory.CreateDelegate(typeof(Spine.AnimationState.TrackEntryDelegate), arg0.func);
                obj.Interrupt += ev;
            }
            else if (arg0.op == EventOp.Sub)
            {
                Spine.AnimationState.TrackEntryDelegate ev = (Spine.AnimationState.TrackEntryDelegate)LuaMisc.GetEventHandler(obj, typeof(Spine.TrackEntry), "Interrupt");
                Delegate[] ds    = ev.GetInvocationList();
                LuaState   state = LuaState.Get(L);

                for (int i = 0; i < ds.Length; i++)
                {
                    ev = (Spine.AnimationState.TrackEntryDelegate)ds[i];
                    LuaDelegate ld = ev.Target as LuaDelegate;

                    if (ld != null && ld.func == arg0.func)
                    {
                        obj.Interrupt -= ev;
                        state.DelayDispose(ld.func);
                        break;
                    }
                }

                arg0.func.Dispose();
            }

            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    static int set_completed(IntPtr L)
    {
        try
        {
            UnityEngine.AsyncOperation obj = (UnityEngine.AsyncOperation)ToLua.CheckObject(L, 1, typeof(UnityEngine.AsyncOperation));
            EventObject arg0 = null;

            if (LuaDLL.lua_isuserdata(L, 2) != 0)
            {
                arg0 = (EventObject)ToLua.ToObject(L, 2);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "The event 'UnityEngine.AsyncOperation.completed' can only appear on the left hand side of += or -= when used outside of the type 'UnityEngine.AsyncOperation'"));
            }

            if (arg0.op == EventOp.Add)
            {
                System.Action <UnityEngine.AsyncOperation> ev = (System.Action <UnityEngine.AsyncOperation>)DelegateFactory.CreateDelegate(typeof(System.Action <UnityEngine.AsyncOperation>), arg0.func);
                obj.completed += ev;
            }
            else if (arg0.op == EventOp.Sub)
            {
                System.Action <UnityEngine.AsyncOperation> ev = (System.Action <UnityEngine.AsyncOperation>)LuaMisc.GetEventHandler(obj, typeof(UnityEngine.AsyncOperation), "completed");
                Delegate[] ds    = ev.GetInvocationList();
                LuaState   state = LuaState.Get(L);

                for (int i = 0; i < ds.Length; i++)
                {
                    ev = (System.Action <UnityEngine.AsyncOperation>)ds[i];
                    LuaDelegate ld = ev.Target as LuaDelegate;

                    if (ld != null && ld.func == arg0.func)
                    {
                        obj.completed -= ev;
                        state.DelayDispose(ld.func);
                        break;
                    }
                }

                arg0.func.Dispose();
            }

            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #13
0
    static int set_PropertyChanged(IntPtr L)
    {
        try
        {
            Newtonsoft.Json.Linq.JObject obj = (Newtonsoft.Json.Linq.JObject)ToLua.CheckObject(L, 1, typeof(Newtonsoft.Json.Linq.JObject));
            EventObject arg0 = null;

            if (LuaDLL.lua_isuserdata(L, 2) != 0)
            {
                arg0 = (EventObject)ToLua.ToObject(L, 2);
            }
            else
            {
                return LuaDLL.luaL_throw(L, "The event 'Newtonsoft.Json.Linq.JObject.PropertyChanged' can only appear on the left hand side of += or -= when used outside of the type 'Newtonsoft.Json.Linq.JObject'");
            }

            if (arg0.op == EventOp.Add)
            {
                System.ComponentModel.PropertyChangedEventHandler ev = (System.ComponentModel.PropertyChangedEventHandler)DelegateFactory.CreateDelegate(typeof(System.ComponentModel.PropertyChangedEventHandler), arg0.func);
                obj.PropertyChanged += ev;
            }
            else if (arg0.op == EventOp.Sub)
            {
                System.ComponentModel.PropertyChangedEventHandler ev = (System.ComponentModel.PropertyChangedEventHandler)LuaMisc.GetEventHandler(obj, typeof(Newtonsoft.Json.Linq.JObject), "PropertyChanged");
                Delegate[] ds = ev.GetInvocationList();
                LuaState state = LuaState.Get(L);

                for (int i = 0; i < ds.Length; i++)
                {
                    ev = (System.ComponentModel.PropertyChangedEventHandler)ds[i];
                    LuaDelegate ld = ev.Target as LuaDelegate;

                    if (ld != null && ld.func == arg0.func)
                    {
                        obj.PropertyChanged -= ev;
                        state.DelayDispose(ld.func);
                        break;
                    }
                }

                arg0.func.Dispose();
            }

            return 0;
        }
        catch(Exception e)
        {
            return LuaDLL.toluaL_exception(L, e);
        }
    }