static int set_onLinkClick(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); YlyRichText obj = (YlyRichText)o; YlyDelegateUtil.StringDelegate arg0 = null; LuaTypes funcType2 = LuaDLL.lua_type(L, 2); if (funcType2 != LuaTypes.LUA_TFUNCTION) { arg0 = (YlyDelegateUtil.StringDelegate)ToLua.CheckObject(L, 2, typeof(YlyDelegateUtil.StringDelegate)); } else { LuaFunction func = ToLua.ToLuaFunction(L, 2); arg0 = DelegateFactory.CreateDelegate(typeof(YlyDelegateUtil.StringDelegate), func) as YlyDelegateUtil.StringDelegate; } obj.onLinkClick = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index onLinkClick on a nil value" : e.Message)); } }
/// <summary> /// the function can use for ylyRichText hyperLink's click callBack function for lua, but need tolua support, /// here will not introduce tolua, if your project has tolua plugin, remove the comments, and then export the wrap file /// 下面的函数可以用作yly富文本组件超链接在lua那边的点击回调函数,不过需要tolua插件的支持, /// 这里就不引入tolua了,有tolua插件的项目,把注释去掉,然后导出wrap文件即可 /// </summary> /// <returns>The delegate.</returns> /// <param name="func">Func.</param> public static YlyDelegateUtil.StringDelegate stringDelegate(LuaFunction func) { YlyDelegateUtil.StringDelegate action = (arg) => { func.Call(arg); }; return(action); }
static int stringDelegate(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); LuaFunction arg0 = ToLua.CheckLuaFunction(L, 1); YlyDelegateUtil.StringDelegate o = YlyDelegateUtil.stringDelegate(arg0); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int get_onLinkClick(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); YlyRichText obj = (YlyRichText)o; YlyDelegateUtil.StringDelegate ret = obj.onLinkClick; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index onLinkClick on a nil value" : e.Message)); } }
public static Delegate YlyDelegateUtil_StringDelegate(LuaFunction func, LuaTable self, bool flag) { if (func == null) { YlyDelegateUtil.StringDelegate fn = delegate(string param0) { }; return(fn); } if (!flag) { YlyDelegateUtil_StringDelegate_Event target = new YlyDelegateUtil_StringDelegate_Event(func); YlyDelegateUtil.StringDelegate d = target.Call; target.method = d.Method; return(d); } else { YlyDelegateUtil_StringDelegate_Event target = new YlyDelegateUtil_StringDelegate_Event(func, self); YlyDelegateUtil.StringDelegate d = target.CallWithSelf; target.method = d.Method; return(d); } }