@playcraft/skills 0.0.2
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 +333 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/skills.loader.d.ts +31 -0
- package/dist/src/skills.loader.d.ts.map +1 -0
- package/dist/src/skills.loader.js +200 -0
- package/dist/src/skills.loader.js.map +1 -0
- package/dist/src/skills.types.d.ts +44 -0
- package/dist/src/skills.types.d.ts.map +1 -0
- package/dist/src/skills.types.js +9 -0
- package/dist/src/skills.types.js.map +1 -0
- package/package.json +35 -0
- package/skills/2048_core.aigameplay/SKILL.md +123 -0
- package/skills/2048_core.aigameplay/manifest.json +159 -0
- package/skills/2048_core.aigameplay/ref/pgs-schema.json +194 -0
- package/skills/2048_core.aigameplay/ref/reducer.template.ts +189 -0
- package/skills/SKILL.md +46 -0
- package/skills/ad_compliance_rules.aiconfig/SKILL.md +85 -0
- package/skills/ad_compliance_rules.aiconfig/manifest.json +60 -0
- package/skills/agent_remix_orchestrator.aicomponent/SKILL.md +257 -0
- package/skills/agent_remix_orchestrator.aicomponent/manifest.json +12 -0
- package/skills/app_metadata.aiconfig/SKILL.md +53 -0
- package/skills/app_metadata.aiconfig/manifest.json +32 -0
- package/skills/appear_sfx.aiaudio/SKILL.md +59 -0
- package/skills/appear_sfx.aiaudio/manifest.json +45 -0
- package/skills/appear_sfx.aiaudio/ref/appear.mp3 +0 -0
- package/skills/arrow_move_error_sfx.aiaudio/SKILL.md +59 -0
- package/skills/arrow_move_error_sfx.aiaudio/manifest.json +45 -0
- package/skills/arrow_move_error_sfx.aiaudio/ref/arrow_move_error.mp3 +0 -0
- package/skills/arrow_path_data_format.aicomponent/SKILL.md +152 -0
- package/skills/arrow_path_data_format.aicomponent/manifest.json +57 -0
- package/skills/arrow_path_data_format.aicomponent/ref/LevelParser.ts +188 -0
- package/skills/arrow_path_data_format.aicomponent/ref/LevelTypes.ts +131 -0
- package/skills/arrow_pick_match_rules.aigameplay/SKILL.md +117 -0
- package/skills/arrow_pick_match_rules.aigameplay/manifest.json +105 -0
- package/skills/arrow_pick_match_rules.aigameplay/ref/pgs-schema.json +180 -0
- package/skills/asset_pipeline_scripts.aicomponent/SKILL.md +117 -0
- package/skills/asset_pipeline_scripts.aicomponent/manifest.json +17 -0
- package/skills/asset_pipeline_scripts.aicomponent/ref/gen-sprite.sh +105 -0
- package/skills/ball_sort.aigameplay/SKILL.md +109 -0
- package/skills/ball_sort.aigameplay/manifest.json +155 -0
- package/skills/ball_sort.aigameplay/ref/pgs-schema.json +192 -0
- package/skills/ball_sort.aigameplay/ref/reducer.template.ts +156 -0
- package/skills/basketball_shot.aigameplay/SKILL.md +94 -0
- package/skills/basketball_shot.aigameplay/manifest.json +150 -0
- package/skills/basketball_shot.aigameplay/ref/pgs-schema.json +229 -0
- package/skills/basketball_shot.aigameplay/ref/reducer.template.ts +189 -0
- package/skills/bg_music.aiaudio/SKILL.md +61 -0
- package/skills/bg_music.aiaudio/manifest.json +48 -0
- package/skills/bg_music.aiaudio/ref/bg.mp3 +0 -0
- package/skills/big_watermelon.aigameplay/SKILL.md +94 -0
- package/skills/big_watermelon.aigameplay/manifest.json +155 -0
- package/skills/big_watermelon.aigameplay/ref/pgs-schema.json +191 -0
- package/skills/big_watermelon.aigameplay/ref/reducer.template.ts +202 -0
- package/skills/block_puzzle.aigameplay/SKILL.md +121 -0
- package/skills/block_puzzle.aigameplay/manifest.json +154 -0
- package/skills/block_puzzle.aigameplay/ref/pgs-schema.json +170 -0
- package/skills/block_puzzle.aigameplay/ref/reducer.template.ts +182 -0
- package/skills/board_entity_sprite.aiimage/SKILL.md +255 -0
- package/skills/board_entity_sprite.aiimage/manifest.json +153 -0
- package/skills/board_entity_sprite.aiimage/ref/ProceduralCar.ts +357 -0
- package/skills/board_entity_sprite.aiimage/ref/car.png +0 -0
- package/skills/board_entity_sprite.aiimage/ref/car.webp +0 -0
- package/skills/bottom_ui_bar.aicomponent/SKILL.md +50 -0
- package/skills/bottom_ui_bar.aicomponent/manifest.json +31 -0
- package/skills/bottom_ui_bar.aicomponent/ref/GameBottomUI.ts +27 -0
- package/skills/bubble_shooter.aigameplay/SKILL.md +129 -0
- package/skills/bubble_shooter.aigameplay/manifest.json +181 -0
- package/skills/bubble_shooter.aigameplay/ref/pgs-schema.json +226 -0
- package/skills/bubble_shooter.aigameplay/ref/reducer.template.ts +228 -0
- package/skills/button_click_sfx.aiaudio/SKILL.md +59 -0
- package/skills/button_click_sfx.aiaudio/manifest.json +45 -0
- package/skills/button_click_sfx.aiaudio/ref/button_click.mp3 +0 -0
- package/skills/calm_piano.aiaudio/SKILL.md +68 -0
- package/skills/calm_piano.aiaudio/manifest.json +50 -0
- package/skills/camera_controller_3d.aicomponent/SKILL.md +100 -0
- package/skills/camera_controller_3d.aicomponent/manifest.json +52 -0
- package/skills/camera_controller_3d.aicomponent/ref/CameraController.ts +199 -0
- package/skills/camera_controller_3d.aicomponent/ref/OrbitControlsAdapter.ts +152 -0
- package/skills/candy_tile.aiimage/SKILL.md +62 -0
- package/skills/candy_tile.aiimage/manifest.json +49 -0
- package/skills/car_parking.aigameplay/SKILL.md +105 -0
- package/skills/car_parking.aigameplay/manifest.json +164 -0
- package/skills/car_parking.aigameplay/ref/pgs-schema.json +163 -0
- package/skills/car_parking.aigameplay/ref/reducer.template.ts +166 -0
- package/skills/castle.aiimage/SKILL.md +64 -0
- package/skills/castle.aiimage/manifest.json +48 -0
- package/skills/cheerful_ukulele.aiaudio/SKILL.md +72 -0
- package/skills/cheerful_ukulele.aiaudio/manifest.json +50 -0
- package/skills/click_sfx.aiaudio/SKILL.md +59 -0
- package/skills/click_sfx.aiaudio/manifest.json +45 -0
- package/skills/click_sfx.aiaudio/ref/click.mp3 +0 -0
- package/skills/combo_display.aicomponent/SKILL.md +45 -0
- package/skills/combo_display.aicomponent/manifest.json +31 -0
- package/skills/combo_display.aicomponent/ref/ComboManager.ts +362 -0
- package/skills/combo_display.aicomponent/ref/ComboSmallUI.ts +232 -0
- package/skills/combo_praise_text.aicomponent/SKILL.md +56 -0
- package/skills/combo_praise_text.aicomponent/manifest.json +34 -0
- package/skills/combo_praise_text.aicomponent/ref/ComboManager.ts +362 -0
- package/skills/countdown_timer.aicomponent/SKILL.md +44 -0
- package/skills/countdown_timer.aicomponent/manifest.json +35 -0
- package/skills/countdown_timer.aicomponent/ref/CountdownDisplay.ts +213 -0
- package/skills/cta_platform_config.aiconfig/SKILL.md +72 -0
- package/skills/cta_platform_config.aiconfig/manifest.json +56 -0
- package/skills/debug_overlay.aicomponent/SKILL.md +75 -0
- package/skills/debug_overlay.aicomponent/manifest.json +17 -0
- package/skills/debug_overlay.aicomponent/ref/DebugOverlay.ts +144 -0
- package/skills/desert.aiimage/SKILL.md +63 -0
- package/skills/desert.aiimage/manifest.json +49 -0
- package/skills/difficulty_curve_designer.aiconfig/SKILL.md +68 -0
- package/skills/difficulty_curve_designer.aiconfig/manifest.json +36 -0
- package/skills/digit_renderer.aicomponent/SKILL.md +43 -0
- package/skills/digit_renderer.aicomponent/manifest.json +25 -0
- package/skills/digit_renderer.aicomponent/ref/DigitRenderer.ts +237 -0
- package/skills/download_button.aicomponent/SKILL.md +44 -0
- package/skills/download_button.aicomponent/manifest.json +25 -0
- package/skills/download_button.aicomponent/ref/DownloadButton.ts +137 -0
- package/skills/draw_line_puzzle.aigameplay/SKILL.md +84 -0
- package/skills/draw_line_puzzle.aigameplay/manifest.json +152 -0
- package/skills/draw_line_puzzle.aigameplay/ref/pgs-schema.json +189 -0
- package/skills/draw_line_puzzle.aigameplay/ref/reducer.template.ts +194 -0
- package/skills/easy_to_hard.aiconfig/SKILL.md +52 -0
- package/skills/easy_to_hard.aiconfig/manifest.json +33 -0
- package/skills/eight_ball_pool.aigameplay/SKILL.md +104 -0
- package/skills/eight_ball_pool.aigameplay/manifest.json +152 -0
- package/skills/eight_ball_pool.aigameplay/ref/pgs-schema.json +205 -0
- package/skills/eight_ball_pool.aigameplay/ref/reducer.template.ts +198 -0
- package/skills/energetic_electronic.aiaudio/SKILL.md +69 -0
- package/skills/energetic_electronic.aiaudio/manifest.json +51 -0
- package/skills/fail_sfx.aiaudio/SKILL.md +59 -0
- package/skills/fail_sfx.aiaudio/manifest.json +44 -0
- package/skills/fail_sfx.aiaudio/ref/fail.mp3 +0 -0
- package/skills/figer_icon.aiimage/SKILL.md +58 -0
- package/skills/figer_icon.aiimage/manifest.json +48 -0
- package/skills/figer_icon.aiimage/ref/figer.png +0 -0
- package/skills/figer_icon.aiimage/ref/figer.webp +0 -0
- package/skills/forest.aiimage/SKILL.md +74 -0
- package/skills/forest.aiimage/manifest.json +48 -0
- package/skills/fruit_tile.aiimage/SKILL.md +68 -0
- package/skills/fruit_tile.aiimage/manifest.json +48 -0
- package/skills/game_over_panel.aicomponent/SKILL.md +47 -0
- package/skills/game_over_panel.aicomponent/manifest.json +61 -0
- package/skills/game_over_panel.aicomponent/ref/GameOverPanel.ts +74 -0
- package/skills/game_scene.aicomponent/SKILL.md +57 -0
- package/skills/game_scene.aicomponent/manifest.json +36 -0
- package/skills/game_scene.aicomponent/ref/Game.ts +748 -0
- package/skills/gameplay_balance_check.aivalidator/SKILL.md +69 -0
- package/skills/gameplay_balance_check.aivalidator/manifest.json +21 -0
- package/skills/gameplay_unit_test.aivalidator/SKILL.md +89 -0
- package/skills/gameplay_unit_test.aivalidator/manifest.json +17 -0
- package/skills/gameplay_unit_test.aivalidator/ref/gameplay.test.ts +202 -0
- package/skills/gameplay_unit_test.aivalidator/ref/vitest.config.ts +13 -0
- package/skills/grid_board_layout.aicomponent/SKILL.md +85 -0
- package/skills/grid_board_layout.aicomponent/manifest.json +69 -0
- package/skills/grid_board_layout.aicomponent/ref/BoardLayout.ts +416 -0
- package/skills/grid_board_layout.aicomponent/ref/BoardLayout3D.ts +125 -0
- package/skills/grid_board_layout.aicomponent/ref/BoardLayoutMath.ts +85 -0
- package/skills/grid_board_layout.aicomponent/ref/BoardRenderer3D.ts +298 -0
- package/skills/heart_lives.aicomponent/SKILL.md +42 -0
- package/skills/heart_lives.aicomponent/manifest.json +25 -0
- package/skills/heart_lives.aicomponent/ref/HeartDisplay.ts +96 -0
- package/skills/idle-breathe.aicomponent/SKILL.md +27 -0
- package/skills/idle-breathe.aicomponent/manifest.json +20 -0
- package/skills/idle-breathe.aicomponent/ref/phaser.js +25 -0
- package/skills/idle-breathe.aicomponent/ref/playcanvas.js +29 -0
- package/skills/jewel_tile.aiimage/SKILL.md +63 -0
- package/skills/jewel_tile.aiimage/manifest.json +49 -0
- package/skills/knife_hit.aigameplay/SKILL.md +103 -0
- package/skills/knife_hit.aigameplay/manifest.json +151 -0
- package/skills/knife_hit.aigameplay/ref/pgs-schema.json +202 -0
- package/skills/knife_hit.aigameplay/ref/reducer.template.ts +196 -0
- package/skills/left_right_parkour.aigameplay/SKILL.md +120 -0
- package/skills/left_right_parkour.aigameplay/manifest.json +165 -0
- package/skills/left_right_parkour.aigameplay/ref/pgs-schema.json +200 -0
- package/skills/left_right_parkour.aigameplay/ref/reducer.template.ts +194 -0
- package/skills/level_data_pack.aiconfig/SKILL.md +64 -0
- package/skills/level_data_pack.aiconfig/manifest.json +37 -0
- package/skills/level_data_validator.aivalidator/SKILL.md +85 -0
- package/skills/level_data_validator.aivalidator/manifest.json +17 -0
- package/skills/level_data_validator.aivalidator/ref/LevelValidator.ts +113 -0
- package/skills/level_lifecycle.aicomponent/SKILL.md +81 -0
- package/skills/level_lifecycle.aicomponent/manifest.json +87 -0
- package/skills/level_lifecycle.aicomponent/ref/LevelLifecycle.ts +235 -0
- package/skills/level_solvability_validator.aivalidator/SKILL.md +74 -0
- package/skills/level_solvability_validator.aivalidator/manifest.json +23 -0
- package/skills/level_solvability_validator.aivalidator/ref/LevelValidator.ts +186 -0
- package/skills/level_state.aicomponent/SKILL.md +55 -0
- package/skills/level_state.aicomponent/manifest.json +34 -0
- package/skills/level_state.aicomponent/ref/LevelDataManager.ts +26 -0
- package/skills/level_state.aicomponent/ref/LevelManager.ts +26 -0
- package/skills/loading_screen.aicomponent/SKILL.md +57 -0
- package/skills/loading_screen.aicomponent/manifest.json +43 -0
- package/skills/loading_screen.aicomponent/ref/LoadingUI.ts +339 -0
- package/skills/lose_result_panel.aiimage/SKILL.md +58 -0
- package/skills/lose_result_panel.aiimage/manifest.json +47 -0
- package/skills/lose_result_panel.aiimage/ref/lose.png +0 -0
- package/skills/lose_result_panel.aiimage/ref/lose.webp +0 -0
- package/skills/lose_sfx.aiaudio/SKILL.md +59 -0
- package/skills/lose_sfx.aiaudio/manifest.json +45 -0
- package/skills/lose_sfx.aiaudio/ref/lose.mp3 +0 -0
- package/skills/match-pop.aicomponent/SKILL.md +29 -0
- package/skills/match-pop.aicomponent/manifest.json +19 -0
- package/skills/match-pop.aicomponent/ref/phaser.js +30 -0
- package/skills/match-pop.aicomponent/ref/playcanvas.js +22 -0
- package/skills/match3_core.aigameplay/SKILL.md +125 -0
- package/skills/match3_core.aigameplay/manifest.json +107 -0
- package/skills/match3_core.aigameplay/ref/pgs-schema.json +154 -0
- package/skills/match3_core.aigameplay/ref/reducer.template.ts +191 -0
- package/skills/match_engine.aicomponent/SKILL.md +84 -0
- package/skills/match_engine.aicomponent/manifest.json +23 -0
- package/skills/match_engine.aicomponent/ref/MatchEngine.ts +75 -0
- package/skills/memory_match.aigameplay/SKILL.md +111 -0
- package/skills/memory_match.aigameplay/manifest.json +164 -0
- package/skills/memory_match.aigameplay/ref/pgs-schema.json +190 -0
- package/skills/memory_match.aigameplay/ref/reducer.template.ts +162 -0
- package/skills/merge_core.aigameplay/SKILL.md +112 -0
- package/skills/merge_core.aigameplay/manifest.json +154 -0
- package/skills/merge_core.aigameplay/ref/pgs-schema.json +202 -0
- package/skills/merge_core.aigameplay/ref/reducer.template.ts +179 -0
- package/skills/mistake_sfx.aiaudio/SKILL.md +59 -0
- package/skills/mistake_sfx.aiaudio/manifest.json +45 -0
- package/skills/mistake_sfx.aiaudio/ref/mistake.mp3 +0 -0
- package/skills/nomove_hint_overlay.aiimage/SKILL.md +58 -0
- package/skills/nomove_hint_overlay.aiimage/manifest.json +48 -0
- package/skills/nomove_hint_overlay.aiimage/ref/nomove_hint.png +0 -0
- package/skills/nomove_hint_overlay.aiimage/ref/nomove_hint.webp +0 -0
- package/skills/normal_dot.aiimage/SKILL.md +58 -0
- package/skills/normal_dot.aiimage/manifest.json +46 -0
- package/skills/normal_dot.aiimage/ref/normal_dot.png +0 -0
- package/skills/normal_dot.aiimage/ref/normal_dot.webp +0 -0
- package/skills/ocean.aiimage/SKILL.md +71 -0
- package/skills/ocean.aiimage/manifest.json +49 -0
- package/skills/particle-confetti.aicomponent/SKILL.md +32 -0
- package/skills/particle-confetti.aicomponent/manifest.json +21 -0
- package/skills/particle-confetti.aicomponent/ref/html5-spritesheet.js +17 -0
- package/skills/particle-confetti.aicomponent/ref/phaser.js +38 -0
- package/skills/particle-explosion.aicomponent/SKILL.md +37 -0
- package/skills/particle-explosion.aicomponent/manifest.json +24 -0
- package/skills/particle-explosion.aicomponent/ref/html5-spritesheet.js +40 -0
- package/skills/particle-explosion.aicomponent/ref/phaser.js +46 -0
- package/skills/particle-explosion.aicomponent/ref/playcanvas.js +33 -0
- package/skills/particle-trail.aicomponent/SKILL.md +25 -0
- package/skills/particle-trail.aicomponent/manifest.json +22 -0
- package/skills/particle-trail.aicomponent/ref/phaser.js +31 -0
- package/skills/path_animation.aicomponent/SKILL.md +82 -0
- package/skills/path_animation.aicomponent/manifest.json +77 -0
- package/skills/path_animation.aicomponent/ref/AnimationManager.ts +694 -0
- package/skills/path_animation.aicomponent/ref/AnimationManager3D.ts +317 -0
- package/skills/path_elimination_rules.aigameplay/SKILL.md +88 -0
- package/skills/path_elimination_rules.aigameplay/manifest.json +119 -0
- package/skills/path_elimination_rules.aigameplay/ref/pgs-schema.json +227 -0
- package/skills/path_input_handler.aicomponent/SKILL.md +87 -0
- package/skills/path_input_handler.aicomponent/manifest.json +97 -0
- package/skills/path_input_handler.aicomponent/ref/InputHandler.ts +714 -0
- package/skills/path_input_handler.aicomponent/ref/InputHandler3D.ts +204 -0
- package/skills/path_renderer.aicomponent/SKILL.md +101 -0
- package/skills/path_renderer.aicomponent/manifest.json +69 -0
- package/skills/path_renderer.aicomponent/ref/PathRenderer.ts +509 -0
- package/skills/path_renderer.aicomponent/ref/PathRenderer3D.ts +176 -0
- package/skills/path_renderer.aicomponent/ref/PathRenderers.ts +640 -0
- package/skills/phaser.aicomponent/SKILL.md +315 -0
- package/skills/phaser.aicomponent/manifest.json +156 -0
- package/skills/phaser.aicomponent/ref/BootScene.ts +29 -0
- package/skills/phaser.aicomponent/ref/GameConfig.ts +29 -0
- package/skills/phaser.aicomponent/ref/GameScene.ts +88 -0
- package/skills/phaser.aicomponent/ref/PreloaderScene.ts +78 -0
- package/skills/phaser.aicomponent/ref/SceneKeys.ts +7 -0
- package/skills/phaser.aicomponent/ref/SoundUtils.ts +21 -0
- package/skills/phaser.aicomponent/ref/UiLayout.ts +74 -0
- package/skills/phaser.aicomponent/ref/globals.d.ts +52 -0
- package/skills/phaser.aicomponent/ref/index.css +40 -0
- package/skills/phaser.aicomponent/ref/index.html +14 -0
- package/skills/phaser.aicomponent/ref/index.ts +48 -0
- package/skills/phaser.aicomponent/ref/main.ts +16 -0
- package/skills/phaser.aicomponent/ref/package.json +22 -0
- package/skills/phaser.aicomponent/ref/tsconfig.json +25 -0
- package/skills/phaser.aicomponent/ref/webpack.config.js +57 -0
- package/skills/phaser_scene_lifecycle.aicomponent/SKILL.md +63 -0
- package/skills/phaser_scene_lifecycle.aicomponent/manifest.json +33 -0
- package/skills/pick_and_match_rules.aigameplay/SKILL.md +113 -0
- package/skills/pick_and_match_rules.aigameplay/manifest.json +121 -0
- package/skills/pick_and_match_rules.aigameplay/ref/pgs-schema.json +354 -0
- package/skills/pin_pull.aigameplay/SKILL.md +110 -0
- package/skills/pin_pull.aigameplay/manifest.json +164 -0
- package/skills/pin_pull.aigameplay/ref/pgs-schema.json +201 -0
- package/skills/pin_pull.aigameplay/ref/reducer.template.ts +216 -0
- package/skills/playable_app_logo.aiimage/SKILL.md +58 -0
- package/skills/playable_app_logo.aiimage/manifest.json +47 -0
- package/skills/playable_app_logo.aiimage/ref/logo.png +0 -0
- package/skills/playable_app_logo.aiimage/ref/logo.webp +0 -0
- package/skills/playable_end_screen_layout.aicomponent/SKILL.md +75 -0
- package/skills/playable_end_screen_layout.aicomponent/manifest.json +24 -0
- package/skills/playable_guidance_layer.aicomponent/SKILL.md +89 -0
- package/skills/playable_guidance_layer.aicomponent/manifest.json +24 -0
- package/skills/playable_hud_layout.aicomponent/SKILL.md +96 -0
- package/skills/playable_hud_layout.aicomponent/manifest.json +24 -0
- package/skills/playable_scripts_build.aicomponent/SKILL.md +69 -0
- package/skills/playable_scripts_build.aicomponent/manifest.json +53 -0
- package/skills/playable_scripts_build.aicomponent/ref/builds.config.js +257 -0
- package/skills/playcraft-3d-flip-sprite/SKILL.md +336 -0
- package/skills/playcraft-3d-flip-sprite/renderer/flatten_glb.mjs +62 -0
- package/skills/playcraft-3d-flip-sprite/renderer/render.mjs +325 -0
- package/skills/playcraft-3d-flip-sprite/renderer/render_single.mjs +138 -0
- package/skills/playcraft-asset-management/SKILL.md +73 -0
- package/skills/playcraft-audio-generation/SKILL.md +126 -0
- package/skills/playcraft-build/SKILL.md +44 -0
- package/skills/playcraft-code-editor/SKILL.md +71 -0
- package/skills/playcraft-create-remix/SKILL.md +62 -0
- package/skills/playcraft-deploy/SKILL.md +59 -0
- package/skills/playcraft-image-generation/SKILL.md +148 -0
- package/skills/playcraft-image-processing/SKILL.md +216 -0
- package/skills/playcraft-platform-intro/SKILL.md +41 -0
- package/skills/playcraft-prefab/SKILL.md +98 -0
- package/skills/playcraft-project-management/SKILL.md +57 -0
- package/skills/playcraft-remix-workflow/SKILL.md +119 -0
- package/skills/playcraft-remix-workflow/references/xplatform.schema.json5 +31 -0
- package/skills/playcraft-save/SKILL.md +46 -0
- package/skills/playcraft-skill-recommender/SKILL.md +152 -0
- package/skills/playcraft-sprite-generation/SKILL.md +534 -0
- package/skills/playcraft-sprite-remix/SKILL.md +155 -0
- package/skills/playcraft-sprite-sheet/SKILL.md +97 -0
- package/skills/playtest_report.aivalidator/SKILL.md +103 -0
- package/skills/playtest_report.aivalidator/manifest.json +21 -0
- package/skills/preloader_scene.aicomponent/SKILL.md +58 -0
- package/skills/preloader_scene.aicomponent/manifest.json +43 -0
- package/skills/preloader_scene.aicomponent/ref/Preloader.ts +339 -0
- package/skills/progress_bar.aicomponent/SKILL.md +38 -0
- package/skills/progress_bar.aicomponent/manifest.json +25 -0
- package/skills/progress_bar.aicomponent/ref/ProgressDisplay.ts +140 -0
- package/skills/references/xplatform.schema.json5 +31 -0
- package/skills/responsive_2d_layout.aicomponent/SKILL.md +161 -0
- package/skills/responsive_2d_layout.aicomponent/manifest.json +43 -0
- package/skills/responsive_2d_layout.aicomponent/ref/UiLayout.ts +56 -0
- package/skills/run_context_state.aicomponent/SKILL.md +54 -0
- package/skills/run_context_state.aicomponent/manifest.json +40 -0
- package/skills/run_context_state.aicomponent/ref/RunContextRuntime.ts +30 -0
- package/skills/score-fly.aicomponent/SKILL.md +31 -0
- package/skills/score-fly.aicomponent/manifest.json +21 -0
- package/skills/score-fly.aicomponent/ref/phaser.js +26 -0
- package/skills/score-fly.aicomponent/ref/playcanvas.js +28 -0
- package/skills/score_goal.aiconfig/SKILL.md +46 -0
- package/skills/score_goal.aiconfig/manifest.json +33 -0
- package/skills/screen-flash.aicomponent/SKILL.md +30 -0
- package/skills/screen-flash.aicomponent/manifest.json +20 -0
- package/skills/screen-flash.aicomponent/ref/phaser.js +48 -0
- package/skills/screen-shake.aicomponent/SKILL.md +30 -0
- package/skills/screen-shake.aicomponent/manifest.json +19 -0
- package/skills/screen-shake.aicomponent/ref/phaser.js +23 -0
- package/skills/screen-shake.aicomponent/ref/playcanvas.js +44 -0
- package/skills/screw_puzzle.aigameplay/SKILL.md +116 -0
- package/skills/screw_puzzle.aigameplay/manifest.json +164 -0
- package/skills/screw_puzzle.aigameplay/ref/pgs-schema.json +235 -0
- package/skills/screw_puzzle.aigameplay/ref/reducer.template.ts +213 -0
- package/skills/settings_state.aicomponent/SKILL.md +61 -0
- package/skills/settings_state.aicomponent/manifest.json +33 -0
- package/skills/settings_state.aicomponent/ref/SettingsManager.ts +130 -0
- package/skills/slide_out_to_tray_animation.aicomponent/SKILL.md +64 -0
- package/skills/slide_out_to_tray_animation.aicomponent/manifest.json +58 -0
- package/skills/slide_out_to_tray_animation.aicomponent/ref/AnimationManager.ts +164 -0
- package/skills/slide_out_to_tray_animation.aicomponent/ref/AnimationManager3D.ts +198 -0
- package/skills/slide_out_to_tray_animation.aicomponent/ref/BezierUtils.ts +59 -0
- package/skills/slot_machine.aigameplay/SKILL.md +119 -0
- package/skills/slot_machine.aigameplay/manifest.json +166 -0
- package/skills/slot_machine.aigameplay/ref/pgs-schema.json +212 -0
- package/skills/slot_machine.aigameplay/ref/reducer.template.ts +212 -0
- package/skills/sniper_shot.aigameplay/SKILL.md +84 -0
- package/skills/sniper_shot.aigameplay/manifest.json +153 -0
- package/skills/sniper_shot.aigameplay/ref/pgs-schema.json +211 -0
- package/skills/sniper_shot.aigameplay/ref/reducer.template.ts +211 -0
- package/skills/solitaire.aigameplay/SKILL.md +101 -0
- package/skills/solitaire.aigameplay/manifest.json +151 -0
- package/skills/solitaire.aigameplay/ref/pgs-schema.json +200 -0
- package/skills/solitaire.aigameplay/ref/reducer.template.ts +176 -0
- package/skills/sound-effects/SKILL.md +46 -0
- package/skills/sound_utils.aicomponent/SKILL.md +52 -0
- package/skills/sound_utils.aicomponent/manifest.json +30 -0
- package/skills/sound_utils.aicomponent/ref/SoundUtils.ts +29 -0
- package/skills/sprite-animation-2d.aicomponent/SKILL.md +45 -0
- package/skills/sprite-animation-2d.aicomponent/manifest.json +28 -0
- package/skills/sprite-animation-2d.aicomponent/ref/html5.js +83 -0
- package/skills/sprite-animation-2d.aicomponent/ref/phaser.js +38 -0
- package/skills/sprite-animation-2d.aicomponent/ref/playcanvas.js +67 -0
- package/skills/sprite_entity_renderer.aicomponent/SKILL.md +148 -0
- package/skills/sprite_entity_renderer.aicomponent/manifest.json +17 -0
- package/skills/sprite_entity_renderer.aicomponent/ref/SpriteEntityRenderer.ts +126 -0
- package/skills/success_sfx.aiaudio/SKILL.md +59 -0
- package/skills/success_sfx.aiaudio/manifest.json +45 -0
- package/skills/success_sfx.aiaudio/ref/success.mp3 +0 -0
- package/skills/tap_blast.aigameplay/SKILL.md +116 -0
- package/skills/tap_blast.aigameplay/manifest.json +153 -0
- package/skills/tap_blast.aigameplay/ref/pgs-schema.json +208 -0
- package/skills/tap_blast.aigameplay/ref/reducer.template.ts +202 -0
- package/skills/theme_state.aicomponent/SKILL.md +53 -0
- package/skills/theme_state.aicomponent/manifest.json +33 -0
- package/skills/theme_state.aicomponent/ref/ThemeManager.ts +174 -0
- package/skills/theme_switcher_build.aicomponent/SKILL.md +62 -0
- package/skills/theme_switcher_build.aicomponent/manifest.json +38 -0
- package/skills/theme_switcher_build.aicomponent/ref/theme-index.ts +8 -0
- package/skills/theme_variant.aiconfig/SKILL.md +78 -0
- package/skills/theme_variant.aiconfig/manifest.json +39 -0
- package/skills/theme_variant.aiconfig/ref/ExampleTheme/index.ts +16 -0
- package/skills/theme_variant.aiconfig/ref/ExampleTheme/levelEasy.json +141 -0
- package/skills/threejs.aicomponent/SKILL.md +422 -0
- package/skills/threejs.aicomponent/manifest.json +166 -0
- package/skills/threejs.aicomponent/ref/AssetLoader.ts +158 -0
- package/skills/threejs.aicomponent/ref/BaseScene.ts +88 -0
- package/skills/threejs.aicomponent/ref/GameConfig.ts +47 -0
- package/skills/threejs.aicomponent/ref/MainScene.ts +170 -0
- package/skills/threejs.aicomponent/ref/PreloaderScene.ts +93 -0
- package/skills/threejs.aicomponent/ref/SceneKeys.ts +6 -0
- package/skills/threejs.aicomponent/ref/SceneManager.ts +69 -0
- package/skills/threejs.aicomponent/ref/ViewportManager.ts +62 -0
- package/skills/threejs.aicomponent/ref/globals.d.ts +74 -0
- package/skills/threejs.aicomponent/ref/index.css +80 -0
- package/skills/threejs.aicomponent/ref/index.html +20 -0
- package/skills/threejs.aicomponent/ref/index.ts +117 -0
- package/skills/threejs.aicomponent/ref/main.ts +10 -0
- package/skills/threejs.aicomponent/ref/package.json +23 -0
- package/skills/threejs.aicomponent/ref/tsconfig.json +24 -0
- package/skills/threejs.aicomponent/ref/webpack.config.js +61 -0
- package/skills/time_clear_goal.aiconfig/SKILL.md +46 -0
- package/skills/time_clear_goal.aiconfig/manifest.json +32 -0
- package/skills/time_icon.aiimage/SKILL.md +58 -0
- package/skills/time_icon.aiimage/manifest.json +47 -0
- package/skills/time_icon.aiimage/ref/time.png +0 -0
- package/skills/time_icon.aiimage/ref/time.webp +0 -0
- package/skills/top_ui_bar.aicomponent/SKILL.md +45 -0
- package/skills/top_ui_bar.aicomponent/manifest.json +27 -0
- package/skills/top_ui_bar.aicomponent/ref/GameTopUI.ts +229 -0
- package/skills/tower_defence.aigameplay/SKILL.md +117 -0
- package/skills/tower_defence.aigameplay/manifest.json +175 -0
- package/skills/tower_defence.aigameplay/ref/pgs-schema.json +247 -0
- package/skills/tower_defence.aigameplay/ref/reducer.template.ts +239 -0
- package/skills/tray_container.aicomponent/SKILL.md +143 -0
- package/skills/tray_container.aicomponent/manifest.json +58 -0
- package/skills/tray_container.aicomponent/ref/TrayRenderer.ts +155 -0
- package/skills/tray_container.aicomponent/ref/TrayRenderer3D.ts +281 -0
- package/skills/tray_container.aicomponent/ref/TrayRendererHtmlOverlay.ts +228 -0
- package/skills/tutorial_overlay.aicomponent/SKILL.md +46 -0
- package/skills/tutorial_overlay.aicomponent/manifest.json +34 -0
- package/skills/tutorial_overlay.aicomponent/ref/TutorialManager.ts +367 -0
- package/skills/tween-animation-2d.aicomponent/SKILL.md +35 -0
- package/skills/tween-animation-2d.aicomponent/manifest.json +28 -0
- package/skills/tween-animation-2d.aicomponent/ref/phaser.js +49 -0
- package/skills/tween-animation-2d.aicomponent/ref/playcanvas.js +36 -0
- package/skills/typescript_module_patterns.aicomponent/SKILL.md +209 -0
- package/skills/typescript_module_patterns.aicomponent/manifest.json +28 -0
- package/skills/typescript_module_patterns.aicomponent/ref/globals.d.ts +31 -0
- package/skills/ui-transition.aicomponent/SKILL.md +33 -0
- package/skills/ui-transition.aicomponent/manifest.json +19 -0
- package/skills/ui-transition.aicomponent/ref/phaser.js +45 -0
- package/skills/ux_flow_spec.aiconfig/SKILL.md +82 -0
- package/skills/ux_flow_spec.aiconfig/manifest.json +39 -0
- package/skills/wave_difficulty.aiconfig/SKILL.md +46 -0
- package/skills/wave_difficulty.aiconfig/manifest.json +33 -0
- package/skills/webpack_build.aicomponent/SKILL.md +204 -0
- package/skills/webpack_build.aicomponent/manifest.json +29 -0
- package/skills/webpack_build.aicomponent/ref/package.json +16 -0
- package/skills/webpack_build.aicomponent/ref/webpack.config.js +53 -0
- package/skills/win_anim_sfx.aiaudio/SKILL.md +59 -0
- package/skills/win_anim_sfx.aiaudio/manifest.json +46 -0
- package/skills/win_anim_sfx.aiaudio/ref/win_anim.mp3 +0 -0
- package/skills/win_dot.aiimage/SKILL.md +58 -0
- package/skills/win_dot.aiimage/manifest.json +47 -0
- package/skills/win_dot.aiimage/ref/win_dot.png +0 -0
- package/skills/win_dot.aiimage/ref/win_dot.webp +0 -0
- package/skills/win_result_panel.aiimage/SKILL.md +58 -0
- package/skills/win_result_panel.aiimage/manifest.json +47 -0
- package/skills/win_result_panel.aiimage/ref/win.png +0 -0
- package/skills/win_result_panel.aiimage/ref/win.webp +0 -0
- package/skills/word_connect.aigameplay/SKILL.md +86 -0
- package/skills/word_connect.aigameplay/manifest.json +154 -0
- package/skills/word_connect.aigameplay/ref/pgs-schema.json +212 -0
- package/skills/word_connect.aigameplay/ref/reducer.template.ts +186 -0
- package/src/index.ts +10 -0
- package/src/skills.loader.ts +225 -0
- package/src/skills.types.ts +42 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: progress_bar.aicomponent
|
|
3
|
+
description: 关卡进度条。显示当前关卡已消除路径数/总路径数的比例,直观呈现关卡完成进度。
|
|
4
|
+
triggers: 需要显示关卡进度指示器时触发。
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 关卡进度条(Level Progress Bar)
|
|
8
|
+
|
|
9
|
+
## Scaffold
|
|
10
|
+
|
|
11
|
+
`src/game/scenes/GameUI/ProgressDisplay.ts`
|
|
12
|
+
|
|
13
|
+
## Recipe
|
|
14
|
+
|
|
15
|
+
| 决策 | 原因 |
|
|
16
|
+
|------|------|
|
|
17
|
+
| **已消除数/总数比例** | 进度条显示的是"完成了多少"而非剩余多少,正向激励玩家继续;比生命条更直观地传递关卡接近尾声的信息 |
|
|
18
|
+
| **独立于 LevelManager** | ProgressDisplay 只读取已消除路径数,不持有 LevelManager 引用;GameScene 负责同步,DisplayWidget 保持纯视觉 |
|
|
19
|
+
|
|
20
|
+
## Adapter
|
|
21
|
+
|
|
22
|
+
- **Role**: `levelProgressBar` — 关卡完成进度条 UI
|
|
23
|
+
- **Provides**: `ProgressDisplay` 类(更新进度百分比 + 渲染进度条)
|
|
24
|
+
- **Requires**: `phaser.aicomponent`(Graphics/Rectangle API)
|
|
25
|
+
- **Consumed by**: `top_ui_bar.aicomponent` 或 `game_scene.aicomponent`(在路径消除时调用 `update(removed, total)`)
|
|
26
|
+
- **Integration point**: `src/game/scenes/GameUI/ProgressDisplay.ts` → 顶部 UI 条或 GameScene 持有实例
|
|
27
|
+
|
|
28
|
+
## Skill Definition
|
|
29
|
+
|
|
30
|
+
```yaml
|
|
31
|
+
tools:
|
|
32
|
+
- read_file
|
|
33
|
+
- write_file
|
|
34
|
+
inputs:
|
|
35
|
+
- source: src/game/scenes/GameUI/ProgressDisplay.ts
|
|
36
|
+
outputs:
|
|
37
|
+
- progressDisplay: ProgressDisplay class
|
|
38
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"atomId": "progress_bar.aicomponent",
|
|
4
|
+
"bundleType": "aicomponent",
|
|
5
|
+
"category": "component",
|
|
6
|
+
"mode": "fixed",
|
|
7
|
+
"label": { "zh": "关卡进度条", "en": "Level progress bar" },
|
|
8
|
+
"tags": ["ui", "progress", "bar", "level-progress"],
|
|
9
|
+
"bindingRoles": ["progressBar"],
|
|
10
|
+
"scaffold": {
|
|
11
|
+
"files": {
|
|
12
|
+
"src/game/scenes/GameUI/ProgressDisplay.ts": { "source": "ref/ProgressDisplay.ts", "mode": "full", "weight": 10 }
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"imports": [
|
|
16
|
+
{ "slot": "engine", "pinAtomId": "phaser.aicomponent", "edgeKind": "requires", "bindAs": "engine" }
|
|
17
|
+
],
|
|
18
|
+
"exports": [
|
|
19
|
+
{ "name": "ProgressDisplay", "kind": "class", "location": "src/game/scenes/GameUI/ProgressDisplay.ts" }
|
|
20
|
+
],
|
|
21
|
+
"neutralDescriptor": {
|
|
22
|
+
"geometry": "horizontal progress bar showing ratio of eliminated paths to total paths in the current level"
|
|
23
|
+
},
|
|
24
|
+
"files": { "skill": "SKILL.md", "progressDisplay": "ref/ProgressDisplay.ts" }
|
|
25
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import * as Phaser from "phaser";
|
|
2
|
+
import { DigitRenderer } from "./DigitRenderer";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 进度百分比显示组件(LED / 七段数码管风格)。
|
|
6
|
+
* 显示一个3位数字后跟百分号(如 "42%")。
|
|
7
|
+
*/
|
|
8
|
+
export class ProgressDisplay {
|
|
9
|
+
private scene: Phaser.Scene;
|
|
10
|
+
private container: Phaser.GameObjects.Container;
|
|
11
|
+
private digitGraphics: Phaser.GameObjects.Graphics[] = [];
|
|
12
|
+
private digitWidth: number;
|
|
13
|
+
private digitHeight: number;
|
|
14
|
+
private digitSpacing: number;
|
|
15
|
+
private percentWidth: number;
|
|
16
|
+
private displayWidth: number;
|
|
17
|
+
private anchorLeftX: number;
|
|
18
|
+
|
|
19
|
+
constructor(
|
|
20
|
+
scene: Phaser.Scene,
|
|
21
|
+
parent: Phaser.GameObjects.Container,
|
|
22
|
+
options: {
|
|
23
|
+
xLeft: number;
|
|
24
|
+
y: number;
|
|
25
|
+
digitWidth: number;
|
|
26
|
+
digitHeight: number;
|
|
27
|
+
digitSpacing: number;
|
|
28
|
+
percentWidth: number;
|
|
29
|
+
},
|
|
30
|
+
) {
|
|
31
|
+
this.scene = scene;
|
|
32
|
+
this.digitWidth = options.digitWidth;
|
|
33
|
+
this.digitHeight = options.digitHeight;
|
|
34
|
+
this.digitSpacing = options.digitSpacing;
|
|
35
|
+
this.percentWidth = options.percentWidth;
|
|
36
|
+
this.anchorLeftX = options.xLeft;
|
|
37
|
+
|
|
38
|
+
// 3位数字 + 百分号
|
|
39
|
+
const totalWidth =
|
|
40
|
+
this.digitWidth * 3 + this.percentWidth + this.digitSpacing * 3;
|
|
41
|
+
this.displayWidth = totalWidth;
|
|
42
|
+
|
|
43
|
+
this.container = scene.add.container(
|
|
44
|
+
options.xLeft + totalWidth / 2,
|
|
45
|
+
options.y,
|
|
46
|
+
);
|
|
47
|
+
this.container.setSize(totalWidth, this.digitHeight);
|
|
48
|
+
parent.add(this.container);
|
|
49
|
+
|
|
50
|
+
let offsetX = -totalWidth / 2;
|
|
51
|
+
|
|
52
|
+
// 3个数字槽位
|
|
53
|
+
for (let i = 0; i < 3; i++) {
|
|
54
|
+
const g = scene.add.graphics();
|
|
55
|
+
g.setPosition(offsetX + this.digitWidth / 2, 0);
|
|
56
|
+
offsetX += this.digitWidth;
|
|
57
|
+
offsetX += this.digitSpacing;
|
|
58
|
+
this.digitGraphics.push(g);
|
|
59
|
+
this.container.add(g);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// 百分号
|
|
63
|
+
const percentG = scene.add.graphics();
|
|
64
|
+
percentG.setPosition(offsetX + this.percentWidth / 2, 0);
|
|
65
|
+
this.digitGraphics.push(percentG);
|
|
66
|
+
this.container.add(percentG);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 更新容器位置,使第一个可见数字与图标对齐。
|
|
71
|
+
* 前导空白数字会将容器向左偏移。
|
|
72
|
+
* @param percent 百分比值
|
|
73
|
+
*/
|
|
74
|
+
private updatePosition(percent: number): void {
|
|
75
|
+
let leadingBlanks = 0;
|
|
76
|
+
if (percent < 100) {
|
|
77
|
+
leadingBlanks += 1;
|
|
78
|
+
}
|
|
79
|
+
if (percent < 10) {
|
|
80
|
+
leadingBlanks += 1;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const blankWidth = leadingBlanks * (this.digitWidth + this.digitSpacing);
|
|
84
|
+
this.container.x = this.anchorLeftX - blankWidth + this.displayWidth / 2;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* 根据已消除/总数更新进度显示。
|
|
89
|
+
* @param removed 已消除的路径数
|
|
90
|
+
* @param total 总路径数
|
|
91
|
+
*/
|
|
92
|
+
public updateProgress(removed: number, total: number): void {
|
|
93
|
+
if (!this.container || this.digitGraphics.length < 4) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
let percent = 0;
|
|
98
|
+
if (total > 0) {
|
|
99
|
+
percent = Math.floor((removed / total) * 100);
|
|
100
|
+
}
|
|
101
|
+
percent = Math.max(0, Math.min(100, percent));
|
|
102
|
+
|
|
103
|
+
this.updatePosition(percent);
|
|
104
|
+
|
|
105
|
+
const color = 0x50536b;
|
|
106
|
+
const digitWidth = this.digitWidth;
|
|
107
|
+
const digitHeight = this.digitHeight;
|
|
108
|
+
|
|
109
|
+
const hundreds = percent >= 100 ? 1 : -1;
|
|
110
|
+
const tens = percent >= 10 ? Math.floor((percent % 100) / 10) : -1;
|
|
111
|
+
const ones = percent % 10;
|
|
112
|
+
|
|
113
|
+
// 百位
|
|
114
|
+
DigitRenderer.drawDigit(
|
|
115
|
+
this.digitGraphics[0],
|
|
116
|
+
hundreds,
|
|
117
|
+
color,
|
|
118
|
+
digitWidth,
|
|
119
|
+
digitHeight,
|
|
120
|
+
);
|
|
121
|
+
// 十位
|
|
122
|
+
DigitRenderer.drawDigit(
|
|
123
|
+
this.digitGraphics[1],
|
|
124
|
+
tens,
|
|
125
|
+
color,
|
|
126
|
+
digitWidth,
|
|
127
|
+
digitHeight,
|
|
128
|
+
);
|
|
129
|
+
// 个位
|
|
130
|
+
DigitRenderer.drawDigit(
|
|
131
|
+
this.digitGraphics[2],
|
|
132
|
+
ones,
|
|
133
|
+
color,
|
|
134
|
+
digitWidth,
|
|
135
|
+
digitHeight,
|
|
136
|
+
);
|
|
137
|
+
// 百分号
|
|
138
|
+
DigitRenderer.drawPercentSign(this.digitGraphics[3], color, digitHeight);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"title": "平台私有metadata字段协议",
|
|
5
|
+
"description": "描述PlayCraft平台渲染各字段表单时的辅助数据结构",
|
|
6
|
+
"required": [
|
|
7
|
+
],
|
|
8
|
+
"properties": {
|
|
9
|
+
"value_type": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"const": "path",
|
|
12
|
+
"description": "可选字段,值类型标识。例如 所描述的目标字段若表示文件路径,例如 value: ./assets/xxx.png,则可以添加 value_type: path 用于平台识别后使用文件解析器处理该目标字段",
|
|
13
|
+
"examples": [
|
|
14
|
+
"path"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"mime_type": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "可选字段,所描述的目标字段若表示文件/文件路径时可以使用。用于指定文件格式,遵循 MIME 规范",
|
|
20
|
+
"examples": [
|
|
21
|
+
"image/png",
|
|
22
|
+
"image/jpeg",
|
|
23
|
+
"image/gif",
|
|
24
|
+
"image/webp",
|
|
25
|
+
"audio/mpeg",
|
|
26
|
+
"application/json"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"additionalProperties": false
|
|
31
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: responsive_2d_layout.aicomponent
|
|
3
|
+
description: 2D 可玩 UI 布局规范(框架无关)+ 本仓库默认的 Phaser 参考实现。规范定义设计分辨率、uiScale/vScale 与不变量;ref/UiLayout.ts 为 Phaser 绑定,非 Phaser 运行时需按同一公式实现等价逻辑。
|
|
4
|
+
triggers: 需要为试玩或 2D UI 做跨屏适配、从设计稿坐标换算到运行时坐标、或统一 UI 缩放规则时触发。
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 2D 自适应布局(Responsive 2D Layout)
|
|
8
|
+
|
|
9
|
+
本 skill 分两层:
|
|
10
|
+
|
|
11
|
+
1. **布局规范(Layout Canon)**:与具体引擎无关;Agent **必须先理解并遵守**,在任何运行时(Phaser、Canvas、DOM、其他)中复用同一套数学与约束。
|
|
12
|
+
2. **Phaser 参考实现**:本仓库提供的默认代码骨架;若项目使用其他引擎,**不得删改规范公式**,只替换「从哪里读取 width/height」的绑定层。
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 一、框架无关:布局规范(Layout Canon)
|
|
17
|
+
|
|
18
|
+
### 1.1 坐标系与设计空间
|
|
19
|
+
|
|
20
|
+
- **设计稿(Design space)**:固定基准宽 \(W_d\) × 高 \(H_d\)(本系列 skill 约定默认 **750 × 1334**,竖屏可_play 常用;可按项目替换,但须在配置中单点定义)。
|
|
21
|
+
- **原点**:画布左上角为 \((0,0)\),**x 向右、y 向下**(与常见 2D 画布一致)。
|
|
22
|
+
- **设计像素**:UI 稿上的数值(间距、字号、图标边长)均以设计空间中的 **dp**(design px)理解,记为无单位实数,与 \(W_d, H_d\) 同量纲。
|
|
23
|
+
|
|
24
|
+
### 1.2 运行时视口
|
|
25
|
+
|
|
26
|
+
- **运行时布局宽高** \(W_r, H_r\):Agent 必须从当前「用于摆放 UI 的矩形」读出——在 Phaser 中通常是主摄像机在 **Scale 模式生效后** 的宽高;在 DOM 中可以是根容器 clientWidth/Height;原则一致:**与最终绘制/点击检测使用同一坐标系**。
|
|
27
|
+
- **不规定** 如何实现全屏或 HiDPI(devicePixelRatio、内部渲染倍数由引擎 skill 决定)。规范只要求:用于布局公式的 \(W_r, H_r\) 与 **UI 摆放/命中** 一致。
|
|
28
|
+
|
|
29
|
+
### 1.3 缩放系数(必须按此定义)
|
|
30
|
+
|
|
31
|
+
令:
|
|
32
|
+
|
|
33
|
+
\[
|
|
34
|
+
\text{scaleX} = W_r / W_d,\quad \text{scaleY} = H_r / H_d
|
|
35
|
+
\]
|
|
36
|
+
|
|
37
|
+
- **uiScale**(整体 UI 可取的最小维缩放,且夹断):
|
|
38
|
+
|
|
39
|
+
\[
|
|
40
|
+
\text{rawUiScale} = \min(\text{scaleX}, \text{scaleY}),\quad
|
|
41
|
+
\text{uiScale} = \mathrm{clamp}(\text{rawUiScale}, \text{minScale}, \text{maxScale})
|
|
42
|
+
\]
|
|
43
|
+
|
|
44
|
+
其中 `minScale`、`maxScale` 为项目配置(默认可沿用 `GameConfig`:0.7~1.4),**须在单点配置中可调,禁止在组件内各自写死缩放**。
|
|
45
|
+
|
|
46
|
+
- **vScale**(仅随高度变化,用于「贴底 / 贴顶」等垂向比例):
|
|
47
|
+
|
|
48
|
+
\[
|
|
49
|
+
\text{vScale} = \text{scaleY} = H_r / H_d
|
|
50
|
+
\]
|
|
51
|
+
|
|
52
|
+
- **中心点**(运行时像素):
|
|
53
|
+
|
|
54
|
+
\[
|
|
55
|
+
\text{centerX} = W_r / 2,\quad \text{centerY} = H_r / 2
|
|
56
|
+
\]
|
|
57
|
+
|
|
58
|
+
### 1.4 从设计量到运行时的映射(约定)
|
|
59
|
+
|
|
60
|
+
Agent 布置控件时应**统一**使用下列规则(除非本规范另有说明):
|
|
61
|
+
|
|
62
|
+
- **以设计稿为单位的宽高、圆角、描边粗细、图标边长**(各向同性缩放需求):乘以 **uiScale**。
|
|
63
|
+
- **距屏幕上/下边的垂直距离**(设计稿中从底边向上的距离):用 **vScale** 换算,例如距底 `80` dp → 运行时 `y = H_r - 80 * vScale`(锚点策略与具体引擎 API 由实现决定,**换算系数必须是 vScale**)。
|
|
64
|
+
- **居中偏移**:相对中心的水平/垂直偏移,优先用 `centerX/centerY` 加 **设计偏移 × uiScale**(与项目现有代码一致)。
|
|
65
|
+
|
|
66
|
+
### 1.5 布局不变量(跨引擎)
|
|
67
|
+
|
|
68
|
+
- **单一真理来源**:每个画面/场景一次计算 \(W_r, H_r, \text{uiScale}, \text{vScale}, \text{centerX}, \text{centerY}\),**全屏 UI 共用**;禁止部分组件自行 `innerWidth/字体模糊估算` 另起一套比例。
|
|
69
|
+
- **棋盘 / 世界内容**:可与 UI 分层;若棋盘 skill 依赖「可用区域高度(扣除顶栏/底栏)」,扣除量须用 **设计稿高度常量 × vScale** 或 **运行时像素** 明确统一,并与本规范中的 \(W_r, H_r\) 一致。
|
|
70
|
+
- **安全区 / 刘海**:若需适配,**先**得到有效 \(W_r', H_r'\)( inset 后的矩形),再**代入以上公式**替换 \(W_r, H_r\);公式不变。
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 二、Agent 执行要点(与引擎无关)
|
|
75
|
+
|
|
76
|
+
1. 读取规范第一节,确认项目的 \(W_d, H_d\) 与 `minScale`/`maxScale` 数据源(如 `GameConfig`)。
|
|
77
|
+
2. 在目标运行时实现或调用与 **1.3 节公式等价** 的函数,得到 `uiScale`、`vScale`、`centerX`、`centerY`。
|
|
78
|
+
3. 所有 2D UI 字号、边距、控件尺寸除非特例,均通过 **dp × uiScale** 或 **dp × vScale(垂向边距)** 导出;**禁止** 混用未夹断的 `scaleX` 作为「整体 UI 缩放」以免扁长屏拉伸失调。
|
|
79
|
+
4. 若运行时不是 Phaser:**不要**复制粘贴 Phaser 类型;保留输入为「宽、高 + 配置」、输出为「上述系数与中心点」的纯函数即可。
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 三、Phaser 参考实现(本仓库默认)
|
|
84
|
+
|
|
85
|
+
`ref/UiLayout.ts` 中的 `computeUiLayout(sceneOrCamera, config?)` 即为 **1.3 节** 的 Phaser 绑定:`width/height` 取自主摄像机,`config` 默认 `GameConfig`。
|
|
86
|
+
|
|
87
|
+
### Scaffold
|
|
88
|
+
|
|
89
|
+
| 目标路径 | 来源 | 说明 |
|
|
90
|
+
|---------|-----|-----|
|
|
91
|
+
| `src/game/utils/UiLayout.ts` | `ref/UiLayout.ts` | `computeUiLayout()` + 类型定义 |
|
|
92
|
+
|
|
93
|
+
### Imports
|
|
94
|
+
|
|
95
|
+
- `phaser.aicomponent`(硬依赖:从 `Phaser.Scene` / `Camera` 取宽高)
|
|
96
|
+
|
|
97
|
+
### Skill Definition
|
|
98
|
+
|
|
99
|
+
```yaml
|
|
100
|
+
tools:
|
|
101
|
+
- read_file
|
|
102
|
+
- write_file
|
|
103
|
+
inputs:
|
|
104
|
+
- source: src/game/utils/UiLayout.ts
|
|
105
|
+
outputs:
|
|
106
|
+
- computeUiLayout: function computing responsive UI scale parameters
|
|
107
|
+
- UiLayoutConfig: interface
|
|
108
|
+
- UiLayoutResult: interface
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 使用示例(Phaser)
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
import { computeUiLayout } from '../utils/UiLayout';
|
|
115
|
+
|
|
116
|
+
// 在 Phaser Scene.create() 中
|
|
117
|
+
const { width, height, uiScale, vScale, centerX, centerY } = computeUiLayout(this);
|
|
118
|
+
|
|
119
|
+
// UI 元素定位示例(与第一节规范一致)
|
|
120
|
+
const buttonY = height - 80 * vScale; // 距底 80 dp
|
|
121
|
+
const iconSize = 48 * uiScale; // 边长 48 dp 的图标
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## 四、与引擎 skill 的关系
|
|
127
|
+
|
|
128
|
+
- **`phaser.aicomponent`**:负责画布分辨率、Scale 模式、HiDPR 等 **引擎层** 行为;**UI 逻辑坐标**仍须服从本 skill **第一节** 的 \(W_r, H_r\) 定义(与主摄像机一致)。
|
|
129
|
+
- **`grid_board_layout.aicomponent`**:棋盘几何在已扣除 HUD 的可用区域内计算;所用 **\(W_r, H_r\) 与 uiScale/vScale** 须与本规范一致,避免棋盘与 UI 两套比例。
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Recipe
|
|
134
|
+
|
|
135
|
+
| 决策 | 原因 |
|
|
136
|
+
|------|------|
|
|
137
|
+
| **规范与实现分离** | Layout Canon(第一节)与引擎无关;若与 `phaser.aicomponent` 合并,则 Three.js 或 DOM 项目无法复用布局数学 |
|
|
138
|
+
| **数学符号表述** | 用 LaTeX 公式明确定义 uiScale/vScale 计算式,消除 Agent 对"缩放"语义的歧义(clamp 边界、最小维优先等) |
|
|
139
|
+
| **vScale 独立于 uiScale** | 垂向间距随高度变化,水平内容随最小维变化,两者不可混用;独立命名强制 Agent 正确选择换算系数 |
|
|
140
|
+
| **单点配置原则** | minScale/maxScale 从 GameConfig 读取,禁止各组件内写死,保证全局一致性 |
|
|
141
|
+
|
|
142
|
+
## Adapter
|
|
143
|
+
|
|
144
|
+
- **Role**: `responsiveLayout` — 2D UI 自适应布局规范(Canon)及 Phaser 参考实现
|
|
145
|
+
- **Provides**: 布局数学规范文档(引擎无关)、`computeUiLayout()` Phaser 绑定实现、`UiLayoutResult` 接口类型
|
|
146
|
+
- **Requires**: `phaser.aicomponent`(Phaser 绑定层硬依赖;规范层本身无运行时依赖)
|
|
147
|
+
- **Consumed by**: `grid_board_layout.aicomponent`、`top_ui_bar.aicomponent`、`bottom_ui_bar.aicomponent`、`playable_hud_layout.aicomponent`、`playable_end_screen_layout.aicomponent` 等所有涉及 UI 坐标换算的 skill
|
|
148
|
+
- **Integration point**: `src/game/utils/UiLayout.ts` —— 所有 Phaser Scene 在 `create()` 中调用 `computeUiLayout(this)` 获取布局参数
|
|
149
|
+
|
|
150
|
+
## 五、屏幕分区与分层(引专用规范 skill)
|
|
151
|
+
|
|
152
|
+
以下 skill **不重复** 推导 uiScale/vScale,仅在 **本第一节** 之上约定 **顶/底/棋盘/指引/结算** 的合同:
|
|
153
|
+
|
|
154
|
+
| skill | 内容 |
|
|
155
|
+
|-------|------|
|
|
156
|
+
| `playable_hud_layout.aicomponent` | HUD 顶/底区与中间 playable 区域高度扣减、相对 z-order |
|
|
157
|
+
| `playable_end_screen_layout.aicomponent` | 全屏结算:遮罩、主视觉安全区、主/次 CTA 锚点 |
|
|
158
|
+
| `playable_guidance_layer.aicomponent` | 指引层:遮罩/挖洞/手指缩放、与 HUD 及结算的深度关系 |
|
|
159
|
+
| `bottom_ui_bar.aicomponent` | (Phaser)底栏占位与 `GAME_BOTTOM_UI_BAR_HEIGHT` 与 `GameConfig` 对齐 |
|
|
160
|
+
|
|
161
|
+
Agent 处理 HUD / 结算 / 指引时 **应加载** 对应规范 skill,再落地到具体 `aicomponent` 代码。
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"atomId": "responsive_2d_layout.aicomponent",
|
|
4
|
+
"bundleType": "aicomponent",
|
|
5
|
+
"category": "layout",
|
|
6
|
+
"mode": "fixed",
|
|
7
|
+
"label": { "zh": "2D 自适应布局", "en": "Responsive 2D layout" },
|
|
8
|
+
"tags": ["layout", "responsive", "scale", "design-size", "ui-scale", "phaser", "layout-canon", "framework-agnostic"],
|
|
9
|
+
"bindingRoles": ["responsiveLayout"],
|
|
10
|
+
"scaffold": {
|
|
11
|
+
"files": {
|
|
12
|
+
"src/game/utils/UiLayout.ts": {
|
|
13
|
+
"source": "ref/UiLayout.ts",
|
|
14
|
+
"mode": "full",
|
|
15
|
+
"weight": 10
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"imports": [
|
|
20
|
+
{ "slot": "engine", "pinAtomId": "phaser.aicomponent", "edgeKind": "requires", "bindAs": "engine" }
|
|
21
|
+
],
|
|
22
|
+
"exports": [
|
|
23
|
+
{ "name": "computeUiLayout", "kind": "function", "location": "src/game/utils/UiLayout.ts" },
|
|
24
|
+
{ "name": "UiLayoutConfig", "kind": "interface", "location": "src/game/utils/UiLayout.ts" },
|
|
25
|
+
{ "name": "UiLayoutResult", "kind": "interface", "location": "src/game/utils/UiLayout.ts" }
|
|
26
|
+
],
|
|
27
|
+
"neutralDescriptor": {
|
|
28
|
+
"geometry": "framework-agnostic layout canon: design WxH, viewport Wr/Hr, uiScale = clamp(min(scaleX,scaleY), minScale, maxScale), vScale = scaleY; Phaser ref in ref/UiLayout.ts",
|
|
29
|
+
"layers": ["coordinate-system", "scaling", "layout-math", "design-tokens"],
|
|
30
|
+
"replaceable": ["base design resolution", "min/max scale bounds", "engine adapter"]
|
|
31
|
+
},
|
|
32
|
+
"usageHints": [
|
|
33
|
+
"先读 SKILL.md 第一节 Layout Canon:公式与引擎无关,任何运行时都应复用同一套 uiScale/vScale 定义",
|
|
34
|
+
"默认设计稿 750×1334;uiScale = clamp(min(Wr/Wd, Hr/Hd), minScale, maxScale);vScale = Hr/Hd",
|
|
35
|
+
"同一画面只算一次布局系数,全 UI 共用;安全区先缩小 Wr/Hr 再代入公式",
|
|
36
|
+
"Phaser 项目用 computeUiLayout(scene);非 Phaser 实现等价纯函数,禁止仅复制 Phaser 类型",
|
|
37
|
+
"GameConfig.baseWidth/Height/minScale/maxScale 可覆盖默认值"
|
|
38
|
+
],
|
|
39
|
+
"files": {
|
|
40
|
+
"skill": "SKILL.md",
|
|
41
|
+
"uiLayout": "ref/UiLayout.ts"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as Phaser from 'phaser';
|
|
2
|
+
import { GameConfig } from '../GameConfig';
|
|
3
|
+
|
|
4
|
+
export interface UiLayoutConfig {
|
|
5
|
+
baseWidth?: number;
|
|
6
|
+
baseHeight?: number;
|
|
7
|
+
minScale?: number;
|
|
8
|
+
maxScale?: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface UiLayoutResult {
|
|
12
|
+
camera: Phaser.Cameras.Scene2D.Camera;
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
uiScale: number;
|
|
16
|
+
vScale: number;
|
|
17
|
+
centerX: number;
|
|
18
|
+
centerY: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 实现 `responsive_2d_layout.aicomponent` SKILL.md 第一节 Layout Canon(Phaser 绑定)。
|
|
23
|
+
* 统一计算基于 750x1334 设计稿的 UI 适配参数。
|
|
24
|
+
*
|
|
25
|
+
* - uiScale: 以宽高比例中较小值为基准,并限制在 [minScale, maxScale]
|
|
26
|
+
* - vScale: 仅基于高度的缩放系数,用于纵向坐标(设计稿 Y * vScale)
|
|
27
|
+
*/
|
|
28
|
+
export function computeUiLayout(
|
|
29
|
+
sceneOrCamera: Phaser.Scene | Phaser.Cameras.Scene2D.Camera,
|
|
30
|
+
config: UiLayoutConfig = GameConfig,
|
|
31
|
+
): UiLayoutResult {
|
|
32
|
+
const camera =
|
|
33
|
+
sceneOrCamera instanceof Phaser.Scene
|
|
34
|
+
? sceneOrCamera.cameras.main
|
|
35
|
+
: sceneOrCamera;
|
|
36
|
+
|
|
37
|
+
const { width, height } = camera;
|
|
38
|
+
|
|
39
|
+
const baseWidth = config.baseWidth ?? 750;
|
|
40
|
+
const baseHeight = config.baseHeight ?? 1334;
|
|
41
|
+
|
|
42
|
+
const scaleX = width / baseWidth;
|
|
43
|
+
const scaleY = height / baseHeight;
|
|
44
|
+
|
|
45
|
+
const minScale = config.minScale ?? 0.7;
|
|
46
|
+
const maxScale = config.maxScale ?? 1.4;
|
|
47
|
+
|
|
48
|
+
const rawUiScale = Math.min(scaleX, scaleY);
|
|
49
|
+
const uiScale = Phaser.Math.Clamp(rawUiScale, minScale, maxScale);
|
|
50
|
+
const vScale = scaleY;
|
|
51
|
+
|
|
52
|
+
const centerX = width * 0.5;
|
|
53
|
+
const centerY = height * 0.5;
|
|
54
|
+
|
|
55
|
+
return { camera, width, height, uiScale, vScale, centerX, centerY };
|
|
56
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: run_context_state.aicomponent
|
|
3
|
+
description: 运行上下文状态(全局单例)。区分当前运行模式(normal 正常闯关 vs test 测试预览),测试模式下提供自定义关卡数据,影响是否更新关卡进度。
|
|
4
|
+
triggers: 需要区分正式运行和测试/预览模式、注入自定义测试关卡时触发。
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 运行上下文状态(Run Context State)
|
|
8
|
+
|
|
9
|
+
## 说明
|
|
10
|
+
|
|
11
|
+
`RunContextRuntime` 是一个模块级全局单例,存储当前运行上下文:
|
|
12
|
+
|
|
13
|
+
- `null`:正常游戏模式
|
|
14
|
+
- `{ mode: "test", raw, displayName }`:测试/预览模式,使用自定义关卡数据
|
|
15
|
+
|
|
16
|
+
`RunFlags.affectsProgression` 控制本次运行是否更新关卡进度。
|
|
17
|
+
|
|
18
|
+
## Scaffold
|
|
19
|
+
|
|
20
|
+
| 目标路径 | 来源 |
|
|
21
|
+
|---------|-----|
|
|
22
|
+
| `src/game/run/RunContextRuntime.ts` | `ref/RunContextRuntime.ts` |
|
|
23
|
+
|
|
24
|
+
## Skill Definition
|
|
25
|
+
|
|
26
|
+
```yaml
|
|
27
|
+
tools:
|
|
28
|
+
- read_file
|
|
29
|
+
- write_file
|
|
30
|
+
inputs:
|
|
31
|
+
- source: src/game/run/RunContextRuntime.ts
|
|
32
|
+
outputs:
|
|
33
|
+
- runContext: setActiveRunContext / getActiveRunContext / clearActiveRunContext functions
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Recipe
|
|
37
|
+
|
|
38
|
+
| 决策 | 原因 |
|
|
39
|
+
|------|------|
|
|
40
|
+
| **模块级单例而非类实例** | 运行上下文是全局唯一的;模块级变量比单例类更简洁,且在 ESM 中天然保证唯一性 |
|
|
41
|
+
| **null 表示正常模式** | 默认值 null 意味着"不需要特殊处理",减少正常游戏路径中的条件判断 |
|
|
42
|
+
| **`affectsProgression` 独立标志** | 测试模式下不应更新关卡进度,但并非所有非正常模式都不更新;独立标志使语义更精确 |
|
|
43
|
+
|
|
44
|
+
## Adapter
|
|
45
|
+
|
|
46
|
+
- **Role**: `runContextState` — 运行上下文全局单例(正常游戏 vs 测试预览模式)
|
|
47
|
+
- **Provides**: `setActiveRunContext()`、`getActiveRunContext()`、`clearActiveRunContext()` 函数,`RunFlags.affectsProgression` 标志
|
|
48
|
+
- **Requires**: 无(纯模块级单例,无运行时依赖)
|
|
49
|
+
- **Consumed by**: `level_state.aicomponent`(读取 `affectsProgression` 决定是否更新关卡进度)、调试/预览工具(注入 `{mode:"test", raw, displayName}`)
|
|
50
|
+
- **Integration point**: `src/game/run/RunContextRuntime.ts` —— 游戏启动时由外部工具或 URL 参数注入测试关卡
|
|
51
|
+
|
|
52
|
+
## Imports
|
|
53
|
+
|
|
54
|
+
无(纯模块级单例,不依赖其他 skill)。
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"atomId": "run_context_state.aicomponent",
|
|
4
|
+
"bundleType": "aicomponent",
|
|
5
|
+
"category": "state",
|
|
6
|
+
"mode": "fixed",
|
|
7
|
+
"label": { "zh": "运行上下文状态", "en": "Run context state" },
|
|
8
|
+
"tags": ["state", "run-context", "test-mode", "preview", "debug"],
|
|
9
|
+
"bindingRoles": ["runContext"],
|
|
10
|
+
"scaffold": {
|
|
11
|
+
"files": {
|
|
12
|
+
"src/game/run/RunContextRuntime.ts": {
|
|
13
|
+
"source": "ref/RunContextRuntime.ts",
|
|
14
|
+
"mode": "full",
|
|
15
|
+
"weight": 10
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"imports": [],
|
|
20
|
+
"exports": [
|
|
21
|
+
{ "name": "setActiveRunContext", "kind": "function", "location": "src/game/run/RunContextRuntime.ts" },
|
|
22
|
+
{ "name": "getActiveRunContext", "kind": "function", "location": "src/game/run/RunContextRuntime.ts" },
|
|
23
|
+
{ "name": "clearActiveRunContext", "kind": "function", "location": "src/game/run/RunContextRuntime.ts" },
|
|
24
|
+
{ "name": "ActiveRunContext", "kind": "type", "location": "src/game/run/RunContextRuntime.ts" },
|
|
25
|
+
{ "name": "RunFlags", "kind": "type", "location": "src/game/run/RunContextRuntime.ts" }
|
|
26
|
+
],
|
|
27
|
+
"neutralDescriptor": {
|
|
28
|
+
"geometry": "global singleton storing the current run mode (normal vs test) and optional test level data, affecting game progression behavior",
|
|
29
|
+
"layers": ["debug-runtime", "test-mode-gate"]
|
|
30
|
+
},
|
|
31
|
+
"usageHints": [
|
|
32
|
+
"test 模式下游戏使用 RunContext 中提供的自定义关卡数据,不影响正式关卡进度",
|
|
33
|
+
"affectsProgression: false 的 run 不会更新 LevelManager 的进度",
|
|
34
|
+
"仅在编辑器/预览场景中写入;游戏场景只读"
|
|
35
|
+
],
|
|
36
|
+
"files": {
|
|
37
|
+
"skill": "SKILL.md",
|
|
38
|
+
"runContextRuntime": "ref/RunContextRuntime.ts"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { RawLevelJson } from "../levels/LevelTypes";
|
|
2
|
+
|
|
3
|
+
export type ActiveRunContext = {
|
|
4
|
+
mode: "test";
|
|
5
|
+
raw: RawLevelJson;
|
|
6
|
+
displayName: string;
|
|
7
|
+
} | null;
|
|
8
|
+
|
|
9
|
+
export type RunKind = "normal" | "test";
|
|
10
|
+
|
|
11
|
+
export type RunFlags = {
|
|
12
|
+
kind: RunKind;
|
|
13
|
+
affectsProgression: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
let activeRunContext: ActiveRunContext = null;
|
|
17
|
+
|
|
18
|
+
export function setActiveRunContext(
|
|
19
|
+
payload: Exclude<ActiveRunContext, null>,
|
|
20
|
+
): void {
|
|
21
|
+
activeRunContext = payload;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function getActiveRunContext(): ActiveRunContext {
|
|
25
|
+
return activeRunContext;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function clearActiveRunContext(): void {
|
|
29
|
+
activeRunContext = null;
|
|
30
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# score-fly — Score Fly-Up Animation
|
|
2
|
+
|
|
3
|
+
Displays a floating score popup that rises and fades out. Provides instant feedback for score gains, combos, or bonuses.
|
|
4
|
+
|
|
5
|
+
## Animation Sequence
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
0ms: Create score text at match position, scale 0
|
|
9
|
+
0→120ms: Scale in 0→1.2 (elastic punch)
|
|
10
|
+
120ms: Scale settle 1.2→1.0
|
|
11
|
+
120→800ms: Float up + fade out
|
|
12
|
+
800ms: Destroy text object
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
| Parameter | Default | Description |
|
|
18
|
+
|-----------|---------|-------------|
|
|
19
|
+
| `text` | required | Score string: "+100", "COMBO!", "×3" |
|
|
20
|
+
| `flyHeight` | 60px | Distance to float upward |
|
|
21
|
+
| `duration` | 800ms | Total animation time |
|
|
22
|
+
| `color` | "#FFD700" | Text color (gold by default) |
|
|
23
|
+
| `fontSize` | 32px | Text size |
|
|
24
|
+
| `x`, `y` | required | Screen position to spawn at |
|
|
25
|
+
|
|
26
|
+
## Common Patterns
|
|
27
|
+
|
|
28
|
+
- Score gain: `"+100"` in gold
|
|
29
|
+
- Combo multiplier: `"×3 COMBO!"` in orange
|
|
30
|
+
- Perfect: `"PERFECT!"` in rainbow gradient
|
|
31
|
+
- Time bonus: `"+5s"` in blue
|