Skip to content

Commit b46c22a

Browse files
Merge pull request #937 from OpenWebGAL/refactor-state-mgmt
实现新流程控制和演出调用架构
2 parents 6faf573 + 4cce67f commit b46c22a

110 files changed

Lines changed: 2183 additions & 1948 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@webgal/base",
3-
"version": "4.5",
3+
"version": "4.6",
44
"description": "A brand new web Visual Novel engine.",
55
"repository": "https://github.com/OpenWebGAL/WebGAL.git",
66
"author": "Mahiru <Mahiru_@outlook.com>",

packages/webgal/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webgal-engine",
3-
"version": "4.5.20",
3+
"version": "4.6.0",
44
"scripts": {
55
"dev": "vite --host --port 3000",
66
"build": "node scripts/update-engine-version.js && cross-env NODE_ENV=production tsc && vite build --base=./",
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
11
changeBg:WebGalEnter.webp -next;
22
changeFigure:stand.webp -id=figure01 -transform={"position":{"x":1000,"y":720}};
3-
;演示setAnimation平行执行
3+
接下来演示setAnimation平行执行
44
setAnimation:shockwaveIn -target=figure01 -next
55
setAnimation:move-front-and-back -target=figure01 -parallel
6-
;演示通过-continue接续执行两个常规setTransform正常运作、不被打断
6+
接下来演示通过-continue接续执行两个常规setTransform正常运作、不被打断
77
setTransform:{"position":{"x":-1000}} -duration=5000 -target=figure01 -continue
88
setTransform:{"position":{"x":1000}} -duration=5000 -target=figure01
9-
;演示setTransform平行执行
9+
接下来演示setTransform平行执行
1010
setTransform:{"position":{"x":-1000},"scale":{"x":0.5},"contrast":0.5} -duration=5000 -target=figure01 -ease=easeOut -next -keep
1111
wait:2000
1212
setTransform:{"position":{"y":0},"scale":{"y":0.5},"saturation":0} -duration=5000 -target=figure01 -ease=linear -parallel -continue
1313
setTransform:{"position":{"y":-720},"scale":{"y":1},"saturation":1} -duration=5000 -target=figure01 -ease=linear -next
1414
setTransform:{"position":{"x":1000},"scale":{"x":1},"contrast":1} -duration=5000 -target=figure01 -ease=easeIn -parallel;
15-
;演示参数解耦改动后setTempAnimation普通运作是否正常
15+
接下来演示参数解耦改动后setTempAnimation普通运作是否正常
1616
setTempAnimation:[{"duration":0}, {"duration":500,"position":{"x":-1000}}, {"duration":500,"position":{"y":720},"scale":{"y":0.5},"saturation":0}, {"duration":500,"position":{"x":-1000, "y":720}}, {"duration":500}, {"duration":500,"position":{"x":-1000},"scale":{"x":0.5},"contrast":0.5}] -target=figure01
1717
setTempAnimation:[{"duration":0}, {"duration":500,"position":{"x":1000}}, {"duration":500,"position":{"y":720}}, {"duration":500,"position":{"x":1000, "y":720}}, {"duration":500}, {"duration":500,"position":{"x":1000}}] -target=figure01
18-
;演示参数解耦改动后setTransform的-writeDefault参数是否运作正常
18+
接下来演示参数解耦改动后setTransform的-writeDefault参数是否运作正常
1919
setTransform:{} -writeDefault -target=figure01 -duration=500
2020
setTransform:{"position":{"x":1000,"y":720}} -target=figure01 -next;
2121
setAnimation:shockwaveOut -target=figure01 -parallel
22-
;演示setTempAnimation平行执行
22+
接下来演示setTempAnimation平行执行
23+
setTransform:{"alpha":1} -target=figure01 -next;
2324
setTempAnimation:[{"duration":0},{"position":{"x":-1000},"scale":{"x":0.5},"contrast":0.5,"duration":5000,"ease":"easeOut"},{"position":{"x":-1000},"scale":{"x":0.5},"contrast":0.5,"duration":2000},{"position":{"x":600},"scale":{"x":1},"contrast":1,"duration":5000,"ease":"easeIn"},{"duration":2000}] -target=figure01 -next;
2425
setTempAnimation:[{"duration":2000},{"position":{"y":0},"scale":{"y":0.5},"saturation":0,"duration":5000,"ease":"linear"},{"position":{"y":-720},"scale":{"y":1},"saturation":1,"duration":5000,"ease":"linear"},{"duration":2000}] -target=figure01 -parallel -continue;
25-
;演示并行执行多条终止时间点不一致的setTransform
26+
演示并行执行多条终止时间点不一致的setTransform
2627
setTransform:{"position":{"x":-1000}} -duration=5000 -next -target=figure01;
2728
setTransform:{"position":{"y":0}} -duration=3000 -parallel -target=figure01;
2829
setTransform:{"position":{"x":1000}} -duration=3000 -next -target=figure01;
2930
setTransform:{"position":{"y":-720}} -duration=5000 -parallel -target=figure01;
31+
结束,接下来退场。
3032
changeBg: -next;
3133
changeFigure: -id=figure01
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
DOM 管理测试 1 开始:验证 intro 创建 introContainer 后会自动清理。
2+
intro:DOM 测试第一段|自动结束 -delayTime=80 -fontSize=small -animation=fadeIn;
3+
DOM 管理测试 1 结束:预期状态:第一段 intro 结束后回到对话,introContainer 不应继续遮挡画面。
4+
5+
DOM 管理测试 2 开始:验证连续 intro 不残留前一个 DOM 内容。
6+
intro:DOM 测试第二段|如果第一段文字仍可见就是异常 -delayTime=80 -fontSize=small -animation=slideIn -backgroundColor=rgba(16,16,16,1);
7+
DOM 管理测试 2 结束:预期状态:只显示过第二段 intro,结束后没有残留黑屏内容。
8+
9+
DOM 管理测试 3 开始:验证 chooseContainer 在选择后清理;快速预览默认选择第 2 项。
10+
choose:手动 DOM 路径:dom_choice_manual|快速预览 DOM 路径:dom_choice_fast -defaultChoose=2;
11+
label:dom_choice_manual;
12+
setVar:domChoice=manual;
13+
DOM 管理测试 3 手动路径:手动选择第 1 项时会看到这里。
14+
jumpLabel:dom_choice_after;
15+
label:dom_choice_fast;
16+
setVar:domChoice=fast;
17+
DOM 管理测试 3 默认路径:快速预览默认选择第 2 项。
18+
label:dom_choice_after;
19+
DOM 管理测试 3 结束:预期状态:domChoice={domChoice};选择结束后 chooseContainer 不应残留按钮。
20+
21+
DOM 管理测试 4 开始:验证 getUserInput 的输入框 DOM 在确认后清理,快速预览写入默认值。
22+
getUserInput:domInput -title=DOM 输入测试 -buttonText=确认 -defaultValue=DOMDefault;
23+
DOM 管理测试 4 结束:预期状态:快速预览时 domInput={domInput},应为 DOMDefault;普通运行或普通快进确认后输入框 DOM 被清理。
24+
25+
DOM 管理测试 5 开始:验证 setTextbox hide/on 后文本框能恢复。
26+
setTextbox:hide -next;
27+
wait:300;
28+
setTextbox:on -next;
29+
DOM 管理测试 5 结束:预期状态:这句话可见,文本框已恢复显示,introContainer 和 chooseContainer 没有可见残留。
30+
end;
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
流程控制测试 1 开始:验证 jumpLabel 会跳过当前路径并继续执行。
2+
jumpLabel:flow_jump_target;
3+
流程控制测试 1 异常路径:如果看到这句话,说明 jumpLabel 没有跳过中间语句。
4+
label:flow_jump_target;
5+
流程控制测试 1 结束:预期状态:没有看到“异常路径”,并成功到达 flow_jump_target。
6+
7+
流程控制测试 2 开始:验证 choose 跳转到标签;快速预览默认选择第 2 项。
8+
choose:路径 A:flow_choose_a|路径 B:flow_choose_b -defaultChoose=2;
9+
label:flow_choose_a;
10+
setVar:flowChoice=A;
11+
流程控制测试 2 路径 A:手动选择 A 时会看到这里。
12+
jumpLabel:flow_choose_end;
13+
label:flow_choose_b;
14+
setVar:flowChoice=B;
15+
流程控制测试 2 路径 B:快速预览默认选择 B 时会看到这里。
16+
label:flow_choose_end;
17+
流程控制测试 2 结束:预期状态:快速预览时 flowChoice={flowChoice},应为 B;手动运行时应等于所选路径。
18+
19+
流程控制测试 3 开始:验证 callScene 子场景执行后会回到父场景继续。
20+
setVar:flowChildDone=0;
21+
callScene:demo_test_flow_control_child.txt;
22+
流程控制测试 3 结束:预期状态:已从子场景返回,flowChildDone={flowChildDone},应为 1。
23+
24+
流程控制测试 4 开始:验证连续 jumpLabel 能落到统一出口,不进入中间路径。
25+
jumpLabel:flow_chain_1;
26+
流程控制测试 4 异常路径 A:如果看到这句话,说明第一段跳转失败。
27+
label:flow_chain_1;
28+
jumpLabel:flow_chain_2;
29+
流程控制测试 4 异常路径 B:如果看到这句话,说明第二段跳转失败。
30+
label:flow_chain_2;
31+
流程控制测试 4 结束:预期状态:直接到达 flow_chain_2,未显示异常路径。
32+
end;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
流程控制子场景测试开始:验证 callScene 会压栈进入子场景。
2+
setVar:flowChildDone=1;
3+
流程控制子场景测试结束:预期状态:flowChildDone={flowChildDone},下一句应回到父场景。;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
用户输入流程控制测试 1 开始:验证快速预览下 getUserInput 会写入 defaultValue。
2+
getUserInput:previewName -title=输入测试 -buttonText=确认 -defaultValue=FastPreviewName;
3+
jumpLabel:input_default_ok -when=previewName=="FastPreviewName";
4+
用户输入流程控制测试 1 手动输入路径:previewName={previewName},与默认值不同。
5+
jumpLabel:input_default_end;
6+
label:input_default_ok;
7+
用户输入流程控制测试 1 默认值路径:previewName={previewName},快速预览默认值命中。
8+
label:input_default_end;
9+
用户输入流程控制测试 1 结束:预期状态:快速预览时 previewName={previewName},应为 FastPreviewName;普通运行或普通快进时应等待用户确认,并按实际输入分支。
10+
11+
用户输入流程控制测试 2 开始:验证快速预览下 choose 的 defaultChoose 会决定流程。
12+
choose:手动路径:input_manual_path|快速预览默认路径:input_fast_path -defaultChoose=2;
13+
label:input_manual_path;
14+
setVar:inputChoice=manual;
15+
用户输入流程控制测试 2 手动路径:手动选择第 1 项时会看到这里。
16+
jumpLabel:input_choice_after;
17+
label:input_fast_path;
18+
setVar:inputChoice=fastPreviewDefault;
19+
用户输入流程控制测试 2 默认路径:快速预览默认选择第 2 项。
20+
label:input_choice_after;
21+
用户输入流程控制测试 2 结束:预期状态:快速预览时 inputChoice={inputChoice},应为 fastPreviewDefault;普通运行或普通快进时应等待玩家选择。
22+
23+
用户输入流程控制测试 3 开始:验证输入变量可以参与后续 choose 的显示条件。
24+
choose:(previewName=="FastPreviewName")->默认输入路径:input_name_default|(previewName!="FastPreviewName")->其它输入路径:input_name_other -defaultChoose=1;
25+
label:input_name_default;
26+
setVar:inputNameBranch=defaultName;
27+
用户输入流程控制测试 3 默认输入路径:快速预览默认输入会显示并选择这里。
28+
jumpLabel:input_name_after;
29+
label:input_name_other;
30+
setVar:inputNameBranch=otherName;
31+
用户输入流程控制测试 3 其它输入路径:手动输入其它名字时可选择这里。
32+
label:input_name_after;
33+
用户输入流程控制测试 3 结束:预期状态:快速预览时 inputNameBranch={inputNameBranch},应为 defaultName。
34+
end;
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
变量流程控制测试 1 开始:验证数值变量驱动 jumpLabel -when。
2+
setVar:varScore=2;
3+
jumpLabel:var_score_high -when=varScore>1;
4+
变量流程控制测试 1 异常路径:varScore>1 时不应看到这里。
5+
jumpLabel:var_score_end;
6+
label:var_score_high;
7+
变量流程控制测试 1 命中路径:varScore={varScore},条件跳转生效。
8+
label:var_score_end;
9+
变量流程控制测试 1 结束:预期状态:varScore={varScore},应为 2,并且只经过命中路径。
10+
11+
变量流程控制测试 2 开始:验证 choose 的显示条件、启用条件和默认选择。
12+
setVar:varHasTicket=true;
13+
setVar:varDoorPower=1;
14+
choose:(varHasTicket==true)->进入可见路径:var_ticket_ok|[varDoorPower>1]->能量路径:var_power_path|(varScore<0)->隐藏路径:var_hidden -defaultChoose=1;
15+
label:var_ticket_ok;
16+
setVar:varChoice=ticket;
17+
变量流程控制测试 2 可见路径:快速预览默认选择这里。
18+
jumpLabel:var_choose_end;
19+
label:var_power_path;
20+
setVar:varChoice=power;
21+
变量流程控制测试 2 能量路径:只有 varDoorPower>1 时才能手动选择。
22+
jumpLabel:var_choose_end;
23+
label:var_hidden;
24+
setVar:varChoice=hidden;
25+
变量流程控制测试 2 隐藏路径:varScore<0 时才应显示。
26+
label:var_choose_end;
27+
变量流程控制测试 2 结束:预期状态:快速预览时 varChoice={varChoice},应为 ticket;能量路径应显示但不可选,隐藏路径不应显示。
28+
29+
变量流程控制测试 3 开始:验证快速预览下后续测试继承前面变量状态。
30+
setVar:varScore=varScore + 3;
31+
jumpLabel:var_inherited_ok -when=varScore>4;
32+
变量流程控制测试 3 异常路径:varScore 继承并加 3 后应大于 4。
33+
jumpLabel:var_inherited_end;
34+
label:var_inherited_ok;
35+
变量流程控制测试 3 命中路径:varScore={varScore},varChoice={varChoice}。
36+
label:var_inherited_end;
37+
变量流程控制测试 3 结束:预期状态:varScore={varScore},应为 5;varChoice={varChoice},应保持 ticket。
38+
end;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
choose: Lip Sync Animation Test:demo_animation.txt | Variable interpolation test:demo_var.txt | Change Config:demo_changeConfig.txt | Performs:demo_performs.txt;
1+
choose: Lip Sync Animation Test:demo_animation.txt | Variable interpolation test:demo_var.txt | Change Config:demo_changeConfig.txt | Performs:demo_performs.txt | Flow Control Test:demo_test_flow_control.txt | Variable Flow Control Test:demo_test_variable_flow_control.txt | Input Flow Control Test:demo_test_input_flow_control.txt | DOM Lifecycle Test:demo_test_dom_control.txt;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"name":"WebGAL Refine 2026",
3-
"webgal-version":"4.5.20"
3+
"webgal-version":"4.6.0"
44
}

0 commit comments

Comments
 (0)