Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
66ac5f7
feat: add rules argument for getUserInput
xiaoxustudio Jan 3, 2026
37e06ab
feat: can use $0 get input value
xiaoxustudio Jan 3, 2026
c251412
feat: 添加引擎描述文件和版本自动同步机制
A-kirami Feb 5, 2026
d83ae66
fix: fast button state error
xiaoxustudio Feb 9, 2026
70beeae
refactor: optimize auto and fast button state management
xiaoxustudio Feb 9, 2026
3088ec9
fix: service worker
MakinoharaShoko Mar 1, 2026
b1c9fac
fix: supplement transform interface
HardyNLee Mar 14, 2026
dabcc94
fix: remove animation before set effect
HardyNLee Mar 14, 2026
c916f76
Merge pull request #898 from HardyNLee/fix/transform-interface
MakinoharaShoko Mar 14, 2026
687eb9e
Merge branch 'dev' into pr/899
MakinoharaShoko Mar 21, 2026
f47ed34
fix: update removeAnimationByTargetKey to handle multiple animations
MakinoharaShoko Mar 21, 2026
1bebc83
Merge pull request #899 from HardyNLee/fix/set-effect
MakinoharaShoko Mar 21, 2026
a24fc35
fix: safari view problem
MakinoharaShoko Mar 21, 2026
d598cd5
fix: view port problem
MakinoharaShoko Mar 21, 2026
4864aca
fix: ios resize problem
MakinoharaShoko Mar 22, 2026
fdc1572
refactor ios screen handle code
MakinoharaShoko Mar 22, 2026
17b098a
Merge pull request #905 from OpenWebGAL/fix-safari-problem
MakinoharaShoko Mar 22, 2026
88e10a9
webgal ui refresh 1
MakinoharaShoko Mar 22, 2026
ece780e
template file ok
MakinoharaShoko Mar 22, 2026
35bdbc0
template file adjust
MakinoharaShoko Mar 22, 2026
c7eb9c9
textbox adjust complete
MakinoharaShoko Mar 22, 2026
7622fe0
fix scene typo
MakinoharaShoko Mar 22, 2026
2aaae00
title refine 1
MakinoharaShoko Mar 22, 2026
8133b08
title refine 2
MakinoharaShoko Mar 22, 2026
2dfafcb
fix: add skin support
MakinoharaShoko Mar 23, 2026
786ba76
restore old module scss
MakinoharaShoko Mar 28, 2026
b515662
restore template (was accidentally deleted)
MakinoharaShoko Mar 28, 2026
42590f0
fix: use kebab-case for engine name per RFC #762
MakinoharaShoko Mar 28, 2026
b0acd14
feat: complete all optional fields in webgal-engine.json per RFC #762
MakinoharaShoko Mar 28, 2026
200af92
Merge pull request #874 from xiaoxustudio/fix/fast-button-state
MakinoharaShoko Mar 28, 2026
836a4f4
Merge pull request #859 from A-kirami/feat/engine-descriptor
MakinoharaShoko Mar 28, 2026
fa59dea
upgrade deps
MakinoharaShoko Mar 28, 2026
c05bd0d
adjust color
MakinoharaShoko Mar 28, 2026
cf6f751
Merge branch 'dev' into refresh-ui
MakinoharaShoko Mar 28, 2026
badc941
fix: title style and layout
MakinoharaShoko Mar 28, 2026
f5f4781
Merge pull request #911 from OpenWebGAL/refresh-ui
MakinoharaShoko Mar 28, 2026
9019e85
chore: use local built-in component to show text
xiaoxustudio Mar 30, 2026
04119cc
update: font and style
MakinoharaShoko Apr 1, 2026
00b0cb6
update title styles
MakinoharaShoko Apr 1, 2026
8406a60
chore: leftText change to required
xiaoxustudio Apr 7, 2026
32463ff
feat: add ruleButtonText argument
xiaoxustudio Apr 7, 2026
bc40c51
Merge pull request #820 from xiaoxustudio/feat/getUserInput-rules
MakinoharaShoko Apr 7, 2026
5b0fb42
chore(manifest): align official webgal-engine.json with RFC v3
A-kirami Apr 7, 2026
1d753ca
Merge pull request #912 from OpenWebGAL/fix-spine-skins
MakinoharaShoko Apr 11, 2026
0c7fccb
fix: sw, update version
MakinoharaShoko Apr 11, 2026
1a74acd
Merge branch 'dev' into chore/align-webgal-engine-manifest-v3
A-kirami Apr 11, 2026
9df6af2
Merge pull request #927 from A-kirami/chore/align-webgal-engine-manif…
MakinoharaShoko Apr 11, 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 packages/parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"dependencies": {
"chevrotain": "^10.5.0",
"cloudlogjs": "^1.0.11",
"lodash": "^4.17.21",
"lodash": "^4.17.23",
"tsx": "^3.12.7"
},
"devDependencies": {
Expand Down
152 changes: 113 additions & 39 deletions packages/webgal/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@
<link rel="manifest" href="/manifest.json" />
<title>WebGAL</title>
<style>
html,
body {
margin: 0;
background: black;
width: 100%;
height: 100%;
overflow: hidden;
}

.html-body__effect-background {
Expand Down Expand Up @@ -129,6 +134,7 @@
.title-enter-container__link-to-github > div {
padding: 0 0 0.25em 0;
}

</style>
</head>
<body>
Expand All @@ -153,29 +159,70 @@
<div id="html-body__panic-overlay"></div>
<!-- 应用挂载点 -->
<div id="root"></div>
<script>
(() => {
const userAgent = navigator.userAgent || '';
const platform = navigator.userAgentData?.platform || navigator.platform || '';
const maxTouchPoints = navigator.maxTouchPoints || 0;
const isIOSPhone = /iPhone|iPod/i.test(userAgent);
const isIPad = /iPad/i.test(userAgent) || (/Mac/i.test(platform) && maxTouchPoints > 1);

window.__WEBGAL_DEVICE_INFO__ = {
isIOS: isIOSPhone || isIPad,
isIOSPhone,
isIPad,
};
})();
</script>
<!-- 在窗口大小改变时进行强制缩放 -->
<script>
(() => {
const isIOS = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
const deviceInfo = window.__WEBGAL_DEVICE_INFO__ ?? { isIOS: false };
const isIOS = deviceInfo.isIOS;
const layoutConfig = isIOS
? {
bottomInset: 15,
resizeDelay: 500,
viewport:
'width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover',
hideEffectBackground: true,
}
: {
bottomInset: 0,
resizeDelay: 0,
viewport: 'width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no',
hideEffectBackground: false,
};
const root = document.querySelector('#root');
const titleEnter = document.querySelector('.html-body__title-enter');
const effectBackground = document.querySelector('.html-body__effect-background');
let viewportMeta = document.querySelector('meta[name="viewport"]');

const ensureViewportMeta = () => {
if (!viewportMeta) {
viewportMeta = document.createElement('meta');
viewportMeta.name = 'viewport';
document.head.appendChild(viewportMeta);
}
return viewportMeta;
};

const resize = () => {
const targetHeight = 1440; // 目标高度
const targetWidth = 2560; // 目标宽度

const h = window.innerHeight; // 窗口高度
const w = window.innerWidth; // 窗口宽度
const zoomH = h / targetHeight; // 以窗口高度为基准的变换比
const layoutHeight = Math.max(h - layoutConfig.bottomInset, 1);
const zoomH = layoutHeight / targetHeight; // 以窗口高度为基准的变换比
const zoomW = w / targetWidth; // 以窗口宽度为基准的变换比
const zoomH2 = w / targetHeight; // 竖屏时以窗口高度为基础的变换比
const zoomW2 = h / targetWidth; // 竖屏时以窗口宽度为基础的变换比
let mh = (targetHeight - h) / 2; // y轴移动距离
const zoomW2 = layoutHeight / targetWidth; // 竖屏时以窗口宽度为基础的变换比
let mh = (targetHeight - layoutHeight) / 2; // y轴移动距离
let mw = (targetWidth - w) / 2; // x轴移动距离
let mh2os = targetWidth / 2 - w / 2; // 竖屏时 y轴移动距离
let mw2os = targetHeight / 2 - h / 2; // 竖屏时 x轴移动距离
let mw2os = targetHeight / 2 - layoutHeight / 2; // 竖屏时 x轴移动距离
let transform = '';
let effectBackgroundTransform = '';
const root = document.querySelector('#root'); // 获取根元素
const titleEnter = document.querySelector('.html-body__title-enter');
const effectBackground = document.querySelector('.html-body__effect-background');
const elements = [root, titleEnter];
if (w > h) {
if (effectBackground) {
Expand Down Expand Up @@ -211,6 +258,11 @@
// iOS 不强制旋转
if (isIOS) {
const zoomWi = w / targetWidth;
if (effectBackground) {
effectBackground.style.height = `100vh`;
effectBackground.style.width = `100vw`;
effectBackgroundTransform = '';
}
transform = `translate(${-mw}px, ${-mh}px) ` + `scale(${zoomWi},${zoomWi}) `;
}
}
Expand All @@ -223,42 +275,51 @@
}
}
};
if (!isIOS) {
// 非 IOS
// 创建一个新的 meta 标签
const metaTag = document.createElement('meta');
metaTag.name = 'viewport';
metaTag.content = 'width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no';
// 将该标签添加到 head 中
document.head.appendChild(metaTag);
resize();
window.onload = resize;
window.onresize = resize;
// 监听键盘 F11 键按下事件,全屏时触发页面调整
document.onkeydown = (e) => {
if (e && e.key === 'F11') {
setTimeout(() => {
resize();
}, 100);
let iosResizeTimer = null;
const scheduleResize = () => {
if (layoutConfig.resizeDelay > 0) {
if (iosResizeTimer) {
window.clearTimeout(iosResizeTimer);
}
};
} else {
// IOS
const metaTag = document.createElement('meta');
metaTag.name = 'viewport';
metaTag.content = 'width=device-width, initial-scale=0.22, minimum-scale=0.01, maximum-scale=1';
// 将该标签添加到 head 中
document.head.appendChild(metaTag);
iosResizeTimer = window.setTimeout(() => {
resize();
iosResizeTimer = null;
}, layoutConfig.resizeDelay);
return;
}
resize();
};
if (isIOS) {
const styleTag = document.createElement('style');
styleTag.textContent = '* { font-synthesis: none !important; }';
styleTag.textContent = `* { font-synthesis: none !important; }`;
if (layoutConfig.hideEffectBackground) {
styleTag.textContent += `
#ebg,
#ebgOverlay {
display: none !important;
}
`;
}
document.head.appendChild(styleTag);
}
ensureViewportMeta().content = layoutConfig.viewport;
scheduleResize();
window.onload = scheduleResize;
window.onresize = scheduleResize;
// 监听键盘 F11 键按下事件,全屏时触发页面调整
document.onkeydown = (e) => {
if (e && e.key === 'F11') {
setTimeout(() => {
scheduleResize();
}, 100);
}
};
Comment on lines +310 to +316
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Assigning to document.onkeydown overwrites any existing keydown handlers. It is generally better practice to use addEventListener to allow multiple listeners to coexist without interference.

Suggested change
document.onkeydown = (e) => {
if (e && e.key === 'F11') {
setTimeout(() => {
scheduleResize();
}, 100);
}
};
document.addEventListener('keydown', (e) => {
if (e && e.key === 'F11') {
setTimeout(() => {
scheduleResize();
}, 100);
}
});

})();
</script>
<!-- 注册 Service Worker -->
<script>
(() => {
const isIOS = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
const isIOS = window.__WEBGAL_DEVICE_INFO__?.isIOS ?? false;
if ('serviceWorker' in navigator && !isIOS) {
navigator.serviceWorker
.register('./webgal-serviceworker.js')
Expand All @@ -274,7 +335,10 @@
<!-- 首屏加载 -->
<script>
(() => {
const isIOS = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
const isIOS = window.__WEBGAL_DEVICE_INFO__?.isIOS ?? false;
const enterConfig = isIOS
? { skipAnimation: true, hideDelay: 0 }
: { skipAnimation: false, hideDelay: 2000 };
let enterPromiseResolve;
const enterPromise = new Promise((res) => {
enterPromiseResolve = res;
Expand All @@ -299,6 +363,17 @@
});
/** 点击屏幕,进入引擎主界面 */
const enter = () => {
const titleEnter = document.querySelector('.html-body__title-enter');
if (enterConfig.skipAnimation) {
if (titleEnter) {
titleEnter.style.pointerEvents = 'none';
titleEnter.style.transition = 'none';
titleEnter.style.opacity = '0';
titleEnter.style.display = 'none';
}
enterPromiseResolve();
return;
}
const initialBackground = document.querySelector('.title-enter__initial-background');
if (initialBackground) {
initialBackground.style.opacity = '0';
Expand All @@ -313,7 +388,6 @@
whiteBackground.style.opacity = '1';
}
}, 50); // 在50ms后开始显示白色渐变
const titleEnter = document.querySelector('.html-body__title-enter');
setTimeout(() => {
if (titleEnter) titleEnter.style.opacity = '0';
}, 500); // 500ms后开始降低落地页透明度
Expand All @@ -325,7 +399,7 @@
if (titleEnter) {
titleEnter.style.display = 'none';
}
}, 2000); // 将落地页设置为不显示
}, enterConfig.hideDelay); // 将落地页设置为不显示
enterPromiseResolve();
};
const titleEnter = document.querySelector('.html-body__title-enter');
Expand Down
16 changes: 8 additions & 8 deletions packages/webgal/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "webgal-engine",
"version": "4.5.18",
"version": "4.5.19",
"scripts": {
"dev": "vite --host --port 3000",
"build": "cross-env NODE_ENV=production tsc && vite build --base=./",
"build": "node scripts/update-engine-version.js && cross-env NODE_ENV=production tsc && vite build --base=./",
"preview": "vite preview",
"lint": "eslint src/** --fix",
"prepublishOnly": "npm run build"
Expand All @@ -13,12 +13,12 @@
"@icon-park/react": "^1.4.2",
"@reduxjs/toolkit": "^1.8.1",
"angular-expressions": "^1.4.3",
"axios": "^0.30.2",
"axios": "^1.13.5",
"cloudlogjs": "^1.0.9",
"gifuct-js": "^2.1.2",
"i18next": "^22.4.15",
"localforage": "^1.10.0",
"lodash": "^4.17.21",
"lodash": "^4.17.23",
"mitt": "^3.0.0",
"modern-css-reset": "^1.4.0",
"pixi-filters": "^4.2.0",
Expand All @@ -39,11 +39,11 @@
"@types/react": "^17.0.33",
"@types/react-dom": "^17.0.10",
"@types/uuid": "^8.3.4",
"@typescript-eslint/eslint-plugin": "^5.18.0",
"@typescript-eslint/parser": "^5.18.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"@vitejs/plugin-react": "^4.0.4",
"cross-env": "^7.0.3",
"eslint": "^8.13.0",
"eslint": "^9.26.0",
"eslint-config-alloy": "^4.5.1",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
Expand All @@ -53,7 +53,7 @@
"rollup-plugin-visualizer": "^5.6.0",
"typescript": "^4.5.4",
"unplugin-info": "^1.2.2",
"vite": "^4.5.5",
"vite": "^5.4.21",
"vite-plugin-compression": "^0.5.1"
}
}
2 changes: 1 addition & 1 deletion packages/webgal/public/game/scene/demo_changeConfig.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
webgal:我会修改标题 -hold;
setVar:Game_name=WebGal_Change -global;
setVar:Game_name=WebGAL_Change -global;
webgal:游戏标题已经被我修改为{Game_name} -hold;
webgal:我会修改游戏背景 -hold;
setVar:Title_img=bg.webp -global;
Expand Down
4 changes: 2 additions & 2 deletions packages/webgal/public/game/scene/demo_en.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
bgm:s_Title.mp3 -volume=80 -enter=3000;
unlockBgm:s_Title.mp3 -name=welcome;
intro:*Getting started| The image materials used in this demo game are AI-generated images;
intro:*Credit| Created By ondoku3.com;
intro:*Credit| Created by ondoku3.com;
changeBg:bg.webp -next;
unlockCg:bg.webp -name=良い夜;
changeFigure:stand.webp -left -enter=enter-from-left -next;
Expand All @@ -22,7 +22,7 @@ pixiPerform:snow;
For example, let's make it snow as a special effect. -e008_For_example_let's_make.mp3;
As you can see, WebGAL has attractive features. |Try it out and experience it. -e009_As_you_can see_WebGAL.mp3;
That's all for the feature introduction. -e010_That's_all_for_the_feature introduction.mp3;
Next,I will introduce the history and trivia of WebGAL. -e011_Next_I_will introduce_the_ history.mp3;
Next, I will introduce the history and trivia of WebGAL. -e011_Next_I_will introduce_the_ history.mp3;
pixiInit;
choose:WebGAL History:choose1|WebGAL Trivia:choose2;
;選択1
Expand Down
2 changes: 1 addition & 1 deletion packages/webgal/public/game/scene/demo_escape.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
intro:我会显示出来:\:\,\.\;不信你看看 -hold;
WebGal:我会显示出来:\:\,\.\;不信你看看;
WebGAL:我会显示出来:\:\,\.\;不信你看看;
choose:我会显示出来:\:\,\.\;不信你看看;
Loading
Loading