@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,235 @@
|
|
|
1
|
+
import * as Phaser from "phaser";
|
|
2
|
+
import { GameOverPanel } from "./GameOverPanel";
|
|
3
|
+
import { LevelManager } from "../../levels/LevelManager";
|
|
4
|
+
import {
|
|
5
|
+
AUTO_NEXT_LEVEL_ON_WIN,
|
|
6
|
+
CHALLENGE_LEVEL_MODE,
|
|
7
|
+
} from "../../DebugConfig";
|
|
8
|
+
import { clearActiveRunContext } from "../../run/RunContextRuntime";
|
|
9
|
+
import { safePlaySound } from "../../utils/SoundUtils";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 描述 LevelLifecycle 从 Game 场景中所需内容的最小接口。
|
|
13
|
+
* 避免模块级别的循环导入。
|
|
14
|
+
*/
|
|
15
|
+
export interface LevelLifecycleGameRef extends Phaser.Scene {
|
|
16
|
+
level: any; // ParsedLevel | null
|
|
17
|
+
currentLives: number;
|
|
18
|
+
maxLives: number;
|
|
19
|
+
topUI: any; // GameTopUI | null
|
|
20
|
+
gameOverPanel: GameOverPanel | undefined;
|
|
21
|
+
isInputLocked: boolean;
|
|
22
|
+
isTestMode: boolean;
|
|
23
|
+
runFlags: { kind: string; affectsProgression: boolean };
|
|
24
|
+
settings: any;
|
|
25
|
+
winProcessing: boolean;
|
|
26
|
+
removedPaths: Set<number>;
|
|
27
|
+
nomoveHintSprite: Phaser.GameObjects.Image | null;
|
|
28
|
+
nomoveHintTween: Phaser.Tweens.Tween | null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 关卡生命周期管理器。
|
|
33
|
+
* 负责处理生命值、游戏结束、胜利、自动进入下一关等逻辑。
|
|
34
|
+
*/
|
|
35
|
+
export class LevelLifecycle {
|
|
36
|
+
private scene: LevelLifecycleGameRef;
|
|
37
|
+
|
|
38
|
+
constructor(scene: LevelLifecycleGameRef) {
|
|
39
|
+
this.scene = scene;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ── 扣除生命值 ──
|
|
43
|
+
|
|
44
|
+
/** 扣除一条生命值。如果生命值归零,触发游戏结束流程。 */
|
|
45
|
+
loseLife(): void {
|
|
46
|
+
const s = this.scene;
|
|
47
|
+
if (s.currentLives <= 0) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
s.currentLives = Math.max(0, s.currentLives - 1);
|
|
52
|
+
if (s.topUI) {
|
|
53
|
+
s.topUI.setLives(s.currentLives);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (s.currentLives <= 0) {
|
|
57
|
+
// 失去最后一条命后,先播放提示效果
|
|
58
|
+
safePlaySound(s, "fail", { volume: 2.0 });
|
|
59
|
+
// 然后延迟显示面板,锁定输入以防误触
|
|
60
|
+
s.isInputLocked = true;
|
|
61
|
+
s.time.delayedCall(400, () => {
|
|
62
|
+
this.handleOutOfLives();
|
|
63
|
+
s.isInputLocked = false;
|
|
64
|
+
});
|
|
65
|
+
} else {
|
|
66
|
+
safePlaySound(s, "mistake", { volume: 2.0 });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// ── 处理生命值耗尽 ──
|
|
71
|
+
|
|
72
|
+
/** 生命值耗尽时的处理逻辑,延迟后显示游戏结束面板。 */
|
|
73
|
+
private handleOutOfLives(): void {
|
|
74
|
+
const s = this.scene;
|
|
75
|
+
if (s.gameOverPanel) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
s.isInputLocked = true;
|
|
80
|
+
|
|
81
|
+
s.time.delayedCall(300, () => {
|
|
82
|
+
this.showGameOverPanel();
|
|
83
|
+
s.isInputLocked = false;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// ── 显示游戏结束面板 ──
|
|
88
|
+
|
|
89
|
+
/** 显示失败类型的游戏结束面板。 */
|
|
90
|
+
showGameOverPanel(): void {
|
|
91
|
+
const s = this.scene;
|
|
92
|
+
if (s.gameOverPanel) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
s.gameOverPanel = new GameOverPanel(s as any, {
|
|
97
|
+
type: "lose",
|
|
98
|
+
onClose: () => {
|
|
99
|
+
s.gameOverPanel = undefined;
|
|
100
|
+
if (!s.runFlags.affectsProgression) {
|
|
101
|
+
clearActiveRunContext();
|
|
102
|
+
}
|
|
103
|
+
if (s.isTestMode) {
|
|
104
|
+
s.scene.start("Editor");
|
|
105
|
+
} else {
|
|
106
|
+
s.scene.start("Game");
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// ── 显示挑战模式胜利面板 ──
|
|
113
|
+
|
|
114
|
+
/** 显示挑战模式的胜利面板,并停止背景音乐。 */
|
|
115
|
+
showChallengeWinPanel(): void {
|
|
116
|
+
const s = this.scene;
|
|
117
|
+
if (s.gameOverPanel) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
s.settings.stopBgm();
|
|
122
|
+
|
|
123
|
+
s.gameOverPanel = new GameOverPanel(s as any, {
|
|
124
|
+
type: "win",
|
|
125
|
+
onClose: () => {
|
|
126
|
+
s.gameOverPanel = undefined;
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// ── 处理关卡通关 ──
|
|
132
|
+
|
|
133
|
+
/** 处理关卡通关逻辑,防止重复处理。 */
|
|
134
|
+
handleLevelSuccess(): void {
|
|
135
|
+
const s = this.scene;
|
|
136
|
+
if (s.winProcessing) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
s.winProcessing = true;
|
|
141
|
+
void this.processWinAndShowSuccessPanel().finally(() => {
|
|
142
|
+
s.winProcessing = false;
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// ── 处理胜利并显示成功面板 ──
|
|
147
|
+
|
|
148
|
+
/** 异步处理胜利逻辑:测试模式返回编辑器,自动进入下一关或显示胜利面板。 */
|
|
149
|
+
private async processWinAndShowSuccessPanel(): Promise<void> {
|
|
150
|
+
const s = this.scene;
|
|
151
|
+
|
|
152
|
+
// 测试/预览模式:胜利后返回编辑器
|
|
153
|
+
if (s.isTestMode) {
|
|
154
|
+
console.log("[Game] 预览模式胜利 - 返回编辑器");
|
|
155
|
+
clearActiveRunContext();
|
|
156
|
+
s.scene.start("Editor");
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// 如果启用了自动进入下一关,跳过显示面板
|
|
161
|
+
if (AUTO_NEXT_LEVEL_ON_WIN) {
|
|
162
|
+
// 挑战模式:改为显示胜利面板
|
|
163
|
+
if (CHALLENGE_LEVEL_MODE !== 0) {
|
|
164
|
+
this.showChallengeWinPanel();
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
this.autoProgressToNextLevel();
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// 挑战模式:显示胜利面板
|
|
173
|
+
if (CHALLENGE_LEVEL_MODE !== 0) {
|
|
174
|
+
this.showChallengeWinPanel();
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// ── 自动进入下一关 ──
|
|
180
|
+
|
|
181
|
+
/** 自动进入下一关,重置生命值并重启场景。 */
|
|
182
|
+
autoProgressToNextLevel(): void {
|
|
183
|
+
const s = this.scene;
|
|
184
|
+
const mgr = LevelManager.instance;
|
|
185
|
+
const nextIndex = mgr.getNextIndex();
|
|
186
|
+
|
|
187
|
+
mgr.setCurrentIndex(nextIndex);
|
|
188
|
+
s.currentLives = s.maxLives;
|
|
189
|
+
s.scene.restart();
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// ── 播放危险闪烁帧 ──
|
|
193
|
+
|
|
194
|
+
/** 播放危险闪烁帧效果(红色边框闪烁),用于错误操作时的视觉反馈。 */
|
|
195
|
+
playDangerFrame(): void {
|
|
196
|
+
const s = this.scene;
|
|
197
|
+
const sprite = s.nomoveHintSprite;
|
|
198
|
+
if (!sprite) return;
|
|
199
|
+
|
|
200
|
+
if (s.nomoveHintTween) {
|
|
201
|
+
s.nomoveHintTween.stop();
|
|
202
|
+
s.nomoveHintTween = null;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const cam = s.cameras.main;
|
|
206
|
+
const centerX = cam.width / 2;
|
|
207
|
+
const centerY = cam.height / 2;
|
|
208
|
+
sprite.setPosition(centerX, centerY);
|
|
209
|
+
sprite.setDisplaySize(cam.width, cam.height);
|
|
210
|
+
|
|
211
|
+
sprite.setAlpha(0);
|
|
212
|
+
sprite.setVisible(true);
|
|
213
|
+
|
|
214
|
+
s.nomoveHintTween = s.tweens.add({
|
|
215
|
+
targets: sprite,
|
|
216
|
+
alpha: { from: 0, to: 1 },
|
|
217
|
+
duration: 150,
|
|
218
|
+
ease: "Linear",
|
|
219
|
+
yoyo: true,
|
|
220
|
+
repeat: 0,
|
|
221
|
+
onComplete: () => {
|
|
222
|
+
sprite.setVisible(false);
|
|
223
|
+
sprite.setAlpha(0);
|
|
224
|
+
s.nomoveHintTween = null;
|
|
225
|
+
},
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// ── 处理超时 ──
|
|
230
|
+
|
|
231
|
+
/** 处理计时器超时,显示游戏结束面板。 */
|
|
232
|
+
handleTimeOut(): void {
|
|
233
|
+
this.showGameOverPanel();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: level_solvability_validator.aivalidator
|
|
3
|
+
description: 关卡可解性验证器。验证箭头推出三消关卡数据的正确性:无格子冲突、无推出阻挡(或存在合法序列)、颜色分组约束、篮子不溢出。纯逻辑,可在构建时或运行时调用。
|
|
4
|
+
triggers: 需要验证关卡数据正确性、检查可解性、调试关卡设计时触发。
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 关卡可解性验证器(Level Solvability Validator)
|
|
8
|
+
|
|
9
|
+
## 说明
|
|
10
|
+
|
|
11
|
+
验证 `arrow_pick_match` 玩法的关卡数据,确保:
|
|
12
|
+
|
|
13
|
+
1. **无格子冲突**:任意两条路径不共享格子
|
|
14
|
+
2. **推出可达**:每条路径到边界方向上无其他路径占据(或存在合法序列)
|
|
15
|
+
3. **颜色约束**:每种颜色恰好 matchCount(3) 条路径
|
|
16
|
+
4. **篮子不溢出**:存在一个推出顺序使篮子永不超过 capacity
|
|
17
|
+
|
|
18
|
+
## Scaffold
|
|
19
|
+
|
|
20
|
+
| 目标路径 | 来源 | 说明 |
|
|
21
|
+
|---------|-----|------|
|
|
22
|
+
| `src/game/logic/LevelValidator.ts` | `ref/LevelValidator.ts` | 验证器 |
|
|
23
|
+
|
|
24
|
+
## 关键接口
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
interface ValidationResult {
|
|
28
|
+
valid: boolean;
|
|
29
|
+
errors: string[];
|
|
30
|
+
warnings: string[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
class LevelValidator {
|
|
34
|
+
static validate(level: ParsedLevel, matchCount?: number, trayCapacity?: number): ValidationResult;
|
|
35
|
+
static checkNoOverlap(level: ParsedLevel): string[];
|
|
36
|
+
static checkAllUnblocked(level: ParsedLevel): string[];
|
|
37
|
+
static checkColorConstraint(level: ParsedLevel, matchCount: number): string[];
|
|
38
|
+
static checkSolvability(level: ParsedLevel, matchCount: number, trayCapacity: number): string[];
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Recipe
|
|
43
|
+
|
|
44
|
+
| 决策 | 原因 |
|
|
45
|
+
|------|------|
|
|
46
|
+
| **静态方法类** | 验证器是无状态纯函数,不需要实例化;静态方法使调用更简洁,且允许独立调用单项检查 |
|
|
47
|
+
| **与 level_data_validator 分离** | `level_data_validator` 检查格式正确性(适用所有玩法),本 skill 检查 arrow_pick_match 的玩法可解性(特定玩法约束);分离后非此玩法的 Remix 不需要加载本 skill |
|
|
48
|
+
| **支持构建时和运行时两个调用点** | 构建时批量验证关卡包;运行时在加载关卡时即时校验;同一个 `validate()` 函数满足两个场景 |
|
|
49
|
+
|
|
50
|
+
## Adapter
|
|
51
|
+
|
|
52
|
+
- **Role**: `levelSolvabilityValidator` — Arrow pick-match 玩法关卡可解性验证器
|
|
53
|
+
- **Provides**: `LevelValidator` 类(`validate()`、`checkNoOverlap()`、`checkAllUnblocked()`、`checkColorConstraint()`、`checkSolvability()`),`ValidationResult` 类型
|
|
54
|
+
- **Requires**: `arrow_path_data_format.aicomponent`(ParsedLevel 类型)
|
|
55
|
+
- **Consumed by**: `gameplay_unit_test.aivalidator`(集成可解性测试);Agent 在生成新关卡数据后调用验证
|
|
56
|
+
- **Integration point**: `src/game/logic/LevelValidator.ts` —— 构建时批量验证 `LEVELS` 数组,或运行时关卡加载前验证
|
|
57
|
+
|
|
58
|
+
## Imports
|
|
59
|
+
|
|
60
|
+
- `arrow_path_data_format.aicomponent`(硬依赖:ParsedLevel 类型)
|
|
61
|
+
|
|
62
|
+
## 使用方式
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
// 构建时验证
|
|
66
|
+
import { LevelValidator } from "./logic/LevelValidator";
|
|
67
|
+
for (const raw of LEVELS) {
|
|
68
|
+
const level = parseLevelJson(raw);
|
|
69
|
+
const result = LevelValidator.validate(level);
|
|
70
|
+
if (!result.valid) {
|
|
71
|
+
console.error(`Level ${level.index} invalid:`, result.errors);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"atomId": "level_solvability_validator.aivalidator",
|
|
4
|
+
"bundleType": "aivalidator",
|
|
5
|
+
"category": "validator",
|
|
6
|
+
"mode": "fixed",
|
|
7
|
+
"label": {
|
|
8
|
+
"zh": "关卡可解性验证器",
|
|
9
|
+
"en": "Level solvability validator"
|
|
10
|
+
},
|
|
11
|
+
"tags": ["logic", "validator", "level", "solvability", "constraint", "debug", "tool"],
|
|
12
|
+
"bindingRoles": ["levelValidator"],
|
|
13
|
+
"imports": [],
|
|
14
|
+
"binding": {
|
|
15
|
+
"role": "levelValidator",
|
|
16
|
+
"target": "src/game/logic/LevelValidator.ts",
|
|
17
|
+
"type": "code-module-reference"
|
|
18
|
+
},
|
|
19
|
+
"files": {
|
|
20
|
+
"skill": "SKILL.md",
|
|
21
|
+
"ref": ["ref/LevelValidator.ts"]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 关卡可解性验证器
|
|
3
|
+
* 验证 arrow_pick_match 关卡数据的正确性和可解性
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
interface GridPoint { x: number; y: number; }
|
|
7
|
+
interface LevelPath {
|
|
8
|
+
points: GridPoint[];
|
|
9
|
+
head: GridPoint;
|
|
10
|
+
direction: string;
|
|
11
|
+
color: string;
|
|
12
|
+
indices: number[];
|
|
13
|
+
pathIndex: number;
|
|
14
|
+
}
|
|
15
|
+
interface ParsedLevel {
|
|
16
|
+
rows: number;
|
|
17
|
+
cols: number;
|
|
18
|
+
paths: LevelPath[];
|
|
19
|
+
trayCapacity: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface ValidationResult {
|
|
23
|
+
valid: boolean;
|
|
24
|
+
errors: string[];
|
|
25
|
+
warnings: string[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export class LevelValidator {
|
|
29
|
+
/**
|
|
30
|
+
* 完整验证
|
|
31
|
+
*/
|
|
32
|
+
static validate(
|
|
33
|
+
level: ParsedLevel,
|
|
34
|
+
matchCount: number = 3,
|
|
35
|
+
trayCapacity?: number,
|
|
36
|
+
): ValidationResult {
|
|
37
|
+
const cap = trayCapacity ?? level.trayCapacity ?? 7;
|
|
38
|
+
const errors: string[] = [];
|
|
39
|
+
const warnings: string[] = [];
|
|
40
|
+
|
|
41
|
+
errors.push(...LevelValidator.checkNoOverlap(level));
|
|
42
|
+
errors.push(...LevelValidator.checkColorConstraint(level, matchCount));
|
|
43
|
+
warnings.push(...LevelValidator.checkAllUnblocked(level));
|
|
44
|
+
errors.push(...LevelValidator.checkSolvability(level, matchCount, cap));
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
valid: errors.length === 0,
|
|
48
|
+
errors,
|
|
49
|
+
warnings,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 检查无格子冲突
|
|
55
|
+
*/
|
|
56
|
+
static checkNoOverlap(level: ParsedLevel): string[] {
|
|
57
|
+
const errors: string[] = [];
|
|
58
|
+
const occupied = new Map<number, number>(); // index → pathIndex
|
|
59
|
+
|
|
60
|
+
for (const path of level.paths) {
|
|
61
|
+
for (const idx of path.indices) {
|
|
62
|
+
if (occupied.has(idx)) {
|
|
63
|
+
const col = idx % level.cols;
|
|
64
|
+
const row = Math.floor(idx / level.cols);
|
|
65
|
+
errors.push(
|
|
66
|
+
`Cell (${col},${row}) occupied by both path ${occupied.get(idx)} and path ${path.pathIndex}`,
|
|
67
|
+
);
|
|
68
|
+
} else {
|
|
69
|
+
occupied.set(idx, path.pathIndex);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return errors;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* 检查所有路径是否可无阻挡推出
|
|
79
|
+
*/
|
|
80
|
+
static checkAllUnblocked(level: ParsedLevel): string[] {
|
|
81
|
+
const warnings: string[] = [];
|
|
82
|
+
|
|
83
|
+
// 构建全局占据集
|
|
84
|
+
const occupied = new Set<string>();
|
|
85
|
+
for (const path of level.paths) {
|
|
86
|
+
for (const pt of path.points) {
|
|
87
|
+
occupied.add(`${pt.x},${pt.y}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
for (const path of level.paths) {
|
|
92
|
+
const { dx, dy } = LevelValidator.dirToDelta(path.direction);
|
|
93
|
+
if (dx === 0 && dy === 0) continue;
|
|
94
|
+
|
|
95
|
+
let cx = path.head.x;
|
|
96
|
+
let cy = path.head.y;
|
|
97
|
+
let blocked = false;
|
|
98
|
+
|
|
99
|
+
for (let step = 0; step < Math.max(level.rows, level.cols) + 1; step++) {
|
|
100
|
+
cx += dx;
|
|
101
|
+
cy += dy;
|
|
102
|
+
if (cx < 0 || cy < 0 || cx >= level.cols || cy >= level.rows) break;
|
|
103
|
+
|
|
104
|
+
const key = `${cx},${cy}`;
|
|
105
|
+
// 检查是否被其他路径占据(排除自己的点)
|
|
106
|
+
const isSelf = path.points.some(p => p.x === cx && p.y === cy);
|
|
107
|
+
if (!isSelf && occupied.has(key)) {
|
|
108
|
+
warnings.push(`Path ${path.pathIndex} (${path.color}) is blocked at (${cx},${cy})`);
|
|
109
|
+
blocked = true;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return warnings;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* 检查颜色分组约束
|
|
120
|
+
*/
|
|
121
|
+
static checkColorConstraint(level: ParsedLevel, matchCount: number): string[] {
|
|
122
|
+
const errors: string[] = [];
|
|
123
|
+
const colorCounts = new Map<string, number>();
|
|
124
|
+
|
|
125
|
+
for (const path of level.paths) {
|
|
126
|
+
colorCounts.set(path.color, (colorCounts.get(path.color) || 0) + 1);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
for (const [color, count] of colorCounts) {
|
|
130
|
+
if (count % matchCount !== 0) {
|
|
131
|
+
errors.push(
|
|
132
|
+
`Color "${color}" has ${count} paths, not a multiple of matchCount(${matchCount})`,
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return errors;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* 检查是否存在合法推出序列(贪心验证:同色连续推)
|
|
142
|
+
*/
|
|
143
|
+
static checkSolvability(
|
|
144
|
+
level: ParsedLevel,
|
|
145
|
+
matchCount: number,
|
|
146
|
+
trayCapacity: number,
|
|
147
|
+
): string[] {
|
|
148
|
+
const errors: string[] = [];
|
|
149
|
+
|
|
150
|
+
// 按颜色分组
|
|
151
|
+
const colorGroups = new Map<string, number[]>();
|
|
152
|
+
for (const path of level.paths) {
|
|
153
|
+
const list = colorGroups.get(path.color) || [];
|
|
154
|
+
list.push(path.pathIndex);
|
|
155
|
+
colorGroups.set(path.color, list);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// 贪心策略:逐组推出
|
|
159
|
+
let traySize = 0;
|
|
160
|
+
for (const [color, pathIndices] of colorGroups) {
|
|
161
|
+
// 推出该组所有路径
|
|
162
|
+
traySize += pathIndices.length;
|
|
163
|
+
// 消除
|
|
164
|
+
const matches = Math.floor(pathIndices.length / matchCount);
|
|
165
|
+
traySize -= matches * matchCount;
|
|
166
|
+
|
|
167
|
+
if (traySize > trayCapacity) {
|
|
168
|
+
errors.push(
|
|
169
|
+
`Greedy strategy overflows tray at color "${color}" (tray would have ${traySize}/${trayCapacity})`,
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return errors;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
private static dirToDelta(direction: string): { dx: number; dy: number } {
|
|
178
|
+
switch (direction) {
|
|
179
|
+
case "left": return { dx: -1, dy: 0 };
|
|
180
|
+
case "right": return { dx: 1, dy: 0 };
|
|
181
|
+
case "up": return { dx: 0, dy: -1 };
|
|
182
|
+
case "down": return { dx: 0, dy: 1 };
|
|
183
|
+
default: return { dx: 0, dy: 0 };
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: level_state.aicomponent
|
|
3
|
+
description: 关卡进度状态管理器。管理当前关卡索引、加载并解析下一关数据、处理关卡循环和随机播放逻辑。
|
|
4
|
+
triggers: 需要管理关卡进度、加载关卡数据或实现进关逻辑时触发。
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 关卡进度状态(Level Progress State)
|
|
8
|
+
|
|
9
|
+
## 说明
|
|
10
|
+
|
|
11
|
+
`LevelManager` 管理关卡流转:
|
|
12
|
+
|
|
13
|
+
- 持有关卡数据列表(来自主题配置)
|
|
14
|
+
- 跟踪当前关卡索引
|
|
15
|
+
- `getCurrentLevel()`:返回当前关卡 ParsedLevel
|
|
16
|
+
- `nextLevel()`:进入下一关(支持循环/随机)
|
|
17
|
+
|
|
18
|
+
## Scaffold
|
|
19
|
+
|
|
20
|
+
| 目标路径 | 来源 |
|
|
21
|
+
|---------|-----|
|
|
22
|
+
| `src/game/levels/LevelManager.ts` | `ref/LevelManager.ts` |
|
|
23
|
+
|
|
24
|
+
## Skill Definition
|
|
25
|
+
|
|
26
|
+
```yaml
|
|
27
|
+
tools:
|
|
28
|
+
- read_file
|
|
29
|
+
- write_file
|
|
30
|
+
inputs:
|
|
31
|
+
- source: src/game/levels/LevelManager.ts
|
|
32
|
+
outputs:
|
|
33
|
+
- levelManager: LevelManager class
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Recipe
|
|
37
|
+
|
|
38
|
+
| 决策 | 原因 |
|
|
39
|
+
|------|------|
|
|
40
|
+
| **状态与渲染分离** | 关卡进度(当前索引、循环模式)与游戏渲染逻辑完全无关;LevelManager 作为纯状态机,GameScene 作为协调器,职责边界清晰 |
|
|
41
|
+
| **支持循环/随机两种进关模式** | 试玩广告的关卡通常数量有限,需要支持循环;随机模式增加重玩多样性;两种模式由 ThemeVariantConfig 的配置决定 |
|
|
42
|
+
| **关卡数据来自主题配置** | 不同 Remix 变体可以有完全不同的关卡集合;LevelManager 从 ThemeVariantConfig.levels 读取,关卡数据随主题一起替换 |
|
|
43
|
+
|
|
44
|
+
## Adapter
|
|
45
|
+
|
|
46
|
+
- **Role**: `levelProgressState` — 关卡进度状态机(当前关卡索引 + 进关逻辑)
|
|
47
|
+
- **Provides**: `LevelManager` 类(`getCurrentLevel()`、`nextLevel()`、`reset()`)
|
|
48
|
+
- **Requires**: `phaser.aicomponent`、`arrow_path_data_format.aicomponent`(ParsedLevel 类型 + parseLevelJson)
|
|
49
|
+
- **Consumed by**: `level_lifecycle.aicomponent`(调用 `nextLevel()` 推进进度)、`game_scene.aicomponent`(实例化并持有 LevelManager)
|
|
50
|
+
- **Integration point**: `src/game/levels/LevelManager.ts` —— `game_scene` 在 `create()` 中 `new LevelManager(themeConfig.levels)`
|
|
51
|
+
|
|
52
|
+
## Imports
|
|
53
|
+
|
|
54
|
+
- `phaser.aicomponent`(硬依赖)
|
|
55
|
+
- `arrow_path_data_format.aicomponent`(硬依赖:ParsedLevel 类型 + parseLevelJson)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"atomId": "level_state.aicomponent",
|
|
4
|
+
"bundleType": "aicomponent",
|
|
5
|
+
"category": "state",
|
|
6
|
+
"mode": "fixed",
|
|
7
|
+
"label": { "zh": "关卡进度状态", "en": "Level progress state" },
|
|
8
|
+
"tags": ["state", "level", "progress", "level-manager", "level-data"],
|
|
9
|
+
"bindingRoles": ["levelProgress"],
|
|
10
|
+
"scaffold": {
|
|
11
|
+
"files": {
|
|
12
|
+
"src/game/levels/LevelManager.ts": {
|
|
13
|
+
"source": "ref/LevelManager.ts",
|
|
14
|
+
"mode": "full",
|
|
15
|
+
"weight": 10
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"imports": [
|
|
20
|
+
{ "slot": "engine", "pinAtomId": "phaser.aicomponent", "edgeKind": "requires", "bindAs": "engine" },
|
|
21
|
+
{ "slot": "levelData", "pinAtomId": "arrow_path_data_format.aicomponent", "edgeKind": "requires", "bindAs": "levelData" }
|
|
22
|
+
],
|
|
23
|
+
"exports": [
|
|
24
|
+
{ "name": "LevelManager", "kind": "class", "location": "src/game/levels/LevelManager.ts" }
|
|
25
|
+
],
|
|
26
|
+
"neutralDescriptor": {
|
|
27
|
+
"geometry": "level progression state: tracks current level index, parses next level data, handles level cycling and shuffle",
|
|
28
|
+
"layers": ["state-management", "progression", "level-data-access"]
|
|
29
|
+
},
|
|
30
|
+
"files": {
|
|
31
|
+
"skill": "SKILL.md",
|
|
32
|
+
"levelManager": "ref/LevelManager.ts"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export class LevelManager {
|
|
2
|
+
private static _instance: LevelManager | undefined;
|
|
3
|
+
|
|
4
|
+
static get instance(): LevelManager {
|
|
5
|
+
if (!LevelManager._instance) {
|
|
6
|
+
LevelManager._instance = new LevelManager();
|
|
7
|
+
}
|
|
8
|
+
return LevelManager._instance;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
private readonly minIndex: number = 1;
|
|
12
|
+
private currentIndex = 1;
|
|
13
|
+
|
|
14
|
+
getCurrentIndex(): number {
|
|
15
|
+
return this.currentIndex;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
setCurrentIndex(index: number): void {
|
|
19
|
+
const clamped = Math.max(this.minIndex, Math.floor(index || 0));
|
|
20
|
+
this.currentIndex = clamped;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
getNextIndex(): number {
|
|
24
|
+
return this.currentIndex + 1;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export class LevelManager {
|
|
2
|
+
private static _instance: LevelManager | undefined;
|
|
3
|
+
|
|
4
|
+
static get instance(): LevelManager {
|
|
5
|
+
if (!LevelManager._instance) {
|
|
6
|
+
LevelManager._instance = new LevelManager();
|
|
7
|
+
}
|
|
8
|
+
return LevelManager._instance;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
private readonly minIndex: number = 1;
|
|
12
|
+
private currentIndex = 1;
|
|
13
|
+
|
|
14
|
+
getCurrentIndex(): number {
|
|
15
|
+
return this.currentIndex;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
setCurrentIndex(index: number): void {
|
|
19
|
+
const clamped = Math.max(this.minIndex, Math.floor(index || 0));
|
|
20
|
+
this.currentIndex = clamped;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
getNextIndex(): number {
|
|
24
|
+
return this.currentIndex + 1;
|
|
25
|
+
}
|
|
26
|
+
}
|