CreateDelegate() private method

private CreateDelegate ( Type t, LuaFunction func = null ) : Delegate
t Type
func LuaInterface.LuaFunction
return Delegate
示例#1
0
    static int SetEase(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes <DG.Tweening.Tween, DG.Tweening.Ease>(L, 1))
            {
                DG.Tweening.Sequence obj  = (DG.Tweening.Sequence)ToLua.ToObject(L, 1);
                DG.Tweening.Ease     arg0 = (DG.Tweening.Ease)ToLua.ToObject(L, 2);
                DG.Tweening.Tween    o    = obj.SetEase(arg0);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes <DG.Tweening.Tween, UnityEngine.AnimationCurve>(L, 1))
            {
                DG.Tweening.Sequence       obj  = (DG.Tweening.Sequence)ToLua.ToObject(L, 1);
                UnityEngine.AnimationCurve arg0 = (UnityEngine.AnimationCurve)ToLua.ToObject(L, 2);
                DG.Tweening.Tween          o    = obj.SetEase(arg0);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes <DG.Tweening.Tween, DG.Tweening.EaseFunction>(L, 1))
            {
                DG.Tweening.Sequence     obj  = (DG.Tweening.Sequence)ToLua.ToObject(L, 1);
                DG.Tweening.EaseFunction arg0 = null;
                LuaTypes funcType2            = LuaDLL.lua_type(L, 2);

                if (funcType2 != LuaTypes.LUA_TFUNCTION)
                {
                    arg0 = (DG.Tweening.EaseFunction)ToLua.ToObject(L, 2);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 2);
                    arg0 = DelegateFactory.CreateDelegate(typeof(DG.Tweening.EaseFunction), func) as DG.Tweening.EaseFunction;
                }

                DG.Tweening.Tween o = obj.SetEase(arg0);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 3)
            {
                DG.Tweening.Sequence obj  = (DG.Tweening.Sequence)ToLua.CheckObject(L, 1, typeof(DG.Tweening.Sequence));
                DG.Tweening.Ease     arg0 = (DG.Tweening.Ease)ToLua.CheckObject(L, 2, typeof(DG.Tweening.Ease));
                float             arg1    = (float)LuaDLL.luaL_checknumber(L, 3);
                DG.Tweening.Tween o       = obj.SetEase(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 4)
            {
                DG.Tweening.Sequence obj  = (DG.Tweening.Sequence)ToLua.CheckObject(L, 1, typeof(DG.Tweening.Sequence));
                DG.Tweening.Ease     arg0 = (DG.Tweening.Ease)ToLua.CheckObject(L, 2, typeof(DG.Tweening.Ease));
                float             arg1    = (float)LuaDLL.luaL_checknumber(L, 3);
                float             arg2    = (float)LuaDLL.luaL_checknumber(L, 4);
                DG.Tweening.Tween o       = obj.SetEase(arg0, arg1, arg2);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: DG.Tweening.Sequence.SetEase"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    static int set_reapplyDrivenProperties(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.RectTransform.reapplyDrivenProperties' can only appear on the left hand side of += or -= when used outside of the type 'UnityEngine.RectTransform'"));
            }

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

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

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

                arg0.func.Dispose();
            }

            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
示例#3
0
    static int LoadPrefab(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(LuaFramework.ResourceManager), typeof(string), typeof(string[]), typeof(LuaInterface.LuaFunction)))
            {
                LuaFramework.ResourceManager obj = (LuaFramework.ResourceManager)ToLua.ToObject(L, 1);
                string      arg0 = ToLua.ToString(L, 2);
                string[]    arg1 = ToLua.CheckStringArray(L, 3);
                LuaFunction arg2 = ToLua.ToLuaFunction(L, 4);
                obj.LoadPrefab(arg0, arg1, arg2);
                return(0);
            }
            else if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(LuaFramework.ResourceManager), typeof(string), typeof(string[]), typeof(System.Action <UnityEngine.Object[]>)))
            {
                LuaFramework.ResourceManager obj = (LuaFramework.ResourceManager)ToLua.ToObject(L, 1);
                string   arg0 = ToLua.ToString(L, 2);
                string[] arg1 = ToLua.CheckStringArray(L, 3);
                System.Action <UnityEngine.Object[]> arg2 = null;
                LuaTypes funcType4 = LuaDLL.lua_type(L, 4);

                if (funcType4 != LuaTypes.LUA_TFUNCTION)
                {
                    arg2 = (System.Action <UnityEngine.Object[]>)ToLua.ToObject(L, 4);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 4);
                    arg2 = DelegateFactory.CreateDelegate(typeof(System.Action <UnityEngine.Object[]>), func) as System.Action <UnityEngine.Object[]>;
                }

                obj.LoadPrefab(arg0, arg1, arg2);
                return(0);
            }
            else if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(LuaFramework.ResourceManager), typeof(string), typeof(string), typeof(System.Action <UnityEngine.Object[]>)))
            {
                LuaFramework.ResourceManager obj = (LuaFramework.ResourceManager)ToLua.ToObject(L, 1);
                string arg0 = ToLua.ToString(L, 2);
                string arg1 = ToLua.ToString(L, 3);
                System.Action <UnityEngine.Object[]> arg2 = null;
                LuaTypes funcType4 = LuaDLL.lua_type(L, 4);

                if (funcType4 != LuaTypes.LUA_TFUNCTION)
                {
                    arg2 = (System.Action <UnityEngine.Object[]>)ToLua.ToObject(L, 4);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 4);
                    arg2 = DelegateFactory.CreateDelegate(typeof(System.Action <UnityEngine.Object[]>), func) as System.Action <UnityEngine.Object[]>;
                }

                obj.LoadPrefab(arg0, arg1, arg2);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: LuaFramework.ResourceManager.LoadPrefab"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
示例#4
0
    static int set_textureRebuilt(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.Font.textureRebuilt' can only appear on the left hand side of += or -= when used outside of the type 'UnityEngine.Font'"));
            }

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

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

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

                arg0.func.Dispose();
            }

            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
示例#5
0
    static int ShowEditBox(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 6);
            NativeManager          obj  = (NativeManager)ToLua.CheckObject(L, 1, typeof(NativeManager));
            EditBoxMessage         arg0 = (EditBoxMessage)ToLua.CheckObject(L, 2, typeof(EditBoxMessage));
            System.Action <string> arg1 = null;
            LuaTypes funcType3          = LuaDLL.lua_type(L, 3);

            if (funcType3 != LuaTypes.LUA_TFUNCTION)
            {
                arg1 = (System.Action <string>)ToLua.CheckObject(L, 3, typeof(System.Action <string>));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 3);
                arg1 = DelegateFactory.CreateDelegate(typeof(System.Action <string>), func) as System.Action <string>;
            }

            System.Action <string> arg2 = null;
            LuaTypes funcType4          = LuaDLL.lua_type(L, 4);

            if (funcType4 != LuaTypes.LUA_TFUNCTION)
            {
                arg2 = (System.Action <string>)ToLua.CheckObject(L, 4, typeof(System.Action <string>));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 4);
                arg2 = DelegateFactory.CreateDelegate(typeof(System.Action <string>), func) as System.Action <string>;
            }

            System.Action <double> arg3 = null;
            LuaTypes funcType5          = LuaDLL.lua_type(L, 5);

            if (funcType5 != LuaTypes.LUA_TFUNCTION)
            {
                arg3 = (System.Action <double>)ToLua.CheckObject(L, 5, typeof(System.Action <double>));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 5);
                arg3 = DelegateFactory.CreateDelegate(typeof(System.Action <double>), func) as System.Action <double>;
            }

            System.Action <string, int> arg4 = null;
            LuaTypes funcType6 = LuaDLL.lua_type(L, 6);

            if (funcType6 != LuaTypes.LUA_TFUNCTION)
            {
                arg4 = (System.Action <string, int>)ToLua.CheckObject(L, 6, typeof(System.Action <string, int>));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 6);
                arg4 = DelegateFactory.CreateDelegate(typeof(System.Action <string, int>), func) as System.Action <string, int>;
            }

            obj.ShowEditBox(arg0, arg1, arg2, arg3, arg4);
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    static int _CreateGameFramework_Resource_LoadAssetCallbacks(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1)
            {
                GameFramework.Resource.LoadAssetSuccessCallback arg0 = null;
                LuaTypes funcType1 = LuaDLL.lua_type(L, 1);

                if (funcType1 != LuaTypes.LUA_TFUNCTION)
                {
                    arg0 = (GameFramework.Resource.LoadAssetSuccessCallback)ToLua.CheckObject(L, 1, typeof(GameFramework.Resource.LoadAssetSuccessCallback));
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 1);
                    arg0 = DelegateFactory.CreateDelegate(typeof(GameFramework.Resource.LoadAssetSuccessCallback), func) as GameFramework.Resource.LoadAssetSuccessCallback;
                }

                GameFramework.Resource.LoadAssetCallbacks obj = new GameFramework.Resource.LoadAssetCallbacks(arg0);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(GameFramework.Resource.LoadAssetSuccessCallback), typeof(GameFramework.Resource.LoadAssetDependencyAssetCallback)))
            {
                GameFramework.Resource.LoadAssetSuccessCallback arg0 = null;
                LuaTypes funcType1 = LuaDLL.lua_type(L, 1);

                if (funcType1 != LuaTypes.LUA_TFUNCTION)
                {
                    arg0 = (GameFramework.Resource.LoadAssetSuccessCallback)ToLua.CheckObject(L, 1, typeof(GameFramework.Resource.LoadAssetSuccessCallback));
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 1);
                    arg0 = DelegateFactory.CreateDelegate(typeof(GameFramework.Resource.LoadAssetSuccessCallback), func) as GameFramework.Resource.LoadAssetSuccessCallback;
                }

                GameFramework.Resource.LoadAssetDependencyAssetCallback arg1 = null;
                LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

                if (funcType2 != LuaTypes.LUA_TFUNCTION)
                {
                    arg1 = (GameFramework.Resource.LoadAssetDependencyAssetCallback)ToLua.CheckObject(L, 2, typeof(GameFramework.Resource.LoadAssetDependencyAssetCallback));
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 2);
                    arg1 = DelegateFactory.CreateDelegate(typeof(GameFramework.Resource.LoadAssetDependencyAssetCallback), func) as GameFramework.Resource.LoadAssetDependencyAssetCallback;
                }

                GameFramework.Resource.LoadAssetCallbacks obj = new GameFramework.Resource.LoadAssetCallbacks(arg0, arg1);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(GameFramework.Resource.LoadAssetSuccessCallback), typeof(GameFramework.Resource.LoadAssetUpdateCallback)))
            {
                GameFramework.Resource.LoadAssetSuccessCallback arg0 = null;
                LuaTypes funcType1 = LuaDLL.lua_type(L, 1);

                if (funcType1 != LuaTypes.LUA_TFUNCTION)
                {
                    arg0 = (GameFramework.Resource.LoadAssetSuccessCallback)ToLua.CheckObject(L, 1, typeof(GameFramework.Resource.LoadAssetSuccessCallback));
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 1);
                    arg0 = DelegateFactory.CreateDelegate(typeof(GameFramework.Resource.LoadAssetSuccessCallback), func) as GameFramework.Resource.LoadAssetSuccessCallback;
                }

                GameFramework.Resource.LoadAssetUpdateCallback arg1 = null;
                LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

                if (funcType2 != LuaTypes.LUA_TFUNCTION)
                {
                    arg1 = (GameFramework.Resource.LoadAssetUpdateCallback)ToLua.CheckObject(L, 2, typeof(GameFramework.Resource.LoadAssetUpdateCallback));
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 2);
                    arg1 = DelegateFactory.CreateDelegate(typeof(GameFramework.Resource.LoadAssetUpdateCallback), func) as GameFramework.Resource.LoadAssetUpdateCallback;
                }

                GameFramework.Resource.LoadAssetCallbacks obj = new GameFramework.Resource.LoadAssetCallbacks(arg0, arg1);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(GameFramework.Resource.LoadAssetSuccessCallback), typeof(GameFramework.Resource.LoadAssetFailureCallback)))
            {
                GameFramework.Resource.LoadAssetSuccessCallback arg0 = null;
                LuaTypes funcType1 = LuaDLL.lua_type(L, 1);

                if (funcType1 != LuaTypes.LUA_TFUNCTION)
                {
                    arg0 = (GameFramework.Resource.LoadAssetSuccessCallback)ToLua.CheckObject(L, 1, typeof(GameFramework.Resource.LoadAssetSuccessCallback));
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 1);
                    arg0 = DelegateFactory.CreateDelegate(typeof(GameFramework.Resource.LoadAssetSuccessCallback), func) as GameFramework.Resource.LoadAssetSuccessCallback;
                }

                GameFramework.Resource.LoadAssetFailureCallback arg1 = null;
                LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

                if (funcType2 != LuaTypes.LUA_TFUNCTION)
                {
                    arg1 = (GameFramework.Resource.LoadAssetFailureCallback)ToLua.CheckObject(L, 2, typeof(GameFramework.Resource.LoadAssetFailureCallback));
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 2);
                    arg1 = DelegateFactory.CreateDelegate(typeof(GameFramework.Resource.LoadAssetFailureCallback), func) as GameFramework.Resource.LoadAssetFailureCallback;
                }

                GameFramework.Resource.LoadAssetCallbacks obj = new GameFramework.Resource.LoadAssetCallbacks(arg0, arg1);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(GameFramework.Resource.LoadAssetSuccessCallback), typeof(GameFramework.Resource.LoadAssetFailureCallback), typeof(GameFramework.Resource.LoadAssetDependencyAssetCallback)))
            {
                GameFramework.Resource.LoadAssetSuccessCallback arg0 = null;
                LuaTypes funcType1 = LuaDLL.lua_type(L, 1);

                if (funcType1 != LuaTypes.LUA_TFUNCTION)
                {
                    arg0 = (GameFramework.Resource.LoadAssetSuccessCallback)ToLua.CheckObject(L, 1, typeof(GameFramework.Resource.LoadAssetSuccessCallback));
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 1);
                    arg0 = DelegateFactory.CreateDelegate(typeof(GameFramework.Resource.LoadAssetSuccessCallback), func) as GameFramework.Resource.LoadAssetSuccessCallback;
                }

                GameFramework.Resource.LoadAssetFailureCallback arg1 = null;
                LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

                if (funcType2 != LuaTypes.LUA_TFUNCTION)
                {
                    arg1 = (GameFramework.Resource.LoadAssetFailureCallback)ToLua.CheckObject(L, 2, typeof(GameFramework.Resource.LoadAssetFailureCallback));
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 2);
                    arg1 = DelegateFactory.CreateDelegate(typeof(GameFramework.Resource.LoadAssetFailureCallback), func) as GameFramework.Resource.LoadAssetFailureCallback;
                }

                GameFramework.Resource.LoadAssetDependencyAssetCallback arg2 = null;
                LuaTypes funcType3 = LuaDLL.lua_type(L, 3);

                if (funcType3 != LuaTypes.LUA_TFUNCTION)
                {
                    arg2 = (GameFramework.Resource.LoadAssetDependencyAssetCallback)ToLua.CheckObject(L, 3, typeof(GameFramework.Resource.LoadAssetDependencyAssetCallback));
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 3);
                    arg2 = DelegateFactory.CreateDelegate(typeof(GameFramework.Resource.LoadAssetDependencyAssetCallback), func) as GameFramework.Resource.LoadAssetDependencyAssetCallback;
                }

                GameFramework.Resource.LoadAssetCallbacks obj = new GameFramework.Resource.LoadAssetCallbacks(arg0, arg1, arg2);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(GameFramework.Resource.LoadAssetSuccessCallback), typeof(GameFramework.Resource.LoadAssetFailureCallback), typeof(GameFramework.Resource.LoadAssetUpdateCallback)))
            {
                GameFramework.Resource.LoadAssetSuccessCallback arg0 = null;
                LuaTypes funcType1 = LuaDLL.lua_type(L, 1);

                if (funcType1 != LuaTypes.LUA_TFUNCTION)
                {
                    arg0 = (GameFramework.Resource.LoadAssetSuccessCallback)ToLua.CheckObject(L, 1, typeof(GameFramework.Resource.LoadAssetSuccessCallback));
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 1);
                    arg0 = DelegateFactory.CreateDelegate(typeof(GameFramework.Resource.LoadAssetSuccessCallback), func) as GameFramework.Resource.LoadAssetSuccessCallback;
                }

                GameFramework.Resource.LoadAssetFailureCallback arg1 = null;
                LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

                if (funcType2 != LuaTypes.LUA_TFUNCTION)
                {
                    arg1 = (GameFramework.Resource.LoadAssetFailureCallback)ToLua.CheckObject(L, 2, typeof(GameFramework.Resource.LoadAssetFailureCallback));
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 2);
                    arg1 = DelegateFactory.CreateDelegate(typeof(GameFramework.Resource.LoadAssetFailureCallback), func) as GameFramework.Resource.LoadAssetFailureCallback;
                }

                GameFramework.Resource.LoadAssetUpdateCallback arg2 = null;
                LuaTypes funcType3 = LuaDLL.lua_type(L, 3);

                if (funcType3 != LuaTypes.LUA_TFUNCTION)
                {
                    arg2 = (GameFramework.Resource.LoadAssetUpdateCallback)ToLua.CheckObject(L, 3, typeof(GameFramework.Resource.LoadAssetUpdateCallback));
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 3);
                    arg2 = DelegateFactory.CreateDelegate(typeof(GameFramework.Resource.LoadAssetUpdateCallback), func) as GameFramework.Resource.LoadAssetUpdateCallback;
                }

                GameFramework.Resource.LoadAssetCallbacks obj = new GameFramework.Resource.LoadAssetCallbacks(arg0, arg1, arg2);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(GameFramework.Resource.LoadAssetSuccessCallback), typeof(GameFramework.Resource.LoadAssetFailureCallback), typeof(GameFramework.Resource.LoadAssetUpdateCallback), typeof(GameFramework.Resource.LoadAssetDependencyAssetCallback)))
            {
                GameFramework.Resource.LoadAssetSuccessCallback arg0 = null;
                LuaTypes funcType1 = LuaDLL.lua_type(L, 1);

                if (funcType1 != LuaTypes.LUA_TFUNCTION)
                {
                    arg0 = (GameFramework.Resource.LoadAssetSuccessCallback)ToLua.CheckObject(L, 1, typeof(GameFramework.Resource.LoadAssetSuccessCallback));
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 1);
                    arg0 = DelegateFactory.CreateDelegate(typeof(GameFramework.Resource.LoadAssetSuccessCallback), func) as GameFramework.Resource.LoadAssetSuccessCallback;
                }

                GameFramework.Resource.LoadAssetFailureCallback arg1 = null;
                LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

                if (funcType2 != LuaTypes.LUA_TFUNCTION)
                {
                    arg1 = (GameFramework.Resource.LoadAssetFailureCallback)ToLua.CheckObject(L, 2, typeof(GameFramework.Resource.LoadAssetFailureCallback));
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 2);
                    arg1 = DelegateFactory.CreateDelegate(typeof(GameFramework.Resource.LoadAssetFailureCallback), func) as GameFramework.Resource.LoadAssetFailureCallback;
                }

                GameFramework.Resource.LoadAssetUpdateCallback arg2 = null;
                LuaTypes funcType3 = LuaDLL.lua_type(L, 3);

                if (funcType3 != LuaTypes.LUA_TFUNCTION)
                {
                    arg2 = (GameFramework.Resource.LoadAssetUpdateCallback)ToLua.CheckObject(L, 3, typeof(GameFramework.Resource.LoadAssetUpdateCallback));
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 3);
                    arg2 = DelegateFactory.CreateDelegate(typeof(GameFramework.Resource.LoadAssetUpdateCallback), func) as GameFramework.Resource.LoadAssetUpdateCallback;
                }

                GameFramework.Resource.LoadAssetDependencyAssetCallback arg3 = null;
                LuaTypes funcType4 = LuaDLL.lua_type(L, 4);

                if (funcType4 != LuaTypes.LUA_TFUNCTION)
                {
                    arg3 = (GameFramework.Resource.LoadAssetDependencyAssetCallback)ToLua.CheckObject(L, 4, typeof(GameFramework.Resource.LoadAssetDependencyAssetCallback));
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 4);
                    arg3 = DelegateFactory.CreateDelegate(typeof(GameFramework.Resource.LoadAssetDependencyAssetCallback), func) as GameFramework.Resource.LoadAssetDependencyAssetCallback;
                }

                GameFramework.Resource.LoadAssetCallbacks obj = new GameFramework.Resource.LoadAssetCallbacks(arg0, arg1, arg2, arg3);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: GameFramework.Resource.LoadAssetCallbacks.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    static int Add(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(System.Collections.Generic.List <EventDelegate>), typeof(EventDelegate)))
            {
                System.Collections.Generic.List <EventDelegate> arg0 = (System.Collections.Generic.List <EventDelegate>)ToLua.ToObject(L, 1);
                EventDelegate arg1 = (EventDelegate)ToLua.ToObject(L, 2);
                EventDelegate.Add(arg0, arg1);
                return(0);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(System.Collections.Generic.List <EventDelegate>), typeof(EventDelegate.Callback)))
            {
                System.Collections.Generic.List <EventDelegate> arg0 = (System.Collections.Generic.List <EventDelegate>)ToLua.ToObject(L, 1);
                EventDelegate.Callback arg1 = null;
                LuaTypes funcType2          = LuaDLL.lua_type(L, 2);

                if (funcType2 != LuaTypes.LUA_TFUNCTION)
                {
                    arg1 = (EventDelegate.Callback)ToLua.ToObject(L, 2);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 2);
                    arg1 = DelegateFactory.CreateDelegate(typeof(EventDelegate.Callback), func) as EventDelegate.Callback;
                }

                EventDelegate o = EventDelegate.Add(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(System.Collections.Generic.List <EventDelegate>), typeof(EventDelegate), typeof(bool)))
            {
                System.Collections.Generic.List <EventDelegate> arg0 = (System.Collections.Generic.List <EventDelegate>)ToLua.ToObject(L, 1);
                EventDelegate arg1 = (EventDelegate)ToLua.ToObject(L, 2);
                bool          arg2 = LuaDLL.lua_toboolean(L, 3);
                EventDelegate.Add(arg0, arg1, arg2);
                return(0);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(System.Collections.Generic.List <EventDelegate>), typeof(EventDelegate.Callback), typeof(bool)))
            {
                System.Collections.Generic.List <EventDelegate> arg0 = (System.Collections.Generic.List <EventDelegate>)ToLua.ToObject(L, 1);
                EventDelegate.Callback arg1 = null;
                LuaTypes funcType2          = LuaDLL.lua_type(L, 2);

                if (funcType2 != LuaTypes.LUA_TFUNCTION)
                {
                    arg1 = (EventDelegate.Callback)ToLua.ToObject(L, 2);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 2);
                    arg1 = DelegateFactory.CreateDelegate(typeof(EventDelegate.Callback), func) as EventDelegate.Callback;
                }

                bool          arg2 = LuaDLL.lua_toboolean(L, 3);
                EventDelegate o    = EventDelegate.Add(arg0, arg1, arg2);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: EventDelegate.Add"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
示例#8
0
 void OnGUI()
 {
     if (GUI.Button(new Rect(10, 10, 120, 40), " = OnClick1"))
     {
         CallLuaFunction(SetClick1);
     }
     else if (GUI.Button(new Rect(10, 60, 120, 40), " + Click1"))
     {
         CallLuaFunction(AddClick1);
     }
     else if (GUI.Button(new Rect(10, 110, 120, 40), " + Click2"))
     {
         CallLuaFunction(AddClick2);
     }
     else if (GUI.Button(new Rect(10, 160, 120, 40), " - Click1"))
     {
         CallLuaFunction(RemoveClick1);
     }
     else if (GUI.Button(new Rect(10, 210, 120, 40), " - Click2"))
     {
         CallLuaFunction(RemoveClick2);
     }
     else if (GUI.Button(new Rect(10, 260, 120, 40), "+ Click1 in C#"))
     {
         LuaFunction func = state.GetFunction("DoClick1");
         TestEventListener.OnClick onClick = (TestEventListener.OnClick)DelegateFactory.CreateDelegate(typeof(TestEventListener.OnClick), func);
         listener.onClick += onClick;
     }
     else if (GUI.Button(new Rect(10, 310, 120, 40), " - Click1 in C#"))
     {
         LuaFunction func = state.GetFunction("DoClick1");
         listener.onClick = (TestEventListener.OnClick)DelegateFactory.RemoveDelegate(listener.onClick, func);
         func.Dispose();
         func = null;
     }
     else if (GUI.Button(new Rect(10, 360, 120, 40), "OnClick"))
     {
         if (listener.onClick != null)
         {
             listener.onClick(gameObject);
         }
         else
         {
             Debug.Log("empty delegate!!");
         }
     }
     else if (GUI.Button(new Rect(10, 410, 120, 40), "Override"))
     {
         CallLuaFunction(TestOverride);
     }
     else if (GUI.Button(new Rect(10, 460, 120, 40), "Force GC"))
     {
         //自动gc log: collect lua reference name , id xxx in thread
         state.LuaGC(LuaGCOptions.LUA_GCCOLLECT, 0);
         GC.Collect();
     }
     else if (GUI.Button(new Rect(10, 510, 120, 40), "event +"))
     {
         CallLuaFunction(AddEvent);
     }
     else if (GUI.Button(new Rect(10, 560, 120, 40), "event -"))
     {
         CallLuaFunction(RemoveEvent);
     }
     else if (GUI.Button(new Rect(10, 610, 120, 40), "event call"))
     {
         listener.OnClickEvent(gameObject);
     }
 }
示例#9
0
    static int AddPackage(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(string)))
            {
                string             arg0 = ToLua.ToString(L, 1);
                FairyGUI.UIPackage o    = FairyGUI.UIPackage.AddPackage(arg0);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.AssetBundle)))
            {
                UnityEngine.AssetBundle arg0 = (UnityEngine.AssetBundle)ToLua.ToObject(L, 1);
                FairyGUI.UIPackage      o    = FairyGUI.UIPackage.AddPackage(arg0);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(FairyGUI.UIPackage.LoadResource)))
            {
                string arg0 = ToLua.ToString(L, 1);
                FairyGUI.UIPackage.LoadResource arg1 = null;
                LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

                if (funcType2 != LuaTypes.LUA_TFUNCTION)
                {
                    arg1 = (FairyGUI.UIPackage.LoadResource)ToLua.ToObject(L, 2);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 2);
                    arg1 = DelegateFactory.CreateDelegate(typeof(FairyGUI.UIPackage.LoadResource), func) as FairyGUI.UIPackage.LoadResource;
                }

                FairyGUI.UIPackage o = FairyGUI.UIPackage.AddPackage(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(UnityEngine.AssetBundle)))
            {
                string arg0 = ToLua.ToString(L, 1);
                UnityEngine.AssetBundle arg1 = (UnityEngine.AssetBundle)ToLua.ToObject(L, 2);
                FairyGUI.UIPackage      o    = FairyGUI.UIPackage.AddPackage(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.AssetBundle), typeof(UnityEngine.AssetBundle)))
            {
                UnityEngine.AssetBundle arg0 = (UnityEngine.AssetBundle)ToLua.ToObject(L, 1);
                UnityEngine.AssetBundle arg1 = (UnityEngine.AssetBundle)ToLua.ToObject(L, 2);
                FairyGUI.UIPackage      o    = FairyGUI.UIPackage.AddPackage(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.AssetBundle), typeof(UnityEngine.AssetBundle), typeof(string)))
            {
                UnityEngine.AssetBundle arg0 = (UnityEngine.AssetBundle)ToLua.ToObject(L, 1);
                UnityEngine.AssetBundle arg1 = (UnityEngine.AssetBundle)ToLua.ToObject(L, 2);
                string             arg2      = ToLua.ToString(L, 3);
                FairyGUI.UIPackage o         = FairyGUI.UIPackage.AddPackage(arg0, arg1, arg2);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(UnityEngine.AssetBundle), typeof(string)))
            {
                string arg0 = ToLua.ToString(L, 1);
                UnityEngine.AssetBundle arg1 = (UnityEngine.AssetBundle)ToLua.ToObject(L, 2);
                string             arg2      = ToLua.ToString(L, 3);
                FairyGUI.UIPackage o         = FairyGUI.UIPackage.AddPackage(arg0, arg1, arg2);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.UIPackage.AddPackage"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
示例#10
0
    static int SetOnFinished(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 2 && ToLua.CheckTypes(L, 1, typeof(TestEventListener), typeof(TestEventListener.VoidDelegate)))
        {
            TestEventListener obj = (TestEventListener)ToLua.ToObject(L, 1);
            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 = DelegateFactory.CreateDelegate(L, typeof(TestEventListener.VoidDelegate), func) as TestEventListener.VoidDelegate;
            }

            try
            {
                obj.SetOnFinished(arg0);
            }
            catch (Exception e)
            {
                return(LuaDLL.toluaL_exception(L, e));
            }

            return(0);
        }
        else if (count == 2 && ToLua.CheckTypes(L, 1, typeof(TestEventListener), typeof(TestEventListener.OnClick)))
        {
            TestEventListener         obj  = (TestEventListener)ToLua.ToObject(L, 1);
            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 = DelegateFactory.CreateDelegate(L, typeof(TestEventListener.OnClick), func) as TestEventListener.OnClick;
            }

            try
            {
                obj.SetOnFinished(arg0);
            }
            catch (Exception e)
            {
                return(LuaDLL.toluaL_exception(L, e));
            }

            return(0);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: TestEventListener.SetOnFinished");
        }

        return(0);
    }
    static int set_ListFinished(IntPtr L)
    {
        try
        {
            UnityGameFramework.Runtime.ListLoader obj = (UnityGameFramework.Runtime.ListLoader)ToLua.CheckObject(L, 1, typeof(UnityGameFramework.Runtime.ListLoader));
            EventObject arg0 = null;

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

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

                for (int i = 0; i < ds.Length; i++)
                {
                    ev = (UnityGameFramework.Runtime.ListLoader.ListFinishedHandler)ds[i];
                    LuaDelegate ld = ev.Target as LuaDelegate;

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

                arg0.func.Dispose();
            }

            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
示例#12
0
    private static int Create(IntPtr L)
    {
        int result;

        try
        {
            int num = LuaDLL.lua_gettop(L);
            if (num == 5 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(int), typeof(int), typeof(int), typeof(bool)))
            {
                string    name          = ToLua.ToString(L, 1);
                int       lengthSamples = (int)LuaDLL.lua_tonumber(L, 2);
                int       channels      = (int)LuaDLL.lua_tonumber(L, 3);
                int       frequency     = (int)LuaDLL.lua_tonumber(L, 4);
                bool      stream        = LuaDLL.lua_toboolean(L, 5);
                AudioClip obj           = AudioClip.Create(name, lengthSamples, channels, frequency, stream);
                ToLua.Push(L, obj);
                result = 1;
            }
            else if (num == 6 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(int), typeof(int), typeof(int), typeof(bool), typeof(AudioClip.PCMReaderCallback)))
            {
                string   name2          = ToLua.ToString(L, 1);
                int      lengthSamples2 = (int)LuaDLL.lua_tonumber(L, 2);
                int      channels2      = (int)LuaDLL.lua_tonumber(L, 3);
                int      frequency2     = (int)LuaDLL.lua_tonumber(L, 4);
                bool     stream2        = LuaDLL.lua_toboolean(L, 5);
                LuaTypes luaTypes       = LuaDLL.lua_type(L, 6);
                AudioClip.PCMReaderCallback pcmreadercallback;
                if (luaTypes != LuaTypes.LUA_TFUNCTION)
                {
                    pcmreadercallback = (AudioClip.PCMReaderCallback)ToLua.ToObject(L, 6);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 6);
                    pcmreadercallback = (DelegateFactory.CreateDelegate(typeof(AudioClip.PCMReaderCallback), func) as AudioClip.PCMReaderCallback);
                }
                AudioClip obj2 = AudioClip.Create(name2, lengthSamples2, channels2, frequency2, stream2, pcmreadercallback);
                ToLua.Push(L, obj2);
                result = 1;
            }
            else if (num == 7 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(int), typeof(int), typeof(int), typeof(bool), typeof(AudioClip.PCMReaderCallback), typeof(AudioClip.PCMSetPositionCallback)))
            {
                string   name3          = ToLua.ToString(L, 1);
                int      lengthSamples3 = (int)LuaDLL.lua_tonumber(L, 2);
                int      channels3      = (int)LuaDLL.lua_tonumber(L, 3);
                int      frequency3     = (int)LuaDLL.lua_tonumber(L, 4);
                bool     stream3        = LuaDLL.lua_toboolean(L, 5);
                LuaTypes luaTypes2      = LuaDLL.lua_type(L, 6);
                AudioClip.PCMReaderCallback pcmreadercallback2;
                if (luaTypes2 != LuaTypes.LUA_TFUNCTION)
                {
                    pcmreadercallback2 = (AudioClip.PCMReaderCallback)ToLua.ToObject(L, 6);
                }
                else
                {
                    LuaFunction func2 = ToLua.ToLuaFunction(L, 6);
                    pcmreadercallback2 = (DelegateFactory.CreateDelegate(typeof(AudioClip.PCMReaderCallback), func2) as AudioClip.PCMReaderCallback);
                }
                LuaTypes luaTypes3 = LuaDLL.lua_type(L, 7);
                AudioClip.PCMSetPositionCallback pcmsetpositioncallback;
                if (luaTypes3 != LuaTypes.LUA_TFUNCTION)
                {
                    pcmsetpositioncallback = (AudioClip.PCMSetPositionCallback)ToLua.ToObject(L, 7);
                }
                else
                {
                    LuaFunction func3 = ToLua.ToLuaFunction(L, 7);
                    pcmsetpositioncallback = (DelegateFactory.CreateDelegate(typeof(AudioClip.PCMSetPositionCallback), func3) as AudioClip.PCMSetPositionCallback);
                }
                AudioClip obj3 = AudioClip.Create(name3, lengthSamples3, channels3, frequency3, stream3, pcmreadercallback2, pcmsetpositioncallback);
                ToLua.Push(L, obj3);
                result = 1;
            }
            else
            {
                result = LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.AudioClip.Create");
            }
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
示例#13
0
    static int RemoveGlobalHook(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 7);
            System.Action <UI.StateHandle> arg0 = null;
            LuaTypes funcType1 = LuaDLL.lua_type(L, 1);

            if (funcType1 != LuaTypes.LUA_TFUNCTION)
            {
                arg0 = (System.Action <UI.StateHandle>)ToLua.CheckObject(L, 1, typeof(System.Action <UI.StateHandle>));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 1);
                arg0 = DelegateFactory.CreateDelegate(typeof(System.Action <UI.StateHandle>), func) as System.Action <UI.StateHandle>;
            }

            System.Action <UI.StateHandle> arg1 = null;
            LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

            if (funcType2 != LuaTypes.LUA_TFUNCTION)
            {
                arg1 = (System.Action <UI.StateHandle>)ToLua.CheckObject(L, 2, typeof(System.Action <UI.StateHandle>));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 2);
                arg1 = DelegateFactory.CreateDelegate(typeof(System.Action <UI.StateHandle>), func) as System.Action <UI.StateHandle>;
            }

            System.Action <UnityEngine.EventSystems.PointerEventData> arg2 = null;
            LuaTypes funcType3 = LuaDLL.lua_type(L, 3);

            if (funcType3 != LuaTypes.LUA_TFUNCTION)
            {
                arg2 = (System.Action <UnityEngine.EventSystems.PointerEventData>)ToLua.CheckObject(L, 3, typeof(System.Action <UnityEngine.EventSystems.PointerEventData>));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 3);
                arg2 = DelegateFactory.CreateDelegate(typeof(System.Action <UnityEngine.EventSystems.PointerEventData>), func) as System.Action <UnityEngine.EventSystems.PointerEventData>;
            }

            System.Action <UnityEngine.EventSystems.PointerEventData> arg3 = null;
            LuaTypes funcType4 = LuaDLL.lua_type(L, 4);

            if (funcType4 != LuaTypes.LUA_TFUNCTION)
            {
                arg3 = (System.Action <UnityEngine.EventSystems.PointerEventData>)ToLua.CheckObject(L, 4, typeof(System.Action <UnityEngine.EventSystems.PointerEventData>));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 4);
                arg3 = DelegateFactory.CreateDelegate(typeof(System.Action <UnityEngine.EventSystems.PointerEventData>), func) as System.Action <UnityEngine.EventSystems.PointerEventData>;
            }

            System.Action <UnityEngine.EventSystems.PointerEventData> arg4 = null;
            LuaTypes funcType5 = LuaDLL.lua_type(L, 5);

            if (funcType5 != LuaTypes.LUA_TFUNCTION)
            {
                arg4 = (System.Action <UnityEngine.EventSystems.PointerEventData>)ToLua.CheckObject(L, 5, typeof(System.Action <UnityEngine.EventSystems.PointerEventData>));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 5);
                arg4 = DelegateFactory.CreateDelegate(typeof(System.Action <UnityEngine.EventSystems.PointerEventData>), func) as System.Action <UnityEngine.EventSystems.PointerEventData>;
            }

            System.Action <UnityEngine.EventSystems.PointerEventData> arg5 = null;
            LuaTypes funcType6 = LuaDLL.lua_type(L, 6);

            if (funcType6 != LuaTypes.LUA_TFUNCTION)
            {
                arg5 = (System.Action <UnityEngine.EventSystems.PointerEventData>)ToLua.CheckObject(L, 6, typeof(System.Action <UnityEngine.EventSystems.PointerEventData>));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 6);
                arg5 = DelegateFactory.CreateDelegate(typeof(System.Action <UnityEngine.EventSystems.PointerEventData>), func) as System.Action <UnityEngine.EventSystems.PointerEventData>;
            }

            System.Action <UI.StateHandle, int> arg6 = null;
            LuaTypes funcType7 = LuaDLL.lua_type(L, 7);

            if (funcType7 != LuaTypes.LUA_TFUNCTION)
            {
                arg6 = (System.Action <UI.StateHandle, int>)ToLua.CheckObject(L, 7, typeof(System.Action <UI.StateHandle, int>));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 7);
                arg6 = DelegateFactory.CreateDelegate(typeof(System.Action <UI.StateHandle, int>), func) as System.Action <UI.StateHandle, int>;
            }

            UI.StateHandle.RemoveGlobalHook(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    static int ShowMessageBox(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && ToLua.CheckTypes(L, 1, typeof(MyFrameWork.UIMgr), typeof(string)))
            {
                MyFrameWork.UIMgr obj  = (MyFrameWork.UIMgr)ToLua.ToObject(L, 1);
                string            arg0 = ToLua.ToString(L, 2);
                obj.ShowMessageBox(arg0);
                return(0);
            }
            else if (count == 4 && ToLua.CheckTypes(L, 1, typeof(MyFrameWork.UIMgr), typeof(string), typeof(string), typeof(UIEventListener.VoidDelegate)))
            {
                MyFrameWork.UIMgr            obj       = (MyFrameWork.UIMgr)ToLua.ToObject(L, 1);
                string                       arg0      = ToLua.ToString(L, 2);
                string                       arg1      = ToLua.ToString(L, 3);
                UIEventListener.VoidDelegate arg2      = null;
                LuaTypes                     funcType4 = LuaDLL.lua_type(L, 4);

                if (funcType4 != LuaTypes.LUA_TFUNCTION)
                {
                    arg2 = (UIEventListener.VoidDelegate)ToLua.ToObject(L, 4);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 4);
                    arg2 = DelegateFactory.CreateDelegate(typeof(UIEventListener.VoidDelegate), func) as UIEventListener.VoidDelegate;
                }

                obj.ShowMessageBox(arg0, arg1, arg2);
                return(0);
            }
            else if (count == 6 && ToLua.CheckTypes(L, 1, typeof(MyFrameWork.UIMgr), typeof(string), typeof(string), typeof(UIEventListener.VoidDelegate), typeof(string), typeof(UIEventListener.VoidDelegate)))
            {
                MyFrameWork.UIMgr            obj       = (MyFrameWork.UIMgr)ToLua.ToObject(L, 1);
                string                       arg0      = ToLua.ToString(L, 2);
                string                       arg1      = ToLua.ToString(L, 3);
                UIEventListener.VoidDelegate arg2      = null;
                LuaTypes                     funcType4 = LuaDLL.lua_type(L, 4);

                if (funcType4 != LuaTypes.LUA_TFUNCTION)
                {
                    arg2 = (UIEventListener.VoidDelegate)ToLua.ToObject(L, 4);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 4);
                    arg2 = DelegateFactory.CreateDelegate(typeof(UIEventListener.VoidDelegate), func) as UIEventListener.VoidDelegate;
                }

                string arg3 = ToLua.ToString(L, 5);
                UIEventListener.VoidDelegate arg4 = null;
                LuaTypes funcType6 = LuaDLL.lua_type(L, 6);

                if (funcType6 != LuaTypes.LUA_TFUNCTION)
                {
                    arg4 = (UIEventListener.VoidDelegate)ToLua.ToObject(L, 6);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 6);
                    arg4 = DelegateFactory.CreateDelegate(typeof(UIEventListener.VoidDelegate), func) as UIEventListener.VoidDelegate;
                }

                obj.ShowMessageBox(arg0, arg1, arg2, arg3, arg4);
                return(0);
            }
            else
            {
                return(LuaDLL.tolua_error(L, "invalid arguments to method: MyFrameWork.UIMgr.ShowMessageBox"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
示例#15
0
    static int BezierMove(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 10 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(UnityEngine.Vector3), typeof(float), typeof(InterpType), typeof(RepeatType), typeof(bool), typeof(PathType), typeof(UnityEngine.Vector3[]), typeof(AnimCallBack), typeof(object[])))
            {
                UnityEngine.GameObject arg0     = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                UnityEngine.Vector3    arg1     = (UnityEngine.Vector3)ToLua.ToObject(L, 2);
                float                 arg2      = (float)LuaDLL.lua_tonumber(L, 3);
                InterpType            arg3      = (InterpType)ToLua.ToObject(L, 4);
                RepeatType            arg4      = (RepeatType)ToLua.ToObject(L, 5);
                bool                  arg5      = LuaDLL.lua_toboolean(L, 6);
                PathType              arg6      = (PathType)ToLua.ToObject(L, 7);
                UnityEngine.Vector3[] arg7      = ToLua.CheckObjectArray <UnityEngine.Vector3>(L, 8);
                AnimCallBack          arg8      = null;
                LuaTypes              funcType9 = LuaDLL.lua_type(L, 9);

                if (funcType9 != LuaTypes.LUA_TFUNCTION)
                {
                    arg8 = (AnimCallBack)ToLua.ToObject(L, 9);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 9);
                    arg8 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
                }

                object[] arg9 = ToLua.CheckObjectArray(L, 10);
                AnimData o    = AnimSystem.BezierMove(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 10 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(UnityEngine.Vector3), typeof(UnityEngine.Vector3), typeof(float), typeof(InterpType), typeof(bool), typeof(PathType), typeof(UnityEngine.Vector3[]), typeof(AnimCallBack), typeof(object[])))
            {
                UnityEngine.GameObject arg0     = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                UnityEngine.Vector3    arg1     = (UnityEngine.Vector3)ToLua.ToObject(L, 2);
                UnityEngine.Vector3    arg2     = (UnityEngine.Vector3)ToLua.ToObject(L, 3);
                float                 arg3      = (float)LuaDLL.lua_tonumber(L, 4);
                InterpType            arg4      = (InterpType)ToLua.ToObject(L, 5);
                bool                  arg5      = LuaDLL.lua_toboolean(L, 6);
                PathType              arg6      = (PathType)ToLua.ToObject(L, 7);
                UnityEngine.Vector3[] arg7      = ToLua.CheckObjectArray <UnityEngine.Vector3>(L, 8);
                AnimCallBack          arg8      = null;
                LuaTypes              funcType9 = LuaDLL.lua_type(L, 9);

                if (funcType9 != LuaTypes.LUA_TFUNCTION)
                {
                    arg8 = (AnimCallBack)ToLua.ToObject(L, 9);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 9);
                    arg8 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
                }

                object[] arg9 = ToLua.CheckObjectArray(L, 10);
                AnimData o    = AnimSystem.BezierMove(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 11 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(UnityEngine.Vector3), typeof(UnityEngine.Vector3), typeof(float), typeof(float), typeof(InterpType), typeof(bool), typeof(PathType), typeof(float[]), typeof(AnimCallBack), typeof(object[])))
            {
                UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                UnityEngine.Vector3    arg1 = (UnityEngine.Vector3)ToLua.ToObject(L, 2);
                UnityEngine.Vector3    arg2 = (UnityEngine.Vector3)ToLua.ToObject(L, 3);
                float        arg3           = (float)LuaDLL.lua_tonumber(L, 4);
                float        arg4           = (float)LuaDLL.lua_tonumber(L, 5);
                InterpType   arg5           = (InterpType)ToLua.ToObject(L, 6);
                bool         arg6           = LuaDLL.lua_toboolean(L, 7);
                PathType     arg7           = (PathType)ToLua.ToObject(L, 8);
                float[]      arg8           = ToLua.CheckNumberArray <float>(L, 9);
                AnimCallBack arg9           = null;
                LuaTypes     funcType10     = LuaDLL.lua_type(L, 10);

                if (funcType10 != LuaTypes.LUA_TFUNCTION)
                {
                    arg9 = (AnimCallBack)ToLua.ToObject(L, 10);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 10);
                    arg9 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
                }

                object[] arg10 = ToLua.CheckObjectArray(L, 11);
                AnimData o     = AnimSystem.BezierMove(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 11 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(UnityEngine.Vector3), typeof(float), typeof(RepeatType), typeof(InterpType), typeof(float), typeof(bool), typeof(PathType), typeof(float[]), typeof(AnimCallBack), typeof(object[])))
            {
                UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                UnityEngine.Vector3    arg1 = (UnityEngine.Vector3)ToLua.ToObject(L, 2);
                float        arg2           = (float)LuaDLL.lua_tonumber(L, 3);
                RepeatType   arg3           = (RepeatType)ToLua.ToObject(L, 4);
                InterpType   arg4           = (InterpType)ToLua.ToObject(L, 5);
                float        arg5           = (float)LuaDLL.lua_tonumber(L, 6);
                bool         arg6           = LuaDLL.lua_toboolean(L, 7);
                PathType     arg7           = (PathType)ToLua.ToObject(L, 8);
                float[]      arg8           = ToLua.CheckNumberArray <float>(L, 9);
                AnimCallBack arg9           = null;
                LuaTypes     funcType10     = LuaDLL.lua_type(L, 10);

                if (funcType10 != LuaTypes.LUA_TFUNCTION)
                {
                    arg9 = (AnimCallBack)ToLua.ToObject(L, 10);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 10);
                    arg9 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
                }

                object[] arg10 = ToLua.CheckObjectArray(L, 11);
                AnimData o     = AnimSystem.BezierMove(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 13 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(UnityEngine.Vector3), typeof(UnityEngine.Vector3), typeof(float), typeof(float), typeof(RepeatType), typeof(int), typeof(InterpType), typeof(bool), typeof(PathType), typeof(UnityEngine.Vector3[]), typeof(AnimCallBack), typeof(object[])))
            {
                UnityEngine.GameObject arg0      = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                UnityEngine.Vector3    arg1      = (UnityEngine.Vector3)ToLua.ToObject(L, 2);
                UnityEngine.Vector3    arg2      = (UnityEngine.Vector3)ToLua.ToObject(L, 3);
                float                 arg3       = (float)LuaDLL.lua_tonumber(L, 4);
                float                 arg4       = (float)LuaDLL.lua_tonumber(L, 5);
                RepeatType            arg5       = (RepeatType)ToLua.ToObject(L, 6);
                int                   arg6       = (int)LuaDLL.lua_tonumber(L, 7);
                InterpType            arg7       = (InterpType)ToLua.ToObject(L, 8);
                bool                  arg8       = LuaDLL.lua_toboolean(L, 9);
                PathType              arg9       = (PathType)ToLua.ToObject(L, 10);
                UnityEngine.Vector3[] arg10      = ToLua.CheckObjectArray <UnityEngine.Vector3>(L, 11);
                AnimCallBack          arg11      = null;
                LuaTypes              funcType12 = LuaDLL.lua_type(L, 12);

                if (funcType12 != LuaTypes.LUA_TFUNCTION)
                {
                    arg11 = (AnimCallBack)ToLua.ToObject(L, 12);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 12);
                    arg11 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
                }

                object[] arg12 = ToLua.CheckObjectArray(L, 13);
                AnimData o     = AnimSystem.BezierMove(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 13 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject), typeof(UnityEngine.Vector3), typeof(UnityEngine.Vector3), typeof(float), typeof(RepeatType), typeof(int), typeof(float), typeof(InterpType), typeof(bool), typeof(PathType), typeof(float[]), typeof(AnimCallBack), typeof(object[])))
            {
                UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                UnityEngine.Vector3    arg1 = (UnityEngine.Vector3)ToLua.ToObject(L, 2);
                UnityEngine.Vector3    arg2 = (UnityEngine.Vector3)ToLua.ToObject(L, 3);
                float        arg3           = (float)LuaDLL.lua_tonumber(L, 4);
                RepeatType   arg4           = (RepeatType)ToLua.ToObject(L, 5);
                int          arg5           = (int)LuaDLL.lua_tonumber(L, 6);
                float        arg6           = (float)LuaDLL.lua_tonumber(L, 7);
                InterpType   arg7           = (InterpType)ToLua.ToObject(L, 8);
                bool         arg8           = LuaDLL.lua_toboolean(L, 9);
                PathType     arg9           = (PathType)ToLua.ToObject(L, 10);
                float[]      arg10          = ToLua.CheckNumberArray <float>(L, 11);
                AnimCallBack arg11          = null;
                LuaTypes     funcType12     = LuaDLL.lua_type(L, 12);

                if (funcType12 != LuaTypes.LUA_TFUNCTION)
                {
                    arg11 = (AnimCallBack)ToLua.ToObject(L, 12);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 12);
                    arg11 = DelegateFactory.CreateDelegate(typeof(AnimCallBack), func) as AnimCallBack;
                }

                object[] arg12 = ToLua.CheckObjectArray(L, 13);
                AnimData o     = AnimSystem.BezierMove(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: AnimSystem.BezierMove"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    private static int Create(IntPtr L)
    {
        int result;

        try
        {
            int num = LuaDLL.lua_gettop(L);
            if (num == 5 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(int), typeof(int), typeof(int), typeof(bool)))
            {
                string    text = ToLua.ToString(L, 1);
                int       num2 = (int)LuaDLL.lua_tonumber(L, 2);
                int       num3 = (int)LuaDLL.lua_tonumber(L, 3);
                int       num4 = (int)LuaDLL.lua_tonumber(L, 4);
                bool      flag = LuaDLL.lua_toboolean(L, 5);
                AudioClip obj  = AudioClip.Create(text, num2, num3, num4, flag);
                ToLua.Push(L, obj);
                result = 1;
            }
            else if (num == 6 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(int), typeof(int), typeof(int), typeof(bool), typeof(AudioClip.PCMReaderCallback)))
            {
                string   text2    = ToLua.ToString(L, 1);
                int      num5     = (int)LuaDLL.lua_tonumber(L, 2);
                int      num6     = (int)LuaDLL.lua_tonumber(L, 3);
                int      num7     = (int)LuaDLL.lua_tonumber(L, 4);
                bool     flag2    = LuaDLL.lua_toboolean(L, 5);
                LuaTypes luaTypes = LuaDLL.lua_type(L, 6);
                AudioClip.PCMReaderCallback pCMReaderCallback;
                if (luaTypes != LuaTypes.LUA_TFUNCTION)
                {
                    pCMReaderCallback = (AudioClip.PCMReaderCallback)ToLua.ToObject(L, 6);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 6);
                    pCMReaderCallback = (DelegateFactory.CreateDelegate(typeof(AudioClip.PCMReaderCallback), func) as AudioClip.PCMReaderCallback);
                }
                AudioClip obj2 = AudioClip.Create(text2, num5, num6, num7, flag2, pCMReaderCallback);
                ToLua.Push(L, obj2);
                result = 1;
            }
            else if (num == 7 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(int), typeof(int), typeof(int), typeof(bool), typeof(AudioClip.PCMReaderCallback), typeof(AudioClip.PCMSetPositionCallback)))
            {
                string   text3     = ToLua.ToString(L, 1);
                int      num8      = (int)LuaDLL.lua_tonumber(L, 2);
                int      num9      = (int)LuaDLL.lua_tonumber(L, 3);
                int      num10     = (int)LuaDLL.lua_tonumber(L, 4);
                bool     flag3     = LuaDLL.lua_toboolean(L, 5);
                LuaTypes luaTypes2 = LuaDLL.lua_type(L, 6);
                AudioClip.PCMReaderCallback pCMReaderCallback2;
                if (luaTypes2 != LuaTypes.LUA_TFUNCTION)
                {
                    pCMReaderCallback2 = (AudioClip.PCMReaderCallback)ToLua.ToObject(L, 6);
                }
                else
                {
                    LuaFunction func2 = ToLua.ToLuaFunction(L, 6);
                    pCMReaderCallback2 = (DelegateFactory.CreateDelegate(typeof(AudioClip.PCMReaderCallback), func2) as AudioClip.PCMReaderCallback);
                }
                LuaTypes luaTypes3 = LuaDLL.lua_type(L, 7);
                AudioClip.PCMSetPositionCallback pCMSetPositionCallback;
                if (luaTypes3 != LuaTypes.LUA_TFUNCTION)
                {
                    pCMSetPositionCallback = (AudioClip.PCMSetPositionCallback)ToLua.ToObject(L, 7);
                }
                else
                {
                    LuaFunction func3 = ToLua.ToLuaFunction(L, 7);
                    pCMSetPositionCallback = (DelegateFactory.CreateDelegate(typeof(AudioClip.PCMSetPositionCallback), func3) as AudioClip.PCMSetPositionCallback);
                }
                AudioClip obj3 = AudioClip.Create(text3, num8, num9, num10, flag3, pCMReaderCallback2, pCMSetPositionCallback);
                ToLua.Push(L, obj3);
                result = 1;
            }
            else
            {
                result = LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.AudioClip.Create");
            }
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
    static int WaitFor(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(Lit.Unity.LitBehaviour), typeof(Lit.Unity._D_OuterBool), typeof(Lit.Unity._D_Void)))
            {
                Lit.Unity.LitBehaviour obj  = (Lit.Unity.LitBehaviour)ToLua.ToObject(L, 1);
                Lit.Unity._D_OuterBool arg0 = null;
                LuaTypes funcType2          = LuaDLL.lua_type(L, 2);

                if (funcType2 != LuaTypes.LUA_TFUNCTION)
                {
                    arg0 = (Lit.Unity._D_OuterBool)ToLua.ToObject(L, 2);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 2);
                    arg0 = DelegateFactory.CreateDelegate(typeof(Lit.Unity._D_OuterBool), func) as Lit.Unity._D_OuterBool;
                }

                Lit.Unity._D_Void arg1      = null;
                LuaTypes          funcType3 = LuaDLL.lua_type(L, 3);

                if (funcType3 != LuaTypes.LUA_TFUNCTION)
                {
                    arg1 = (Lit.Unity._D_Void)ToLua.ToObject(L, 3);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 3);
                    arg1 = DelegateFactory.CreateDelegate(typeof(Lit.Unity._D_Void), func) as Lit.Unity._D_Void;
                }

                UnityEngine.Coroutine o = obj.WaitFor(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(Lit.Unity.LitBehaviour), typeof(float), typeof(Lit.Unity._D_Void)))
            {
                Lit.Unity.LitBehaviour obj  = (Lit.Unity.LitBehaviour)ToLua.ToObject(L, 1);
                float             arg0      = (float)LuaDLL.lua_tonumber(L, 2);
                Lit.Unity._D_Void arg1      = null;
                LuaTypes          funcType3 = LuaDLL.lua_type(L, 3);

                if (funcType3 != LuaTypes.LUA_TFUNCTION)
                {
                    arg1 = (Lit.Unity._D_Void)ToLua.ToObject(L, 3);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 3);
                    arg1 = DelegateFactory.CreateDelegate(typeof(Lit.Unity._D_Void), func) as Lit.Unity._D_Void;
                }

                UnityEngine.Coroutine o = obj.WaitFor(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: Lit.Unity.LitBehaviour.WaitFor"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
示例#18
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);
        }
    }
    static int _RepeatEveryFrame(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(Lit.Unity.LitBehaviour), typeof(int), typeof(Lit.Unity._D_Void)))
            {
                Lit.Unity.LitBehaviour obj = (Lit.Unity.LitBehaviour)ToLua.ToObject(L, 1);
                int arg0 = (int)LuaDLL.lua_tonumber(L, 2);
                Lit.Unity._D_Void arg1      = null;
                LuaTypes          funcType3 = LuaDLL.lua_type(L, 3);

                if (funcType3 != LuaTypes.LUA_TFUNCTION)
                {
                    arg1 = (Lit.Unity._D_Void)ToLua.ToObject(L, 3);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 3);
                    arg1 = DelegateFactory.CreateDelegate(typeof(Lit.Unity._D_Void), func) as Lit.Unity._D_Void;
                }

                System.Collections.IEnumerator o = obj._RepeatEveryFrame(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(Lit.Unity.LitBehaviour), typeof(int), typeof(System.Action <int>), typeof(int)))
            {
                Lit.Unity.LitBehaviour obj = (Lit.Unity.LitBehaviour)ToLua.ToObject(L, 1);
                int arg0 = (int)LuaDLL.lua_tonumber(L, 2);
                System.Action <int> arg1      = null;
                LuaTypes            funcType3 = LuaDLL.lua_type(L, 3);

                if (funcType3 != LuaTypes.LUA_TFUNCTION)
                {
                    arg1 = (System.Action <int>)ToLua.ToObject(L, 3);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 3);
                    arg1 = DelegateFactory.CreateDelegate(typeof(System.Action <int>), func) as System.Action <int>;
                }

                int arg2 = (int)LuaDLL.lua_tonumber(L, 4);
                System.Collections.IEnumerator o = obj._RepeatEveryFrame(arg0, arg1, arg2);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(Lit.Unity.LitBehaviour), typeof(int), typeof(System.Action), typeof(int)))
            {
                Lit.Unity.LitBehaviour obj = (Lit.Unity.LitBehaviour)ToLua.ToObject(L, 1);
                int           arg0         = (int)LuaDLL.lua_tonumber(L, 2);
                System.Action arg1         = null;
                LuaTypes      funcType3    = LuaDLL.lua_type(L, 3);

                if (funcType3 != LuaTypes.LUA_TFUNCTION)
                {
                    arg1 = (System.Action)ToLua.ToObject(L, 3);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 3);
                    arg1 = DelegateFactory.CreateDelegate(typeof(System.Action), func) as System.Action;
                }

                int arg2 = (int)LuaDLL.lua_tonumber(L, 4);
                System.Collections.IEnumerator o = obj._RepeatEveryFrame(arg0, arg1, arg2);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(Lit.Unity.LitBehaviour), typeof(int), typeof(Lit.Unity._D_Void), typeof(Lit.Unity._D_OuterBool)))
            {
                Lit.Unity.LitBehaviour obj = (Lit.Unity.LitBehaviour)ToLua.ToObject(L, 1);
                int arg0 = (int)LuaDLL.lua_tonumber(L, 2);
                Lit.Unity._D_Void arg1      = null;
                LuaTypes          funcType3 = LuaDLL.lua_type(L, 3);

                if (funcType3 != LuaTypes.LUA_TFUNCTION)
                {
                    arg1 = (Lit.Unity._D_Void)ToLua.ToObject(L, 3);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 3);
                    arg1 = DelegateFactory.CreateDelegate(typeof(Lit.Unity._D_Void), func) as Lit.Unity._D_Void;
                }

                Lit.Unity._D_OuterBool arg2 = null;
                LuaTypes funcType4          = LuaDLL.lua_type(L, 4);

                if (funcType4 != LuaTypes.LUA_TFUNCTION)
                {
                    arg2 = (Lit.Unity._D_OuterBool)ToLua.ToObject(L, 4);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 4);
                    arg2 = DelegateFactory.CreateDelegate(typeof(Lit.Unity._D_OuterBool), func) as Lit.Unity._D_OuterBool;
                }

                System.Collections.IEnumerator o = obj._RepeatEveryFrame(arg0, arg1, arg2);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: Lit.Unity.LitBehaviour._RepeatEveryFrame"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    static int Create(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 5 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(int), typeof(int), typeof(int), typeof(bool)))
            {
                string arg0             = ToLua.ToString(L, 1);
                int    arg1             = (int)LuaDLL.lua_tonumber(L, 2);
                int    arg2             = (int)LuaDLL.lua_tonumber(L, 3);
                int    arg3             = (int)LuaDLL.lua_tonumber(L, 4);
                bool   arg4             = LuaDLL.lua_toboolean(L, 5);
                UnityEngine.AudioClip o = UnityEngine.AudioClip.Create(arg0, arg1, arg2, arg3, arg4);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 6 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(int), typeof(int), typeof(int), typeof(bool), typeof(UnityEngine.AudioClip.PCMReaderCallback)))
            {
                string arg0 = ToLua.ToString(L, 1);
                int    arg1 = (int)LuaDLL.lua_tonumber(L, 2);
                int    arg2 = (int)LuaDLL.lua_tonumber(L, 3);
                int    arg3 = (int)LuaDLL.lua_tonumber(L, 4);
                bool   arg4 = LuaDLL.lua_toboolean(L, 5);
                UnityEngine.AudioClip.PCMReaderCallback arg5 = null;
                LuaTypes funcType6 = LuaDLL.lua_type(L, 6);

                if (funcType6 != LuaTypes.LUA_TFUNCTION)
                {
                    arg5 = (UnityEngine.AudioClip.PCMReaderCallback)ToLua.ToObject(L, 6);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 6);
                    arg5 = DelegateFactory.CreateDelegate(typeof(UnityEngine.AudioClip.PCMReaderCallback), func) as UnityEngine.AudioClip.PCMReaderCallback;
                }

                UnityEngine.AudioClip o = UnityEngine.AudioClip.Create(arg0, arg1, arg2, arg3, arg4, arg5);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 7 && TypeChecker.CheckTypes(L, 1, typeof(string), typeof(int), typeof(int), typeof(int), typeof(bool), typeof(UnityEngine.AudioClip.PCMReaderCallback), typeof(UnityEngine.AudioClip.PCMSetPositionCallback)))
            {
                string arg0 = ToLua.ToString(L, 1);
                int    arg1 = (int)LuaDLL.lua_tonumber(L, 2);
                int    arg2 = (int)LuaDLL.lua_tonumber(L, 3);
                int    arg3 = (int)LuaDLL.lua_tonumber(L, 4);
                bool   arg4 = LuaDLL.lua_toboolean(L, 5);
                UnityEngine.AudioClip.PCMReaderCallback arg5 = null;
                LuaTypes funcType6 = LuaDLL.lua_type(L, 6);

                if (funcType6 != LuaTypes.LUA_TFUNCTION)
                {
                    arg5 = (UnityEngine.AudioClip.PCMReaderCallback)ToLua.ToObject(L, 6);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 6);
                    arg5 = DelegateFactory.CreateDelegate(typeof(UnityEngine.AudioClip.PCMReaderCallback), func) as UnityEngine.AudioClip.PCMReaderCallback;
                }

                UnityEngine.AudioClip.PCMSetPositionCallback arg6 = null;
                LuaTypes funcType7 = LuaDLL.lua_type(L, 7);

                if (funcType7 != LuaTypes.LUA_TFUNCTION)
                {
                    arg6 = (UnityEngine.AudioClip.PCMSetPositionCallback)ToLua.ToObject(L, 7);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 7);
                    arg6 = DelegateFactory.CreateDelegate(typeof(UnityEngine.AudioClip.PCMSetPositionCallback), func) as UnityEngine.AudioClip.PCMSetPositionCallback;
                }

                UnityEngine.AudioClip o = UnityEngine.AudioClip.Create(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.AudioClip.Create"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
示例#21
0
 public T ToDelegate <T>() where T : class
 {
     return(DelegateFactory.CreateDelegate(typeof(T), this) as T);
 }
示例#22
0
    static int Play(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(FairyGUI.Transition)))
            {
                FairyGUI.Transition obj = (FairyGUI.Transition)ToLua.ToObject(L, 1);
                obj.Play();
                return(0);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(FairyGUI.Transition), typeof(FairyGUI.PlayCompleteCallback)))
            {
                FairyGUI.Transition           obj  = (FairyGUI.Transition)ToLua.ToObject(L, 1);
                FairyGUI.PlayCompleteCallback arg0 = null;
                LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

                if (funcType2 != LuaTypes.LUA_TFUNCTION)
                {
                    arg0 = (FairyGUI.PlayCompleteCallback)ToLua.ToObject(L, 2);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 2);
                    arg0 = DelegateFactory.CreateDelegate(typeof(FairyGUI.PlayCompleteCallback), func) as FairyGUI.PlayCompleteCallback;
                }

                obj.Play(arg0);
                return(0);
            }
            else if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(FairyGUI.Transition), typeof(int), typeof(float), typeof(FairyGUI.PlayCompleteCallback)))
            {
                FairyGUI.Transition obj = (FairyGUI.Transition)ToLua.ToObject(L, 1);
                int   arg0 = (int)LuaDLL.lua_tonumber(L, 2);
                float arg1 = (float)LuaDLL.lua_tonumber(L, 3);
                FairyGUI.PlayCompleteCallback arg2 = null;
                LuaTypes funcType4 = LuaDLL.lua_type(L, 4);

                if (funcType4 != LuaTypes.LUA_TFUNCTION)
                {
                    arg2 = (FairyGUI.PlayCompleteCallback)ToLua.ToObject(L, 4);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 4);
                    arg2 = DelegateFactory.CreateDelegate(typeof(FairyGUI.PlayCompleteCallback), func) as FairyGUI.PlayCompleteCallback;
                }

                obj.Play(arg0, arg1, arg2);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.Transition.Play"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    static int FindLastIndex(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(System.Collections.Generic.List <EventDelegate>), typeof(System.Predicate <EventDelegate>)))
            {
                System.Collections.Generic.List <EventDelegate> obj = (System.Collections.Generic.List <EventDelegate>)ToLua.ToObject(L, 1);
                System.Predicate <EventDelegate> arg0 = null;
                LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

                if (funcType2 != LuaTypes.LUA_TFUNCTION)
                {
                    arg0 = (System.Predicate <EventDelegate>)ToLua.ToObject(L, 2);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 2);
                    arg0 = DelegateFactory.CreateDelegate(typeof(System.Predicate <EventDelegate>), func) as System.Predicate <EventDelegate>;
                }

                int o = obj.FindLastIndex(arg0);
                LuaDLL.lua_pushinteger(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(System.Collections.Generic.List <EventDelegate>), typeof(int), typeof(System.Predicate <EventDelegate>)))
            {
                System.Collections.Generic.List <EventDelegate> obj = (System.Collections.Generic.List <EventDelegate>)ToLua.ToObject(L, 1);
                int arg0 = (int)LuaDLL.lua_tonumber(L, 2);
                System.Predicate <EventDelegate> arg1 = null;
                LuaTypes funcType3 = LuaDLL.lua_type(L, 3);

                if (funcType3 != LuaTypes.LUA_TFUNCTION)
                {
                    arg1 = (System.Predicate <EventDelegate>)ToLua.ToObject(L, 3);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 3);
                    arg1 = DelegateFactory.CreateDelegate(typeof(System.Predicate <EventDelegate>), func) as System.Predicate <EventDelegate>;
                }

                int o = obj.FindLastIndex(arg0, arg1);
                LuaDLL.lua_pushinteger(L, o);
                return(1);
            }
            else if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(System.Collections.Generic.List <EventDelegate>), typeof(int), typeof(int), typeof(System.Predicate <EventDelegate>)))
            {
                System.Collections.Generic.List <EventDelegate> obj = (System.Collections.Generic.List <EventDelegate>)ToLua.ToObject(L, 1);
                int arg0 = (int)LuaDLL.lua_tonumber(L, 2);
                int arg1 = (int)LuaDLL.lua_tonumber(L, 3);
                System.Predicate <EventDelegate> arg2 = null;
                LuaTypes funcType4 = LuaDLL.lua_type(L, 4);

                if (funcType4 != LuaTypes.LUA_TFUNCTION)
                {
                    arg2 = (System.Predicate <EventDelegate>)ToLua.ToObject(L, 4);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 4);
                    arg2 = DelegateFactory.CreateDelegate(typeof(System.Predicate <EventDelegate>), func) as System.Predicate <EventDelegate>;
                }

                int o = obj.FindLastIndex(arg0, arg1, arg2);
                LuaDLL.lua_pushinteger(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: System.Collections.Generic.List<EventDelegate>.FindLastIndex"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    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));
        }
    }
    static int AddListener(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(DelegateHelper.StringDelegate), typeof(object)))
            {
                DelegateHelper.StringDelegate arg0 = null;
                LuaTypes funcType1 = LuaDLL.lua_type(L, 1);

                if (funcType1 != LuaTypes.LUA_TFUNCTION)
                {
                    arg0 = (DelegateHelper.StringDelegate)ToLua.ToObject(L, 1);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 1);
                    arg0 = DelegateFactory.CreateDelegate(typeof(DelegateHelper.StringDelegate), func) as DelegateHelper.StringDelegate;
                }

                object arg1 = ToLua.ToVarObject(L, 2);
                LuaHelper.AddListener(arg0, arg1);
                return(0);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(DelegateHelper.TableDelegate), typeof(object)))
            {
                DelegateHelper.TableDelegate arg0 = null;
                LuaTypes funcType1 = LuaDLL.lua_type(L, 1);

                if (funcType1 != LuaTypes.LUA_TFUNCTION)
                {
                    arg0 = (DelegateHelper.TableDelegate)ToLua.ToObject(L, 1);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 1);
                    arg0 = DelegateFactory.CreateDelegate(typeof(DelegateHelper.TableDelegate), func) as DelegateHelper.TableDelegate;
                }

                object arg1 = ToLua.ToVarObject(L, 2);
                LuaHelper.AddListener(arg0, arg1);
                return(0);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(DelegateHelper.FloatDelegate), typeof(object)))
            {
                DelegateHelper.FloatDelegate arg0 = null;
                LuaTypes funcType1 = LuaDLL.lua_type(L, 1);

                if (funcType1 != LuaTypes.LUA_TFUNCTION)
                {
                    arg0 = (DelegateHelper.FloatDelegate)ToLua.ToObject(L, 1);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 1);
                    arg0 = DelegateFactory.CreateDelegate(typeof(DelegateHelper.FloatDelegate), func) as DelegateHelper.FloatDelegate;
                }

                object arg1 = ToLua.ToVarObject(L, 2);
                LuaHelper.AddListener(arg0, arg1);
                return(0);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(DelegateHelper.VoidDelegate), typeof(object)))
            {
                DelegateHelper.VoidDelegate arg0 = null;
                LuaTypes funcType1 = LuaDLL.lua_type(L, 1);

                if (funcType1 != LuaTypes.LUA_TFUNCTION)
                {
                    arg0 = (DelegateHelper.VoidDelegate)ToLua.ToObject(L, 1);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 1);
                    arg0 = DelegateFactory.CreateDelegate(typeof(DelegateHelper.VoidDelegate), func) as DelegateHelper.VoidDelegate;
                }

                object arg1 = ToLua.ToVarObject(L, 2);
                LuaHelper.AddListener(arg0, arg1);
                return(0);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(DelegateHelper.IntDelegate), typeof(object)))
            {
                DelegateHelper.IntDelegate arg0 = null;
                LuaTypes funcType1 = LuaDLL.lua_type(L, 1);

                if (funcType1 != LuaTypes.LUA_TFUNCTION)
                {
                    arg0 = (DelegateHelper.IntDelegate)ToLua.ToObject(L, 1);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 1);
                    arg0 = DelegateFactory.CreateDelegate(typeof(DelegateHelper.IntDelegate), func) as DelegateHelper.IntDelegate;
                }

                object arg1 = ToLua.ToVarObject(L, 2);
                LuaHelper.AddListener(arg0, arg1);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: LuaHelper.AddListener"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }