#if USE_UNI_LUA using LuaAPI = UniLua.Lua; using RealStatePtr = UniLua.ILuaState; using LuaCSFunction = UniLua.CSharpFunctionDelegate; #else using LuaAPI = XLua.LuaDLL.Lua; using RealStatePtr = System.IntPtr; using LuaCSFunction = XLua.LuaDLL.lua_CSFunction; #endif using XLua; using System.Collections.Generic; namespace XLua.CSObjectWrap { using Utils = XLua.Utils; public class EventDelegateWrap { public static void __Register(RealStatePtr L) { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); System.Type type = typeof(EventDelegate); Utils.BeginObjectRegister(type, L, translator, 0, 6, 6, 3); Utils.RegisterFunc(L, Utils.METHOD_IDX, "Equals", _m_Equals); Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetHashCode", _m_GetHashCode); Utils.RegisterFunc(L, Utils.METHOD_IDX, "Set", _m_Set); Utils.RegisterFunc(L, Utils.METHOD_IDX, "Execute", _m_Execute); Utils.RegisterFunc(L, Utils.METHOD_IDX, "Clear", _m_Clear); Utils.RegisterFunc(L, Utils.METHOD_IDX, "ToString", _m_ToString); Utils.RegisterFunc(L, Utils.GETTER_IDX, "target", _g_get_target); Utils.RegisterFunc(L, Utils.GETTER_IDX, "methodName", _g_get_methodName); Utils.RegisterFunc(L, Utils.GETTER_IDX, "parameters", _g_get_parameters); Utils.RegisterFunc(L, Utils.GETTER_IDX, "isValid", _g_get_isValid); Utils.RegisterFunc(L, Utils.GETTER_IDX, "isEnabled", _g_get_isEnabled); Utils.RegisterFunc(L, Utils.GETTER_IDX, "oneShot", _g_get_oneShot); Utils.RegisterFunc(L, Utils.SETTER_IDX, "target", _s_set_target); Utils.RegisterFunc(L, Utils.SETTER_IDX, "methodName", _s_set_methodName); Utils.RegisterFunc(L, Utils.SETTER_IDX, "oneShot", _s_set_oneShot); Utils.EndObjectRegister(type, L, translator, null, null, null, null, null); Utils.BeginClassRegister(type, L, __CreateInstance, 6, 0, 0); Utils.RegisterFunc(L, Utils.CLS_IDX, "Execute", _m_Execute_xlua_st_); Utils.RegisterFunc(L, Utils.CLS_IDX, "IsValid", _m_IsValid_xlua_st_); Utils.RegisterFunc(L, Utils.CLS_IDX, "Set", _m_Set_xlua_st_); Utils.RegisterFunc(L, Utils.CLS_IDX, "Add", _m_Add_xlua_st_); Utils.RegisterFunc(L, Utils.CLS_IDX, "Remove", _m_Remove_xlua_st_); Utils.EndClassRegister(type, L, translator); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int __CreateInstance(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); if(LuaAPI.lua_gettop(L) == 1) { EventDelegate gen_ret = new EventDelegate(); translator.Push(L, gen_ret); return 1; } if(LuaAPI.lua_gettop(L) == 2 && translator.Assignable(L, 2)) { EventDelegate.Callback _call = translator.GetDelegate(L, 2); EventDelegate gen_ret = new EventDelegate(_call); translator.Push(L, gen_ret); return 1; } if(LuaAPI.lua_gettop(L) == 3 && translator.Assignable(L, 2) && (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING)) { UnityEngine.MonoBehaviour _target = (UnityEngine.MonoBehaviour)translator.GetObject(L, 2, typeof(UnityEngine.MonoBehaviour)); string _methodName = LuaAPI.lua_tostring(L, 3); EventDelegate gen_ret = new EventDelegate(_target, _methodName); translator.Push(L, gen_ret); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return LuaAPI.luaL_error(L, "invalid arguments to EventDelegate constructor!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Equals(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); EventDelegate gen_to_be_invoked = (EventDelegate)translator.FastGetCSObj(L, 1); { object _obj = translator.GetObject(L, 2, typeof(object)); bool gen_ret = gen_to_be_invoked.Equals( _obj ); LuaAPI.lua_pushboolean(L, gen_ret); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_GetHashCode(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); EventDelegate gen_to_be_invoked = (EventDelegate)translator.FastGetCSObj(L, 1); { int gen_ret = gen_to_be_invoked.GetHashCode( ); LuaAPI.xlua_pushinteger(L, gen_ret); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Set(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); EventDelegate gen_to_be_invoked = (EventDelegate)translator.FastGetCSObj(L, 1); { UnityEngine.MonoBehaviour _target = (UnityEngine.MonoBehaviour)translator.GetObject(L, 2, typeof(UnityEngine.MonoBehaviour)); string _methodName = LuaAPI.lua_tostring(L, 3); gen_to_be_invoked.Set( _target, _methodName ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Execute(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); EventDelegate gen_to_be_invoked = (EventDelegate)translator.FastGetCSObj(L, 1); { bool gen_ret = gen_to_be_invoked.Execute( ); LuaAPI.lua_pushboolean(L, gen_ret); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Clear(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); EventDelegate gen_to_be_invoked = (EventDelegate)translator.FastGetCSObj(L, 1); { gen_to_be_invoked.Clear( ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_ToString(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); EventDelegate gen_to_be_invoked = (EventDelegate)translator.FastGetCSObj(L, 1); { string gen_ret = gen_to_be_invoked.ToString( ); LuaAPI.lua_pushstring(L, gen_ret); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Execute_xlua_st_(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); { System.Collections.Generic.List _list = (System.Collections.Generic.List)translator.GetObject(L, 1, typeof(System.Collections.Generic.List)); EventDelegate.Execute( _list ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_IsValid_xlua_st_(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); { System.Collections.Generic.List _list = (System.Collections.Generic.List)translator.GetObject(L, 1, typeof(System.Collections.Generic.List)); bool gen_ret = EventDelegate.IsValid( _list ); LuaAPI.lua_pushboolean(L, gen_ret); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Set_xlua_st_(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); int gen_param_count = LuaAPI.lua_gettop(L); if(gen_param_count == 2&& translator.Assignable>(L, 1)&& translator.Assignable(L, 2)) { System.Collections.Generic.List _list = (System.Collections.Generic.List)translator.GetObject(L, 1, typeof(System.Collections.Generic.List)); EventDelegate.Callback _callback = translator.GetDelegate(L, 2); EventDelegate gen_ret = EventDelegate.Set( _list, _callback ); translator.Push(L, gen_ret); return 1; } if(gen_param_count == 2&& translator.Assignable>(L, 1)&& translator.Assignable(L, 2)) { System.Collections.Generic.List _list = (System.Collections.Generic.List)translator.GetObject(L, 1, typeof(System.Collections.Generic.List)); EventDelegate _del = (EventDelegate)translator.GetObject(L, 2, typeof(EventDelegate)); EventDelegate.Set( _list, _del ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return LuaAPI.luaL_error(L, "invalid arguments to EventDelegate.Set!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Add_xlua_st_(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); int gen_param_count = LuaAPI.lua_gettop(L); if(gen_param_count == 2&& translator.Assignable>(L, 1)&& translator.Assignable(L, 2)) { System.Collections.Generic.List _list = (System.Collections.Generic.List)translator.GetObject(L, 1, typeof(System.Collections.Generic.List)); EventDelegate.Callback _callback = translator.GetDelegate(L, 2); EventDelegate gen_ret = EventDelegate.Add( _list, _callback ); translator.Push(L, gen_ret); return 1; } if(gen_param_count == 2&& translator.Assignable>(L, 1)&& translator.Assignable(L, 2)) { System.Collections.Generic.List _list = (System.Collections.Generic.List)translator.GetObject(L, 1, typeof(System.Collections.Generic.List)); EventDelegate _ev = (EventDelegate)translator.GetObject(L, 2, typeof(EventDelegate)); EventDelegate.Add( _list, _ev ); return 0; } if(gen_param_count == 3&& translator.Assignable>(L, 1)&& translator.Assignable(L, 2)&& LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 3)) { System.Collections.Generic.List _list = (System.Collections.Generic.List)translator.GetObject(L, 1, typeof(System.Collections.Generic.List)); EventDelegate.Callback _callback = translator.GetDelegate(L, 2); bool _oneShot = LuaAPI.lua_toboolean(L, 3); EventDelegate gen_ret = EventDelegate.Add( _list, _callback, _oneShot ); translator.Push(L, gen_ret); return 1; } if(gen_param_count == 3&& translator.Assignable>(L, 1)&& translator.Assignable(L, 2)&& LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 3)) { System.Collections.Generic.List _list = (System.Collections.Generic.List)translator.GetObject(L, 1, typeof(System.Collections.Generic.List)); EventDelegate _ev = (EventDelegate)translator.GetObject(L, 2, typeof(EventDelegate)); bool _oneShot = LuaAPI.lua_toboolean(L, 3); EventDelegate.Add( _list, _ev, _oneShot ); return 0; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return LuaAPI.luaL_error(L, "invalid arguments to EventDelegate.Add!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _m_Remove_xlua_st_(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); int gen_param_count = LuaAPI.lua_gettop(L); if(gen_param_count == 2&& translator.Assignable>(L, 1)&& translator.Assignable(L, 2)) { System.Collections.Generic.List _list = (System.Collections.Generic.List)translator.GetObject(L, 1, typeof(System.Collections.Generic.List)); EventDelegate.Callback _callback = translator.GetDelegate(L, 2); bool gen_ret = EventDelegate.Remove( _list, _callback ); LuaAPI.lua_pushboolean(L, gen_ret); return 1; } if(gen_param_count == 2&& translator.Assignable>(L, 1)&& translator.Assignable(L, 2)) { System.Collections.Generic.List _list = (System.Collections.Generic.List)translator.GetObject(L, 1, typeof(System.Collections.Generic.List)); EventDelegate _ev = (EventDelegate)translator.GetObject(L, 2, typeof(EventDelegate)); bool gen_ret = EventDelegate.Remove( _list, _ev ); LuaAPI.lua_pushboolean(L, gen_ret); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return LuaAPI.luaL_error(L, "invalid arguments to EventDelegate.Remove!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_target(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); EventDelegate gen_to_be_invoked = (EventDelegate)translator.FastGetCSObj(L, 1); translator.Push(L, gen_to_be_invoked.target); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_methodName(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); EventDelegate gen_to_be_invoked = (EventDelegate)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushstring(L, gen_to_be_invoked.methodName); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_parameters(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); EventDelegate gen_to_be_invoked = (EventDelegate)translator.FastGetCSObj(L, 1); translator.Push(L, gen_to_be_invoked.parameters); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_isValid(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); EventDelegate gen_to_be_invoked = (EventDelegate)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.isValid); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_isEnabled(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); EventDelegate gen_to_be_invoked = (EventDelegate)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.isEnabled); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_oneShot(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); EventDelegate gen_to_be_invoked = (EventDelegate)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.oneShot); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_target(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); EventDelegate gen_to_be_invoked = (EventDelegate)translator.FastGetCSObj(L, 1); gen_to_be_invoked.target = (UnityEngine.MonoBehaviour)translator.GetObject(L, 2, typeof(UnityEngine.MonoBehaviour)); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_methodName(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); EventDelegate gen_to_be_invoked = (EventDelegate)translator.FastGetCSObj(L, 1); gen_to_be_invoked.methodName = LuaAPI.lua_tostring(L, 2); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_oneShot(RealStatePtr L) { try { ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L); EventDelegate gen_to_be_invoked = (EventDelegate)translator.FastGetCSObj(L, 1); gen_to_be_invoked.oneShot = LuaAPI.lua_toboolean(L, 2); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } } }