Example #1
0
    static int SetEventHandle(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (LuaScriptMgr.CheckTypes(L, 1, typeof(UIEventListener), typeof(int), typeof(UtilCommon.OnTouchEventHandle)) && LuaScriptMgr.CheckParamsType(L, typeof(object), 4, count - 3))
        {
            UIEventListener obj  = (UIEventListener)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UIEventListener");
            int             arg0 = (int)LuaDLL.lua_tonumber(L, 2);
            UtilCommon.OnTouchEventHandle arg1 = null;
            LuaTypes funcType3 = LuaDLL.lua_type(L, 3);

            if (funcType3 != LuaTypes.LUA_TFUNCTION)
            {
                arg1 = (UtilCommon.OnTouchEventHandle)LuaScriptMgr.GetLuaObject(L, 3);
            }
            else
            {
                LuaFunction func = LuaScriptMgr.GetLuaFunction(L, 3);
                arg1 = (param0, param1, param2) =>
                {
                    int top = func.BeginPCall();
                    LuaScriptMgr.Push(L, param0);
                    LuaScriptMgr.PushVarObject(L, param1);
                    LuaScriptMgr.PushArray(L, param2);
                    func.PCall(top, 3);
                    func.EndPCall(top);
                };
            }

            object[] objs2 = LuaScriptMgr.GetParamsObject(L, 4, count - 3);
            obj.SetEventHandle(arg0, arg1, objs2);
            return(0);
        }
        else if (LuaScriptMgr.CheckTypes(L, 1, typeof(UIEventListener), typeof(EnumTouchEventType), typeof(UtilCommon.OnTouchEventHandle)) && LuaScriptMgr.CheckParamsType(L, typeof(object), 4, count - 3))
        {
            UIEventListener               obj  = (UIEventListener)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UIEventListener");
            EnumTouchEventType            arg0 = (EnumTouchEventType)LuaScriptMgr.GetLuaObject(L, 2);
            UtilCommon.OnTouchEventHandle arg1 = null;
            LuaTypes funcType3 = LuaDLL.lua_type(L, 3);

            if (funcType3 != LuaTypes.LUA_TFUNCTION)
            {
                arg1 = (UtilCommon.OnTouchEventHandle)LuaScriptMgr.GetLuaObject(L, 3);
            }
            else
            {
                LuaFunction func = LuaScriptMgr.GetLuaFunction(L, 3);
                arg1 = (param0, param1, param2) =>
                {
                    int top = func.BeginPCall();
                    LuaScriptMgr.Push(L, param0);
                    LuaScriptMgr.PushVarObject(L, param1);
                    LuaScriptMgr.PushArray(L, param2);
                    func.PCall(top, 3);
                    func.EndPCall(top);
                };
            }

            object[] objs2 = LuaScriptMgr.GetParamsObject(L, 4, count - 3);
            obj.SetEventHandle(arg0, arg1, objs2);
            return(0);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: UIEventListener.SetEventHandle");
        }

        return(0);
    }