static int RemoveEventListener(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 3);
            EventSystem.EventDispatcher obj = (EventSystem.EventDispatcher)ToLua.CheckObject(L, 1, typeof(EventSystem.EventDispatcher));
            string arg0 = ToLua.CheckString(L, 2);
            EventSystem.EventDelegate arg1 = null;
            LuaTypes funcType3             = LuaDLL.lua_type(L, 3);

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

            bool o = obj.RemoveEventListener(arg0, arg1);
            LuaDLL.lua_pushboolean(L, o);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    static int AddEventListener(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(EventSystem.EventDispatcher), typeof(string), typeof(EventSystem.EventDelegate)))
            {
                EventSystem.EventDispatcher obj = (EventSystem.EventDispatcher)ToLua.ToObject(L, 1);
                string arg0 = ToLua.ToString(L, 2);
                EventSystem.EventDelegate arg1 = null;
                LuaTypes funcType3             = LuaDLL.lua_type(L, 3);

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

                bool o = obj.AddEventListener(arg0, arg1);
                LuaDLL.lua_pushboolean(L, o);
                return(1);
            }
            else if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(EventSystem.EventDispatcher), typeof(string), typeof(EventSystem.EventDelegate), typeof(EventSystem.EventDispatcherAddMode)))
            {
                EventSystem.EventDispatcher obj = (EventSystem.EventDispatcher)ToLua.ToObject(L, 1);
                string arg0 = ToLua.ToString(L, 2);
                EventSystem.EventDelegate arg1 = null;
                LuaTypes funcType3             = LuaDLL.lua_type(L, 3);

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

                EventSystem.EventDispatcherAddMode arg2 = (EventSystem.EventDispatcherAddMode)ToLua.ToObject(L, 4);
                bool o = obj.AddEventListener(arg0, arg1, arg2);
                LuaDLL.lua_pushboolean(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: EventSystem.EventDispatcher.AddEventListener"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
 public static bool HasListener <T>(EventSystem.EventDelegate <T> del) where T : IEvent
 {
     return(_eventSystem.HasListener(del));
 }
 public static void RemoveListener <T>(EventSystem.EventDelegate <T> del) where T : IEvent
 {
     _eventSystem.RemoveListener(del);
 }