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 | |
|---|---|---|---|
|
|
8079c868be | ||
|
|
defbd639e1 | ||
|
|
d61b4b2526 |
@@ -20,6 +20,7 @@ tools/*.mjs
|
|||||||
!/tools/test_mengsan_zip_install.mjs
|
!/tools/test_mengsan_zip_install.mjs
|
||||||
!/mengsan/tools/test-hud-status.cjs
|
!/mengsan/tools/test-hud-status.cjs
|
||||||
!/mengsan/tools/test-battle-hud.cjs
|
!/mengsan/tools/test-battle-hud.cjs
|
||||||
|
!/mengsan/tools/test-journey-ui-zoom.cjs
|
||||||
!/mengsan/tools/import-status-icons.cjs
|
!/mengsan/tools/import-status-icons.cjs
|
||||||
|
|
||||||
/.update_tmp/
|
/.update_tmp/
|
||||||
|
|||||||
Vendored
+6
-6
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"version": "2.0.2.3-rc.10",
|
"version": "2.0.2.3-rc.12",
|
||||||
"generated_at": "2026-11-24T04:08:42.242236+00:00",
|
"generated_at": "2026-11-24T09:48:22.826349+00:00",
|
||||||
"algorithm": "sha256",
|
"algorithm": "sha256",
|
||||||
"update_channels": true,
|
"update_channels": true,
|
||||||
"file_count": 288,
|
"file_count": 288,
|
||||||
"size_bytes": 48059903,
|
"size_bytes": 48059903,
|
||||||
"folder_sha256": "db468919dfb9a06552c4b6122a05f2af4967be3604d3b5c6613ffcf24f28e335",
|
"folder_sha256": "9e1cc4963c9a7196cac7a4859085e64d20c023c8e5b633511576a52f3f4f90c4",
|
||||||
"core": [
|
"core": [
|
||||||
"extension.js",
|
"extension.js",
|
||||||
"menu.js",
|
"menu.js",
|
||||||
@@ -439,7 +439,7 @@
|
|||||||
},
|
},
|
||||||
"extension.js": {
|
"extension.js": {
|
||||||
"size": 15732,
|
"size": 15732,
|
||||||
"sha256": "4378ce1123d26ce777e01c0a159f8b0895529a1d2f6941567388a3f447e150bc"
|
"sha256": "10e65b526a40e307dcac38c3b7819b3122755676bab26722f5c8ec762c4ea044"
|
||||||
},
|
},
|
||||||
"function.js": {
|
"function.js": {
|
||||||
"size": 38588,
|
"size": 38588,
|
||||||
@@ -1696,7 +1696,7 @@
|
|||||||
"extension.js": {
|
"extension.js": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"size": 15732,
|
"size": 15732,
|
||||||
"sha256": "4378ce1123d26ce777e01c0a159f8b0895529a1d2f6941567388a3f447e150bc"
|
"sha256": "10e65b526a40e307dcac38c3b7819b3122755676bab26722f5c8ec762c4ea044"
|
||||||
},
|
},
|
||||||
"function.js": {
|
"function.js": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
@@ -3116,7 +3116,7 @@
|
|||||||
"entry": "mengsan/register.js",
|
"entry": "mengsan/register.js",
|
||||||
"manifest": "dist/modules/mengsan.json",
|
"manifest": "dist/modules/mengsan.json",
|
||||||
"file_count": 846,
|
"file_count": 846,
|
||||||
"size_bytes": 150436158,
|
"size_bytes": 150445067,
|
||||||
"legacy_manifest": "dist/modules/mengsan.legacy.json"
|
"legacy_manifest": "dist/modules/mengsan.legacy.json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+64
-64
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"version": "2.0.2.3-rc.10",
|
"version": "2.0.2.3-rc.12",
|
||||||
"generated_at": "2026-11-24T04:08:42.243037+00:00",
|
"generated_at": "2026-11-24T09:48:22.828556+00:00",
|
||||||
"algorithm": "sha256",
|
"algorithm": "sha256",
|
||||||
"update_channels": true,
|
"update_channels": true,
|
||||||
"file_count": 846,
|
"file_count": 846,
|
||||||
"size_bytes": 150436158,
|
"size_bytes": 150445067,
|
||||||
"folder_sha256": "9babf97d7834d9abb150995481290e0508fb3fe8b4ea4ea5ffff5cb0d5225525",
|
"folder_sha256": "217415a2ab324c7b08b010a3269422933db6671093c655340a97cc9e92f488b5",
|
||||||
"core": [
|
"core": [
|
||||||
"mengsan/register.js"
|
"mengsan/register.js"
|
||||||
],
|
],
|
||||||
@@ -3724,8 +3724,8 @@
|
|||||||
"sha256": "6397fcbcd50dba1dc1901b1ea5a3a720d4156c6a761290f904a2135e7a84d373"
|
"sha256": "6397fcbcd50dba1dc1901b1ea5a3a720d4156c6a761290f904a2135e7a84d373"
|
||||||
},
|
},
|
||||||
"mengsan/cards/personal-piles.js": {
|
"mengsan/cards/personal-piles.js": {
|
||||||
"size": 24068,
|
"size": 25275,
|
||||||
"sha256": "49c8fc467c159efac1087da5c41ee4eb27707867128135b59042e9bbfde65846"
|
"sha256": "3b8b7311f527b7b0ac1b0dee89f6b77caa751c9562f4b0a70ec2094a973e403a"
|
||||||
},
|
},
|
||||||
"mengsan/cards/rampage.js": {
|
"mengsan/cards/rampage.js": {
|
||||||
"size": 5265,
|
"size": 5265,
|
||||||
@@ -3876,8 +3876,8 @@
|
|||||||
"sha256": "580282573457b4fcc27fe976e81aea415148310f0ce543b18dbc18e719dff909"
|
"sha256": "580282573457b4fcc27fe976e81aea415148310f0ce543b18dbc18e719dff909"
|
||||||
},
|
},
|
||||||
"mengsan/mode.js": {
|
"mengsan/mode.js": {
|
||||||
"size": 126390,
|
"size": 126443,
|
||||||
"sha256": "b6715380f36bee8a52d404a8f307ddd967a407c6c3d6bf573c94b3315b4c1f1a"
|
"sha256": "d46a0e698ff3b1ce9a7f738cbf5c3c3bce847e349cf69a6601484db4ef7f3138"
|
||||||
},
|
},
|
||||||
"mengsan/monsters/actions.js": {
|
"mengsan/monsters/actions.js": {
|
||||||
"size": 33807,
|
"size": 33807,
|
||||||
@@ -4104,8 +4104,8 @@
|
|||||||
"sha256": "784641ea207432c3fe9e55b83d95a7976490521bbfb736d01973f7adaee749d1"
|
"sha256": "784641ea207432c3fe9e55b83d95a7976490521bbfb736d01973f7adaee749d1"
|
||||||
},
|
},
|
||||||
"mengsan/ui/card-library.js": {
|
"mengsan/ui/card-library.js": {
|
||||||
"size": 22135,
|
"size": 25506,
|
||||||
"sha256": "0756e87b0af8e71c177a7be9ff175d645ecbf2dfaad36b5852cad82a4b60bba3"
|
"sha256": "0b75ac71ef4a9a8ace598aeb03fe59fe866371369d2db035380b0ea169d6f528"
|
||||||
},
|
},
|
||||||
"mengsan/ui/character-select.css": {
|
"mengsan/ui/character-select.css": {
|
||||||
"size": 6060,
|
"size": 6060,
|
||||||
@@ -4116,20 +4116,20 @@
|
|||||||
"sha256": "81073b10ae63ac921c1eed851127c64fbe6ca4407d4b9b41c3a24b6373cb1e87"
|
"sha256": "81073b10ae63ac921c1eed851127c64fbe6ca4407d4b9b41c3a24b6373cb1e87"
|
||||||
},
|
},
|
||||||
"mengsan/ui/dialogue.js": {
|
"mengsan/ui/dialogue.js": {
|
||||||
"size": 7649,
|
"size": 7790,
|
||||||
"sha256": "a405f315270c24cdb2c53ba4e211a3fd5bf9bb582335d5dbf910adb5622deac6"
|
"sha256": "c138f465d52b04e27402b7b440f57631b36199d690d044fc48dd0640da689d51"
|
||||||
},
|
},
|
||||||
"mengsan/ui/energy-display.js": {
|
"mengsan/ui/energy-display.js": {
|
||||||
"size": 498,
|
"size": 498,
|
||||||
"sha256": "b12157ac3008c0e63fb384fe5fefe54964b86436652c73670f6a4c4faa4ad1da"
|
"sha256": "b12157ac3008c0e63fb384fe5fefe54964b86436652c73670f6a4c4faa4ad1da"
|
||||||
},
|
},
|
||||||
"mengsan/ui/flow-ui.js": {
|
"mengsan/ui/flow-ui.js": {
|
||||||
"size": 3394,
|
"size": 3440,
|
||||||
"sha256": "9070b108e2342a89b545c6d7c19af140431c343fc4e28e344e72f3fdc524f3b4"
|
"sha256": "5e889fdf671ff031fc661e148a13812cebb0fbcacaa81064589a8caf17e06efe"
|
||||||
},
|
},
|
||||||
"mengsan/ui/gm-manager.js": {
|
"mengsan/ui/gm-manager.js": {
|
||||||
"size": 9913,
|
"size": 9924,
|
||||||
"sha256": "bdefd7704e499a25e7a02de26c6487dff55c15f2723089c8fd8d85155d9e2afc"
|
"sha256": "eefbcaa7fb4ddc68991b9d77bb1be253c4278a9008d171e85aac84b414b04455"
|
||||||
},
|
},
|
||||||
"mengsan/ui/hand/adapter.js": {
|
"mengsan/ui/hand/adapter.js": {
|
||||||
"size": 935,
|
"size": 935,
|
||||||
@@ -4148,8 +4148,8 @@
|
|||||||
"sha256": "4b804c1d42c6c1171d42a37136fcb903bfb3128beae6a357b52ef9cede54908f"
|
"sha256": "4b804c1d42c6c1171d42a37136fcb903bfb3128beae6a357b52ef9cede54908f"
|
||||||
},
|
},
|
||||||
"mengsan/ui/hand/input.js": {
|
"mengsan/ui/hand/input.js": {
|
||||||
"size": 13600,
|
"size": 13480,
|
||||||
"sha256": "2a2f78bfa84639c0cf78c4b8e124d79c1405de8b82f99fd5fdd240a760fe347b"
|
"sha256": "ca1eb00598b1135cdc1b937642eaffdf5858b5e8e4678dd12bf4e384556a5372"
|
||||||
},
|
},
|
||||||
"mengsan/ui/hand/overlays.js": {
|
"mengsan/ui/hand/overlays.js": {
|
||||||
"size": 3970,
|
"size": 3970,
|
||||||
@@ -4160,20 +4160,20 @@
|
|||||||
"sha256": "b958c78088e903c5ec09537f2d3b2241fe51a9067604e360b560c02fdac30904"
|
"sha256": "b958c78088e903c5ec09537f2d3b2241fe51a9067604e360b560c02fdac30904"
|
||||||
},
|
},
|
||||||
"mengsan/ui/hud/index.js": {
|
"mengsan/ui/hud/index.js": {
|
||||||
"size": 27135,
|
"size": 28411,
|
||||||
"sha256": "c91b29c61227e21f3303e0a9368645c7215e6794dce5f62651db0433b773a3d0"
|
"sha256": "fc9ea1815d75a6ad950a6f87a5af38cccebe05b032f3dde69dde0f7f13a9d8a6"
|
||||||
},
|
},
|
||||||
"mengsan/ui/hud/overlays.js": {
|
"mengsan/ui/hud/overlays.js": {
|
||||||
"size": 11789,
|
"size": 11817,
|
||||||
"sha256": "c98e2956fbb2a32d4bb2c79350f8c530c4760719650d1f095e5a177c7825b6c1"
|
"sha256": "1ed2cc37a4afddfcfff41bc7e1a94422855ead2f5f1b38a5d008eaa474d370b0"
|
||||||
},
|
},
|
||||||
"mengsan/ui/hud/status-model.js": {
|
"mengsan/ui/hud/status-model.js": {
|
||||||
"size": 11300,
|
"size": 11300,
|
||||||
"sha256": "b18ae987f451453f77a397093cd57d8a8bd1fc03dbe845e3fc5a943da0a8ff04"
|
"sha256": "b18ae987f451453f77a397093cd57d8a8bd1fc03dbe845e3fc5a943da0a8ff04"
|
||||||
},
|
},
|
||||||
"mengsan/ui/hud/style.css": {
|
"mengsan/ui/hud/style.css": {
|
||||||
"size": 20395,
|
"size": 19961,
|
||||||
"sha256": "05e40d81cf81731cc2c0dc89ec876229d5a1f93100b69af38fee001927433626"
|
"sha256": "3313acbd5e99d3346cfb1ce95bad5274752da35a4e7fb6b4ff0fa92e2ad00907"
|
||||||
},
|
},
|
||||||
"mengsan/ui/intent-display.js": {
|
"mengsan/ui/intent-display.js": {
|
||||||
"size": 13341,
|
"size": 13341,
|
||||||
@@ -4184,12 +4184,12 @@
|
|||||||
"sha256": "6fc56c6c084508a39d801521a103f8c39eea90eb895f47a78924997241d9f932"
|
"sha256": "6fc56c6c084508a39d801521a103f8c39eea90eb895f47a78924997241d9f932"
|
||||||
},
|
},
|
||||||
"mengsan/ui/map/renderer.js": {
|
"mengsan/ui/map/renderer.js": {
|
||||||
"size": 26905,
|
"size": 27005,
|
||||||
"sha256": "12c0755f38c0213093c8fd5b29f79fbfc721fed9a9d756bf12ee497363c05b26"
|
"sha256": "9ec156a410df674c80b987b243fce399415d8acc02db43d0018b56882d335609"
|
||||||
},
|
},
|
||||||
"mengsan/ui/navigation.js": {
|
"mengsan/ui/navigation.js": {
|
||||||
"size": 11317,
|
"size": 11328,
|
||||||
"sha256": "62dc4cd8093b931c91b42070f36f6a7f54493cf13e55c682b8ef5c2bb8495be7"
|
"sha256": "6494765969d7e9f27bd03af778d4713fe4c361643d547fc0ce44975074ca67e7"
|
||||||
},
|
},
|
||||||
"mengsan/ui/potions.css": {
|
"mengsan/ui/potions.css": {
|
||||||
"size": 2886,
|
"size": 2886,
|
||||||
@@ -4208,8 +4208,8 @@
|
|||||||
"sha256": "c2b500560d9cbb506e1f976f1449d2dd1f01021487606cd13efd64d6ff46604b"
|
"sha256": "c2b500560d9cbb506e1f976f1449d2dd1f01021487606cd13efd64d6ff46604b"
|
||||||
},
|
},
|
||||||
"mengsan/ui/relics.js": {
|
"mengsan/ui/relics.js": {
|
||||||
"size": 4563,
|
"size": 4574,
|
||||||
"sha256": "2673556941004981a443cb7dc4d93dad23ae64ac1bb4ff471b95950429625608"
|
"sha256": "cecca4fb42dcaf596ba2645986a2244f51da56215d1e9583251f43691c0bb6c8"
|
||||||
},
|
},
|
||||||
"mengsan/ui/rest-ui.js": {
|
"mengsan/ui/rest-ui.js": {
|
||||||
"size": 3997,
|
"size": 3997,
|
||||||
@@ -4236,12 +4236,12 @@
|
|||||||
"sha256": "e9cd1c36d28faf8790d67e33bb3487c76eb508103277899fc5201b49d2155abf"
|
"sha256": "e9cd1c36d28faf8790d67e33bb3487c76eb508103277899fc5201b49d2155abf"
|
||||||
},
|
},
|
||||||
"mengsan/ui/style.css": {
|
"mengsan/ui/style.css": {
|
||||||
"size": 82481,
|
"size": 84814,
|
||||||
"sha256": "a382ac4a62389b0e2b5d8454ca0bb278f8c0019f8f3af6dcf18b8113e7af4fd2"
|
"sha256": "82a31f514ee896cb1c94fd4a2998a2c9e53b49d13a7155028dc72deded7c6c26"
|
||||||
},
|
},
|
||||||
"mengsan/ui/virtual-card-grid.js": {
|
"mengsan/ui/virtual-card-grid.js": {
|
||||||
"size": 4820,
|
"size": 5695,
|
||||||
"sha256": "0933ec3eea0169b34a6e7b4c20e9f75b0645fa787ea70b7ec7d4469213f94ae2"
|
"sha256": "c63c929576ac341ce0fd1090b4957cb42f1b86c442330f66f841b4ea71f869dd"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tree": {
|
"tree": {
|
||||||
@@ -7921,8 +7921,8 @@
|
|||||||
},
|
},
|
||||||
"personal-piles.js": {
|
"personal-piles.js": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"size": 24068,
|
"size": 25275,
|
||||||
"sha256": "49c8fc467c159efac1087da5c41ee4eb27707867128135b59042e9bbfde65846"
|
"sha256": "3b8b7311f527b7b0ac1b0dee89f6b77caa751c9562f4b0a70ec2094a973e403a"
|
||||||
},
|
},
|
||||||
"rampage.js": {
|
"rampage.js": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
@@ -8148,8 +8148,8 @@
|
|||||||
},
|
},
|
||||||
"mode.js": {
|
"mode.js": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"size": 126390,
|
"size": 126443,
|
||||||
"sha256": "b6715380f36bee8a52d404a8f307ddd967a407c6c3d6bf573c94b3315b4c1f1a"
|
"sha256": "d46a0e698ff3b1ce9a7f738cbf5c3c3bce847e349cf69a6601484db4ef7f3138"
|
||||||
},
|
},
|
||||||
"monsters": {
|
"monsters": {
|
||||||
"type": "directory",
|
"type": "directory",
|
||||||
@@ -8456,8 +8456,8 @@
|
|||||||
},
|
},
|
||||||
"card-library.js": {
|
"card-library.js": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"size": 22135,
|
"size": 25506,
|
||||||
"sha256": "0756e87b0af8e71c177a7be9ff175d645ecbf2dfaad36b5852cad82a4b60bba3"
|
"sha256": "0b75ac71ef4a9a8ace598aeb03fe59fe866371369d2db035380b0ea169d6f528"
|
||||||
},
|
},
|
||||||
"character-select.css": {
|
"character-select.css": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
@@ -8471,8 +8471,8 @@
|
|||||||
},
|
},
|
||||||
"dialogue.js": {
|
"dialogue.js": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"size": 7649,
|
"size": 7790,
|
||||||
"sha256": "a405f315270c24cdb2c53ba4e211a3fd5bf9bb582335d5dbf910adb5622deac6"
|
"sha256": "c138f465d52b04e27402b7b440f57631b36199d690d044fc48dd0640da689d51"
|
||||||
},
|
},
|
||||||
"energy-display.js": {
|
"energy-display.js": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
@@ -8481,13 +8481,13 @@
|
|||||||
},
|
},
|
||||||
"flow-ui.js": {
|
"flow-ui.js": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"size": 3394,
|
"size": 3440,
|
||||||
"sha256": "9070b108e2342a89b545c6d7c19af140431c343fc4e28e344e72f3fdc524f3b4"
|
"sha256": "5e889fdf671ff031fc661e148a13812cebb0fbcacaa81064589a8caf17e06efe"
|
||||||
},
|
},
|
||||||
"gm-manager.js": {
|
"gm-manager.js": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"size": 9913,
|
"size": 9924,
|
||||||
"sha256": "bdefd7704e499a25e7a02de26c6487dff55c15f2723089c8fd8d85155d9e2afc"
|
"sha256": "eefbcaa7fb4ddc68991b9d77bb1be253c4278a9008d171e85aac84b414b04455"
|
||||||
},
|
},
|
||||||
"hand": {
|
"hand": {
|
||||||
"type": "directory",
|
"type": "directory",
|
||||||
@@ -8514,8 +8514,8 @@
|
|||||||
},
|
},
|
||||||
"input.js": {
|
"input.js": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"size": 13600,
|
"size": 13480,
|
||||||
"sha256": "2a2f78bfa84639c0cf78c4b8e124d79c1405de8b82f99fd5fdd240a760fe347b"
|
"sha256": "ca1eb00598b1135cdc1b937642eaffdf5858b5e8e4678dd12bf4e384556a5372"
|
||||||
},
|
},
|
||||||
"overlays.js": {
|
"overlays.js": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
@@ -8534,13 +8534,13 @@
|
|||||||
"children": {
|
"children": {
|
||||||
"index.js": {
|
"index.js": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"size": 27135,
|
"size": 28411,
|
||||||
"sha256": "c91b29c61227e21f3303e0a9368645c7215e6794dce5f62651db0433b773a3d0"
|
"sha256": "fc9ea1815d75a6ad950a6f87a5af38cccebe05b032f3dde69dde0f7f13a9d8a6"
|
||||||
},
|
},
|
||||||
"overlays.js": {
|
"overlays.js": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"size": 11789,
|
"size": 11817,
|
||||||
"sha256": "c98e2956fbb2a32d4bb2c79350f8c530c4760719650d1f095e5a177c7825b6c1"
|
"sha256": "1ed2cc37a4afddfcfff41bc7e1a94422855ead2f5f1b38a5d008eaa474d370b0"
|
||||||
},
|
},
|
||||||
"status-model.js": {
|
"status-model.js": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
@@ -8549,8 +8549,8 @@
|
|||||||
},
|
},
|
||||||
"style.css": {
|
"style.css": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"size": 20395,
|
"size": 19961,
|
||||||
"sha256": "05e40d81cf81731cc2c0dc89ec876229d5a1f93100b69af38fee001927433626"
|
"sha256": "3313acbd5e99d3346cfb1ce95bad5274752da35a4e7fb6b4ff0fa92e2ad00907"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -8569,15 +8569,15 @@
|
|||||||
},
|
},
|
||||||
"renderer.js": {
|
"renderer.js": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"size": 26905,
|
"size": 27005,
|
||||||
"sha256": "12c0755f38c0213093c8fd5b29f79fbfc721fed9a9d756bf12ee497363c05b26"
|
"sha256": "9ec156a410df674c80b987b243fce399415d8acc02db43d0018b56882d335609"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"navigation.js": {
|
"navigation.js": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"size": 11317,
|
"size": 11328,
|
||||||
"sha256": "62dc4cd8093b931c91b42070f36f6a7f54493cf13e55c682b8ef5c2bb8495be7"
|
"sha256": "6494765969d7e9f27bd03af778d4713fe4c361643d547fc0ce44975074ca67e7"
|
||||||
},
|
},
|
||||||
"potions.css": {
|
"potions.css": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
@@ -8601,8 +8601,8 @@
|
|||||||
},
|
},
|
||||||
"relics.js": {
|
"relics.js": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"size": 4563,
|
"size": 4574,
|
||||||
"sha256": "2673556941004981a443cb7dc4d93dad23ae64ac1bb4ff471b95950429625608"
|
"sha256": "cecca4fb42dcaf596ba2645986a2244f51da56215d1e9583251f43691c0bb6c8"
|
||||||
},
|
},
|
||||||
"rest-ui.js": {
|
"rest-ui.js": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
@@ -8636,13 +8636,13 @@
|
|||||||
},
|
},
|
||||||
"style.css": {
|
"style.css": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"size": 82481,
|
"size": 84814,
|
||||||
"sha256": "a382ac4a62389b0e2b5d8454ca0bb278f8c0019f8f3af6dcf18b8113e7af4fd2"
|
"sha256": "82a31f514ee896cb1c94fd4a2998a2c9e53b49d13a7155028dc72deded7c6c26"
|
||||||
},
|
},
|
||||||
"virtual-card-grid.js": {
|
"virtual-card-grid.js": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"size": 4820,
|
"size": 5695,
|
||||||
"sha256": "0933ec3eea0169b34a6e7b4c20e9f75b0645fa787ea70b7ec7d4469213f94ae2"
|
"sha256": "c63c929576ac341ce0fd1090b4957cb42f1b86c442330f66f841b4ea71f869dd"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "2.0.2.3-rc.10",
|
"version": "2.0.2.3-rc.12",
|
||||||
"module_id": "mengsan",
|
"module_id": "mengsan",
|
||||||
"snapshot": "legacy",
|
"snapshot": "legacy",
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
| 场景 | 操作与通过标准 |
|
| 场景 | 操作与通过标准 |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| 触屏拖牌与目标连线 | 从手牌拖出一张【杀】并移动到可选敌人。线起点贴在拖动牌上缘中央,终点跟随触点,两端误差各不超过 2 CSS px。取消手势后线立即消失。对合法目标松手后拖线立即消失,原生提交只触发一次。完整对局中再检查提交后的出牌特效能指向实际目标。 |
|
| 触屏拖牌与目标连线 | 从手牌拖出一张【杀】并移动到可选敌人。线起点贴在拖动牌上缘中央,终点跟随触点,两端误差各不超过 2 CSS px。取消手势后线立即消失。对合法目标松手后拖线立即消失,原生提交只触发一次。完整对局中再检查提交后的出牌特效能指向实际目标。 |
|
||||||
|
| 普通出牌布局与缩放 | 在主动出牌阶段检查手牌扇面、提示语和「确定/回合结束」按钮组。三者共用战场中线,误差不超过 2 CSS px。改变界面缩放后重新检查对齐和拖牌线两端。 |
|
||||||
| 出牌响应布局与按钮交互 | 敌人出【杀】,选择【闪】,观察场上出牌副本、响应文字与「确定/取消」两键的整体边界。三者从上到下共用战场中线,横向中心误差不超过 2 CSS px,牌面、提示、按钮和选中手牌之间有可见间距。确认和取消分别可点击,响应结束后场上的牌恢复原生位置。 |
|
| 出牌响应布局与按钮交互 | 敌人出【杀】,选择【闪】,观察场上出牌副本、响应文字与「确定/取消」两键的整体边界。三者从上到下共用战场中线,横向中心误差不超过 2 CSS px,牌面、提示、按钮和选中手牌之间有可见间距。确认和取消分别可点击,响应结束后场上的牌恢复原生位置。 |
|
||||||
| 弃牌时技能栏稳定 | 启用十周年 UI,进入需弃置两张手牌的场景并点选第一张。技能栏在重建的首帧起就不出现重复的药水按钮,普通技能仍可见,弃牌计数正常更新。 |
|
| 弃牌时技能栏稳定 | 启用十周年 UI,进入需弃置两张手牌的场景并点选第一张。技能栏在重建的首帧起就不出现重复的药水按钮,普通技能仍可见,弃牌计数正常更新。 |
|
||||||
| 战斗药水槽与计数信息 | 持有药水进入战斗。药水槽位于左上区域,可贴近轮数、时间及牌堆数量控件,各自的可见区域互不重叠。点按药水可打开详情,并能在可用阶段正常使用。 |
|
| 战斗药水槽与计数信息 | 持有药水进入战斗。药水槽位于左上区域,可贴近轮数、时间及牌堆数量控件,各自的可见区域互不重叠。点按药水可打开详情,并能在可用阶段正常使用。 |
|
||||||
@@ -18,8 +19,10 @@ $env:HUD_REVIEW = '1'
|
|||||||
node mengsan/tools/test-battle-hud.cjs
|
node mengsan/tools/test-battle-hud.cjs
|
||||||
```
|
```
|
||||||
|
|
||||||
需要截图时,将 `HUD_ARTIFACTS` 指向已建立的临时目录。完整矩阵覆盖原生 UI、十周年 UI 的手杀、十周年和新杀风格,以及 1080×486、812×375、667×375,含 0.64 页面缩放和非整数像素比。各场景检查拖牌、出牌连线、响应和药水槽位置,启用十周年 UI 的场景另测弃牌时的技能栏重建。
|
需要截图时,将 `HUD_ARTIFACTS` 指向已建立的临时目录。完整矩阵覆盖原生 UI、十周年 UI 的手杀、十周年和新杀风格,以及 1080×486、812×375、667×375,含非整数像素比。1080×486 使用无名杀「新版」布局,从 65% 缩放基线切换到 50%、85%、100% 和 120%,核验普通出牌位置和拖牌线。出牌后的默认及金龙连线均检查端点,完整金龙贴图需在客户端核验。
|
||||||
|
|
||||||
## Android 实机复核
|
## Android 实机复核
|
||||||
|
|
||||||
在本轮改动对应的 Android 客户端启用十周年 UI,使用该客户端当前启用的皮肤复核各场景,并记录十周年 UI 版本和皮肤。拖牌时分别观察松手前的拖线和松手后的出牌特效。响应用两次事件分别检查确认和取消。弃牌时观察点牌瞬间,检查原生计数面板与药水槽能同时看清并各自操作。实机结果单独记录,实机不可用时写明未验。
|
在本轮改动对应的 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 风格,在常用倍率和一个较高倍率下复核受影响的操作。优先确认触屏地图滚动、剧情分支点按、较长内容滑动和弹窗关闭。报告逐项标注通过、失败或未验。
|
||||||
+1
-1
@@ -6,7 +6,7 @@ import { configureDiagnostics } from "./diagnostics/index.js";
|
|||||||
|
|
||||||
export const type = "extension";
|
export const type = "extension";
|
||||||
export let shuYing = new Object();
|
export let shuYing = new Object();
|
||||||
const shuYingLocalVersion = "2.0.2.3-rc.10";
|
const shuYingLocalVersion = "2.0.2.3-rc.12";
|
||||||
|
|
||||||
shuYing.name = "术樱包";
|
shuYing.name = "术樱包";
|
||||||
shuYing.editable = false;
|
shuYing.editable = false;
|
||||||
|
|||||||
@@ -20,13 +20,15 @@ export function installPersonalPiles(session, owner, battle, run, resources, env
|
|||||||
// Detached nodes: engine get.position recognises these IDs; no duplicate document IDs.
|
// Detached nodes: engine get.position recognises these IDs; no duplicate document IDs.
|
||||||
draw.id = "cardPile"; discard.id = "discardPile";
|
draw.id = "cardPile"; discard.id = "discardPile";
|
||||||
const owned = new Set(), topPlaying = new Set(), restores = [];
|
const owned = new Set(), topPlaying = new Set(), restores = [];
|
||||||
|
const pileNodes = { drawPile: draw, discardPile: discard };
|
||||||
|
const viewKeys = new WeakMap(), exhaustSources = new WeakMap();
|
||||||
const strict = env.strict !== false;
|
const strict = env.strict !== false;
|
||||||
let released = false, forcedOwner = false, forcedPublic = false, exhaustTotal = 0;
|
let released = false, forcedOwner = false, forcedPublic = false, exhaustTotal = 0;
|
||||||
function recordExhaust(card) {
|
function recordExhaust(card) {
|
||||||
if (card.storage?.mengsanExhausted_shuying) return false;
|
if (card.storage?.mengsanExhausted_shuying) return false;
|
||||||
card.storage.mengsanExhausted_shuying = true;
|
card.storage.mengsanExhausted_shuying = true;
|
||||||
battle.exhaustPile.push(snapshot(card)); exhaustTotal++;
|
battle.exhaustPile.push(snapshotExhausted(card)); exhaustTotal++;
|
||||||
queueIroncladExhaust(owner, card); queueRelicExhaust(owner, card); refresh(); return true;
|
queueIroncladExhaust(owner, card); queueRelicExhaust(owner, card); refresh("exhaustPile"); return true;
|
||||||
}
|
}
|
||||||
const personal = () => {
|
const personal = () => {
|
||||||
if (released || forcedPublic) return false;
|
if (released || forcedPublic) return false;
|
||||||
@@ -42,7 +44,7 @@ export function installPersonalPiles(session, owner, battle, run, resources, env
|
|||||||
}
|
}
|
||||||
return false; // Never infer ownership from whose turn it is.
|
return false; // Never infer ownership from whose turn it is.
|
||||||
};
|
};
|
||||||
const refresh = () => { if (!released) env.refresh(); };
|
const refresh = (...piles) => { if (!released) env.refresh(...piles); };
|
||||||
const canReceiveTransfer = (card, sourceSession) => !released && session.active && sourceSession===session &&
|
const canReceiveTransfer = (card, sourceSession) => !released && session.active && sourceSession===session &&
|
||||||
owner.isAlive() && !owned.has(card) && typeof card?.storage?.mengsanCard_shuying?.id==="string" &&
|
owner.isAlive() && !owned.has(card) && typeof card?.storage?.mengsanCard_shuying?.id==="string" &&
|
||||||
![...owned].some(c=>c.storage?.mengsanCard_shuying?.id===card.storage.mengsanCard_shuying.id);
|
![...owned].some(c=>c.storage?.mengsanCard_shuying?.id===card.storage.mengsanCard_shuying.id);
|
||||||
@@ -95,6 +97,19 @@ export function installPersonalPiles(session, owner, battle, run, resources, env
|
|||||||
return { ...data, ...snapshotRampage(card), ...ironcladHooks(owner)?.snapshotCard(card), ...sharedHooks(owner)?.snapshotCard?.(card), name: card.name, suit: card.suit, number: card.number,
|
return { ...data, ...snapshotRampage(card), ...ironcladHooks(owner)?.snapshotCard(card), ...sharedHooks(owner)?.snapshotCard?.(card), name: card.name, suit: card.suit, number: card.number,
|
||||||
nature: card.nature || null, affixes: data.affixes?.slice() || [], upgrade: data.upgrade || 0 };
|
nature: card.nature || null, affixes: data.affixes?.slice() || [], upgrade: data.upgrade || 0 };
|
||||||
}
|
}
|
||||||
|
function viewKey(card) {
|
||||||
|
if (!viewKeys.has(card)) viewKeys.set(card, Symbol());
|
||||||
|
return viewKeys.get(card);
|
||||||
|
}
|
||||||
|
function snapshotExhausted(card) {
|
||||||
|
const data = snapshot(card);
|
||||||
|
exhaustSources.set(data, card);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
function removeExhaustSnapshot(card) {
|
||||||
|
const index = battle.exhaustPile.findIndex(data => exhaustSources.get(data) === card);
|
||||||
|
if (index >= 0) battle.exhaustPile.splice(index, 1);
|
||||||
|
}
|
||||||
for (const data of battle.drawPile) {
|
for (const data of battle.drawPile) {
|
||||||
if (data.name === "muniu") continue;
|
if (data.name === "muniu") continue;
|
||||||
const card = game.createCard(data.name, data.suit, data.number, data.nature);
|
const card = game.createCard(data.name, data.suit, data.number, data.nature);
|
||||||
@@ -111,16 +126,28 @@ export function installPersonalPiles(session, owner, battle, run, resources, env
|
|||||||
if (Object.getOwnPropertyDescriptor(ui, key)?.get === read) Object.defineProperty(ui, key, descriptor.get ? descriptor : { ...descriptor, value: publicNode });
|
if (Object.getOwnPropertyDescriptor(ui, key)?.get === read) Object.defineProperty(ui, key, descriptor.get ? descriptor : { ...descriptor, value: publicNode });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
for (const [key, node] of [["drawPile", draw], ["discardPile", discard]]) {
|
for (const [key, node] of Object.entries(pileNodes)) {
|
||||||
Object.defineProperty(battle, key, { configurable: true, enumerable: true,
|
Object.defineProperty(battle, key, { configurable: true, enumerable: true,
|
||||||
get: () => Array.from(node.childNodes, snapshot) });
|
get: () => Array.from(node.childNodes, snapshot) });
|
||||||
}
|
}
|
||||||
const observer = new MutationObserver(() => {
|
const observer = new MutationObserver(records => {
|
||||||
if (released) return;
|
if (released) return;
|
||||||
|
const changed = new Set(records.map(record => record.target));
|
||||||
// A card from our deck can be discarded during an enemy-owned event.
|
// A card from our deck can be discarded during an enemy-owned event.
|
||||||
for (const card of Array.from(publicDiscard.childNodes)) if (owned.has(card)) discard.appendChild(card);
|
if (changed.has(publicDiscard)) {
|
||||||
for (const node of [draw, discard]) for (const card of node.childNodes) adopt(card);
|
for (const card of Array.from(publicDiscard.childNodes)) {
|
||||||
refresh();
|
if (!owned.has(card)) continue;
|
||||||
|
discard.appendChild(card);
|
||||||
|
changed.add(discard);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const piles = [];
|
||||||
|
for (const [key, node] of Object.entries(pileNodes)) {
|
||||||
|
if (!changed.has(node)) continue;
|
||||||
|
for (const card of node.childNodes) adopt(card);
|
||||||
|
piles.push(key);
|
||||||
|
}
|
||||||
|
if (piles.length) refresh(...piles);
|
||||||
});
|
});
|
||||||
for (const node of [draw, discard, publicDiscard]) observer.observe(node, { childList: true });
|
for (const node of [draw, discard, publicDiscard]) observer.observe(node, { childList: true });
|
||||||
function wash() {
|
function wash() {
|
||||||
@@ -129,7 +156,7 @@ export function installPersonalPiles(session, owner, battle, run, resources, env
|
|||||||
shuffle(run, cards);
|
shuffle(run, cards);
|
||||||
queueRelicShuffle(owner);
|
queueRelicShuffle(owner);
|
||||||
for (const card of cards) { card.fix?.(); draw.appendChild(card); }
|
for (const card of cards) { card.fix?.(); draw.appendChild(card); }
|
||||||
refresh();
|
refresh("drawPile", "discardPile");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
function take(number = 1, putBack = false, bottom = false) {
|
function take(number = 1, putBack = false, bottom = false) {
|
||||||
@@ -147,7 +174,7 @@ export function installPersonalPiles(session, owner, battle, run, resources, env
|
|||||||
if (putBack) for (let i = cards.length - 1; i >= 0; i--) {
|
if (putBack) for (let i = cards.length - 1; i >= 0; i--) {
|
||||||
if (bottom) draw.appendChild(cards[i]); else draw.insertBefore(cards[i], draw.firstChild);
|
if (bottom) draw.appendChild(cards[i]); else draw.insertBefore(cards[i], draw.firstChild);
|
||||||
}
|
}
|
||||||
refresh(); return cards;
|
refresh("drawPile"); return cards;
|
||||||
}
|
}
|
||||||
function wrap(object, key, replacement, shouldReplace = personal) {
|
function wrap(object, key, replacement, shouldReplace = personal) {
|
||||||
const descriptor = Object.getOwnPropertyDescriptor(object, key), original = object[key];
|
const descriptor = Object.getOwnPropertyDescriptor(object, key), original = object[key];
|
||||||
@@ -177,6 +204,17 @@ export function installPersonalPiles(session, owner, battle, run, resources, env
|
|||||||
owned.clear(); topPlaying.clear(); draw.remove(); discard.remove(); exhausted.remove();
|
owned.clear(); topPlaying.clear(); draw.remove(); discard.remove(); exhausted.remove();
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
|
pileView: {
|
||||||
|
count(key) {
|
||||||
|
return pileNodes[key]?.childNodes.length ?? battle.exhaustPile.length;
|
||||||
|
},
|
||||||
|
records(key) {
|
||||||
|
const node = pileNodes[key];
|
||||||
|
return node
|
||||||
|
? Array.from(node.childNodes, card => ({ card: snapshot(card), key: viewKey(card) }))
|
||||||
|
: battle.exhaustPile.map(card => ({ card, key: viewKey(exhaustSources.get(card) ?? card) }));
|
||||||
|
},
|
||||||
|
},
|
||||||
take,
|
take,
|
||||||
canReceiveTransfer,
|
canReceiveTransfer,
|
||||||
receiveTransfer(card,sourceSession) {
|
receiveTransfer(card,sourceSession) {
|
||||||
@@ -259,13 +297,12 @@ export function installPersonalPiles(session, owner, battle, run, resources, env
|
|||||||
exhaustTotal() { return exhaustTotal; },
|
exhaustTotal() { return exhaustTotal; },
|
||||||
exhaustedCards() { return [...owned].filter(card => card.storage?.mengsanExhausted_shuying); },
|
exhaustedCards() { return [...owned].filter(card => card.storage?.mengsanExhausted_shuying); },
|
||||||
syncExhaustSnapshots() {
|
syncExhaustSnapshots() {
|
||||||
if(released || !session.active)return;
|
if (released || !session.active) return;
|
||||||
const current=new Map([...owned].filter(card=>card.storage?.mengsanExhausted_shuying)
|
for (let index = 0; index < battle.exhaustPile.length; index++) {
|
||||||
.map(card=>[card.storage.mengsanCard_shuying?.id,card]));
|
const card = exhaustSources.get(battle.exhaustPile[index]);
|
||||||
for(let index=0;index<battle.exhaustPile.length;index++){
|
if (card?.storage?.mengsanExhausted_shuying) battle.exhaustPile[index] = snapshotExhausted(card);
|
||||||
const card=current.get(battle.exhaustPile[index].id);
|
|
||||||
if(card)battle.exhaustPile[index]=snapshot(card);
|
|
||||||
}
|
}
|
||||||
|
// Whole-deck upgrades also mutate draw and discard cards in place.
|
||||||
refresh();
|
refresh();
|
||||||
},
|
},
|
||||||
// 自动打出不会触发抽牌、洗牌或堆顶牌不足的失败规则。
|
// 自动打出不会触发抽牌、洗牌或堆顶牌不足的失败规则。
|
||||||
@@ -273,9 +310,7 @@ export function installPersonalPiles(session, owner, battle, run, resources, env
|
|||||||
if (released || !session.active || !owned.has(card)) return false;
|
if (released || !session.active || !owned.has(card)) return false;
|
||||||
if (fromExhaust) {
|
if (fromExhaust) {
|
||||||
if (!card.storage?.mengsanExhausted_shuying) return false;
|
if (!card.storage?.mengsanExhausted_shuying) return false;
|
||||||
const id = card.storage?.mengsanCard_shuying?.id;
|
removeExhaustSnapshot(card);
|
||||||
const index = battle.exhaustPile.findIndex(data => data.id === id);
|
|
||||||
if (index >= 0) battle.exhaustPile.splice(index,1);
|
|
||||||
delete card.storage.mengsanExhausted_shuying;
|
delete card.storage.mengsanExhausted_shuying;
|
||||||
delete card._selfDestroyed;
|
delete card._selfDestroyed;
|
||||||
} else if (card.parentNode !== draw && card.parentNode !== discard) return false;
|
} else if (card.parentNode !== draw && card.parentNode !== discard) return false;
|
||||||
@@ -315,9 +350,7 @@ export function installPersonalPiles(session, owner, battle, run, resources, env
|
|||||||
if(released || !session.active || !owner.isAlive() || !owned.has(card))return false;
|
if(released || !session.active || !owner.isAlive() || !owned.has(card))return false;
|
||||||
if(owner.getCards("h").includes(card))return true;
|
if(owner.getCards("h").includes(card))return true;
|
||||||
if(card.storage?.mengsanExhausted_shuying){
|
if(card.storage?.mengsanExhausted_shuying){
|
||||||
const id=card.storage.mengsanCard_shuying?.id;
|
removeExhaustSnapshot(card);
|
||||||
const index=battle.exhaustPile.findIndex(data=>data.id===id);
|
|
||||||
if(index>=0)battle.exhaustPile.splice(index,1);
|
|
||||||
delete card.storage.mengsanExhausted_shuying;delete card._selfDestroyed;
|
delete card.storage.mengsanExhausted_shuying;delete card._selfDestroyed;
|
||||||
}
|
}
|
||||||
delete card.storage.mengsanConsumed_shuying;
|
delete card.storage.mengsanConsumed_shuying;
|
||||||
@@ -356,7 +389,7 @@ export function installPersonalPiles(session, owner, battle, run, resources, env
|
|||||||
const card = game.createCard(data.name, data.suit, data.number, data.nature);
|
const card = game.createCard(data.name, data.suit, data.number, data.nature);
|
||||||
adopt(card, data);
|
adopt(card, data);
|
||||||
discard.appendChild(card);
|
discard.appendChild(card);
|
||||||
refresh();
|
refresh("discardPile");
|
||||||
return card;
|
return card;
|
||||||
},
|
},
|
||||||
async addToHand(data) {
|
async addToHand(data) {
|
||||||
|
|||||||
+2
-2
@@ -703,7 +703,7 @@ const prepareBattle = async (run, node, encounter, session, resources) => {
|
|||||||
|
|
||||||
activeBattle.personalPiles = installPersonalPiles(session, me, _status.mengsanBattle_shuying, run, resources, {
|
activeBattle.personalPiles = installPersonalPiles(session, me, _status.mengsanBattle_shuying, run, resources, {
|
||||||
game, ui, get, lib, _status, document, MutationObserver, shuffle: shuffleBattlePile,
|
game, ui, get, lib, _status, document, MutationObserver, shuffle: shuffleBattlePile,
|
||||||
refresh: () => activeBattle?.session === session && activeBattle.pilesUI?.refresh(),
|
refresh: (...piles) => activeBattle?.session === session && activeBattle.pilesUI?.refresh(...piles),
|
||||||
});
|
});
|
||||||
activeBattle.personalPiles.withOwner(() => me.init(run.player.character));
|
activeBattle.personalPiles.withOwner(() => me.init(run.player.character));
|
||||||
me.storage.mengsanUnitId_shuying = "player";
|
me.storage.mengsanUnitId_shuying = "player";
|
||||||
@@ -799,7 +799,7 @@ const prepareBattle = async (run, node, encounter, session, resources) => {
|
|||||||
session.ownResource({}, () => game.removeGlobalSkill(skill));
|
session.ownResource({}, () => game.removeGlobalSkill(skill));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
activeBattle.pilesUI = mountBattlePiles(session, _status.mengsanBattle_shuying);
|
activeBattle.pilesUI = mountBattlePiles(session, _status.mengsanBattle_shuying, activeBattle.personalPiles.pileView);
|
||||||
currentBattle.owner = me;
|
currentBattle.owner = me;
|
||||||
currentBattle.run = run;
|
currentBattle.run = run;
|
||||||
potionSkillIds.forEach(skill => me.addSkill(skill));
|
potionSkillIds.forEach(skill => me.addSkill(skill));
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ const { chromium } = require(packages ? path.join(packages, 'playwright') : 'pla
|
|||||||
const prefix = '/extension/' + encodeURIComponent('术樱包') + '/mengsan';
|
const prefix = '/extension/' + encodeURIComponent('术樱包') + '/mengsan';
|
||||||
const decadePrefix = '/extension/' + encodeURIComponent('十周年UI');
|
const decadePrefix = '/extension/' + encodeURIComponent('十周年UI');
|
||||||
const reviewOnly = process.env.HUD_REVIEW === '1';
|
const reviewOnly = process.env.HUD_REVIEW === '1';
|
||||||
|
const journeyReview = process.env.UI_ZOOM_REVIEW === '1';
|
||||||
const holdStatus = async (page, locator, pointerType = 'mouse') => {
|
const holdStatus = async (page, locator, pointerType = 'mouse') => {
|
||||||
const box = await locator.boundingBox();
|
const box = await locator.boundingBox();
|
||||||
const point = {x:box.x + box.width / 2,y:box.y + box.height / 2};
|
const point = {x:box.x + box.width / 2,y:box.y + box.height / 2};
|
||||||
@@ -46,6 +47,18 @@ async function checkMobileTargetLine(page, artifact) {
|
|||||||
await touch.send('Input.dispatchTouchEvent', {type:'touchMove',touchPoints:[end]});
|
await touch.send('Input.dispatchTouchEvent', {type:'touchMove',touchPoints:[end]});
|
||||||
await aim.waitFor({state:'visible',timeout:2500});
|
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();
|
await drag();
|
||||||
const geometry = await aim.evaluate((overlay, pointer) => {
|
const geometry = await aim.evaluate((overlay, pointer) => {
|
||||||
const card = window.card.getBoundingClientRect();
|
const card = window.card.getBoundingClientRect();
|
||||||
@@ -61,6 +74,7 @@ async function checkMobileTargetLine(page, artifact) {
|
|||||||
return {origin,pointer,from:{x:left?bounds.left:bounds.right,y:up?bounds.top:bounds.bottom},
|
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}};
|
to:{x:left?bounds.right:bounds.left,y:up?bounds.bottom:bounds.top}};
|
||||||
},end);
|
},end);
|
||||||
|
await page.evaluate(() => { delete document.createElementNS; });
|
||||||
if (artifact) await page.screenshot({path:artifact});
|
if (artifact) await page.screenshot({path:artifact});
|
||||||
await touch.send('Input.dispatchTouchEvent', {type:'touchCancel',touchPoints:[]});
|
await touch.send('Input.dispatchTouchEvent', {type:'touchCancel',touchPoints:[]});
|
||||||
assert.equal(await aim.count(),0,'the target line disappears on touch cancellation');
|
assert.equal(await aim.count(),0,'the target line disappears on touch cancellation');
|
||||||
@@ -78,6 +92,46 @@ async function checkMobileTargetLine(page, artifact) {
|
|||||||
assert.equal(await page.evaluate(()=>game.isSubmitted()),before+1,'touch release still submits the valid target once');
|
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) {
|
async function checkCommittedLine(page, skin) {
|
||||||
const geometry = await page.evaluate(async ({skin,decadePrefix}) => {
|
const geometry = await page.evaluate(async ({skin,decadePrefix}) => {
|
||||||
const engine = await import('/noname.js');
|
const engine = await import('/noname.js');
|
||||||
@@ -86,11 +140,12 @@ async function checkCommittedLine(page, skin) {
|
|||||||
const [actor,target] = window.game.players;
|
const [actor,target] = window.game.players;
|
||||||
// Use the shipped line producers and renderer, with only the game lifecycle isolated.
|
// Use the shipped line producers and renderer, with only the game lifecycle isolated.
|
||||||
engine.lib.config ??= {};
|
engine.lib.config ??= {};
|
||||||
engine.setUI({arena,create:{div:() => {
|
engine.setUI({arena,create:{div:selector => {
|
||||||
const node = document.createElement('div');
|
const node = document.createElement('div');
|
||||||
node.className = 'linexy hidden';
|
if (selector) node.className = 'linexy hidden';
|
||||||
node.show = () => node.classList.remove('hidden');
|
node.show = () => node.classList.remove('hidden');
|
||||||
node.listenTransition = () => {};
|
node.listenTransition = () => {};
|
||||||
|
node.setBackgroundImage = path => {node.style.backgroundImage = `url(${path})`;};
|
||||||
return node;
|
return node;
|
||||||
}},refresh:node=>node.getBoundingClientRect()});
|
}},refresh:node=>node.getBoundingClientRect()});
|
||||||
const get = engine.get;
|
const get = engine.get;
|
||||||
@@ -102,7 +157,7 @@ async function checkCommittedLine(page, skin) {
|
|||||||
if (skin !== 'native') {
|
if (skin !== 'native') {
|
||||||
const {playerLine} = await import(decadePrefix+'/src/overrides/player/animations.js');
|
const {playerLine} = await import(decadePrefix+'/src/overrides/player/animations.js');
|
||||||
const {BoundsCache} = await import(decadePrefix+'/src/utils/bounds.js');
|
const {BoundsCache} = await import(decadePrefix+'/src/utils/bounds.js');
|
||||||
window.decadeUI = {boundsCaches:{hand:new BoundsCache(hand)}};
|
window.decadeUI ??= {boundsCaches:{hand:new BoundsCache(hand)}};
|
||||||
actor.checkBoundsCache = target.checkBoundsCache = function() {
|
actor.checkBoundsCache = target.checkBoundsCache = function() {
|
||||||
this.cacheLeft = this.offsetLeft;
|
this.cacheLeft = this.offsetLeft;
|
||||||
this.cacheTop = this.offsetTop;
|
this.cacheTop = this.offsetTop;
|
||||||
@@ -124,11 +179,30 @@ async function checkCommittedLine(page, skin) {
|
|||||||
const result = {x1,y1,x2:x1+matrix.c*length,y2:y1+matrix.d*length,expectedStart,
|
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}};
|
expectedEnd:{x:target.offsetLeft+target.offsetWidth/2,y:target.offsetTop+target.offsetHeight/2}};
|
||||||
effect.remove();
|
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;
|
return result;
|
||||||
},{skin,decadePrefix});
|
},{skin,decadePrefix});
|
||||||
assert.ok(geometry && Math.hypot(geometry.x1-geometry.expectedStart.x,geometry.y1-geometry.expectedStart.y)<=2 &&
|
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,
|
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));
|
'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) {
|
async function checkBattlePotionSlots(page, skin, artifact) {
|
||||||
@@ -333,15 +407,16 @@ async function checkMobileResponseLayout(page, skin, artifact) {
|
|||||||
const restored = await page.evaluate(() => {
|
const restored = await page.evaluate(() => {
|
||||||
delete hudEventState.event.respondTo;
|
delete hudEventState.event.respondTo;
|
||||||
hud.refresh();
|
hud.refresh();
|
||||||
return ui.control.style.translate === '' && reviewResponse.card.style.translate === '';
|
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');
|
assert.ok(restored,'response spacing is released when the original event ends');
|
||||||
}
|
}
|
||||||
const fixture = `<!doctype html><meta charset="utf-8"><link rel="stylesheet" href="/layout/default/layout.css"><div id="window"><div id="arena"><div id="mebg"></div><div id="me" class="mengsan-hand-root-shuying"><div id="handcards1" class="mengsan-hand-scroll-shuying"><div class="handcards mengsan-hand-zone-shuying mengsan-hand-layout-shuying"></div></div><div id="handcards2"><div class="handcards"></div></div></div><div id="control"><div class="control"><div>测试技能</div><div>结束出牌</div></div></div></div></div><style>html,body,#window{margin:0;width:100%;height:100%;position:absolute}#arena{inset:0;width:100%;height:100%;position:absolute}#arena>.player{position:absolute;width:100px;height:130px;background:#345;color:#fff}#arena>.player .avatar{height:100%;width:100%;background:linear-gradient(#334f4b,#172d29)}#arena>.player .name{position:absolute;top:4px;left:4px}#me{position:absolute;bottom:0;width:100%;height:160px}#handcards1,#handcards2{position:absolute;width:100%;height:100%}.handcards{height:100%}.card{background:#e8d7b2;color:#263b35;position:absolute}.mengsan-intent-shuying{position:absolute}</style>`;
|
const fixture = `<!doctype html><meta charset="utf-8"><link rel="stylesheet" href="/layout/default/layout.css"><div id="window"><div id="arena"><div id="mebg"></div><div id="me" class="mengsan-hand-root-shuying"><div id="handcards1" class="mengsan-hand-scroll-shuying"><div class="handcards mengsan-hand-zone-shuying mengsan-hand-layout-shuying"></div></div><div id="handcards2"><div class="handcards"></div></div></div><div id="control"><div class="control"><div>测试技能</div><div>结束出牌</div></div></div></div></div><style>html,body,#window{margin:0;width:100%;height:100%;position:absolute}#arena{inset:0;width:100%;height:100%;position:absolute}#arena>.player{position:absolute;width:100px;height:130px;background:#345;color:#fff}#arena>.player .avatar{height:100%;width:100%;background:linear-gradient(#334f4b,#172d29)}#arena>.player .name{position:absolute;top:4px;left:4px}#me{position:absolute;bottom:0;width:100%;height:160px}#handcards1,#handcards2{position:absolute;width:100%;height:100%}.handcards{height:100%}.card{background:#e8d7b2;color:#263b35;position:absolute}.mengsan-intent-shuying{position:absolute}</style>`;
|
||||||
const importMap = reviewOnly ? fs.readFileSync(path.join(app,'index.html'),'utf8').match(/<script type="importmap">.*?<\/script>/s)[0] : '';
|
const importMap = reviewOnly || journeyReview ? fs.readFileSync(path.join(app,'index.html'),'utf8').match(/<script type="importmap">.*?<\/script>/s)[0] : '';
|
||||||
const server = http.createServer((req, res) => {
|
const server = http.createServer((req, res) => {
|
||||||
if (req.url === '/fixture') { res.setHeader('Content-Type','text/html;charset=utf-8');res.end(fixture.replace('<meta charset="utf-8">','<meta charset="utf-8">'+importMap));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 && req.url==='/noname.js'){res.setHeader('Content-Type','text/javascript');res.end('export const _status={};');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') {
|
if(decodeURIComponent(new URL(req.url,'http://localhost').pathname)==='/extension/术樱包/diagnostics/index.js') {
|
||||||
res.setHeader('Content-Type','text/javascript');res.end('export const getDiagnostics=()=>({status:()=>({enabled:false}),scope:()=>({info(){},error(){}})});');return;
|
res.setHeader('Content-Type','text/javascript');res.end('export const getDiagnostics=()=>({status:()=>({enabled:false}),scope:()=>({info(){},error(){}})});');return;
|
||||||
}
|
}
|
||||||
@@ -359,12 +434,17 @@ const server = http.createServer((req, res) => {
|
|||||||
const viewports = reviewOnly ? [{width:1080,height:486},{width:812,height:375},{width:667,height:375}]
|
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}];
|
: [{width:1280,height:720},{width:1234,height:920},{width:812,height:600},{width:812,height:375},{width:667,height:375},{width:375,height:500},{width:540,height:900}];
|
||||||
try {
|
try {
|
||||||
|
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 skin of process.env.HUD_TEST_SKIN?[process.env.HUD_TEST_SKIN]:['native','shousha','shizhounian','xinsha']) {
|
||||||
for (const viewport of viewports) {
|
for (const viewport of viewports) {
|
||||||
const page = await browser.newPage({viewport,hasTouch:true,deviceScaleFactor:reviewOnly?2.625:1});
|
const page = await browser.newPage({viewport,hasTouch:true,deviceScaleFactor:reviewOnly?2.625:1});
|
||||||
await page.goto(origin+'/fixture');
|
await page.goto(origin+'/fixture');
|
||||||
if (reviewOnly && viewport.width===1080) {
|
if (reviewOnly && viewport.width===1080) {
|
||||||
await page.addStyleTag({content:'body{zoom:.64;width:156.25%;height:156.25%}'});
|
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({content:'body{background:#161e29 url("/image/background/lanting_bg.jpg") center/cover no-repeat}'});
|
||||||
await page.addStyleTag({url:origin+prefix+'/ui/style.css'});
|
await page.addStyleTag({url:origin+prefix+'/ui/style.css'});
|
||||||
@@ -477,8 +557,22 @@ const server = http.createServer((req, res) => {
|
|||||||
if (reviewOnly) {
|
if (reviewOnly) {
|
||||||
const scenario = `${skin}-${viewport.width}x${viewport.height}`;
|
const scenario = `${skin}-${viewport.width}x${viewport.height}`;
|
||||||
const artifact = name => process.env.HUD_ARTIFACTS && path.join(process.env.HUD_ARTIFACTS,`${name}-${scenario}.png`);
|
const artifact = name => process.env.HUD_ARTIFACTS && path.join(process.env.HUD_ARTIFACTS,`${name}-${scenario}.png`);
|
||||||
try { await checkMobileTargetLine(page,artifact('A012')); await checkCommittedLine(page,skin); checks+=7; }
|
try { await checkMobileTargetLine(page,artifact('A012')); await checkCommittedLine(page,skin); checks+=8; }
|
||||||
catch (error) { reviewFailures.push(`${scenario} ${error.message}`); }
|
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; }
|
try { await checkBattlePotionSlots(page,skin,artifact('battle-potion-slots')); checks+=4; }
|
||||||
catch (error) { reviewFailures.push(`${scenario} ${error.message}`); }
|
catch (error) { reviewFailures.push(`${scenario} ${error.message}`); }
|
||||||
try { await checkMobileResponseLayout(page,skin,artifact('A013')); checks+=4; }
|
try { await checkMobileResponseLayout(page,skin,artifact('A013')); checks+=4; }
|
||||||
@@ -486,6 +580,15 @@ const server = http.createServer((req, res) => {
|
|||||||
if (skin!=='native') {
|
if (skin!=='native') {
|
||||||
try { await checkPotionSkillsDuringDiscard(page,skin,artifact('discard-skill-controls')); checks+=5; }
|
try { await checkPotionSkillsDuringDiscard(page,skin,artifact('discard-skill-controls')); checks+=5; }
|
||||||
catch (error) { reviewFailures.push(`${scenario} ${error.message}`); }
|
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`);
|
if (!reviewFailures.some(failure => failure.startsWith(`${scenario} `))) console.log(`${scenario} battle UI review passed`);
|
||||||
await page.close();
|
await page.close();
|
||||||
|
|||||||
@@ -0,0 +1,368 @@
|
|||||||
|
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');
|
||||||
|
const battle = {drawPile:run.player.deck,discardPile:[],exhaustPile:[]};
|
||||||
|
window.pileReview = {
|
||||||
|
battle,
|
||||||
|
control: mountBattlePiles({active:true,ownResource(){}},battle),
|
||||||
|
};
|
||||||
|
} 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');
|
||||||
|
}
|
||||||
|
|
||||||
|
async function checkLivePiles(page, origin, prefix) {
|
||||||
|
await mountSurface(page,origin,prefix,{zoom:1},'牌堆');
|
||||||
|
await page.evaluate(async prefix => {
|
||||||
|
const {battle,control} = window.pileReview;
|
||||||
|
control.dispose();
|
||||||
|
const engine = await import('/noname.js');
|
||||||
|
const {mountBattlePiles} = await import(prefix+'/ui/card-library.js');
|
||||||
|
const {installPersonalPiles} = await import(prefix+'/cards/personal-piles.js');
|
||||||
|
const {DAZED_NAME,dazedDefinition,createDazedData} = await import(prefix+'/cards/status-cards.js');
|
||||||
|
battle.drawPile = Array.from({length:48},(_,index) => ({id:`card-${index}`,name:'sha',suit:'heart',number:index%13+1}));
|
||||||
|
engine.lib.card[DAZED_NAME] = dazedDefinition;
|
||||||
|
engine.lib.translate[DAZED_NAME] = '晕眩';
|
||||||
|
const hand = document.createElement('div');
|
||||||
|
const owner = {playerid:'pile-review',isAlive:()=>true,getCards:()=>Array.from(hand.childNodes),
|
||||||
|
lose(card,pile) { pile.appendChild(card); return {}; }};
|
||||||
|
const session = {active:true,ownResource(){}};
|
||||||
|
const publicDiscard = document.createElement('div');
|
||||||
|
const ui = {cardPile:document.createElement('div'),discardPile:publicDiscard};
|
||||||
|
const game = {createCard(name,suit,number,nature) {
|
||||||
|
return Object.assign(document.createElement('div'),{name,suit,number,nature,gaintag:new Set(),
|
||||||
|
addGaintag(tag) { this.gaintag.add(tag); }});
|
||||||
|
}};
|
||||||
|
let dialogControl;
|
||||||
|
const piles = installPersonalPiles(session,owner,battle,{}, {card(){}}, {
|
||||||
|
game,ui,get:{},lib:engine.lib,_status:{},document,MutationObserver,shuffle:(_,cards)=>cards.reverse(),
|
||||||
|
refresh: (...keys) => dialogControl?.refresh(...keys),
|
||||||
|
});
|
||||||
|
const reads = {count:0,records:0};
|
||||||
|
dialogControl = mountBattlePiles(session,battle,{
|
||||||
|
count(key) { reads.count++; return piles.pileView.count(key); },
|
||||||
|
records(key) { reads.records++; return piles.pileView.records(key); },
|
||||||
|
});
|
||||||
|
window.pileReview = {piles,control:dialogControl,draw:piles.withOwner(()=>ui.cardPile),publicDiscard,createDazedData,reads,
|
||||||
|
makeNative(suit,number) { return hand.appendChild(game.createCard('sha',suit,number)); }};
|
||||||
|
},prefix);
|
||||||
|
await page.locator('.mengsan-battle-piles-button-shuying').tap();
|
||||||
|
const result = await page.evaluate(async () => {
|
||||||
|
const {piles,draw,publicDiscard,createDazedData,reads,makeNative} = window.pileReview;
|
||||||
|
const dialog = document.querySelector('.mengsan-deck-dialog-shuying');
|
||||||
|
const [drawTab,discardTab,exhaustTab] = dialog.querySelectorAll('.ms-deck-tabs button:not([hidden])');
|
||||||
|
const grid = dialog.querySelector('.ms-library-grid');
|
||||||
|
const body = dialog.querySelector('.ms-deck-body');
|
||||||
|
const frame = async () => {
|
||||||
|
// Let native pile mutations notify the dialog before waiting for its next paint.
|
||||||
|
await Promise.resolve();
|
||||||
|
await new Promise(resolve => requestAnimationFrame(resolve));
|
||||||
|
};
|
||||||
|
const cardAt = index => grid.querySelector(`[data-card-index="${index}"]`);
|
||||||
|
const first = cardAt(0);
|
||||||
|
reads.count = reads.records = 0;
|
||||||
|
publicDiscard.appendChild(document.createElement('div'));
|
||||||
|
await frame();
|
||||||
|
const unrelatedReads = {...reads};
|
||||||
|
let countUpdates = 0;
|
||||||
|
const observer = new MutationObserver(records => { countUpdates += records.length; });
|
||||||
|
observer.observe(discardTab,{childList:true});
|
||||||
|
for (let index=0;index<3;index++) {
|
||||||
|
piles.addToDiscard(createDazedData(`status-${index}`));
|
||||||
|
}
|
||||||
|
const beforeFrame = discardTab.textContent;
|
||||||
|
await frame();
|
||||||
|
observer.disconnect();
|
||||||
|
const afterBatch = {beforeFrame,countUpdates,discard:discardTab.textContent,sameCard:first===cardAt(0),reads:{...reads}};
|
||||||
|
|
||||||
|
first.click();
|
||||||
|
const heading = dialog.querySelector('.ms-deck-detail h3');
|
||||||
|
const back = dialog.querySelector('.ms-deck-detail button');
|
||||||
|
const [seen] = piles.take(1);
|
||||||
|
await frame();
|
||||||
|
const detail = {stillOpen:heading.isConnected && !heading.closest('section').hidden,focused:document.activeElement===back,draw:drawTab.textContent};
|
||||||
|
if (!detail.stillOpen) return {afterBatch,detail};
|
||||||
|
back.click();
|
||||||
|
const afterBack = {top:body.scrollTop,number:cardAt(0).querySelector('.ms-deck-corner').textContent,
|
||||||
|
focused:document.activeElement===drawTab};
|
||||||
|
|
||||||
|
const start = 12;
|
||||||
|
const original = cardAt(start);
|
||||||
|
body.scrollTop = original.getBoundingClientRect().top - body.getBoundingClientRect().top - 5;
|
||||||
|
await frame();
|
||||||
|
const topBefore = cardAt(start).getBoundingClientRect().top - body.getBoundingClientRect().top;
|
||||||
|
cardAt(start).focus({preventScroll:true});
|
||||||
|
draw.prepend(seen,...Array.from(draw.childNodes).slice(25,33));
|
||||||
|
await frame();
|
||||||
|
const moved = cardAt(start+9);
|
||||||
|
const reorder = {topBefore,topAfter:moved?.getBoundingClientRect().top-body.getBoundingClientRect().top,
|
||||||
|
focused:document.activeElement===moved,order:moved?.querySelector('.ms-deck-order').textContent};
|
||||||
|
|
||||||
|
const upgraded = draw.childNodes[start+9];
|
||||||
|
upgraded.storage.mengsanCard_shuying.upgrade = 1;
|
||||||
|
piles.syncExhaustSnapshots();
|
||||||
|
await frame();
|
||||||
|
const upgrade = {tag:cardAt(start+9).querySelector('.ms-deck-tags')?.textContent,focused:document.activeElement===cardAt(start+9)};
|
||||||
|
|
||||||
|
body.style.maxHeight = '32px';
|
||||||
|
draw.replaceChildren();
|
||||||
|
await frame();
|
||||||
|
const empty = {visible:!!grid.querySelector('.ms-deck-empty'),top:body.scrollTop,focused:document.activeElement===drawTab};
|
||||||
|
body.scrollTop = body.scrollHeight;
|
||||||
|
piles.take(1);
|
||||||
|
await frame();
|
||||||
|
const wash = {draw:drawTab.textContent,discard:discardTab.textContent,top:body.scrollTop,
|
||||||
|
first:cardAt(0).querySelector('.ms-deck-name').textContent};
|
||||||
|
body.style.maxHeight = '';
|
||||||
|
|
||||||
|
publicDiscard.appendChild(seen);
|
||||||
|
await frame();
|
||||||
|
const reclaimed = {stillPublic:publicDiscard.contains(seen),discard:discardTab.textContent};
|
||||||
|
piles.addToDiscard(createDazedData('status-4'));
|
||||||
|
discardTab.click();
|
||||||
|
const switched = {discard:discardTab.textContent,visible:cardAt(1).querySelector('.ms-deck-name').textContent};
|
||||||
|
cardAt(1).click();
|
||||||
|
piles.addToDiscard(createDazedData('status-5'));
|
||||||
|
await frame();
|
||||||
|
const discardDetail = {visible:!dialog.querySelector('.ms-deck-detail').hidden,
|
||||||
|
summary:dialog.querySelector('.ms-deck-summary').textContent};
|
||||||
|
|
||||||
|
const nativeFirst = makeNative('club',7), nativeSecond = makeNative('diamond',8);
|
||||||
|
await piles.exhaustFromHand(nativeFirst);
|
||||||
|
await piles.exhaustFromHand(nativeSecond);
|
||||||
|
exhaustTab.click();
|
||||||
|
cardAt(0).focus({preventScroll:true});
|
||||||
|
piles.syncExhaustSnapshots();
|
||||||
|
await frame();
|
||||||
|
const corners = () => Array.from(grid.querySelectorAll('.ms-deck-corner'),card => card.textContent);
|
||||||
|
const exhaust = {cards:corners(),focused:document.activeElement===cardAt(0)};
|
||||||
|
piles.beginAutoPlay(nativeSecond,true);
|
||||||
|
await frame();
|
||||||
|
exhaust.remaining = corners();
|
||||||
|
discardTab.click();
|
||||||
|
return {unrelatedReads,afterBatch,detail,afterBack,reorder,upgrade,empty,wash,reclaimed,switched,discardDetail,exhaust};
|
||||||
|
});
|
||||||
|
assert.deepEqual(result.unrelatedReads,{count:0,records:0});
|
||||||
|
assert.deepEqual(result.afterBatch,{beforeFrame:'弃牌堆 · 0',countUpdates:1,discard:'弃牌堆 · 3',sameCard:true,
|
||||||
|
reads:{count:1,records:0}});
|
||||||
|
assert.deepEqual(result.detail,{stillOpen:true,focused:true,draw:'剩余牌堆 · 47'});
|
||||||
|
assert.deepEqual(result.afterBack,{top:0,number:'♥ 红桃 2',focused:true});
|
||||||
|
assert.ok(Math.abs(result.reorder.topAfter-result.reorder.topBefore)<=2,JSON.stringify(result.reorder));
|
||||||
|
assert.equal(result.reorder.focused,true);
|
||||||
|
assert.equal(result.reorder.order,'22');
|
||||||
|
assert.deepEqual(result.upgrade,{tag:'+1',focused:true});
|
||||||
|
assert.deepEqual(result.empty,{visible:true,top:0,focused:true});
|
||||||
|
assert.deepEqual(result.wash,{draw:'剩余牌堆 · 2',discard:'弃牌堆 · 0',top:0,first:'晕眩'});
|
||||||
|
assert.deepEqual(result.reclaimed,{stillPublic:false,discard:'弃牌堆 · 1'});
|
||||||
|
assert.deepEqual(result.switched,{discard:'弃牌堆 · 2',visible:'晕眩'});
|
||||||
|
assert.deepEqual(result.discardDetail,{visible:true,summary:'弃牌堆 · 共 3 张'});
|
||||||
|
assert.deepEqual(result.exhaust,{cards:['♣ 梅花 7','♦ 方块 8'],focused:true,remaining:['♣ 梅花 7']});
|
||||||
|
if (process.env.HUD_ARTIFACTS) {
|
||||||
|
await page.screenshot({path:path.join(process.env.HUD_ARTIFACTS,'battle-piles-live.png')});
|
||||||
|
}
|
||||||
|
const readsAfterClose = await page.evaluate(async () => {
|
||||||
|
const {control,reads} = window.pileReview;
|
||||||
|
reads.count = reads.records = 0;
|
||||||
|
control.refresh();
|
||||||
|
document.querySelector('.ms-deck-header button').click();
|
||||||
|
await new Promise(resolve => requestAnimationFrame(resolve));
|
||||||
|
return {...reads};
|
||||||
|
});
|
||||||
|
assert.deepEqual(readsAfterClose,{count:0,records:0});
|
||||||
|
assert.equal(await page.locator('.mengsan-deck-dialog-shuying').count(),0);
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.testJourneyZoom = async function testJourneyZoom(browser,origin,prefix) {
|
||||||
|
const pilePage = await browser.newPage({viewport:{width:812,height:375},hasTouch:true});
|
||||||
|
try { await checkLivePiles(pilePage,origin,prefix); }
|
||||||
|
finally { await pilePage.close(); }
|
||||||
|
console.log('Live battle piles: passed');
|
||||||
|
if (process.env.PILE_REFRESH_REVIEW === '1') return;
|
||||||
|
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`);
|
||||||
|
};
|
||||||
+118
-46
@@ -115,6 +115,7 @@ export function openCardLibrary(run, options = {}) {
|
|||||||
if (existing) { existing.focus(); return () => {}; }
|
if (existing) { existing.focus(); return () => {}; }
|
||||||
const previousFocus = document.activeElement;
|
const previousFocus = document.activeElement;
|
||||||
const selection = options.selection;
|
const selection = options.selection;
|
||||||
|
const sections = options.sections;
|
||||||
const dialog = element("dialog", "mengsan-deck-dialog-shuying", null);
|
const dialog = element("dialog", "mengsan-deck-dialog-shuying", null);
|
||||||
dialog.setAttribute("aria-label", options.title || "卡牌库");
|
dialog.setAttribute("aria-label", options.title || "卡牌库");
|
||||||
const header = element("header", "ms-deck-header", null, dialog);
|
const header = element("header", "ms-deck-header", null, dialog);
|
||||||
@@ -122,10 +123,13 @@ export function openCardLibrary(run, options = {}) {
|
|||||||
element("span", "ms-deck-eyebrow", options.eyebrow || "梦三 · 行囊", title);
|
element("span", "ms-deck-eyebrow", options.eyebrow || "梦三 · 行囊", title);
|
||||||
element("h2", "ms-deck-title", options.title || "卡牌库", title);
|
element("h2", "ms-deck-title", options.title || "卡牌库", title);
|
||||||
let closed = false, sizeObserver = null, virtualGrid = null, searchTimer = 0;
|
let closed = false, sizeObserver = null, virtualGrid = null, searchTimer = 0;
|
||||||
|
let refreshFrame = 0;
|
||||||
|
const pendingPiles = new Set();
|
||||||
const close = () => {
|
const close = () => {
|
||||||
if (closed) return;
|
if (closed) return;
|
||||||
closed = true;
|
closed = true;
|
||||||
clearTimeout(searchTimer);
|
clearTimeout(searchTimer);
|
||||||
|
cancelPileRefresh();
|
||||||
virtualGrid?.dispose();
|
virtualGrid?.dispose();
|
||||||
sizeObserver?.disconnect();
|
sizeObserver?.disconnect();
|
||||||
if (typeof window !== "undefined") window.removeEventListener?.("resize", fitCards);
|
if (typeof window !== "undefined") window.removeEventListener?.("resize", fitCards);
|
||||||
@@ -134,7 +138,7 @@ export function openCardLibrary(run, options = {}) {
|
|||||||
list.replaceChildren(); detailPanel.replaceChildren(); body.replaceChildren();
|
list.replaceChildren(); detailPanel.replaceChildren(); body.replaceChildren();
|
||||||
dialog.replaceChildren();
|
dialog.replaceChildren();
|
||||||
catalogRecords = null; descriptionCache = new WeakMap();
|
catalogRecords = null; descriptionCache = new WeakMap();
|
||||||
selectedButton = null; current = [];
|
selectedButton = null; current = []; sectionRecords = []; detailListPosition = null;
|
||||||
virtualGrid = null; sizeObserver = null;
|
virtualGrid = null; sizeObserver = null;
|
||||||
if (previousFocus?.isConnected) previousFocus.focus();
|
if (previousFocus?.isConnected) previousFocus.focus();
|
||||||
const onClose = options.onClose;
|
const onClose = options.onClose;
|
||||||
@@ -142,16 +146,16 @@ export function openCardLibrary(run, options = {}) {
|
|||||||
onClose?.(close);
|
onClose?.(close);
|
||||||
};
|
};
|
||||||
button("关闭", header, close);
|
button("关闭", header, close);
|
||||||
let view = selection || (!options.sections && options.view === "catalog")
|
let view = selection || (!sections && options.view === "catalog")
|
||||||
? "catalog" : "deck";
|
? "catalog" : "deck";
|
||||||
const navigation = element("nav", "ms-deck-tabs", null, dialog);
|
const navigation = element("nav", "ms-deck-tabs", null, dialog);
|
||||||
navigation.setAttribute("aria-label", "卡牌列表视图");
|
navigation.setAttribute("aria-label", "卡牌列表视图");
|
||||||
const deckTab = button("持有牌", navigation, () => { view = "deck"; render(); });
|
const deckTab = button("持有牌", navigation, () => { view = "deck"; render(); });
|
||||||
const catalogTab = button("图鉴", navigation, () => { view = "catalog"; render(); });
|
const catalogTab = button("图鉴", navigation, () => { view = "catalog"; render(); });
|
||||||
deckTab.hidden = catalogTab.hidden = Boolean(options.sections || selection);
|
deckTab.hidden = catalogTab.hidden = Boolean(sections || selection);
|
||||||
let sectionIndex = 0;
|
let sectionIndex = 0;
|
||||||
const sectionTabs = options.sections ? options.sections().map((section, index) =>
|
const sectionTabs = sections?.map((section, index) =>
|
||||||
button(section.title, navigation, () => { sectionIndex = index; render(); })) : [];
|
button(section.title, navigation, () => { sectionIndex = index; render(); }));
|
||||||
const filters = element("div", "ms-catalog-filters", null, dialog);
|
const filters = element("div", "ms-catalog-filters", null, dialog);
|
||||||
function field(label) {
|
function field(label) {
|
||||||
const wrapper = element("label", "ms-catalog-field", null, filters);
|
const wrapper = element("label", "ms-catalog-field", null, filters);
|
||||||
@@ -192,6 +196,7 @@ export function openCardLibrary(run, options = {}) {
|
|||||||
const footer = element("p", "ms-deck-footer", "点击卡牌查看完整介绍 · 仅供查看,不改变牌组或抽牌顺序", dialog);
|
const footer = element("p", "ms-deck-footer", "点击卡牌查看完整介绍 · 仅供查看,不改变牌组或抽牌顺序", dialog);
|
||||||
let current = Array.isArray(run?.player?.deck) ? run.player.deck : [];
|
let current = Array.isArray(run?.player?.deck) ? run.player.deck : [];
|
||||||
let detail = false, selectedButton = null, scrollTop = 0, orderedView = false;
|
let detail = false, selectedButton = null, scrollTop = 0, orderedView = false;
|
||||||
|
let sectionRecords = [], displayedSection = -1, detailListPosition = null;
|
||||||
const list = element("div", "ms-deck-grid ms-library-grid", null, body);
|
const list = element("div", "ms-deck-grid ms-library-grid", null, body);
|
||||||
const detailPanel = element("section", "ms-deck-detail", null, body);
|
const detailPanel = element("section", "ms-deck-detail", null, body);
|
||||||
detailPanel.hidden = true;
|
detailPanel.hidden = true;
|
||||||
@@ -199,7 +204,15 @@ export function openCardLibrary(run, options = {}) {
|
|||||||
virtualGrid = createVirtualCardGrid(body, list, createTile);
|
virtualGrid = createVirtualCardGrid(body, list, createTile);
|
||||||
function back() {
|
function back() {
|
||||||
detail = false; detailPanel.hidden = true; list.hidden = false;
|
detail = false; detailPanel.hidden = true; list.hidden = false;
|
||||||
detailPanel.replaceChildren(); body.scrollTop = scrollTop; fitCards();
|
detailPanel.replaceChildren();
|
||||||
|
if (sections) {
|
||||||
|
cancelPileRefresh();
|
||||||
|
updateSectionTabs();
|
||||||
|
renderSection({ position: detailListPosition });
|
||||||
|
detailListPosition = null; selectedButton = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
body.scrollTop = scrollTop; fitCards();
|
||||||
virtualGrid?.resume();
|
virtualGrid?.resume();
|
||||||
if (selectedButton?.isConnected) selectedButton.focus({ preventScroll: true });
|
if (selectedButton?.isConnected) selectedButton.focus({ preventScroll: true });
|
||||||
else if (virtualGrid && selectedButton) virtualGrid.focus(Number(selectedButton.dataset.cardIndex));
|
else if (virtualGrid && selectedButton) virtualGrid.focus(Number(selectedButton.dataset.cardIndex));
|
||||||
@@ -207,6 +220,7 @@ export function openCardLibrary(run, options = {}) {
|
|||||||
function showDetail(card, details, owner, catalog = false) {
|
function showDetail(card, details, owner, catalog = false) {
|
||||||
clearTimeout(searchTimer);
|
clearTimeout(searchTimer);
|
||||||
selectedButton = owner; scrollTop = body.scrollTop;
|
selectedButton = owner; scrollTop = body.scrollTop;
|
||||||
|
if (sections) detailListPosition = captureListPosition(owner);
|
||||||
detail = true; list.hidden = true; detailPanel.hidden = false;
|
detail = true; list.hidden = true; detailPanel.hidden = false;
|
||||||
detailPanel.replaceChildren();
|
detailPanel.replaceChildren();
|
||||||
const backButton = button(catalog ? "返回图鉴" : "返回牌库", detailPanel, back);
|
const backButton = button(catalog ? "返回图鉴" : "返回牌库", detailPanel, back);
|
||||||
@@ -242,7 +256,8 @@ export function openCardLibrary(run, options = {}) {
|
|||||||
}
|
}
|
||||||
body.scrollTop = 0; backButton.focus();
|
body.scrollTop = 0; backButton.focus();
|
||||||
}
|
}
|
||||||
function fitCards() {
|
function fitCards() { layoutCards(); }
|
||||||
|
function layoutCards(position = null) {
|
||||||
if (closed || !body.clientHeight) return;
|
if (closed || !body.clientHeight) return;
|
||||||
const padding = getComputedStyle(body);
|
const padding = getComputedStyle(body);
|
||||||
const available = body.clientHeight - parseFloat(padding.paddingTop) - parseFloat(padding.paddingBottom);
|
const available = body.clientHeight - parseFloat(padding.paddingTop) - parseFloat(padding.paddingBottom);
|
||||||
@@ -250,7 +265,7 @@ export function openCardLibrary(run, options = {}) {
|
|||||||
const height = Math.max(128, Math.min(218, Math.floor((available - (rows - 1) * 8) / rows)));
|
const height = Math.max(128, Math.min(218, Math.floor((available - (rows - 1) * 8) / rows)));
|
||||||
dialog.style.setProperty("--ms-card-height", String(height) + "px");
|
dialog.style.setProperty("--ms-card-height", String(height) + "px");
|
||||||
dialog.style.setProperty("--ms-card-art-width", String(Math.max(8, Math.min(98, Math.floor((height - (orderedView ? 104 : 80)) * 5 / 7)))) + "px");
|
dialog.style.setProperty("--ms-card-art-width", String(Math.max(8, Math.min(98, Math.floor((height - (orderedView ? 104 : 80)) * 5 / 7)))) + "px");
|
||||||
virtualGrid?.layout(height);
|
virtualGrid?.layout(height, position);
|
||||||
}
|
}
|
||||||
function createTile(record, index) {
|
function createTile(record, index) {
|
||||||
const { card, catalog = false, ordered = false } = record;
|
const { card, catalog = false, ordered = false } = record;
|
||||||
@@ -266,33 +281,95 @@ export function openCardLibrary(run, options = {}) {
|
|||||||
element("span", "ms-deck-excerpt", details.description, tile);
|
element("span", "ms-deck-excerpt", details.description, tile);
|
||||||
return tile;
|
return tile;
|
||||||
}
|
}
|
||||||
|
function captureListPosition(focused = document.activeElement) {
|
||||||
|
const scrollTop = sectionRecords.length ? body.scrollTop : 0;
|
||||||
|
const anchors = scrollTop > 0 ? virtualGrid.visiblePositions().map(({ index, offset }) =>
|
||||||
|
({ key: sectionRecords[index].key, offset })) : [];
|
||||||
|
const focusKey = list.contains(focused) ? sectionRecords[Number(focused.dataset.cardIndex)]?.key : undefined;
|
||||||
|
return { scrollTop, anchors, focusKey };
|
||||||
|
}
|
||||||
|
function restoreListPosition(position) {
|
||||||
|
if (!position) { fitCards(); return; }
|
||||||
|
const indices = new Map(sectionRecords.map(({ key }, index) => [key, index]));
|
||||||
|
const anchor = position.anchors.find(({ key }) => indices.has(key));
|
||||||
|
layoutCards({ index: anchor ? indices.get(anchor.key) : -1, offset: anchor?.offset,
|
||||||
|
scrollTop: sectionRecords.length ? position.scrollTop : 0 });
|
||||||
|
if (position.focusKey === undefined) return;
|
||||||
|
const index = indices.get(position.focusKey);
|
||||||
|
if (index === undefined) sectionTabs[sectionIndex].focus({ preventScroll: true });
|
||||||
|
else virtualGrid.focus(index, { scroll: false });
|
||||||
|
}
|
||||||
|
function updateSectionTabs(piles = null) {
|
||||||
|
sections.forEach(({ title, key, ordered }, index) => {
|
||||||
|
if (piles && !piles.has(key)) return;
|
||||||
|
const tab = sectionTabs[index];
|
||||||
|
const count = options.pileView.count(key);
|
||||||
|
const label = `${title} · ${count}`;
|
||||||
|
if (tab.textContent !== label) tab.textContent = label;
|
||||||
|
if (!piles) tab.setAttribute("aria-pressed", String(index === sectionIndex));
|
||||||
|
if (index !== sectionIndex) return;
|
||||||
|
const summaryLabel = ordered ? "剩余牌堆按从左到右、从上到下的顺序摸取;第 1 张为下一张。" :
|
||||||
|
`${title} · 共 ${count} 张`;
|
||||||
|
if (summary.textContent !== summaryLabel) summary.textContent = summaryLabel;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function renderSection({ position = null, preserve = false } = {}) {
|
||||||
|
const { key, ordered } = sections[sectionIndex];
|
||||||
|
const records = options.pileView.records(key).map(({ card, key }) =>
|
||||||
|
({ card, key, ordered, signature: JSON.stringify(card) }));
|
||||||
|
if (displayedSection === sectionIndex && records.length === sectionRecords.length &&
|
||||||
|
records.every(({ key, signature }, index) => key === sectionRecords[index].key && signature === sectionRecords[index].signature)) {
|
||||||
|
if (position) restoreListPosition(position);
|
||||||
|
else if (!preserve) virtualGrid.resume();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (preserve) position = captureListPosition();
|
||||||
|
displayedSection = sectionIndex; sectionRecords = records; orderedView = ordered;
|
||||||
|
descriptionCache = new WeakMap();
|
||||||
|
virtualGrid.setRecords(records);
|
||||||
|
if (!records.length) {
|
||||||
|
const emptyMessage = ordered ? "剩余牌堆为空;下一次摸牌需按规则洗切弃牌堆,洗切后的顺序尚未确定。" : "此处暂无卡牌。";
|
||||||
|
element("p", "ms-deck-empty", emptyMessage, list);
|
||||||
|
}
|
||||||
|
restoreListPosition(position);
|
||||||
|
}
|
||||||
|
function cancelPileRefresh() {
|
||||||
|
if (refreshFrame) cancelAnimationFrame(refreshFrame);
|
||||||
|
refreshFrame = 0;
|
||||||
|
pendingPiles.clear();
|
||||||
|
}
|
||||||
|
function schedulePileRefresh(...piles) {
|
||||||
|
if (closed) return;
|
||||||
|
for (const key of piles.length ? piles : sections.map(section => section.key)) pendingPiles.add(key);
|
||||||
|
if (refreshFrame) return;
|
||||||
|
refreshFrame = requestAnimationFrame(() => {
|
||||||
|
refreshFrame = 0;
|
||||||
|
updateSectionTabs(pendingPiles);
|
||||||
|
const updateList = !detail && pendingPiles.has(sections[sectionIndex].key);
|
||||||
|
pendingPiles.clear();
|
||||||
|
if (updateList) renderSection({ preserve: true });
|
||||||
|
});
|
||||||
|
}
|
||||||
function render() {
|
function render() {
|
||||||
clearTimeout(searchTimer);
|
clearTimeout(searchTimer);
|
||||||
detail = false; list.hidden = false; detailPanel.hidden = true;
|
detail = false; list.hidden = false; detailPanel.hidden = true;
|
||||||
detailPanel.replaceChildren();
|
detailPanel.replaceChildren();
|
||||||
body.scrollTop = 0;
|
body.scrollTop = 0;
|
||||||
selectedButton = null;
|
selectedButton = null;
|
||||||
const catalog = !options.sections && view === "catalog";
|
const catalog = !sections && view === "catalog";
|
||||||
filters.hidden = !catalog;
|
filters.hidden = !catalog;
|
||||||
deckTab.setAttribute("aria-pressed", String(!catalog));
|
deckTab.setAttribute("aria-pressed", String(!catalog));
|
||||||
catalogTab.setAttribute("aria-pressed", String(catalog));
|
catalogTab.setAttribute("aria-pressed", String(catalog));
|
||||||
list.classList.toggle("ms-catalog-grid", catalog);
|
list.classList.toggle("ms-catalog-grid", catalog);
|
||||||
let records = [], emptyMessage = "此处暂无卡牌。";
|
if (sections) {
|
||||||
orderedView = false;
|
cancelPileRefresh();
|
||||||
if (options.sections) {
|
detailListPosition = null;
|
||||||
const sections = options.sections();
|
updateSectionTabs();
|
||||||
const section = sections[sectionIndex];
|
renderSection();
|
||||||
orderedView = Boolean(section?.ordered);
|
return;
|
||||||
if (section?.ordered) emptyMessage = "剩余牌堆为空;下一次摸牌需按规则洗切弃牌堆,洗切后的顺序尚未确定。";
|
}
|
||||||
sectionTabs.forEach((tab, index) => {
|
let records = [];
|
||||||
tab.textContent = `${sections[index].title} · ${sections[index].cards.length}`;
|
if (catalog) {
|
||||||
tab.setAttribute("aria-pressed", String(index === sectionIndex));
|
|
||||||
});
|
|
||||||
records = (section?.cards || []).map(card => ({ card, ordered: section.ordered }));
|
|
||||||
summary.textContent = section?.ordered
|
|
||||||
? "剩余牌堆按从左到右、从上到下的顺序摸取;第 1 张为下一张。"
|
|
||||||
: `${section?.title || "牌堆"} · 共 ${records.length} 张`;
|
|
||||||
} else if (catalog) {
|
|
||||||
const query = search.value.trim().toLocaleLowerCase();
|
const query = search.value.trim().toLocaleLowerCase();
|
||||||
catalogRecords ||= getCardCatalog().map(card => {
|
catalogRecords ||= getCardCatalog().map(card => {
|
||||||
const details = describeCatalogCard(card);
|
const details = describeCatalogCard(card);
|
||||||
@@ -311,15 +388,14 @@ export function openCardLibrary(run, options = {}) {
|
|||||||
details.cost !== null && details.cost === Number(costFilter.value))));
|
details.cost !== null && details.cost === Number(costFilter.value))));
|
||||||
summary.textContent = `卡牌图鉴 · 共 ${total} 种 · 当前显示 ${records.length} 种`;
|
summary.textContent = `卡牌图鉴 · 共 ${total} 种 · 当前显示 ${records.length} 种`;
|
||||||
} else {
|
} else {
|
||||||
summary.textContent = options.sections ? "剩余牌堆按从左到右、从上到下的顺序摸取;第 1 张为下一张。" :
|
summary.textContent = `本次征程实际携带 · 共 ${current.length} 张 · 同名不同花色、点数分别展示`;
|
||||||
`本次征程实际携带 · 共 ${current.length} 张 · 同名不同花色、点数分别展示`;
|
|
||||||
}
|
}
|
||||||
if (catalog && selection) footer.textContent = selection.description;
|
if (catalog && selection) footer.textContent = selection.description;
|
||||||
else footer.textContent = catalog ? "图鉴仅供查阅,不会获得卡牌或改变征程牌组 · 点击卡牌查看完整介绍" :
|
else footer.textContent = catalog ? "图鉴仅供查阅,不会获得卡牌或改变征程牌组 · 点击卡牌查看完整介绍" :
|
||||||
"点击卡牌查看完整介绍 · 仅供查看,不改变牌组或抽牌顺序";
|
"点击卡牌查看完整介绍 · 仅供查看,不改变牌组或抽牌顺序";
|
||||||
virtualGrid.setRecords(catalog || options.sections ? records : current.map(card => ({ card })));
|
virtualGrid.setRecords(catalog ? records : current.map(card => ({ card })));
|
||||||
if (!(catalog || options.sections ? records : current).length) {
|
if (!(catalog ? records : current).length) {
|
||||||
element("p", "ms-deck-empty", catalog ? "没有符合筛选的卡牌,可清空筛选后查看全部图鉴。" : emptyMessage, list);
|
element("p", "ms-deck-empty", catalog ? "没有符合筛选的卡牌,可清空筛选后查看全部图鉴。" : "此处暂无卡牌。", list);
|
||||||
}
|
}
|
||||||
fitCards();
|
fitCards();
|
||||||
}
|
}
|
||||||
@@ -328,7 +404,7 @@ export function openCardLibrary(run, options = {}) {
|
|||||||
// Prevent the map's Escape/Tab handler from acting behind this modal.
|
// Prevent the map's Escape/Tab handler from acting behind this modal.
|
||||||
dialog.addEventListener("keydown", event => event.stopPropagation());
|
dialog.addEventListener("keydown", event => event.stopPropagation());
|
||||||
render();
|
render();
|
||||||
document.body.appendChild(dialog);
|
document.documentElement.appendChild(dialog);
|
||||||
try { dialog.showModal(); } catch (error) { close(); throw error; }
|
try { dialog.showModal(); } catch (error) { close(); throw error; }
|
||||||
fitCards();
|
fitCards();
|
||||||
if (typeof ResizeObserver !== "undefined") {
|
if (typeof ResizeObserver !== "undefined") {
|
||||||
@@ -338,20 +414,12 @@ export function openCardLibrary(run, options = {}) {
|
|||||||
window.addEventListener?.("resize", fitCards);
|
window.addEventListener?.("resize", fitCards);
|
||||||
}
|
}
|
||||||
header.querySelector("button").focus();
|
header.querySelector("button").focus();
|
||||||
close.refresh = () => {
|
if (sections) close.refresh = schedulePileRefresh;
|
||||||
if (closed) return;
|
|
||||||
// Rebuild from live arrays after a pile mutation, including while viewing details.
|
|
||||||
const wasDetail = detail, offset = body.scrollTop;
|
|
||||||
catalogRecords = null; descriptionCache = new WeakMap();
|
|
||||||
render(); body.scrollTop = offset;
|
|
||||||
virtualGrid?.resume();
|
|
||||||
if (wasDetail) header.querySelector("button").focus();
|
|
||||||
};
|
|
||||||
return close;
|
return close;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The battle view exposes only this player's own piles, including consumed cards.
|
// The battle view exposes only this player's own piles, including consumed cards.
|
||||||
export function mountBattlePiles(session, battle) {
|
export function mountBattlePiles(session, battle, pileView) {
|
||||||
let closeDialog = null, disposed = false;
|
let closeDialog = null, disposed = false;
|
||||||
const control = button("牌堆", ui.window, () => {
|
const control = button("牌堆", ui.window, () => {
|
||||||
if (disposed || !session.active || battle.resolving) return;
|
if (disposed || !session.active || battle.resolving) return;
|
||||||
@@ -359,10 +427,14 @@ export function mountBattlePiles(session, battle) {
|
|||||||
closeDialog = openCardLibrary(null, {
|
closeDialog = openCardLibrary(null, {
|
||||||
title: "战斗牌堆", eyebrow: "梦三 · 个人牌堆",
|
title: "战斗牌堆", eyebrow: "梦三 · 个人牌堆",
|
||||||
onClose(handle) { if (closeDialog === handle) closeDialog = null; },
|
onClose(handle) { if (closeDialog === handle) closeDialog = null; },
|
||||||
sections: () => [
|
pileView: pileView ?? {
|
||||||
{ title: "剩余牌堆", cards: battle.drawPile, ordered: true },
|
count: key => battle[key].length,
|
||||||
{ title: "弃牌堆", cards: battle.discardPile, ordered: false },
|
records: key => battle[key].map(card => ({ card, key: card.id ?? card })),
|
||||||
{ title: "消耗牌堆", cards: battle.exhaustPile, ordered: false },
|
},
|
||||||
|
sections: [
|
||||||
|
{ title: "剩余牌堆", key: "drawPile", ordered: true },
|
||||||
|
{ title: "弃牌堆", key: "discardPile", ordered: false },
|
||||||
|
{ title: "消耗牌堆", key: "exhaustPile", ordered: false },
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
}, "mengsan-battle-piles-button-shuying");
|
}, "mengsan-battle-piles-button-shuying");
|
||||||
@@ -372,5 +444,5 @@ export function mountBattlePiles(session, battle) {
|
|||||||
disposed = true; closeDialog?.(); closeDialog = null; control.remove();
|
disposed = true; closeDialog?.(); closeDialog = null; control.remove();
|
||||||
};
|
};
|
||||||
session.ownResource(control, dispose);
|
session.ownResource(control, dispose);
|
||||||
return { dispose, refresh() { if (!disposed) closeDialog?.refresh?.(); } };
|
return { dispose, refresh(...piles) { if (!disposed && session.active) closeDialog?.refresh?.(...piles); } };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,21 +29,22 @@ export const playDialogue = (lines, options = {}) => new Promise(resolve => {
|
|||||||
|
|
||||||
const overlay = ui.create.div(".mengsan-dialogue-overlay-shuying", ui.window);
|
const overlay = ui.create.div(".mengsan-dialogue-overlay-shuying", ui.window);
|
||||||
const stage = ui.create.div(".mengsan-dialogue-stage-shuying", overlay);
|
const stage = ui.create.div(".mengsan-dialogue-stage-shuying", overlay);
|
||||||
ui.create.div(".mengsan-dialogue-chapter-shuying", options.title || "剧情", stage);
|
ui.create.div(".mengsan-dialogue-chapter-shuying", options.title || "剧情", overlay);
|
||||||
const textBox = ui.create.div(".mengsan-dialogue-box-shuying", stage);
|
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(
|
const portraitFrame = ui.create.div(
|
||||||
".mengsan-dialogue-portrait-frame-shuying", textBox);
|
".mengsan-dialogue-portrait-frame-shuying", textBox);
|
||||||
const speaker = ui.create.div(".mengsan-dialogue-speaker-shuying", textBox);
|
const speaker = ui.create.div(".mengsan-dialogue-speaker-shuying", textBox);
|
||||||
const text = ui.create.div(".mengsan-dialogue-text-shuying", textBox);
|
const text = ui.create.div(".mengsan-dialogue-text-shuying", textBox);
|
||||||
const progress = ui.create.div(".mengsan-dialogue-progress-shuying", textBox);
|
const progress = ui.create.div(".mengsan-dialogue-progress-shuying", textBox);
|
||||||
const indicator = ui.create.div(".mengsan-dialogue-indicator-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");
|
const skipButton = document.createElement("button");
|
||||||
skipButton.type = "button";
|
skipButton.type = "button";
|
||||||
skipButton.className = "mengsan-dialogue-skip-shuying";
|
skipButton.className = "mengsan-dialogue-skip-shuying";
|
||||||
skipButton.textContent = "跳过对话";
|
skipButton.textContent = "跳过对话";
|
||||||
skipButton.setAttribute("aria-label", "跳过对话,未选择的发言使用默认选项");
|
skipButton.setAttribute("aria-label", "跳过对话,未选择的发言使用默认选项");
|
||||||
stage.appendChild(skipButton);
|
overlay.appendChild(skipButton);
|
||||||
|
|
||||||
let lineIndex = -1;
|
let lineIndex = -1;
|
||||||
let timer = null;
|
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);
|
const help = ui.create.div(".mengsan-dialogue-help-shuying", stage);
|
||||||
help.textContent = "点击补全文字 · 再次点击继续 · Enter / 空格";
|
help.textContent = "点击补全文字 · 再次点击继续 · Enter / 空格";
|
||||||
showNextLine();
|
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;
|
if (overlay.dataset.resolved) return;
|
||||||
overlay.dataset.resolved = "true";
|
overlay.dataset.resolved = "true";
|
||||||
overlay.remove();
|
overlay.remove();
|
||||||
if (previousFocus?.isConnected) previousFocus.focus();
|
if (previousFocus?.isConnected) previousFocus.focus({ preventScroll: true });
|
||||||
resolve(id);
|
resolve(id);
|
||||||
};
|
};
|
||||||
const initialFocus = render(overlay, finish);
|
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(); }
|
if (event.shiftKey && document.activeElement === first) { event.preventDefault(); last.focus(); }
|
||||||
else if (!event.shiftKey && document.activeElement === last) { event.preventDefault(); first.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) => {
|
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;
|
const created = dialog;
|
||||||
dialog.addEventListener("close", () => { if (dialog === created) close(); });
|
dialog.addEventListener("close", () => { if (dialog === created) close(); });
|
||||||
dialog.addEventListener("keydown", event => event.stopPropagation());
|
dialog.addEventListener("keydown", event => event.stopPropagation());
|
||||||
document.body.appendChild(dialog);
|
document.documentElement.appendChild(dialog);
|
||||||
try { dialog.showModal(); } catch (error) { close(); throw error; }
|
try { dialog.showModal(); } catch (error) { close(); throw error; }
|
||||||
render();
|
render();
|
||||||
dialog.querySelector(".ms-deck-header button").focus();
|
dialog.querySelector(".ms-deck-header button").focus();
|
||||||
|
|||||||
+10
-14
@@ -89,24 +89,20 @@ export function createHandInput(player, session, adapter, fan, env, refresh, log
|
|||||||
aim = document.createElementNS(svg, "svg");
|
aim = document.createElementNS(svg, "svg");
|
||||||
aim.classList.add("mengsan-hand-aim-shuying");
|
aim.classList.add("mengsan-hand-aim-shuying");
|
||||||
aim.setAttribute("aria-hidden", "true");
|
aim.setAttribute("aria-hidden", "true");
|
||||||
|
aim.setAttribute("preserveAspectRatio", "none");
|
||||||
aim.appendChild(document.createElementNS(svg, "line"));
|
aim.appendChild(document.createElementNS(svg, "line"));
|
||||||
document.documentElement.appendChild(aim);
|
document.documentElement.appendChild(aim);
|
||||||
}
|
}
|
||||||
// 牌面和触点在同一个视口坐标系,统一换算到绘制层的局部坐标。
|
// Use the painted overlay bounds so card, touch and line share viewport CSS pixels.
|
||||||
const matrix = aim.getScreenCTM();
|
const overlay = aim.getBoundingClientRect();
|
||||||
const determinant = matrix && matrix.a * matrix.d - matrix.b * matrix.c;
|
if (!(overlay.width > 0 && overlay.height > 0)) { removeAim(); return; }
|
||||||
if (!determinant || !Number.isFinite(determinant)) { removeAim(); return; }
|
const viewBox = `0 0 ${overlay.width} ${overlay.height}`;
|
||||||
const inverse = matrix.inverse();
|
if (aim.getAttribute("viewBox") !== viewBox) aim.setAttribute("viewBox", viewBox);
|
||||||
const viewportPoint = aim.createSVGPoint();
|
|
||||||
viewportPoint.x = x; viewportPoint.y = y;
|
|
||||||
const from = viewportPoint.matrixTransform(inverse);
|
|
||||||
viewportPoint.x = point.x; viewportPoint.y = point.y;
|
|
||||||
const to = viewportPoint.matrixTransform(inverse);
|
|
||||||
const line = aim.firstElementChild;
|
const line = aim.firstElementChild;
|
||||||
line.setAttribute("x1", from.x);
|
line.setAttribute("x1", x - overlay.left);
|
||||||
line.setAttribute("y1", from.y);
|
line.setAttribute("y1", y - overlay.top);
|
||||||
line.setAttribute("x2", to.x);
|
line.setAttribute("x2", point.x - overlay.left);
|
||||||
line.setAttribute("y2", to.y);
|
line.setAttribute("y2", point.y - overlay.top);
|
||||||
}
|
}
|
||||||
function clearSelection(state) {
|
function clearSelection(state) {
|
||||||
if (!live(state) || !state.selected) return;
|
if (!live(state) || !state.selected) return;
|
||||||
|
|||||||
+37
-10
@@ -108,7 +108,7 @@ export function mountBattleHUD(player, battle, env) {
|
|||||||
const openDetails = (target, id = null) => {
|
const openDetails = (target, id = null) => {
|
||||||
if (disposed || frozen || !battle.session.active) return;
|
if (disposed || frozen || !battle.session.active) return;
|
||||||
closeDialog(); previousFocus = document.activeElement;
|
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 current = dialog;
|
||||||
const header = create('header', 'ms-deck-header', dialog);
|
const header = create('header', 'ms-deck-header', dialog);
|
||||||
create('h2', '', header, `${nameOf(target)} · 当前状态`);
|
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 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); }
|
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;
|
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');
|
const oldLayout = arena.getAttribute('data-mengsan-hud-layout');
|
||||||
restores.push(() => {
|
restores.push(() => {
|
||||||
if (arena.getAttribute('data-mengsan-hud-layout') !== layout) return;
|
if (arena.getAttribute('data-mengsan-hud-layout') !== layout) return;
|
||||||
@@ -272,20 +277,41 @@ export function mountBattleHUD(player, battle, env) {
|
|||||||
const hudHeight = hudHeightFor();
|
const hudHeight = hudHeightFor();
|
||||||
style(arena, '--mengsan-hud-height', `${hudHeight}px`);
|
style(arena, '--mengsan-hud-height', `${hudHeight}px`);
|
||||||
const large = width >= 1000;
|
const large = width >= 1000;
|
||||||
style(arena, '--mengsan-hud-left', short ? '216px' : narrow ? '116px' : large ? '352px' : '292px');
|
const left = short ? 216 : narrow ? 116 : large ? 352 : 292;
|
||||||
style(arena, '--mengsan-hud-right', short ? '132px' : narrow ? '116px' : '184px');
|
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-info-left', short ? '108px' : narrow ? '22px' : large ? '200px' : '160px');
|
||||||
style(arena, '--mengsan-profile-width', short ? '172px' : narrow ? '76px' : large ? '200px' : '130px');
|
style(arena, '--mengsan-profile-width', short ? '172px' : narrow ? '76px' : large ? '200px' : '130px');
|
||||||
skinActor(player);
|
skinActor(player);
|
||||||
// Inline important dimensions also beat skins with #arena > .player !important rules.
|
// 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 selfBottom = narrow ? 180 : 24;
|
||||||
const selfHeight = short || narrow ? 104 : large ? 196 : 148;
|
const selfHeight = short || narrow ? 104 : large ? 196 : 148;
|
||||||
const infoTop = narrow ? hudHeight - selfBottom + 16 : hudHeight - selfBottom - selfHeight + (short ? 0 : 20);
|
const infoTop = narrow ? hudHeight - selfBottom + 16 : hudHeight - selfBottom - selfHeight + (short ? 0 : 20);
|
||||||
style(arena, '--mengsan-profile-info-top', `${infoTop}px`);
|
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',
|
for (const [key, value] of Object.entries({left:`${selfLeft}px`, right:'auto', top:'auto',
|
||||||
bottom:`${selfBottom}px`, width:short ? '76px' : narrow ? '76px' : large ? '144px' : '104px',
|
bottom:`${selfBottom}px`, width:`${selfWidth}px`,
|
||||||
height:`${selfHeight}px`, transform:'none'})) style(player, key, value);
|
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-relic-dock-bottom', `${selfBottom + selfHeight + (narrow ? -4 : 12)}px`);
|
||||||
style(arena, '--mengsan-skill-ceiling', `${Math.min(hudHeight - 36, selfBottom + selfHeight)}px`);
|
style(arena, '--mengsan-skill-ceiling', `${Math.min(hudHeight - 36, selfBottom + selfHeight)}px`);
|
||||||
style(arena, '--mengsan-status-height', short ? '52px' : narrow ? '84px' : '160px');
|
style(arena, '--mengsan-status-height', short ? '52px' : narrow ? '84px' : '160px');
|
||||||
@@ -339,8 +365,8 @@ export function mountBattleHUD(player, battle, env) {
|
|||||||
const hudHeight = hudHeightFor();
|
const hudHeight = hudHeightFor();
|
||||||
const rail = layout === 'wide' ? 142 : layout === 'short' ? 112 : 96;
|
const rail = layout === 'wide' ? 142 : layout === 'short' ? 112 : 96;
|
||||||
const actionBottom = layout === 'narrow' ? hudHeight - 48 : hudHeight + 8;
|
const actionBottom = layout === 'narrow' ? hudHeight - 48 : hudHeight + 8;
|
||||||
const compactActions = response || arena.clientWidth < 1000;
|
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:compactActions?'16px':'var(--mengsan-hud-left)',right:compactActions?'16px':'var(--mengsan-hud-right)',top:'auto',bottom:`${actionBottom}px`,width:'auto','max-height':'none',transform:'none'})) style(ui.control,key,value);
|
for (const [key,value] of Object.entries({position:'absolute',left: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')) {
|
for (const group of ui.control.children) if (group.classList.contains('control')) {
|
||||||
if (external.includes(group)) {
|
if (external.includes(group)) {
|
||||||
ownClass(group,'mengsan-hud-native-skills-shuying');
|
ownClass(group,'mengsan-hud-native-skills-shuying');
|
||||||
@@ -362,7 +388,7 @@ export function mountBattleHUD(player, battle, env) {
|
|||||||
const host=node.offsetParent||arena,a=arena.getBoundingClientRect(),h=host.getBoundingClientRect();
|
const host=node.offsetParent||arena,a=arena.getBoundingClientRect(),h=host.getBoundingClientRect();
|
||||||
const scale=h.width/host.offsetWidth||1,zoom=a.width/arena.clientWidth||1;
|
const scale=h.width/host.offsetWidth||1,zoom=a.width/arena.clientWidth||1;
|
||||||
const responseConfirm = response && node === ui.confirm;
|
const responseConfirm = response && node === ui.confirm;
|
||||||
const center=responseConfirm ? arena.clientWidth/2 : (parseFloat(arena.style.getPropertyValue('--mengsan-hud-left'))+arena.clientWidth-parseFloat(arena.style.getPropertyValue('--mengsan-hud-right')))/2;
|
const center=arena.clientWidth/2;
|
||||||
const side=responseConfirm ? 0 : node===ui.confirm?-1:1;
|
const side=responseConfirm ? 0 : node===ui.confirm?-1:1;
|
||||||
for(const [key,value] of Object.entries({position:'absolute',left:`${(a.left+center*zoom-h.left)/scale+side*80}px`,right:'auto',top:'auto',bottom:`${(h.bottom-a.bottom+actionBottom*zoom)/scale}px`,width:`${Math.min(rail,140)}px`,transform:'translateX(-50%)'}))style(node,key,value);
|
for(const [key,value] of Object.entries({position:'absolute',left:`${(a.left+center*zoom-h.left)/scale+side*80}px`,right:'auto',top:'auto',bottom:`${(h.bottom-a.bottom+actionBottom*zoom)/scale}px`,width:`${Math.min(rail,140)}px`,transform:'translateX(-50%)'}))style(node,key,value);
|
||||||
}
|
}
|
||||||
@@ -420,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 mark of hiddenMarks) mark.classList.remove('mengsan-hud-represented-mark-shuying'); hiddenMarks.clear();
|
||||||
for (const restore of restores.reverse()) restore();
|
for (const restore of restores.reverse()) restore();
|
||||||
releaseNodes();
|
releaseNodes();
|
||||||
|
invalidateHandBounds();
|
||||||
root.remove(); link.remove();
|
root.remove(); link.remove();
|
||||||
}
|
}
|
||||||
ownClass(document.body, 'mengsan-hud-active-shuying'); ownClass(arena, 'mengsan-hud-arena-shuying');
|
ownClass(document.body, 'mengsan-hud-active-shuying'); ownClass(arena, 'mengsan-hud-arena-shuying');
|
||||||
|
|||||||
@@ -82,9 +82,9 @@ export function createOverlayLayout(arena, hand, ui, player) {
|
|||||||
.filter(button => !button.closest('.mengsan-hud-external-control-shuying,.removing,.closing'))
|
.filter(button => !button.closest('.mengsan-hud-external-control-shuying,.removing,.closing'))
|
||||||
.map(button => button.getBoundingClientRect()).filter(box => box.height && box.width);
|
.map(button => button.getBoundingClientRect()).filter(box => box.height && box.width);
|
||||||
}
|
}
|
||||||
function positionResponseActions(handTop, center, gap, used) {
|
function alignActions(handTop, center, gap, used, response) {
|
||||||
const controls = [ui.control];
|
const controls = [ui.control];
|
||||||
if (ui.confirm?.isConnected && !ui.control.contains(ui.confirm)) controls.push(ui.confirm);
|
if (response && ui.confirm?.isConnected && !ui.control.contains(ui.confirm)) controls.push(ui.confirm);
|
||||||
let top = Infinity;
|
let top = Infinity;
|
||||||
for (const node of controls) {
|
for (const node of controls) {
|
||||||
const isRoot = node === ui.control;
|
const isRoot = node === ui.control;
|
||||||
@@ -102,7 +102,7 @@ export function createOverlayLayout(arena, hand, ui, player) {
|
|||||||
const right = Math.max(...centered.map(box => box.right));
|
const right = Math.max(...centered.map(box => box.right));
|
||||||
const scale = hostScale(node), previous = currentShift(node,scale);
|
const scale = hostScale(node), previous = currentShift(node,scale);
|
||||||
const bottom = Math.max(...buttons.map(box => box.bottom)) - previous.y;
|
const bottom = Math.max(...buttons.map(box => box.bottom)) - previous.y;
|
||||||
const offset = handTop - gap - bottom;
|
const offset = response ? handTop - gap - bottom : 0;
|
||||||
shift(node,center - (left + right)/2 + previous.x,offset,scale,used);
|
shift(node,center - (left + right)/2 + previous.x,offset,scale,used);
|
||||||
top = Math.min(top, ...buttons.map(box => box.top - previous.y + offset));
|
top = Math.min(top, ...buttons.map(box => box.top - previous.y + offset));
|
||||||
}
|
}
|
||||||
@@ -140,16 +140,16 @@ export function createOverlayLayout(arena, hand, ui, player) {
|
|||||||
const handCards=[...hand.querySelectorAll('.handcards>.card')].map(node=>node.getBoundingClientRect()).filter(box=>box.height&&box.width);
|
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 handTop=Math.min(handBox.top,...handCards.map(box=>box.top));
|
||||||
const gap=Math.max(4,(arena.clientHeight<=500?6:8)*zoom);
|
const gap=Math.max(4,(arena.clientHeight<=500?6:8)*zoom);
|
||||||
const responseTop=response ? positionResponseActions(handCards.length ? Math.min(...handCards.map(box=>box.top)) : handTop,(a.left+a.right)/2,gap,used) : Infinity;
|
const 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;
|
const controlTop=ui.control.getBoundingClientRect().top;
|
||||||
let promptBottom=Math.min(controlTop-10*zoom,a.bottom-(footerHeight+54)*zoom);
|
let promptBottom=Math.min(controlTop-10*zoom,a.bottom-(footerHeight+54)*zoom);
|
||||||
if(Number.isFinite(responseTop))promptBottom=responseTop-gap;
|
if(response && Number.isFinite(actionTop))promptBottom=actionTop-gap;
|
||||||
let promptTop=Infinity;
|
let promptTop=Infinity;
|
||||||
for(const node of prompts) {
|
for(const node of prompts) {
|
||||||
if(node.hidden || !node.getClientRects().length)continue;
|
if(node.hidden || !node.getClientRects().length)continue;
|
||||||
mark(node,'mengsan-hud-prompt-shuying');used.add(node);
|
mark(node,'mengsan-hud-prompt-shuying');used.add(node);
|
||||||
const promptX=response?a.left+16*zoom:x;
|
|
||||||
const promptWidth=response?arena.clientWidth-32:width;
|
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);
|
position(node,promptX,0,promptWidth,arena.clientHeight<=500?34:64);
|
||||||
const height=node.getBoundingClientRect().height;
|
const height=node.getBoundingClientRect().height;
|
||||||
position(node,promptX,Math.max(a.top+(response?8:50)*zoom,promptBottom-height),promptWidth,arena.clientHeight<=500?34:64);
|
position(node,promptX,Math.max(a.top+(response?8:50)*zoom,promptBottom-height),promptWidth,arena.clientHeight<=500?34:64);
|
||||||
|
|||||||
@@ -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 { 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-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-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-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-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; }
|
.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).
|
Keep them above the portrait (25) and below action controls (30).
|
||||||
Inline elevations used by awakening animations still take precedence. */
|
Inline elevations used by awakening animations still take precedence. */
|
||||||
body.mengsan-hud-active-shuying>#decadeUI-canvas { z-index:28; }
|
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-hand-shuying .handcards>.card { pointer-events:auto; }
|
||||||
.mengsan-hud-mebg-shuying,.mengsan-hud-hand-shuying>.fakeme.avatar { display:none!important; }
|
.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. */
|
/* 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-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-name-shuying { font-size:15px; }
|
||||||
[data-mengsan-hud-layout="short"] .mengsan-hud-energy-shuying { font-size:14px; }
|
[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-hand-shuying { 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-shuying .mengsan-hud-status-shuying { min-height:26px;padding:2px 4px; }
|
[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="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-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-name-shuying { font-size:16px; }
|
||||||
[data-mengsan-hud-layout="narrow"] .mengsan-hud-status-shuying span { display:none; }
|
[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; }
|
#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; }
|
[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-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; }
|
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%; }
|
[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; }
|
.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; }
|
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;
|
suppressClick = true;
|
||||||
if (!viewport.hasPointerCapture(event.pointerId)) viewport.setPointerCapture(event.pointerId);
|
if (!viewport.hasPointerCapture(event.pointerId)) viewport.setPointerCapture(event.pointerId);
|
||||||
viewport.classList.add("dragging");
|
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();
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
const endDrag = event => {
|
const endDrag = event => {
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ export const askMenu = (title, description, choices) => new Promise(resolve => {
|
|||||||
dialog.appendChild(button);
|
dialog.appendChild(button);
|
||||||
}
|
}
|
||||||
dialog.addEventListener("cancel", event => { event.preventDefault(); finish(null); });
|
dialog.addEventListener("cancel", event => { event.preventDefault(); finish(null); });
|
||||||
document.body.appendChild(dialog);
|
document.documentElement.appendChild(dialog);
|
||||||
dialog.showModal();
|
dialog.showModal();
|
||||||
dialog.querySelector("button")?.focus();
|
dialog.querySelector("button")?.focus();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ export function mountRelics(session, run, battleRelics, { stripRoot = ui.me } =
|
|||||||
});
|
});
|
||||||
dialog.addEventListener("keydown", event => event.stopPropagation());
|
dialog.addEventListener("keydown", event => event.stopPropagation());
|
||||||
refresh();
|
refresh();
|
||||||
document.body.appendChild(dialog);
|
document.documentElement.appendChild(dialog);
|
||||||
try { dialog.showModal(); dismiss.focus(); }
|
try { dialog.showModal(); dismiss.focus(); }
|
||||||
catch (error) { close(); throw error; }
|
catch (error) { close(); throw error; }
|
||||||
};
|
};
|
||||||
|
|||||||
+75
-25
@@ -303,9 +303,26 @@
|
|||||||
|
|
||||||
.mengsan-dialogue-stage-shuying {
|
.mengsan-dialogue-stage-shuying {
|
||||||
position: absolute !important;
|
position: absolute !important;
|
||||||
inset: 0 !important;
|
inset: 68px 0 max(8px, env(safe-area-inset-bottom)) !important;
|
||||||
width: 100% !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 {
|
.mengsan-dialogue-chapter-shuying {
|
||||||
@@ -388,13 +405,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.mengsan-dialogue-box-shuying {
|
.mengsan-dialogue-box-shuying {
|
||||||
position: absolute !important;
|
position: relative !important;
|
||||||
left: 50% !important;
|
inset: auto !important;
|
||||||
right: auto !important;
|
width: 100% !important;
|
||||||
bottom: clamp(18px, 4vh, 42px) !important;
|
|
||||||
top: auto !important;
|
|
||||||
transform: translateX(-50%) !important;
|
|
||||||
width: min(1120px, 92vw) !important;
|
|
||||||
height: auto !important;
|
height: auto !important;
|
||||||
min-height: clamp(120px, 20vh, 180px);
|
min-height: clamp(120px, 20vh, 180px);
|
||||||
padding: clamp(32px, 5vh, 46px) clamp(24px, 4vw, 52px) 28px;
|
padding: clamp(32px, 5vh, 46px) clamp(24px, 4vw, 52px) 28px;
|
||||||
@@ -496,9 +509,8 @@
|
|||||||
height: 146px !important;
|
height: 146px !important;
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
}
|
}
|
||||||
|
.mengsan-dialogue-content-shuying { width: 96%; }
|
||||||
.mengsan-dialogue-box-shuying {
|
.mengsan-dialogue-box-shuying {
|
||||||
bottom: 8px !important;
|
|
||||||
width: 96vw !important;
|
|
||||||
min-height: 126px;
|
min-height: 126px;
|
||||||
padding: 30px 18px 24px;
|
padding: 30px 18px 24px;
|
||||||
}
|
}
|
||||||
@@ -548,6 +560,7 @@
|
|||||||
|
|
||||||
.mengsan-map-panel-shuying {
|
.mengsan-map-panel-shuying {
|
||||||
padding: 0 !important;
|
padding: 0 !important;
|
||||||
|
container-type: size;
|
||||||
background:
|
background:
|
||||||
linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
|
linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
|
||||||
linear-gradient(rgba(255,255,255,.012) 1px, transparent 1px);
|
linear-gradient(rgba(255,255,255,.012) 1px, transparent 1px);
|
||||||
@@ -783,7 +796,7 @@
|
|||||||
position: relative !important;
|
position: relative !important;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
display: block !important;
|
display: block !important;
|
||||||
width: min(420px, calc(100vw - 32px));
|
width: min(420px, calc(100% - 32px));
|
||||||
height: 100% !important;
|
height: 100% !important;
|
||||||
padding: 0 !important;
|
padding: 0 !important;
|
||||||
border: 0;
|
border: 0;
|
||||||
@@ -920,7 +933,7 @@
|
|||||||
.mengsan-ink-legend-shuying { display: none; }
|
.mengsan-ink-legend-shuying { display: none; }
|
||||||
.mengsan-map-shuying .mengsan-node-shuying { width: 52px; height: 52px; padding: 9px; }
|
.mengsan-map-shuying .mengsan-node-shuying { width: 52px; height: 52px; padding: 9px; }
|
||||||
.mengsan-map-menu-layer-shuying { align-items: flex-end; }
|
.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); } }
|
@keyframes mengsan-menu-enter-mobile-shuying { from { opacity: 0; transform: translateY(24px); } }
|
||||||
.mengsan-map-menu-title-shuying { font-size: 24px; }
|
.mengsan-map-menu-title-shuying { font-size: 24px; }
|
||||||
.mengsan-map-menu-header-shuying { inset: 14px 14px auto 14px !important; }
|
.mengsan-map-menu-header-shuying { inset: 14px 14px auto 14px !important; }
|
||||||
@@ -929,6 +942,35 @@
|
|||||||
.mengsan-map-menu-action-shuying { min-height: 64px; }
|
.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) {
|
@media (prefers-reduced-motion: reduce) {
|
||||||
.mengsan-map-menu-sheet-shuying { animation: none !important; }
|
.mengsan-map-menu-sheet-shuying { animation: none !important; }
|
||||||
.mengsan-map-menu-trigger-shuying,
|
.mengsan-map-menu-trigger-shuying,
|
||||||
@@ -954,6 +996,11 @@
|
|||||||
.mengsan-flow-overlay-shuying {
|
.mengsan-flow-overlay-shuying {
|
||||||
background: radial-gradient(ellipse at 18% 20%, #53635766, transparent 55%), linear-gradient(120deg, #172724f5, #101b1df5);
|
background: radial-gradient(ellipse at 18% 20%, #53635766, transparent 55%), linear-gradient(120deg, #172724f5, #101b1df5);
|
||||||
padding: 80px 24px 28px;
|
padding: 80px 24px 28px;
|
||||||
|
overflow: clip;
|
||||||
|
}
|
||||||
|
.mengsan-flow-overlay-shuying > .mengsan-panel-shuying {
|
||||||
|
min-height: 0;
|
||||||
|
overscroll-behavior: contain;
|
||||||
}
|
}
|
||||||
.mengsan-flow-panel-shuying {
|
.mengsan-flow-panel-shuying {
|
||||||
width: min(680px, 100%) !important;
|
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 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 { 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-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-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: 24px !important; max-width: calc(100% - 160px); color: var(--flow-muted); }
|
.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-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-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-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-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: 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-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 { 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-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 { 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; }
|
.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) {
|
@media (max-width: 600px) {
|
||||||
.mengsan-dialogue-chapter-shuying { display: block !important; font-size: 14px; }
|
.mengsan-dialogue-chapter-shuying { display: block !important; font-size: 14px; }
|
||||||
.mengsan-flow-overlay-shuying { padding: 78px 12px 16px; }
|
.mengsan-flow-overlay-shuying { padding: 78px 12px 16px; }
|
||||||
.mengsan-flow-panel-shuying { padding: 24px 18px; }
|
.mengsan-flow-panel-shuying { padding: 24px 18px; }
|
||||||
.mengsan-flow-panel-shuying > .mengsan-title-shuying { font-size: 30px; }
|
.mengsan-flow-panel-shuying > .mengsan-title-shuying { font-size: 30px; }
|
||||||
.mengsan-flow-panel-shuying .mengsan-choice-shuying { padding: 14px; }
|
.mengsan-flow-panel-shuying .mengsan-choice-shuying { padding: 14px; }
|
||||||
.mengsan-dialogue-box-shuying { bottom: 36px !important; }
|
|
||||||
}
|
}
|
||||||
@media (max-height: 500px) {
|
@media (max-height: 500px) {
|
||||||
.mengsan-flow-overlay-shuying { padding-top: 70px; padding-bottom: 12px; }
|
.mengsan-flow-overlay-shuying { padding-top: 70px; padding-bottom: 12px; }
|
||||||
.mengsan-flow-panel-shuying { padding: 18px 24px; }
|
.mengsan-flow-panel-shuying { padding: 18px 24px; }
|
||||||
.mengsan-flow-panel-shuying > .mengsan-description-shuying { margin-bottom: 16px; }
|
.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-text-shuying { max-height: 24vh; }
|
||||||
.mengsan-dialogue-portrait-frame-shuying {
|
.mengsan-dialogue-portrait-frame-shuying {
|
||||||
height: 110px !important;
|
height: 110px !important;
|
||||||
@@ -1267,7 +1319,8 @@ dialog.mengsan-deck-dialog-shuying::backdrop { background: #080706b8; }
|
|||||||
|
|
||||||
/* Battle-only control; removed with its owning session. */
|
/* Battle-only control; removed with its owning session. */
|
||||||
.mengsan-battle-piles-button-shuying {
|
.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;
|
z-index: 35; min-width: 64px; min-height: 44px; padding: 8px 14px;
|
||||||
border: 1px solid #dcb578; border-radius: 8px; background: #30251eee;
|
border: 1px solid #dcb578; border-radius: 8px; background: #30251eee;
|
||||||
color: #f4e7cc; font: 16px/1.4 "Microsoft YaHei", sans-serif;
|
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-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 { 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; }
|
.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. */
|
/* Only session-created Mengsan players; retain internal identity and seat order. */
|
||||||
.player.mengsan-hide-identity-shuying > .identity {
|
.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;
|
height: 22px;
|
||||||
object-fit: contain;
|
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 {
|
.mengsan-hand-relics-shuying {
|
||||||
position: absolute !important;
|
position: absolute !important;
|
||||||
left: 0;
|
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-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 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; }
|
.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 {
|
.mengsan-bonds-shuying {
|
||||||
position: relative !important;
|
position: relative !important;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
|||||||
@@ -5,6 +5,21 @@ export function createVirtualCardGrid(viewport, grid, createCard) {
|
|||||||
const maxCached = 24;
|
const maxCached = 24;
|
||||||
let records = [], columns = 1, height = 218, gap = 8, padding = 5, viewportHeight = 0;
|
let records = [], columns = 1, height = 218, gap = 8, padding = 5, viewportHeight = 0;
|
||||||
let frame = 0, disposed = false;
|
let frame = 0, disposed = false;
|
||||||
|
function mount(index) {
|
||||||
|
if (mounted.has(index)) return mounted.get(index);
|
||||||
|
const node = cached.get(index) || createCard(records[index], index);
|
||||||
|
cached.delete(index);
|
||||||
|
node.dataset.cardIndex = String(index);
|
||||||
|
node.style.gridRow = String(Math.floor(index / columns) + 1);
|
||||||
|
node.style.gridColumn = String(index % columns + 1);
|
||||||
|
// 保持 DOM 顺序与屏幕顺序一致,方便键盘与读屏浏览。
|
||||||
|
let next = null;
|
||||||
|
for (const [otherIndex, other] of mounted) {
|
||||||
|
if (otherIndex > index && (!next || otherIndex < Number(next.dataset.cardIndex))) next = other;
|
||||||
|
}
|
||||||
|
grid.insertBefore(node, next); mounted.set(index, node);
|
||||||
|
return node;
|
||||||
|
}
|
||||||
function draw() {
|
function draw() {
|
||||||
if (disposed || grid.hidden || !viewportHeight) return;
|
if (disposed || grid.hidden || !viewportHeight) return;
|
||||||
const stride = height + gap;
|
const stride = height + gap;
|
||||||
@@ -20,25 +35,26 @@ export function createVirtualCardGrid(viewport, grid, createCard) {
|
|||||||
while (cached.size > maxCached) cached.delete(cached.keys().next().value);
|
while (cached.size > maxCached) cached.delete(cached.keys().next().value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (let index = first; index < end; index++) {
|
for (let index = first; index < end; index++) mount(index);
|
||||||
if (mounted.has(index)) continue;
|
|
||||||
const node = cached.get(index) || createCard(records[index], index);
|
|
||||||
cached.delete(index);
|
|
||||||
node.dataset.cardIndex = String(index);
|
|
||||||
node.style.gridRow = String(Math.floor(index / columns) + 1);
|
|
||||||
node.style.gridColumn = String(index % columns + 1);
|
|
||||||
// 保持 DOM 顺序与屏幕顺序一致,方便键盘与读屏浏览。
|
|
||||||
let next = null;
|
|
||||||
for (const [otherIndex, other] of mounted) {
|
|
||||||
if (otherIndex > index && (!next || otherIndex < Number(next.dataset.cardIndex))) next = other;
|
|
||||||
}
|
|
||||||
grid.insertBefore(node, next); mounted.set(index, node);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
function schedule() {
|
function schedule() {
|
||||||
if (!frame && !disposed) frame = requestAnimationFrame(() => { frame = 0; draw(); });
|
if (!frame && !disposed) frame = requestAnimationFrame(() => { frame = 0; draw(); });
|
||||||
}
|
}
|
||||||
function layout(cardHeight = height) {
|
function rowTop(index) {
|
||||||
|
return padding + Math.floor(index / columns) * (height + gap);
|
||||||
|
}
|
||||||
|
function visiblePositions() {
|
||||||
|
const top = viewport.scrollTop, bottom = top + viewportHeight;
|
||||||
|
const firstRow = Math.max(0, Math.floor((top - padding) / (height + gap)));
|
||||||
|
const positions = [];
|
||||||
|
for (let index = firstRow * columns; index < records.length; index++) {
|
||||||
|
const position = rowTop(index);
|
||||||
|
if (position >= bottom) break;
|
||||||
|
if (position + height > top) positions.push({ index, offset: position - top });
|
||||||
|
}
|
||||||
|
return positions;
|
||||||
|
}
|
||||||
|
function layout(cardHeight = height, position = null) {
|
||||||
height = cardHeight;
|
height = cardHeight;
|
||||||
if (disposed || grid.hidden || !grid.clientWidth) return;
|
if (disposed || grid.hidden || !grid.clientWidth) return;
|
||||||
const style = getComputedStyle(grid);
|
const style = getComputedStyle(grid);
|
||||||
@@ -53,16 +69,21 @@ export function createVirtualCardGrid(viewport, grid, createCard) {
|
|||||||
node.style.gridRow = String(Math.floor(index / columns) + 1);
|
node.style.gridRow = String(Math.floor(index / columns) + 1);
|
||||||
node.style.gridColumn = String(index % columns + 1);
|
node.style.gridColumn = String(index % columns + 1);
|
||||||
}
|
}
|
||||||
|
if (position) viewport.scrollTop = position.index >= 0
|
||||||
|
? rowTop(position.index) - position.offset : position.scrollTop;
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
function focus(index) {
|
function focus(index, { scroll = true } = {}) {
|
||||||
if (!Number.isInteger(index) || index < 0 || index >= records.length || disposed) return;
|
if (!Number.isInteger(index) || index < 0 || index >= records.length || disposed) return;
|
||||||
const top = padding + Math.floor(index / columns) * (height + gap);
|
if (scroll) {
|
||||||
if (top < viewport.scrollTop) viewport.scrollTop = top;
|
const top = rowTop(index);
|
||||||
else if (top + height > viewport.scrollTop + viewportHeight) {
|
if (top < viewport.scrollTop) viewport.scrollTop = top;
|
||||||
viewport.scrollTop = top + height - viewportHeight;
|
else if (top + height > viewport.scrollTop + viewportHeight) {
|
||||||
|
viewport.scrollTop = top + height - viewportHeight;
|
||||||
|
}
|
||||||
|
draw();
|
||||||
}
|
}
|
||||||
draw(); mounted.get(index)?.focus({ preventScroll: true });
|
mount(index).focus({ preventScroll: true });
|
||||||
}
|
}
|
||||||
function keydown(event) {
|
function keydown(event) {
|
||||||
const card = event.target.closest("[data-card-index]");
|
const card = event.target.closest("[data-card-index]");
|
||||||
@@ -83,6 +104,7 @@ export function createVirtualCardGrid(viewport, grid, createCard) {
|
|||||||
records = value; mounted.clear(); cached.clear(); grid.replaceChildren();
|
records = value; mounted.clear(); cached.clear(); grid.replaceChildren();
|
||||||
},
|
},
|
||||||
layout,
|
layout,
|
||||||
|
visiblePositions,
|
||||||
focus,
|
focus,
|
||||||
resume() { draw(); },
|
resume() { draw(); },
|
||||||
dispose() {
|
dispose() {
|
||||||
|
|||||||
Reference in New Issue
Block a user