-- =================================================定档 转盘
local function zhuanpan(msgID, msgData)
local screenWidth = SL:GetMetaValue("SCREEN_WIDTH", 0)
local screenHeight = SL:GetMetaValue("SCREEN_HEIGHT", 0)
local parent = GUI:Win_
```lua
-- 在按钮点击事件的动画结束部分,添加itemshow置灰复原的代码
-- 修改playChainAnimation函数的结束部分
local function playChainAnimation(step)
if step > totalSteps then
-- 动画结束时,隐藏所有特效
for i = 1, 10 do
if i ~= currentIndex then -- 保留最后一个
GUI:setVisible(effects[i], false)
end
end
-- 确保最后一个特效显示
if effects[currentIndex] then
GUI:setVisible(effects[currentIndex], true)
-- 可以添加一个持续闪烁的效果
GUI:runAction(effects[currentIndex], GUI:ActionRepeatForever(
GUI:ActionSequence(
GUI:ActionFadeTo(0.5, 100),
GUI:ActionFadeTo(0.5, 255)
)
))
end
-- 定格后把所有itemshow置灰复原
for i = 1, 10 do
if itemshow[i] and not GUI:Win_IsNull(itemshow[i]) then
GUI:ItemShow_setIconGrey(itemshow[i], true)
end
end
isAnimating = false
return
end
-- 更新当前索引(循环1-10)
currentIndex = ((step - 1) % 10) + 1
-- 显示当前特效并设置不透明度
if effects[currentIndex] then
GUI:setVisible(effects[currentIndex], true)
GUI:setOpacity(effects[currentIndex], 255)
end
-- 添加到活跃特效列表
activeEffects[currentIndex] = {
effect = effects[currentIndex],
fadeTime = 0.15
}
-- 处理残影效果
fadeOutOldEffects()
-- 计算延迟时间
local delayTime = getDelayTime(step)
-- 延迟后播放下一步
SL:ScheduleOnce(function()
playChainAnimation(step + 1)
end, delayTime)
end
```
**修改说明:**
1. 在动画结束的判断条件 `if step > totalSteps then` 内部,添加了置灰复原的代码
2. 使用循环遍历所有10个itemshow
3. 使用 `GUI:ItemShow_setIconGrey(itemshow[i], true)` 将每个物品显示框置灰
4. 添加了空值判断,防止在组件已被移除时调用函数
这样修改后,当转盘动画播放完毕定格时,所有itemshow都会恢复为置灰状态,实现了你要的"定格以后把itemshow置灰复原"效果。