@craft_eco/craft-mcp 0.1.25 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -10
- package/bin/craft-mcp.mjs +10 -8
- package/dist-server/game-workflow/bundle-files.mjs +43 -0
- package/dist-server/game-workflow/engines.mjs +13 -6
- package/dist-server/game-workflow/project-bundles.mjs +90 -0
- package/dist-server/game-workflow/project-context.mjs +91 -0
- package/dist-server/game-workflow/projects.mjs +16 -4
- package/dist-server/game-workflow/publication-materials.mjs +18 -20
- package/dist-server/game-workflow/publications.mjs +15 -17
- package/dist-server/game-workflow/publish-capture.mjs +21 -57
- package/dist-server/integrations/config.mjs +71 -0
- package/dist-server/integrations/files.mjs +54 -0
- package/dist-server/integrations/hosts.mjs +30 -0
- package/dist-server/integrations/install.mjs +86 -0
- package/dist-server/integrations/runtime.mjs +71 -0
- package/dist-server/mcp/publication-page.mjs +18 -50
- package/dist-server/mcp/publish-panel.mjs +28 -35
- package/dist-server/mcp/server.mjs +17 -14
- package/dist-server/preview/preview-launcher.mjs +9 -2
- package/dist-server/preview/preview-start.mjs +2 -2
- package/dist-server/upstream/publication-transport.mjs +19 -19
- package/package.json +10 -2
- package/resources/craft-create/SKILL.md +14 -0
- package/resources/craft-game-maker/SKILL.md +77 -71
- package/resources/craft-game-maker/js.md +10 -10
- package/resources/craft-game-maker/js3d.md +13 -13
- package/resources/game_visual_qa.mjs +1149 -1149
- package/resources/js/bundle.json +93 -0
- package/resources/js/context/AGENTS.md +15 -102
- package/resources/js/context/knowledge/AigcWiring.md +5 -196
- package/resources/js/context/knowledge/AssetUrl.md +5 -20
- package/resources/js/context/knowledge/Layout.md +7 -0
- package/resources/js/context/knowledge/Lifecycle.md +6 -27
- package/resources/js/context/skills/aigc-generate/SKILL.md +6 -141
- package/resources/js/context/skills/asset-search/SKILL.md +5 -62
- package/resources/js/context/skills/asset-search/references/resource-config.md +9 -0
- package/resources/js/context/skills/export-config/SKILL.md +7 -19
- package/resources/js/context/skills/export-config/scripts/export-config.mjs +3 -45
- package/resources/js/context/skills/index.json +30 -0
- package/resources/js/context/skills/visual-qa/SKILL.md +6 -28
- package/resources/js/project/README.md +4 -96
- package/resources/js/project/package.json +1 -2
- package/resources/js/project/scripts/config-export/panel-resource-path.mjs +106 -0
- package/resources/js/{context/skills/export-config/scripts → project/scripts/config-export}/sync-asset-controls.mjs +1 -37
- package/resources/js/project/scripts/config-export.mjs +10 -34
- package/resources/js3d/bundle.json +104 -0
- package/resources/js3d/context/AGENTS.md +16 -85
- package/resources/js3d/context/knowledge/AigcWiring.md +9 -0
- package/resources/js3d/context/knowledge/AssetUrl.md +9 -0
- package/resources/js3d/context/knowledge/CodingGuide/Pitfalls.md +9 -67
- package/resources/js3d/context/knowledge/Layout.md +7 -0
- package/resources/js3d/context/knowledge/Runtime.md +5 -30
- package/resources/js3d/context/skills/aigc-integration/SKILL.md +6 -164
- package/resources/js3d/context/skills/asset-search/SKILL.md +5 -171
- package/resources/js3d/context/skills/asset-search/references/resource-config.md +6 -94
- package/resources/js3d/context/skills/asset-usage-audit/SKILL.md +6 -82
- package/resources/js3d/context/skills/export-config/SKILL.md +7 -11
- package/resources/js3d/context/skills/export-config/scripts/export-config.mjs +3 -55
- package/resources/js3d/context/skills/index.json +42 -0
- package/resources/js3d/context/skills/performance-audit/SKILL.md +8 -153
- package/resources/js3d/context/skills/visual-qa/SKILL.md +14 -0
- package/resources/js3d/project/README.md +4 -103
- package/resources/js3d/project/package.json +1 -2
- package/resources/js3d/project/scripts/config-export/panel-resource-path.mjs +106 -0
- package/resources/js3d/{context/skills/export-config/scripts → project/scripts/config-export}/sync-scene-assets.mjs +3 -28
- package/resources/js3d/project/scripts/config-export.mjs +12 -34
- package/vendor/agent-cli/dist/src/artifacts/build-failure.d.ts +8 -0
- package/vendor/agent-cli/dist/src/artifacts/build-failure.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/artifacts/build-failure.js +39 -0
- package/vendor/agent-cli/dist/src/artifacts/build-failure.js.map +1 -0
- package/vendor/agent-cli/dist/src/artifacts/dependency-toolchain.d.ts +5 -0
- package/vendor/agent-cli/dist/src/artifacts/dependency-toolchain.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/artifacts/dependency-toolchain.js +45 -0
- package/vendor/agent-cli/dist/src/artifacts/dependency-toolchain.js.map +1 -0
- package/vendor/agent-cli/dist/src/artifacts/preinstalled-dependencies.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/preinstalled-dependencies.js +2 -1
- package/vendor/agent-cli/dist/src/artifacts/preinstalled-dependencies.js.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/prepare.d.ts +2 -0
- package/vendor/agent-cli/dist/src/artifacts/prepare.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/prepare.js +7 -2
- package/vendor/agent-cli/dist/src/artifacts/prepare.js.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/process-artifacts.d.ts +2 -0
- package/vendor/agent-cli/dist/src/artifacts/process-artifacts.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/process-artifacts.js +27 -16
- package/vendor/agent-cli/dist/src/artifacts/process-artifacts.js.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-references.d.ts +14 -0
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-references.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-references.js +119 -0
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-references.js.map +1 -0
- package/vendor/agent-cli/dist/src/artifacts/static.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/static.js +20 -6
- package/vendor/agent-cli/dist/src/artifacts/static.js.map +1 -1
- package/vendor/agent-cli/dist/src/cli/process-protocol.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/cli/process-protocol.js +24 -2
- package/vendor/agent-cli/dist/src/cli/process-protocol.js.map +1 -1
- package/vendor/agent-cli/dist/src/cli/process-steering.d.ts +21 -0
- package/vendor/agent-cli/dist/src/cli/process-steering.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/cli/process-steering.js +66 -0
- package/vendor/agent-cli/dist/src/cli/process-steering.js.map +1 -0
- package/vendor/agent-cli/dist/src/context/user-skill-bundle.js +1 -1
- package/vendor/agent-cli/dist/src/context/user-skill-bundle.js.map +1 -1
- package/vendor/agent-cli/dist/src/index.d.ts +4 -1
- package/vendor/agent-cli/dist/src/index.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/index.js +3 -0
- package/vendor/agent-cli/dist/src/index.js.map +1 -1
- package/vendor/agent-cli/dist/src/protocol/messages/messages.gen.d.ts +29 -1
- package/vendor/agent-cli/dist/src/protocol/messages/messages.gen.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/protocol/messages/messages.gen.js +18 -1
- package/vendor/agent-cli/dist/src/protocol/messages/messages.gen.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/client.d.ts +10 -0
- package/vendor/agent-cli/dist/src/session/client.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/client.js +15 -5
- package/vendor/agent-cli/dist/src/session/client.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/link-session.d.ts +3 -0
- package/vendor/agent-cli/dist/src/session/link-session.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/link-session.js +14 -1
- package/vendor/agent-cli/dist/src/session/link-session.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/process-observability.d.ts +3 -0
- package/vendor/agent-cli/dist/src/session/process-observability.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/process-observability.js +11 -0
- package/vendor/agent-cli/dist/src/session/process-observability.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/process-request.d.ts +3 -2
- package/vendor/agent-cli/dist/src/session/process-request.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/process-request.js +27 -9
- package/vendor/agent-cli/dist/src/session/process-request.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/run-start-body.d.ts +1 -0
- package/vendor/agent-cli/dist/src/session/run-start-body.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/run-start-body.js +8 -3
- package/vendor/agent-cli/dist/src/session/run-start-body.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/run-steer.d.ts +42 -0
- package/vendor/agent-cli/dist/src/session/run-steer.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/session/run-steer.js +205 -0
- package/vendor/agent-cli/dist/src/session/run-steer.js.map +1 -0
- package/vendor/agent-cli/dist/src/shared/types.d.ts +6 -0
- package/vendor/agent-cli/dist/src/shared/types.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/tools/context-program-receipt.d.ts +21 -0
- package/vendor/agent-cli/dist/src/tools/context-program-receipt.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/tools/context-program-receipt.js +102 -0
- package/vendor/agent-cli/dist/src/tools/context-program-receipt.js.map +1 -0
- package/vendor/agent-cli/dist/src/tools/context-program.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/tools/context-program.js +3 -0
- package/vendor/agent-cli/dist/src/tools/context-program.js.map +1 -1
- package/resources/js/context/.role/AGENTS_DESIGN.md +0 -9
- package/resources/js/context/agents/aigc-asset.md +0 -168
- package/resources/js/context/knowledge/AigcEnabled.md +0 -49
- package/resources/js/context/knowledge/FrontendComponents.md +0 -17
- package/resources/js/context/knowledge/MobileAdaptation.md +0 -73
- package/resources/js/context/knowledge/MobileAdapted.md +0 -36
- package/resources/js/context/knowledge/Multiplayer/GameplaySystemKnowledge.md +0 -114
- package/resources/js/context/knowledge/Multiplayer/OverviewKnowledge.md +0 -115
- package/resources/js/context/knowledge/Multiplayer/StateSyncKnowledge.md +0 -392
- package/resources/js/context/knowledge/PlatformServices.md +0 -190
- package/resources/js/context/knowledge/ProjectDisplayConfig.md +0 -35
- package/resources/js/context/knowledge/Subsystems/Optional/MultiplayerManagerKnowledge.md +0 -242
- package/resources/js/context/knowledge/Ui.md +0 -11
- package/resources/js/context/knowledge/UiEditorCompat.md +0 -21
- package/resources/js/context/rules/MultiplayerCapability.md +0 -23
- package/resources/js/context/rules/MultiplayerRoomEntryUX.md +0 -63
- package/resources/js/context/rules/PlatformBoundaryModules.md +0 -44
- package/resources/js/context/rules/preview_ready.md +0 -8
- package/resources/js/context/skills/aigc-generate/knowledge/audio.md +0 -39
- package/resources/js/context/skills/aigc-generate/knowledge/batch-replace.md +0 -26
- package/resources/js/context/skills/aigc-generate/knowledge/character2d.md +0 -132
- package/resources/js/context/skills/aigc-generate/knowledge/non-stepwise-aigc.md +0 -53
- package/resources/js/context/skills/aigc-generate/knowledge/texture-prop.md +0 -52
- package/resources/js/context/skills/aigc-generate/knowledge/texture-scene.md +0 -191
- package/resources/js/context/skills/aigc-generate/knowledge/texture-ui.md +0 -55
- package/resources/js/context/skills/asset-search/scripts/asset_display.mjs +0 -62
- package/resources/js/context/skills/asset-search/scripts/config.json +0 -5
- package/resources/js/context/skills/asset-search/scripts/provided_assets.mjs +0 -125
- package/resources/js/context/skills/asset-search/scripts/search.mjs +0 -760
- package/resources/js/context/skills/asset-search/scripts/sprite_source_materializer.mjs +0 -657
- package/resources/js/context/skills/asset-search/strategies/anim2d.md +0 -42
- package/resources/js/context/skills/asset-search/strategies/audio.md +0 -34
- package/resources/js/context/skills/asset-search/strategies/effect2d.md +0 -31
- package/resources/js/context/skills/asset-search/strategies/texture-prop.md +0 -22
- package/resources/js/context/skills/asset-search/strategies/ui-common.md +0 -40
- package/resources/js/context/skills/asset-search/strategies/ui-style.md +0 -28
- package/resources/js/context/skills/export-config/scripts/translate-asset-titles.mjs +0 -161
- package/resources/js/context/skills/lightgame-runtime-adapt/SKILL.md +0 -93
- package/resources/js/context/skills/lightgame-runtime-adapt/project/game-runtime.json +0 -7
- package/resources/js/context/skills/lightgame-runtime-adapt/project/package.json +0 -22
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/identity/qq-ai-game-sdk.min.js +0 -5
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/identity/qq-session.mjs +0 -208
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/identity/shared.mjs +0 -37
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/platform-capture-video.mjs +0 -227
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/platform-service.d.mts +0 -31
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/platform-service.mjs +0 -272
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/platform.d.mts +0 -79
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/platform/platform.mjs +0 -29
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/release.json +0 -22
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tooling/cli.mjs +0 -16
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tooling/project.d.mts +0 -4
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tooling/project.mjs +0 -50
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tooling/vite.d.mts +0 -3
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tooling/vite.mjs +0 -72
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tools/assets.d.mts +0 -24
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tools/assets.mjs +0 -2
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tools/astc.d.mts +0 -10
- package/resources/js/context/skills/lightgame-runtime-adapt/project/runtime/lightgame/1.1.0/tools/astc.mjs +0 -1
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/config-export.mjs +0 -37
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/refresh-runtime.mjs +0 -50
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/cli.mjs +0 -20
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/config.d.mts +0 -19
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/config.mjs +0 -1
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/installed.json +0 -6
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/project.d.mts +0 -6
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/project.mjs +0 -77
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/vite.d.mts +0 -2
- package/resources/js/context/skills/lightgame-runtime-adapt/project/scripts/skill-modules/export-config/vite.mjs +0 -34
- package/resources/js/context/skills/lightgame-runtime-adapt/project/src/display/ui-stage.ts +0 -156
- package/resources/js/context/skills/lightgame-runtime-adapt/project/src/display/viewport.ts +0 -249
- package/resources/js/context/skills/lightgame-runtime-adapt/project/src/main.ts +0 -87
- package/resources/js/context/skills/lightgame-runtime-adapt/project/src/platform.ts +0 -2
- package/resources/js/context/skills/lightgame-runtime-adapt/project/src/screenUi.ts +0 -185
- package/resources/js/context/skills/lightgame-runtime-adapt/project/src/style.css +0 -294
- package/resources/js/context/skills/lightgame-runtime-adapt/project/tsconfig.json +0 -20
- package/resources/js/context/skills/lightgame-runtime-adapt/project/vite.config.ts +0 -5
- package/resources/js/context/skills/lightgame-runtime-adapt/scripts/install-template.mjs +0 -159
- package/resources/js/context/skills/mobile-adaptation/SKILL.md +0 -277
- package/resources/js/context/skills/mobile-adaptation/assets/example/src/input/input-config.json +0 -50
- package/resources/js/context/skills/mobile-adaptation/assets/example/src/input/input-layer.ts +0 -862
- package/resources/js/context/skills/mobile-adaptation/assets/example/src/input/input-platform.ts +0 -92
- package/resources/js/context/skills/mobile-adaptation/assets/example/src/input/input-primitives.ts +0 -254
- package/resources/js/context/skills/mobile-adaptation/assets/example/src/input/look-pad.ts +0 -245
- package/resources/js/context/skills/mobile-adaptation/assets/example/src/ui/touch-controls.css +0 -135
- package/resources/js/context/skills/mobile-adaptation/references/input-config.md +0 -342
- package/resources/js/context/skills/mobile-adaptation/references/verification.md +0 -140
- package/resources/js/context/skills/mobile-adaptation/references/web-audio.md +0 -11
- package/resources/js/context/skills/mobile-compat-qa/SKILL.md +0 -53
- package/resources/js/context/skills/mobile-compat-qa/references/startup-diagnosis.md +0 -23
- package/resources/js/context/skills/mobile-compat-qa/references/web-lifecycle.md +0 -20
- package/resources/js/context/skills/mobile-compat-qa/references/web-performance.md +0 -19
- package/resources/js/context/skills/optimization-suggestions/SKILL.md +0 -89
- package/resources/js/context/skills/platform-services/SKILL.md +0 -101
- package/resources/js/context/skills/platform-services/assets/modules/MultiplayerManager.ts +0 -465
- package/resources/js/context/skills/platform-services/assets/modules/eventBus.ts +0 -57
- package/resources/js/context/skills/platform-services/assets/modules/identity/qq-ai-game-sdk.min.js +0 -5
- package/resources/js/context/skills/platform-services/assets/modules/identity/qq-session.mjs +0 -208
- package/resources/js/context/skills/platform-services/assets/modules/identity/shared.mjs +0 -37
- package/resources/js/context/skills/platform-services/assets/modules/leaderboard.d.mts +0 -39
- package/resources/js/context/skills/platform-services/assets/modules/leaderboard.mjs +0 -1
- package/resources/js/context/skills/platform-services/assets/modules/log.ts +0 -35
- package/resources/js/context/skills/platform-services/assets/modules/multiplayer/clockSync.ts +0 -61
- package/resources/js/context/skills/platform-services/assets/modules/multiplayer/dsClient.ts +0 -52
- package/resources/js/context/skills/platform-services/assets/modules/multiplayer/payloadCodec.ts +0 -30
- package/resources/js/context/skills/platform-services/assets/modules/multiplayer/roomHttp.ts +0 -89
- package/resources/js/context/skills/platform-services/assets/modules/multiplayer/types.ts +0 -47
- package/resources/js/context/skills/platform-services/assets/modules/platform-service.d.mts +0 -31
- package/resources/js/context/skills/platform-services/assets/modules/platform-service.mjs +0 -272
- package/resources/js/context/skills/platform-services/assets/modules/save.d.mts +0 -49
- package/resources/js/context/skills/platform-services/assets/modules/save.mjs +0 -1
- package/resources/js/context/skills/platform-services/assets/scaffold/ds/main.mjs +0 -7
- package/resources/js/context/skills/platform-services/assets/scaffold/ds/rooms/SyncRoom.mjs +0 -264
- package/resources/js/context/skills/platform-services/assets/scaffold/ds/rooms/syncSchema.mjs +0 -39
- package/resources/js/context/skills/platform-services/references/SERVER_GUIDE.md +0 -139
- package/resources/js/context/skills/platform-services/references/api_reference.md +0 -18
- package/resources/js/context/skills/platform-services/references/leaderboard_playbook.md +0 -96
- package/resources/js/context/skills/platform-services/scripts/install.mjs +0 -148
- package/resources/js/context/skills/resolution-adaptation/SKILL.md +0 -47
- package/resources/js/context/skills/resolution-adaptation/assets/display/ui-stage.ts +0 -156
- package/resources/js/context/skills/resolution-adaptation/assets/display/viewport.ts +0 -249
- package/resources/js/context/skills/resolution-adaptation/assets/example/main.ts +0 -98
- package/resources/js/context/skills/resolution-adaptation/assets/example/ui-tokens.css +0 -200
- package/resources/js/context/skills/resolution-adaptation/references/audit.md +0 -31
- package/resources/js/context/skills/resolution-adaptation/references/device-safe-area.md +0 -40
- package/resources/js/context/skills/resolution-adaptation/references/game-ui-occlusion.md +0 -18
- package/resources/js/context/skills/resolution-adaptation/references/layout-rules.md +0 -15
- package/resources/js/context/skills/resolution-adaptation/references/troubleshooting.md +0 -34
- package/resources/js/context/skills/resolution-adaptation/references/viewport-api.md +0 -38
- package/resources/js/context/skills/resolution-adaptation/references/world-resize.md +0 -55
- package/resources/js/context/skills/resolution-adaptation/scripts/aspect_audit.mjs +0 -448
- package/resources/js/context/skills/scene-editor-compat/SKILL.md +0 -94
- package/resources/js/context/skills/scene-editor-compat/assets/example/localcraft.assets.json +0 -13
- package/resources/js/context/skills/scene-editor-compat/assets/example/localcraft.scene-editor.json +0 -6
- package/resources/js/context/skills/scene-editor-compat/assets/example/src/game/sceneAdapter.ts +0 -25
- package/resources/js/context/skills/scene-editor-compat/assets/example/src/scenes/main.scene.json +0 -18
- package/resources/js/context/skills/scene-editor-compat/assets/runtime/release.json +0 -7
- package/resources/js/context/skills/scene-editor-compat/assets/runtime/scene.d.mts +0 -42
- package/resources/js/context/skills/scene-editor-compat/assets/runtime/scene.mjs +0 -144
- package/resources/js/context/skills/scene-editor-compat/docs/contract.md +0 -330
- package/resources/js/context/skills/scene-editor-compat/docs/resource-sync.md +0 -64
- package/resources/js/context/skills/scene-editor-compat/docs/runtime-state.md +0 -28
- package/resources/js/context/skills/scene-editor-compat/docs/terrain-contract.md +0 -47
- package/resources/js/context/skills/scene-editor-compat/docs/visual-contract.md +0 -64
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/localcraft.assets.json +0 -38
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/localcraft.scene-editor.json +0 -9
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/src/game/sceneAdapter.ts +0 -59
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/src/game/sceneBlockers.ts +0 -30
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/src/game/sceneFileAssets.ts +0 -66
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/src/scenes/Main.Scene.ts +0 -20
- package/resources/js/context/skills/scene-editor-compat/examples/platformer-ts/src/scenes/SceneTypes.ts +0 -26
- package/resources/js/context/skills/scene-editor-compat/references/contract.md +0 -73
- package/resources/js/context/skills/scene-editor-compat/scripts/apply_scene_marker.py +0 -162
- package/resources/js/context/skills/scene-editor-compat/scripts/check_scene_contract.py +0 -853
- package/resources/js/context/skills/scene-editor-compat/scripts/check_scene_resource_urls.py +0 -173
- package/resources/js/context/skills/scene-editor-compat/scripts/scene-editor.mjs +0 -427
- package/resources/js/context/skills/scene-editor-compat/version.json +0 -1
- package/resources/js/context/skills/ui-editor-compat/SKILL.md +0 -48
- package/resources/js/context/skills/ui-editor-compat/assets/example/hud/WidgetLayout_Hud.ts +0 -35
- package/resources/js/context/skills/ui-editor-compat/assets/example/hud/WidgetLogic_Hud.ts +0 -74
- package/resources/js/context/skills/ui-editor-compat/assets/example/hud/hud.css +0 -60
- package/resources/js/context/skills/ui-editor-compat/assets/runtime/dom-ui.d.mts +0 -45
- package/resources/js/context/skills/ui-editor-compat/assets/runtime/dom-ui.mjs +0 -265
- package/resources/js/context/skills/ui-editor-compat/assets/runtime/release.json +0 -7
- package/resources/js/context/skills/ui-editor-compat/references/contract.md +0 -132
- package/resources/js/context/skills/ui-editor-compat/scripts/editor-contract.mjs +0 -327
- package/resources/js/context/skills/ui-editor-compat/scripts/project-files.mjs +0 -80
- package/resources/js/context/skills/ui-editor-compat/scripts/ui-editor.mjs +0 -84
- package/resources/js/context/skills/version-update/SKILL.md +0 -192
- package/resources/js/context/skills/version-update/scripts/check_runtime_refs.mjs +0 -129
- package/resources/js/context/skills/version-update/scripts/feature_snapshot.mjs +0 -159
- package/resources/js/context/skills/version-update/scripts/update_feature_version.mjs +0 -157
- package/resources/js/context/skills/version-update/upgrade_diffs/.gitkeep +0 -0
- package/resources/js/context/version/version.json +0 -1
- package/resources/js/project/SPEC/assist/.gitkeep +0 -0
- package/resources/js/project/SPEC/guide/.gitkeep +0 -0
- package/resources/js/project/SPEC/plan/.gitkeep +0 -0
- package/resources/js/project/SPEC/readme.md +0 -6
- package/resources/js/project/SPEC/res/.gitkeep +0 -0
- package/resources/js/project/SPEC/task-item/.gitkeep +0 -0
- package/resources/js/project/runtime/lightgame/1.0.0/platform/config.d.mts +0 -19
- package/resources/js/project/runtime/lightgame/1.0.0/platform/config.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/platform/leaderboard.d.mts +0 -39
- package/resources/js/project/runtime/lightgame/1.0.0/platform/leaderboard.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/platform/platform-capture-video.mjs +0 -227
- package/resources/js/project/runtime/lightgame/1.0.0/platform/platform-service.d.mts +0 -25
- package/resources/js/project/runtime/lightgame/1.0.0/platform/platform-service.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/platform/platform.d.mts +0 -79
- package/resources/js/project/runtime/lightgame/1.0.0/platform/platform.mjs +0 -29
- package/resources/js/project/runtime/lightgame/1.0.0/platform/save.d.mts +0 -49
- package/resources/js/project/runtime/lightgame/1.0.0/platform/save.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/release.json +0 -37
- package/resources/js/project/runtime/lightgame/1.0.0/tooling/cli.mjs +0 -2
- package/resources/js/project/runtime/lightgame/1.0.0/tooling/project.d.mts +0 -8
- package/resources/js/project/runtime/lightgame/1.0.0/tooling/project.mjs +0 -2
- package/resources/js/project/runtime/lightgame/1.0.0/tooling/vite.d.mts +0 -3
- package/resources/js/project/runtime/lightgame/1.0.0/tooling/vite.mjs +0 -8
- package/resources/js/project/runtime/lightgame/1.0.0/tools/assets.d.mts +0 -24
- package/resources/js/project/runtime/lightgame/1.0.0/tools/assets.mjs +0 -2
- package/resources/js/project/runtime/lightgame/1.0.0/tools/astc.d.mts +0 -10
- package/resources/js/project/runtime/lightgame/1.0.0/tools/astc.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/tools/audio.d.mts +0 -20
- package/resources/js/project/runtime/lightgame/1.0.0/tools/audio.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/tools/canvas.d.mts +0 -21
- package/resources/js/project/runtime/lightgame/1.0.0/tools/canvas.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/tools/input.d.mts +0 -17
- package/resources/js/project/runtime/lightgame/1.0.0/tools/input.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/tools/three.d.mts +0 -40
- package/resources/js/project/runtime/lightgame/1.0.0/tools/three.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/tools/ui.d.mts +0 -10
- package/resources/js/project/runtime/lightgame/1.0.0/tools/ui.mjs +0 -1
- package/resources/js/project/runtime/lightgame/1.0.0/tools/video.d.mts +0 -8
- package/resources/js/project/runtime/lightgame/1.0.0/tools/video.mjs +0 -1
- package/resources/js/project/scripts/refresh-runtime.mjs +0 -50
- package/resources/js/project/vendor/core-manager-js/package.json +0 -33
- package/resources/js/project/vendor/core-manager-js/src/.versions.json +0 -42
- package/resources/js/project/vendor/core-manager-js/src/CoreManagerPlugin.ts +0 -41
- package/resources/js/project/vendor/core-manager-js/src/assetManager/AssetRef.ts +0 -93
- package/resources/js/project/vendor/core-manager-js/src/assetManager/AstcFirstImageFile.ts +0 -203
- package/resources/js/project/vendor/core-manager-js/src/assetManager/AstcTextureLoader.ts +0 -106
- package/resources/js/project/vendor/core-manager-js/src/assetManager/resolveAssetUrl.test.ts +0 -25
- package/resources/js/project/vendor/core-manager-js/src/assetManager/resolveAssetUrl.ts +0 -21
- package/resources/js/project/vendor/core-manager-js/src/audioManager/AudioManager.test.ts +0 -65
- package/resources/js/project/vendor/core-manager-js/src/audioManager/AudioManager.ts +0 -340
- package/resources/js/project/vendor/core-manager-js/src/configManager/FeatureConfig.ts +0 -87
- package/resources/js/project/vendor/core-manager-js/src/configManager/tuneRuntime.d.mts +0 -92
- package/resources/js/project/vendor/core-manager-js/src/configManager/tuneRuntime.mjs +0 -271
- package/resources/js/project/vendor/core-manager-js/src/index.ts +0 -31
- package/resources/js/project/vendor/core-manager-js/src/inputManager/InputConfig.ts +0 -81
- package/resources/js/project/vendor/core-manager-js/src/inputManager/InputManager.test.ts +0 -43
- package/resources/js/project/vendor/core-manager-js/src/inputManager/InputManager.ts +0 -32
- package/resources/js/project/vendor/core-manager-js/src/inputManager/InputRuntime.test.ts +0 -141
- package/resources/js/project/vendor/core-manager-js/src/inputManager/InputRuntime.ts +0 -20
- package/resources/js/project/vendor/core-manager-js/src/inputManager/KeyboardProvider.ts +0 -183
- package/resources/js/project/vendor/core-manager-js/src/inputManager/TouchProvider.ts +0 -304
- package/resources/js/project/vendor/core-manager-js/src/inputManager/VirtualJoystick.ts +0 -351
- package/resources/js/project/vendor/core-manager-js/src/inputManager/_internal/InputManagerImpl.ts +0 -180
- package/resources/js/project/vendor/core-manager-js/src/inputManager/icons.b64 +0 -13
- package/resources/js/project/vendor/core-manager-js/src/inputManager/icons.b64.d.ts +0 -14
- package/resources/js/project/vendor/core-manager-js/src/inputManager/input_config.example.json +0 -68
- package/resources/js/project/vendor/core-manager-js/src/logManager/DebugConsole.ts +0 -433
- package/resources/js/project/vendor/core-manager-js/src/logManager/LogCapture.ts +0 -118
- package/resources/js/project/vendor/core-manager-js/src/logManager/LogManager.ts +0 -444
- package/resources/js/project/vendor/core-manager-js/src/logManager/ScreenCapture.ts +0 -485
- package/resources/js/project/vendor/core-manager-js/src/logManager/ScreenCaptureVideo.test.ts +0 -66
- package/resources/js/project/vendor/core-manager-js/src/logManager/ScreenCaptureVideo.ts +0 -149
- package/resources/js/project/vendor/core-manager-js/src/logManager/icons.b64 +0 -9
- package/resources/js/project/vendor/core-manager-js/src/resourceManager/AssetUrlResolver.ts +0 -29
- package/resources/js/project/vendor/core-manager-js/src/resourceManager/ResourceManager.test.ts +0 -88
- package/resources/js/project/vendor/core-manager-js/src/resourceManager/ResourceManager.ts +0 -122
- package/resources/js/project/vendor/core-manager-js/src/runtime.ts +0 -24
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/CharacterEntity.ts +0 -318
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/CharacterPhysicsBinding.test.ts +0 -151
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/CharacterPhysicsBinding.ts +0 -235
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/EffectComposite.test.ts +0 -98
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/EffectComposite.ts +0 -94
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/EffectEntity.ts +0 -209
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/FxManager.test.ts +0 -106
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/FxManager.ts +0 -341
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/FxRecipe.test.ts +0 -68
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/FxRecipe.ts +0 -236
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/SpriteAnimManager.test.ts +0 -22
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/SpriteAnimManager.ts +0 -29
- package/resources/js/project/vendor/core-manager-js/src/spriteAnimManager/SpriteEntity.test.ts +0 -197
- package/resources/js/project/vendor/core-manager-js/src/uiManager/DomUiContracts.ts +0 -9
- package/resources/js/project/vendor/core-manager-js/src/uiManager/DomUiKit.ts +0 -555
- package/resources/js/project/vendor/core-manager-js/src/uiManager/UIFacadePlugin.test.ts +0 -112
- package/resources/js/project/vendor/core-manager-js/src/uiManager/UIFacadePlugin.ts +0 -178
- package/resources/js/project/vendor/core-manager-js/src/uiManager/ui-base.css +0 -246
- package/resources/js/project/vendor/core-manager-js/src/videoManager/VideoManager.ts +0 -139
- package/resources/js/project/vendor/core-manager-js/tsconfig.json +0 -15
- package/resources/js/project/vendor/run.sh +0 -4
- package/resources/js/project/version/craft_feature_version.json +0 -42
- package/resources/js/project/version/project_feature_version.json +0 -11
- package/resources/js3d/context/.role/AGENTS_DESIGN.md +0 -9
- package/resources/js3d/context/knowledge/3D/PoseInterpolationKnowledge.md +0 -75
- package/resources/js3d/context/knowledge/CodingGuide/SceneEditableGuide.md +0 -42
- package/resources/js3d/context/knowledge/FrontendComponents.md +0 -19
- package/resources/js3d/context/knowledge/MobileAdaptation.md +0 -73
- package/resources/js3d/context/knowledge/MobileAdapted.md +0 -36
- package/resources/js3d/context/knowledge/Multiplayer/GameplaySystemKnowledge.md +0 -114
- package/resources/js3d/context/knowledge/Multiplayer/OverviewKnowledge.md +0 -117
- package/resources/js3d/context/knowledge/Multiplayer/StateSyncKnowledge.md +0 -430
- package/resources/js3d/context/knowledge/PlatformServices.md +0 -190
- package/resources/js3d/context/knowledge/ProjectDisplayConfig.md +0 -35
- package/resources/js3d/context/knowledge/SceneEditorCompat.md +0 -35
- package/resources/js3d/context/knowledge/StepByStep.md +0 -21
- package/resources/js3d/context/knowledge/Subsystems/Optional/MultiplayerManagerKnowledge.md +0 -242
- package/resources/js3d/context/knowledge/UiEditorCompat.md +0 -21
- package/resources/js3d/context/rules/MultiplayerCapability.md +0 -27
- package/resources/js3d/context/rules/MultiplayerRoomEntryUX.md +0 -63
- package/resources/js3d/context/rules/PlatformBoundaryModules.md +0 -44
- package/resources/js3d/context/rules/preview_ready.md +0 -8
- package/resources/js3d/context/skills/aigc-integration/assets/sprite-sheet-player.mjs +0 -70
- package/resources/js3d/context/skills/aigc-integration/callback.md +0 -77
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/README.md +0 -23
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/audio-aigc-knowledge.md +0 -38
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/character2d-aigc-knowledge.md +0 -72
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/staticmesh-aigc-knowledge.md +0 -33
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/texture-prop-aigc-knowledge.md +0 -36
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/texture-scene-aigc-knowledge.md +0 -37
- package/resources/js3d/context/skills/aigc-integration/knowledge/aigc/texture-ui-aigc-knowledge.md +0 -35
- package/resources/js3d/context/skills/asset-search/references/sprite-sheets.md +0 -58
- package/resources/js3d/context/skills/asset-search/scripts/asset_display.mjs +0 -62
- package/resources/js3d/context/skills/asset-search/scripts/config.json +0 -235
- package/resources/js3d/context/skills/asset-search/scripts/manifest_pipeline.mjs +0 -905
- package/resources/js3d/context/skills/asset-search/scripts/preflight.mjs +0 -79
- package/resources/js3d/context/skills/asset-search/scripts/provided_assets.mjs +0 -74
- package/resources/js3d/context/skills/asset-search/scripts/search.mjs +0 -637
- package/resources/js3d/context/skills/asset-search/scripts/sprite_source_materializer.mjs +0 -667
- package/resources/js3d/context/skills/asset-search/strategies/anim2d.md +0 -42
- package/resources/js3d/context/skills/asset-search/strategies/effect2d.md +0 -31
- package/resources/js3d/context/skills/asset-usage-audit/references/case-tidewater-zoo.md +0 -89
- package/resources/js3d/context/skills/asset-usage-audit/references/optimization-playbook.md +0 -143
- package/resources/js3d/context/skills/asset-usage-audit/references/usage-model.md +0 -90
- package/resources/js3d/context/skills/export-config/scripts/translate-asset-titles.mjs +0 -161
- package/resources/js3d/context/skills/game-art-style/SKILL.md +0 -60
- package/resources/js3d/context/skills/game-art-style/assets/previews/cartoon.png +0 -0
- package/resources/js3d/context/skills/game-art-style/assets/previews/comic.png +0 -0
- package/resources/js3d/context/skills/game-art-style/assets/previews/cozy.png +0 -0
- package/resources/js3d/context/skills/game-art-style/assets/previews/cyber.png +0 -0
- package/resources/js3d/context/skills/game-art-style/assets/previews/horror.png +0 -0
- package/resources/js3d/context/skills/game-art-style/assets/previews/lowpoly.png +0 -0
- package/resources/js3d/context/skills/game-art-style/assets/previews/paper.png +0 -0
- package/resources/js3d/context/skills/game-art-style/assets/previews/voxel.png +0 -0
- package/resources/js3d/context/skills/game-art-style/references/art-parameters-lite.md +0 -38
- package/resources/js3d/context/skills/game-art-style/references/construction.md +0 -111
- package/resources/js3d/context/skills/game-art-style/references/materials-textures.md +0 -105
- package/resources/js3d/context/skills/game-art-style/references/sources.md +0 -25
- package/resources/js3d/context/skills/game-art-style/references/styles/cartoon.md +0 -175
- package/resources/js3d/context/skills/game-art-style/references/styles/comic.md +0 -168
- package/resources/js3d/context/skills/game-art-style/references/styles/cozy.md +0 -191
- package/resources/js3d/context/skills/game-art-style/references/styles/cyber.md +0 -165
- package/resources/js3d/context/skills/game-art-style/references/styles/horror.md +0 -173
- package/resources/js3d/context/skills/game-art-style/references/styles/lowpoly.md +0 -185
- package/resources/js3d/context/skills/game-art-style/references/styles/paper.md +0 -181
- package/resources/js3d/context/skills/game-art-style/references/styles/voxel.md +0 -189
- package/resources/js3d/context/skills/game-art-style/references/user-style-document.md +0 -88
- package/resources/js3d/context/skills/mobile-adaptation/SKILL.md +0 -301
- package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/input/input-config.json +0 -104
- package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/input/input-layer.ts +0 -933
- package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/input/input-platform.ts +0 -92
- package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/input/input-primitives.ts +0 -254
- package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/input/look-pad.ts +0 -245
- package/resources/js3d/context/skills/mobile-adaptation/assets/example/src/ui/touch-controls.css +0 -257
- package/resources/js3d/context/skills/mobile-adaptation/references/input-config.md +0 -342
- package/resources/js3d/context/skills/mobile-adaptation/references/verification.md +0 -140
- package/resources/js3d/context/skills/mobile-adaptation/references/web-audio.md +0 -11
- package/resources/js3d/context/skills/mobile-compat-qa/SKILL.md +0 -53
- package/resources/js3d/context/skills/mobile-compat-qa/references/startup-diagnosis.md +0 -23
- package/resources/js3d/context/skills/mobile-compat-qa/references/web-form-input.md +0 -10
- package/resources/js3d/context/skills/mobile-compat-qa/references/web-lifecycle.md +0 -20
- package/resources/js3d/context/skills/mobile-compat-qa/references/web-performance.md +0 -19
- package/resources/js3d/context/skills/optimization-suggestions/SKILL.md +0 -74
- package/resources/js3d/context/skills/performance-audit/references/case-notes.md +0 -93
- package/resources/js3d/context/skills/performance-audit/references/rules.md +0 -183
- package/resources/js3d/context/skills/platform-services/SKILL.md +0 -101
- package/resources/js3d/context/skills/platform-services/assets/modules/MultiplayerManager.ts +0 -465
- package/resources/js3d/context/skills/platform-services/assets/modules/eventBus.ts +0 -57
- package/resources/js3d/context/skills/platform-services/assets/modules/identity/qq-ai-game-sdk.min.js +0 -5
- package/resources/js3d/context/skills/platform-services/assets/modules/identity/qq-session.mjs +0 -208
- package/resources/js3d/context/skills/platform-services/assets/modules/identity/shared.mjs +0 -37
- package/resources/js3d/context/skills/platform-services/assets/modules/leaderboard.d.mts +0 -39
- package/resources/js3d/context/skills/platform-services/assets/modules/leaderboard.mjs +0 -1
- package/resources/js3d/context/skills/platform-services/assets/modules/log.ts +0 -35
- package/resources/js3d/context/skills/platform-services/assets/modules/multiplayer/clockSync.ts +0 -61
- package/resources/js3d/context/skills/platform-services/assets/modules/multiplayer/dsClient.ts +0 -52
- package/resources/js3d/context/skills/platform-services/assets/modules/multiplayer/payloadCodec.ts +0 -30
- package/resources/js3d/context/skills/platform-services/assets/modules/multiplayer/roomHttp.ts +0 -89
- package/resources/js3d/context/skills/platform-services/assets/modules/multiplayer/types.ts +0 -47
- package/resources/js3d/context/skills/platform-services/assets/modules/platform-service.d.mts +0 -31
- package/resources/js3d/context/skills/platform-services/assets/modules/platform-service.mjs +0 -272
- package/resources/js3d/context/skills/platform-services/assets/modules/save.d.mts +0 -49
- package/resources/js3d/context/skills/platform-services/assets/modules/save.mjs +0 -1
- package/resources/js3d/context/skills/platform-services/assets/scaffold/ds/main.mjs +0 -7
- package/resources/js3d/context/skills/platform-services/assets/scaffold/ds/rooms/SyncRoom.mjs +0 -264
- package/resources/js3d/context/skills/platform-services/assets/scaffold/ds/rooms/syncSchema.mjs +0 -39
- package/resources/js3d/context/skills/platform-services/references/SERVER_GUIDE.md +0 -139
- package/resources/js3d/context/skills/platform-services/references/api_reference.md +0 -18
- package/resources/js3d/context/skills/platform-services/references/leaderboard_playbook.md +0 -96
- package/resources/js3d/context/skills/platform-services/scripts/install.mjs +0 -148
- package/resources/js3d/context/skills/resolution-adaptation/SKILL.md +0 -46
- package/resources/js3d/context/skills/resolution-adaptation/assets/display/ui-stage.ts +0 -156
- package/resources/js3d/context/skills/resolution-adaptation/assets/display/viewport.ts +0 -239
- package/resources/js3d/context/skills/resolution-adaptation/assets/example/main.ts +0 -129
- package/resources/js3d/context/skills/resolution-adaptation/assets/example/ui-tokens.css +0 -188
- package/resources/js3d/context/skills/resolution-adaptation/references/audit.md +0 -31
- package/resources/js3d/context/skills/resolution-adaptation/references/device-safe-area.md +0 -40
- package/resources/js3d/context/skills/resolution-adaptation/references/game-ui-occlusion.md +0 -18
- package/resources/js3d/context/skills/resolution-adaptation/references/layout-rules.md +0 -15
- package/resources/js3d/context/skills/resolution-adaptation/references/troubleshooting.md +0 -34
- package/resources/js3d/context/skills/resolution-adaptation/references/viewport-api.md +0 -38
- package/resources/js3d/context/skills/resolution-adaptation/scripts/aspect_audit.mjs +0 -448
- package/resources/js3d/context/skills/scene-editor-compat/SKILL.md +0 -599
- package/resources/js3d/context/skills/scene-editor-compat/references/bundle-contract.md +0 -141
- package/resources/js3d/context/skills/scene-editor-compat/references/editor-integration.md +0 -92
- package/resources/js3d/context/skills/scene-editor-compat/references/scene-data-format.md +0 -125
- package/resources/js3d/context/skills/scene-editor-compat/references/slots-rules.md +0 -113
- package/resources/js3d/context/skills/scene-editor-compat/scripts/scene-editor.mjs +0 -1187
- package/resources/js3d/context/skills/threejs-game-quality/SKILL.md +0 -53
- package/resources/js3d/context/skills/threejs-game-quality/agents/openai.yaml +0 -4
- package/resources/js3d/context/skills/threejs-game-quality/references/01-build.md +0 -94
- package/resources/js3d/context/skills/threejs-game-quality/references/02-avoid.md +0 -50
- package/resources/js3d/context/skills/threejs-game-quality/references/03-detect.md +0 -105
- package/resources/js3d/context/skills/threejs-game-quality/references/camera-by-genre.md +0 -147
- package/resources/js3d/context/skills/threejs-game-quality/references/camera-distance.md +0 -79
- package/resources/js3d/context/skills/threejs-game-quality/references/camera-sources.md +0 -56
- package/resources/js3d/context/skills/threejs-game-quality/references/character-motion-face.md +0 -51
- package/resources/js3d/context/skills/threejs-game-quality/references/parameter-contract.md +0 -55
- package/resources/js3d/context/skills/threejs-game-quality/references/refine-existing.md +0 -78
- package/resources/js3d/context/skills/threejs-game-quality/references/rendering-stability.md +0 -84
- package/resources/js3d/context/skills/threejs-game-quality/references/runtime-tools.md +0 -120
- package/resources/js3d/context/skills/threejs-game-quality/scripts/package.json +0 -4
- package/resources/js3d/context/skills/threejs-game-quality/scripts/runtime-audit.js +0 -238
- package/resources/js3d/context/skills/ui-editor-compat/SKILL.md +0 -59
- package/resources/js3d/context/skills/ui-editor-compat/assets/example/hud/WidgetLayout_Hud.ts +0 -35
- package/resources/js3d/context/skills/ui-editor-compat/assets/example/hud/WidgetLogic_Hud.ts +0 -61
- package/resources/js3d/context/skills/ui-editor-compat/assets/example/hud/hud.css +0 -60
- package/resources/js3d/context/skills/ui-editor-compat/assets/runtime/dom-ui.d.mts +0 -45
- package/resources/js3d/context/skills/ui-editor-compat/assets/runtime/dom-ui.mjs +0 -265
- package/resources/js3d/context/skills/ui-editor-compat/assets/runtime/release.json +0 -7
- package/resources/js3d/context/skills/ui-editor-compat/references/contract.md +0 -110
- package/resources/js3d/context/skills/ui-editor-compat/scripts/editor-contract.mjs +0 -327
- package/resources/js3d/context/skills/ui-editor-compat/scripts/project-files.mjs +0 -80
- package/resources/js3d/context/skills/ui-editor-compat/scripts/ui-editor.mjs +0 -84
- package/resources/js3d/context/skills/version-update/SKILL.md +0 -191
- package/resources/js3d/context/skills/version-update/scripts/check_runtime_refs.mjs +0 -129
- package/resources/js3d/context/skills/version-update/scripts/feature_snapshot.mjs +0 -159
- package/resources/js3d/context/skills/version-update/scripts/update_feature_version.mjs +0 -157
- package/resources/js3d/context/skills/version-update/upgrade_diffs/.gitkeep +0 -0
- package/resources/js3d/context/version/version.json +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/config.d.mts +0 -19
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/config.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/leaderboard.d.mts +0 -39
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/leaderboard.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/platform-capture-video.mjs +0 -227
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/platform-service.d.mts +0 -25
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/platform-service.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/platform.d.mts +0 -79
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/platform.mjs +0 -30
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/save.d.mts +0 -49
- package/resources/js3d/project/runtime/lightgame/1.0.0/platform/save.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/release.json +0 -39
- package/resources/js3d/project/runtime/lightgame/1.0.0/tooling/cli.mjs +0 -2
- package/resources/js3d/project/runtime/lightgame/1.0.0/tooling/project.d.mts +0 -8
- package/resources/js3d/project/runtime/lightgame/1.0.0/tooling/project.mjs +0 -2
- package/resources/js3d/project/runtime/lightgame/1.0.0/tooling/vite.d.mts +0 -3
- package/resources/js3d/project/runtime/lightgame/1.0.0/tooling/vite.mjs +0 -7
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/assets.d.mts +0 -24
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/assets.mjs +0 -2
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/astc.d.mts +0 -10
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/astc.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/audio.d.mts +0 -20
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/audio.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/canvas.d.mts +0 -21
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/canvas.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/glb.d.mts +0 -26
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/glb.mjs +0 -351
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/input.d.mts +0 -17
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/input.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/three.d.mts +0 -40
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/three.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/ui.d.mts +0 -10
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/ui.mjs +0 -1
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/video.d.mts +0 -8
- package/resources/js3d/project/runtime/lightgame/1.0.0/tools/video.mjs +0 -1
- package/resources/js3d/project/scripts/refresh-runtime.mjs +0 -50
- package/resources/js3d/project/vendor/core-manager-three/package.json +0 -12
- package/resources/js3d/project/vendor/core-manager-three/src/index.ts +0 -2
- package/resources/js3d/project/vendor/run.sh +0 -4
- package/resources/js3d/project/version/craft_feature_version.json +0 -42
- package/resources/js3d/project/version/project_feature_version.json +0 -11
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-delivery.d.ts +0 -7
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-delivery.d.ts.map +0 -1
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-delivery.js +0 -145
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-delivery.js.map +0 -1
- /package/resources/js/{context/skills/export-config/scripts → project/scripts/config-export}/assert-asset-wiring.mjs +0 -0
- /package/resources/js3d/{context/skills/export-config/scripts → project/scripts/config-export}/assert-asset-wiring.mjs +0 -0
- /package/resources/js3d/{context/skills/export-config/scripts → project/scripts/config-export}/sync-asset-controls.mjs +0 -0
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { readFile, lstat, mkdir, writeFile } from 'node:fs/promises';
|
|
2
|
-
import { resolve, join, relative, isAbsolute, dirname } from 'node:path';
|
|
3
|
-
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
4
|
-
|
|
5
|
-
const pair = name => [`${name}.mjs`, `${name}.d.mts`];
|
|
6
|
-
const within = (dir, names) => names.map(name => `${dir}/${name}`);
|
|
7
|
-
const identity = [...pair('platform-service'), ...within('identity', ['shared.mjs', 'qq-session.mjs', 'qq-ai-game-sdk.min.js'])];
|
|
8
|
-
const multiplayer = [
|
|
9
|
-
'MultiplayerManager.ts', 'log.ts', 'eventBus.ts',
|
|
10
|
-
...within('multiplayer', ['types.ts', 'roomHttp.ts', 'dsClient.ts', 'clockSync.ts', 'payloadCodec.ts']),
|
|
11
|
-
];
|
|
12
|
-
const release = {
|
|
13
|
-
version: '1.3.0',
|
|
14
|
-
target: 'src/skill-modules/platform-services',
|
|
15
|
-
defaults: ['identity'],
|
|
16
|
-
groups: {
|
|
17
|
-
identity,
|
|
18
|
-
leaderboard: [...identity, ...pair('leaderboard')],
|
|
19
|
-
save: [...identity, ...pair('save')],
|
|
20
|
-
multiplayer: [...identity, ...multiplayer],
|
|
21
|
-
},
|
|
22
|
-
scaffolds: {
|
|
23
|
-
multiplayer: { target: 'ds', files: ['main.mjs', 'rooms/SyncRoom.mjs', 'rooms/syncSchema.mjs'] },
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
const skillAssets = resolve(dirname(fileURLToPath(import.meta.url)), '../assets');
|
|
27
|
-
const assets = join(skillAssets, 'modules');
|
|
28
|
-
const BACKUP_SUFFIX = '.previous';
|
|
29
|
-
const safeParts = value => typeof value === 'string' && value.split('/').every(part => /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(part));
|
|
30
|
-
|
|
31
|
-
async function checkedPath(root, name) {
|
|
32
|
-
if (!safeParts(name)) throw new Error(`Invalid package path: ${name}`);
|
|
33
|
-
const target = resolve(root, name);
|
|
34
|
-
const rel = relative(root, target);
|
|
35
|
-
if (isAbsolute(rel) || rel === '..' || rel.startsWith('../')) throw new Error(`Path escapes project: ${name}`);
|
|
36
|
-
let current = root;
|
|
37
|
-
for (const part of name.split('/')) {
|
|
38
|
-
current = join(current, part);
|
|
39
|
-
try {
|
|
40
|
-
const info = await lstat(current);
|
|
41
|
-
if (info.isSymbolicLink()) throw new Error(`Symbolic links are not allowed: ${current}`);
|
|
42
|
-
} catch (error) { if (error.code !== 'ENOENT') throw error; }
|
|
43
|
-
}
|
|
44
|
-
return target;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
async function readOptional(path) {
|
|
48
|
-
try {
|
|
49
|
-
return await readFile(path);
|
|
50
|
-
} catch (error) {
|
|
51
|
-
if (error.code === 'ENOENT') return null;
|
|
52
|
-
throw error;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
async function readRecord(path) {
|
|
57
|
-
try {
|
|
58
|
-
const record = JSON.parse(await readFile(path, 'utf8'));
|
|
59
|
-
return record && typeof record === 'object' ? record : {};
|
|
60
|
-
} catch (error) {
|
|
61
|
-
if (error.code === 'ENOENT') return {};
|
|
62
|
-
throw error;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// 骨架只在目标目录不存在时整份写入;写入后归工程所有,重装不覆盖。
|
|
67
|
-
async function installScaffold(root, { target, files }) {
|
|
68
|
-
const dir = await checkedPath(root, target);
|
|
69
|
-
try {
|
|
70
|
-
await lstat(dir);
|
|
71
|
-
return { target, status: 'kept' };
|
|
72
|
-
} catch (error) { if (error.code !== 'ENOENT') throw error; }
|
|
73
|
-
const entries = [];
|
|
74
|
-
for (const name of files) {
|
|
75
|
-
const bytes = await readFile(await checkedPath(join(skillAssets, 'scaffold', target), name));
|
|
76
|
-
entries.push([await checkedPath(root, `${target}/${name}`), bytes]);
|
|
77
|
-
}
|
|
78
|
-
for (const [path, bytes] of entries) {
|
|
79
|
-
await mkdir(dirname(path), { recursive: true });
|
|
80
|
-
await writeFile(path, bytes, { flag: 'wx' });
|
|
81
|
-
}
|
|
82
|
-
return { target, status: 'created' };
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export async function installPackage(project, modules, source = assets) {
|
|
86
|
-
const root = resolve(project);
|
|
87
|
-
const info = await lstat(root);
|
|
88
|
-
if (!info.isDirectory() || info.isSymbolicLink()) throw new Error('Project root must be a real directory');
|
|
89
|
-
await readFile(await checkedPath(root, 'package.json'));
|
|
90
|
-
const selected = modules ?? release.defaults;
|
|
91
|
-
if (!Array.isArray(selected) || !selected.length) throw new Error('Select at least one module');
|
|
92
|
-
for (const module of selected) {
|
|
93
|
-
if (!Object.hasOwn(release.groups, module)) throw new Error(`Unknown module: ${module}`);
|
|
94
|
-
}
|
|
95
|
-
const recordPath = await checkedPath(root, `${release.target}/installed.json`);
|
|
96
|
-
const previous = await readRecord(recordPath);
|
|
97
|
-
const kept = Array.isArray(previous.modules) ? previous.modules.filter(module => Object.hasOwn(release.groups, module)) : [];
|
|
98
|
-
const installed = [...new Set([...kept, ...selected])].sort();
|
|
99
|
-
const files = [];
|
|
100
|
-
for (const name of new Set(installed.flatMap(module => release.groups[module]))) {
|
|
101
|
-
const target = await checkedPath(root, `${release.target}/${name}`);
|
|
102
|
-
const backup = await checkedPath(root, `${release.target}/${name}${BACKUP_SUFFIX}`);
|
|
103
|
-
const bytes = await readFile(await checkedPath(source, name));
|
|
104
|
-
const current = await readOptional(target);
|
|
105
|
-
files.push({ target, backup, bytes, current: current && !current.equals(bytes) ? current : null });
|
|
106
|
-
}
|
|
107
|
-
const changed = files.filter(file => file.current);
|
|
108
|
-
const unmerged = [];
|
|
109
|
-
for (const file of changed) if (await readOptional(file.backup)) unmerged.push(relative(root, file.backup));
|
|
110
|
-
if (unmerged.length) throw new Error(`Unmerged backup: ${unmerged.join(', ')}. Merge it into the installed file and delete it before reinstalling`);
|
|
111
|
-
for (const { backup, current } of changed) await writeFile(backup, current);
|
|
112
|
-
for (const { target, bytes } of files) {
|
|
113
|
-
await mkdir(dirname(target), { recursive: true });
|
|
114
|
-
await writeFile(target, bytes);
|
|
115
|
-
}
|
|
116
|
-
await writeFile(recordPath, `${JSON.stringify({ version: release.version, modules: installed }, null, 2)}\n`);
|
|
117
|
-
const scaffolds = [];
|
|
118
|
-
for (const module of selected) {
|
|
119
|
-
if (release.scaffolds[module]) scaffolds.push(await installScaffold(root, release.scaffolds[module]));
|
|
120
|
-
}
|
|
121
|
-
const previousVersion = typeof previous.version === 'string' ? previous.version : '';
|
|
122
|
-
const backups = changed.map(file => relative(root, file.backup));
|
|
123
|
-
return { root: release.target, version: release.version, previousVersion, modules: installed, backups, scaffolds };
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export async function runCli(args = process.argv.slice(2)) {
|
|
127
|
-
let project, modules;
|
|
128
|
-
for (let index = 0; index < args.length; index++) {
|
|
129
|
-
const flag = args[index];
|
|
130
|
-
const value = args[++index];
|
|
131
|
-
if (!value || value.startsWith('--')) throw new Error(`Missing value for ${flag}`);
|
|
132
|
-
if (flag === '--project') project = value;
|
|
133
|
-
else if (flag === '--modules') modules = value.split(',');
|
|
134
|
-
else throw new Error(`Unknown option: ${flag}`);
|
|
135
|
-
}
|
|
136
|
-
if (!project) throw new Error('Usage: install.mjs --project <directory> [--modules <comma-separated names>]');
|
|
137
|
-
const result = await installPackage(project, modules);
|
|
138
|
-
const version = result.previousVersion && result.previousVersion !== result.version ? `${result.previousVersion} -> ${result.version}` : result.version;
|
|
139
|
-
console.log(`[skill] ${result.root}: ${result.modules.join(', ')} (${version})`);
|
|
140
|
-
for (const scaffold of result.scaffolds) console.log(`[skill] ${scaffold.target}/: ${scaffold.status}`);
|
|
141
|
-
for (const backup of result.backups) console.log(`[skill] BACKUP ${backup}`);
|
|
142
|
-
if (result.backups.length) console.log('[skill] Changed files were replaced. Re-apply project changes from each backup, then delete it.');
|
|
143
|
-
return result;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
if (process.argv[1] && import.meta.url === pathToFileURL(resolve(process.argv[1])).href) {
|
|
147
|
-
runCli().catch(error => { console.error(error.message); process.exitCode = 1; });
|
|
148
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: resolution-adaptation
|
|
3
|
-
description: 屏幕分辨率、宽高比与横竖屏适配。用于调整尺寸模型、画面与 UI 分层、相机取景及设备安全区;不规定控件样式或具体布局写法。
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# 分辨率适配
|
|
7
|
-
|
|
8
|
-
通用分辨率适配不触发移动端接入,也不证明已完成移动端适配。默认不添加移动端专属能力;触发条件与状态更新见 `${CRAFT_CONTEXT_DIR}/knowledge/MobileAdapted.md`。
|
|
9
|
-
|
|
10
|
-
## 尺寸模型
|
|
11
|
-
|
|
12
|
-
- 以游戏容器实际可绘制的 CSS 尺寸为准,显示偏好见 `${CRAFT_CONTEXT_DIR}/knowledge/ProjectDisplayConfig.md`,不把首选分辨率当成固定运行尺寸。
|
|
13
|
-
- 沿用短边锁定、长边扩展:短边为 1080 逻辑像素,长边按实测比例计算并限制在 `[1440, 2400]`;横竖屏交换对应轴。
|
|
14
|
-
- 4:3~20:9 范围内铺满;超出范围时等比居中留边。缩放取 `min(容器宽/逻辑宽, 容器高/逻辑高)`,不拉伸画面。
|
|
15
|
-
- 长边和方向是运行时值。布局通过重排、锚定或内容延展吸收空间变化,不以固定 1920×1080 覆盖所有设备。
|
|
16
|
-
|
|
17
|
-
## 分层与可见范围
|
|
18
|
-
|
|
19
|
-
- **背景与遮罩**负责完整覆盖容器,包括极端比例的留边;**世界层**负责玩法与相机取景;**屏幕 UI 层**负责不随相机移动的界面。
|
|
20
|
-
- 世界坐标、UI 逻辑坐标与 CSS 像素分开使用,跨层投影和输入命中使用同一份缩放与偏移。
|
|
21
|
-
- `safeFrame` 是当前方向下的保守可见区(1440×1080 或 1080×1440);`omniSafeFrame` 是跨方向的居中 1080×1080 区域。需要持续可见的核心内容以这些区域为基准,或随方向重新布局;扩展区域不承担不可替代的操作与判定。
|
|
22
|
-
- 比例安全框不包含刘海、手势区或宿主按钮。移动端按钮和展示型 HUD(血量、分数、计时、任务等)都须避让:竖屏避开顶部整带;横屏分别避开左上、右上区域,顶部中间仍可用。背景、世界与遮罩不随之整体内缩。
|
|
23
|
-
- 首次制作或修改移动端功能 UI 时,先读 `${CRAFT_SKILL_DIR}/references/device-safe-area.md`,统一遮挡来源、横竖屏布局和 CSS→逻辑坐标换算;不等到出现点击故障再处理。
|
|
24
|
-
- 保护当前玩法必需区域:固定棋盘/轨道保留全部操作与判定位置,跟随玩法保留角色、当前目标及反应空间。控件写法由业务决定;在框内不等于可读、可操作。
|
|
25
|
-
|
|
26
|
-
## 统一适配链
|
|
27
|
-
|
|
28
|
-
- 复用 `${CRAFT_PROJECT_DIR}/src/display/`,由 `viewport.ts` 解算、`ui-stage.ts` 统一管理 UI 逻辑尺寸与全局变换;不重复初始化或叠加第二套全局缩放。
|
|
29
|
-
- 观测容器尺寸变化,在同一 resize 链同步画面、UI、取景和命中所依赖的坐标。容器尺寸无效时暂缓更新;转屏后重新计算,不缓存初始尺寸。
|
|
30
|
-
- stage 内沿用逻辑坐标,避免混入未经换算的视口尺寸而产生二次缩放;业务动效不覆盖 stage 的全局变换。
|
|
31
|
-
- 制作或调整移动端交互 UI 时,遵守 [显示尺寸与有效热区](../mobile-adaptation/references/input-config.md#显示尺寸与有效热区) 的缩放后 40 CSS px 下限;普通按钮、自定义控件及复制的样式示例都须按实际比例换算,并随 resize 更新布局与命中。
|
|
32
|
-
- Three.js 渲染尺寸使用容器 CSS 尺寸,UI 使用逻辑尺寸。透视相机同步 aspect,正交相机按取景方案更新投影范围;世界取景与碰撞边界分开。旧显示配置中的 scene / coordSpace 属于场景编辑器,应保留。
|
|
33
|
-
|
|
34
|
-
## 验证与按需参考
|
|
35
|
-
|
|
36
|
-
进入实际玩法并打开代表性面板,检查首选尺寸、4:3、20:9、小尺寸及超范围比例;同会话横竖切换后返回原尺寸,异常再以目标尺寸冷启动对照。核对关键区域、UI 可读/可达、输入命中与背景覆盖,不以标题正常或逻辑字号代替验证。
|
|
37
|
-
|
|
38
|
-
仅在需要时读取:
|
|
39
|
-
|
|
40
|
-
- 小屏缩水、面板裁切、切换错位或接线检查:[适配故障排查](references/troubleshooting.md)。
|
|
41
|
-
|
|
42
|
-
- 布局与取景方案:`${CRAFT_SKILL_DIR}/references/layout-rules.md`。
|
|
43
|
-
- 制作或修改 HUD、面板与控件布局:读 `${CRAFT_SKILL_DIR}/references/game-ui-occlusion.md`,分别检查视觉遮挡、输入拦截及关键玩法区域;位于安全框内不代表这些检查已通过。
|
|
44
|
-
- 移动端功能 UI 制作/修改必读;其它刘海、手势区或宿主遮挡问题按需读:`${CRAFT_SKILL_DIR}/references/device-safe-area.md`。
|
|
45
|
-
- 接入或维护解算模块:`${CRAFT_SKILL_DIR}/references/viewport-api.md`;`assets/display/` 提供实现,`assets/example/` 提供接线与样式示例,均不作为控件规范。
|
|
46
|
-
- 多比例自动审计:`${CRAFT_SKILL_DIR}/scripts/aspect_audit.mjs`,传 `--config "${CRAFT_PROJECT_DIR}/game.config.json"`;玩法/面板步骤与报告边界见 `${CRAFT_SKILL_DIR}/references/audit.md`。几何通过不代表玩法、取景或真机验收通过。
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `#ui-root` / `#ui-stage` 的唯一 owner:把 `viewport.ts` 的解算结果落到 DOM 上。
|
|
3
|
-
*
|
|
4
|
-
* 落盘位置:`${CRAFT_PROJECT_DIR}/src/display/ui-stage.ts`
|
|
5
|
-
*
|
|
6
|
-
* 职责边界:
|
|
7
|
-
* - 层级骨架(root / stage / 层段)由本文件的 `createUiStage()` 创建;
|
|
8
|
-
* - stage 的**盒(width / height)与 transform(translate + scale)**在每次 `apply()` 时重设。
|
|
9
|
-
*
|
|
10
|
-
* 为什么每次重设:短边锁定模型下长边随设备比例变化(1440 ~ 2400),设计尺寸不是常量,
|
|
11
|
-
* 不能用 contain 模型「构造期固定尺寸 + `min(cssW / width, cssH / height)` 缩放」。
|
|
12
|
-
*
|
|
13
|
-
* 为什么要 `id`:`#ui-root` 是平台截图合成(`connectPreview({ uiRoot })`)与视觉自检的
|
|
14
|
-
* 锚点,`#ui-stage` 是业务 CSS 与方向钩子的锚点。同域重绘必须能按固定 id 定位这一层。
|
|
15
|
-
*/
|
|
16
|
-
import { computeLogicalSize, getOmniSafeFrame, getSafeFrame } from './viewport';
|
|
17
|
-
import type { LogicalSize, SafeFrame, ViewportOptions } from './viewport';
|
|
18
|
-
|
|
19
|
-
const UI_LAYERS: Record<string, number> = { background: 0, hud: 100, panel: 300, scrim: 600, modal: 650, toast: 900 };
|
|
20
|
-
|
|
21
|
-
function createUiStage(container: HTMLElement, options: { width: number; height: number }): {
|
|
22
|
-
root: HTMLDivElement;
|
|
23
|
-
stage: HTMLDivElement;
|
|
24
|
-
layer(name: string): HTMLDivElement;
|
|
25
|
-
dispose(): void;
|
|
26
|
-
} {
|
|
27
|
-
const document = container.ownerDocument;
|
|
28
|
-
const root = document.createElement('div');
|
|
29
|
-
const stage = document.createElement('div');
|
|
30
|
-
Object.assign(root.style, { position: 'absolute', inset: '0', pointerEvents: 'none', overflow: 'hidden', zIndex: '10' });
|
|
31
|
-
Object.assign(stage.style, {
|
|
32
|
-
position: 'absolute', left: '50%', top: '50%', width: `${options.width}px`, height: `${options.height}px`,
|
|
33
|
-
transform: 'translate(-50%, -50%)', transformOrigin: 'center center', pointerEvents: 'none',
|
|
34
|
-
});
|
|
35
|
-
root.append(stage);
|
|
36
|
-
const layers = new Map<string, HTMLDivElement>();
|
|
37
|
-
for (const [name, order] of Object.entries(UI_LAYERS)) {
|
|
38
|
-
const element = document.createElement('div');
|
|
39
|
-
element.dataset.layer = name;
|
|
40
|
-
Object.assign(element.style, { position: 'absolute', inset: '0', pointerEvents: 'none', zIndex: String(order) });
|
|
41
|
-
stage.append(element);
|
|
42
|
-
layers.set(name, element);
|
|
43
|
-
}
|
|
44
|
-
container.append(root);
|
|
45
|
-
return {
|
|
46
|
-
root,
|
|
47
|
-
stage,
|
|
48
|
-
layer(name: string): HTMLDivElement {
|
|
49
|
-
const element = layers.get(name);
|
|
50
|
-
if (!element) throw new Error(`Unknown UI layer '${name}'`);
|
|
51
|
-
return element;
|
|
52
|
-
},
|
|
53
|
-
dispose(): void {
|
|
54
|
-
root.remove();
|
|
55
|
-
layers.clear();
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/** 稳定的 DOM 钩子,业务 CSS 与自检脚本依赖它们,不要改名 */
|
|
61
|
-
export const UI_ROOT_ID = 'ui-root';
|
|
62
|
-
export const UI_STAGE_ID = 'ui-stage';
|
|
63
|
-
|
|
64
|
-
export interface UiStageHandle {
|
|
65
|
-
readonly root: HTMLDivElement;
|
|
66
|
-
readonly stage: HTMLDivElement;
|
|
67
|
-
/** 当前逻辑尺寸(设计像素)。**不是常量**:短边恒定、长边随 viewport 比例伸缩 */
|
|
68
|
-
readonly logical: LogicalSize;
|
|
69
|
-
/** 逻辑像素 → CSS 像素的缩放系数。控件半径 / 拖动阈值等设计像素尺寸都乘它 */
|
|
70
|
-
readonly scale: number;
|
|
71
|
-
/** 当前方向下必须完整可见的居中区域(逻辑坐标) */
|
|
72
|
-
readonly safeFrame: SafeFrame;
|
|
73
|
-
/** 横竖都可见的居中方形(逻辑坐标)。转屏后也必须还在的元素用它 */
|
|
74
|
-
readonly omniSafeFrame: SafeFrame;
|
|
75
|
-
/**
|
|
76
|
-
* 取层段容器(`background` / `hud` / `panel` / `scrim` / `modal` / `toast`)。
|
|
77
|
-
* 虚拟控件与业务 HUD 都挂进层段里,
|
|
78
|
-
* **不要自己在 stage 下另建一层** —— 会绕过层序,且破坏触点仲裁所依赖的插入顺序。
|
|
79
|
-
*/
|
|
80
|
-
layer(name: string): HTMLDivElement;
|
|
81
|
-
/** 按 viewport(容器)CSS 尺寸重算并同步。入参必须是容器尺寸,不是 canvas 尺寸 */
|
|
82
|
-
apply(viewportW: number, viewportH: number): void;
|
|
83
|
-
/** 直接读容器实测尺寸再 apply;容器未布局(宽高为 0)时保持上一次的有效值 */
|
|
84
|
-
applyFromContainer(): void;
|
|
85
|
-
dispose(): void;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
let current: UiStageHandle | null = null;
|
|
89
|
-
|
|
90
|
-
/** 入口 `initUiStage` 之后,虚拟控件与业务 HUD 共用这一层,不要再 `createUiStage`。 */
|
|
91
|
-
export function getUiStage(): UiStageHandle {
|
|
92
|
-
if (!current) throw new Error('UI stage 尚未 initUiStage');
|
|
93
|
-
return current;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export function initUiStage(container: HTMLElement, options?: ViewportOptions): UiStageHandle {
|
|
97
|
-
// 容器未布局(iframe 首帧)时 clientWidth/Height 为 0。此时用兜底解算值建 stage,
|
|
98
|
-
// 建完必须再走一次 applyFromContainer,等观测回调送来真实尺寸。
|
|
99
|
-
let logical = computeLogicalSize(container.clientWidth, container.clientHeight, options);
|
|
100
|
-
|
|
101
|
-
const ui = createUiStage(container, { width: logical.logicW, height: logical.logicH });
|
|
102
|
-
const root: HTMLDivElement = ui.root;
|
|
103
|
-
const stage: HTMLDivElement = ui.stage;
|
|
104
|
-
root.id = UI_ROOT_ID;
|
|
105
|
-
stage.id = UI_STAGE_ID;
|
|
106
|
-
|
|
107
|
-
const handle: UiStageHandle = {
|
|
108
|
-
root,
|
|
109
|
-
stage,
|
|
110
|
-
get logical() {
|
|
111
|
-
return logical;
|
|
112
|
-
},
|
|
113
|
-
get scale() {
|
|
114
|
-
return logical.scale;
|
|
115
|
-
},
|
|
116
|
-
get safeFrame() {
|
|
117
|
-
return getSafeFrame(logical, options);
|
|
118
|
-
},
|
|
119
|
-
get omniSafeFrame() {
|
|
120
|
-
return getOmniSafeFrame(logical, options);
|
|
121
|
-
},
|
|
122
|
-
layer(name: string): HTMLDivElement {
|
|
123
|
-
return ui.layer(name);
|
|
124
|
-
},
|
|
125
|
-
apply(viewportW: number, viewportH: number): void {
|
|
126
|
-
logical = computeLogicalSize(viewportW, viewportH, options);
|
|
127
|
-
|
|
128
|
-
// translate(-50%, -50%) 是 createUiStage 设好的居中方式,必须原样保留。
|
|
129
|
-
stage.style.width = `${logical.logicW}px`;
|
|
130
|
-
stage.style.height = `${logical.logicH}px`;
|
|
131
|
-
stage.style.transform = `translate(-50%, -50%) scale(${logical.scale})`;
|
|
132
|
-
|
|
133
|
-
// 方向钩子(**实测值**,转屏实时翻转)。业务 CSS 用
|
|
134
|
-
// `#ui-stage[data-orientation="portrait"] .xxx { ... }` 分支排布,
|
|
135
|
-
// 业务坐标更新沿现有 resize 链处理。
|
|
136
|
-
stage.dataset.orientation = logical.orientation;
|
|
137
|
-
|
|
138
|
-
// 给「不在 stage 内」的元素(全屏视频层、canvas 内控件等)留一个换算入口:
|
|
139
|
-
// 设计像素尺寸 × --ui-scale = 实际 CSS 像素。
|
|
140
|
-
container.style.setProperty('--ui-scale', String(logical.scale));
|
|
141
|
-
},
|
|
142
|
-
applyFromContainer(): void {
|
|
143
|
-
const w = container.clientWidth;
|
|
144
|
-
const h = container.clientHeight;
|
|
145
|
-
if (w > 0 && h > 0) handle.apply(w, h);
|
|
146
|
-
},
|
|
147
|
-
dispose(): void {
|
|
148
|
-
if (current === handle) current = null;
|
|
149
|
-
ui.dispose();
|
|
150
|
-
},
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
handle.applyFromContainer();
|
|
154
|
-
current = handle;
|
|
155
|
-
return handle;
|
|
156
|
-
}
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 显示器适配:短边锁定 + 长边扩展,**方向无关**。
|
|
3
|
-
*
|
|
4
|
-
* 落盘位置:`${CRAFT_PROJECT_DIR}/src/display/viewport.ts`
|
|
5
|
-
* 本文件是纯函数模块:不引用 three.js、不引用 runtime、不碰 DOM。渲染层、UI 层、
|
|
6
|
-
* 玩法层都从同一份解算结果取值,因此三者的坐标系必然一致。
|
|
7
|
-
*
|
|
8
|
-
* 核心规则:
|
|
9
|
-
* - 哪条轴是短边由**运行时实测**决定:`vw >= vh` 即横向,反之纵向;
|
|
10
|
-
* - 短边逻辑长度恒为 shortEdge(默认 1080);
|
|
11
|
-
* - 长边逻辑长度 = shortEdge × (viewport 长边 / viewport 短边),clamp 到
|
|
12
|
-
* [minLong, maxLong](默认 [1440, 2400])。
|
|
13
|
-
*
|
|
14
|
-
* 由此:
|
|
15
|
-
* - 支持的比例范围内,横竖方向的逻辑区域都铺满容器;
|
|
16
|
-
* - 只有比 4:3 更方、或比 20:9 更长的极端比例才触发 clamp 并留边;
|
|
17
|
-
* - 逻辑像素乘返回的 scale 得到 CSS 像素;控件可读性按实际显示结果检查。
|
|
18
|
-
*
|
|
19
|
-
* `#ui-stage` 的 `data-orientation` 可用于 CSS 重排;需要业务坐标更新时沿现有 resize 链处理。
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/** 可选覆盖项。绝大多数项目不需要传 —— 默认值就是规范值 */
|
|
23
|
-
export interface ViewportOptions {
|
|
24
|
-
/** 短边逻辑长度,默认 1080;不规定控件字号 */
|
|
25
|
-
shortEdge?: number;
|
|
26
|
-
/**
|
|
27
|
-
* 长边 clamp 范围 [min, max],单位为设计像素。
|
|
28
|
-
* 缺省时**按 shortEdge 派生**:`[shortEdge × 4/3, shortEdge × 20/9]`
|
|
29
|
-
* (默认 shortEdge 1080 → [1440, 2400]),即支持 4:3 ~ 20:9。
|
|
30
|
-
* 这样改 shortEdge 不会意外触发 clamp。显式传值则完全按传入的绝对像素。
|
|
31
|
-
*/
|
|
32
|
-
longEdgeClamp?: [number, number];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/** 运行时**实测**方向,不是配置声明 */
|
|
36
|
-
export type Orientation = 'landscape' | 'portrait';
|
|
37
|
-
|
|
38
|
-
/** 一次 resize 的解算结果,UI 层与相机层共用 */
|
|
39
|
-
export interface LogicalSize {
|
|
40
|
-
/** 逻辑宽(设计像素) */
|
|
41
|
-
logicW: number;
|
|
42
|
-
/** 逻辑高(设计像素) */
|
|
43
|
-
logicH: number;
|
|
44
|
-
/** 逻辑像素 → CSS 像素的缩放系数 */
|
|
45
|
-
scale: number;
|
|
46
|
-
/** 居中偏移(CSS 像素)。未触发 clamp 时恒为 0 */
|
|
47
|
-
offsetX: number;
|
|
48
|
-
offsetY: number;
|
|
49
|
-
/** 长边是否被 clamp。为 true 时才会出现留边 */
|
|
50
|
-
clamped: boolean;
|
|
51
|
-
/** 本次解算时 viewport 的实际方向 */
|
|
52
|
-
orientation: Orientation;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/** 保守可见区(UI 逻辑坐标,居中),不作为世界或碰撞边界 */
|
|
56
|
-
export interface SafeFrame {
|
|
57
|
-
x: number;
|
|
58
|
-
y: number;
|
|
59
|
-
width: number;
|
|
60
|
-
height: number;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const DEFAULT_SHORT_EDGE = 1080;
|
|
64
|
-
/** 默认支持的长短边比例区间:4:3 ~ 20:9 */
|
|
65
|
-
const DEFAULT_MIN_RATIO = 4 / 3;
|
|
66
|
-
const DEFAULT_MAX_RATIO = 20 / 9;
|
|
67
|
-
|
|
68
|
-
function clamp(value: number, min: number, max: number): number {
|
|
69
|
-
return Math.min(max, Math.max(min, value));
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function resolveParams(options?: ViewportOptions): {
|
|
73
|
-
shortEdge: number;
|
|
74
|
-
minLong: number;
|
|
75
|
-
maxLong: number;
|
|
76
|
-
} {
|
|
77
|
-
const rawShort = Number(options?.shortEdge);
|
|
78
|
-
const shortEdge = rawShort > 0 ? rawShort : DEFAULT_SHORT_EDGE;
|
|
79
|
-
// 缺省 clamp 按短边派生,保证换 shortEdge 时比例区间不变
|
|
80
|
-
const [rawMin, rawMax] = options?.longEdgeClamp ?? [
|
|
81
|
-
shortEdge * DEFAULT_MIN_RATIO,
|
|
82
|
-
shortEdge * DEFAULT_MAX_RATIO,
|
|
83
|
-
];
|
|
84
|
-
// 容错:配置写反或非法时退回派生默认,不让一处笔误把画面算崩
|
|
85
|
-
const minLong = rawMin > 0 ? Math.min(rawMin, rawMax) : shortEdge * DEFAULT_MIN_RATIO;
|
|
86
|
-
const maxLong = rawMax > 0 ? Math.max(rawMin, rawMax) : shortEdge * DEFAULT_MAX_RATIO;
|
|
87
|
-
return { shortEdge, minLong, maxLong };
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* 由 viewport 尺寸解算逻辑坐标系,运行时方向由入参实测得出。
|
|
92
|
-
*
|
|
93
|
-
* @param viewportW CSS 像素宽(用容器 clientWidth,不要用 window.innerWidth ——
|
|
94
|
-
* iOS Safari 地址栏收起会改变后者,且预览跑在 iframe 里时它是宿主尺寸)
|
|
95
|
-
* @param viewportH CSS 像素高
|
|
96
|
-
* @param options 可选覆盖;缺省即规范值
|
|
97
|
-
*/
|
|
98
|
-
export function computeLogicalSize(
|
|
99
|
-
viewportW: number,
|
|
100
|
-
viewportH: number,
|
|
101
|
-
options?: ViewportOptions,
|
|
102
|
-
): LogicalSize {
|
|
103
|
-
const { shortEdge, minLong, maxLong } = resolveParams(options);
|
|
104
|
-
|
|
105
|
-
// iframe 尚未布局时宽高为 0,退回横向基准比例,避免除零产生 NaN 污染整条链路
|
|
106
|
-
if (!(viewportW > 0) || !(viewportH > 0)) {
|
|
107
|
-
return {
|
|
108
|
-
logicW: minLong,
|
|
109
|
-
logicH: shortEdge,
|
|
110
|
-
scale: 1,
|
|
111
|
-
offsetX: 0,
|
|
112
|
-
offsetY: 0,
|
|
113
|
-
clamped: false,
|
|
114
|
-
orientation: 'landscape',
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// 方向来自实测。正方形(vw === vh)归为 landscape,避免边界抖动。
|
|
119
|
-
const landscape = viewportW >= viewportH;
|
|
120
|
-
const viewportShort = landscape ? viewportH : viewportW;
|
|
121
|
-
const viewportLong = landscape ? viewportW : viewportH;
|
|
122
|
-
|
|
123
|
-
const rawLong = shortEdge * (viewportLong / viewportShort);
|
|
124
|
-
const logicLong = clamp(rawLong, minLong, maxLong);
|
|
125
|
-
// 浮点比较用绝对误差:rawLong 来自除法,与 clamp 边界直接 !== 会误判
|
|
126
|
-
const clamped = Math.abs(logicLong - rawLong) > 1e-6;
|
|
127
|
-
|
|
128
|
-
const logicW = landscape ? logicLong : shortEdge;
|
|
129
|
-
const logicH = landscape ? shortEdge : logicLong;
|
|
130
|
-
|
|
131
|
-
// 未 clamp 时两轴比值相同,min 取到的就是短边比值,offset 自然为 0;
|
|
132
|
-
// clamp 后逻辑比例与 viewport 不符,min 保证内容不被裁切,多出部分成为留边。
|
|
133
|
-
const scale = Math.min(viewportW / logicW, viewportH / logicH);
|
|
134
|
-
const offsetX = (viewportW - logicW * scale) / 2;
|
|
135
|
-
const offsetY = (viewportH - logicH * scale) / 2;
|
|
136
|
-
|
|
137
|
-
return {
|
|
138
|
-
logicW,
|
|
139
|
-
logicH,
|
|
140
|
-
scale,
|
|
141
|
-
offsetX,
|
|
142
|
-
offsetY,
|
|
143
|
-
clamped,
|
|
144
|
-
orientation: landscape ? 'landscape' : 'portrait',
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* 当前方向下必须完整可见的居中区域(逻辑坐标)。
|
|
150
|
-
*
|
|
151
|
-
* 短边方向恒等于 shortEdge(全高/全宽可见),长边方向取 clamp 下限 minLong ——
|
|
152
|
-
* 即最方的受支持比例。在当前方向下该区域完整落在画面内,因此:
|
|
153
|
-
* - 需要持续可见的屏幕内容可按此区域布局,或随方向重新布局;
|
|
154
|
-
* - 世界对象按相机取景保护当前玩法必需区域,不限制在此 UI 坐标框内。
|
|
155
|
-
*
|
|
156
|
-
* **注意 safe frame 随设备方向翻转**(横向 1440×1080 ↔ 纵向 1080×1440)。
|
|
157
|
-
* 跨方向的屏幕布局参考见 `getOmniSafeFrame()`。
|
|
158
|
-
*/
|
|
159
|
-
export function getSafeFrame(logical: LogicalSize, options?: ViewportOptions): SafeFrame {
|
|
160
|
-
const { shortEdge, minLong } = resolveParams(options);
|
|
161
|
-
const landscape = logical.orientation === 'landscape';
|
|
162
|
-
const width = landscape ? Math.min(minLong, logical.logicW) : shortEdge;
|
|
163
|
-
const height = landscape ? shortEdge : Math.min(minLong, logical.logicH);
|
|
164
|
-
return {
|
|
165
|
-
x: (logical.logicW - width) / 2,
|
|
166
|
-
y: (logical.logicH - height) / 2,
|
|
167
|
-
width,
|
|
168
|
-
height,
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* 横竖方向都保证可见的居中方形区域(逻辑坐标,边长 = shortEdge)。
|
|
174
|
-
*
|
|
175
|
-
* 用于需要跨方向持续可见的屏幕内容,例如暂停按钮与提示。
|
|
176
|
-
* 世界对象按实际相机投影与玩法取景处理,不以此框限制世界坐标。
|
|
177
|
-
*/
|
|
178
|
-
export function getOmniSafeFrame(logical: LogicalSize, options?: ViewportOptions): SafeFrame {
|
|
179
|
-
const { shortEdge } = resolveParams(options);
|
|
180
|
-
const side = Math.min(shortEdge, logical.logicW, logical.logicH);
|
|
181
|
-
return {
|
|
182
|
-
x: (logical.logicW - side) / 2,
|
|
183
|
-
y: (logical.logicH - side) / 2,
|
|
184
|
-
width: side,
|
|
185
|
-
height: side,
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* 有界世界的取景矩形(逻辑坐标)。世界**居中**放进逻辑区域,多出的空间向四周均匀延伸。
|
|
191
|
-
*
|
|
192
|
-
* 两条轴各自独立判断,一个表达式覆盖两种情形:
|
|
193
|
-
*
|
|
194
|
-
* | 情形 | 结果 | 表现 |
|
|
195
|
-
* |---|---|---|
|
|
196
|
-
* | 世界 **窄于** 该轴逻辑长度 | 起点取负、长度取逻辑长度 | 取景被钳在居中位,世界居中、两侧留白 |
|
|
197
|
-
* | 世界 **不窄于** 该轴逻辑长度 | 等价于 `(0, 0, worldW, worldH)` | 相机正常跟随滚动 |
|
|
198
|
-
*
|
|
199
|
-
* 因此单轴滚动的横版世界会自动得到「滚动轴滚动 + 另一轴居中留白」,不需要按品类分支。
|
|
200
|
-
*
|
|
201
|
-
* **两个硬约束:**
|
|
202
|
-
*
|
|
203
|
-
* 1. **不要把返回值当作物理 / 碰撞边界。** 物理边界必须保持世界原尺寸
|
|
204
|
-
* `(0, 0, worldW, worldH)`,否则角色能走进留白区。
|
|
205
|
-
* 取景矩形是「镜头能看到哪」,物理边界是「角色能走到哪」,改造后二者不再相等。
|
|
206
|
-
* 2. **必须在 resize 回调里重算并重设。** `logical` 是运行时值,转屏或改窗口后
|
|
207
|
-
* 旧值立即失效(世界会重新贴边)。
|
|
208
|
-
*
|
|
209
|
-
* 另外注意世界坐标会出现**负值区域**(屏幕左边缘可能对应世界 x < 0),
|
|
210
|
-
* 所以出界判定一律用世界坐标与世界尺寸比较,写 `x < 0` 会误判。
|
|
211
|
-
*
|
|
212
|
-
* @param worldW 玩法世界宽(设计像素常量);无界世界传世界包围盒或按需放大
|
|
213
|
-
* @param worldH 玩法世界高
|
|
214
|
-
* @param logicW 当前逻辑区域宽(取 `computeLogicalSize(...).logicW`,不要重算第二遍)
|
|
215
|
-
* @param logicH 当前逻辑区域高
|
|
216
|
-
*/
|
|
217
|
-
export interface CameraBounds {
|
|
218
|
-
/** 可能为负:世界窄于逻辑区域时,屏幕左/上边缘落在世界之外 */
|
|
219
|
-
x: number;
|
|
220
|
-
y: number;
|
|
221
|
-
width: number;
|
|
222
|
-
height: number;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
export function getCameraBounds(
|
|
226
|
-
worldW: number,
|
|
227
|
-
worldH: number,
|
|
228
|
-
logicW: number,
|
|
229
|
-
logicH: number,
|
|
230
|
-
): CameraBounds {
|
|
231
|
-
// -(0) 会得到 -0:数值上等价,但 Object.is(-0, 0) 为 false、JSON 往返也会变号,
|
|
232
|
-
// 对外暴露不干净。用 `|| 0` 把 ±0 一律归一到 +0。
|
|
233
|
-
return {
|
|
234
|
-
x: Math.min(0, -(logicW - worldW) / 2) || 0,
|
|
235
|
-
y: Math.min(0, -(logicH - worldH) / 2) || 0,
|
|
236
|
-
width: Math.max(worldW, logicW),
|
|
237
|
-
height: Math.max(worldH, logicH),
|
|
238
|
-
};
|
|
239
|
-
}
|