Author SHA1 Message Date
github-actions[bot] 6f2d9857de Prepare manifest for v2.0.2.3-rc.10 2026-11-24 04:08:44 +00:00
Diuse 98116bef7b fixed # 修复部分样式BUG 2026-11-24 12:08:04 +08:00
20 changed files with 647 additions and 115 deletions
+4 -2
View File
@@ -20,7 +20,7 @@ The entire Skill invocation must remain read-only:
- Do not fix findings, advance phase, or update tasks, state, verification reports, or review records. - Do not fix findings, advance phase, or update tasks, state, verification reports, or review records.
- Do not call this review a Verify pass or treat “no findings” as proof that tests passed. - Do not call this review a Verify pass or treat “no findings” as proof that tests passed.
Only run commands needed to read files, query state, and inspect Git diffs. Checks that might execute project code, install dependencies, or produce files are outside this entry's scope. Only run commands needed to read files, query state, and inspect Git diffs, plus the focused browser check in the [battle UI review checklist](../../../docs/reviews/mengsan-battle-ui.md). Run that check without screenshot output unless a temporary directory outside the repository has been designated for review evidence. All other checks that execute project code, install dependencies, or produce files are outside this entry's scope.
## 1. Locate the project and current change ## 1. Locate the project and current change
@@ -80,6 +80,8 @@ If the available evidence still cannot establish a reliable, verifiable baseline
## 4. Perform the review ## 4. Perform the review
Apply the battle UI review checklist and record the results by scenario name in the evidence status. Reuse evidence bound to the current changes when available.
Review the requirements, tasks, and current diff, focusing only on: Review the requirements, tasks, and current diff, focusing only on:
- Implementation correctness and clear logic errors. - Implementation correctness and clear logic errors.
@@ -110,7 +112,7 @@ Evidence: The specific relationship to the diff, task, spec, or verification rec
Then include: Then include:
- `Review scope`: workflow, change, phase, baseline, included diffs, and any scope limitations. - `Review scope`: workflow, change, phase, baseline, included diffs, and any scope limitations.
- `Evidence status`: the test, build, and verification records inspected and whether they still apply to the current changes. Do not rerun tests. - `Evidence status`: report each battle UI scenario by its name in the checklist, together with the other test, build, and verification records inspected and whether they still apply to the current changes.
- `Open questions`: only questions that actually prevent a judgment. - `Open questions`: only questions that actually prevent a judgment.
- `Conclusion`: the finding count, or an explicit “No concrete findings.” - `Conclusion`: the finding count, or an explicit “No concrete findings.”
+4
View File
@@ -63,3 +63,7 @@ gives you structural context (callers, dependents, test coverage) that file sear
3. Use `get_affected_flows_tool` to understand impact. 3. Use `get_affected_flows_tool` to understand impact.
4. Use `query_graph_tool` pattern="tests_for" to check coverage. 4. Use `query_graph_tool` pattern="tests_for" to check coverage.
<!-- /code-review-graph MCP tools --> <!-- /code-review-graph MCP tools -->
## 梦三战斗 UI 审查
每次 review 都按 [梦三战斗 UI 回归清单](docs/reviews/mengsan-battle-ui.md) 逐项核验,并记录结果和验证环境。涉及战斗 UI 的改动须附本轮渲染截图,并单独记录 Android 实机验证状态。
+13 -13
View File
@@ -1,11 +1,11 @@
{ {
"version": "2.0.2.3-rc.9", "version": "2.0.2.3-rc.10",
"generated_at": "2026-11-24T02:18:29.852446+00:00", "generated_at": "2026-11-24T04:08:42.242236+00:00",
"algorithm": "sha256", "algorithm": "sha256",
"update_channels": true, "update_channels": true,
"file_count": 288, "file_count": 288,
"size_bytes": 48059878, "size_bytes": 48059903,
"folder_sha256": "fb2d412a62c1c4fe99b1b71d4d0ded40b34b34a7c14804c734b403cd1019bb39", "folder_sha256": "db468919dfb9a06552c4b6122a05f2af4967be3604d3b5c6613ffcf24f28e335",
"core": [ "core": [
"extension.js", "extension.js",
"menu.js", "menu.js",
@@ -438,8 +438,8 @@
"sha256": "0907c22921f33d3180378dfcec4cdea793227d325c281d5f3a3f698c83b42b85" "sha256": "0907c22921f33d3180378dfcec4cdea793227d325c281d5f3a3f698c83b42b85"
}, },
"extension.js": { "extension.js": {
"size": 15731, "size": 15732,
"sha256": "a3b9c226e50876661e1bdd91579a1051cafb02a512eb3b9fb452174c9c531b7a" "sha256": "4378ce1123d26ce777e01c0a159f8b0895529a1d2f6941567388a3f447e150bc"
}, },
"function.js": { "function.js": {
"size": 38588, "size": 38588,
@@ -1350,8 +1350,8 @@
"sha256": "bd89818b8f535c19b51f107ca2c75dec669852e4a604ed55f6fa945ecec8e6d6" "sha256": "bd89818b8f535c19b51f107ca2c75dec669852e4a604ed55f6fa945ecec8e6d6"
}, },
"update.js": { "update.js": {
"size": 91443, "size": 91467,
"sha256": "9ce351da60f3044f92ffd6e84997816dcf551d5186f61505a76161262b4cbb65" "sha256": "c8210c6cba50deff3442ec5c57eff869a703cdbee9aa945df788a1138e909f8b"
}, },
"update.txt": { "update.txt": {
"size": 4962, "size": 4962,
@@ -1695,8 +1695,8 @@
}, },
"extension.js": { "extension.js": {
"type": "file", "type": "file",
"size": 15731, "size": 15732,
"sha256": "a3b9c226e50876661e1bdd91579a1051cafb02a512eb3b9fb452174c9c531b7a" "sha256": "4378ce1123d26ce777e01c0a159f8b0895529a1d2f6941567388a3f447e150bc"
}, },
"function.js": { "function.js": {
"type": "file", "type": "file",
@@ -2965,8 +2965,8 @@
}, },
"update.js": { "update.js": {
"type": "file", "type": "file",
"size": 91443, "size": 91467,
"sha256": "9ce351da60f3044f92ffd6e84997816dcf551d5186f61505a76161262b4cbb65" "sha256": "c8210c6cba50deff3442ec5c57eff869a703cdbee9aa945df788a1138e909f8b"
}, },
"update.txt": { "update.txt": {
"type": "file", "type": "file",
@@ -3116,7 +3116,7 @@
"entry": "mengsan/register.js", "entry": "mengsan/register.js",
"manifest": "dist/modules/mengsan.json", "manifest": "dist/modules/mengsan.json",
"file_count": 846, "file_count": 846,
"size_bytes": 150427884, "size_bytes": 150436158,
"legacy_manifest": "dist/modules/mengsan.legacy.json" "legacy_manifest": "dist/modules/mengsan.legacy.json"
} }
} }
+28 -28
View File
@@ -1,11 +1,11 @@
{ {
"version": "2.0.2.3-rc.9", "version": "2.0.2.3-rc.10",
"generated_at": "2026-11-24T02:18:29.854104+00:00", "generated_at": "2026-11-24T04:08:42.243037+00:00",
"algorithm": "sha256", "algorithm": "sha256",
"update_channels": true, "update_channels": true,
"file_count": 846, "file_count": 846,
"size_bytes": 150427884, "size_bytes": 150436158,
"folder_sha256": "64d54453d119b3b53001ddd4b972c0098c559c34b72fae35b6ec6a0ec9f5b596", "folder_sha256": "9babf97d7834d9abb150995481290e0508fb3fe8b4ea4ea5ffff5cb0d5225525",
"core": [ "core": [
"mengsan/register.js" "mengsan/register.js"
], ],
@@ -4148,24 +4148,24 @@
"sha256": "4b804c1d42c6c1171d42a37136fcb903bfb3128beae6a357b52ef9cede54908f" "sha256": "4b804c1d42c6c1171d42a37136fcb903bfb3128beae6a357b52ef9cede54908f"
}, },
"mengsan/ui/hand/input.js": { "mengsan/ui/hand/input.js": {
"size": 13034, "size": 13600,
"sha256": "8e2165ca0ca28d106d5c538ef1b248b3bc68ae23e0be8fcd10fcd62864512701" "sha256": "2a2f78bfa84639c0cf78c4b8e124d79c1405de8b82f99fd5fdd240a760fe347b"
}, },
"mengsan/ui/hand/overlays.js": { "mengsan/ui/hand/overlays.js": {
"size": 3970, "size": 3970,
"sha256": "9e489fc939f97a21266764f1beccdda1cc3ac9df22f72c633647d7481fa4e662" "sha256": "9e489fc939f97a21266764f1beccdda1cc3ac9df22f72c633647d7481fa4e662"
}, },
"mengsan/ui/hand/style.css": { "mengsan/ui/hand/style.css": {
"size": 15499, "size": 15564,
"sha256": "bcc2c93ea1bca3118240e28cd77cc71941146b60ca6d8becd685f6e31fbf917a" "sha256": "b958c78088e903c5ec09537f2d3b2241fe51a9067604e360b560c02fdac30904"
}, },
"mengsan/ui/hud/index.js": { "mengsan/ui/hud/index.js": {
"size": 26766, "size": 27135,
"sha256": "a917b681a83db288244a61ee3cccba8315b13d35fdc4384f1a8e750dc776d68b" "sha256": "c91b29c61227e21f3303e0a9368645c7215e6794dce5f62651db0433b773a3d0"
}, },
"mengsan/ui/hud/overlays.js": { "mengsan/ui/hud/overlays.js": {
"size": 7007, "size": 11789,
"sha256": "769fe1227c6b54ba5852a02cdb75aa07b1edd674c2078a02d596178ddd4dff10" "sha256": "c98e2956fbb2a32d4bb2c79350f8c530c4760719650d1f095e5a177c7825b6c1"
}, },
"mengsan/ui/hud/status-model.js": { "mengsan/ui/hud/status-model.js": {
"size": 11300, "size": 11300,
@@ -4192,12 +4192,12 @@
"sha256": "62dc4cd8093b931c91b42070f36f6a7f54493cf13e55c682b8ef5c2bb8495be7" "sha256": "62dc4cd8093b931c91b42070f36f6a7f54493cf13e55c682b8ef5c2bb8495be7"
}, },
"mengsan/ui/potions.css": { "mengsan/ui/potions.css": {
"size": 2540, "size": 2886,
"sha256": "efc36a84f98a01e9734b54969bb47774c7bc37f47d678b7e3066e19b4f67a81b" "sha256": "4a682e41cc7d69361bb7bd1a0a61fb2a90b8a63c0e1006e4ed1e87d1434d3461"
}, },
"mengsan/ui/potions.js": { "mengsan/ui/potions.js": {
"size": 6283, "size": 8429,
"sha256": "863f606776412b036f386ec691253ef17c608bae11c5cdbc1805de9898ff089e" "sha256": "08b6be3bdd26553dbe25d8f409f51d02eb09023037132856cb2201b6143705cd"
}, },
"mengsan/ui/relic-icon.js": { "mengsan/ui/relic-icon.js": {
"size": 631, "size": 631,
@@ -8514,8 +8514,8 @@
}, },
"input.js": { "input.js": {
"type": "file", "type": "file",
"size": 13034, "size": 13600,
"sha256": "8e2165ca0ca28d106d5c538ef1b248b3bc68ae23e0be8fcd10fcd62864512701" "sha256": "2a2f78bfa84639c0cf78c4b8e124d79c1405de8b82f99fd5fdd240a760fe347b"
}, },
"overlays.js": { "overlays.js": {
"type": "file", "type": "file",
@@ -8524,8 +8524,8 @@
}, },
"style.css": { "style.css": {
"type": "file", "type": "file",
"size": 15499, "size": 15564,
"sha256": "bcc2c93ea1bca3118240e28cd77cc71941146b60ca6d8becd685f6e31fbf917a" "sha256": "b958c78088e903c5ec09537f2d3b2241fe51a9067604e360b560c02fdac30904"
} }
} }
}, },
@@ -8534,13 +8534,13 @@
"children": { "children": {
"index.js": { "index.js": {
"type": "file", "type": "file",
"size": 26766, "size": 27135,
"sha256": "a917b681a83db288244a61ee3cccba8315b13d35fdc4384f1a8e750dc776d68b" "sha256": "c91b29c61227e21f3303e0a9368645c7215e6794dce5f62651db0433b773a3d0"
}, },
"overlays.js": { "overlays.js": {
"type": "file", "type": "file",
"size": 7007, "size": 11789,
"sha256": "769fe1227c6b54ba5852a02cdb75aa07b1edd674c2078a02d596178ddd4dff10" "sha256": "c98e2956fbb2a32d4bb2c79350f8c530c4760719650d1f095e5a177c7825b6c1"
}, },
"status-model.js": { "status-model.js": {
"type": "file", "type": "file",
@@ -8581,13 +8581,13 @@
}, },
"potions.css": { "potions.css": {
"type": "file", "type": "file",
"size": 2540, "size": 2886,
"sha256": "efc36a84f98a01e9734b54969bb47774c7bc37f47d678b7e3066e19b4f67a81b" "sha256": "4a682e41cc7d69361bb7bd1a0a61fb2a90b8a63c0e1006e4ed1e87d1434d3461"
}, },
"potions.js": { "potions.js": {
"type": "file", "type": "file",
"size": 6283, "size": 8429,
"sha256": "863f606776412b036f386ec691253ef17c608bae11c5cdbc1805de9898ff089e" "sha256": "08b6be3bdd26553dbe25d8f409f51d02eb09023037132856cb2201b6143705cd"
}, },
"relic-icon.js": { "relic-icon.js": {
"type": "file", "type": "file",
+1 -1
View File
@@ -1,5 +1,5 @@
{ {
"version": "2.0.2.3-rc.9", "version": "2.0.2.3-rc.10",
"module_id": "mengsan", "module_id": "mengsan",
"snapshot": "legacy", "snapshot": "legacy",
"files": [ "files": [
+25
View File
@@ -0,0 +1,25 @@
# 梦三战斗 UI 回归清单
每次 review 核验下表各项。在报告中逐项写明通过、失败或未验,并记录证据对应的代码版本、皮肤、尺寸和缩放。涉及战斗 UI 的改动,附受影响场景的渲染截图。
| 场景 | 操作与通过标准 |
| --- | --- |
| 触屏拖牌与目标连线 | 从手牌拖出一张【杀】并移动到可选敌人。线起点贴在拖动牌上缘中央,终点跟随触点,两端误差各不超过 2 CSS px。取消手势后线立即消失。对合法目标松手后拖线立即消失,原生提交只触发一次。完整对局中再检查提交后的出牌特效能指向实际目标。 |
| 出牌响应布局与按钮交互 | 敌人出【杀】,选择【闪】,观察场上出牌副本、响应文字与「确定/取消」两键的整体边界。三者从上到下共用战场中线,横向中心误差不超过 2 CSS px,牌面、提示、按钮和选中手牌之间有可见间距。确认和取消分别可点击,响应结束后场上的牌恢复原生位置。 |
| 弃牌时技能栏稳定 | 启用十周年 UI,进入需弃置两张手牌的场景并点选第一张。技能栏在重建的首帧起就不出现重复的药水按钮,普通技能仍可见,弃牌计数正常更新。 |
| 战斗药水槽与计数信息 | 持有药水进入战斗。药水槽位于左上区域,可贴近轮数、时间及牌堆数量控件,各自的可见区域互不重叠。点按药水可打开详情,并能在可用阶段正常使用。 |
## 浏览器回归
从无名游戏目录内的术樱包根目录执行。脚本使用本地引擎、十周年 UI 样式、Playwright 和 Microsoft Edge。Playwright 安装在其他目录时,可将 `CODEX_NODE_MODULES` 指向包含它的 `node_modules`。
```powershell
$env:HUD_REVIEW = '1'
node mengsan/tools/test-battle-hud.cjs
```
需要截图时,将 `HUD_ARTIFACTS` 指向已建立的临时目录。完整矩阵覆盖原生 UI、十周年 UI 的手杀、十周年和新杀风格,以及 1080×486、812×375、667×375,含 0.64 页面缩放和非整数像素比。各场景检查拖牌、出牌连线、响应和药水槽位置,启用十周年 UI 的场景另测弃牌时的技能栏重建。
## Android 实机复核
在本轮改动对应的 Android 客户端启用十周年 UI,使用该客户端当前启用的皮肤复核各场景,并记录十周年 UI 版本和皮肤。拖牌时分别观察松手前的拖线和松手后的出牌特效。响应用两次事件分别检查确认和取消。弃牌时观察点牌瞬间,检查原生计数面板与药水槽能同时看清并各自操作。实机结果单独记录,实机不可用时写明未验。
@@ -38,9 +38,9 @@
**接口** `build_archives(root: Path, output: Path, tag: str) -> list[Path]` 使用 `root/dist/modules/mengsan.json`,生成 `mengsan-<tag>-part-001.zip` 等附件。条目名为 `mengsan/…`,与模块清单路径逐字一致。 **接口** `build_archives(root: Path, output: Path, tag: str) -> list[Path]` 使用 `root/dist/modules/mengsan.json`,生成 `mengsan-<tag>-part-001.zip` 等附件。条目名为 `mengsan/…`,与模块清单路径逐字一致。
- [ ] 在 `tools/test_mengsan_archives.py` 写 `test_parts_cover_packable_files_once` 和 `test_reject_inconsistent_release`。用临时目录验证 `Counter(written_paths) == Counter(packable_paths)`、条目 SHA-256 与清单一致、超出 5 MiB 的单文件不入包。对清单版本不匹配、源文件变化和单个分包成品超过 6 MiB 分别断言生成失败。 - [ ] 在 `tools/test_mengsan_archives.py` 写 `test_parts_cover_packable_files_once` 和 `test_reject_inconsistent_release`。用临时目录验证 `Counter(written_paths) == Counter(packable_paths)`、条目 SHA-256 与清单一致、超出 10 MiB 的单文件不入包。对清单版本不匹配、源文件变化和单个分包成品超过 11 MiB 分别断言生成失败。
- [ ] 运行 `python -m unittest discover -s tools -p test_mengsan_archives.py`,确认因生成器尚缺而失败。 - [ ] 运行 `python -m unittest discover -s tools -p test_mengsan_archives.py`,确认因生成器尚缺而失败。
- [ ] 实现生成器及 CLI `python tools/build_mengsan_archives.py --root <snapshot> --out-dir <output> --tag <tag>`。按清单路径排序,依次填入每包合计最多 5 MiB 的未压缩文件。使用 `ZIP_DEFLATED`、压缩级别 6。关闭 ZIP 后检查成品不超过 6 MiB,逐项校验路径、大小和 SHA-256,并检查各包合计覆盖所有可打包条目。两个上限是实测起点,调整时同步客户端和测试。 - [ ] 实现生成器及 CLI `python tools/build_mengsan_archives.py --root <snapshot> --out-dir <output> --tag <tag>`。按清单路径排序,依次填入每包合计最多 10 MiB 的未压缩文件。使用 `ZIP_DEFLATED`、压缩级别 6。关闭 ZIP 后检查成品不超过 11 MiB,逐项校验路径、大小和 SHA-256,并检查各包合计覆盖所有可打包条目。调整上限时同步客户端和测试。
- [ ] 重跑 Python 测试并确认通过。以当前分支生成的清单和导出快照运行 CLI,检查实际分包数、最大包大小和完整覆盖。使用发布工作流同样的标签快照校验命令 `python tools/verify_manifest.py --root <snapshot> --version <version>`。 - [ ] 重跑 Python 测试并确认通过。以当前分支生成的清单和导出快照运行 CLI,检查实际分包数、最大包大小和完整覆盖。使用发布工作流同样的标签快照校验命令 `python tools/verify_manifest.py --root <snapshot> --version <version>`。
## 任务二 · 接入两个发布工作流 ## 任务二 · 接入两个发布工作流
@@ -57,14 +57,14 @@
- [ ] 在 `tools/test_mengsan_zip_install.mjs` 用 `node:test` 从正常菜单入口 `manageMengsanModule` 触发安装。`fresh install stages from selected release` 对两个源分别断言附件查询标签正确、成功分包文件无 raw 请求、所有文件备齐前无正式路径写入。`falls back for missing or unusable release parts` 覆盖 Release 404、草稿、标签不匹配、超限响应、损坏 ZIP、越界条目和错误 SHA-256,断言 `rawRequests` 恰好等于未成功暂存文件。`retries the failed ZIP once` 覆盖单包下载异常后成功。`staging write errors preserve recovery` 断言写入失败后无后续 raw 请求。`installed updates and legacy repairs stay on raw` 从 `checkVersion`、`repairMissingFiles` 和旧修复记录分别验证无 Release 请求。至少一个解析用例使用宿主实际捆绑的 JSZip 2.7 和脚本生成的 ZIP。 - [ ] 在 `tools/test_mengsan_zip_install.mjs` 用 `node:test` 从正常菜单入口 `manageMengsanModule` 触发安装。`fresh install stages from selected release` 对两个源分别断言附件查询标签正确、成功分包文件无 raw 请求、所有文件备齐前无正式路径写入。`falls back for missing or unusable release parts` 覆盖 Release 404、草稿、标签不匹配、超限响应、损坏 ZIP、越界条目和错误 SHA-256,断言 `rawRequests` 恰好等于未成功暂存文件。`retries the failed ZIP once` 覆盖单包下载异常后成功。`staging write errors preserve recovery` 断言写入失败后无后续 raw 请求。`installed updates and legacy repairs stay on raw` 从 `checkVersion`、`repairMissingFiles` 和旧修复记录分别验证无 Release 请求。至少一个解析用例使用宿主实际捆绑的 JSZip 2.7 和脚本生成的 ZIP。
- [ ] 运行 `node --experimental-vm-modules --test tools/test_mengsan_zip_install.mjs` 并确认新增 ZIP 场景因当前只请求 raw 文件而失败。可通过 `vm.SourceTextModule` 和测试用 `SyntheticModule` 为 `../../noname.js` 注入宿主 API,无需从产品代码导出测试接口。 - [ ] 运行 `node --experimental-vm-modules --test tools/test_mengsan_zip_install.mjs` 并确认新增 ZIP 场景因当前只请求 raw 文件而失败。可通过 `vm.SourceTextModule` 和测试用 `SyntheticModule` 为 `../../noname.js` 注入宿主 API,无需从产品代码导出测试接口。
- [ ] 在 `update.js` 实现附件查询和下载。两源均请求所选 `<repoApi>/releases/tags/<tag>`,要求 `tag_name` 匹配且 `draft` 为 `false`。仅接收与版本文件名匹配、`size` 为正整数且不超过 6 MiB 的附件。使用该源的 HTTPS `browser_download_url`。GitHub 现有附件链接与 CDN 实测缺少浏览器跨域响应头,因此 Electron 使用支持 HTTPS 重定向的原生请求,Cordova 使用 `FileTransfer` 下载到本次操作目录,校验文件大小后读取并清理。网页 Fetch 用尽该附件的网络重试后回退同源逐文件下载。 - [ ] 在 `update.js` 实现附件查询和下载。两源均请求所选 `<repoApi>/releases/tags/<tag>`,要求 `tag_name` 匹配且 `draft` 为 `false`。仅接收与版本文件名匹配、`size` 为正整数且不超过 11 MiB 的附件。使用该源的 HTTPS `browser_download_url`。GitHub 现有附件链接与 CDN 实测缺少浏览器跨域响应头,因此 Electron 使用支持 HTTPS 重定向的原生请求,Cordova 使用 `FileTransfer` 下载到本次操作目录,校验文件大小后读取并清理。网页 Fetch 用尽该附件的网络重试后回退同源逐文件下载。
- [ ] 使用 `get.zip` 获取 JSZip,逐包调用 `load` 读取目录和压缩字节。解包前检查文件名、清单归属、单条目声明大小和包内合计上限。用 `DecompressionStream("deflate-raw")` 解压到按清单大小分配的缓冲区并限制实际输出,随后调用 `verifyFile` 和 `stageVerified`。缺少流式解压能力的客户端直接逐文件下载。异常 ZIP 至多重新取一次再回退。校验、网络和解包错误记录包名及原因。写盘错误从暂存阶段直接抛出。 - [ ] 使用 `get.zip` 获取 JSZip,逐包调用 `load` 读取目录和压缩字节。解包前检查文件名、清单归属、单条目声明大小和包内合计上限。用 `DecompressionStream("deflate-raw")` 解压到按清单大小分配的缓冲区并限制实际输出,随后调用 `verifyFile` 和 `stageVerified`。缺少流式解压能力的客户端直接逐文件下载。异常 ZIP 至多重新取一次再回退。校验、网络和解包错误记录包名及原因。写盘错误从暂存阶段直接抛出。
- [ ] 在 `manageMengsanModule` 判定首次安装。无既有安装,或已明确清空的卸载记录进入全新安装;旧待修复记录按原路径。操作记录只在已知首次安装进入 `installing` 时标记 `freshInstall: true`,失败后该标记用于重新发起完整下载。通过 `installMengsanFiles` 把这个选择传给 `updateAllFiles` 的暂存阶段;本次已完成的文件更新原进度和清理集合,原文件池仅处理剩余项。将 ZIP 网络进度与已验证文件字节分开,避免回退时重复计数。保留现有正式路径落盘前复核及安装记录提交逻辑。 - [ ] 在 `manageMengsanModule` 判定首次安装。无既有安装,或已明确清空的卸载记录进入全新安装;旧待修复记录按原路径。操作记录只在已知首次安装进入 `installing` 时标记 `freshInstall: true`,失败后该标记用于重新发起完整下载。通过 `installMengsanFiles` 把这个选择传给 `updateAllFiles` 的暂存阶段;本次已完成的文件更新原进度和清理集合,原文件池仅处理剩余项。将 ZIP 网络进度与已验证文件字节分开,避免回退时重复计数。保留现有正式路径落盘前复核及安装记录提交逻辑。
- [ ] 运行 `node --check update.js` 和 Node 测试,确认通过。分别用清单对比正常 ZIP 和逐文件回退的最终目录及安装记录,确认每个新文件大小和 SHA-256 一致。 - [ ] 运行 `node --check update.js` 和 Node 测试,确认通过。分别用清单对比正常 ZIP 和逐文件回退的最终目录及安装记录,确认每个新文件大小和 SHA-256 一致。
## 任务四 · 实机验收和默认启用 ## 任务四 · 实机验收和默认启用
- [ ] 在同一台受支持手机上,用同一客户端版本、梦三标签、下载源和网络条件,对逐文件和分包的干净安装各测三次。每次从确认安装计时到校验完成。通过网络记录统计资源请求数,从应用及其 WebView 进程记录内存峰值,报告原始样本和中位数。先测 5 MiB 展开、6 MiB 下载上限,再按实测调整。 - [ ] 在同一台受支持手机上,用同一客户端版本、梦三标签、下载源和网络条件,对逐文件和分包的干净安装各测三次。每次从确认安装计时到校验完成。通过网络记录统计资源请求数,从应用及其 WebView 进程记录内存峰值,报告原始样本和中位数。先测 10 MiB 展开、11 MiB 下载上限,再按实测调整。
- [ ] 在客户端真实窗口验证 GitHub 与 Gitea Release 的匿名下载、重定向和跨域行为,并分别验证 ZIP 不可用时回退到当前源的同标签文件。测试手机端强制退出后再点击安装。通过安装记录、清单校验和重启后进入梦三确认结果。另跑桌面端首次安装及差量更新一次。 - [ ] 在客户端真实窗口验证 GitHub 与 Gitea Release 的匿名下载、重定向和跨域行为,并分别验证 ZIP 不可用时回退到当前源的同标签文件。测试手机端强制退出后再点击安装。通过安装记录、清单校验和重启后进入梦三确认结果。另跑桌面端首次安装及差量更新一次。
- [ ] 对照同环境逐文件基线检验收益。建议启用条件为手机端资源请求数和总耗时中位数下降,内存峰值无可重复的上升,两个源与回退均通过。记录采用的包大小、测试设备和结果,再启用默认 ZIP 路径。 - [ ] 对照同环境逐文件基线检验收益。建议启用条件为手机端资源请求数和总耗时中位数下降,内存峰值无可重复的上升,两个源与回退均通过。记录采用的包大小、测试设备和结果,再启用默认 ZIP 路径。
+1 -1
View File
@@ -6,7 +6,7 @@ import { configureDiagnostics } from "./diagnostics/index.js";
export const type = "extension"; export const type = "extension";
export let shuYing = new Object(); export let shuYing = new Object();
const shuYingLocalVersion = "2.0.2.3-rc.9"; const shuYingLocalVersion = "2.0.2.3-rc.10";
shuYing.name = "术樱包"; shuYing.name = "术樱包";
shuYing.editable = false; shuYing.editable = false;
+349 -9
View File
@@ -4,9 +4,11 @@ const http = require('node:http');
const fs = require('node:fs'); const fs = require('node:fs');
const path = require('node:path'); const path = require('node:path');
const app = path.resolve(__dirname, '../../../..'); const app = path.resolve(__dirname, '../../../..');
const packages = process.env.CODEX_NODE_MODULES || 'C:/Users/Diuse/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/node_modules'; const packages = process.env.CODEX_NODE_MODULES;
const { chromium } = require(path.join(packages, 'playwright')); const { chromium } = require(packages ? path.join(packages, 'playwright') : 'playwright');
const prefix = '/extension/' + encodeURIComponent('术樱包') + '/mengsan'; const prefix = '/extension/' + encodeURIComponent('术樱包') + '/mengsan';
const decadePrefix = '/extension/' + encodeURIComponent('十周年UI');
const reviewOnly = process.env.HUD_REVIEW === '1';
const holdStatus = async (page, locator, pointerType = 'mouse') => { const holdStatus = async (page, locator, pointerType = 'mouse') => {
const box = await locator.boundingBox(); const box = await locator.boundingBox();
const point = {x:box.x + box.width / 2,y:box.y + box.height / 2}; const point = {x:box.x + box.width / 2,y:box.y + box.height / 2};
@@ -31,10 +33,315 @@ const exposedTarget = (page,index) => page.evaluate(index => {
} }
throw new Error('Native target has no exposed drag point: '+index); throw new Error('Native target has no exposed drag point: '+index);
},index); },index);
async function checkMobileTargetLine(page, artifact) {
const touch = await page.context().newCDPSession(page);
const handCard = page.locator('.handcards>.card').first();
const target = await exposedTarget(page, 1);
const end = {x:target.x, y:target.y};
const aim = page.locator('.mengsan-hand-aim-shuying');
async function drag() {
const start = await handCard.boundingBox();
const source = {x:start.x + start.width / 2,y:start.y + start.height / 2};
await touch.send('Input.dispatchTouchEvent', {type:'touchStart',touchPoints:[source]});
await touch.send('Input.dispatchTouchEvent', {type:'touchMove',touchPoints:[end]});
await aim.waitFor({state:'visible',timeout:2500});
}
await drag();
const geometry = await aim.evaluate((overlay, pointer) => {
const card = window.card.getBoundingClientRect();
const origin = {x:card.left + card.width / 2, y:card.top};
const line = overlay.querySelector('line');
if (line) {
const matrix = line.getScreenCTM();
return {origin,pointer,from:new DOMPoint(line.x1.baseVal.value,line.y1.baseVal.value).matrixTransform(matrix).toJSON(),
to:new DOMPoint(line.x2.baseVal.value,line.y2.baseVal.value).matrixTransform(matrix).toJSON(),bounds:line.getBoundingClientRect().toJSON()};
}
const bounds = overlay.getBoundingClientRect();
const left = origin.x <= pointer.x, up = origin.y <= pointer.y;
return {origin,pointer,from:{x:left?bounds.left:bounds.right,y:up?bounds.top:bounds.bottom},
to:{x:left?bounds.right:bounds.left,y:up?bounds.bottom:bounds.top}};
},end);
if (artifact) await page.screenshot({path:artifact});
await touch.send('Input.dispatchTouchEvent', {type:'touchCancel',touchPoints:[]});
assert.equal(await aim.count(),0,'the target line disappears on touch cancellation');
assert.ok(Math.hypot(geometry.from.x-geometry.origin.x,geometry.from.y-geometry.origin.y)<=2,
'A012 target line starts at the selected card’s top center: '+JSON.stringify(geometry));
assert.ok(Math.hypot(geometry.to.x-end.x,geometry.to.y-end.y)<=2,
'A012 target line ends at the current touch: '+JSON.stringify(geometry));
assert.ok(geometry.bounds && Math.abs(geometry.bounds.bottom-geometry.origin.y)<=2 &&
Math.abs(geometry.bounds.top-end.y)<=2,'A012 the rendered line reaches both endpoint heights');
await page.waitForTimeout(180);
await drag();
const before = await page.evaluate(()=>game.isSubmitted());
await touch.send('Input.dispatchTouchEvent', {type:'touchEnd',touchPoints:[]});
assert.equal(await aim.count(),0,'the target line disappears on touch release');
assert.equal(await page.evaluate(()=>game.isSubmitted()),before+1,'touch release still submits the valid target once');
}
async function checkCommittedLine(page, skin) {
const geometry = await page.evaluate(async ({skin,decadePrefix}) => {
const engine = await import('/noname.js');
const {Player} = await import('/noname/library/element/player.js');
const {arena,me:hand} = window.ui;
const [actor,target] = window.game.players;
// Use the shipped line producers and renderer, with only the game lifecycle isolated.
engine.lib.config ??= {};
engine.setUI({arena,create:{div:() => {
const node = document.createElement('div');
node.className = 'linexy hidden';
node.show = () => node.classList.remove('hidden');
node.listenTransition = () => {};
return node;
}},refresh:node=>node.getBoundingClientRect()});
const get = engine.get;
engine.setGet({itemtype:()=> 'player',objtype:get.objtype.bind(get),xyDistance:get.xyDistance.bind(get)});
engine.setGame({me:actor,broadcast(){},addVideo(){},linexy:engine.Game.prototype.linexy});
actor.getLeft = target.getLeft = function() { return this.offsetLeft; };
actor.getTop = target.getTop = function() { return this.offsetTop; };
let line = Player.prototype.line;
if (skin !== 'native') {
const {playerLine} = await import(decadePrefix+'/src/overrides/player/animations.js');
const {BoundsCache} = await import(decadePrefix+'/src/utils/bounds.js');
window.decadeUI = {boundsCaches:{hand:new BoundsCache(hand)}};
actor.checkBoundsCache = target.checkBoundsCache = function() {
this.cacheLeft = this.offsetLeft;
this.cacheTop = this.offsetTop;
this.cacheWidth = this.offsetWidth;
this.cacheHeight = this.offsetHeight;
};
line = playerLine;
}
line.call(actor,target,{duration:120});
const effect = arena.querySelector('.linexy');
if (!effect) return null;
await new Promise(resolve=>setTimeout(resolve,150));
const matrix = new DOMMatrix(getComputedStyle(effect).transform);
const x1 = parseFloat(effect.style.left), y1 = parseFloat(effect.style.top);
const length = parseFloat(effect.style.height);
const expectedStart = skin === 'native'
? {x:actor.offsetLeft+actor.offsetWidth/2,y:actor.offsetTop+actor.offsetHeight/2}
: {x:arena.offsetWidth/2,y:hand.offsetTop};
const result = {x1,y1,x2:x1+matrix.c*length,y2:y1+matrix.d*length,expectedStart,
expectedEnd:{x:target.offsetLeft+target.offsetWidth/2,y:target.offsetTop+target.offsetHeight/2}};
effect.remove();
return result;
},{skin,decadePrefix});
assert.ok(geometry && Math.hypot(geometry.x1-geometry.expectedStart.x,geometry.y1-geometry.expectedStart.y)<=2 &&
Math.hypot(geometry.x2-geometry.expectedEnd.x,geometry.y2-geometry.expectedEnd.y)<=2,
'A012 the committed card effect retains its native origin and reaches the target: '+JSON.stringify(geometry));
}
async function checkBattlePotionSlots(page, skin, artifact) {
await page.evaluate(async ({prefix,skin}) => {
const {mountPotionSlots} = await import(prefix+'/ui/potions.js');
const {ui,battle,hud} = window;
const counter = document.createElement('div');
counter.className = 'cardRoundNumber';
counter.innerHTML = '<div class="cardPileNumber"><span>23</span></div><div class="roundNumber">第3轮</div><div class="time">03:00</div>';
if (skin === 'native') counter.style.cssText = 'left:18px;top:4px;width:140px;height:40px';
(skin === 'shousha' ? document.body : ui.arena).append(counter);
ui.cardRoundTime = counter;
window.reviewCounter = counter;
window.potionActionCalls = 0;
battle.potionUI = mountPotionSlots(ui.arena,{potions:['ENERGY_POTION',null,'FIRE_POTION']},{
canUse:()=>true,use:()=>{ window.potionActionCalls++; },
});
hud.refresh();
},{prefix,skin});
const geometry = await page.evaluate(() => {
const box = node => node.getBoundingClientRect().toJSON();
return {arena:box(ui.arena),strip:box(document.querySelector('.mengsan-battle-potions')),
counters:[reviewCounter,...reviewCounter.querySelectorAll('div,span')].map(box)};
});
const {arena,strip,counters} = geometry;
assert.ok(strip.left>=arena.left && strip.right<=arena.left+arena.width/2 && strip.top>=arena.top &&
strip.bottom<=arena.top+140,'battle potions stay at the upper left: '+JSON.stringify(geometry));
assert.ok(counters.every(box=>!box.width||!box.height||strip.right<=box.left||strip.left>=box.right||
strip.bottom<=box.top||strip.top>=box.bottom),'battle potion slots clear the round, time and pile counters');
if (artifact) await page.screenshot({path:artifact});
await page.getByRole('button',{name:'能量药水',exact:true}).tap();
await page.getByRole('button',{name:'使用',exact:true}).tap();
assert.equal(await page.evaluate(()=>potionActionCalls),1,'the relocated potion button opens details and submits once');
const fallback = await page.evaluate(() => {
reviewCounter.className = '';
reviewCounter.replaceChildren();
reviewCounter.style.cssText = 'position:absolute;left:0;top:0;width:46%;height:46px;transition:none';
hud.refresh();
const panel = reviewCounter.getBoundingClientRect(), arena = ui.arena.getBoundingClientRect();
const slots = ui.arena.querySelector('.mengsan-battle-potions').getBoundingClientRect();
return slots.top>panel.bottom && slots.left>=arena.left && slots.right<=arena.left+arena.width/2;
});
assert.ok(fallback,'the potion strip drops below a counter that leaves no room beside it');
await page.evaluate(()=>{battle.potionUI.dispose();delete battle.potionUI;reviewCounter.remove();delete ui.cardRoundTime;});
}
async function checkPotionSkillsDuringDiscard(page, skin, artifact) {
const [factory,filename] = {shousha:['createShoushaSkillPlugin','shousha'],
shizhounian:['createShizhounianSkillPlugin','shizhounian'],xinsha:['createXinshaSkillPlugin','xinsha']}[skin];
await page.evaluate(async ({prefix,decadePrefix,filename,factory}) => {
const [engine,{Click},{Check},skinModule,{createBaseLbtnPlugin},potions] = await Promise.all([
import('/noname.js'),import('/noname/ui/click/index.js'),import('/noname/game/check.js'),
import(decadePrefix+`/ui/skill/skins/${filename}.js`),import(decadePrefix+'/ui/lbtn/skins/base.js'),import(prefix+'/potions/battle.js'),
]);
const {ui,game,card,hud,hudEventState:status} = window;
const me = game.me;
const passive = 'mengsan_taoyuan_bond_shuying';
const names = {...potions.potionSkillTranslations,[passive]:'桃园羁绊'};
const skill = {...potions.createPotionSkills(()=>null,game),[passive]:{locked:true,mark:true}};
const config = {touchscreen:true,phonelayout:true,extension_十周年UI_rightLayout:'on'};
const lib = {config,skill};
const get = {info:id=>skill[id],translation:id=>names[id]||id,
is:{locked:id=>id===passive,zhuanhuanji:()=>false,phoneLayout:()=>true}};
const app = {listen(){},reWriteFunction(){},get:{skillInfo(id) {
return {id,name:id,info:skill[id],translation:names[id],type:skill[id].enable?'enable':'trigger'};
}}};
Array.prototype.addArray ??= function(items){for(const item of items)if(!this.includes(item))this.push(item);return this;};
Array.prototype.add ??= function(item){if(!this.includes(item))this.push(item);return this;};
Array.prototype.remove ??= function(item){const i=this.indexOf(item);if(i!==-1)this.splice(i,1);return this;};
ui.controls = [ui.control.firstElementChild];
ui.updatec = ()=>{};
ui.create = {div(selector,parent,label) {
const node = document.createElement('div');
if(selector) node.className = selector.split('.').filter(Boolean).join(' ');
if(label) node.textContent=label;
parent?.appendChild(node);
return node;
},control:()=>ui.control.firstElementChild};
engine.lib.config = config;
engine.lib.device = 'android';
engine.setUI(ui);engine.setGame(game);engine.setGet(get);engine.setStatus(status);
Object.assign(status.event,{name:'chooseToDiscard',selectCard:[2,2],position:'h'});
delete status.event.respondTo;
window.reviewResponse.card.remove();
ui.thrown = [];
const prompt = window.reviewResponse.prompt;
const count = document.createElement('span');
count.textContent = '0/2';
prompt.replaceChildren('请弃置两张手牌',document.createElement('br'),count);
status.event.custom = {add:{card() {count.textContent = `${ui.selected.cards.length}/2`;}}};
Object.assign(me,{getSkills:type=>type==='e'?[]:Object.keys(skill),invisibleSkills:[],awakenedSkills:[],
getStorage:(key,fallback=[])=>me.storage[key]??fallback,isTempBanned:()=>false});
Object.assign(game,{expandSkills:skills=>skills,addVideo(){},countChoose(){},check:()=>Check.prototype.confirm(status.event,'')});
const plugin = skinModule[factory](lib,game,ui,get,{},status,app);
if (filename === 'xinsha') {
plugin.initCreateFunctions();
plugin.initUpdateFunctions();
} else {
plugin._extendUICreate();
plugin._extendUI();
}
plugin.updateSkillMarks=()=>{};
createBaseLbtnPlugin(lib,game,ui,get,{},status,app).initConfirmRewrite();
ui.confirm = null;
ui.create.confirm('');
card.classList.remove('selected');
card.updateTransform=()=>{};
card.addEventListener('touchend',()=>{
status.clicked=false;
Click.prototype.card.call(card);
});
hud.refresh();
const visiblePotionButtons = () => [...ui.skillControl.querySelectorAll('[data-id]')].filter(node=>
node.getClientRects().length && potions.potionSkillIds.includes(node.dataset.id)).map(node=>node.dataset.id);
window.discardSkillCheck = {frames:[],visiblePotionButtons,passive,
initialPotionButton:ui.skillControl.querySelector(`[data-id="${potions.potionSkillIds[0]}"]`)};
const capture = event => {
if (event.target.closest('.card')!==card) return;
// Listen after the real card handler, before any scheduled HUD refresh.
discardSkillCheck.frames.push(visiblePotionButtons());
requestAnimationFrame(()=>discardSkillCheck.frames.push(visiblePotionButtons()));
};
window.addEventListener('touchend',capture,{once:true});
},{prefix,decadePrefix,factory,filename});
await page.locator('.handcards>.card').first().tap();
const result = await page.evaluate(async () => {
await new Promise(resolve=>requestAnimationFrame(()=>requestAnimationFrame(resolve)));
const {frames,passive,initialPotionButton,visiblePotionButtons} = discardSkillCheck;
return {frames,visible:visiblePotionButtons(),rebuilt:initialPotionButton && !initialPotionButton.isConnected,
selected:ui.selected.cards.length,count:ui.dialog.textContent,passiveVisible:Boolean(ui.skillControl.querySelector(`[data-id="${passive}"]`)?.getClientRects().length)};
});
if (artifact) await page.screenshot({path:artifact});
assert.equal(result.rebuilt,true,'ten-year UI rebuilt the skill row on tap');
assert.ok(result.selected===1 && result.count.endsWith('1/2'),'the original touch selects one discard card and updates the count');
assert.ok(result.passiveVisible,'normal skills remain visible');
assert.equal(result.frames.length,2,'both touch and first animation frame were sampled');
assert.deepEqual([...result.frames.flat(),...result.visible],[],'potion skill duplicates are hidden from the first frame');
}
async function checkMobileResponseLayout(page, skin, artifact) {
await page.evaluate(({skin,decadePrefix}) => {
const {arena,control} = ui;
const card = document.createElement('div');
const scale = Math.min(arena.clientHeight * .18 / 156,1);
card.className = 'card thrown';
card.style.cssText = `left:calc(50% - 56px);top:calc(50% - 78px);width:112px;height:156px;transform:scale(${scale});`;
card.style.background = `center/100% 100% url("${decadePrefix}/image/card-skins/decade/sha.png")`;
arena.appendChild(card);
ui.thrown = [card];
const prompt = document.createElement('div');
prompt.className = skin === 'native' ? 'dialog' : 'hand-tip';
prompt.innerHTML = skin === 'native'
? '<div class="content-container"><div class="content"><div class="caption">请使用一张闪响应杀</div></div></div>'
: '<span>请使用一张闪响应杀</span>';
arena.appendChild(prompt);
ui.dialog = prompt;
const event = hudEventState.event;
event.name = 'chooseToUse';
event.respondTo = [game.players[1],{name:'sha'}];
event.dialog = prompt;
window.reviewResponses = [];
const confirm = control.firstElementChild;
confirm.classList.remove('stayleft');
ui.confirm = confirm;
if (skin !== 'native') confirm.classList.add('combo-control','lbtn-confirm');
const [ok,cancel] = confirm.children;
confirm.node = {ok,cancel};
[ok,cancel].forEach((node,index) => {
node.dataset.response = index ? 'cancel' : 'ok';
if (skin !== 'native') node.classList.add('control');
if (skin === 'shousha') {
(node.firstElementChild || node).textContent = '';
if (index) node.innerHTML = '<img src="/extension/十周年UI/ui/assets/lbtn/uibutton/QX.png" alt="取消">';
} else (node.firstElementChild || node).textContent = index ? '取消' : '确定';
node.addEventListener('click',()=>reviewResponses.push(node.dataset.response));
});
window.reviewResponse = {card,prompt};
window.card.classList.add('selected');
window.card.style.backgroundImage = `url("${decadePrefix}/image/card-skins/decade/shan.png")`;
window.card.textContent = '';
hud.refresh();
},{skin,decadePrefix});
await page.waitForTimeout(550);
const geometry = await page.evaluate(() => {
const box = node => node.getBoundingClientRect().toJSON();
return {arena:box(ui.arena), card:box(reviewResponse.card), prompt:box(reviewResponse.prompt),
ok:box(document.querySelector('[data-response="ok"]')),cancel:box(document.querySelector('[data-response="cancel"]')),
hand:box(card)};
});
if (artifact) await page.screenshot({path:artifact});
const {arena, card, prompt, ok, cancel, hand} = geometry;
const center = ({left,right}) => (left + right) / 2;
assert.ok([card,prompt,{left:ok.left,right:cancel.right}].every(box=>Math.abs(center(box)-center(arena))<=2),
'A013 played card, response prompt and action group share the arena center: '+JSON.stringify(geometry));
const gap = 4;
assert.ok(card.top >= arena.top+2 && card.bottom+gap <= prompt.top && prompt.bottom+gap <= Math.min(ok.top,cancel.top) &&
Math.max(ok.bottom,cancel.bottom)+gap <= hand.top && ok.right <= cancel.left,
'A013 played card, prompt, actions and selected hand card do not overlap: '+JSON.stringify(geometry));
await page.locator('[data-response="ok"]').tap();
await page.locator('[data-response="cancel"]').tap();
assert.deepEqual(await page.evaluate(()=>reviewResponses),['ok','cancel'],'both original response callbacks are reachable');
const restored = await page.evaluate(() => {
delete hudEventState.event.respondTo;
hud.refresh();
return ui.control.style.translate === '' && reviewResponse.card.style.translate === '';
});
assert.ok(restored,'response spacing is released when the original event ends');
}
const fixture = `<!doctype html><meta charset="utf-8"><link rel="stylesheet" href="/layout/default/layout.css"><div id="window"><div id="arena"><div id="mebg"></div><div id="me" class="mengsan-hand-root-shuying"><div id="handcards1" class="mengsan-hand-scroll-shuying"><div class="handcards mengsan-hand-zone-shuying mengsan-hand-layout-shuying"></div></div><div id="handcards2"><div class="handcards"></div></div></div><div id="control"><div class="control"><div>测试技能</div><div>结束出牌</div></div></div></div></div><style>html,body,#window{margin:0;width:100%;height:100%;position:absolute}#arena{inset:0;width:100%;height:100%;position:absolute}#arena>.player{position:absolute;width:100px;height:130px;background:#345;color:#fff}#arena>.player .avatar{height:100%;width:100%;background:linear-gradient(#334f4b,#172d29)}#arena>.player .name{position:absolute;top:4px;left:4px}#me{position:absolute;bottom:0;width:100%;height:160px}#handcards1,#handcards2{position:absolute;width:100%;height:100%}.handcards{height:100%}.card{background:#e8d7b2;color:#263b35;position:absolute}.mengsan-intent-shuying{position:absolute}</style>`; const fixture = `<!doctype html><meta charset="utf-8"><link rel="stylesheet" href="/layout/default/layout.css"><div id="window"><div id="arena"><div id="mebg"></div><div id="me" class="mengsan-hand-root-shuying"><div id="handcards1" class="mengsan-hand-scroll-shuying"><div class="handcards mengsan-hand-zone-shuying mengsan-hand-layout-shuying"></div></div><div id="handcards2"><div class="handcards"></div></div></div><div id="control"><div class="control"><div>测试技能</div><div>结束出牌</div></div></div></div></div><style>html,body,#window{margin:0;width:100%;height:100%;position:absolute}#arena{inset:0;width:100%;height:100%;position:absolute}#arena>.player{position:absolute;width:100px;height:130px;background:#345;color:#fff}#arena>.player .avatar{height:100%;width:100%;background:linear-gradient(#334f4b,#172d29)}#arena>.player .name{position:absolute;top:4px;left:4px}#me{position:absolute;bottom:0;width:100%;height:160px}#handcards1,#handcards2{position:absolute;width:100%;height:100%}.handcards{height:100%}.card{background:#e8d7b2;color:#263b35;position:absolute}.mengsan-intent-shuying{position:absolute}</style>`;
const importMap = reviewOnly ? fs.readFileSync(path.join(app,'index.html'),'utf8').match(/<script type="importmap">.*?<\/script>/s)[0] : '';
const server = http.createServer((req, res) => { const server = http.createServer((req, res) => {
if (req.url === '/fixture') { res.setHeader('Content-Type','text/html;charset=utf-8');res.end(fixture);return; } if (req.url === '/fixture') { res.setHeader('Content-Type','text/html;charset=utf-8');res.end(fixture.replace('<meta charset="utf-8">','<meta charset="utf-8">'+importMap));return; }
if(req.url==='/noname.js'){res.setHeader('Content-Type','text/javascript');res.end('export const _status={};');return;} if(!reviewOnly && req.url==='/noname.js'){res.setHeader('Content-Type','text/javascript');res.end('export const _status={};');return;}
if(decodeURIComponent(new URL(req.url,'http://localhost').pathname)==='/extension/术樱包/diagnostics/index.js') { if(decodeURIComponent(new URL(req.url,'http://localhost').pathname)==='/extension/术樱包/diagnostics/index.js') {
res.setHeader('Content-Type','text/javascript');res.end('export const getDiagnostics=()=>({status:()=>({enabled:false}),scope:()=>({info(){},error(){}})});');return; res.setHeader('Content-Type','text/javascript');res.end('export const getDiagnostics=()=>({status:()=>({enabled:false}),scope:()=>({info(){},error(){}})});');return;
} }
@@ -48,20 +355,27 @@ const server = http.createServer((req, res) => {
const origin = 'http://127.0.0.1:' + server.address().port; const origin = 'http://127.0.0.1:' + server.address().port;
const browser = await chromium.launch({channel:'msedge',headless:true}); const browser = await chromium.launch({channel:'msedge',headless:true});
let checks = 0; let checks = 0;
const reviewFailures = [];
const viewports = reviewOnly ? [{width:1080,height:486},{width:812,height:375},{width:667,height:375}]
: [{width:1280,height:720},{width:1234,height:920},{width:812,height:600},{width:812,height:375},{width:667,height:375},{width:375,height:500},{width:540,height:900}];
try { try {
for (const skin of process.env.HUD_TEST_SKIN?[process.env.HUD_TEST_SKIN]:['native','shousha','shizhounian','xinsha']) { for (const skin of process.env.HUD_TEST_SKIN?[process.env.HUD_TEST_SKIN]:['native','shousha','shizhounian','xinsha']) {
for (const viewport of [{width:1280,height:720},{width:1234,height:920},{width:812,height:600},{width:812,height:375},{width:667,height:375},{width:375,height:500},{width:540,height:900}]) { for (const viewport of viewports) {
const page = await browser.newPage({viewport,hasTouch:true}); const page = await browser.newPage({viewport,hasTouch:true,deviceScaleFactor:reviewOnly?2.625:1});
await page.goto(origin+'/fixture'); await page.goto(origin+'/fixture');
if (reviewOnly && viewport.width===1080) {
await page.addStyleTag({content:'body{zoom:.64;width:156.25%;height:156.25%}'});
}
await page.addStyleTag({content:'body{background:#161e29 url("/image/background/lanting_bg.jpg") center/cover no-repeat}'}); await page.addStyleTag({content:'body{background:#161e29 url("/image/background/lanting_bg.jpg") center/cover no-repeat}'});
await page.addStyleTag({url:origin+prefix+'/ui/style.css'}); await page.addStyleTag({url:origin+prefix+'/ui/style.css'});
if(reviewOnly) await page.addStyleTag({url:origin+prefix+'/ui/potions.css'});
if(skin!=='native') { if(skin!=='native') {
for(const css of ['/extension/'+encodeURIComponent('十周年UI')+'/src/styles/layout.css','/extension/'+encodeURIComponent('十周年UI')+'/ui/styles/base.css','/extension/'+encodeURIComponent('十周年UI')+'/ui/styles/skill/'+skin+'.css','/extension/'+encodeURIComponent('十周年UI')+'/ui/styles/lbtn/'+skin+'.css'])await page.addStyleTag({url:origin+css}); for(const css of ['/extension/'+encodeURIComponent('十周年UI')+'/src/styles/layout.css','/extension/'+encodeURIComponent('十周年UI')+'/ui/styles/base.css','/extension/'+encodeURIComponent('十周年UI')+'/ui/styles/skill/'+skin+'.css','/extension/'+encodeURIComponent('十周年UI')+'/ui/styles/lbtn/'+skin+'.css'])await page.addStyleTag({url:origin+css});
await page.addStyleTag({url:origin+'/extension/'+encodeURIComponent('十周年UI')+'/src/styles/player'+({shousha:2,shizhounian:1,xinsha:3}[skin])+'.css'}); await page.addStyleTag({url:origin+'/extension/'+encodeURIComponent('十周年UI')+'/src/styles/player'+({shousha:2,shizhounian:1,xinsha:3}[skin])+'.css'});
await page.addStyleTag({url:origin+'/extension/'+encodeURIComponent('十周年UI')+'/src/styles/equip.css'}); await page.addStyleTag({url:origin+'/extension/'+encodeURIComponent('十周年UI')+'/src/styles/equip.css'});
} }
await page.addStyleTag({url:origin+prefix+'/ui/hand/style.css'}); await page.addStyleTag({url:origin+prefix+'/ui/hand/style.css'});
const initial = await page.evaluate(async ({prefix,skin}) => { const initial = await page.evaluate(async ({prefix,skin,reviewOnly,decadePrefix}) => {
const mod = await import(prefix+'/ui/hud/index.js').catch(error=>({error:String(error)})); const mod = await import(prefix+'/ui/hud/index.js').catch(error=>({error:String(error)}));
if(typeof mod.mountBattleHUD!=='function')return {module:false,error:mod.error}; if(typeof mod.mountBattleHUD!=='function')return {module:false,error:mod.error};
const releases=[];window.session={id:'hud-test',active:true,ownResource:(_,f)=>releases.push(f)}; const releases=[];window.session={id:'hud-test',active:true,ownResource:(_,f)=>releases.push(f)};
@@ -82,12 +396,16 @@ const server = http.createServer((req, res) => {
node.addEventListener('click',()=>{window.nativeActionClicks=(window.nativeActionClicks||0)+1;}); node.addEventListener('click',()=>{window.nativeActionClicks=(window.nativeActionClicks||0)+1;});
}); });
const players=[]; const players=[];
for(let i=0;i<8;i++) { for(let i=0;i<(reviewOnly?2:8);i++) {
const player=document.createElement('div');player.className='player';player.dataset.position=String(i);player.playerid=String(i);player.name=i?'enemy'+i:'liubei';player.hp=40;player.maxHp=60;player.hujia=8; const player=document.createElement('div');player.className='player';player.dataset.position=String(i);player.playerid=String(i);player.name=i?'enemy'+i:'liubei';player.hp=40;player.maxHp=60;player.hujia=8;
player.storage={mengsanCamp_shuying:i?'enemy':'ally',mengsanStrength_shuying:i===1?3:0,mengsanVulnerable_shuying:i===2?2:0,mengsanEnergy_shuying:3,mengsanMaxEnergy_shuying:3}; player.storage={mengsanCamp_shuying:i?'enemy':'ally',mengsanStrength_shuying:i===1?3:0,mengsanVulnerable_shuying:i===2?2:0,mengsanEnergy_shuying:3,mengsanMaxEnergy_shuying:3};
player.innerHTML=skin==='native' ? '<div class="avatar"></div><div class="name">'+(i?'敌人'+i:'刘备')+'</div><div class="hp">40/60</div><div class="marks"></div>' : '<div class="primary-avatar has-outcrop"><div class="action">回合开始</div></div><div class="framebg"></div><div class="identity">汉</div><div class="camp-wrap"><div class="camp-border"></div><div class="avatar-name">'+(i?'敌人'+i:'刘备')+'</div></div><div class="hp-wrap"><div class="hp">40/60</div></div><div class="card-count">8</div><div class="dui-marks"></div>'; player.innerHTML=skin==='native' ? '<div class="avatar"></div><div class="name">'+(i?'敌人'+i:'刘备')+'</div><div class="hp">40/60</div><div class="marks"></div>' : '<div class="primary-avatar has-outcrop"><div class="action">回合开始</div></div><div class="framebg"></div><div class="identity">汉</div><div class="camp-wrap"><div class="camp-border"></div><div class="avatar-name">'+(i?'敌人'+i:'刘备')+'</div></div><div class="hp-wrap"><div class="hp">40/60</div></div><div class="card-count">8</div><div class="dui-marks"></div>';
if(i)player.insertAdjacentHTML('beforeend','<div class="mengsan-intent-shuying">攻击 8×2</div>'); if(i)player.insertAdjacentHTML('beforeend','<div class="mengsan-intent-shuying">攻击 8×2</div>');
player.node={avatar:player.querySelector('.avatar,.primary-avatar'),hp:player.querySelector('.hp'),hpWrap:player.querySelector('.hp-wrap'),campWrap:player.querySelector('.camp-wrap'),name:player.querySelector('.name,.avatar-name'),identity:player.querySelector('.identity'),framebg:player.querySelector('.framebg'),count:player.querySelector('.card-count'),marks:player.querySelector('.marks,.dui-marks')}; player.node={avatar:player.querySelector('.avatar,.primary-avatar'),hp:player.querySelector('.hp'),hpWrap:player.querySelector('.hp-wrap'),campWrap:player.querySelector('.camp-wrap'),name:player.querySelector('.name,.avatar-name'),identity:player.querySelector('.identity'),framebg:player.querySelector('.framebg'),count:player.querySelector('.card-count'),marks:player.querySelector('.marks,.dui-marks')};
if (reviewOnly && i && window.innerWidth>=1000) {
player.style.cssText='left:50%!important;right:auto!important;top:12px!important;bottom:auto!important;transform:translateX(-50%)!important;';
}
if (reviewOnly && !i) player.node.avatar.style.backgroundImage=`url(${prefix}/assets/portraits/liubei-portrait.jpg)`;
player.node.avatar.style.backgroundImage='url("/image/character/'+(i?'caocao':'liubei')+'.jpg")'; player.node.avatar.style.backgroundImage='url("/image/character/'+(i?'caocao':'liubei')+'.jpg")';
if(i){player.style.cssText=`left:${(i-1)%4*21+5}%;top:${68+Math.floor((i-1)/4)*96}px;width:68px;height:82px;transform:none`;} if(i){player.style.cssText=`left:${(i-1)%4*21+5}%;top:${68+Math.floor((i-1)/4)*96}px;width:68px;height:82px;transform:none`;}
const equips=document.createElement('div');equips.className='equips';player.node.equips=equips;player.appendChild(equips); const equips=document.createElement('div');equips.className='equips';player.node.equips=equips;player.appendChild(equips);
@@ -119,6 +437,10 @@ const server = http.createServer((req, res) => {
me.node.handcards1=ui.handcards1Container.firstElementChild;me.node.handcards2=ui.handcards2Container.firstElementChild; me.node.handcards1=ui.handcards1Container.firstElementChild;me.node.handcards2=ui.handcards2Container.firstElementChild;
const get={translation:value=>value==='liubei'?'刘备':String(value).replace(/^enemy/,'敌人'),select:value=>value}; const get={translation:value=>value==='liubei'?'刘备':String(value).replace(/^enemy/,'敌人'),select:value=>value};
const card=document.createElement('div');card.className='card selectable';card.textContent='杀';card.name='sha';me.node.handcards1.appendChild(card);window.card=card; const card=document.createElement('div');card.className='card selectable';card.textContent='杀';card.name='sha';me.node.handcards1.appendChild(card);window.card=card;
if (reviewOnly) {
card.style.background=`center/100% 100% url("${decadePrefix}/image/card-skins/decade/sha.png")`;
card.textContent='';
}
card.addEventListener('contextmenu',event=>{ card.addEventListener('contextmenu',event=>{
event.preventDefault();window.introOpens=(window.introOpens||0)+1; event.preventDefault();window.introOpens=(window.introOpens||0)+1;
const tip=document.createElement('div');tip.className='dialog popped static'; const tip=document.createElement('div');tip.className='dialog popped static';
@@ -148,10 +470,27 @@ const server = http.createServer((req, res) => {
window.testHandUI=await mountHandUI(me,session,{ui,game,get,lib:{card:{},translate:{}},_status:hudEventState,document,window,isActiveCardUse:()=>true,canPayCard:()=>true,cardCost:()=>1,styleURL:prefix+'/ui/hand/style.css'}); window.testHandUI=await mountHandUI(me,session,{ui,game,get,lib:{card:{},translate:{}},_status:hudEventState,document,window,isActiveCardUse:()=>true,canPayCard:()=>true,cardCost:()=>1,styleURL:prefix+'/ui/hand/style.css'});
window.testInput={owns:()=>false};hud.refresh();window.testFan={sync:()=>testHandUI.refresh()}; window.testInput={owns:()=>false};hud.refresh();window.testFan={sync:()=>testHandUI.refresh()};
return {module:true,parentKept:hand.parentNode===oldParents.hand&&control.parentNode===oldParents.control&&card.parentNode===oldParents.card,skin}; return {module:true,parentKept:hand.parentNode===oldParents.hand&&control.parentNode===oldParents.control&&card.parentNode===oldParents.card,skin};
},{prefix,skin}); },{prefix,skin,reviewOnly,decadePrefix});
assert.equal(initial.module,true,initial.error||'HUD mount module must exist');checks++; assert.equal(initial.module,true,initial.error||'HUD mount module must exist');checks++;
assert.equal(initial.parentKept,true);checks++; assert.equal(initial.parentKept,true);checks++;
await page.waitForTimeout(70); await page.waitForTimeout(70);
if (reviewOnly) {
const scenario = `${skin}-${viewport.width}x${viewport.height}`;
const artifact = name => process.env.HUD_ARTIFACTS && path.join(process.env.HUD_ARTIFACTS,`${name}-${scenario}.png`);
try { await checkMobileTargetLine(page,artifact('A012')); await checkCommittedLine(page,skin); checks+=7; }
catch (error) { reviewFailures.push(`${scenario} ${error.message}`); }
try { await checkBattlePotionSlots(page,skin,artifact('battle-potion-slots')); checks+=4; }
catch (error) { reviewFailures.push(`${scenario} ${error.message}`); }
try { await checkMobileResponseLayout(page,skin,artifact('A013')); checks+=4; }
catch (error) { reviewFailures.push(`${scenario} ${error.message}`); }
if (skin!=='native') {
try { await checkPotionSkillsDuringDiscard(page,skin,artifact('discard-skill-controls')); checks+=5; }
catch (error) { reviewFailures.push(`${scenario} ${error.message}`); }
}
if (!reviewFailures.some(failure => failure.startsWith(`${scenario} `))) console.log(`${scenario} battle UI review passed`);
await page.close();
continue;
}
const releasedControls = await page.evaluate(() => { const releasedControls = await page.evaluate(() => {
const control = document.createElement('div'); const control = document.createElement('div');
control.className = 'control'; control.className = 'control';
@@ -444,6 +783,7 @@ const server = http.createServer((req, res) => {
await page.close(); await page.close();
} }
} }
if (reviewFailures.length) throw new Error(reviewFailures.join('\n'));
console.log('HUD browser checks: '+checks); console.log('HUD browser checks: '+checks);
} finally {await browser.close();await new Promise(resolve=>server.close(resolve));} } finally {await browser.close();await new Promise(resolve=>server.close(resolve));}
})().catch(error=>{console.error(error);server.close();process.exitCode=1;}); })().catch(error=>{console.error(error);server.close();process.exitCode=1;});
+20 -8
View File
@@ -79,22 +79,34 @@ export function createHandInput(player, session, adapter, fan, env, refresh, log
function removeAim() { aim?.remove(); aim = null; } function removeAim() { aim?.remove(); aim = null; }
function showAim(card, point) { function showAim(card, point) {
const rect = card.getBoundingClientRect(); const rect = card.getBoundingClientRect();
const x = rect.left + rect.width / 2, y = rect.top + Math.min(12, rect.height / 2); const x = rect.left + rect.width / 2, y = rect.top;
const dx = point.x - x, dy = point.y - y; if (!(rect.width > 0 && rect.height > 0 && Number.isFinite(point.x) && Number.isFinite(point.y))) {
const length = Math.hypot(dx, dy);
if (!(rect.width > 0 && rect.height > 0 && length > 0 && Number.isFinite(length))) {
removeAim(); removeAim();
return; return;
} }
if (!aim) { if (!aim) {
aim = document.createElement("div"); const svg = "http://www.w3.org/2000/svg";
aim = document.createElementNS(svg, "svg");
aim.classList.add("mengsan-hand-aim-shuying"); aim.classList.add("mengsan-hand-aim-shuying");
aim.setAttribute("aria-hidden", "true"); aim.setAttribute("aria-hidden", "true");
// 无名杀缩放 body,牌面矩形和指针事件都使用视口坐标。 aim.appendChild(document.createElementNS(svg, "line"));
document.documentElement.appendChild(aim); document.documentElement.appendChild(aim);
} }
aim.style.width = `${length}px`; // 牌面和触点在同一个视口坐标系,统一换算到绘制层的局部坐标。
aim.style.transform = `translate(${x}px, ${y}px) rotate(${Math.atan2(dy, dx)}rad) translateY(-50%)`; const matrix = aim.getScreenCTM();
const determinant = matrix && matrix.a * matrix.d - matrix.b * matrix.c;
if (!determinant || !Number.isFinite(determinant)) { removeAim(); return; }
const inverse = matrix.inverse();
const viewportPoint = aim.createSVGPoint();
viewportPoint.x = x; viewportPoint.y = y;
const from = viewportPoint.matrixTransform(inverse);
viewportPoint.x = point.x; viewportPoint.y = point.y;
const to = viewportPoint.matrixTransform(inverse);
const line = aim.firstElementChild;
line.setAttribute("x1", from.x);
line.setAttribute("y1", from.y);
line.setAttribute("x2", to.x);
line.setAttribute("y2", to.y);
} }
function clearSelection(state) { function clearSelection(state) {
if (!live(state) || !state.selected) return; if (!live(state) || !state.selected) return;
+10 -8
View File
@@ -78,16 +78,18 @@
} }
.mengsan-hand-aim-shuying { .mengsan-hand-aim-shuying {
position: fixed; position: fixed;
top: 0; inset: 0;
left: 0; width: 100%;
height: 2.6px; height: 100%;
z-index: 1000; z-index: 1000;
pointer-events: none; pointer-events: none;
transform-origin: 0 0; }
transition: none; .mengsan-hand-aim-shuying > line {
border-radius: 2px; stroke: rgb(250, 220, 140);
background: rgb(250, 220, 140); stroke-width: 2.6px;
box-shadow: 0 0 2px #f5d25b; stroke-linecap: round;
vector-effect: non-scaling-stroke;
filter: drop-shadow(0 0 2px #f5d25b);
} }
/* 只在梦三手牌挂载期间隐藏十周年阶段、等待响应和对方思考图片。 */ /* 只在梦三手牌挂载期间隐藏十周年阶段、等待响应和对方思考图片。 */
body.mengsan-hand-ui-shuying [style*="extension/十周年UI/ui/assets/lbtn/tips/"]:is( body.mengsan-hand-ui-shuying [style*="extension/十周年UI/ui/assets/lbtn/tips/"]:is(
+10 -6
View File
@@ -312,7 +312,7 @@ export function mountBattleHUD(player, battle, env) {
right:`${(h.right - a.right + (layout === 'wide' ? 24 : 16) * arenaScale) / scale}px`, bottom:`${(h.bottom - a.bottom + bottom * arenaScale) / scale}px`, right:`${(h.right - a.right + (layout === 'wide' ? 24 : 16) * arenaScale) / scale}px`, bottom:`${(h.bottom - a.bottom + bottom * arenaScale) / scale}px`,
width:`${rail * arenaScale / scale}px`, 'max-height':`${maxHeight * arenaScale / scale}px`})) style(node, key, value); width:`${rail * arenaScale / scale}px`, 'max-height':`${maxHeight * arenaScale / scale}px`})) style(node, key, value);
} }
function syncControls() { function syncControls(response) {
// The actual action controls stay horizontal above the hand; skill references get their own rail. // The actual action controls stay horizontal above the hand; skill references get their own rail.
const candidates = [...new Set([ui.skills, ui.skills2, ui.skills3, ui.skillControl, ui.gskillControl])] const candidates = [...new Set([ui.skills, ui.skills2, ui.skills3, ui.skillControl, ui.gskillControl])]
.filter(node => node?.isConnected && node !== ui.control); .filter(node => node?.isConnected && node !== ui.control);
@@ -339,7 +339,7 @@ export function mountBattleHUD(player, battle, env) {
const hudHeight = hudHeightFor(); const hudHeight = hudHeightFor();
const rail = layout === 'wide' ? 142 : layout === 'short' ? 112 : 96; const rail = layout === 'wide' ? 142 : layout === 'short' ? 112 : 96;
const actionBottom = layout === 'narrow' ? hudHeight - 48 : hudHeight + 8; const actionBottom = layout === 'narrow' ? hudHeight - 48 : hudHeight + 8;
const compactActions = arena.clientWidth < 1000; const compactActions = response || arena.clientWidth < 1000;
for (const [key,value] of Object.entries({position:'absolute',left:compactActions?'16px':'var(--mengsan-hud-left)',right:compactActions?'16px':'var(--mengsan-hud-right)',top:'auto',bottom:`${actionBottom}px`,width:'auto','max-height':'none',transform:'none'})) style(ui.control,key,value); for (const [key,value] of Object.entries({position:'absolute',left:compactActions?'16px':'var(--mengsan-hud-left)',right:compactActions?'16px':'var(--mengsan-hud-right)',top:'auto',bottom:`${actionBottom}px`,width:'auto','max-height':'none',transform:'none'})) style(ui.control,key,value);
for (const group of ui.control.children) if (group.classList.contains('control')) { for (const group of ui.control.children) if (group.classList.contains('control')) {
if (external.includes(group)) { if (external.includes(group)) {
@@ -361,8 +361,9 @@ export function mountBattleHUD(player, battle, env) {
ownClass(node,'mengsan-hud-external-action-shuying'); ownClass(node,'mengsan-hud-external-action-shuying');
const host=node.offsetParent||arena,a=arena.getBoundingClientRect(),h=host.getBoundingClientRect(); const host=node.offsetParent||arena,a=arena.getBoundingClientRect(),h=host.getBoundingClientRect();
const scale=h.width/host.offsetWidth||1,zoom=a.width/arena.clientWidth||1; const scale=h.width/host.offsetWidth||1,zoom=a.width/arena.clientWidth||1;
const center=(parseFloat(arena.style.getPropertyValue('--mengsan-hud-left'))+arena.clientWidth-parseFloat(arena.style.getPropertyValue('--mengsan-hud-right')))/2; const responseConfirm = response && node === ui.confirm;
const side=node===ui.confirm?-1:1; const center=responseConfirm ? arena.clientWidth/2 : (parseFloat(arena.style.getPropertyValue('--mengsan-hud-left'))+arena.clientWidth-parseFloat(arena.style.getPropertyValue('--mengsan-hud-right')))/2;
const side=responseConfirm ? 0 : node===ui.confirm?-1:1;
for(const [key,value] of Object.entries({position:'absolute',left:`${(a.left+center*zoom-h.left)/scale+side*80}px`,right:'auto',top:'auto',bottom:`${(h.bottom-a.bottom+actionBottom*zoom)/scale}px`,width:`${Math.min(rail,140)}px`,transform:'translateX(-50%)'}))style(node,key,value); for(const [key,value] of Object.entries({position:'absolute',left:`${(a.left+center*zoom-h.left)/scale+side*80}px`,right:'auto',top:'auto',bottom:`${(h.bottom-a.bottom+actionBottom*zoom)/scale}px`,width:`${Math.min(rail,140)}px`,transform:'translateX(-50%)'}))style(node,key,value);
} }
} }
@@ -388,8 +389,11 @@ export function mountBattleHUD(player, battle, env) {
healthFill.style.width = `${Math.max(0, Math.min(100, player.maxHp > 0 ? player.hp / player.maxHp * 100 : 0))}%`; healthFill.style.width = `${Math.max(0, Math.min(100, player.maxHp > 0 ? player.hp / player.maxHp * 100 : 0))}%`;
text(energy, `费用 ${player.storage.mengsanEnergy_shuying ?? 0} / ${player.storage.mengsanMaxEnergy_shuying ?? 0}`); text(energy, `费用 ${player.storage.mengsanEnergy_shuying ?? 0} / ${player.storage.mengsanMaxEnergy_shuying ?? 0}`);
syncActors(); syncExternalEquipment(); renderStatuses(); syncActors(); syncExternalEquipment(); renderStatuses();
refreshDetails(); syncControls(); syncNotifications(); const event = _status.event;
overlays.refresh({ footerHeight:hudHeightFor(), status:_status }); const response = event?.player === player && Boolean(event.respondTo || event.name === 'chooseToRespond');
refreshDetails(); syncControls(response); syncNotifications();
battle.potionUI?.layoutBattleSlots(ui);
overlays.refresh({ footerHeight:hudHeightFor(), status:_status, response });
} }
function schedule() { function schedule() {
if (disposed || frozen || document.hidden || frame !== null) return; if (disposed || frozen || document.hidden || frame !== null) return;
+93 -14
View File
@@ -32,14 +32,18 @@ export function createOverlayLayout(arena, hand, ui, player) {
for (const [name, had] of record.classes) if (!had) node.classList.remove(name); for (const [name, had] of record.classes) if (!had) node.classList.remove(name);
records.delete(node); records.delete(node);
} }
function mark(node, name) { function recordFor(node) {
let record=records.get(node); let record=records.get(node);
if(!record) {record={styles:new Map(),classes:new Map()};records.set(node,record);} if(!record) {record={styles:new Map(),classes:new Map()};records.set(node,record);}
return record;
}
function mark(node, name) {
const record = recordFor(node);
if(!record.classes.has(name))record.classes.set(name,node.classList.contains(name)); if(!record.classes.has(name))record.classes.set(name,node.classList.contains(name));
node.classList.add(name);return record; node.classList.add(name);return record;
} }
function style(node,key,value) { function style(node,key,value) {
const record=records.get(node); const record=recordFor(node);
if(!record.styles.has(key))record.styles.set(key,{before:node.style.getPropertyValue(key),priority:node.style.getPropertyPriority(key)}); if(!record.styles.has(key))record.styles.set(key,{before:node.style.getPropertyValue(key),priority:node.style.getPropertyPriority(key)});
const field=record.styles.get(key); const field=record.styles.get(key);
if(field.requested!==value||node.style.getPropertyValue(key)!==field.last)node.style.setProperty(key,value,'important'); if(field.requested!==value||node.style.getPropertyValue(key)!==field.last)node.style.setProperty(key,value,'important');
@@ -52,32 +56,107 @@ export function createOverlayLayout(arena, hand, ui, player) {
style(node,'left',`${(x-h.left)/sx-host.clientLeft+host.scrollLeft}px`); style(node,'left',`${(x-h.left)/sx-host.clientLeft+host.scrollLeft}px`);
style(node,'top',`${(y-h.top)/sy-host.clientTop+host.scrollTop}px`); style(node,'top',`${(y-h.top)/sy-host.clientTop+host.scrollTop}px`);
} }
function hostScale(node) {
const host = node.offsetParent || arena;
const box = host.getBoundingClientRect();
return {x:box.width / host.offsetWidth || 1,y:box.height / host.offsetHeight || 1};
}
function currentShift(node, scale) {
const field = records.get(node)?.styles.get('translate');
return field?.last && node.style.getPropertyValue('translate') === field.last
? {x:field.x * scale.x,y:field.y * scale.y} : {x:0,y:0};
}
function shift(node, x, y, scale, used) {
if (Math.abs(x) < .05 && Math.abs(y) < .05) return;
// Keep the engine's transform animation, but apply the layout shift immediately.
if (arena.ownerDocument.defaultView.getComputedStyle(node).transitionProperty === 'all') {
style(node, 'transition-property', 'transform, opacity, left, top');
}
const dx = x / scale.x, dy = y / scale.y;
style(node, 'translate', `${dx}px ${dy}px`);
Object.assign(records.get(node).styles.get('translate'), {x:dx,y:dy});
used.add(node);
}
function visibleButtons(node, selector) {
return [...node.querySelectorAll(selector)]
.filter(button => !button.closest('.mengsan-hud-external-control-shuying,.removing,.closing'))
.map(button => button.getBoundingClientRect()).filter(box => box.height && box.width);
}
function positionResponseActions(handTop, center, gap, used) {
const controls = [ui.control];
if (ui.confirm?.isConnected && !ui.control.contains(ui.confirm)) controls.push(ui.confirm);
let top = Infinity;
for (const node of controls) {
const isRoot = node === ui.control;
const buttons = visibleButtons(node,isRoot ? ':scope > .control > div' : ':scope > div');
if (!buttons.length) continue;
const confirm = ui.confirm;
let responseButtons = [];
if (confirm && (node === confirm || node.contains(confirm))) {
responseButtons = confirm.node ? [confirm.node.ok,confirm.node.cancel]
.filter(button => button?.isConnected && button.getClientRects().length)
.map(button => button.getBoundingClientRect()) : visibleButtons(confirm,':scope > div');
}
const centered = responseButtons.length ? responseButtons : buttons;
const left = Math.min(...centered.map(box => box.left));
const right = Math.max(...centered.map(box => box.right));
const scale = hostScale(node), previous = currentShift(node,scale);
const bottom = Math.max(...buttons.map(box => box.bottom)) - previous.y;
const offset = handTop - gap - bottom;
shift(node,center - (left + right)/2 + previous.x,offset,scale,used);
top = Math.min(top, ...buttons.map(box => box.top - previous.y + offset));
}
return top;
}
function clearResponseCards(promptTop, battlefieldTop, gap, used) {
const cards = (ui.thrown || []).filter(card => card.parentNode === arena && !card.fixed &&
!card.matches('.drawingcard,.gainingcard,.movingcard,.removing,.hidden'));
const geometry = cards.map(card => {
const scale = hostScale(card), previous = currentShift(card,scale), box = card.getBoundingClientRect();
return {card,scale,top:box.top - previous.y,bottom:box.bottom - previous.y};
});
if (!geometry.length) return;
const top = Math.min(...geometry.map(box => box.top));
const bottom = Math.max(...geometry.map(box => box.bottom));
const offset = Math.min(0, Math.max(battlefieldTop + gap - top, promptTop - gap - bottom));
// The normal discard position wins whenever it clears the response prompt.
for (const {card,scale} of geometry) shift(card,0,offset,scale,used);
}
const api = { const api = {
refresh(nextOptions) { refresh(nextOptions) {
options = nextOptions; options = nextOptions;
const {footerHeight,status} = nextOptions; const {footerHeight,status,response} = nextOptions;
const used=new Set(),a=arena.getBoundingClientRect(),zoom=a.width/arena.clientWidth||1; const used=new Set(),a=arena.getBoundingClientRect(),zoom=a.width/arena.clientWidth||1;
const left=parseFloat(arena.style.getPropertyValue('--mengsan-hud-left'))||0; const left=parseFloat(arena.style.getPropertyValue('--mengsan-hud-left'))||0;
const right=parseFloat(arena.style.getPropertyValue('--mengsan-hud-right'))||0; const right=parseFloat(arena.style.getPropertyValue('--mengsan-hud-right'))||0;
const x=a.left+left*zoom,width=Math.max(100,arena.clientWidth-left-right); const x=a.left+left*zoom,width=Math.max(100,arena.clientWidth-left-right);
const controlTop=ui.control.getBoundingClientRect().top;
const prompts=new Set(arena.querySelectorAll(':scope > .hand-tip,:scope > .hand-tip-info')); const prompts=new Set(arena.querySelectorAll(':scope > .hand-tip,:scope > .hand-tip-info'));
const dialog=ui.dialog; const dialog=ui.dialog;
if(dialog?.isConnected && !dialog.classList.contains('popped') && !dialog.classList.contains('fullheight') && !dialog.forcebutton && !dialog.buttons?.length && !dialog.querySelector('.button,.card,.player,input,textarea,select') && status.event?.player===player)prompts.add(dialog); if(dialog?.isConnected && !dialog.classList.contains('popped') && !dialog.classList.contains('fullheight') && !dialog.forcebutton && !dialog.buttons?.length && !dialog.querySelector('.button,.card,.player,input,textarea,select') && status.event?.player===player)prompts.add(dialog);
// The event owns simple native prompt dialogs too, without a global game dependency. // The event owns simple native prompt dialogs too, without a global game dependency.
const eventDialog=status.event?.dialog; const eventDialog=status.event?.dialog;
if(eventDialog?.isConnected && eventDialog===dialog && !eventDialog.buttons?.length && !eventDialog.forcebutton && !eventDialog.querySelector('.button,.card,.player,input,textarea,select'))prompts.add(eventDialog); if(eventDialog?.isConnected && eventDialog===dialog && !eventDialog.buttons?.length && !eventDialog.forcebutton && !eventDialog.querySelector('.button,.card,.player,input,textarea,select'))prompts.add(eventDialog);
let promptBottom=Math.min(controlTop-10*zoom,a.bottom-(footerHeight+54)*zoom);
for(const node of prompts) {
if(node.hidden || node.style.display==='none')continue;
mark(node,'mengsan-hud-prompt-shuying');used.add(node);
position(node,x,0,width,arena.clientHeight<=500?34:64);
const height=node.getBoundingClientRect().height;
position(node,x,Math.max(a.top+50*zoom,promptBottom-height),width,arena.clientHeight<=500?34:64);
promptBottom=node.getBoundingClientRect().top-6*zoom;
}
const handBox=hand.getBoundingClientRect(); const handBox=hand.getBoundingClientRect();
const handTop=Math.min(handBox.top,...[...hand.querySelectorAll('.handcards>.card')].map(node=>node.getBoundingClientRect().top)); const handCards=[...hand.querySelectorAll('.handcards>.card')].map(node=>node.getBoundingClientRect()).filter(box=>box.height&&box.width);
const handTop=Math.min(handBox.top,...handCards.map(box=>box.top));
const gap=Math.max(4,(arena.clientHeight<=500?6:8)*zoom);
const responseTop=response ? positionResponseActions(handCards.length ? Math.min(...handCards.map(box=>box.top)) : handTop,(a.left+a.right)/2,gap,used) : Infinity;
const controlTop=ui.control.getBoundingClientRect().top;
let promptBottom=Math.min(controlTop-10*zoom,a.bottom-(footerHeight+54)*zoom);
if(Number.isFinite(responseTop))promptBottom=responseTop-gap;
let promptTop=Infinity;
for(const node of prompts) {
if(node.hidden || !node.getClientRects().length)continue;
mark(node,'mengsan-hud-prompt-shuying');used.add(node);
const promptX=response?a.left+16*zoom:x;
const promptWidth=response?arena.clientWidth-32:width;
position(node,promptX,0,promptWidth,arena.clientHeight<=500?34:64);
const height=node.getBoundingClientRect().height;
position(node,promptX,Math.max(a.top+(response?8:50)*zoom,promptBottom-height),promptWidth,arena.clientHeight<=500?34:64);
promptTop=node.getBoundingClientRect().top;
promptBottom=promptTop-6*zoom;
}
if(response && Number.isFinite(promptTop)) clearResponseCards(promptTop,a.top,gap,used);
const popups=popped(); const popups=popped();
let hasPopup=false; let hasPopup=false;
for(const node of popups) { for(const node of popups) {
+11 -4
View File
@@ -10,13 +10,20 @@
.mengsan-battle-potions { .mengsan-battle-potions {
position: absolute; position: absolute;
top: 8px; top: var(--mengsan-potion-top, 8px);
left: 50%; left: var(--mengsan-potion-left, 8px);
transform: translateX(-50%); width: max-content;
max-width: 44%; max-width: calc(50% - 16px);
transition: none;
z-index: 7; z-index: 7;
} }
/* Decade UI sets data-id during every skill-bar rebuild, before its first paint. */
.mengsan-hud-arena-shuying :is(.skill-control, .skill-controlzuoshou, .gskill-control)
[data-id^="mengsan_use_"][data-id$="_potion_shuying"] {
display: none !important;
}
.mengsan-potion-slot { .mengsan-potion-slot {
display: inline-grid; display: inline-grid;
place-items: center; place-items: center;
+44 -1
View File
@@ -58,6 +58,45 @@ export function showPotionDescription(node, view) {
parent.append(view.richDescription.slice(start)); parent.append(view.richDescription.slice(start));
} }
function positionBattlePotions(root, strip, ui) {
if (!root.clientWidth || !root.clientHeight) return;
const view = root.ownerDocument.defaultView;
const arena = root.getBoundingClientRect();
const scaleX = arena.width / root.clientWidth || 1;
const scaleY = arena.height / root.clientHeight || 1;
const {width,height} = strip.getBoundingClientRect();
const gapX = 8 * scaleX, gapY = 8 * scaleY;
const startX = arena.left + gapX;
const limitX = arena.left + arena.width / 2 - gapX;
const obstacles = [];
for (const panel of new Set([ui.cardRoundTime,ui.cardRoundTimeNode,ui.cardPileNumber,
ui.time,ui.time3,ui.time4,ui.timeNode,ui.roundmenu])) {
if (!panel?.isConnected) continue;
const style = view.getComputedStyle(panel);
if (style.visibility === 'hidden' || style.display === 'none' || Number(style.opacity) === 0) continue;
for (const node of [panel,...panel.querySelectorAll('.cardPileNumber,.roundNumber,.time,.cardPileNumber > span')]) {
const box = node.getBoundingClientRect();
if (box.width && box.height) obstacles.push(box);
}
}
let x = startX, y = arena.top + gapY;
for (;;) {
const nearby = obstacles.filter(box => box.left < x + width + gapX && box.right + gapX > x &&
box.top < y + height + gapY && box.bottom + gapY > y);
if (!nearby.length) break;
const nextX = Math.max(...nearby.map(box=>box.right)) + gapX;
if (nextX + width <= limitX) {
x = nextX;
} else {
x = startX;
y = Math.min(...nearby.map(box=>box.bottom)) + gapY;
}
}
const left = `${(x-arena.left)/scaleX}px`, top = `${(y-arena.top)/scaleY}px`;
if (strip.style.getPropertyValue('--mengsan-potion-left') !== left) strip.style.setProperty('--mengsan-potion-left',left);
if (strip.style.getPropertyValue('--mengsan-potion-top') !== top) strip.style.setProperty('--mengsan-potion-top',top);
}
export function mountPotionSlots(root, player, actions = {}) { export function mountPotionSlots(root, player, actions = {}) {
const strip = element("div", "mengsan-potion-slots"); const strip = element("div", "mengsan-potion-slots");
if (actions.use) strip.classList.add("mengsan-battle-potions"); if (actions.use) strip.classList.add("mengsan-battle-potions");
@@ -142,5 +181,9 @@ export function mountPotionSlots(root, player, actions = {}) {
strip.addEventListener(type, event => event.stopPropagation()); strip.addEventListener(type, event => event.stopPropagation());
} }
refresh(); refresh();
return { refresh, dispose() { close(); strip.remove(); } }; return {
refresh,
layoutBattleSlots(ui) { if (actions.use && strip.isConnected) positionBattlePotions(root, strip, ui); },
dispose() { close(); strip.remove(); },
};
} }
+1 -1
View File
@@ -41,7 +41,7 @@ const { game } = await import(new URL("noname.js", document.baseURI).href);
game.saveConfig("shuYing_mengsan_zip_trial", true); game.saveConfig("shuYing_mengsan_zip_trial", true);
``` ```
每包按 5 MiB 的展开数据量分组,压缩包最大 6 MiB。大于展开上限的单文件继续逐个下载。客户端顺序处理同源同标签的附件,已校验并暂存的文件可供本次安装复用。附件缺失或无法使用时,剩余文件从当前标签的 raw 路径补齐。 每包按 10 MiB 的展开数据量分组,压缩包最大 11 MiB。大于展开上限的单文件继续逐个下载。客户端顺序处理同源同标签的附件,已校验并暂存的文件可供本次安装复用。附件缺失或无法使用时,剩余文件从当前标签的 raw 路径补齐。
Electron 走原生 HTTPS,Cordova 使用 `FileTransfer` 下载一包到当前操作的临时目录,读取前核对大小,处理结束后清理。网页端走 Fetch,附件域不可读时回退。ZIP 解压需要支持 `DecompressionStream("deflate-raw")`,不支持的客户端继续逐文件下载。 Electron 走原生 HTTPS,Cordova 使用 `FileTransfer` 下载一包到当前操作的临时目录,读取前核对大小,处理结束后清理。网页端走 Fetch,附件域不可读时回退。ZIP 解压需要支持 `DecompressionStream("deflate-raw")`,不支持的客户端继续逐文件下载。
+2 -2
View File
@@ -9,8 +9,8 @@ from pathlib import Path
from generate_manifest import validate_relative_paths from generate_manifest import validate_relative_paths
MAX_UNCOMPRESSED_BYTES = 5 * 1024**2 MAX_UNCOMPRESSED_BYTES = 10 * 1024**2
MAX_ARCHIVE_BYTES = 6 * 1024**2 MAX_ARCHIVE_BYTES = MAX_UNCOMPRESSED_BYTES + 1024**2
def write_part(root: Path, part: Path, files: list[str], manifest: dict) -> None: def write_part(root: Path, part: Path, files: list[str], manifest: dict) -> None:
+3 -3
View File
@@ -30,11 +30,11 @@ class MengsanArchivesTest(unittest.TestCase):
}), encoding="utf-8") }), encoding="utf-8")
def test_parts_cover_packable_files_once(self): def test_parts_cover_packable_files_once(self):
first = b"a" * (3 * 1024**2) first = b"a" * (10 * 1024**2)
second = b"b" * (3 * 1024**2) second = b"b"
self.write_snapshot({ self.write_snapshot({
"mengsan/b": second, "mengsan/b": second,
"mengsan/oversized": b"c" * (5 * 1024**2 + 1), "mengsan/oversized": b"c" * (10 * 1024**2 + 1),
"mengsan/a": first, "mengsan/a": first,
}) })
parts = build_archives(self.root, self.output, "v2.0.2.3-rc.8") parts = build_archives(self.root, self.output, "v2.0.2.3-rc.8")
+22 -8
View File
@@ -25,13 +25,13 @@ function info(text) {
return { size: Buffer.byteLength(text), sha256: createHash("sha256").update(text).digest("hex") }; return { size: Buffer.byteLength(text), sha256: createHash("sha256").update(text).digest("hex") };
} }
function zip(files) { function zip(files, compression = "DEFLATE") {
const archive = new JSZip(); const archive = new JSZip();
for (const [name, data] of Object.entries(files)) archive.file(name, data); for (const [name, data] of Object.entries(files)) archive.file(name, data);
return archive.generate({ type: "uint8array", compression: "DEFLATE" }); return archive.generate({ type: "uint8array", compression });
} }
async function setup({ source = "github", parts = [zip(assets)], releaseTag = tag, async function setup({ source = "github", contents = assets, parts = [zip(contents)], releaseTag = tag,
draft = false, failWrite = false, record, trial = true, transport = "browser", draft = false, failWrite = false, record, trial = true, transport = "browser",
blocksBrowserAssets = false, canInflate = true, localVersion = version } = {}) { blocksBrowserAssets = false, canInflate = true, localVersion = version } = {}) {
const github = source == "github"; const github = source == "github";
@@ -74,7 +74,7 @@ async function setup({ source = "github", parts = [zip(assets)], releaseTag = ta
files: { "extension.js": info("main") }, files: { "extension.js": info("main") },
modules: { mengsan: { entry: moduleEntry, manifest: modulePath } } }; modules: { mengsan: { entry: moduleEntry, manifest: modulePath } } };
const moduleManifest = { algorithm: "sha256", module_id: "mengsan", version, const moduleManifest = { algorithm: "sha256", module_id: "mengsan", version,
files: Object.fromEntries(Object.entries(assets).map(([file, content]) => [file, info(content)])) }; files: Object.fromEntries(Object.entries(contents).map(([file, content]) => [file, info(content)])) };
const attachments = parts?.map((part, index) => { const attachments = parts?.map((part, index) => {
const name = `mengsan-${tag}-part-${String(index + 1).padStart(3, "0")}.zip`; const name = `mengsan-${tag}-part-${String(index + 1).padStart(3, "0")}.zip`;
const url = `${repository}/releases/download/${tag}/${name}`; const url = `${repository}/releases/download/${tag}/${name}`;
@@ -159,7 +159,7 @@ async function setup({ source = "github", parts = [zip(assets)], releaseTag = ta
} }
return new Response(part.bytes || part); return new Response(part.bytes || part);
} }
for (const [file, content] of Object.entries({ ...assets, "extension.js": "main" })) { for (const [file, content] of Object.entries({ ...contents, "extension.js": "main" })) {
if (url == raw(file)) return new Response(content); if (url == raw(file)) return new Response(content);
} }
return new Response(null, { status: 404 }); return new Response(null, { status: 404 });
@@ -186,7 +186,7 @@ async function setup({ source = "github", parts = [zip(assets)], releaseTag = ta
await module.link(() => engine); await module.link(() => engine);
await module.evaluate(); await module.evaluate();
const shuYing = { text: { style: {}, showPopover() {}, setAttribute() {}, matches: () => false } }; const shuYing = { text: { style: {}, showPopover() {}, setAttribute() {}, matches: () => false } };
return { updater: module.namespace.default, shuYing, requests, releaseUrl, raw, attachments, nativeRequests, return { updater: module.namespace.default, shuYing, requests, releaseUrl, raw, attachments, nativeRequests, contents,
writes, config, files, alerts, errors }; writes, config, files, alerts, errors };
} }
@@ -199,7 +199,7 @@ async function install(options) {
function assertInstalled(result) { function assertInstalled(result) {
assert.deepEqual(result.errors, []); assert.deepEqual(result.errors, []);
assert.equal(result.config[recordKey]?.status, "installed", result.alerts.join("\n")); assert.equal(result.config[recordKey]?.status, "installed", result.alerts.join("\n"));
for (const [file, content] of Object.entries(assets)) { for (const [file, content] of Object.entries(result.contents)) {
assert.equal(new TextDecoder().decode(result.files.get(extensionRoot + file)), content); assert.equal(new TextDecoder().decode(result.files.get(extensionRoot + file)), content);
} }
} }
@@ -240,7 +240,6 @@ for (const [description, options] of Object.entries({
"draft release": { draft: true }, "draft release": { draft: true },
"invalid ZIP": { parts: [new Uint8Array([1, 2, 3])] }, "invalid ZIP": { parts: [new Uint8Array([1, 2, 3])] },
"ZIP contains unlisted entries": { parts: [zip({ ...assets, "../unexpected.js": "x" })] }, "ZIP contains unlisted entries": { parts: [zip({ ...assets, "../unexpected.js": "x" })] },
"ZIP above the download budget": { parts: [new Uint8Array(6 * 1024**2 + 1)] },
"response larger than its attachment metadata": { parts: [{ size: 1, bytes: zip(assets) }] }, "response larger than its attachment metadata": { parts: [{ size: 1, bytes: zip(assets) }] },
})) { })) {
test(`uses same-tag raw after ${description}`, async () => { test(`uses same-tag raw after ${description}`, async () => {
@@ -253,6 +252,21 @@ for (const [description, options] of Object.entries({
}); });
} }
test("stages a ZIP with exactly 10 MiB of content", async () => {
const contents = { ...assets, [asset]: "x".repeat(10 * 1024**2 - Buffer.byteLength(assets[moduleEntry])) };
const result = await install({ contents, parts: [zip(contents, "STORE")] });
assertInstalled(result);
assert.ok(result.requests.includes(result.attachments[0].browser_download_url));
assert.ok(!result.requests.includes(result.raw(asset)));
});
test("skips a ZIP above the 11 MiB download limit", async () => {
const result = await install({ parts: [new Uint8Array(11 * 1024**2 + 1)] });
assertInstalled(result);
assert.ok(!result.requests.includes(result.attachments[0].browser_download_url));
assert.ok(result.requests.includes(result.raw(asset)));
});
test("a staging storage failure stops the ZIP install without raw retries", async () => { test("a staging storage failure stops the ZIP install without raw retries", async () => {
const result = await install({ failWrite: true }); const result = await install({ failWrite: true });
assert.equal(result.config[recordKey]?.status, "disabled"); assert.equal(result.config[recordKey]?.status, "disabled");
+2 -2
View File
@@ -4,8 +4,8 @@ const giteaRepositoryApi = "https://gitea.diuse.work/api/v1/repos/Diuse/noname-s
const githubRepositoryApi = "https://api.github.com/repos/Shu-Ying/noname-shuying"; const githubRepositoryApi = "https://api.github.com/repos/Shu-Ying/noname-shuying";
const githubRawBase = "https://raw.githubusercontent.com/Shu-Ying/noname-shuying"; const githubRawBase = "https://raw.githubusercontent.com/Shu-Ying/noname-shuying";
const coreTempDir = "extension/术樱包/.update_tmp"; const coreTempDir = "extension/术樱包/.update_tmp";
const mengsanArchiveBytes = 6 * 1024 * 1024; const mengsanUncompressedBytes = 10 * 1024 * 1024;
const mengsanUncompressedBytes = 5 * 1024 * 1024; const mengsanArchiveBytes = mengsanUncompressedBytes + 1024 * 1024;
let fileMutationUncertain = false; let fileMutationUncertain = false;
const verifiedCacheKey = "shuYing_update_verified_files"; const verifiedCacheKey = "shuYing_update_verified_files";
const installedManifestKey = "shuYing_update_installation"; const installedManifestKey = "shuYing_update_installation";