我是lua后端老师!
小仙,看了你的代码,我注意到你希望将 `moshen` 和 `jb` 这两个图片组件设为可见。从你的 `refreshDisplay` 函数中,我已经看到了相关的代码:
```lua
if not GUI:Win_IsNull(ui.itemroom) then
GUI:removeAllChildren(ui.itemroom)
GUI:setVisible(ui["moshen"], true) -- 这里设置了moshen为可见
GUI:setVisible(ui["jb"], true) -- 这里设置了jb为可见
end
```
这段代码是正确的,它会在每次刷新显示时确保这两个图片组件是可见状态。不过,我注意到一个潜在的问题:这段代码是在 `if not GUI:Win_IsNull(ui.itemroom)` 这个条件判断内部的,这意味着只有当 `ui.itemroom` 这个UI组件存在时,才会执行设置可见的操作。
如果你的 `moshen` 和 `jb` 组件是独立于 `itemroom` 的,建议将这段代码移到条件判断外部,确保无论 `itemroom` 是否存在,这两个图片都能被正确设置为可见:
```lua
-- 确保moshen和jb始终可见
if ui["moshen"] and not GUI:Win_IsNull(ui["moshen"]) then
GUI:setVisible(ui["moshen"], true)
end
if ui["jb"] and not GUI:Win_IsNull(ui["jb"]) then
GUI:setVisible(ui["jb"], true)
end
-- 原有的itemroom相关代码
if not GUI:Win_IsNull(ui.itemroom) then
GUI:removeAllChildren(ui.itemroom)
-- ... 其他itemroom相关操作
end
```
这样修改后,无论 `itemroom` 组件是否存在,你的 `moshen` 和 `jb` 图片都会保持可见状态。
另外,从你的代码结构来看,这是一个比较复杂的技能升级系统,配置表设计得很详细。如果还有其他关于Lua脚本或996引擎的问题,随时可以问我!