function fentian.upmain()
if not fentian.parent or not fentian.parent._ui then
return
end
local ui = fentian.parent._ui
local cfg = fentian.parent.cfg
if not cfg then
return
end
local var = tonum
🤖 回答引擎: 前端Lua |
🕒 时间: 2026-04-09 13:25:25 |
👁️ 阅读: 0
从代码分析来看,你的Text_1显示的是`next_cfg.cur_attr_5`的值,但配置表中`cur_attr_5`对应的是"攻击速度+"属性。
从你提供的配置表可以看到:
- 等级18的配置中 `cur_attr_5 = 10`,所以Text_1应该显示"攻击速度+10"
- 其他属性如cur_attr_4对应攻击力,cur_attr_8对应生命值等
检查一下你的代码逻辑:
```lua
if not GUI:Win_IsNull(ui.Text_1) then
GUI:Text_setString(ui.Text_1, "攻击速度+" .. (next_cfg.cur_attr_5 or 0))
end
```
如果Text_1显示的是18而不是10,可能有几个原因:
1. **变量名混淆**:可能你的`next_level`变量是18,但误用了`next_level`而不是`next_cfg.cur_attr_5`
2. **配置表结构问题**:确保你的`cfg`变量正确加载了这个配置表
3. **打印调试**:可以在设置前打印一下值确认
建议添加调试信息:
```lua
SL:Print("next_level =", next_level)
SL:Print("next_cfg.cur_attr_5 =", next_cfg.cur_attr_5)
```
这样就能清楚看到是哪个值出了问题。如果`next_cfg.cur_attr_5`确实是10但显示18,那可能是其他地方修改了Text_1的内容。
从代码分析来看,你的Text_1显示的是`next_cfg.cur_attr_5`的值,但配置表中`cur_attr_5`对应的是"攻击速度+"属性。
从你提供的配置表可以看到:
- 等级18的配置中 `cur_attr_5 = 10`,所以Text_1应该显示"攻击速度+10"
- 其他属性如cur_attr_4对应攻击力,cur_attr_8对应生命值等
检查一下你的代码逻辑:
```lua
if not GUI:Win_IsNull(ui.Text_1) then
GUI:Text_setString(ui.Text_1, "攻击速度+" .. (next_cfg.cur_attr_5 or 0))
end
```
如果Text_1显示的是18而不是10,可能有几个原因:
1. **变量名混淆**:可能你的`next_level`变量是18,但误用了`next_level`而不是`next_cfg.cur_attr_5`
2. **配置表结构问题**:确保你的`cfg`变量正确加载了这个配置表
3. **打印调试**:可以在设置前打印一下值确认
建议添加调试信息:
```lua
SL:Print("next_level =", next_level)
SL:Print("next_cfg.cur_attr_5 =", next_cfg.cur_attr_5)
```
这样就能清楚看到是哪个值出了问题。如果`next_cfg.cur_attr_5`确实是10但显示18,那可能是其他地方修改了Text_1的内容。
← 返回问答库