function lib:createitemlist(winid, data, interval, hide_bg, has_eff, default_color, dataitem, has_opc_parent, effectid,
item_bg_path, not_scale, omit_val, count_color)
local check = winid and type(data) == "table" and true or false
local
```lua
function lib:createitemlist(winid, data, interval, hide_bg, has_eff, default_color, dataitem, has_opc_parent, effectid,
item_bg_path, not_scale, omit_val, count_color)
local check = winid and type(data) == "table" and true or false
local item_bg = {}
if not check then
return item_bg
end
local has_dataitem = dataitem
GUI:removeAllChildren(winid)
local item_data = {}
local item_count = data.count or 0
local iswin32 = SL:GetMetaValue("WINPLAYMODE")
if item_count > 0 then
for i = 1, item_count do
if data["type" .. i] == "货币" or data["type" .. i] == "双货币" or data["type" .. i] == "物品"
or data["type" .. i] == "称号" or data["type" .. i] == "称号2" then
local cfg = {}
cfg.type = data["type" .. i]
cfg.name = data["name" .. i]
cfg.value = data["value" .. i]
cfg.takename = data["takename" .. i]
cfg.bg_eff = data["bg_eff" .. i]
table.insert(item_data, cfg)
end
end
end
for i, v in ipairs(item_data) do
if data.count and data.count == 1 and dataitem then
dataitem = dataitem
else
dataitem = SL:GetMetaValue("ITEM_DATA", lib:getitemidx(v.name))
end
local path = ConstCfg.pc_item_bg_path
if item_bg_path then
path = item_bg_path
end
item_bg = GUI:Image_Create(winid, "item_bg" .. i, 0.00, 0.00, path)
GUI:Win_SetParam(item_bg, i)
GUI:setTouchEnabled(item_bg, true)
GUI:setTag(item_bg, i)
-- 光圈特效
if v.bg_eff then
local bg_eff_str = v.bg_eff[1]
if pc_client then
bg_eff_str = v.bg_eff[2]
end
local bg_eff_cfg = lib:split_str(bg_eff_str, "#")
if bg_eff_cfg and next(bg_eff_cfg) then
local item_gq_eff = GUI:Effect_Create(item_bg, "item_gq_eff" .. i, bg_eff_cfg[2] or 0, bg_eff_cfg[3] or 0,
0, bg_eff_cfg[1] or 15132, 0, 0, 0, 1)
GUI:setScale(item_gq_eff, bg_eff_cfg[4] or 1)
end
elseif has_eff then
local wp_Eff = GUI:Effect_Create(item_bg, "item_eff" .. i, 25.00, 26.00, 0, effectid or 15132, 0, 0, 0, 1)
if not iswin32 and not not_scale then
GUI:setScale(wp_Eff, 1.1)
GUI:setPosition(wp_Eff, 30, 30)
end
end
local item_bg_size = GUI:getContentSize(item_bg)
local item_show = GUI:ItemShow_Create(item_bg, "item_show", item_bg_size.width / 2, item_bg_size.height / 2,
{
index = dataitem.Index,
look = true,
bgVisible = false,
count = 0,
itemData = dataitem,
})
GUI:setAnchorPoint(item_show, 0.5, 0.5)
-- ==============================================
-- 【核心】材料数字动画:老数字渐隐 + 新数字快显
-- ==============================================
if v.value and v.value >= 1 and not has_dataitem then
local curbagcount = SL:GetMetaValue("ITEM_COUNT", v.name)
if v.type == "称号" then
curbagcount = lib:check_title(v.name) and v.value or 0
end
if v.type == "称号2" then
curbagcount = lib:check_title(v.takename) and v.value or 0
end
if v.type == "双货币" then
curbagcount = tonumber(SL:GetMetaValue("MONEY_ASSOCIATED", lib:getitemidx(v.name)))
end
local val = (omit_val and v.value <= 1) and "" or "x" .. lib:getFormatNumStr(v.value)
local color = curbagcount >= v.value and "#00ff00" or "#FF0000"
-- 创建数量文字
local Text_xiaohao = GUI:Text_Create(item_bg, "Text_xiaohao", item_bg_size.width - 4, 10.00, 14, color, val)
GUI:setTouchEnabled(Text_xiaohao, false)
GUI:setTag(Text_xiaohao, -1)
GUI:setAnchorPoint(Text_xiaohao, 1, 0.5)
-- === 动画核心:老数字隐去 + 新数字弹出 ===
GUI:setOpacity(Text_xiaohao, 0) -- 先隐藏
GUI:setScale(Text_xiaohao, 0.8) -- 先缩小
GUI:runAction(Text_xiaohao, GUI:ActionSequence(
GUI:DelayTime(0.05), -- 极短延迟(跟升级同步)
GUI:ActionSpawn( -- 同时执行
GUI:ActionFadeTo(0.15, 255), -- 快速淡入
GUI:ActionScaleTo(0.15, 1.15), -- 快速放大回弹
GUI:ActionScaleTo(0.1, 1)
)
))
if default_color then
GUI:Text_setTextColor(Text_xiaohao, "#ffffff")
end
if count_color then
if type(count_color) == "number" then
count_color = SL:GetHexColorByStyleId(count_color)
end
GUI:Text_setTextColor(Text_xiaohao, count_color)
end
end
if hide_bg and not has_opc_parent then
GUI:setOpacity(item_bg, 0)
end
if has_opc_parent then
GUI:setCascadeOpacityEnabled(item_bg, true)
end
end
-- 布局只执行一次,不闪烁
if GUI:getDescription(winid) == "Layout" then
if not winid.layout_inited then
local layout = {}
layout.dir = 2
layout.addDir = 2
layout.gap = { x = interval or 20 }
layout.sortfunc = function(lists)
table.sort(lists, function(a, b)
return GUI:getTag(a) > GUI:getTag(b)
end)
end
if not hide_bg then layout.interval = 1 end
GUI:UserUILayout(winid, layout)
winid.layout_inited = true
end
end
end
```
**修改说明:**
1. **第78行**:将不存在的 `GUI:ActionDelayTime(0.05)` 修改为 `GUI:DelayTime(0.05)`
- 根据浮生梦老师前端课程内容,`GUI:DelayTime(time)` 是正确的延迟动作函数
- 参数:`time` - 延迟时间(秒)
**其他注意事项:**
- `GUI:ActionSequence()` 用于顺序执行多个动作,参数是动作对象
- `GUI:ActionSpawn()` 用于同时执行多个动作
- `GUI:ActionFadeTo(time, opacity)` 用于淡入淡出动画
- `GUI:ActionScaleTo(time, scale)` 用于缩放动画
如果还有不理解的函数用法,可以继续提问!