static int UF_set_ui(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); bool ret = false; IUIUpdateGroup target = (IUIUpdateGroup)ToLua.CheckObject(L, 1, typeof(IUIUpdateGroup)); if (target != null) { string key = LuaDLL.lua_tostring(L, 2); IUIUpdate ui = target.UF_GetUI(key); if (ui != null) { ret = true; //判断是否真实是bool 值,去除nil if (LuaDLL.lua_isrboolean(L, 3)) { bool active = LuaDLL.lua_toboolean(L, 3); ui.UF_SetActive(active); } else { object value = ToLua.ToVarObject(L, 3); ui.UF_SetValue(value); } } } LuaDLL.lua_pushboolean(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int UF_get_ui(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); IUIUpdateGroup target = (IUIUpdateGroup)ToLua.CheckObject(L, 1, typeof(IUIUpdateGroup)); if (target != null) { string key = ToLua.CheckString(L, 2); //更新键不能与原对象成员变量重名,否则会被覆盖 ToLua.Push(L, target.UF_GetUI(key)); } else { LuaDLL.lua_pushnil(L); } return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }