@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,694 @@
|
|
|
1
|
+
import * as Phaser from "phaser";
|
|
2
|
+
import { safePlaySound } from "../../utils/SoundUtils";
|
|
3
|
+
import {
|
|
4
|
+
MOVE_STEP_MS,
|
|
5
|
+
PATH_LINE_WIDTH_RATIO,
|
|
6
|
+
ARROW_SIZE_RATIO,
|
|
7
|
+
} from "../../GameConfig";
|
|
8
|
+
import { ENABLE_ERROR_PATH_HIGHLIGHT } from "../../DebugConfig";
|
|
9
|
+
import type { PathTrackCell, PathRenderer } from "../../utils/PathRenderers";
|
|
10
|
+
import { fillRoundedTriangle } from "../../utils/PathRenderers";
|
|
11
|
+
|
|
12
|
+
import type { ParsedLevel, LevelPath } from "../../levels/LevelTypes";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 描述 AnimationManager 从 Game 场景中所需内容的最小接口。
|
|
16
|
+
* 避免模块级别的循环导入。
|
|
17
|
+
*/
|
|
18
|
+
export interface AnimationGameRef extends Phaser.Scene {
|
|
19
|
+
level: ParsedLevel | null;
|
|
20
|
+
boardContainer: Phaser.GameObjects.Container;
|
|
21
|
+
cellSize: number;
|
|
22
|
+
cellWidth: number;
|
|
23
|
+
cellHeight: number;
|
|
24
|
+
visualSize: number;
|
|
25
|
+
zoom: number;
|
|
26
|
+
minZoom: number;
|
|
27
|
+
maxZoom: number;
|
|
28
|
+
boardOffsetX: number;
|
|
29
|
+
boardOffsetY: number;
|
|
30
|
+
removedPaths: Set<number>;
|
|
31
|
+
blockedPaths: Set<number>;
|
|
32
|
+
animatingPaths: Set<number>;
|
|
33
|
+
isPlayingWinDiamond: boolean;
|
|
34
|
+
shouldDrawEliminationTrail: boolean;
|
|
35
|
+
zoomTween: Phaser.Tweens.Tween | null;
|
|
36
|
+
settings: { soundOn: boolean };
|
|
37
|
+
pathCornerStyle: "rounded" | "square";
|
|
38
|
+
|
|
39
|
+
// AnimationManager 需要的 Game 方法
|
|
40
|
+
cellCenter(col: number, row: number): { x: number; y: number };
|
|
41
|
+
buildPathTrack(path: LevelPath): PathTrackCell[];
|
|
42
|
+
getPathRendererForLineWidth(lineWidth: number): PathRenderer;
|
|
43
|
+
getPathBaseColor(pathIndex: number): number;
|
|
44
|
+
drawArrowHead(
|
|
45
|
+
g: Phaser.GameObjects.Graphics,
|
|
46
|
+
cx: number,
|
|
47
|
+
cy: number,
|
|
48
|
+
angle: number,
|
|
49
|
+
color: number,
|
|
50
|
+
scale?: number,
|
|
51
|
+
): void;
|
|
52
|
+
fillAxisAlignedSegmentRect(
|
|
53
|
+
g: Phaser.GameObjects.Graphics,
|
|
54
|
+
x1: number,
|
|
55
|
+
y1: number,
|
|
56
|
+
x2: number,
|
|
57
|
+
y2: number,
|
|
58
|
+
lineWidth: number,
|
|
59
|
+
): void;
|
|
60
|
+
directionToDelta(direction: string): { dx: number; dy: number };
|
|
61
|
+
positionBoardContainer(): void;
|
|
62
|
+
relayoutBoard(): void;
|
|
63
|
+
levelLifecycle: { handleLevelSuccess(): void };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export class AnimationManager {
|
|
67
|
+
private scene: AnimationGameRef;
|
|
68
|
+
|
|
69
|
+
constructor(scene: AnimationGameRef) {
|
|
70
|
+
this.scene = scene;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// ── 路径移出棋盘动画 ──
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* 将指定路径以蛇形动画移出棋盘。
|
|
77
|
+
* @param pathIndex 路径索引
|
|
78
|
+
* @param _dx 方向增量X(未使用,运动沿折线路径轨迹)
|
|
79
|
+
* @param _dy 方向增量Y(未使用)
|
|
80
|
+
* @param _steps 步数(未使用)
|
|
81
|
+
* @param isLastPath 是否为最后一条路径
|
|
82
|
+
* @param onComplete 动画完成回调
|
|
83
|
+
*/
|
|
84
|
+
animatePathOffBoard(
|
|
85
|
+
pathIndex: number,
|
|
86
|
+
_dx: number,
|
|
87
|
+
_dy: number,
|
|
88
|
+
_steps: number,
|
|
89
|
+
isLastPath: boolean = false,
|
|
90
|
+
onComplete?: () => void,
|
|
91
|
+
): void {
|
|
92
|
+
const s = this.scene;
|
|
93
|
+
// dx/dy/steps 在此未使用;运动沿折线路径轨迹进行
|
|
94
|
+
if (!s.level || !s.boardContainer) return;
|
|
95
|
+
const level = s.level;
|
|
96
|
+
const path = level.paths[pathIndex]!;
|
|
97
|
+
|
|
98
|
+
// 成功消除的路径使用固定的蓝色
|
|
99
|
+
const color = 0x4050b6;
|
|
100
|
+
|
|
101
|
+
// 复用 buildPathTrack 构建离散格子轨迹
|
|
102
|
+
const baseTrack = s.buildPathTrack(path);
|
|
103
|
+
if (baseTrack.length === 0) return;
|
|
104
|
+
// 创建可变副本,以便扩展棋盘外的格子
|
|
105
|
+
const track: { x: number; y: number }[] = [...baseTrack];
|
|
106
|
+
|
|
107
|
+
const baseLength = track.length; // 原始路径格子数量
|
|
108
|
+
|
|
109
|
+
// 在原始路径的每个格子中心放置静态 normal_dot
|
|
110
|
+
for (let i = 0; i < baseLength; i++) {
|
|
111
|
+
const cell = track[i]!;
|
|
112
|
+
const center = s.cellCenter(cell.x, cell.y);
|
|
113
|
+
this.spawnTrailDot(center.x, center.y, false);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// 将路径延伸到棋盘外,使线条可以完全退出
|
|
117
|
+
let tail = track[track.length - 1]!;
|
|
118
|
+
const { dx: extDx, dy: extDy } = s.directionToDelta(path.direction);
|
|
119
|
+
|
|
120
|
+
const extraSteps = Math.max(level.cols, level.rows) + baseLength;
|
|
121
|
+
for (let i = 0; i < extraSteps; i++) {
|
|
122
|
+
tail = { x: tail.x + extDx, y: tail.y + extDy };
|
|
123
|
+
track.push(tail);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const bodyLength = baseLength; // 蛇身长度 = 原始路径长度
|
|
127
|
+
if (bodyLength <= 0) return;
|
|
128
|
+
|
|
129
|
+
const g = s.add.graphics();
|
|
130
|
+
s.boardContainer.add(g);
|
|
131
|
+
|
|
132
|
+
let headStep = bodyLength - 1; // 箭头从原始路径末尾开始
|
|
133
|
+
let lastDotIndex = -1;
|
|
134
|
+
|
|
135
|
+
/** 绘制当前帧 */
|
|
136
|
+
const drawFrame = () => {
|
|
137
|
+
g.clear();
|
|
138
|
+
|
|
139
|
+
const bodyColor = color;
|
|
140
|
+
|
|
141
|
+
const lineWidth = s.visualSize * PATH_LINE_WIDTH_RATIO;
|
|
142
|
+
g.fillStyle(bodyColor, 1);
|
|
143
|
+
|
|
144
|
+
const tailStep = headStep - (bodyLength - 1);
|
|
145
|
+
const first = Math.max(tailStep, 0);
|
|
146
|
+
const last = Math.min(headStep, track.length - 1);
|
|
147
|
+
|
|
148
|
+
s.getPathRendererForLineWidth(lineWidth).render({
|
|
149
|
+
g,
|
|
150
|
+
track,
|
|
151
|
+
startSegmentIndex: first,
|
|
152
|
+
endSegmentIndexExclusive: last,
|
|
153
|
+
cellSize: s.cellSize,
|
|
154
|
+
lineWidth,
|
|
155
|
+
cellCenter: (col, row) => s.cellCenter(col, row),
|
|
156
|
+
fillAxisAlignedSegmentRect: (g2, x1, y1, x2, y2, w) =>
|
|
157
|
+
s.fillAxisAlignedSegmentRect(g2, x1, y1, x2, y2, w),
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
// 绘制跟随 headStep 格子的箭头头部
|
|
161
|
+
const headIndex = Math.min(headStep, track.length - 1);
|
|
162
|
+
const headCell = track[headIndex]!;
|
|
163
|
+
const headCenter = s.cellCenter(headCell.x, headCell.y);
|
|
164
|
+
|
|
165
|
+
// 胜利时:箭头经过原始路径时放置 win_dot
|
|
166
|
+
if (
|
|
167
|
+
isLastPath &&
|
|
168
|
+
headIndex !== lastDotIndex &&
|
|
169
|
+
headIndex >= 0 &&
|
|
170
|
+
headIndex < baseLength
|
|
171
|
+
) {
|
|
172
|
+
lastDotIndex = headIndex;
|
|
173
|
+
this.spawnTrailDot(headCenter.x, headCenter.y, isLastPath);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
let dirX = extDx;
|
|
177
|
+
let dirY = extDy;
|
|
178
|
+
if (headIndex > 0) {
|
|
179
|
+
const prev = track[headIndex - 1]!;
|
|
180
|
+
dirX = headCell.x - prev.x;
|
|
181
|
+
dirY = headCell.y - prev.y;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// 绘制三角形箭头头部
|
|
185
|
+
let angle = Math.atan2(dirY, dirX) + Math.PI / 2;
|
|
186
|
+
if (angle > Math.PI) {
|
|
187
|
+
angle -= Math.PI * 2;
|
|
188
|
+
}
|
|
189
|
+
s.drawArrowHead(g, headCenter.x, headCenter.y, angle, color);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
drawFrame();
|
|
193
|
+
|
|
194
|
+
const moveEvent = s.time.addEvent({
|
|
195
|
+
delay: MOVE_STEP_MS,
|
|
196
|
+
callback: () => {
|
|
197
|
+
headStep++;
|
|
198
|
+
const tailStep = headStep - (bodyLength - 1);
|
|
199
|
+
// 当整条线(尾部)退出扩展轨迹时,动画结束
|
|
200
|
+
if (tailStep > track.length - 1) {
|
|
201
|
+
g.destroy();
|
|
202
|
+
moveEvent.remove(false);
|
|
203
|
+
|
|
204
|
+
if (onComplete) {
|
|
205
|
+
onComplete();
|
|
206
|
+
}
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
drawFrame();
|
|
210
|
+
},
|
|
211
|
+
callbackScope: this,
|
|
212
|
+
loop: true,
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// ── 胜利时重置棋盘视图 ──
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* 胜利时将棋盘视图平滑重置为默认缩放和居中位置。
|
|
220
|
+
* @param onComplete 重置完成回调
|
|
221
|
+
*/
|
|
222
|
+
resetBoardViewForWin(onComplete?: () => void): void {
|
|
223
|
+
const s = this.scene;
|
|
224
|
+
if (!s.boardContainer) {
|
|
225
|
+
if (onComplete) {
|
|
226
|
+
onComplete();
|
|
227
|
+
}
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const targetZoom = s.minZoom;
|
|
232
|
+
const targetOffsetX = 0;
|
|
233
|
+
const targetOffsetY = 0;
|
|
234
|
+
|
|
235
|
+
const zoomDelta = Math.abs(s.zoom - targetZoom);
|
|
236
|
+
const dx = s.boardOffsetX - targetOffsetX;
|
|
237
|
+
const dy = s.boardOffsetY - targetOffsetY;
|
|
238
|
+
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
239
|
+
|
|
240
|
+
// 如果已经非常接近默认视图,直接对齐并继续
|
|
241
|
+
if (zoomDelta < 0.001 && Math.abs(dx) < 0.5 && Math.abs(dy) < 0.5) {
|
|
242
|
+
s.zoom = targetZoom;
|
|
243
|
+
s.boardOffsetX = targetOffsetX;
|
|
244
|
+
s.boardOffsetY = targetOffsetY;
|
|
245
|
+
s.positionBoardContainer();
|
|
246
|
+
if (onComplete) {
|
|
247
|
+
onComplete();
|
|
248
|
+
}
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// 使用基于速度的时长而非固定值:
|
|
253
|
+
const ZOOM_SPEED = 2.0;
|
|
254
|
+
const PAN_SPEED = 1200;
|
|
255
|
+
|
|
256
|
+
const zoomDuration = zoomDelta > 0 ? (zoomDelta / ZOOM_SPEED) * 1000 : 0;
|
|
257
|
+
const panDuration = distance > 0 ? (distance / PAN_SPEED) * 1000 : 0;
|
|
258
|
+
|
|
259
|
+
let duration = Math.max(zoomDuration, panDuration);
|
|
260
|
+
const MIN_DURATION = 220;
|
|
261
|
+
const MAX_DURATION = 520;
|
|
262
|
+
duration = Phaser.Math.Clamp(duration, MIN_DURATION, MAX_DURATION);
|
|
263
|
+
|
|
264
|
+
if (s.zoomTween) {
|
|
265
|
+
s.zoomTween.stop();
|
|
266
|
+
s.zoomTween = null;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
const startZoom = s.zoom;
|
|
270
|
+
const startOffsetX = s.boardOffsetX;
|
|
271
|
+
const startOffsetY = s.boardOffsetY;
|
|
272
|
+
const tweenState = { t: 0 };
|
|
273
|
+
|
|
274
|
+
s.zoomTween = s.tweens.add({
|
|
275
|
+
targets: tweenState,
|
|
276
|
+
t: 1,
|
|
277
|
+
duration,
|
|
278
|
+
ease: "Sine.easeInOut",
|
|
279
|
+
onUpdate: () => {
|
|
280
|
+
const t = tweenState.t as number;
|
|
281
|
+
s.zoom = Phaser.Math.Linear(startZoom, targetZoom, t);
|
|
282
|
+
s.boardOffsetX = Phaser.Math.Linear(startOffsetX, targetOffsetX, t);
|
|
283
|
+
s.boardOffsetY = Phaser.Math.Linear(startOffsetY, targetOffsetY, t);
|
|
284
|
+
s.positionBoardContainer();
|
|
285
|
+
},
|
|
286
|
+
onComplete: () => {
|
|
287
|
+
s.zoomTween = null;
|
|
288
|
+
s.zoom = targetZoom;
|
|
289
|
+
s.boardOffsetX = targetOffsetX;
|
|
290
|
+
s.boardOffsetY = targetOffsetY;
|
|
291
|
+
s.positionBoardContainer();
|
|
292
|
+
if (onComplete) {
|
|
293
|
+
onComplete();
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// ── 播放胜利钻石动画 ──
|
|
300
|
+
|
|
301
|
+
/** 播放胜利钻石波纹动画,从中心向外扩散。 */
|
|
302
|
+
playWinDiamondAnimation(): void {
|
|
303
|
+
const s = this.scene;
|
|
304
|
+
if (s.isPlayingWinDiamond) {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
s.isPlayingWinDiamond = true;
|
|
308
|
+
if (!s.boardContainer) {
|
|
309
|
+
s.isPlayingWinDiamond = false;
|
|
310
|
+
s.levelLifecycle.handleLevelSuccess();
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
if (s.settings.soundOn) {
|
|
315
|
+
safePlaySound(s, "win_anim", { volume: 2.0 });
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// 从棋盘容器中收集已有的 normal_dot / win_dot
|
|
319
|
+
const children = s.boardContainer.list as Phaser.GameObjects.GameObject[];
|
|
320
|
+
const dots = children.filter(
|
|
321
|
+
(child): child is Phaser.GameObjects.Image =>
|
|
322
|
+
child instanceof Phaser.GameObjects.Image &&
|
|
323
|
+
(child.texture.key === "normal_dot" || child.texture.key === "win_dot"),
|
|
324
|
+
);
|
|
325
|
+
|
|
326
|
+
if (!dots.length) {
|
|
327
|
+
s.isPlayingWinDiamond = false;
|
|
328
|
+
s.levelLifecycle.handleLevelSuccess();
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// 根据边界框中心将点位置映射到网格坐标
|
|
333
|
+
type DotInfo = { dot: Phaser.GameObjects.Image; gx: number; gy: number };
|
|
334
|
+
const infos: DotInfo[] = [];
|
|
335
|
+
|
|
336
|
+
let minGX = Infinity;
|
|
337
|
+
let maxGX = -Infinity;
|
|
338
|
+
let minGY = Infinity;
|
|
339
|
+
let maxGY = -Infinity;
|
|
340
|
+
|
|
341
|
+
dots.forEach((dot) => {
|
|
342
|
+
const gx = Math.round(dot.x / s.cellSize);
|
|
343
|
+
const gy = Math.round(dot.y / s.cellSize);
|
|
344
|
+
infos.push({ dot, gx, gy });
|
|
345
|
+
if (gx < minGX) minGX = gx;
|
|
346
|
+
if (gx > maxGX) maxGX = gx;
|
|
347
|
+
if (gy < minGY) minGY = gy;
|
|
348
|
+
if (gy > maxGY) maxGY = gy;
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
if (!infos.length || !isFinite(minGX) || !isFinite(minGY)) {
|
|
352
|
+
s.isPlayingWinDiamond = false;
|
|
353
|
+
s.levelLifecycle.handleLevelSuccess();
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
const centerGX = Math.round((minGX + maxGX) / 2);
|
|
358
|
+
const centerGY = Math.round((minGY + maxGY) / 2);
|
|
359
|
+
|
|
360
|
+
const buckets = new Map<number, Phaser.GameObjects.Image[]>();
|
|
361
|
+
|
|
362
|
+
infos.forEach(({ dot, gx, gy }) => {
|
|
363
|
+
const dist = Math.abs(gx - centerGX) + Math.abs(gy - centerGY);
|
|
364
|
+
const arr = buckets.get(dist);
|
|
365
|
+
if (arr) {
|
|
366
|
+
arr.push(dot);
|
|
367
|
+
} else {
|
|
368
|
+
buckets.set(dist, [dot]);
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
const distKeys = Array.from(buckets.keys()).sort((a, b) => a - b);
|
|
373
|
+
const totalCount = dots.length;
|
|
374
|
+
let finishedCount = 0;
|
|
375
|
+
|
|
376
|
+
const spanGX = Math.max(1, maxGX - minGX + 1);
|
|
377
|
+
const spanGY = Math.max(1, maxGY - minGY + 1);
|
|
378
|
+
// 根据点的分布调整波纹间隔
|
|
379
|
+
const waveInterval = Phaser.Math.Clamp(
|
|
380
|
+
900 / Math.max(spanGX, spanGY),
|
|
381
|
+
25,
|
|
382
|
+
80,
|
|
383
|
+
);
|
|
384
|
+
|
|
385
|
+
/** 对指定距离层的点执行动画 */
|
|
386
|
+
const animateBucket = (dist: number) => {
|
|
387
|
+
if (!s.sys || !s.sys.isActive()) return;
|
|
388
|
+
|
|
389
|
+
const group = buckets.get(dist);
|
|
390
|
+
if (!group) return;
|
|
391
|
+
|
|
392
|
+
group.forEach((dot) => {
|
|
393
|
+
if (!dot || !dot.scene) return;
|
|
394
|
+
s.tweens.killTweensOf(dot);
|
|
395
|
+
|
|
396
|
+
const baseScale =
|
|
397
|
+
(dot.getData("baseScale") as number | undefined) || dot.scaleX || 1;
|
|
398
|
+
|
|
399
|
+
// 将所有点切换为发光的 win_dot 纹理
|
|
400
|
+
dot.setTexture("win_dot");
|
|
401
|
+
dot.setAlpha(0);
|
|
402
|
+
dot.setScale(baseScale * 0.5);
|
|
403
|
+
|
|
404
|
+
s.tweens.add({
|
|
405
|
+
targets: dot,
|
|
406
|
+
alpha: 1,
|
|
407
|
+
scale: baseScale * 1.3,
|
|
408
|
+
duration: 220,
|
|
409
|
+
ease: "Sine.easeOut",
|
|
410
|
+
onComplete: () => {
|
|
411
|
+
s.tweens.add({
|
|
412
|
+
targets: dot,
|
|
413
|
+
alpha: 0,
|
|
414
|
+
scale: 0,
|
|
415
|
+
duration: 260,
|
|
416
|
+
ease: "Sine.easeIn",
|
|
417
|
+
onComplete: () => {
|
|
418
|
+
dot.destroy();
|
|
419
|
+
finishedCount += 1;
|
|
420
|
+
if (finishedCount >= totalCount) {
|
|
421
|
+
s.isPlayingWinDiamond = false;
|
|
422
|
+
s.levelLifecycle.handleLevelSuccess();
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
});
|
|
426
|
+
},
|
|
427
|
+
});
|
|
428
|
+
});
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
distKeys.forEach((d) => {
|
|
432
|
+
s.time.delayedCall(d * waveInterval, () => {
|
|
433
|
+
animateBucket(d);
|
|
434
|
+
});
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
// ── 播放路径阻挡动画 ──
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* 路径被阻挡时的前进-后退动画。
|
|
442
|
+
* @param pathIndex 路径索引
|
|
443
|
+
* @param dx 方向增量X
|
|
444
|
+
* @param dy 方向增量Y
|
|
445
|
+
* @param steps 阻挡前的步数
|
|
446
|
+
*/
|
|
447
|
+
animateBlockedPath(
|
|
448
|
+
pathIndex: number,
|
|
449
|
+
dx: number,
|
|
450
|
+
dy: number,
|
|
451
|
+
steps: number,
|
|
452
|
+
): void {
|
|
453
|
+
const s = this.scene;
|
|
454
|
+
if (!s.level || !s.boardContainer) {
|
|
455
|
+
s.animatingPaths.delete(pathIndex);
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
s.blockedPaths.add(pathIndex);
|
|
460
|
+
|
|
461
|
+
const level = s.level;
|
|
462
|
+
const path = level.paths[pathIndex];
|
|
463
|
+
if (!path) {
|
|
464
|
+
s.animatingPaths.delete(pathIndex);
|
|
465
|
+
s.relayoutBoard();
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// 复用 buildPathTrack 构建离散格子轨迹
|
|
470
|
+
const baseTrack = s.buildPathTrack(path);
|
|
471
|
+
if (baseTrack.length === 0) {
|
|
472
|
+
s.animatingPaths.delete(pathIndex);
|
|
473
|
+
s.relayoutBoard();
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
// 创建可变副本,以便扩展前方格子
|
|
477
|
+
const track: { x: number; y: number }[] = [...baseTrack];
|
|
478
|
+
|
|
479
|
+
const baseLength = track.length;
|
|
480
|
+
const bodyLength = baseLength;
|
|
481
|
+
if (bodyLength <= 0) {
|
|
482
|
+
s.animatingPaths.delete(pathIndex);
|
|
483
|
+
s.relayoutBoard();
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
let tail = track[track.length - 1]!;
|
|
488
|
+
for (let i = 0; i < steps; i++) {
|
|
489
|
+
tail = { x: tail.x + dx, y: tail.y + dy };
|
|
490
|
+
track.push(tail);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
const g = s.add.graphics();
|
|
494
|
+
s.boardContainer.add(g);
|
|
495
|
+
|
|
496
|
+
let headStep = bodyLength - 1;
|
|
497
|
+
const maxHeadStep = bodyLength - 1 + steps;
|
|
498
|
+
let reversing = false;
|
|
499
|
+
|
|
500
|
+
/** 绘制当前帧 */
|
|
501
|
+
const drawFrame = () => {
|
|
502
|
+
g.clear();
|
|
503
|
+
const lineWidth = s.visualSize * PATH_LINE_WIDTH_RATIO;
|
|
504
|
+
const baseColor = s.getPathBaseColor(pathIndex);
|
|
505
|
+
const color = ENABLE_ERROR_PATH_HIGHLIGHT ? 0xff0000 : baseColor;
|
|
506
|
+
g.fillStyle(color, 1);
|
|
507
|
+
|
|
508
|
+
const tailStep = headStep - (bodyLength - 1);
|
|
509
|
+
const first = Math.max(tailStep, 0);
|
|
510
|
+
const last = Math.min(headStep, track.length - 1);
|
|
511
|
+
|
|
512
|
+
s.getPathRendererForLineWidth(lineWidth).render({
|
|
513
|
+
g,
|
|
514
|
+
track,
|
|
515
|
+
startSegmentIndex: first,
|
|
516
|
+
endSegmentIndexExclusive: last,
|
|
517
|
+
cellSize: s.cellSize,
|
|
518
|
+
lineWidth,
|
|
519
|
+
cellCenter: (col, row) => s.cellCenter(col, row),
|
|
520
|
+
fillAxisAlignedSegmentRect: (g2, x1, y1, x2, y2, w) =>
|
|
521
|
+
s.fillAxisAlignedSegmentRect(g2, x1, y1, x2, y2, w),
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
const headIndex = Math.min(headStep, track.length - 1);
|
|
525
|
+
const headCell = track[headIndex]!;
|
|
526
|
+
const headCenter = s.cellCenter(headCell.x, headCell.y);
|
|
527
|
+
|
|
528
|
+
let dirX = dx;
|
|
529
|
+
let dirY = dy;
|
|
530
|
+
if (headIndex > 0) {
|
|
531
|
+
const prev = track[headIndex - 1]!;
|
|
532
|
+
dirX = headCell.x - prev.x;
|
|
533
|
+
dirY = headCell.y - prev.y;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
let angle = Math.atan2(dirY, dirX) + Math.PI / 2;
|
|
537
|
+
if (angle > Math.PI) {
|
|
538
|
+
angle -= Math.PI * 2;
|
|
539
|
+
}
|
|
540
|
+
s.drawArrowHead(g, headCenter.x, headCenter.y, angle, color);
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
drawFrame();
|
|
544
|
+
|
|
545
|
+
const moveEvent = s.time.addEvent({
|
|
546
|
+
delay: MOVE_STEP_MS,
|
|
547
|
+
callback: () => {
|
|
548
|
+
if (!reversing) {
|
|
549
|
+
if (headStep < maxHeadStep) {
|
|
550
|
+
headStep++;
|
|
551
|
+
} else {
|
|
552
|
+
reversing = true;
|
|
553
|
+
}
|
|
554
|
+
} else {
|
|
555
|
+
if (headStep > bodyLength - 1) {
|
|
556
|
+
headStep--;
|
|
557
|
+
} else {
|
|
558
|
+
s.animatingPaths.delete(pathIndex);
|
|
559
|
+
s.blockedPaths.add(pathIndex);
|
|
560
|
+
s.relayoutBoard();
|
|
561
|
+
g.destroy();
|
|
562
|
+
moveEvent.remove(false);
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
drawFrame();
|
|
568
|
+
},
|
|
569
|
+
callbackScope: this,
|
|
570
|
+
loop: true,
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
// ── 生成轨迹点 ──
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* 在指定位置生成一个轨迹点(normal_dot 或 win_dot)。
|
|
578
|
+
* @param x X坐标
|
|
579
|
+
* @param y Y坐标
|
|
580
|
+
* @param isWin 是否为胜利点(带动画效果)
|
|
581
|
+
*/
|
|
582
|
+
spawnTrailDot(x: number, y: number, isWin: boolean): void {
|
|
583
|
+
const s = this.scene;
|
|
584
|
+
if (!s.boardContainer || !s.shouldDrawEliminationTrail) return;
|
|
585
|
+
const textureKey = isWin ? "win_dot" : "normal_dot";
|
|
586
|
+
const dot = s.add.image(x, y, textureKey);
|
|
587
|
+
s.boardContainer.addAt(dot, 0);
|
|
588
|
+
dot.setOrigin(0.5, 0.5);
|
|
589
|
+
dot.setDepth(-5);
|
|
590
|
+
|
|
591
|
+
const targetPixelSize = s.cellSize * 0.4;
|
|
592
|
+
const texWidth = dot.width || 1;
|
|
593
|
+
const baseScale = targetPixelSize / texWidth;
|
|
594
|
+
dot.setData("baseScale", baseScale);
|
|
595
|
+
|
|
596
|
+
if (!isWin) {
|
|
597
|
+
// 普通消除:静态点,无动画
|
|
598
|
+
dot.setScale(baseScale);
|
|
599
|
+
dot.setAlpha(1);
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
// 胜利:带动画的 win_dot
|
|
604
|
+
dot.setScale(baseScale * 0.3);
|
|
605
|
+
dot.setAlpha(0);
|
|
606
|
+
|
|
607
|
+
s.tweens.add({
|
|
608
|
+
targets: dot,
|
|
609
|
+
alpha: { from: 0, to: 1 },
|
|
610
|
+
scaleX: { from: baseScale * 0.3, to: baseScale },
|
|
611
|
+
scaleY: { from: baseScale * 0.3, to: baseScale },
|
|
612
|
+
duration: 550,
|
|
613
|
+
ease: "Sine.easeOut",
|
|
614
|
+
yoyo: true,
|
|
615
|
+
repeat: 1,
|
|
616
|
+
onComplete: () => {
|
|
617
|
+
dot.destroy();
|
|
618
|
+
},
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
// ── 播放开场缩放动画 ──
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* 播放关卡开场缩放动画:峰值 -> 0.8 -> 1.0。
|
|
626
|
+
* @param targetZoom 目标缩放值
|
|
627
|
+
*/
|
|
628
|
+
playIntroZoomAnimation(targetZoom: number): void {
|
|
629
|
+
const s = this.scene;
|
|
630
|
+
if (!s.boardContainer) {
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
const clampedTarget = Phaser.Math.Clamp(targetZoom, s.minZoom, s.maxZoom);
|
|
635
|
+
|
|
636
|
+
// 优化的缩放动画:0.8 -> 峰值 -> 1
|
|
637
|
+
const startZoom = 0.8;
|
|
638
|
+
const peakZoom = Phaser.Math.Clamp(
|
|
639
|
+
clampedTarget * 1.25,
|
|
640
|
+
s.minZoom,
|
|
641
|
+
s.maxZoom,
|
|
642
|
+
);
|
|
643
|
+
const finalZoom = 1.0;
|
|
644
|
+
|
|
645
|
+
// 如果峰值与起始值太接近,跳过动画
|
|
646
|
+
if (peakZoom - startZoom < 0.15) {
|
|
647
|
+
return;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
if (s.zoomTween) {
|
|
651
|
+
s.zoomTween.stop();
|
|
652
|
+
s.zoomTween = null;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
// 从峰值缩放开始
|
|
656
|
+
s.zoom = peakZoom;
|
|
657
|
+
s.positionBoardContainer();
|
|
658
|
+
|
|
659
|
+
// 使用场景的 levelIntroDurationMs(默认975ms)
|
|
660
|
+
const introDurationMs = 975;
|
|
661
|
+
|
|
662
|
+
// 时间分配:缩小到0.8(50%)-> 放大到1(50%)
|
|
663
|
+
const zoomDownDuration = Math.max(250, Math.floor(introDurationMs * 0.5));
|
|
664
|
+
const zoomUpDuration = Math.max(250, introDurationMs - zoomDownDuration);
|
|
665
|
+
|
|
666
|
+
// 阶段1:从峰值缩小到0.8以展示完整棋盘
|
|
667
|
+
s.zoomTween = s.tweens.add({
|
|
668
|
+
targets: s,
|
|
669
|
+
zoom: startZoom,
|
|
670
|
+
duration: zoomDownDuration,
|
|
671
|
+
ease: "Cubic.easeOut",
|
|
672
|
+
onUpdate: () => {
|
|
673
|
+
s.positionBoardContainer();
|
|
674
|
+
},
|
|
675
|
+
onComplete: () => {
|
|
676
|
+
// 阶段2:从0.8放大回1.0
|
|
677
|
+
s.zoomTween = s.tweens.add({
|
|
678
|
+
targets: s,
|
|
679
|
+
zoom: finalZoom,
|
|
680
|
+
duration: zoomUpDuration,
|
|
681
|
+
ease: "Back.easeOut",
|
|
682
|
+
onUpdate: () => {
|
|
683
|
+
s.positionBoardContainer();
|
|
684
|
+
},
|
|
685
|
+
onComplete: () => {
|
|
686
|
+
s.zoomTween = null;
|
|
687
|
+
s.zoom = finalZoom;
|
|
688
|
+
s.positionBoardContainer();
|
|
689
|
+
},
|
|
690
|
+
});
|
|
691
|
+
},
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
}
|