static int OnIOEventHandle(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); LuaFunction arg0 = LuaScriptMgr.GetLuaFunction(L, 1); UtilCommon.OnIOEventHandle o = LuaHelper.OnIOEventHandle(arg0); LuaScriptMgr.Push(L, o); return(1); }
/// <summary> /// /// </summary> /// <param name="_type"></param> /// <param name="_handle"></param> public void RegesterListener(EnumIOEvent _type, UtilCommon.OnIOEventHandle _handle, string _guid) { if (!m_eventDict.ContainsKey(_type)) { m_eventDict.Add(_type, new Dictionary <string, UtilCommon.OnIOEventHandle>()); } if (!HasRegestered(_type, _guid)) { m_eventDict[_type].Add(_guid, _handle); } }
public static Delegate UtilCommon_OnIOEventHandle(LuaFunction func) { UtilCommon.OnIOEventHandle d = (param0, param1) => { int top = func.BeginPCall(); IntPtr L = func.GetLuaState(); LuaScriptMgr.Push(L, param0); LuaScriptMgr.Push(L, param1); func.PCall(top, 2); func.EndPCall(top); }; return(d); }
/// <summary> /// /// </summary> /// <param name="_type"></param> /// <param name="_playerID"></param> /// <param name="_value"></param> public void TriggerListener(EnumIOEvent _type, int _playerID = 0, bool _flag = true) { if (null == m_eventDict || !m_eventDict.ContainsKey(_type)) { return; } Dictionary <string, UtilCommon.OnIOEventHandle> dict = m_eventDict[_type]; List <UtilCommon.OnIOEventHandle> list = new List <UtilCommon.OnIOEventHandle>(dict.Values); for (int i = 0; i < dict.Count; ++i) { UtilCommon.OnIOEventHandle handle = list[i]; if (null != handle) { handle(_playerID, _flag); } } }
/// <summary> /// /// </summary> /// <param name="_num"></param> /// <param name="_handle"></param> public void RegesterListener(int _num, UtilCommon.OnIOEventHandle _handle, string _guid) { EnumIOEvent _type = (EnumIOEvent)_num; RegesterListener(_type, _handle, _guid); }
static int RegesterListener(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 4 && LuaScriptMgr.CheckTypes(L, 1, typeof(IOLuaHelper), typeof(int), typeof(UtilCommon.OnIOEventHandle), typeof(string))) { IOLuaHelper obj = (IOLuaHelper)LuaScriptMgr.GetNetObjectSelf(L, 1, "IOLuaHelper"); int arg0 = (int)LuaDLL.lua_tonumber(L, 2); UtilCommon.OnIOEventHandle arg1 = null; LuaTypes funcType3 = LuaDLL.lua_type(L, 3); if (funcType3 != LuaTypes.LUA_TFUNCTION) { arg1 = (UtilCommon.OnIOEventHandle)LuaScriptMgr.GetLuaObject(L, 3); } else { LuaFunction func = LuaScriptMgr.GetLuaFunction(L, 3); arg1 = (param0, param1) => { int top = func.BeginPCall(); LuaScriptMgr.Push(L, param0); LuaScriptMgr.Push(L, param1); func.PCall(top, 2); func.EndPCall(top); }; } string arg2 = LuaScriptMgr.GetString(L, 4); obj.RegesterListener(arg0, arg1, arg2); return(0); } else if (count == 4 && LuaScriptMgr.CheckTypes(L, 1, typeof(IOLuaHelper), typeof(EnumIOEvent), typeof(UtilCommon.OnIOEventHandle), typeof(string))) { IOLuaHelper obj = (IOLuaHelper)LuaScriptMgr.GetNetObjectSelf(L, 1, "IOLuaHelper"); EnumIOEvent arg0 = (EnumIOEvent)LuaScriptMgr.GetLuaObject(L, 2); UtilCommon.OnIOEventHandle arg1 = null; LuaTypes funcType3 = LuaDLL.lua_type(L, 3); if (funcType3 != LuaTypes.LUA_TFUNCTION) { arg1 = (UtilCommon.OnIOEventHandle)LuaScriptMgr.GetLuaObject(L, 3); } else { LuaFunction func = LuaScriptMgr.GetLuaFunction(L, 3); arg1 = (param0, param1) => { int top = func.BeginPCall(); LuaScriptMgr.Push(L, param0); LuaScriptMgr.Push(L, param1); func.PCall(top, 2); func.EndPCall(top); }; } string arg2 = LuaScriptMgr.GetString(L, 4); obj.RegesterListener(arg0, arg1, arg2); return(0); } else { LuaDLL.luaL_error(L, "invalid arguments to method: IOLuaHelper.RegesterListener"); } return(0); }