local zhuansheng = {}
function zhuansheng.main(param1, param2, param3, param4)
SL:print("===== 转生界面打开 =====")
lib:Require(param1, function(state)
if state then
if param1 then
zhuansheng.parent = lib:o
根据浮生梦老师前端课程内容,你需要修改 `update_effect_icons` 函数来处理 Image_9 到 Image_13 的显示逻辑。以下是完整的修改代码:
```lua
-- 显示特效图标
local function update_effect_icons()
local ui = zhuansheng.parent._ui
-- 获取当前转生等级
local curLevel = SL:GetMetaValue("RELEVEL") or 0
-- 先隐藏所有Image控件
for i = 9, 13 do
local objectName = "Image_" .. i
if GUI:Win_IsNotNull(ui[objectName]) then
GUI:setVisible(ui[objectName], false)
end
end
-- 根据转生等级显示对应的Image控件
if curLevel >= 1 then
if GUI:Win_IsNotNull(ui["Image_9"]) then
GUI:setVisible(ui["Image_9"], true)
end
end
if curLevel >= 2 then
if GUI:Win_IsNotNull(ui["Image_10"]) then
GUI:setVisible(ui["Image_10"], true)
end
end
if curLevel >= 3 then
if GUI:Win_IsNotNull(ui["Image_11"]) then
GUI:setVisible(ui["Image_11"], true)
end
end
if curLevel >= 4 then
if GUI:Win_IsNotNull(ui["Image_12"]) then
GUI:setVisible(ui["Image_12"], true)
end
end
if curLevel >= 5 then
if GUI:Win_IsNotNull(ui["Image_13"]) then
GUI:setVisible(ui["Image_13"], true)
end
end
end
```
这个修改会:
1. 先隐藏所有 Image_9 到 Image_13 控件
2. 根据当前转生等级依次显示对应的控件
3. 转生等级1:只显示 Image_9
4. 转生等级2:显示 Image_9 和 Image_10
5. 转生等级3:显示 Image_9、Image_10、Image_11
6. 转生等级4:显示 Image_9、Image_10、Image_11、Image_12
7. 转生等级5:全部显示(Image_9 到 Image_13)
记得在 `zhuansheng.upmain()` 函数中调用这个更新函数,这样每次界面刷新时都会正确显示对应的图片控件。