Skip to content
Merged

4.6.2 #1002

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
4ad5d06
fix(parser): 修正场景资源预加载的去重逻辑
A-kirami Jun 8, 2026
5e9019b
chore(parser): 收敛 parser 构建依赖与 TypeScript 配置
A-kirami Jun 8, 2026
f117020
fix(parser): 过滤无效资源预加载项
A-kirami Jun 8, 2026
0fb8f74
flowchart
MakinoharaShoko Jun 13, 2026
f3ee885
fix: flowchart ui
MakinoharaShoko Jun 13, 2026
f594871
fix: 流程图解锁和写入状态时机
MakinoharaShoko Jun 14, 2026
37b0c40
fix(backlog): stop other backlog audio and game vocal on click
CCreative-Od1L Jun 13, 2026
5b5b79d
fix(autoplay): pause auto play while Backlog is open
CCreative-Od1L Jun 13, 2026
c7cd1bc
refactor(backlog): unconditionally pause all backlog audios
CCreative-Od1L Jun 15, 2026
4454fd7
fix(parser): preserve semicolons in inline comments
ChangeSuger Jun 17, 2026
5c1964e
feat: preview protocol add `preview.query.reference-box`
A-kirami Jun 19, 2026
2890d55
fix: validate scene file extension
xiaoxustudio Jun 20, 2026
2f2d471
fix: conditionally enable video skip on double click
xiaoxustudio Jun 20, 2026
eda54bf
feat: implement preview request failure envelope
A-kirami Jun 21, 2026
176407a
feat: add target transform baseline queries
A-kirami Jun 21, 2026
af8fa50
refactor: restructure the editor preview protocol type system
A-kirami Jun 22, 2026
758fc50
fix: Invalid pending target transform baseline
A-kirami Jun 22, 2026
4505d15
fix: adjusted the sync timing of the editor preview transform baseline
A-kirami Jun 23, 2026
2457b15
fix: stabilize set-effect preview baseline
A-kirami Jun 23, 2026
b3ecb28
fix: correct preview set-effect transform baseline
A-kirami Jun 23, 2026
3eb2590
fix: wait for reference box geometry before replying
A-kirami Jun 23, 2026
b2d1068
refactor: clean up editor preview transform queries
A-kirami Jun 24, 2026
1b5cb8f
fix: correct rotated reference bounds
A-kirami Jun 24, 2026
de21fd0
fix: normalize transform frame parsing
A-kirami Jun 25, 2026
a28217e
fix: add missing files
A-kirami Jun 25, 2026
85954a2
perf: avoid full stage commits for set-effect preview updates
A-kirami Jun 26, 2026
1d5882e
fix: #987 next 后接场景跳转失效问题
MakinoharaShoko Jun 27, 2026
2c5559a
fix: handle none bgm command
MakinoharaShoko Jun 27, 2026
bce063a
Merge branch 'dev' into fix-next-scene
MakinoharaShoko Jun 27, 2026
9e3ad7c
Merge branch 'dev' into flowchart
MakinoharaShoko Jun 27, 2026
e325e8e
feat: add flowchart locked node visibility
MakinoharaShoko Jun 27, 2026
4f885cd
flowchart style change
MakinoharaShoko Jul 1, 2026
e418326
Merge pull request #995 from OpenWebGAL/fix-next-scene
MakinoharaShoko Jul 1, 2026
b46ed3e
Merge branch 'dev' into pr/991
MakinoharaShoko Jul 3, 2026
4ad45e4
Merge pull request #991 from A-kirami/feat/editor-preview-transform-q…
MakinoharaShoko Jul 3, 2026
c913fb2
Merge pull request #993 from A-kirami/fix/transform-empty-frame-parsing
MakinoharaShoko Jul 3, 2026
aa1edf8
fix: stabilize preview sync-scene updates
A-kirami Jul 3, 2026
9624579
fix: 已读文本模板应用问题 #999
MakinoharaShoko Jul 4, 2026
68d45ac
fix: skip stage exit animation on restore
MakinoharaShoko Jul 4, 2026
14e105a
Merge branch 'dev' into pr/990
MakinoharaShoko Jul 4, 2026
957fdee
fix: handle play video errors
MakinoharaShoko Jul 4, 2026
3e98bd1
Merge pull request #990 from xiaoxustudio/fix/playVideo-skipOff-issue
MakinoharaShoko Jul 4, 2026
468fa2f
Merge branch 'dev' into pr/988
MakinoharaShoko Jul 4, 2026
86d292a
fix: validate parsed scene url path
MakinoharaShoko Jul 4, 2026
5c197cd
Merge pull request #988 from xiaoxustudio/fix/changeScene-empty-scene
MakinoharaShoko Jul 4, 2026
db0fe6b
Merge branch 'dev' into pr/982
MakinoharaShoko Jul 4, 2026
ee25fc3
Merge pull request #982 from ChangeSuger/fix/parser-inline-comment
MakinoharaShoko Jul 4, 2026
416ca71
Merge branch 'dev' into pr/972
MakinoharaShoko Jul 4, 2026
8e502b0
Merge pull request #972 from A-kirami/fix/parser-asset-dedup-and-buil…
MakinoharaShoko Jul 4, 2026
6f64791
Merge branch 'dev' into pr/1001
MakinoharaShoko Jul 4, 2026
2d861df
Merge pull request #1001 from A-kirami/fix/preview-sync-scene-transac…
MakinoharaShoko Jul 4, 2026
d84a758
Merge branch 'dev' into pr/978
MakinoharaShoko Jul 4, 2026
23181f7
fix: stop auto play when opening backlog
MakinoharaShoko Jul 4, 2026
3fb2c61
Merge pull request #978 from CCreative-Od1L/fix/866-backlog-audio-cle…
MakinoharaShoko Jul 4, 2026
2e24465
Merge branch 'dev' into flowchart
MakinoharaShoko Jul 4, 2026
1b54b33
fix: comp type
MakinoharaShoko Jul 4, 2026
c2bd610
Merge pull request #996 from OpenWebGAL/flowchart
MakinoharaShoko Jul 4, 2026
e7e75e4
update version
MakinoharaShoko Jul 4, 2026
6b4cbf6
update release note
MakinoharaShoko Jul 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@webgal/base",
"version": "4.6.1",
"version": "4.6.2",
"description": "A brand new web Visual Novel engine.",
"repository": "https://github.com/OpenWebGAL/WebGAL.git",
"author": "Mahiru <Mahiru_@outlook.com>",
Expand Down
1 change: 0 additions & 1 deletion packages/parser/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ test
.babelrc
rollup.config.js
tsconfig.json
tsconfig.node.json
16 changes: 3 additions & 13 deletions packages/parser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webgal-parser",
"version": "4.6.1",
"version": "4.6.2",
"description": "WebGAL script parser",
"scripts": {
"test": "vitest",
Expand All @@ -17,26 +17,16 @@
"main": "./build/cjs/index.cjs",
"author": "Mahiru <Mahiru_@outlook.com>",
"license": "MPL-2.0",
"dependencies": {
"chevrotain": "^10.5.0",
"cloudlogjs": "^1.0.11",
"lodash": "^4.17.23",
"tsx": "^3.12.7"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^23.0.2",
"@rollup/plugin-json": "^5.0.1",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-typescript": "^9.0.2",
"@types/lodash": "^4.14.189",
"@types/node": "^18.14.0",
"@vitest/coverage-c8": "^0.28.5",
"rimraf": "^3.0.2",
"rollup": "^3.29.5",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.34.1",
"ts-node": "^10.9.1",
"tslib": "^2.4.1",
"tsx": "^3.12.7",
"typescript": "^4.9.3",
"vitest": "^0.28.5"
},
Expand Down
1 change: 1 addition & 0 deletions packages/parser/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export default [
file: "./build/umd/index.global.js",
name: 'webgalParser',
format: 'iife',
exports: "named",
sourcemap: !isProd
},
],
Expand Down
18 changes: 16 additions & 2 deletions packages/parser/src/sceneParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
ISentence,
} from './interface/sceneInterface';
import { scriptParser } from './scriptParser/scriptParser';
import uniqWith from 'lodash/uniqWith';
import { fileType } from './interface/assets';
import { ConfigMap } from './config/scriptConfig';

Expand Down Expand Up @@ -54,7 +53,7 @@ export const sceneParser = (
);

// 开始资源的预加载
assetsList = uniqWith(assetsList); // 去重
assetsList = deduplicateAssets(assetsList);
assetsPrefetcher(assetsList);

return {
Expand All @@ -65,3 +64,18 @@ export const sceneParser = (
subSceneList: subSceneList, // 子场景列表
};
};

const deduplicateAssets = (assetsList: IAsset[]): IAsset[] => {
const seenAssets = new Set<string>();
return assetsList.filter((asset) => {
if (!asset || typeof asset.url !== 'string' || asset.url === '') {
return false;
}
const assetKey = `${asset.type}:${asset.url}`;
if (seenAssets.has(assetKey)) {
return false;
}
seenAssets.add(assetKey);
return true;
});
};
2 changes: 1 addition & 1 deletion packages/parser/src/scriptParser/scriptParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const scriptParser = (
const commentSplit = sentenceRaw.split(/(?<!\\);/);
let newSentenceRaw = commentSplit[0];
newSentenceRaw = newSentenceRaw.replaceAll('\\;',';');
const sentenceComment = commentSplit[1] ?? '';
const sentenceComment = commentSplit.slice(1).join(';');
if (newSentenceRaw.trim() === '') {
// 注释提前返回
return {
Expand Down
73 changes: 72 additions & 1 deletion packages/parser/test/parser.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SceneParser from "../src/index";
import { ADD_NEXT_ARG_LIST, SCRIPT_CONFIG } from "../src/config/scriptConfig";
import { expect, test } from "vitest";
import { commandType, ISentence } from "../src/interface/sceneInterface";
import { commandType, IAsset, ISentence } from "../src/interface/sceneInterface";
import * as fsp from 'fs/promises';
import { fileType } from "../src/interface/assets";

Expand Down Expand Up @@ -223,6 +223,39 @@ test("say statement applies asset setter to vocal named argument", async () => {
});
});

test("scene assets are deduplicated by type and url", async () => {
let prefetchedAssets: IAsset[] = [];
const parser = new SceneParser((assetList) => {
prefetchedAssets = assetList;
}, (fileName, assetType) => {
return fileName;
}, ADD_NEXT_ARG_LIST, SCRIPT_CONFIG);

const result = parser.parse(`changeBg:shared.webp;
changeFigure:shared.webp;
changeBg:shared.webp;`, 'test', 'test');

expect(result.assetsList).toEqual([
{ name: "shared.webp", url: 'shared.webp', type: fileType.background, lineNumber: 0 },
{ name: "shared.webp", url: 'shared.webp', type: fileType.figure, lineNumber: 1 },
]);
expect(prefetchedAssets).toEqual(result.assetsList);
});

test("scene assets skip entries with empty urls", async () => {
const parser = new SceneParser((assetList) => {
}, (fileName, assetType) => {
if (assetType === fileType.vocal) {
return '';
}
return fileName;
}, ADD_NEXT_ARG_LIST, SCRIPT_CONFIG);

const result = parser.parse(`say:123 -vocal=missing.mp3;`, 'test', 'test');

expect(result.assetsList).toEqual([]);
});

test("wait command", async () => {
const parser = new SceneParser((assetList) => {
}, (fileName, assetType) => {
Expand Down Expand Up @@ -326,6 +359,25 @@ test("escaped semicolon is preserved in content and inline comment is preserved"
expect(result.sentenceList).toContainEqual(expectSentenceItem);
});

test("inline comment preserves following semicolons", async () => {
const parser = new SceneParser((assetList) => {
}, (fileName, assetType) => {
return fileName;
}, ADD_NEXT_ARG_LIST, SCRIPT_CONFIG);

const result = parser.parse(`say:123; first; second; third`, 'test', 'test');
const expectSentenceItem: ISentence = {
command: commandType.say,
commandRaw: "say",
content: "123",
args: [],
sentenceAssets: [],
subScene: [],
inlineComment: "first; second; third"
};
expect(result.sentenceList).toContainEqual(expectSentenceItem);
});

test("comment-only line keeps comment in content", async () => {
const parser = new SceneParser((assetList) => {
}, (fileName, assetType) => {
Expand All @@ -344,3 +396,22 @@ test("comment-only line keeps comment in content", async () => {
};
expect(result.sentenceList).toContainEqual(expectSentenceItem);
});

test("comment-only line preserves following semicolons", async () => {
const parser = new SceneParser((assetList) => {
}, (fileName, assetType) => {
return fileName;
}, ADD_NEXT_ARG_LIST, SCRIPT_CONFIG);

const result = parser.parse(`; first; second; third`, 'test', 'test');
const expectSentenceItem: ISentence = {
command: commandType.comment,
commandRaw: "comment",
content: "first; second; third",
args: [{ key: 'next', value: true }],
sentenceAssets: [],
subScene: [],
inlineComment: ""
};
expect(result.sentenceList).toContainEqual(expectSentenceItem);
});
7 changes: 3 additions & 4 deletions packages/parser/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"declarationDir": "build/types",
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"lib": ["ESNext"],
"allowJs": false,
"skipLibCheck": false,
"esModuleInterop": false,
Expand All @@ -17,13 +17,12 @@
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"types": ["node"],
"paths": {
"@/*": ["./src/*"]
}
},
"include": [
"src"
],
"references": [{ "path": "./tsconfig.node.json"}]
]
}
10 changes: 0 additions & 10 deletions packages/parser/tsconfig.node.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/webgal/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webgal-engine",
"version": "4.6.1",
"version": "4.6.2",
"scripts": {
"dev": "vite --host --port 3000",
"build": "node scripts/update-engine-version.js && cross-env NODE_ENV=production tsc && vite build --base=./",
Expand Down
1 change: 1 addition & 0 deletions packages/webgal/public/game/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Title_bgm:s_Title.mp3;
Game_Logo:WebGalEnter.webp;
Enable_Appreciation:true;
Enable_Continue:true;
Enable_flowchart:true;
Loading
Loading