コード例 #1
0
    static int UnityEngine_RectTransform_ReapplyDrivenProperties(IntPtr L)
    {
#if UNITY_EDITOR
        ToluaProfiler.AddCallRecord("Framework.MonoSingleton<Framework.ResourceMgr>.UnityEngine_RectTransform_ReapplyDrivenProperties");
#endif
        try
        {
            int         count = LuaDLL.lua_gettop(L);
            LuaFunction func  = ToLua.CheckLuaFunction(L, 1);

            if (count == 1)
            {
                Delegate arg1 = DelegateTraits <UnityEngine.RectTransform.ReapplyDrivenProperties> .Create(func);

                ToLua.Push(L, arg1);
            }
            else
            {
                LuaTable self = ToLua.CheckLuaTable(L, 2);
                Delegate arg1 = DelegateTraits <UnityEngine.RectTransform.ReapplyDrivenProperties> .Create(func, self);

                ToLua.Push(L, arg1);
            }
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #2
0
    static int KBEngine_NetworkInterface_ConnectCallback(IntPtr L)
    {
        try
        {
            int         count = LuaDLL.lua_gettop(L);
            LuaFunction func  = ToLua.CheckLuaFunction(L, 1);

            if (count == 1)
            {
                Delegate arg1 = DelegateTraits <KBEngine.NetworkInterface.ConnectCallback> .Create(func);

                ToLua.Push(L, arg1);
            }
            else
            {
                LuaTable self = ToLua.CheckLuaTable(L, 2);
                Delegate arg1 = DelegateTraits <KBEngine.NetworkInterface.ConnectCallback> .Create(func, self);

                ToLua.Push(L, arg1);
            }
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #3
0
    static int UnityEngine_AudioClip_PCMSetPositionCallback(IntPtr L)
    {
#if UNITY_EDITOR
        ToluaProfiler.AddCallRecord("Framework.MonoSingleton<Framework.ResourceMgr>.UnityEngine_AudioClip_PCMSetPositionCallback");
#endif
        try
        {
            int         count = LuaDLL.lua_gettop(L);
            LuaFunction func  = ToLua.CheckLuaFunction(L, 1);

            if (count == 1)
            {
                Delegate arg1 = DelegateTraits <UnityEngine.AudioClip.PCMSetPositionCallback> .Create(func);

                ToLua.Push(L, arg1);
            }
            else
            {
                LuaTable self = ToLua.CheckLuaTable(L, 2);
                Delegate arg1 = DelegateTraits <UnityEngine.AudioClip.PCMSetPositionCallback> .Create(func, self);

                ToLua.Push(L, arg1);
            }
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #4
0
    static int System_Action_string_UnityEngine_LogType(IntPtr L)
    {
        try
        {
            int         count = LuaDLL.lua_gettop(L);
            LuaFunction func  = ToLua.CheckLuaFunction(L, 1);

            if (count == 1)
            {
                Delegate arg1 = DelegateTraits <System.Action <string, UnityEngine.LogType> > .Create(func);

                ToLua.Push(L, arg1);
            }
            else
            {
                LuaTable self = ToLua.CheckLuaTable(L, 2);
                Delegate arg1 = DelegateTraits <System.Action <string, UnityEngine.LogType> > .Create(func, self);

                ToLua.Push(L, arg1);
            }
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #5
0
	static int UIPanel_OnGeometryUpdated(IntPtr L)
	{
		try
		{
			int count = LuaDLL.lua_gettop(L);
			LuaFunction func = ToLua.CheckLuaFunction(L, 1);

			if (count == 1)
			{
				Delegate arg1 = DelegateTraits<UIPanel.OnGeometryUpdated>.Create(func);
				ToLua.Push(L, arg1);
			}
			else
			{
				LuaTable self = ToLua.CheckLuaTable(L, 2);
				Delegate arg1 = DelegateTraits<UIPanel.OnGeometryUpdated>.Create(func, self);
				ToLua.Push(L, arg1);
			}
			return 1;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
コード例 #6
0
    static int GameObjectPool_OnCreateGameObject(IntPtr L)
    {
        try
        {
            int         count = LuaDLL.lua_gettop(L);
            LuaFunction func  = ToLua.CheckLuaFunction(L, 1);

            if (count == 1)
            {
                Delegate arg1 = DelegateTraits <GameObjectPool.OnCreateGameObject> .Create(func);

                ToLua.Push(L, arg1);
            }
            else
            {
                LuaTable self = ToLua.CheckLuaTable(L, 2);
                Delegate arg1 = DelegateTraits <GameObjectPool.OnCreateGameObject> .Create(func, self);

                ToLua.Push(L, arg1);
            }
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #7
0
    static int System_Action_int_LuaFramework_ByteBuffer(IntPtr L)
    {
        try
        {
            int         count = LuaDLL.lua_gettop(L);
            LuaFunction func  = ToLua.CheckLuaFunction(L, 1);

            if (count == 1)
            {
                Delegate arg1 = DelegateTraits <System.Action <int, LuaFramework.ByteBuffer> > .Create(func);

                ToLua.Push(L, arg1);
            }
            else
            {
                LuaTable self = ToLua.CheckLuaTable(L, 2);
                Delegate arg1 = DelegateTraits <System.Action <int, LuaFramework.ByteBuffer> > .Create(func, self);

                ToLua.Push(L, arg1);
            }
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #8
0
    static int Tangzx_ABSystem_AssetBundleInfo_OnUnloadedHandler(IntPtr L)
    {
        try
        {
            int         count = LuaDLL.lua_gettop(L);
            LuaFunction func  = ToLua.CheckLuaFunction(L, 1);

            if (count == 1)
            {
                Delegate arg1 = DelegateTraits <Tangzx.ABSystem.AssetBundleInfo.OnUnloadedHandler> .Create(func);

                ToLua.Push(L, arg1);
            }
            else
            {
                LuaTable self = ToLua.CheckLuaTable(L, 2);
                Delegate arg1 = DelegateTraits <Tangzx.ABSystem.AssetBundleInfo.OnUnloadedHandler> .Create(func, self);

                ToLua.Push(L, arg1);
            }
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #9
0
    static int RequestLoadBundle_OnCreateAssetBundle(IntPtr L)
    {
        try
        {
            int         count = LuaDLL.lua_gettop(L);
            LuaFunction func  = ToLua.CheckLuaFunction(L, 1);

            if (count == 1)
            {
                Delegate arg1 = DelegateTraits <RequestLoadBundle.OnCreateAssetBundle> .Create(func);

                ToLua.Push(L, arg1);
            }
            else
            {
                LuaTable self = ToLua.CheckLuaTable(L, 2);
                Delegate arg1 = DelegateTraits <RequestLoadBundle.OnCreateAssetBundle> .Create(func, self);

                ToLua.Push(L, arg1);
            }
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #10
0
    static int FairyGUI_UIPackage_CreateObjectCallback(IntPtr L)
    {
        try
        {
            int         count = LuaDLL.lua_gettop(L);
            LuaFunction func  = ToLua.CheckLuaFunction(L, 1);

            if (count == 1)
            {
                Delegate arg1 = DelegateTraits <FairyGUI.UIPackage.CreateObjectCallback> .Create(func);

                ToLua.Push(L, arg1);
            }
            else
            {
                LuaTable self = ToLua.CheckLuaTable(L, 2);
                Delegate arg1 = DelegateTraits <FairyGUI.UIPackage.CreateObjectCallback> .Create(func, self);

                ToLua.Push(L, arg1);
            }
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #11
0
    static int Localization_OnLocalizeNotification(IntPtr L)
    {
        try
        {
            int         count = LuaDLL.lua_gettop(L);
            LuaFunction func  = ToLua.CheckLuaFunction(L, 1);

            if (count == 1)
            {
                Delegate arg1 = DelegateTraits <Localization.OnLocalizeNotification> .Create(func);

                ToLua.Push(L, arg1);
            }
            else
            {
                LuaTable self = ToLua.CheckLuaTable(L, 2);
                Delegate arg1 = DelegateTraits <Localization.OnLocalizeNotification> .Create(func, self);

                ToLua.Push(L, arg1);
            }
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #12
0
ファイル: UITableViewWrap.cs プロジェクト: yhjsspz/root
    static int UITableView_NewLoadingDelegate(IntPtr L)
    {
        try
        {
            int         count = LuaDLL.lua_gettop(L);
            LuaFunction func  = ToLua.CheckLuaFunction(L, 1);

            if (count == 1)
            {
                Delegate arg1 = DelegateTraits <UITableView.NewLoadingDelegate> .Create(func);

                ToLua.Push(L, arg1);
            }
            else
            {
                LuaTable self = ToLua.CheckLuaTable(L, 2);
                Delegate arg1 = DelegateTraits <UITableView.NewLoadingDelegate> .Create(func, self);

                ToLua.Push(L, arg1);
            }
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #13
0
    static int Framework_SceneLoadEventHandler(IntPtr L)
    {
#if UNITY_EDITOR
        ToluaProfiler.AddCallRecord("Framework.MonoSingleton<Framework.ResourceMgr>.Framework_SceneLoadEventHandler");
#endif
        try
        {
            int         count = LuaDLL.lua_gettop(L);
            LuaFunction func  = ToLua.CheckLuaFunction(L, 1);

            if (count == 1)
            {
                Delegate arg1 = DelegateTraits <Framework.SceneLoadEventHandler> .Create(func);

                ToLua.Push(L, arg1);
            }
            else
            {
                LuaTable self = ToLua.CheckLuaTable(L, 2);
                Delegate arg1 = DelegateTraits <Framework.SceneLoadEventHandler> .Create(func, self);

                ToLua.Push(L, arg1);
            }
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #14
0
    static int System_Action_UnityEngine_SceneManagement_Scene(IntPtr L)
    {
#if UNITY_EDITOR
        ToluaProfiler.AddCallRecord("Framework.MonoSingleton<Framework.ResourceMgr>.System_Action_UnityEngine_SceneManagement_Scene");
#endif
        try
        {
            int         count = LuaDLL.lua_gettop(L);
            LuaFunction func  = ToLua.CheckLuaFunction(L, 1);

            if (count == 1)
            {
                Delegate arg1 = DelegateTraits <System.Action <UnityEngine.SceneManagement.Scene> > .Create(func);

                ToLua.Push(L, arg1);
            }
            else
            {
                LuaTable self = ToLua.CheckLuaTable(L, 2);
                Delegate arg1 = DelegateTraits <System.Action <UnityEngine.SceneManagement.Scene> > .Create(func, self);

                ToLua.Push(L, arg1);
            }
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #15
0
    static int FairyGUI_ListItemProvider(IntPtr L)
    {
        try
        {
            int         count = LuaDLL.lua_gettop(L);
            LuaFunction func  = ToLua.CheckLuaFunction(L, 1);

            if (count == 1)
            {
                Delegate arg1 = DelegateTraits <FairyGUI.ListItemProvider> .Create(func);

                ToLua.Push(L, arg1);
            }
            else
            {
                LuaTable self = ToLua.CheckLuaTable(L, 2);
                Delegate arg1 = DelegateTraits <FairyGUI.ListItemProvider> .Create(func, self);

                ToLua.Push(L, arg1);
            }
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #16
0
    static int UnityEngine_Events_UnityAction(IntPtr L)
    {
        try
        {
            int         count = LuaDLL.lua_gettop(L);
            LuaFunction func  = ToLua.CheckLuaFunction(L, 1);

            if (count == 1)
            {
                Delegate arg1 = DelegateTraits <UnityEngine.Events.UnityAction> .Create(func);

                ToLua.Push(L, arg1);
            }
            else
            {
                LuaTable self = ToLua.CheckLuaTable(L, 2);
                Delegate arg1 = DelegateTraits <UnityEngine.Events.UnityAction> .Create(func, self);

                ToLua.Push(L, arg1);
            }
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #17
0
    static int UnityEngine_AudioClip_PCMReaderCallback(IntPtr L)
    {
        try
        {
            int         count = LuaDLL.lua_gettop(L);
            LuaFunction func  = ToLua.CheckLuaFunction(L, 1);

            if (count == 1)
            {
                Delegate arg1 = DelegateTraits <UnityEngine.AudioClip.PCMReaderCallback> .Create(func);

                ToLua.Push(L, arg1);
            }
            else
            {
                LuaTable self = ToLua.CheckLuaTable(L, 2);
                Delegate arg1 = DelegateTraits <UnityEngine.AudioClip.PCMReaderCallback> .Create(func, self);

                ToLua.Push(L, arg1);
            }
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #18
0
        public void Add(LuaFunction func, LuaTable self)
        {
            EventCallback1 callback = (EventCallback1)DelegateTraits <EventCallback1> .Create(func, self);

            _callback1 -= callback;
            _callback1 += callback;
        }
コード例 #19
0
    static int Spine_AnimationState_TrackEntryDelegate(IntPtr L)
    {
        try
        {
            int         count = LuaDLL.lua_gettop(L);
            LuaFunction func  = ToLua.CheckLuaFunction(L, 1);

            if (count == 1)
            {
                Delegate arg1 = DelegateTraits <Spine.AnimationState.TrackEntryDelegate> .Create(func);

                ToLua.Push(L, arg1);
            }
            else
            {
                LuaTable self = ToLua.CheckLuaTable(L, 2);
                Delegate arg1 = DelegateTraits <Spine.AnimationState.TrackEntryDelegate> .Create(func, self);

                ToLua.Push(L, arg1);
            }
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #20
0
ファイル: LuaBinder.cs プロジェクト: B-CK/P-Lua
    static int UnityEngine_RectTransform_ReapplyDrivenProperties(IntPtr L)
    {
        try
        {
            int         count = LuaDLL.lua_gettop(L);
            LuaFunction func  = ToLua.CheckLuaFunction(L, 1);

            if (count == 1)
            {
                Delegate arg1 = DelegateTraits <UnityEngine.RectTransform.ReapplyDrivenProperties> .Create(func);

                ToLua.Push(L, arg1);
            }
            else
            {
                LuaTable self = ToLua.CheckLuaTable(L, 2);
                Delegate arg1 = DelegateTraits <UnityEngine.RectTransform.ReapplyDrivenProperties> .Create(func, self);

                ToLua.Push(L, arg1);
            }
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #21
0
    static int System_Func_bool(IntPtr L)
    {
        try
        {
            int         count = LuaDLL.lua_gettop(L);
            LuaFunction func  = ToLua.CheckLuaFunction(L, 1);

            if (count == 1)
            {
                Delegate arg1 = DelegateTraits <System.Func <bool> > .Create(func);

                ToLua.Push(L, arg1);
            }
            else
            {
                LuaTable self = ToLua.CheckLuaTable(L, 2);
                Delegate arg1 = DelegateTraits <System.Func <bool> > .Create(func, self);

                ToLua.Push(L, arg1);
            }
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #22
0
    static int Framework_SceneLoadEventHandler(IntPtr L)
    {
        try
        {
            int         count = LuaDLL.lua_gettop(L);
            LuaFunction func  = ToLua.CheckLuaFunction(L, 1);

            if (count == 1)
            {
                Delegate arg1 = DelegateTraits <Framework.SceneLoadEventHandler> .Create(func);

                ToLua.Push(L, arg1);
            }
            else
            {
                LuaTable self = ToLua.CheckLuaTable(L, 2);
                Delegate arg1 = DelegateTraits <Framework.SceneLoadEventHandler> .Create(func, self);

                ToLua.Push(L, arg1);
            }
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #23
0
    static int EventTriggerListener_VoidDelegate(IntPtr L)
    {
        try
        {
            int         count = LuaDLL.lua_gettop(L);
            LuaFunction func  = ToLua.CheckLuaFunction(L, 1);

            if (count == 1)
            {
                Delegate arg1 = DelegateTraits <EventTriggerListener.VoidDelegate> .Create(func);

                ToLua.Push(L, arg1);
            }
            else
            {
                LuaTable self = ToLua.CheckLuaTable(L, 2);
                Delegate arg1 = DelegateTraits <EventTriggerListener.VoidDelegate> .Create(func, self);

                ToLua.Push(L, arg1);
            }
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #24
0
    static int LuaFramework_LuaManager_OnBundleProgressChanged(IntPtr L)
    {
        try
        {
            int         count = LuaDLL.lua_gettop(L);
            LuaFunction func  = ToLua.CheckLuaFunction(L, 1);

            if (count == 1)
            {
                Delegate arg1 = DelegateTraits <LuaFramework.LuaManager.OnBundleProgressChanged> .Create(func);

                ToLua.Push(L, arg1);
            }
            else
            {
                LuaTable self = ToLua.CheckLuaTable(L, 2);
                Delegate arg1 = DelegateTraits <LuaFramework.LuaManager.OnBundleProgressChanged> .Create(func, self);

                ToLua.Push(L, arg1);
            }
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #25
0
    static int TestExport_TestBuffer(IntPtr L)
    {
        try
        {
            int         count = LuaDLL.lua_gettop(L);
            LuaFunction func  = ToLua.CheckLuaFunction(L, 1);

            if (count == 1)
            {
                Delegate arg1 = DelegateTraits <TestExport.TestBuffer> .Create(func);

                ToLua.Push(L, arg1);
            }
            else
            {
                LuaTable self = ToLua.CheckLuaTable(L, 2);
                Delegate arg1 = DelegateTraits <TestExport.TestBuffer> .Create(func, self);

                ToLua.Push(L, arg1);
            }
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #26
0
    public static void Register()
    {
        dict.Clear();
        dict.Add(typeof(Action <int>), delegateFactory.System_Action_Create);
        dict.Add(typeof(Func <int, int>), delegateFactory.System_Func_Create);

        DelegateTraits <Action <int> > .Init(delegateFactory.System_Action_Create);

        DelegateTraits <Func <int, int> > .Init(delegateFactory.System_Func_Create);
    }
コード例 #27
0
    static int SetOnFinished(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes <TestEventListener.VoidDelegate>(L, 2))
            {
                TestEventListener obj = (TestEventListener)ToLua.CheckObject(L, 1, typeof(TestEventListener));
                TestEventListener.VoidDelegate arg0 = null;
                LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

                if (funcType2 != LuaTypes.LUA_TFUNCTION)
                {
                    arg0 = (TestEventListener.VoidDelegate)ToLua.ToObject(L, 2);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 2);
                    arg0 = (TestEventListener.VoidDelegate) DelegateTraits <TestEventListener.VoidDelegate> .Create(func);
                }

                obj.SetOnFinished(arg0);
                return(0);
            }
            else if (count == 2 && TypeChecker.CheckTypes <TestEventListener.OnClick>(L, 2))
            {
                TestEventListener         obj  = (TestEventListener)ToLua.CheckObject(L, 1, typeof(TestEventListener));
                TestEventListener.OnClick arg0 = null;
                LuaTypes funcType2             = LuaDLL.lua_type(L, 2);

                if (funcType2 != LuaTypes.LUA_TFUNCTION)
                {
                    arg0 = (TestEventListener.OnClick)ToLua.ToObject(L, 2);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 2);
                    arg0 = (TestEventListener.OnClick) DelegateTraits <TestEventListener.OnClick> .Create(func);
                }

                obj.SetOnFinished(arg0);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: TestEventListener.SetOnFinished"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #28
0
    void Bind(LuaState L)
    {
        L.BeginModule(null);
        TestEventListenerWrap.Register(state);
        L.EndModule();

        DelegateFactory.dict.Add(typeof(TestEventListener.OnClick), TestEventListener_OnClick);
        DelegateFactory.dict.Add(typeof(TestEventListener.VoidDelegate), TestEventListener_VoidDelegate);

        DelegateTraits <TestEventListener.OnClick> .Init(TestEventListener_OnClick);

        DelegateTraits <TestEventListener.VoidDelegate> .Init(TestEventListener_VoidDelegate);
    }
コード例 #29
0
    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));
        }
    }
コード例 #30
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));
        }
    }