336 lines
13 KiB
C#
336 lines
13 KiB
C#
#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 EventDelegateParameterWrap
|
|
{
|
|
public static void __Register(RealStatePtr L)
|
|
{
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
System.Type type = typeof(EventDelegate.Parameter);
|
|
Utils.BeginObjectRegister(type, L, translator, 0, 0, 8, 7);
|
|
|
|
|
|
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "value", _g_get_value);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "type", _g_get_type);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "obj", _g_get_obj);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "field", _g_get_field);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "expectedType", _g_get_expectedType);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "cached", _g_get_cached);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "propInfo", _g_get_propInfo);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "fieldInfo", _g_get_fieldInfo);
|
|
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "value", _s_set_value);
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "obj", _s_set_obj);
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "field", _s_set_field);
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "expectedType", _s_set_expectedType);
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "cached", _s_set_cached);
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "propInfo", _s_set_propInfo);
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "fieldInfo", _s_set_fieldInfo);
|
|
|
|
|
|
Utils.EndObjectRegister(type, L, translator, null, null,
|
|
null, null, null);
|
|
|
|
Utils.BeginClassRegister(type, L, __CreateInstance, 1, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.Parameter gen_ret = new EventDelegate.Parameter();
|
|
translator.Push(L, gen_ret);
|
|
|
|
return 1;
|
|
}
|
|
if(LuaAPI.lua_gettop(L) == 3 && translator.Assignable<UnityEngine.Object>(L, 2) && (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING))
|
|
{
|
|
UnityEngine.Object _obj = (UnityEngine.Object)translator.GetObject(L, 2, typeof(UnityEngine.Object));
|
|
string _field = LuaAPI.lua_tostring(L, 3);
|
|
|
|
EventDelegate.Parameter gen_ret = new EventDelegate.Parameter(_obj, _field);
|
|
translator.Push(L, gen_ret);
|
|
|
|
return 1;
|
|
}
|
|
if(LuaAPI.lua_gettop(L) == 2 && translator.Assignable<object>(L, 2))
|
|
{
|
|
object _val = translator.GetObject(L, 2, typeof(object));
|
|
|
|
EventDelegate.Parameter gen_ret = new EventDelegate.Parameter(_val);
|
|
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.Parameter constructor!");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_value(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
EventDelegate.Parameter gen_to_be_invoked = (EventDelegate.Parameter)translator.FastGetCSObj(L, 1);
|
|
translator.PushAny(L, gen_to_be_invoked.value);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_type(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
EventDelegate.Parameter gen_to_be_invoked = (EventDelegate.Parameter)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.type);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_obj(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
EventDelegate.Parameter gen_to_be_invoked = (EventDelegate.Parameter)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.obj);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_field(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
EventDelegate.Parameter gen_to_be_invoked = (EventDelegate.Parameter)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.lua_pushstring(L, gen_to_be_invoked.field);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_expectedType(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
EventDelegate.Parameter gen_to_be_invoked = (EventDelegate.Parameter)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.expectedType);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_cached(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
EventDelegate.Parameter gen_to_be_invoked = (EventDelegate.Parameter)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.lua_pushboolean(L, gen_to_be_invoked.cached);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_propInfo(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
EventDelegate.Parameter gen_to_be_invoked = (EventDelegate.Parameter)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.propInfo);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_fieldInfo(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
EventDelegate.Parameter gen_to_be_invoked = (EventDelegate.Parameter)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.fieldInfo);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _s_set_value(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
EventDelegate.Parameter gen_to_be_invoked = (EventDelegate.Parameter)translator.FastGetCSObj(L, 1);
|
|
gen_to_be_invoked.value = translator.GetObject(L, 2, typeof(object));
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _s_set_obj(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
EventDelegate.Parameter gen_to_be_invoked = (EventDelegate.Parameter)translator.FastGetCSObj(L, 1);
|
|
gen_to_be_invoked.obj = (UnityEngine.Object)translator.GetObject(L, 2, typeof(UnityEngine.Object));
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _s_set_field(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
EventDelegate.Parameter gen_to_be_invoked = (EventDelegate.Parameter)translator.FastGetCSObj(L, 1);
|
|
gen_to_be_invoked.field = 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_expectedType(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
EventDelegate.Parameter gen_to_be_invoked = (EventDelegate.Parameter)translator.FastGetCSObj(L, 1);
|
|
gen_to_be_invoked.expectedType = (System.Type)translator.GetObject(L, 2, typeof(System.Type));
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _s_set_cached(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
EventDelegate.Parameter gen_to_be_invoked = (EventDelegate.Parameter)translator.FastGetCSObj(L, 1);
|
|
gen_to_be_invoked.cached = LuaAPI.lua_toboolean(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_propInfo(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
EventDelegate.Parameter gen_to_be_invoked = (EventDelegate.Parameter)translator.FastGetCSObj(L, 1);
|
|
gen_to_be_invoked.propInfo = (System.Reflection.PropertyInfo)translator.GetObject(L, 2, typeof(System.Reflection.PropertyInfo));
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _s_set_fieldInfo(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
EventDelegate.Parameter gen_to_be_invoked = (EventDelegate.Parameter)translator.FastGetCSObj(L, 1);
|
|
gen_to_be_invoked.fieldInfo = (System.Reflection.FieldInfo)translator.GetObject(L, 2, typeof(System.Reflection.FieldInfo));
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|