local function zhuanpan(msgID, msgData)
local screenWidth = SL:GetMetaValue("SCREEN_WIDTH", 0)
local screenHeight = SL:GetMetaValue("SCREEN_HEIGHT", 0)
local parent = GUI:Win_Create("zhuanpan", 0, 0, 0, 0, false, false, true, false, fals
🤖 回答引擎: 前端Lua |
🕒 时间: 2026-04-21 15:42:58 |
👁️ 阅读: 10
```lua
local function zhuanpan(msgID, msgData)
local screenWidth = SL:GetMetaValue("SCREEN_WIDTH", 0)
local screenHeight = SL:GetMetaValue("SCREEN_HEIGHT", 0)
local parent = GUI:Win_Create("zhuanpan", 0, 0, 0, 0, false, false, true, false, false, false, 1)
GUI:Win_SetMainHide(parent, true)
-- 第一个序列帧
local fullScreenAnim = GUI:Frames_Create(
parent,
"FullScreenFrames",
screenWidth/2,
screenHeight/2,
"res/yuding/donghua/a/a",
".png",
1,
15,
{speed = 100, count = 15, loop = 1}
)
GUI:setAnchorPoint(fullScreenAnim, 0.5, 0.5)
GUI:setContentSize(fullScreenAnim, screenWidth, screenHeight)
GUI:setIgnoreContentAdaptWithSize(fullScreenAnim, false)
-- 第一个序列帧播放完成后的处理
SL:ScheduleOnce(function()
if not GUI:Win_IsNull(fullScreenAnim) then
GUI:removeFromParent(fullScreenAnim)
end
-- 创建第二个序列帧
local secondAnim = GUI:Frames_Create(
parent,
"SecondFrames",
screenWidth/2,
screenHeight/2,
"res/yuding/donghua/b/b",
".png",
1,
15,
{speed = 100, count = 15, loop = -1}
)
GUI:setAnchorPoint(secondAnim, 0.5, 0.5)
GUI:setContentSize(secondAnim, screenWidth, screenHeight)
GUI:setIgnoreContentAdaptWithSize(secondAnim, false)
-- 创建第三个序列帧(初始透明)
local disan = GUI:Frames_Create(
parent,
"threeFrames",
screenWidth/2,
screenHeight/2,
"res/yuding/donghua/d/d",
".png",
1,
25,
{speed = 50, count = 25, loop = -1}
)
GUI:setAnchorPoint(disan, 0.5, 0.5)
GUI:setContentSize(disan, screenWidth, screenHeight)
GUI:setIgnoreContentAdaptWithSize(disan, false)
GUI:setOpacity(disan, 0) -- 初始完全透明
-- 2秒后淡入第三个序列帧
SL:ScheduleOnce(function()
if not GUI:Win_IsNull(disan) then
GUI:Timeline_FadeIn(disan, 2, nil) -- 2秒淡入
end
end, 0.1)
-- 判断参数并执行第四个序列帧
if msgData and msgData.param == "调用" then
-- 在已创建的界面上执行第四个序列帧
local fourthAnim = GUI:Frames_Create(
parent,
"FourthFrames",
screenWidth/2,
screenHeight/2,
"res/yuding/donghua/e/e", -- 第四个序列帧路径
".png",
1,
20,
{speed = 80, count = 20, loop = 1}
)
GUI:setAnchorPoint(fourthAnim, 0.5, 0.5)
GUI:setContentSize(fourthAnim, screenWidth, screenHeight)
GUI:setIgnoreContentAdaptWithSize(fourthAnim, false)
-- 第四个序列帧播放完成后移除
SL:ScheduleOnce(function()
if not GUI:Win_IsNull(fourthAnim) then
GUI:removeFromParent(fourthAnim)
end
end, 2) -- 根据帧数和速度计算播放时间
end
end, 1)
end
SL:RegisterNetMsg(1030, zhuanpan)
```
主要修改说明:
1. 在第一个序列帧播放完成后的处理函数中,添加了参数判断逻辑
2. 当`msgData.param == "调用"`时,会在已创建的界面基础上执行第四个序列帧
3. 第四个序列帧使用`Frames_Create`函数创建,参数说明:
- `parent`: 父节点对象
- `ID`: 唯一ID "FourthFrames"
- `x`, `y`: 屏幕中心位置
- `prefix`: 序列帧前缀路径
- `suffix`: 序列帧后缀
- `beginframe`: 起始帧(1)
- `finishframe`: 结束帧(20)
- `ext`: 扩展参数表,包含速度、数量、循环次数
注意:第四个序列帧的资源路径`res/yuding/donghua/e/e`需要根据实际资源路径进行修改。
← 返回问答库