mirror of
https://github.com/Shu-Ying/noname-shuying.git
synced 2026-11-24 22:16:30 +08:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
40df5b7ac7 | ||
|
|
d61b4b2526 | ||
|
|
98116bef7b |
@@ -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 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
|
||||
|
||||
@@ -80,6 +80,8 @@ If the available evidence still cannot establish a reliable, verifiable baseline
|
||||
|
||||
## 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:
|
||||
|
||||
- Implementation correctness and clear logic errors.
|
||||
@@ -110,7 +112,7 @@ Evidence: The specific relationship to the diff, task, spec, or verification rec
|
||||
Then include:
|
||||
|
||||
- `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.
|
||||
- `Conclusion`: the finding count, or an explicit “No concrete findings.”
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ tools/*.mjs
|
||||
!/tools/test_mengsan_zip_install.mjs
|
||||
!/mengsan/tools/test-hud-status.cjs
|
||||
!/mengsan/tools/test-battle-hud.cjs
|
||||
!/mengsan/tools/test-journey-ui-zoom.cjs
|
||||
!/mengsan/tools/import-status-icons.cjs
|
||||
|
||||
/.update_tmp/
|
||||
|
||||
@@ -63,3 +63,7 @@ gives you structural context (callers, dependents, test coverage) that file sear
|
||||
3. Use `get_affected_flows_tool` to understand impact.
|
||||
4. Use `query_graph_tool` pattern="tests_for" to check coverage.
|
||||
<!-- /code-review-graph MCP tools -->
|
||||
|
||||
## 梦三战斗 UI 审查
|
||||
|
||||
每次 review 都按 [梦三战斗 UI 回归清单](docs/reviews/mengsan-battle-ui.md) 逐项核验,并记录结果和验证环境。涉及战斗 UI 的改动须附本轮渲染截图,并单独记录 Android 实机验证状态。
|
||||
|
||||
Vendored
+13
-13
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"version": "2.0.2.3-rc.9",
|
||||
"generated_at": "2026-11-24T02:18:29.852446+00:00",
|
||||
"version": "2.0.2.3-rc.11",
|
||||
"generated_at": "2026-11-24T06:10:42.618424+00:00",
|
||||
"algorithm": "sha256",
|
||||
"update_channels": true,
|
||||
"file_count": 288,
|
||||
"size_bytes": 48059878,
|
||||
"folder_sha256": "fb2d412a62c1c4fe99b1b71d4d0ded40b34b34a7c14804c734b403cd1019bb39",
|
||||
"size_bytes": 48059903,
|
||||
"folder_sha256": "d9c01ad655f662ee47b2c946e5d5d03e2531059eac1e5d69bace975366ab9a8d",
|
||||
"core": [
|
||||
"extension.js",
|
||||
"menu.js",
|
||||
@@ -438,8 +438,8 @@
|
||||
"sha256": "0907c22921f33d3180378dfcec4cdea793227d325c281d5f3a3f698c83b42b85"
|
||||
},
|
||||
"extension.js": {
|
||||
"size": 15731,
|
||||
"sha256": "a3b9c226e50876661e1bdd91579a1051cafb02a512eb3b9fb452174c9c531b7a"
|
||||
"size": 15732,
|
||||
"sha256": "01bedc58c3acb22f3628ce8cad93795dd6e51488f5bbe93121934f48e4a9a384"
|
||||
},
|
||||
"function.js": {
|
||||
"size": 38588,
|
||||
@@ -1350,8 +1350,8 @@
|
||||
"sha256": "bd89818b8f535c19b51f107ca2c75dec669852e4a604ed55f6fa945ecec8e6d6"
|
||||
},
|
||||
"update.js": {
|
||||
"size": 91443,
|
||||
"sha256": "9ce351da60f3044f92ffd6e84997816dcf551d5186f61505a76161262b4cbb65"
|
||||
"size": 91467,
|
||||
"sha256": "c8210c6cba50deff3442ec5c57eff869a703cdbee9aa945df788a1138e909f8b"
|
||||
},
|
||||
"update.txt": {
|
||||
"size": 4962,
|
||||
@@ -1695,8 +1695,8 @@
|
||||
},
|
||||
"extension.js": {
|
||||
"type": "file",
|
||||
"size": 15731,
|
||||
"sha256": "a3b9c226e50876661e1bdd91579a1051cafb02a512eb3b9fb452174c9c531b7a"
|
||||
"size": 15732,
|
||||
"sha256": "01bedc58c3acb22f3628ce8cad93795dd6e51488f5bbe93121934f48e4a9a384"
|
||||
},
|
||||
"function.js": {
|
||||
"type": "file",
|
||||
@@ -2965,8 +2965,8 @@
|
||||
},
|
||||
"update.js": {
|
||||
"type": "file",
|
||||
"size": 91443,
|
||||
"sha256": "9ce351da60f3044f92ffd6e84997816dcf551d5186f61505a76161262b4cbb65"
|
||||
"size": 91467,
|
||||
"sha256": "c8210c6cba50deff3442ec5c57eff869a703cdbee9aa945df788a1138e909f8b"
|
||||
},
|
||||
"update.txt": {
|
||||
"type": "file",
|
||||
@@ -3116,7 +3116,7 @@
|
||||
"entry": "mengsan/register.js",
|
||||
"manifest": "dist/modules/mengsan.json",
|
||||
"file_count": 846,
|
||||
"size_bytes": 150427884,
|
||||
"size_bytes": 150439572,
|
||||
"legacy_manifest": "dist/modules/mengsan.legacy.json"
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+64
-64
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"version": "2.0.2.3-rc.9",
|
||||
"generated_at": "2026-11-24T02:18:29.854104+00:00",
|
||||
"version": "2.0.2.3-rc.11",
|
||||
"generated_at": "2026-11-24T06:10:42.620435+00:00",
|
||||
"algorithm": "sha256",
|
||||
"update_channels": true,
|
||||
"file_count": 846,
|
||||
"size_bytes": 150427884,
|
||||
"folder_sha256": "64d54453d119b3b53001ddd4b972c0098c559c34b72fae35b6ec6a0ec9f5b596",
|
||||
"size_bytes": 150439572,
|
||||
"folder_sha256": "cc14fd5cb299151caf8e9f2527e49a11a5e49690ba17207d23127d84d0ab3627",
|
||||
"core": [
|
||||
"mengsan/register.js"
|
||||
],
|
||||
@@ -4104,8 +4104,8 @@
|
||||
"sha256": "784641ea207432c3fe9e55b83d95a7976490521bbfb736d01973f7adaee749d1"
|
||||
},
|
||||
"mengsan/ui/card-library.js": {
|
||||
"size": 22135,
|
||||
"sha256": "0756e87b0af8e71c177a7be9ff175d645ecbf2dfaad36b5852cad82a4b60bba3"
|
||||
"size": 22146,
|
||||
"sha256": "029789405e732ff01d537fd7826980c9a9f2c07c95bde087c0e49478de0bd7b9"
|
||||
},
|
||||
"mengsan/ui/character-select.css": {
|
||||
"size": 6060,
|
||||
@@ -4116,20 +4116,20 @@
|
||||
"sha256": "81073b10ae63ac921c1eed851127c64fbe6ca4407d4b9b41c3a24b6373cb1e87"
|
||||
},
|
||||
"mengsan/ui/dialogue.js": {
|
||||
"size": 7649,
|
||||
"sha256": "a405f315270c24cdb2c53ba4e211a3fd5bf9bb582335d5dbf910adb5622deac6"
|
||||
"size": 7790,
|
||||
"sha256": "c138f465d52b04e27402b7b440f57631b36199d690d044fc48dd0640da689d51"
|
||||
},
|
||||
"mengsan/ui/energy-display.js": {
|
||||
"size": 498,
|
||||
"sha256": "b12157ac3008c0e63fb384fe5fefe54964b86436652c73670f6a4c4faa4ad1da"
|
||||
},
|
||||
"mengsan/ui/flow-ui.js": {
|
||||
"size": 3394,
|
||||
"sha256": "9070b108e2342a89b545c6d7c19af140431c343fc4e28e344e72f3fdc524f3b4"
|
||||
"size": 3440,
|
||||
"sha256": "5e889fdf671ff031fc661e148a13812cebb0fbcacaa81064589a8caf17e06efe"
|
||||
},
|
||||
"mengsan/ui/gm-manager.js": {
|
||||
"size": 9913,
|
||||
"sha256": "bdefd7704e499a25e7a02de26c6487dff55c15f2723089c8fd8d85155d9e2afc"
|
||||
"size": 9924,
|
||||
"sha256": "eefbcaa7fb4ddc68991b9d77bb1be253c4278a9008d171e85aac84b414b04455"
|
||||
},
|
||||
"mengsan/ui/hand/adapter.js": {
|
||||
"size": 935,
|
||||
@@ -4148,32 +4148,32 @@
|
||||
"sha256": "4b804c1d42c6c1171d42a37136fcb903bfb3128beae6a357b52ef9cede54908f"
|
||||
},
|
||||
"mengsan/ui/hand/input.js": {
|
||||
"size": 13034,
|
||||
"sha256": "8e2165ca0ca28d106d5c538ef1b248b3bc68ae23e0be8fcd10fcd62864512701"
|
||||
"size": 13480,
|
||||
"sha256": "ca1eb00598b1135cdc1b937642eaffdf5858b5e8e4678dd12bf4e384556a5372"
|
||||
},
|
||||
"mengsan/ui/hand/overlays.js": {
|
||||
"size": 3970,
|
||||
"sha256": "9e489fc939f97a21266764f1beccdda1cc3ac9df22f72c633647d7481fa4e662"
|
||||
},
|
||||
"mengsan/ui/hand/style.css": {
|
||||
"size": 15499,
|
||||
"sha256": "bcc2c93ea1bca3118240e28cd77cc71941146b60ca6d8becd685f6e31fbf917a"
|
||||
"size": 15564,
|
||||
"sha256": "b958c78088e903c5ec09537f2d3b2241fe51a9067604e360b560c02fdac30904"
|
||||
},
|
||||
"mengsan/ui/hud/index.js": {
|
||||
"size": 26766,
|
||||
"sha256": "a917b681a83db288244a61ee3cccba8315b13d35fdc4384f1a8e750dc776d68b"
|
||||
"size": 28411,
|
||||
"sha256": "fc9ea1815d75a6ad950a6f87a5af38cccebe05b032f3dde69dde0f7f13a9d8a6"
|
||||
},
|
||||
"mengsan/ui/hud/overlays.js": {
|
||||
"size": 7007,
|
||||
"sha256": "769fe1227c6b54ba5852a02cdb75aa07b1edd674c2078a02d596178ddd4dff10"
|
||||
"size": 11817,
|
||||
"sha256": "1ed2cc37a4afddfcfff41bc7e1a94422855ead2f5f1b38a5d008eaa474d370b0"
|
||||
},
|
||||
"mengsan/ui/hud/status-model.js": {
|
||||
"size": 11300,
|
||||
"sha256": "b18ae987f451453f77a397093cd57d8a8bd1fc03dbe845e3fc5a943da0a8ff04"
|
||||
},
|
||||
"mengsan/ui/hud/style.css": {
|
||||
"size": 20395,
|
||||
"sha256": "05e40d81cf81731cc2c0dc89ec876229d5a1f93100b69af38fee001927433626"
|
||||
"size": 19961,
|
||||
"sha256": "3313acbd5e99d3346cfb1ce95bad5274752da35a4e7fb6b4ff0fa92e2ad00907"
|
||||
},
|
||||
"mengsan/ui/intent-display.js": {
|
||||
"size": 13341,
|
||||
@@ -4184,20 +4184,20 @@
|
||||
"sha256": "6fc56c6c084508a39d801521a103f8c39eea90eb895f47a78924997241d9f932"
|
||||
},
|
||||
"mengsan/ui/map/renderer.js": {
|
||||
"size": 26905,
|
||||
"sha256": "12c0755f38c0213093c8fd5b29f79fbfc721fed9a9d756bf12ee497363c05b26"
|
||||
"size": 27005,
|
||||
"sha256": "9ec156a410df674c80b987b243fce399415d8acc02db43d0018b56882d335609"
|
||||
},
|
||||
"mengsan/ui/navigation.js": {
|
||||
"size": 11317,
|
||||
"sha256": "62dc4cd8093b931c91b42070f36f6a7f54493cf13e55c682b8ef5c2bb8495be7"
|
||||
"size": 11328,
|
||||
"sha256": "6494765969d7e9f27bd03af778d4713fe4c361643d547fc0ce44975074ca67e7"
|
||||
},
|
||||
"mengsan/ui/potions.css": {
|
||||
"size": 2540,
|
||||
"sha256": "efc36a84f98a01e9734b54969bb47774c7bc37f47d678b7e3066e19b4f67a81b"
|
||||
"size": 2886,
|
||||
"sha256": "4a682e41cc7d69361bb7bd1a0a61fb2a90b8a63c0e1006e4ed1e87d1434d3461"
|
||||
},
|
||||
"mengsan/ui/potions.js": {
|
||||
"size": 6283,
|
||||
"sha256": "863f606776412b036f386ec691253ef17c608bae11c5cdbc1805de9898ff089e"
|
||||
"size": 8429,
|
||||
"sha256": "08b6be3bdd26553dbe25d8f409f51d02eb09023037132856cb2201b6143705cd"
|
||||
},
|
||||
"mengsan/ui/relic-icon.js": {
|
||||
"size": 631,
|
||||
@@ -4208,8 +4208,8 @@
|
||||
"sha256": "c2b500560d9cbb506e1f976f1449d2dd1f01021487606cd13efd64d6ff46604b"
|
||||
},
|
||||
"mengsan/ui/relics.js": {
|
||||
"size": 4563,
|
||||
"sha256": "2673556941004981a443cb7dc4d93dad23ae64ac1bb4ff471b95950429625608"
|
||||
"size": 4574,
|
||||
"sha256": "cecca4fb42dcaf596ba2645986a2244f51da56215d1e9583251f43691c0bb6c8"
|
||||
},
|
||||
"mengsan/ui/rest-ui.js": {
|
||||
"size": 3997,
|
||||
@@ -4236,8 +4236,8 @@
|
||||
"sha256": "e9cd1c36d28faf8790d67e33bb3487c76eb508103277899fc5201b49d2155abf"
|
||||
},
|
||||
"mengsan/ui/style.css": {
|
||||
"size": 82481,
|
||||
"sha256": "a382ac4a62389b0e2b5d8454ca0bb278f8c0019f8f3af6dcf18b8113e7af4fd2"
|
||||
"size": 84814,
|
||||
"sha256": "82a31f514ee896cb1c94fd4a2998a2c9e53b49d13a7155028dc72deded7c6c26"
|
||||
},
|
||||
"mengsan/ui/virtual-card-grid.js": {
|
||||
"size": 4820,
|
||||
@@ -8456,8 +8456,8 @@
|
||||
},
|
||||
"card-library.js": {
|
||||
"type": "file",
|
||||
"size": 22135,
|
||||
"sha256": "0756e87b0af8e71c177a7be9ff175d645ecbf2dfaad36b5852cad82a4b60bba3"
|
||||
"size": 22146,
|
||||
"sha256": "029789405e732ff01d537fd7826980c9a9f2c07c95bde087c0e49478de0bd7b9"
|
||||
},
|
||||
"character-select.css": {
|
||||
"type": "file",
|
||||
@@ -8471,8 +8471,8 @@
|
||||
},
|
||||
"dialogue.js": {
|
||||
"type": "file",
|
||||
"size": 7649,
|
||||
"sha256": "a405f315270c24cdb2c53ba4e211a3fd5bf9bb582335d5dbf910adb5622deac6"
|
||||
"size": 7790,
|
||||
"sha256": "c138f465d52b04e27402b7b440f57631b36199d690d044fc48dd0640da689d51"
|
||||
},
|
||||
"energy-display.js": {
|
||||
"type": "file",
|
||||
@@ -8481,13 +8481,13 @@
|
||||
},
|
||||
"flow-ui.js": {
|
||||
"type": "file",
|
||||
"size": 3394,
|
||||
"sha256": "9070b108e2342a89b545c6d7c19af140431c343fc4e28e344e72f3fdc524f3b4"
|
||||
"size": 3440,
|
||||
"sha256": "5e889fdf671ff031fc661e148a13812cebb0fbcacaa81064589a8caf17e06efe"
|
||||
},
|
||||
"gm-manager.js": {
|
||||
"type": "file",
|
||||
"size": 9913,
|
||||
"sha256": "bdefd7704e499a25e7a02de26c6487dff55c15f2723089c8fd8d85155d9e2afc"
|
||||
"size": 9924,
|
||||
"sha256": "eefbcaa7fb4ddc68991b9d77bb1be253c4278a9008d171e85aac84b414b04455"
|
||||
},
|
||||
"hand": {
|
||||
"type": "directory",
|
||||
@@ -8514,8 +8514,8 @@
|
||||
},
|
||||
"input.js": {
|
||||
"type": "file",
|
||||
"size": 13034,
|
||||
"sha256": "8e2165ca0ca28d106d5c538ef1b248b3bc68ae23e0be8fcd10fcd62864512701"
|
||||
"size": 13480,
|
||||
"sha256": "ca1eb00598b1135cdc1b937642eaffdf5858b5e8e4678dd12bf4e384556a5372"
|
||||
},
|
||||
"overlays.js": {
|
||||
"type": "file",
|
||||
@@ -8524,8 +8524,8 @@
|
||||
},
|
||||
"style.css": {
|
||||
"type": "file",
|
||||
"size": 15499,
|
||||
"sha256": "bcc2c93ea1bca3118240e28cd77cc71941146b60ca6d8becd685f6e31fbf917a"
|
||||
"size": 15564,
|
||||
"sha256": "b958c78088e903c5ec09537f2d3b2241fe51a9067604e360b560c02fdac30904"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -8534,13 +8534,13 @@
|
||||
"children": {
|
||||
"index.js": {
|
||||
"type": "file",
|
||||
"size": 26766,
|
||||
"sha256": "a917b681a83db288244a61ee3cccba8315b13d35fdc4384f1a8e750dc776d68b"
|
||||
"size": 28411,
|
||||
"sha256": "fc9ea1815d75a6ad950a6f87a5af38cccebe05b032f3dde69dde0f7f13a9d8a6"
|
||||
},
|
||||
"overlays.js": {
|
||||
"type": "file",
|
||||
"size": 7007,
|
||||
"sha256": "769fe1227c6b54ba5852a02cdb75aa07b1edd674c2078a02d596178ddd4dff10"
|
||||
"size": 11817,
|
||||
"sha256": "1ed2cc37a4afddfcfff41bc7e1a94422855ead2f5f1b38a5d008eaa474d370b0"
|
||||
},
|
||||
"status-model.js": {
|
||||
"type": "file",
|
||||
@@ -8549,8 +8549,8 @@
|
||||
},
|
||||
"style.css": {
|
||||
"type": "file",
|
||||
"size": 20395,
|
||||
"sha256": "05e40d81cf81731cc2c0dc89ec876229d5a1f93100b69af38fee001927433626"
|
||||
"size": 19961,
|
||||
"sha256": "3313acbd5e99d3346cfb1ce95bad5274752da35a4e7fb6b4ff0fa92e2ad00907"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -8569,25 +8569,25 @@
|
||||
},
|
||||
"renderer.js": {
|
||||
"type": "file",
|
||||
"size": 26905,
|
||||
"sha256": "12c0755f38c0213093c8fd5b29f79fbfc721fed9a9d756bf12ee497363c05b26"
|
||||
"size": 27005,
|
||||
"sha256": "9ec156a410df674c80b987b243fce399415d8acc02db43d0018b56882d335609"
|
||||
}
|
||||
}
|
||||
},
|
||||
"navigation.js": {
|
||||
"type": "file",
|
||||
"size": 11317,
|
||||
"sha256": "62dc4cd8093b931c91b42070f36f6a7f54493cf13e55c682b8ef5c2bb8495be7"
|
||||
"size": 11328,
|
||||
"sha256": "6494765969d7e9f27bd03af778d4713fe4c361643d547fc0ce44975074ca67e7"
|
||||
},
|
||||
"potions.css": {
|
||||
"type": "file",
|
||||
"size": 2540,
|
||||
"sha256": "efc36a84f98a01e9734b54969bb47774c7bc37f47d678b7e3066e19b4f67a81b"
|
||||
"size": 2886,
|
||||
"sha256": "4a682e41cc7d69361bb7bd1a0a61fb2a90b8a63c0e1006e4ed1e87d1434d3461"
|
||||
},
|
||||
"potions.js": {
|
||||
"type": "file",
|
||||
"size": 6283,
|
||||
"sha256": "863f606776412b036f386ec691253ef17c608bae11c5cdbc1805de9898ff089e"
|
||||
"size": 8429,
|
||||
"sha256": "08b6be3bdd26553dbe25d8f409f51d02eb09023037132856cb2201b6143705cd"
|
||||
},
|
||||
"relic-icon.js": {
|
||||
"type": "file",
|
||||
@@ -8601,8 +8601,8 @@
|
||||
},
|
||||
"relics.js": {
|
||||
"type": "file",
|
||||
"size": 4563,
|
||||
"sha256": "2673556941004981a443cb7dc4d93dad23ae64ac1bb4ff471b95950429625608"
|
||||
"size": 4574,
|
||||
"sha256": "cecca4fb42dcaf596ba2645986a2244f51da56215d1e9583251f43691c0bb6c8"
|
||||
},
|
||||
"rest-ui.js": {
|
||||
"type": "file",
|
||||
@@ -8636,8 +8636,8 @@
|
||||
},
|
||||
"style.css": {
|
||||
"type": "file",
|
||||
"size": 82481,
|
||||
"sha256": "a382ac4a62389b0e2b5d8454ca0bb278f8c0019f8f3af6dcf18b8113e7af4fd2"
|
||||
"size": 84814,
|
||||
"sha256": "82a31f514ee896cb1c94fd4a2998a2c9e53b49d13a7155028dc72deded7c6c26"
|
||||
},
|
||||
"virtual-card-grid.js": {
|
||||
"type": "file",
|
||||
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "2.0.2.3-rc.9",
|
||||
"version": "2.0.2.3-rc.11",
|
||||
"module_id": "mengsan",
|
||||
"snapshot": "legacy",
|
||||
"files": [
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
# 梦三战斗 UI 回归清单
|
||||
|
||||
每次 review 核验下表各项。在报告中逐项写明通过、失败或未验,并记录证据对应的代码版本、皮肤、尺寸和缩放。涉及战斗 UI 的改动,附受影响场景的渲染截图。
|
||||
|
||||
| 场景 | 操作与通过标准 |
|
||||
| --- | --- |
|
||||
| 触屏拖牌与目标连线 | 从手牌拖出一张【杀】并移动到可选敌人。线起点贴在拖动牌上缘中央,终点跟随触点,两端误差各不超过 2 CSS px。取消手势后线立即消失。对合法目标松手后拖线立即消失,原生提交只触发一次。完整对局中再检查提交后的出牌特效能指向实际目标。 |
|
||||
| 普通出牌布局与缩放 | 在主动出牌阶段检查手牌扇面、提示语和「确定/回合结束」按钮组。三者共用战场中线,误差不超过 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,含非整数像素比。1080×486 使用无名杀「新版」布局,从 65% 缩放基线切换到 50%、85%、100% 和 120%,核验普通出牌位置和拖牌线。出牌后的默认及金龙连线均检查端点,完整金龙贴图需在客户端核验。
|
||||
|
||||
## Android 实机复核
|
||||
|
||||
在本轮改动对应的 Android 客户端启用十周年 UI,使用该客户端当前启用的皮肤复核各场景,并记录十周年 UI 版本和皮肤。拖牌时分别观察松手前的拖线和松手后的出牌特效。响应用两次事件分别检查确认和取消。弃牌时观察点牌瞬间,检查原生计数面板与药水槽能同时看清并各自操作。实机结果单独记录,实机不可用时写明未验。
|
||||
|
||||
涉及地图、剧情、奖励、牌库、遗物或其他公共弹窗时,一并使用[梦三界面缩放回归清单](mengsan-ui-zoom.md)。
|
||||
@@ -0,0 +1,39 @@
|
||||
# 梦三界面缩放回归清单
|
||||
|
||||
无名杀原生 UI 底层以 `transform: scale()` 缩放,十周年 UI 以 `body.zoom` 缩放。检查通用界面时覆盖两条入口,并记录界面缩放、窗口尺寸、UI 版本和实际使用的风格。
|
||||
|
||||
## 实施方案
|
||||
|
||||
- 地图用实际渲染尺寸换算鼠标位移,保证地图和指针同速移动。窄小布局允许行军菜单和顶部栏在各自区域滚动。
|
||||
- 选将和事件面板的高度随剩余空间调整,内容在面板内滚动,打开和关闭时恢复焦点也保持页面位置。
|
||||
- 剧情将文本和分支选项放进同一滚动容器,跳过和菜单留在顶部。较高倍率下可滚动查看并点按选项。
|
||||
- 牌库、牌堆、遗物、战斗状态、菜单确认和调试管理器沿用奖励与药水的原生对话框挂载方式,以可视窗口约束弹窗尺寸。打开、选择与关闭仍通过各自原有入口执行。
|
||||
- 战场右侧的牌堆和遗物入口随可用高度调整。战斗状态平时放在头像上方,上方空间不足时移到头像侧面。
|
||||
|
||||
## 验收项
|
||||
|
||||
| 范围 | 操作与通过标准 |
|
||||
| --- | --- |
|
||||
| 选将、事件、商店、休息处 | 能看到主操作,点按后返回正确选择或退出。 |
|
||||
| 地图和行军菜单 | 相同屏幕位移下,地图拖动与鼠标位移差不超过 2 CSS px。触屏能滚动,能点开菜单、查看行囊、返回和关闭,能选中可前往节点。 |
|
||||
| 剧情 | 文本和分支选项可浏览,点按分支写入正确剧情状态,跳过和继续均可用。 |
|
||||
| 奖励和战后结算 | 选牌、跳过和结算选项可到达,确认后继续流程。 |
|
||||
| 牌库、牌堆、遗物、药水和战斗状态 | 能通过实际入口打开,弹窗在可视区域内,详情和关闭可点按。内容较长时能滚动。 |
|
||||
| 菜单确认和调试管理器 | 对话框在可视区域内,所选操作返回正确结果,关闭后回到原界面。 |
|
||||
|
||||
## 浏览器复核
|
||||
|
||||
从术樱包根目录执行。脚本使用本地无名杀、十周年 UI、Playwright 和 Microsoft Edge。需要时将 `CODEX_NODE_MODULES` 指向包含 Playwright 的 `node_modules`,将 `HUD_ARTIFACTS` 指向已建立的截图目录。
|
||||
|
||||
```powershell
|
||||
$env:UI_ZOOM_REVIEW = '1'
|
||||
node mengsan/tools/test-battle-hud.cjs
|
||||
```
|
||||
|
||||
自动回归覆盖 16 个界面与交互。以 812×375 横屏为基线,十周年 UI 检查 50%、65%、100%、150%、200%、300%,原生 UI 检查 150% 和 300%。两条缩放入口均检查界面打开后从 65% 切到 200%。另检查 420×360 窄屏、390×720 竖屏和 1280×720 桌面。
|
||||
|
||||
脚本通过渲染出的按钮执行代表性操作,检查界面边界、返回值和关闭结果。鼠标地图拖动单独检查像素误差。完整战斗 HUD 和出牌响应按[战斗回归清单](mengsan-battle-ui.md)复核。
|
||||
|
||||
## Android 实机复核
|
||||
|
||||
用 Android 客户端实际启用的十周年 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/…`,与模块清单路径逐字一致。
|
||||
|
||||
- [ ] 在 `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`,确认因生成器尚缺而失败。
|
||||
- [ ] 实现生成器及 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>`。
|
||||
|
||||
## 任务二 · 接入两个发布工作流
|
||||
@@ -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。
|
||||
- [ ] 运行 `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 至多重新取一次再回退。校验、网络和解包错误记录包名及原因。写盘错误从暂存阶段直接抛出。
|
||||
- [ ] 在 `manageMengsanModule` 判定首次安装。无既有安装,或已明确清空的卸载记录进入全新安装;旧待修复记录按原路径。操作记录只在已知首次安装进入 `installing` 时标记 `freshInstall: true`,失败后该标记用于重新发起完整下载。通过 `installMengsanFiles` 把这个选择传给 `updateAllFiles` 的暂存阶段;本次已完成的文件更新原进度和清理集合,原文件池仅处理剩余项。将 ZIP 网络进度与已验证文件字节分开,避免回退时重复计数。保留现有正式路径落盘前复核及安装记录提交逻辑。
|
||||
- [ ] 运行 `node --check update.js` 和 Node 测试,确认通过。分别用清单对比正常 ZIP 和逐文件回退的最终目录及安装记录,确认每个新文件大小和 SHA-256 一致。
|
||||
|
||||
## 任务四 · 实机验收和默认启用
|
||||
|
||||
- [ ] 在同一台受支持手机上,用同一客户端版本、梦三标签、下载源和网络条件,对逐文件和分包的干净安装各测三次。每次从确认安装计时到校验完成。通过网络记录统计资源请求数,从应用及其 WebView 进程记录内存峰值,报告原始样本和中位数。先测 5 MiB 展开、6 MiB 下载上限,再按实测调整。
|
||||
- [ ] 在同一台受支持手机上,用同一客户端版本、梦三标签、下载源和网络条件,对逐文件和分包的干净安装各测三次。每次从确认安装计时到校验完成。通过网络记录统计资源请求数,从应用及其 WebView 进程记录内存峰值,报告原始样本和中位数。先测 10 MiB 展开、11 MiB 下载上限,再按实测调整。
|
||||
- [ ] 在客户端真实窗口验证 GitHub 与 Gitea Release 的匿名下载、重定向和跨域行为,并分别验证 ZIP 不可用时回退到当前源的同标签文件。测试手机端强制退出后再点击安装。通过安装记录、清单校验和重启后进入梦三确认结果。另跑桌面端首次安装及差量更新一次。
|
||||
- [ ] 对照同环境逐文件基线检验收益。建议启用条件为手机端资源请求数和总耗时中位数下降,内存峰值无可重复的上升,两个源与回退均通过。记录采用的包大小、测试设备和结果,再启用默认 ZIP 路径。
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import { configureDiagnostics } from "./diagnostics/index.js";
|
||||
|
||||
export const type = "extension";
|
||||
export let shuYing = new Object();
|
||||
const shuYingLocalVersion = "2.0.2.3-rc.9";
|
||||
const shuYingLocalVersion = "2.0.2.3-rc.11";
|
||||
|
||||
shuYing.name = "术樱包";
|
||||
shuYing.editable = false;
|
||||
|
||||
@@ -4,9 +4,12 @@ const http = require('node:http');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
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 { chromium } = require(path.join(packages, 'playwright'));
|
||||
const packages = process.env.CODEX_NODE_MODULES;
|
||||
const { chromium } = require(packages ? path.join(packages, 'playwright') : 'playwright');
|
||||
const prefix = '/extension/' + encodeURIComponent('术樱包') + '/mengsan';
|
||||
const decadePrefix = '/extension/' + encodeURIComponent('十周年UI');
|
||||
const reviewOnly = process.env.HUD_REVIEW === '1';
|
||||
const journeyReview = process.env.UI_ZOOM_REVIEW === '1';
|
||||
const holdStatus = async (page, locator, pointerType = 'mouse') => {
|
||||
const box = await locator.boundingBox();
|
||||
const point = {x:box.x + box.width / 2,y:box.y + box.height / 2};
|
||||
@@ -31,10 +34,389 @@ const exposedTarget = (page,index) => page.evaluate(index => {
|
||||
}
|
||||
throw new Error('Native target has no exposed drag point: '+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});
|
||||
}
|
||||
// Exercise a WebView-style mismatch between the SVG matrix and its painted bounds.
|
||||
await page.evaluate(() => {
|
||||
const create = document.createElementNS.bind(document);
|
||||
document.createElementNS = (namespace,tag) => {
|
||||
const node = create(namespace,tag);
|
||||
if (tag === 'svg') {
|
||||
const screenMatrix = node.getScreenCTM.bind(node);
|
||||
node.getScreenCTM = () => screenMatrix()?.translate(-120,45);
|
||||
}
|
||||
return node;
|
||||
};
|
||||
});
|
||||
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);
|
||||
await page.evaluate(() => { delete document.createElementNS; });
|
||||
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 checkOrdinaryPlayCenter(page, skin, artifact) {
|
||||
const geometry = await page.evaluate(async skin => {
|
||||
const {arena,control,me} = ui;
|
||||
const prompt = document.createElement('div');
|
||||
prompt.className = skin === 'native' ? 'dialog' : 'hand-tip';
|
||||
prompt.textContent = '请选择要使用的牌';
|
||||
arena.append(prompt);
|
||||
ui.dialog = prompt;
|
||||
hudEventState.event.dialog = prompt;
|
||||
hud.refresh();
|
||||
await new Promise(resolve=>requestAnimationFrame(()=>requestAnimationFrame(resolve)));
|
||||
const bounds = node => node.getBoundingClientRect().toJSON();
|
||||
const result = {arena:bounds(arena),hand:bounds(me),card:bounds(card),prompt:bounds(prompt),
|
||||
buttons:[...control.firstElementChild.children].map(bounds)};
|
||||
if (!window.card.isConnected) throw new Error('The original hand card must remain connected');
|
||||
return result;
|
||||
},skin);
|
||||
if (artifact) await page.screenshot({path:artifact});
|
||||
await page.evaluate(()=>{ui.dialog.remove();delete ui.dialog;delete hudEventState.event.dialog;hud.refresh();});
|
||||
const {arena,hand,card,prompt,buttons} = geometry;
|
||||
const center = box => (box.left+box.right)/2;
|
||||
const actions = {left:Math.min(...buttons.map(box=>box.left)),right:Math.max(...buttons.map(box=>box.right))};
|
||||
assert.ok([hand,card,prompt,actions].every(box=>Math.abs(center(box)-center(arena))<=2),
|
||||
'ordinary play fan, prompt and action buttons share the arena center: '+JSON.stringify(geometry));
|
||||
}
|
||||
|
||||
async function setBattleZoom(page, zoom) {
|
||||
await page.evaluate(zoom => {
|
||||
const {style} = document.body;
|
||||
style.zoom = zoom;
|
||||
style.width = style.height = '100%';
|
||||
},zoom);
|
||||
// Let the native hand transform and the resize observers settle after a zoom change.
|
||||
await page.waitForFunction(() => {
|
||||
const arena = ui.arena.getBoundingClientRect(), hand = card.getBoundingClientRect();
|
||||
return Math.abs(arena.width-innerWidth)<=2 &&
|
||||
Math.abs((arena.left+arena.right-hand.left-hand.right)/2)<=2;
|
||||
},null,{timeout:2500});
|
||||
}
|
||||
|
||||
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:selector => {
|
||||
const node = document.createElement('div');
|
||||
if (selector) node.className = 'linexy hidden';
|
||||
node.show = () => node.classList.remove('hidden');
|
||||
node.listenTransition = () => {};
|
||||
node.setBackgroundImage = path => {node.style.backgroundImage = `url(${path})`;};
|
||||
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();
|
||||
// Run the configured renderer as well as the default one. Its art may be provided by the Android package.
|
||||
Object.assign(engine.game,{
|
||||
linexy:engine.Game.prototype.zsJinlongLineXy,
|
||||
zsPlayLineAnimationByName:engine.Game.prototype.zsPlayLineAnimationByName,
|
||||
zsPlayLineAnimation:engine.Game.prototype.zsPlayLineAnimation,
|
||||
jianqiLineAnim:new engine.Game().jianqiLineAnim,
|
||||
});
|
||||
line.call(actor,target,{duration:120});
|
||||
const dragon = arena.lastElementChild;
|
||||
const {left,top,width,transform,backgroundImage} = dragon.style;
|
||||
const degrees = Number(transform.match(/rotate\(([-.\d]+)deg\)/)?.[1]);
|
||||
const radians = degrees*Math.PI/180;
|
||||
const distance = parseFloat(width)-2;
|
||||
const start = {x:parseFloat(left),y:parseFloat(top)+10};
|
||||
result.dragon = {start,end:{x:start.x+distance*Math.cos(radians),y:start.y+distance*Math.sin(radians)},backgroundImage};
|
||||
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));
|
||||
assert.ok(geometry.dragon.backgroundImage.includes('jinlonglinexy') &&
|
||||
Math.hypot(geometry.dragon.start.x-geometry.expectedStart.x,geometry.dragon.start.y-geometry.expectedStart.y)<=2 &&
|
||||
Math.hypot(geometry.dragon.end.x-geometry.expectedEnd.x,geometry.dragon.end.y-geometry.expectedEnd.y)<=2,
|
||||
'the configured Jinlong effect retains its 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();
|
||||
const verticalShift = Number.parseFloat(ui.control.style.translate.split(/\s+/)[1]) || 0;
|
||||
return verticalShift === 0 && 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 importMap = reviewOnly || journeyReview ? fs.readFileSync(path.join(app,'index.html'),'utf8').match(/<script type="importmap">.*?<\/script>/s)[0] : '';
|
||||
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==='/noname.js'){res.setHeader('Content-Type','text/javascript');res.end('export const _status={};');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(!reviewOnly && !journeyReview && 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') {
|
||||
res.setHeader('Content-Type','text/javascript');res.end('export const getDiagnostics=()=>({status:()=>({enabled:false}),scope:()=>({info(){},error(){}})});');return;
|
||||
}
|
||||
@@ -48,20 +430,32 @@ const server = http.createServer((req, res) => {
|
||||
const origin = 'http://127.0.0.1:' + server.address().port;
|
||||
const browser = await chromium.launch({channel:'msedge',headless:true});
|
||||
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 {
|
||||
if (journeyReview) {
|
||||
await require('./test-journey-ui-zoom.cjs').testJourneyZoom(browser,origin,prefix);
|
||||
return;
|
||||
}
|
||||
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}]) {
|
||||
const page = await browser.newPage({viewport,hasTouch:true});
|
||||
for (const viewport of viewports) {
|
||||
const page = await browser.newPage({viewport,hasTouch:true,deviceScaleFactor:reviewOnly?2.625:1});
|
||||
await page.goto(origin+'/fixture');
|
||||
if (reviewOnly && viewport.width===1080) {
|
||||
await page.addStyleTag({url:origin+'/layout/nova/layout.css'});
|
||||
await page.addStyleTag({content:'body{zoom:.65;width:100%;height:100%}'});
|
||||
}
|
||||
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'});
|
||||
if(reviewOnly) await page.addStyleTag({url:origin+prefix+'/ui/potions.css'});
|
||||
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});
|
||||
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+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)}));
|
||||
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)};
|
||||
@@ -82,12 +476,16 @@ const server = http.createServer((req, res) => {
|
||||
node.addEventListener('click',()=>{window.nativeActionClicks=(window.nativeActionClicks||0)+1;});
|
||||
});
|
||||
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;
|
||||
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>';
|
||||
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')};
|
||||
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")';
|
||||
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);
|
||||
@@ -119,6 +517,10 @@ const server = http.createServer((req, res) => {
|
||||
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 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=>{
|
||||
event.preventDefault();window.introOpens=(window.introOpens||0)+1;
|
||||
const tip=document.createElement('div');tip.className='dialog popped static';
|
||||
@@ -148,10 +550,50 @@ 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.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};
|
||||
},{prefix,skin});
|
||||
},{prefix,skin,reviewOnly,decadePrefix});
|
||||
assert.equal(initial.module,true,initial.error||'HUD mount module must exist');checks++;
|
||||
assert.equal(initial.parentKept,true);checks++;
|
||||
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+=8; }
|
||||
catch (error) { reviewFailures.push(`${scenario} ${error.message}`); }
|
||||
try { await checkOrdinaryPlayCenter(page,skin,artifact('ordinary-play-center')); checks++; }
|
||||
catch (error) { reviewFailures.push(`${scenario} ${error.message}`); }
|
||||
if (viewport.width===1080) {
|
||||
for (const zoom of [.5,.85,1,1.2]) {
|
||||
try {
|
||||
await setBattleZoom(page,zoom);
|
||||
await checkOrdinaryPlayCenter(page,skin);
|
||||
await checkMobileTargetLine(page);
|
||||
await checkCommittedLine(page,skin);
|
||||
checks+=9;
|
||||
} catch (error) { reviewFailures.push(`${scenario} zoom ${zoom} ${error.message}`); }
|
||||
}
|
||||
await setBattleZoom(page,.65);
|
||||
}
|
||||
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}`); }
|
||||
try {
|
||||
assert.equal(await page.evaluate(()=>{
|
||||
const bounds = window.decadeUI.boundsCaches.hand;
|
||||
bounds.check();
|
||||
hud.dispose();
|
||||
return bounds.updated;
|
||||
}),false,'the skin will read restored hand geometry after the HUD exits');
|
||||
checks++;
|
||||
} 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 control = document.createElement('div');
|
||||
control.className = 'control';
|
||||
@@ -444,6 +886,7 @@ const server = http.createServer((req, res) => {
|
||||
await page.close();
|
||||
}
|
||||
}
|
||||
if (reviewFailures.length) throw new Error(reviewFailures.join('\n'));
|
||||
console.log('HUD browser checks: '+checks);
|
||||
} finally {await browser.close();await new Promise(resolve=>server.close(resolve));}
|
||||
})().catch(error=>{console.error(error);server.close();process.exitCode=1;});
|
||||
|
||||
@@ -0,0 +1,198 @@
|
||||
const assert = require('node:assert/strict');
|
||||
const path = require('node:path');
|
||||
|
||||
const surfaces = [
|
||||
['选将', '.mengsan-character-overlay-shuying', '确认出征', 'mengsan_liubei_shuying'],
|
||||
['地图', '.mengsan-map-overlay-shuying', /可前往$/, 'route'],
|
||||
['事件选项', '.mengsan-flow-overlay-shuying', '继续', 'go'],
|
||||
['商店', '.mengsan-shop-overlay-shuying', '离开商店', 'leave'],
|
||||
['休息处', '.mengsan-rest-overlay-shuying', '离开休息处', 'done'],
|
||||
['剧情', '.mengsan-dialogue-overlay-shuying', /跳过对话/, null],
|
||||
['剧情分支', '.mengsan-dialogue-overlay-shuying', /剧情文本/, 'pledge'],
|
||||
['奖励选牌', '.mengsan-card-choice-dialog-shuying', '跳过', null],
|
||||
['战后选择', '.mengsan-victory-dialog-shuying', /领取战利品/, 'claim'],
|
||||
['牌库', '.mengsan-deck-dialog-shuying', '关闭', null],
|
||||
['牌堆', '.mengsan-deck-dialog-shuying', '关闭', null],
|
||||
['遗物', '.mengsan-relic-dialog-shuying', '关闭', null],
|
||||
['药水详情', '.mengsan-potion-dialog', '关闭', null],
|
||||
['菜单确认', '.mengsan-menu-dialog-shuying', '保留', 'keep'],
|
||||
['调试管理器', '.mengsan-gm-dialog-shuying', '关闭', null],
|
||||
['战斗状态', '.mengsan-hud-dialog-shuying', '关闭', null],
|
||||
];
|
||||
|
||||
async function mountSurface(page, origin, prefix, settings, surface) {
|
||||
await page.goto(origin+'/fixture');
|
||||
await page.addStyleTag({content:'#window,#arena{transition:none}'});
|
||||
for (const file of ['style','shop','rest','potions','character-select']) {
|
||||
await page.addStyleTag({url:origin+prefix+`/ui/${file}.css`});
|
||||
}
|
||||
await page.evaluate(async ({prefix,settings,surface}) => {
|
||||
const engine = await import('/noname.js');
|
||||
const imported = await import(prefix+'/progression/state.js');
|
||||
const updateZoom = settings.transform ? engine.UI.prototype.updatez.bind(engine.ui) :
|
||||
(await import('/extension/'+encodeURIComponent('十周年UI')+'/src/overrides/ui/update.js')).uiUpdatez;
|
||||
window.zoomReviewSetScale = zoom => {
|
||||
engine.game.documentZoom = zoom;
|
||||
updateZoom();
|
||||
};
|
||||
window.zoomReviewSetScale(settings.zoom);
|
||||
const ui = {window:document.getElementById('window'),arena:document.getElementById('arena'),create:{}};
|
||||
ui.create.div = (selector,...args) => {
|
||||
const element = document.createElement('div');
|
||||
element.className = selector.split('.').filter(Boolean).join(' ');
|
||||
element.setBackground = (name,type) => {element.style.backgroundImage=`url(/image/${type}/${name}.jpg)`;};
|
||||
for (const arg of args) {
|
||||
if (arg instanceof Node) arg.append(element);
|
||||
else if (typeof arg === 'string') element.textContent = arg;
|
||||
}
|
||||
return element;
|
||||
};
|
||||
engine.lib.config ??= {};
|
||||
engine.lib.assetURL = '/';
|
||||
engine.lib.card.sha ??= {type:'basic'};
|
||||
engine.lib.translate.sha = '杀';
|
||||
engine.lib.translate.sha_info = '对一名其他角色造成伤害。';
|
||||
engine.lib.translate.mengsan_liubei_shuying = '刘备';
|
||||
engine.setUI(ui);
|
||||
const run = imported.createRun('mengsan_liubei_shuying');
|
||||
Object.assign(run.player,{gold:99,hp:25,maxHp:50,potions:['ENERGY_POTION']});
|
||||
window.zoomReviewResult = null;
|
||||
function settled(value) {window.zoomReviewResult = value;}
|
||||
const modules = name => import(prefix+`/ui/${name}.js`);
|
||||
const choices = [{id:'go',name:'继续'},{id:'leave',name:'离开'}];
|
||||
if (surface==='选将') {
|
||||
const {chooseCharacterCards} = await modules('character-select');
|
||||
chooseCharacterCards([{id:run.player.character,name:'刘备',description:'出征武将'}],prefix,'返回').then(settled);
|
||||
} else if (surface==='地图') {
|
||||
const {showMap} = await modules('map/renderer');
|
||||
showMap(run).then(()=>settled('route'));
|
||||
} else if (surface==='事件选项') {
|
||||
const {chooseButtons} = await modules('flow-ui');
|
||||
chooseButtons('地图事件',choices,'选择一项继续前进').then(settled);
|
||||
} else if (surface==='商店') {
|
||||
const {chooseShop} = await modules('shop-ui');
|
||||
chooseShop(run.player,[{id:'supply:heal',name:'补给',description:'获得补给',price:30}]).then(settled);
|
||||
} else if (surface==='休息处') {
|
||||
const {chooseRest} = await modules('rest-ui');
|
||||
chooseRest([{id:'heal',name:'休息',description:'恢复生命'}],{tent:true}).then(settled);
|
||||
} else if (surface==='剧情' || surface==='剧情分支') {
|
||||
const {playDialogue} = await modules('dialogue');
|
||||
const branch = surface==='剧情分支';
|
||||
const lines = branch ? [{type:'choice',text:'如何回答?',speed:0,flag:'story.zoom',
|
||||
choices:[{id:'pledge',text:'结伴前行'},{id:'leave',text:'独自出发'}]}] :
|
||||
[{type:'narrator',text:'整备完毕,今日继续向前。',speed:0}];
|
||||
playDialogue(lines,{run}).then(()=>settled(branch ? run.storyFlags['story.zoom'] : null));
|
||||
} else if (surface==='奖励选牌') {
|
||||
const {chooseCardDialog} = await modules('reward-ui');
|
||||
chooseCardDialog([{id:'sha',card:{name:'sha'}}]).then(settled);
|
||||
} else if (surface==='战后选择') {
|
||||
const {chooseVictoryOptions} = await modules('reward-ui');
|
||||
chooseVictoryOptions([{id:'claim',label:'领取战利品'}]).then(settled);
|
||||
} else if (surface==='牌库') {
|
||||
const {openCardLibrary} = await modules('card-library');
|
||||
run.player.deck = Array.from({length:48},()=>({name:'sha',suit:'heart',number:5}));
|
||||
openCardLibrary(run);
|
||||
} else if (surface==='牌堆') {
|
||||
const {mountBattlePiles} = await modules('card-library');
|
||||
mountBattlePiles({active:true,ownResource(){}},{drawPile:run.player.deck,discardPile:[],exhaustPile:[]});
|
||||
} else if (surface==='遗物') {
|
||||
const {mountRelics} = await modules('relics');
|
||||
mountRelics({active:true,ownResource(){}},run,{status(){},counter:()=>({value:null,label:null})},{stripRoot:ui.arena});
|
||||
} else if (surface==='药水详情') {
|
||||
const {mountPotionSlots} = await modules('potions');
|
||||
const slots = mountPotionSlots(ui.arena,run.player,{use(){},canUse:()=>true});
|
||||
slots.layoutBattleSlots(ui);
|
||||
} else if (surface==='菜单确认') {
|
||||
const {askMenu} = await modules('navigation');
|
||||
askMenu('结束征程?','保留进度后可以继续。',[{id:'keep',name:'保留'}]).then(settled);
|
||||
} else if (surface==='调试管理器') {
|
||||
const {mountGMManager} = await modules('gm-manager');
|
||||
const game = {};
|
||||
mountGMManager({active:true,ownResource(){}},{getCards:()=>[]},{},{},
|
||||
{field:(target,key,value)=>{target[key]=value;}},game);
|
||||
game.mengsanGM_shuying();
|
||||
} else if (surface==='战斗状态') {
|
||||
const {mountBattleHUD} = await modules('hud/index');
|
||||
ui.me = document.getElementById('me');
|
||||
ui.control = document.getElementById('control');
|
||||
const player = ui.create.div('.player',ui.arena);
|
||||
Object.assign(player,{name:run.player.character,hp:25,maxHp:50,storage:{mengsanStrength_shuying:2},node:{}});
|
||||
mountBattleHUD(player,{session:{active:true,ownResource(){}}},{ui,get:engine.get,_status:engine._status,document,window,assetBase:prefix});
|
||||
}
|
||||
},{prefix,settings,surface});
|
||||
}
|
||||
|
||||
async function checkMapDrag(page) {
|
||||
const viewport = page.locator('.mengsan-map-viewport-shuying');
|
||||
const scroll = await viewport.evaluate(element => {
|
||||
element.scrollTop = (element.scrollHeight-element.clientHeight)/2;
|
||||
const box = element.getBoundingClientRect();
|
||||
const y = Math.min(box.bottom-4,innerHeight-4);
|
||||
return {top:element.scrollTop,scale:box.height/element.offsetHeight,x:box.left+box.width/2,y,
|
||||
distance:Math.min(32,Math.floor((y-Math.max(0,box.top))/2))};
|
||||
});
|
||||
assert.ok(scroll.distance>=8,`the map still provides a draggable viewport: ${JSON.stringify(scroll)}`);
|
||||
await page.mouse.move(scroll.x,scroll.y);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(scroll.x,scroll.y-scroll.distance,{steps:4});
|
||||
await page.mouse.up();
|
||||
const moved = await viewport.evaluate(element=>element.scrollTop)-scroll.top;
|
||||
assert.ok(Math.abs(moved*scroll.scale-scroll.distance)<=2,`map drag follows the pointer: ${JSON.stringify({...scroll,moved})}`);
|
||||
}
|
||||
|
||||
async function checkSurface(page, surface, settings, origin, prefix) {
|
||||
const [name,selector,buttonName,result] = surface;
|
||||
await mountSurface(page,origin,prefix,settings,name);
|
||||
const launcher = {'牌堆':'.mengsan-battle-piles-button-shuying','遗物':'.mengsan-battle-relics-button-shuying',
|
||||
'药水详情':'button.mengsan-potion-slot','战斗状态':'.mengsan-hud-status-shuying'}[name];
|
||||
if (launcher) await page.locator(launcher).first().tap({timeout:1800});
|
||||
const root = page.locator(selector);
|
||||
await root.waitFor({state:'visible',timeout:1800});
|
||||
if (settings.switchTo) {
|
||||
await page.evaluate(zoom => window.zoomReviewSetScale(zoom), settings.switchTo);
|
||||
}
|
||||
const box = await root.boundingBox();
|
||||
const viewport = page.viewportSize();
|
||||
assert.ok(box.x>=-2 && box.y>=-2 && box.x+box.width<=viewport.width+2 && box.y+box.height<=viewport.height+2,
|
||||
`surface within viewport: ${JSON.stringify({box,viewport})}`);
|
||||
if (name==='地图') {
|
||||
await checkMapDrag(page);
|
||||
await root.getByRole('button',{name:'菜单',exact:true}).tap({timeout:1800});
|
||||
const drawer = root.locator('.mengsan-map-menu-sheet-shuying');
|
||||
await drawer.getByRole('button',{name:/行囊/}).tap({timeout:1800});
|
||||
await drawer.getByRole('button',{name:'返回菜单',exact:true}).tap({timeout:1800});
|
||||
await drawer.getByRole('button',{name:'关闭菜单',exact:true}).tap({timeout:1800});
|
||||
}
|
||||
if (process.env.HUD_ARTIFACTS && settings.zoom===1.5 && !settings.transform && !settings.viewport) {
|
||||
await page.screenshot({path:path.join(process.env.HUD_ARTIFACTS,`zoom-${name}.png`)});
|
||||
}
|
||||
if (name==='剧情分支') await root.getByRole('button',{name:'结伴前行',exact:true}).tap({timeout:1800});
|
||||
const action = root.getByRole('button',{name:buttonName}).first();
|
||||
if(name==='牌库') {
|
||||
const card = root.locator('.ms-deck-card').first();
|
||||
await card.tap({timeout:1800});
|
||||
assert.ok(await root.locator('.ms-deck-detail').isVisible(),'a card opens its details');
|
||||
}
|
||||
await action.tap({timeout:1800});
|
||||
assert.equal(await root.count(),0,'the original action closes the surface');
|
||||
if (result!==null) assert.equal(await page.evaluate(()=>zoomReviewResult),result,'the original action returns the choice');
|
||||
}
|
||||
|
||||
exports.testJourneyZoom = async function testJourneyZoom(browser,origin,prefix) {
|
||||
const failures = [];
|
||||
let checks = 0;
|
||||
const scenarios = [{zoom:.5},{zoom:.65},{zoom:1},{zoom:1.5},{zoom:2},{zoom:3},{zoom:1.5,transform:true},
|
||||
{zoom:1.5,viewport:{width:420,height:360}}, {zoom:.65,transform:true,viewport:{width:390,height:720}},
|
||||
{zoom:1,transform:true,viewport:{width:1280,height:720}}, {zoom:3,transform:true},
|
||||
{zoom:.65,switchTo:2}, {zoom:.65,switchTo:2,transform:true}];
|
||||
for (const settings of scenarios) {
|
||||
const page = await browser.newPage({viewport:settings.viewport??{width:812,height:375},hasTouch:true});
|
||||
for (const surface of surfaces) {
|
||||
try { await checkSurface(page,surface,settings,origin,prefix); checks++; }
|
||||
catch (error) { failures.push(`${surface[0]} ${JSON.stringify(settings)} ${error.message}`); }
|
||||
}
|
||||
await page.close();
|
||||
}
|
||||
if (failures.length) throw new Error(`${checks} passed\n${failures.join('\n')}`);
|
||||
console.log(`Journey UI zoom: ${checks} passed`);
|
||||
};
|
||||
@@ -328,7 +328,7 @@ export function openCardLibrary(run, options = {}) {
|
||||
// Prevent the map's Escape/Tab handler from acting behind this modal.
|
||||
dialog.addEventListener("keydown", event => event.stopPropagation());
|
||||
render();
|
||||
document.body.appendChild(dialog);
|
||||
document.documentElement.appendChild(dialog);
|
||||
try { dialog.showModal(); } catch (error) { close(); throw error; }
|
||||
fitCards();
|
||||
if (typeof ResizeObserver !== "undefined") {
|
||||
|
||||
@@ -29,21 +29,22 @@ export const playDialogue = (lines, options = {}) => new Promise(resolve => {
|
||||
|
||||
const overlay = ui.create.div(".mengsan-dialogue-overlay-shuying", ui.window);
|
||||
const stage = ui.create.div(".mengsan-dialogue-stage-shuying", overlay);
|
||||
ui.create.div(".mengsan-dialogue-chapter-shuying", options.title || "剧情", stage);
|
||||
const textBox = ui.create.div(".mengsan-dialogue-box-shuying", stage);
|
||||
ui.create.div(".mengsan-dialogue-chapter-shuying", options.title || "剧情", overlay);
|
||||
const content = ui.create.div(".mengsan-dialogue-content-shuying", stage);
|
||||
const choices = ui.create.div(".mengsan-dialogue-choices-shuying", content);
|
||||
const textBox = ui.create.div(".mengsan-dialogue-box-shuying", content);
|
||||
const portraitFrame = ui.create.div(
|
||||
".mengsan-dialogue-portrait-frame-shuying", textBox);
|
||||
const speaker = ui.create.div(".mengsan-dialogue-speaker-shuying", textBox);
|
||||
const text = ui.create.div(".mengsan-dialogue-text-shuying", textBox);
|
||||
const progress = ui.create.div(".mengsan-dialogue-progress-shuying", textBox);
|
||||
const indicator = ui.create.div(".mengsan-dialogue-indicator-shuying", "◆", textBox);
|
||||
const choices = ui.create.div(".mengsan-dialogue-choices-shuying", stage);
|
||||
const skipButton = document.createElement("button");
|
||||
skipButton.type = "button";
|
||||
skipButton.className = "mengsan-dialogue-skip-shuying";
|
||||
skipButton.textContent = "跳过对话";
|
||||
skipButton.setAttribute("aria-label", "跳过对话,未选择的发言使用默认选项");
|
||||
stage.appendChild(skipButton);
|
||||
overlay.appendChild(skipButton);
|
||||
|
||||
let lineIndex = -1;
|
||||
let timer = null;
|
||||
@@ -189,5 +190,5 @@ export const playDialogue = (lines, options = {}) => new Promise(resolve => {
|
||||
const help = ui.create.div(".mengsan-dialogue-help-shuying", stage);
|
||||
help.textContent = "点击补全文字 · 再次点击继续 · Enter / 空格";
|
||||
showNextLine();
|
||||
textBox.focus();
|
||||
if (!awaitingChoice || typing) textBox.focus({ preventScroll: true });
|
||||
});
|
||||
|
||||
@@ -12,7 +12,7 @@ export const chooseFlow = (title, render, { back } = {}) => new Promise(resolve
|
||||
if (overlay.dataset.resolved) return;
|
||||
overlay.dataset.resolved = "true";
|
||||
overlay.remove();
|
||||
if (previousFocus?.isConnected) previousFocus.focus();
|
||||
if (previousFocus?.isConnected) previousFocus.focus({ preventScroll: true });
|
||||
resolve(id);
|
||||
};
|
||||
const initialFocus = render(overlay, finish);
|
||||
@@ -26,7 +26,7 @@ export const chooseFlow = (title, render, { back } = {}) => new Promise(resolve
|
||||
if (event.shiftKey && document.activeElement === first) { event.preventDefault(); last.focus(); }
|
||||
else if (!event.shiftKey && document.activeElement === last) { event.preventDefault(); first.focus(); }
|
||||
});
|
||||
initialFocus?.focus();
|
||||
initialFocus?.focus({ preventScroll: true });
|
||||
});
|
||||
|
||||
export const chooseButtons = (title, choices, description = "", options = {}) => chooseFlow(title, (overlay, finish) => {
|
||||
|
||||
@@ -181,7 +181,7 @@ export function mountGMManager(session, owner, piles, battle, resources, game) {
|
||||
const created = dialog;
|
||||
dialog.addEventListener("close", () => { if (dialog === created) close(); });
|
||||
dialog.addEventListener("keydown", event => event.stopPropagation());
|
||||
document.body.appendChild(dialog);
|
||||
document.documentElement.appendChild(dialog);
|
||||
try { dialog.showModal(); } catch (error) { close(); throw error; }
|
||||
render();
|
||||
dialog.querySelector(".ms-deck-header button").focus();
|
||||
|
||||
@@ -79,22 +79,30 @@ export function createHandInput(player, session, adapter, fan, env, refresh, log
|
||||
function removeAim() { aim?.remove(); aim = null; }
|
||||
function showAim(card, point) {
|
||||
const rect = card.getBoundingClientRect();
|
||||
const x = rect.left + rect.width / 2, y = rect.top + Math.min(12, rect.height / 2);
|
||||
const dx = point.x - x, dy = point.y - y;
|
||||
const length = Math.hypot(dx, dy);
|
||||
if (!(rect.width > 0 && rect.height > 0 && length > 0 && Number.isFinite(length))) {
|
||||
const x = rect.left + rect.width / 2, y = rect.top;
|
||||
if (!(rect.width > 0 && rect.height > 0 && Number.isFinite(point.x) && Number.isFinite(point.y))) {
|
||||
removeAim();
|
||||
return;
|
||||
}
|
||||
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.setAttribute("aria-hidden", "true");
|
||||
// 无名杀缩放 body,牌面矩形和指针事件都使用视口坐标。
|
||||
aim.setAttribute("preserveAspectRatio", "none");
|
||||
aim.appendChild(document.createElementNS(svg, "line"));
|
||||
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%)`;
|
||||
// Use the painted overlay bounds so card, touch and line share viewport CSS pixels.
|
||||
const overlay = aim.getBoundingClientRect();
|
||||
if (!(overlay.width > 0 && overlay.height > 0)) { removeAim(); return; }
|
||||
const viewBox = `0 0 ${overlay.width} ${overlay.height}`;
|
||||
if (aim.getAttribute("viewBox") !== viewBox) aim.setAttribute("viewBox", viewBox);
|
||||
const line = aim.firstElementChild;
|
||||
line.setAttribute("x1", x - overlay.left);
|
||||
line.setAttribute("y1", y - overlay.top);
|
||||
line.setAttribute("x2", point.x - overlay.left);
|
||||
line.setAttribute("y2", point.y - overlay.top);
|
||||
}
|
||||
function clearSelection(state) {
|
||||
if (!live(state) || !state.selected) return;
|
||||
|
||||
@@ -78,16 +78,18 @@
|
||||
}
|
||||
.mengsan-hand-aim-shuying {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 2.6px;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 1000;
|
||||
pointer-events: none;
|
||||
transform-origin: 0 0;
|
||||
transition: none;
|
||||
border-radius: 2px;
|
||||
background: rgb(250, 220, 140);
|
||||
box-shadow: 0 0 2px #f5d25b;
|
||||
}
|
||||
.mengsan-hand-aim-shuying > line {
|
||||
stroke: rgb(250, 220, 140);
|
||||
stroke-width: 2.6px;
|
||||
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(
|
||||
|
||||
+45
-14
@@ -108,7 +108,7 @@ export function mountBattleHUD(player, battle, env) {
|
||||
const openDetails = (target, id = null) => {
|
||||
if (disposed || frozen || !battle.session.active) return;
|
||||
closeDialog(); previousFocus = document.activeElement;
|
||||
dialog = create('dialog', 'mengsan-hud-dialog-shuying mengsan-deck-dialog-shuying mengsan-relic-dialog-shuying', document.body);
|
||||
dialog = create('dialog', 'mengsan-hud-dialog-shuying mengsan-deck-dialog-shuying mengsan-relic-dialog-shuying', document.documentElement);
|
||||
const current = dialog;
|
||||
const header = create('header', 'ms-deck-header', dialog);
|
||||
create('h2', '', header, `${nameOf(target)} · 当前状态`);
|
||||
@@ -247,8 +247,13 @@ export function mountBattleHUD(player, battle, env) {
|
||||
for (const mark of hiddenMarks) if (!wanted.has(mark)) { mark.classList.remove('mengsan-hud-represented-mark-shuying'); hiddenMarks.delete(mark); }
|
||||
for (const mark of wanted) if (!mark.classList.contains('mengsan-hud-represented-mark-shuying')) { mark.classList.add('mengsan-hud-represented-mark-shuying'); hiddenMarks.add(mark); }
|
||||
}
|
||||
let layout = null;
|
||||
let layout = null, handGeometry;
|
||||
const hudHeightFor = () => layout === 'short' ? 188 : layout === 'narrow' ? 288 : 274;
|
||||
function invalidateHandBounds() {
|
||||
// Decade uses this cache to place the origin of committed card effects.
|
||||
const bounds = window.decadeUI?.boundsCaches?.hand;
|
||||
if (bounds) bounds.updated = false;
|
||||
}
|
||||
const oldLayout = arena.getAttribute('data-mengsan-hud-layout');
|
||||
restores.push(() => {
|
||||
if (arena.getAttribute('data-mengsan-hud-layout') !== layout) return;
|
||||
@@ -272,20 +277,41 @@ export function mountBattleHUD(player, battle, env) {
|
||||
const hudHeight = hudHeightFor();
|
||||
style(arena, '--mengsan-hud-height', `${hudHeight}px`);
|
||||
const large = width >= 1000;
|
||||
style(arena, '--mengsan-hud-left', short ? '216px' : narrow ? '116px' : large ? '352px' : '292px');
|
||||
style(arena, '--mengsan-hud-right', short ? '132px' : narrow ? '116px' : '184px');
|
||||
const left = short ? 216 : narrow ? 116 : large ? 352 : 292;
|
||||
const right = short ? 132 : narrow ? 116 : 184;
|
||||
style(arena, '--mengsan-hud-left', `${left}px`);
|
||||
style(arena, '--mengsan-hud-right', `${right}px`);
|
||||
// Nova sets important geometry on #me and #handcards1. The HUD owns these positions for this battle.
|
||||
const handInset = Math.min(Math.max(left,right),Math.max(0,(width-114)/2));
|
||||
for (const [key,value] of Object.entries({left:`${handInset}px`,right:`${handInset}px`,
|
||||
width:'auto',bottom:short?'64px':'68px'})) style(handRoot,key,value);
|
||||
const firstHand = ui.handcards1Container;
|
||||
if (firstHand && handRoot.contains(firstHand)) {
|
||||
style(firstHand,'left','0px');
|
||||
style(firstHand,'width','100%');
|
||||
}
|
||||
const geometry = [handRoot.offsetLeft, handRoot.offsetTop, handRoot.offsetWidth, handRoot.offsetHeight].join(',');
|
||||
if (geometry !== handGeometry) {
|
||||
handGeometry = geometry;
|
||||
invalidateHandBounds();
|
||||
}
|
||||
style(arena, '--mengsan-profile-info-left', short ? '108px' : narrow ? '22px' : large ? '200px' : '160px');
|
||||
style(arena, '--mengsan-profile-width', short ? '172px' : narrow ? '76px' : large ? '200px' : '130px');
|
||||
skinActor(player);
|
||||
// Inline important dimensions also beat skins with #arena > .player !important rules.
|
||||
const selfLeft = short ? 24 : narrow ? 22 : 40;
|
||||
const selfWidth = short || narrow ? 76 : large ? 144 : 104;
|
||||
const selfBottom = narrow ? 180 : 24;
|
||||
const selfHeight = short || narrow ? 104 : large ? 196 : 148;
|
||||
const infoTop = narrow ? hudHeight - selfBottom + 16 : hudHeight - selfBottom - selfHeight + (short ? 0 : 20);
|
||||
style(arena, '--mengsan-profile-info-top', `${infoTop}px`);
|
||||
for (const [key, value] of Object.entries({left: short ? '24px' : narrow ? '22px' : '40px', right:'auto', top:'auto',
|
||||
bottom:`${selfBottom}px`, width:short ? '76px' : narrow ? '76px' : large ? '144px' : '104px',
|
||||
for (const [key, value] of Object.entries({left:`${selfLeft}px`, right:'auto', top:'auto',
|
||||
bottom:`${selfBottom}px`, width:`${selfWidth}px`,
|
||||
height:`${selfHeight}px`, transform:'none'})) style(player, key, value);
|
||||
style(arena, '--mengsan-side-dock-bottom', `${selfBottom + selfHeight + 12}px`);
|
||||
const statusBottom = selfBottom + selfHeight + 12;
|
||||
const statusBesidePortrait = height - statusBottom < 36;
|
||||
style(arena, '--mengsan-status-left', `${statusBesidePortrait ? selfLeft + selfWidth + 8 : selfLeft}px`);
|
||||
style(arena, '--mengsan-side-dock-bottom', `${statusBesidePortrait ? 8 : statusBottom}px`);
|
||||
style(arena, '--mengsan-relic-dock-bottom', `${selfBottom + selfHeight + (narrow ? -4 : 12)}px`);
|
||||
style(arena, '--mengsan-skill-ceiling', `${Math.min(hudHeight - 36, selfBottom + selfHeight)}px`);
|
||||
style(arena, '--mengsan-status-height', short ? '52px' : narrow ? '84px' : '160px');
|
||||
@@ -312,7 +338,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`,
|
||||
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.
|
||||
const candidates = [...new Set([ui.skills, ui.skills2, ui.skills3, ui.skillControl, ui.gskillControl])]
|
||||
.filter(node => node?.isConnected && node !== ui.control);
|
||||
@@ -339,8 +365,8 @@ export function mountBattleHUD(player, battle, env) {
|
||||
const hudHeight = hudHeightFor();
|
||||
const rail = layout === 'wide' ? 142 : layout === 'short' ? 112 : 96;
|
||||
const actionBottom = layout === 'narrow' ? hudHeight - 48 : hudHeight + 8;
|
||||
const compactActions = 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);
|
||||
const actionInset = response || arena.clientWidth < 1000 ? '16px' : 'max(var(--mengsan-hud-left),var(--mengsan-hud-right))';
|
||||
for (const [key,value] of Object.entries({position:'absolute',left:actionInset,right:actionInset,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')) {
|
||||
if (external.includes(group)) {
|
||||
ownClass(group,'mengsan-hud-native-skills-shuying');
|
||||
@@ -361,8 +387,9 @@ export function mountBattleHUD(player, battle, env) {
|
||||
ownClass(node,'mengsan-hud-external-action-shuying');
|
||||
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 center=(parseFloat(arena.style.getPropertyValue('--mengsan-hud-left'))+arena.clientWidth-parseFloat(arena.style.getPropertyValue('--mengsan-hud-right')))/2;
|
||||
const side=node===ui.confirm?-1:1;
|
||||
const responseConfirm = response && node === ui.confirm;
|
||||
const center=arena.clientWidth/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);
|
||||
}
|
||||
}
|
||||
@@ -388,8 +415,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))}%`;
|
||||
text(energy, `费用 ${player.storage.mengsanEnergy_shuying ?? 0} / ${player.storage.mengsanMaxEnergy_shuying ?? 0}`);
|
||||
syncActors(); syncExternalEquipment(); renderStatuses();
|
||||
refreshDetails(); syncControls(); syncNotifications();
|
||||
overlays.refresh({ footerHeight:hudHeightFor(), status:_status });
|
||||
const event = _status.event;
|
||||
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() {
|
||||
if (disposed || frozen || document.hidden || frame !== null) return;
|
||||
@@ -416,6 +446,7 @@ export function mountBattleHUD(player, battle, env) {
|
||||
for (const mark of hiddenMarks) mark.classList.remove('mengsan-hud-represented-mark-shuying'); hiddenMarks.clear();
|
||||
for (const restore of restores.reverse()) restore();
|
||||
releaseNodes();
|
||||
invalidateHandBounds();
|
||||
root.remove(); link.remove();
|
||||
}
|
||||
ownClass(document.body, 'mengsan-hud-active-shuying'); ownClass(arena, 'mengsan-hud-arena-shuying');
|
||||
|
||||
+93
-14
@@ -32,14 +32,18 @@ export function createOverlayLayout(arena, hand, ui, player) {
|
||||
for (const [name, had] of record.classes) if (!had) node.classList.remove(name);
|
||||
records.delete(node);
|
||||
}
|
||||
function mark(node, name) {
|
||||
function recordFor(node) {
|
||||
let record=records.get(node);
|
||||
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));
|
||||
node.classList.add(name);return record;
|
||||
}
|
||||
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)});
|
||||
const field=record.styles.get(key);
|
||||
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,'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 alignActions(handTop, center, gap, used, response) {
|
||||
const controls = [ui.control];
|
||||
if (response && 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 = response ? handTop - gap - bottom : 0;
|
||||
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 = {
|
||||
refresh(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 left=parseFloat(arena.style.getPropertyValue('--mengsan-hud-left'))||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 controlTop=ui.control.getBoundingClientRect().top;
|
||||
const prompts=new Set(arena.querySelectorAll(':scope > .hand-tip,:scope > .hand-tip-info'));
|
||||
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);
|
||||
// The event owns simple native prompt dialogs too, without a global game dependency.
|
||||
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);
|
||||
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 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 actionTop=alignActions(handCards.length ? Math.min(...handCards.map(box=>box.top)) : handTop,(a.left+a.right)/2,gap,used,response);
|
||||
const controlTop=ui.control.getBoundingClientRect().top;
|
||||
let promptBottom=Math.min(controlTop-10*zoom,a.bottom-(footerHeight+54)*zoom);
|
||||
if(response && Number.isFinite(actionTop))promptBottom=actionTop-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 promptWidth=response?arena.clientWidth-32:width;
|
||||
const promptX=a.left+(arena.clientWidth-promptWidth)*zoom/2;
|
||||
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();
|
||||
let hasPopup=false;
|
||||
for(const node of popups) {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
.mengsan-hud-health-track-shuying { width:100%;height:4px;margin:0 0 2px;background:#ffffff1a;border-radius:4px;overflow:hidden; }
|
||||
.mengsan-hud-health-track-shuying>span { height:100%;background:#9bb78d; }
|
||||
.mengsan-hud-energy-shuying { color:#eacb87;font-size:16px;font-variant-numeric:tabular-nums;white-space:nowrap; }
|
||||
.mengsan-hud-center-shuying { left:40px;right:auto;top:auto;bottom:var(--mengsan-side-dock-bottom);width:var(--mengsan-profile-width);height:var(--mengsan-status-height); }
|
||||
.mengsan-hud-center-shuying { left:var(--mengsan-status-left);right:auto;top:auto;bottom:var(--mengsan-side-dock-bottom);width:var(--mengsan-profile-width);height:var(--mengsan-status-height); }
|
||||
.mengsan-hud-shuying .mengsan-hud-statuses-shuying { display:grid;grid-template-columns:repeat(auto-fill,32px);grid-auto-rows:32px;align-content:end;gap:6px;overflow:hidden;white-space:nowrap;height:100%; }
|
||||
.mengsan-hud-shuying .mengsan-hud-status-shuying { display:flex;align-items:center;justify-content:center;width:32px;height:32px;min-width:0;min-height:32px;padding:2px;background:transparent;border-radius:6px;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;touch-action:pan-y; }
|
||||
.mengsan-hud-status-shuying img { width:26px;height:26px;object-fit:contain;pointer-events:none; }
|
||||
@@ -29,7 +29,7 @@
|
||||
Keep them above the portrait (25) and below action controls (30).
|
||||
Inline elevations used by awakening animations still take precedence. */
|
||||
body.mengsan-hud-active-shuying>#decadeUI-canvas { z-index:28; }
|
||||
.mengsan-hud-hand-shuying { position:absolute!important;left:var(--mengsan-hud-left)!important;right:var(--mengsan-hud-right)!important;bottom:68px!important;top:auto!important;width:calc(100% - var(--mengsan-hud-left) - var(--mengsan-hud-right))!important;height:calc(var(--mengsan-hud-height,274px) - 126px)!important;z-index:24!important;background:none!important;border:0!important;transform:none!important;pointer-events:none; }
|
||||
.mengsan-hud-hand-shuying { position:absolute!important;top:auto!important;height:calc(var(--mengsan-hud-height,274px) - 126px)!important;z-index:24!important;background:none!important;border:0!important;transform:none!important;pointer-events:none; }
|
||||
.mengsan-hud-hand-shuying .handcards>.card { pointer-events:auto; }
|
||||
.mengsan-hud-mebg-shuying,.mengsan-hud-hand-shuying>.fakeme.avatar { display:none!important; }
|
||||
/* These explicit references cover Decade's nested camp-wrap and hp-wrap as well. */
|
||||
@@ -75,12 +75,10 @@ body.mengsan-hud-active-shuying .mengsan-hud-potion-action-shuying { display:non
|
||||
[data-mengsan-hud-layout="short"] .mengsan-hud-hp-shuying,[data-mengsan-hud-layout="short"] .mengsan-hud-block-shuying { font-size:11px; }
|
||||
[data-mengsan-hud-layout="short"] .mengsan-hud-name-shuying { font-size:15px; }
|
||||
[data-mengsan-hud-layout="short"] .mengsan-hud-energy-shuying { font-size:14px; }
|
||||
[data-mengsan-hud-layout="short"] .mengsan-hud-hand-shuying { bottom:64px!important;height:calc(var(--mengsan-hud-height) - 122px)!important; }
|
||||
[data-mengsan-hud-layout="short"] .mengsan-hud-center-shuying { top:auto;left:24px; }
|
||||
[data-mengsan-hud-layout="short"] .mengsan-hud-hand-shuying { height:calc(var(--mengsan-hud-height) - 122px)!important; }
|
||||
[data-mengsan-hud-layout="short"] .mengsan-hud-shuying .mengsan-hud-status-shuying { min-height:26px;padding:2px 4px; }
|
||||
[data-mengsan-hud-layout="short"] .mengsan-hud-status-shuying img { width:18px;height:18px; }
|
||||
[data-mengsan-hud-layout="narrow"] .mengsan-hud-shuying .mengsan-hud-info-shuying { left:22px;width:76px;font-size:12px;gap:5px; }
|
||||
[data-mengsan-hud-layout="narrow"] .mengsan-hud-hand-shuying { bottom:68px!important; }
|
||||
[data-mengsan-hud-layout="narrow"] .mengsan-hud-name-shuying { font-size:16px; }
|
||||
[data-mengsan-hud-layout="narrow"] .mengsan-hud-status-shuying span { display:none; }
|
||||
#arena.mengsan-hud-arena-shuying>.mengsan-hud-notification-shuying { width:148px!important;max-width:148px!important;min-height:30px;height:30px!important;transition:none!important;font:600 16px/30px "Microsoft YaHei",sans-serif!important;white-space:nowrap; }
|
||||
@@ -119,7 +117,6 @@ body.mengsan-hud-active-shuying #arena .mengsan-hud-equips-shuying::-webkit-scro
|
||||
[data-mengsan-hud-layout="narrow"] .mengsan-hand-relics-shuying { right:16px!important;width:96px!important;max-width:96px!important;max-height:36px;flex-wrap:nowrap;justify-content:flex-start;overflow-x:auto;overflow-y:hidden;touch-action:pan-x; }
|
||||
body.mengsan-hud-active-shuying #arena>.mengsan-hud-controls-shuying>.mengsan-hud-native-skills-shuying { flex-direction:column!important;flex-wrap:nowrap!important;align-items:stretch!important;max-width:none!important;overflow:auto!important; }
|
||||
body.mengsan-hud-active-shuying #arena .mengsan-hud-native-skills-shuying>div { width:100%!important;min-width:0!important;box-sizing:border-box!important;padding:8px 10px!important;min-height:40px!important;font:14px/20px "Microsoft YaHei",sans-serif!important;white-space:normal!important; }
|
||||
[data-mengsan-hud-layout="narrow"] .mengsan-hud-center-shuying { left:22px; }
|
||||
[data-mengsan-hud-layout="short"] .mengsan-hud-shuying .mengsan-hud-statuses-shuying { height:100%; }
|
||||
.mengsan-hud-prompt-shuying { box-sizing:border-box!important;height:auto!important;min-height:0!important;overflow:auto!important;padding:2px 6px!important;background:none!important;border:0!important;box-shadow:none!important;text-align:center!important;z-index:32!important;color:#f6edcb!important;text-shadow:0 1px 3px #000,0 0 6px #000!important; }
|
||||
body.mengsan-hud-active-shuying .mengsan-hud-card-intro-shuying { box-sizing:border-box!important;z-index:90!important;height:auto!important;min-height:0!important;overflow:auto!important;border-radius:14px!important;background:#202020f5!important;box-shadow:0 8px 24px #0007!important;color:#f4f4f4!important;transition:none!important; }
|
||||
|
||||
@@ -415,7 +415,8 @@ export const showMap = (run, { saveRun } = {}) => new Promise(resolve => {
|
||||
suppressClick = true;
|
||||
if (!viewport.hasPointerCapture(event.pointerId)) viewport.setPointerCapture(event.pointerId);
|
||||
viewport.classList.add("dragging");
|
||||
viewport.scrollTop = drag.top - distance;
|
||||
const scale = viewport.getBoundingClientRect().height / viewport.offsetHeight || 1;
|
||||
viewport.scrollTop = drag.top - distance / scale;
|
||||
event.preventDefault();
|
||||
});
|
||||
const endDrag = event => {
|
||||
|
||||
@@ -145,7 +145,7 @@ export const askMenu = (title, description, choices) => new Promise(resolve => {
|
||||
dialog.appendChild(button);
|
||||
}
|
||||
dialog.addEventListener("cancel", event => { event.preventDefault(); finish(null); });
|
||||
document.body.appendChild(dialog);
|
||||
document.documentElement.appendChild(dialog);
|
||||
dialog.showModal();
|
||||
dialog.querySelector("button")?.focus();
|
||||
});
|
||||
|
||||
+11
-4
@@ -10,13 +10,20 @@
|
||||
|
||||
.mengsan-battle-potions {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
max-width: 44%;
|
||||
top: var(--mengsan-potion-top, 8px);
|
||||
left: var(--mengsan-potion-left, 8px);
|
||||
width: max-content;
|
||||
max-width: calc(50% - 16px);
|
||||
transition: none;
|
||||
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 {
|
||||
display: inline-grid;
|
||||
place-items: center;
|
||||
|
||||
+44
-1
@@ -58,6 +58,45 @@ export function showPotionDescription(node, view) {
|
||||
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 = {}) {
|
||||
const strip = element("div", "mengsan-potion-slots");
|
||||
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());
|
||||
}
|
||||
refresh();
|
||||
return { refresh, dispose() { close(); strip.remove(); } };
|
||||
return {
|
||||
refresh,
|
||||
layoutBattleSlots(ui) { if (actions.use && strip.isConnected) positionBattlePotions(root, strip, ui); },
|
||||
dispose() { close(); strip.remove(); },
|
||||
};
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ export function mountRelics(session, run, battleRelics, { stripRoot = ui.me } =
|
||||
});
|
||||
dialog.addEventListener("keydown", event => event.stopPropagation());
|
||||
refresh();
|
||||
document.body.appendChild(dialog);
|
||||
document.documentElement.appendChild(dialog);
|
||||
try { dialog.showModal(); dismiss.focus(); }
|
||||
catch (error) { close(); throw error; }
|
||||
};
|
||||
|
||||
+75
-25
@@ -303,9 +303,26 @@
|
||||
|
||||
.mengsan-dialogue-stage-shuying {
|
||||
position: absolute !important;
|
||||
inset: 0 !important;
|
||||
inset: 68px 0 max(8px, env(safe-area-inset-bottom)) !important;
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
height: auto !important;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 16px 0 6px;
|
||||
overflow: auto;
|
||||
touch-action: pan-y;
|
||||
}
|
||||
|
||||
.mengsan-dialogue-content-shuying {
|
||||
position: relative !important;
|
||||
display: flex;
|
||||
flex: none;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 28px;
|
||||
margin-top: auto;
|
||||
width: min(1120px, 92%);
|
||||
}
|
||||
|
||||
.mengsan-dialogue-chapter-shuying {
|
||||
@@ -388,13 +405,9 @@
|
||||
}
|
||||
|
||||
.mengsan-dialogue-box-shuying {
|
||||
position: absolute !important;
|
||||
left: 50% !important;
|
||||
right: auto !important;
|
||||
bottom: clamp(18px, 4vh, 42px) !important;
|
||||
top: auto !important;
|
||||
transform: translateX(-50%) !important;
|
||||
width: min(1120px, 92vw) !important;
|
||||
position: relative !important;
|
||||
inset: auto !important;
|
||||
width: 100% !important;
|
||||
height: auto !important;
|
||||
min-height: clamp(120px, 20vh, 180px);
|
||||
padding: clamp(32px, 5vh, 46px) clamp(24px, 4vw, 52px) 28px;
|
||||
@@ -496,9 +509,8 @@
|
||||
height: 146px !important;
|
||||
padding: 4px;
|
||||
}
|
||||
.mengsan-dialogue-content-shuying { width: 96%; }
|
||||
.mengsan-dialogue-box-shuying {
|
||||
bottom: 8px !important;
|
||||
width: 96vw !important;
|
||||
min-height: 126px;
|
||||
padding: 30px 18px 24px;
|
||||
}
|
||||
@@ -548,6 +560,7 @@
|
||||
|
||||
.mengsan-map-panel-shuying {
|
||||
padding: 0 !important;
|
||||
container-type: size;
|
||||
background:
|
||||
linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
|
||||
linear-gradient(rgba(255,255,255,.012) 1px, transparent 1px);
|
||||
@@ -783,7 +796,7 @@
|
||||
position: relative !important;
|
||||
z-index: 1;
|
||||
display: block !important;
|
||||
width: min(420px, calc(100vw - 32px));
|
||||
width: min(420px, calc(100% - 32px));
|
||||
height: 100% !important;
|
||||
padding: 0 !important;
|
||||
border: 0;
|
||||
@@ -920,7 +933,7 @@
|
||||
.mengsan-ink-legend-shuying { display: none; }
|
||||
.mengsan-map-shuying .mengsan-node-shuying { width: 52px; height: 52px; padding: 9px; }
|
||||
.mengsan-map-menu-layer-shuying { align-items: flex-end; }
|
||||
.mengsan-map-menu-sheet-shuying { width: 100%; height: min(82dvh, 680px) !important; border-right: 0; border-top: 1px solid rgba(210,175,101,.34); border-radius: 16px 16px 0 0; animation-name: mengsan-menu-enter-mobile-shuying; }
|
||||
.mengsan-map-menu-sheet-shuying { width: 100%; height: min(82%, 680px) !important; border-right: 0; border-top: 1px solid rgba(210,175,101,.34); border-radius: 16px 16px 0 0; animation-name: mengsan-menu-enter-mobile-shuying; }
|
||||
@keyframes mengsan-menu-enter-mobile-shuying { from { opacity: 0; transform: translateY(24px); } }
|
||||
.mengsan-map-menu-title-shuying { font-size: 24px; }
|
||||
.mengsan-map-menu-header-shuying { inset: 14px 14px auto 14px !important; }
|
||||
@@ -929,6 +942,35 @@
|
||||
.mengsan-map-menu-action-shuying { min-height: 64px; }
|
||||
}
|
||||
|
||||
@container (max-height: 325px) {
|
||||
.mengsan-map-menu-sheet-shuying { overflow-y: auto; overscroll-behavior-y: contain; }
|
||||
.mengsan-map-menu-header-shuying,
|
||||
.mengsan-map-menu-content-shuying,
|
||||
.mengsan-map-menu-footer-shuying {
|
||||
position: relative !important;
|
||||
inset: auto !important;
|
||||
width: auto !important;
|
||||
margin: 0 14px;
|
||||
}
|
||||
.mengsan-map-menu-header-shuying { height: auto !important; min-height: 54px; padding: 4px; }
|
||||
.mengsan-map-menu-content-shuying { overflow: visible; padding-top: 8px; }
|
||||
.mengsan-map-menu-footer-shuying { height: auto !important; padding: 8px 4px; }
|
||||
}
|
||||
@container (max-height: 190px) {
|
||||
.mengsan-map-header-shuying { grid-template-columns: auto minmax(0, 1fr); min-height: 0; gap: 4px 8px; padding: 4px 8px; }
|
||||
.mengsan-map-menu-trigger-shuying { width: 34px; min-width: 34px; min-height: 34px; }
|
||||
.mengsan-map-title-group-shuying > .mengsan-title-shuying { font-size: 16px; }
|
||||
.mengsan-map-header-shuying > .mengsan-map-status-shuying {
|
||||
grid-column: 1 / -1; justify-self: stretch; justify-content: flex-start;
|
||||
min-width: 0; flex-wrap: nowrap; gap: 4px; overflow-x: auto;
|
||||
}
|
||||
.mengsan-map-stat-shuying { flex: 0 0 auto; min-width: 38px; min-height: 24px; padding: 1px 4px; }
|
||||
.mengsan-map-status-shuying .mengsan-potion-slots { flex: none; flex-wrap: nowrap; }
|
||||
.mengsan-map-status-shuying .mengsan-potion-slot { width: 26px; height: 26px; }
|
||||
.mengsan-map-status-shuying .mengsan-potion-import { flex: none; white-space: nowrap; }
|
||||
.mengsan-map-viewport-shuying { padding-block: 0; }
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.mengsan-map-menu-sheet-shuying { animation: none !important; }
|
||||
.mengsan-map-menu-trigger-shuying,
|
||||
@@ -954,6 +996,11 @@
|
||||
.mengsan-flow-overlay-shuying {
|
||||
background: radial-gradient(ellipse at 18% 20%, #53635766, transparent 55%), linear-gradient(120deg, #172724f5, #101b1df5);
|
||||
padding: 80px 24px 28px;
|
||||
overflow: clip;
|
||||
}
|
||||
.mengsan-flow-overlay-shuying > .mengsan-panel-shuying {
|
||||
min-height: 0;
|
||||
overscroll-behavior: contain;
|
||||
}
|
||||
.mengsan-flow-panel-shuying {
|
||||
width: min(680px, 100%) !important;
|
||||
@@ -1156,30 +1203,35 @@ button.mengsan-card-choice-skip-shuying:hover { color: #fff1d5; border-color: #d
|
||||
.mengsan-menu-dialog-shuying p { margin: 0 0 24px; color: var(--flow-muted); }
|
||||
.mengsan-menu-dialog-shuying button { display: block; width: 100%; min-height: 48px; margin-top: 12px; border: 1px solid #c4a56888; border-radius: 3px; padding: 10px; font: inherit; color: var(--flow-paper); background: #ffffff08; cursor: pointer; }
|
||||
.mengsan-menu-dialog-shuying button.danger { background: var(--flow-danger); border-color: #d89586; }
|
||||
.mengsan-dialogue-overlay-shuying { background: radial-gradient(ellipse at 35% 25%, #62736544, transparent 60%), linear-gradient(120deg, #172724ee, #101b1dee); }
|
||||
.mengsan-dialogue-chapter-shuying { top: 26px !important; left: 24px !important; max-width: calc(100% - 160px); color: var(--flow-muted); }
|
||||
.mengsan-dialogue-overlay-shuying { container-type: size; background: radial-gradient(ellipse at 35% 25%, #62736544, transparent 60%), linear-gradient(120deg, #172724ee, #101b1dee); }
|
||||
.mengsan-dialogue-chapter-shuying { top: 26px !important; left: 50% !important; right: auto !important; transform: translateX(-50%); max-width: 30%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--flow-muted); }
|
||||
.mengsan-dialogue-box-shuying { border-radius: 4px; border-color: var(--flow-gold); background: #172724f5; padding-bottom: 34px; }
|
||||
.mengsan-dialogue-speaker-shuying { border-radius: 2px; color: #172724; background: #efe5cf; font-family: "KaiTi", "SimSun", serif; }
|
||||
.mengsan-dialogue-text-shuying { color: var(--flow-paper); font-size: clamp(17px, 2vw, 22px); line-height: 1.85; max-height: 30vh; overflow: auto; }
|
||||
.mengsan-dialogue-help-shuying { position: absolute !important; bottom: 8px; left: 16px; right: 16px; text-align: center; font-size: 12px; color: var(--flow-muted); pointer-events: none; }
|
||||
.mengsan-dialogue-choices-shuying { position: absolute !important; left: 50%; bottom: clamp(210px, 32vh, 290px); transform: translateX(-50%); width: min(580px, 88vw); display: grid; gap: 10px; z-index: 5; }
|
||||
.mengsan-dialogue-help-shuying { position: relative !important; flex: none; margin: 8px 16px 0; text-align: center; font-size: 12px; color: var(--flow-muted); pointer-events: none; }
|
||||
.mengsan-dialogue-choices-shuying { position: relative !important; width: min(580px, 100%); display: grid; gap: 10px; z-index: 5; }
|
||||
.mengsan-dialogue-choices-shuying:empty { display: none; }
|
||||
.mengsan-dialogue-skip-shuying { position: absolute !important; top: max(18px, env(safe-area-inset-top)); left: max(18px, env(safe-area-inset-left)); z-index: 6; padding: 8px 14px; border: 1px solid var(--flow-gold); border-radius: 4px; color: var(--flow-paper); background: #172724e8; font: inherit; cursor: pointer; }
|
||||
.mengsan-dialogue-skip-shuying:hover, .mengsan-dialogue-skip-shuying:focus-visible { background: #304540; outline: 2px solid var(--flow-gold); outline-offset: 2px; }
|
||||
.mengsan-dialogue-choice-shuying { padding: 12px 18px; border: 1px solid var(--flow-gold); border-radius: 4px; color: var(--flow-paper); background: #172724f5; text-align: left; font: inherit; cursor: pointer; }
|
||||
.mengsan-dialogue-choice-shuying:hover, .mengsan-dialogue-choice-shuying:focus-visible { background: #304540; outline: 2px solid var(--flow-gold); outline-offset: 2px; }
|
||||
@container (max-height: 280px) {
|
||||
.mengsan-dialogue-stage-shuying { padding-top: 4px; }
|
||||
.mengsan-dialogue-choices-shuying { gap: 6px; }
|
||||
.mengsan-dialogue-choice-shuying { min-height: 36px; padding: 6px 14px; }
|
||||
}
|
||||
@media (max-width: 600px) {
|
||||
.mengsan-dialogue-chapter-shuying { display: block !important; font-size: 14px; }
|
||||
.mengsan-flow-overlay-shuying { padding: 78px 12px 16px; }
|
||||
.mengsan-flow-panel-shuying { padding: 24px 18px; }
|
||||
.mengsan-flow-panel-shuying > .mengsan-title-shuying { font-size: 30px; }
|
||||
.mengsan-flow-panel-shuying .mengsan-choice-shuying { padding: 14px; }
|
||||
.mengsan-dialogue-box-shuying { bottom: 36px !important; }
|
||||
}
|
||||
@media (max-height: 500px) {
|
||||
.mengsan-flow-overlay-shuying { padding-top: 70px; padding-bottom: 12px; }
|
||||
.mengsan-flow-panel-shuying { padding: 18px 24px; }
|
||||
.mengsan-flow-panel-shuying > .mengsan-description-shuying { margin-bottom: 16px; }
|
||||
.mengsan-dialogue-box-shuying { bottom: 28px !important; min-height: 100px; max-height: 50vh; padding: 24px 20px 20px; }
|
||||
.mengsan-dialogue-box-shuying { min-height: 100px; padding: 24px 20px 20px; }
|
||||
.mengsan-dialogue-text-shuying { max-height: 24vh; }
|
||||
.mengsan-dialogue-portrait-frame-shuying {
|
||||
height: 110px !important;
|
||||
@@ -1267,7 +1319,8 @@ dialog.mengsan-deck-dialog-shuying::backdrop { background: #080706b8; }
|
||||
|
||||
/* Battle-only control; removed with its owning session. */
|
||||
.mengsan-battle-piles-button-shuying {
|
||||
position: fixed !important; right: max(14px, env(safe-area-inset-right)); top: 110px;
|
||||
--mengsan-battle-side-top: clamp(4px, calc(100% - 100px), 110px);
|
||||
position: fixed !important; right: max(14px, env(safe-area-inset-right)); top: var(--mengsan-battle-side-top);
|
||||
z-index: 35; min-width: 64px; min-height: 44px; padding: 8px 14px;
|
||||
border: 1px solid #dcb578; border-radius: 8px; background: #30251eee;
|
||||
color: #f4e7cc; font: 16px/1.4 "Microsoft YaHei", sans-serif;
|
||||
@@ -1282,7 +1335,7 @@ dialog.mengsan-deck-dialog-shuying::backdrop { background: #080706b8; }
|
||||
.mengsan-gm-dialog-shuying .ms-gm-editor { overflow: auto; flex: 1; min-height: 0; border-top: 1px solid #96754e; padding: 12px 4px; }
|
||||
.mengsan-gm-dialog-shuying .ms-gm-affixes { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 10px; margin-top: 12px; }
|
||||
.mengsan-gm-dialog-shuying .ms-gm-affixes button:disabled { opacity: .55; cursor: not-allowed; }
|
||||
@media (max-height: 500px) { .mengsan-battle-piles-button-shuying { top: 70px; right: max(8px, env(safe-area-inset-right)); } }
|
||||
@media (max-height: 500px) { .mengsan-battle-piles-button-shuying { --mengsan-battle-side-top: clamp(4px, calc(100% - 100px), 70px); right: max(8px, env(safe-area-inset-right)); } }
|
||||
|
||||
/* Only session-created Mengsan players; retain internal identity and seat order. */
|
||||
.player.mengsan-hide-identity-shuying > .identity {
|
||||
@@ -1408,7 +1461,7 @@ body.mengsan-battle-ui-shuying #arena[data-number="3"] > .player:is([data-positi
|
||||
height: 22px;
|
||||
object-fit: contain;
|
||||
}
|
||||
.mengsan-battle-relics-button-shuying { top: 162px; }
|
||||
.mengsan-battle-relics-button-shuying { top: calc(var(--mengsan-battle-side-top) + 52px); }
|
||||
.mengsan-hand-relics-shuying {
|
||||
position: absolute !important;
|
||||
left: 0;
|
||||
@@ -1503,9 +1556,6 @@ body.mengsan-battle-ui-shuying #arena[data-number="3"] > .player:is([data-positi
|
||||
.mengsan-map-inventory-row-shuying > .mengsan-relic-icon-shuying { width: 40px; height: 40px; }
|
||||
.mengsan-relic-choice-tile-shuying .mengsan-card-choice-art-shuying img { padding: 14px; box-sizing: border-box; background: transparent; }
|
||||
.mengsan-relic-choice-tile-shuying .mengsan-card-choice-art-shuying:has(img) .mengsan-card-choice-glyph-shuying { display: none; }
|
||||
@media (max-height: 500px) {
|
||||
.mengsan-battle-relics-button-shuying { top: 122px; }
|
||||
}
|
||||
.mengsan-bonds-shuying {
|
||||
position: relative !important;
|
||||
flex-shrink: 0;
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ const { game } = await import(new URL("noname.js", document.baseURI).href);
|
||||
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")`,不支持的客户端继续逐文件下载。
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ from pathlib import Path
|
||||
|
||||
from generate_manifest import validate_relative_paths
|
||||
|
||||
MAX_UNCOMPRESSED_BYTES = 5 * 1024**2
|
||||
MAX_ARCHIVE_BYTES = 6 * 1024**2
|
||||
MAX_UNCOMPRESSED_BYTES = 10 * 1024**2
|
||||
MAX_ARCHIVE_BYTES = MAX_UNCOMPRESSED_BYTES + 1024**2
|
||||
|
||||
|
||||
def write_part(root: Path, part: Path, files: list[str], manifest: dict) -> None:
|
||||
|
||||
@@ -30,11 +30,11 @@ class MengsanArchivesTest(unittest.TestCase):
|
||||
}), encoding="utf-8")
|
||||
|
||||
def test_parts_cover_packable_files_once(self):
|
||||
first = b"a" * (3 * 1024**2)
|
||||
second = b"b" * (3 * 1024**2)
|
||||
first = b"a" * (10 * 1024**2)
|
||||
second = b"b"
|
||||
self.write_snapshot({
|
||||
"mengsan/b": second,
|
||||
"mengsan/oversized": b"c" * (5 * 1024**2 + 1),
|
||||
"mengsan/oversized": b"c" * (10 * 1024**2 + 1),
|
||||
"mengsan/a": first,
|
||||
})
|
||||
parts = build_archives(self.root, self.output, "v2.0.2.3-rc.8")
|
||||
|
||||
@@ -25,13 +25,13 @@ function info(text) {
|
||||
return { size: Buffer.byteLength(text), sha256: createHash("sha256").update(text).digest("hex") };
|
||||
}
|
||||
|
||||
function zip(files) {
|
||||
function zip(files, compression = "DEFLATE") {
|
||||
const archive = new JSZip();
|
||||
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",
|
||||
blocksBrowserAssets = false, canInflate = true, localVersion = version } = {}) {
|
||||
const github = source == "github";
|
||||
@@ -74,7 +74,7 @@ async function setup({ source = "github", parts = [zip(assets)], releaseTag = ta
|
||||
files: { "extension.js": info("main") },
|
||||
modules: { mengsan: { entry: moduleEntry, manifest: modulePath } } };
|
||||
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 name = `mengsan-${tag}-part-${String(index + 1).padStart(3, "0")}.zip`;
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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.evaluate();
|
||||
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 };
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ async function install(options) {
|
||||
function assertInstalled(result) {
|
||||
assert.deepEqual(result.errors, []);
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -240,7 +240,6 @@ for (const [description, options] of Object.entries({
|
||||
"draft release": { draft: true },
|
||||
"invalid ZIP": { parts: [new Uint8Array([1, 2, 3])] },
|
||||
"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) }] },
|
||||
})) {
|
||||
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 () => {
|
||||
const result = await install({ failWrite: true });
|
||||
assert.equal(result.config[recordKey]?.status, "disabled");
|
||||
|
||||
@@ -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 githubRawBase = "https://raw.githubusercontent.com/Shu-Ying/noname-shuying";
|
||||
const coreTempDir = "extension/术樱包/.update_tmp";
|
||||
const mengsanArchiveBytes = 6 * 1024 * 1024;
|
||||
const mengsanUncompressedBytes = 5 * 1024 * 1024;
|
||||
const mengsanUncompressedBytes = 10 * 1024 * 1024;
|
||||
const mengsanArchiveBytes = mengsanUncompressedBytes + 1024 * 1024;
|
||||
let fileMutationUncertain = false;
|
||||
const verifiedCacheKey = "shuYing_update_verified_files";
|
||||
const installedManifestKey = "shuYing_update_installation";
|
||||
|
||||
Reference in New Issue
Block a user