@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,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: slide_out_to_tray_animation.aicomponent
|
|
3
|
+
description: 两阶段路径消除动画。阶段1:整条路径(多格精灵容器)沿方向匀速滑出棋盘边界。阶段2:head 精灵贝塞尔曲线飞入篮子目标槽位并缩放。用于箭头推出+篮子收集类玩法。
|
|
4
|
+
triggers: 需要路径滑出动画、飞入篮子动画、两阶段消除动画时触发。
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 滑出棋盘+飞入篮子动画(Slide-Out to Tray Animation)
|
|
8
|
+
|
|
9
|
+
## 说明
|
|
10
|
+
|
|
11
|
+
专为"路径推出 → 收集到篮子"设计的两阶段动画:
|
|
12
|
+
|
|
13
|
+
1. **阶段1 - 滑出**:创建临时容器包含路径所有精灵,Tween 沿方向滑出
|
|
14
|
+
2. **阶段2 - 飞入**:保留 head 精灵,贝塞尔抛物线飞入篮子槽位,同时缩放+旋转回正
|
|
15
|
+
|
|
16
|
+
## Scaffold
|
|
17
|
+
|
|
18
|
+
| 目标路径 | 来源 | 说明 |
|
|
19
|
+
|---------|-----|------|
|
|
20
|
+
| `src/game/ui/AnimationManager.ts` | `ref/AnimationManager.ts` | 动画管理器 |
|
|
21
|
+
|
|
22
|
+
## 关键接口
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
class AnimationManager {
|
|
26
|
+
slideOutAndFlyToTray(
|
|
27
|
+
path: LevelPath,
|
|
28
|
+
stepsToExit: number,
|
|
29
|
+
boardRenderer: BoardRenderer,
|
|
30
|
+
trayRenderer: TrayRenderer,
|
|
31
|
+
trayInsertIndex: number,
|
|
32
|
+
onSlideComplete: () => void,
|
|
33
|
+
onFlyComplete: () => void,
|
|
34
|
+
): void;
|
|
35
|
+
|
|
36
|
+
bounceIn(sprite: Phaser.GameObjects.Image): void;
|
|
37
|
+
playWinAnimation(): void;
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Recipe
|
|
42
|
+
|
|
43
|
+
| 决策 | 原因 |
|
|
44
|
+
|------|------|
|
|
45
|
+
| **两阶段分离** | 滑出(路径整体移动)和飞入(单个头部精灵曲线运动)是不同物理行为,分阶段更易调参,且两段可分别中断 |
|
|
46
|
+
| **贝塞尔弧线** | 线性飞行感觉机械;抛物线弧度模拟真实抛体,视觉上更有"弹性"和"收集"感 |
|
|
47
|
+
| **回调驱动完成信号** | `onSlideComplete` / `onFlyComplete` 让 GameScene 精确控制游戏状态更新时机(不在动画开始时更新,而在动画完成后更新)|
|
|
48
|
+
|
|
49
|
+
## Adapter
|
|
50
|
+
|
|
51
|
+
- **Role**: `slideOutToTrayAnimation` — 路径滑出棋盘+飞入篮子两阶段动画
|
|
52
|
+
- **Provides**: `AnimationManager` 类(`slideOutAndFlyToTray()`、`bounceIn()`、`playWinAnimation()`)
|
|
53
|
+
- **Requires**: `phaser.aicomponent`、`tray_container.aicomponent`(TrayRenderer 槽位坐标),与 `grid_board_layout.aicomponent` 间接依赖(通过 BoardRenderer)
|
|
54
|
+
- **Consumed by**: `game_scene.aicomponent`(路径成功消除后调用 `slideOutAndFlyToTray()`)
|
|
55
|
+
- **Integration point**: `src/game/ui/AnimationManager.ts` → `Game.ts` 在路径消除成功时触发
|
|
56
|
+
|
|
57
|
+
## 可配参数
|
|
58
|
+
|
|
59
|
+
| 参数 | 默认 | 说明 |
|
|
60
|
+
|------|------|------|
|
|
61
|
+
| slideDuration | 350ms | 滑出阶段时长 |
|
|
62
|
+
| flyDuration | 400ms | 飞入阶段时长 |
|
|
63
|
+
| arcHeight | 60px | 贝塞尔曲线上拱高度 |
|
|
64
|
+
| ease | "Power2" | 缓动函数 |
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"atomId": "slide_out_to_tray_animation.aicomponent",
|
|
4
|
+
"bundleType": "aicomponent",
|
|
5
|
+
"category": "animation",
|
|
6
|
+
"mode": "fixed",
|
|
7
|
+
"label": {
|
|
8
|
+
"zh": "滑出棋盘+飞入篮子两阶段动画",
|
|
9
|
+
"en": "Slide-out + fly-to-tray two-phase animation"
|
|
10
|
+
},
|
|
11
|
+
"tags": ["animation", "slide-out", "fly", "tray", "bezier", "tween", "path", "arrow", "threejs", "3d"],
|
|
12
|
+
"bindingRoles": ["slideOutToTrayAnimation"],
|
|
13
|
+
"engineVariants": {
|
|
14
|
+
"phaser": {
|
|
15
|
+
"imports": ["phaser.aicomponent", "tray_container.aicomponent", "grid_board_layout.aicomponent"],
|
|
16
|
+
"scaffoldFiles": {
|
|
17
|
+
"src/game/ui/AnimationManager.ts": { "source": "ref/AnimationManager.ts", "mode": "full", "weight": 10 }
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"threejs": {
|
|
21
|
+
"imports": ["threejs.aicomponent", "tray_container.aicomponent", "grid_board_layout.aicomponent"],
|
|
22
|
+
"scaffoldFiles": {
|
|
23
|
+
"src/game/ui/AnimationManager3D.ts": { "source": "ref/AnimationManager3D.ts", "mode": "full", "weight": 10 },
|
|
24
|
+
"src/game/utils/BezierUtils.ts": { "source": "ref/BezierUtils.ts", "mode": "full", "weight": 10 }
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"imports": [
|
|
29
|
+
{ "slot": "engine", "pinAtomId": "phaser.aicomponent", "edgeKind": "requires", "bindAs": "engine" },
|
|
30
|
+
{ "slot": "tray", "pinAtomId": "tray_container.aicomponent", "edgeKind": "requires", "bindAs": "tray" },
|
|
31
|
+
{ "slot": "boardLayout", "pinAtomId": "grid_board_layout.aicomponent", "edgeKind": "requires", "bindAs": "boardLayout" }
|
|
32
|
+
],
|
|
33
|
+
"binding": {
|
|
34
|
+
"role": "slideOutToTrayAnimation",
|
|
35
|
+
"target": "src/game/ui/AnimationManager.ts",
|
|
36
|
+
"type": "code-module-reference"
|
|
37
|
+
},
|
|
38
|
+
"exports": [
|
|
39
|
+
{ "name": "AnimationManager", "kind": "class", "location": "src/game/ui/AnimationManager.ts" },
|
|
40
|
+
{ "name": "AnimationManager3D", "kind": "class", "location": "src/game/ui/AnimationManager3D.ts" },
|
|
41
|
+
{ "name": "BezierUtils", "kind": "module", "location": "src/game/utils/BezierUtils.ts" }
|
|
42
|
+
],
|
|
43
|
+
"neutralDescriptor": {
|
|
44
|
+
"geometry": "two-phase animation: slide path along direction until off-board, then fly head entity along bezier curve to tray target position",
|
|
45
|
+
"layers": ["animation-sequencing", "bezier-interpolation", "easing"],
|
|
46
|
+
"replaceable": ["slide duration", "fly duration", "arc height", "easing function"]
|
|
47
|
+
},
|
|
48
|
+
"usageHints": [
|
|
49
|
+
"两阶段动画:阶段1 整条路径沿方向滑出棋盘,阶段2 head 实体沿贝塞尔曲线飞入篮子",
|
|
50
|
+
"AnimationManager3D 需要每帧调用 update(dt) 驱动动画",
|
|
51
|
+
"3D 模式飞入弧线天然有 Y 轴高度(抛物线),视觉效果比 2D 更自然",
|
|
52
|
+
"BezierUtils.ts 提供纯数学贝塞尔插值,两端引擎实现均可复用"
|
|
53
|
+
],
|
|
54
|
+
"files": {
|
|
55
|
+
"skill": "SKILL.md",
|
|
56
|
+
"ref": ["ref/AnimationManager.ts", "ref/AnimationManager3D.ts", "ref/BezierUtils.ts"]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import * as Phaser from "phaser";
|
|
2
|
+
import type { LevelPath } from "../logic/types";
|
|
3
|
+
import { colorToTextureKey, directionToAngle, directionToDelta } from "../logic/types";
|
|
4
|
+
import { GameConfig } from "../GameConfig";
|
|
5
|
+
import { BoardRenderer } from "./BoardRenderer";
|
|
6
|
+
import { TrayRenderer } from "./TrayRenderer";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 动画管理器
|
|
10
|
+
* 整条路径滑出棋盘 → head 车飞入篮子 → 消除 → 抖动
|
|
11
|
+
*/
|
|
12
|
+
export class AnimationManager {
|
|
13
|
+
private scene: Phaser.Scene;
|
|
14
|
+
|
|
15
|
+
constructor(scene: Phaser.Scene) {
|
|
16
|
+
this.scene = scene;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 整条路径沿方向滑出棋盘,然后 head 飞入篮子
|
|
21
|
+
*/
|
|
22
|
+
slideOutAndFlyToTray(
|
|
23
|
+
path: LevelPath,
|
|
24
|
+
stepsToExit: number,
|
|
25
|
+
boardRenderer: BoardRenderer,
|
|
26
|
+
trayRenderer: TrayRenderer,
|
|
27
|
+
trayInsertIndex: number,
|
|
28
|
+
onSlideComplete: () => void,
|
|
29
|
+
onFlyComplete: () => void,
|
|
30
|
+
): void {
|
|
31
|
+
const { dx, dy } = directionToDelta(path.direction);
|
|
32
|
+
const cellSize = boardRenderer.cellSize;
|
|
33
|
+
const slideDistance = (stepsToExit + path.points.length) * cellSize;
|
|
34
|
+
|
|
35
|
+
// 创建一个容器来装整条路径的所有汽车
|
|
36
|
+
const slideContainer = this.scene.add.container(0, 0);
|
|
37
|
+
slideContainer.setDepth(1000);
|
|
38
|
+
|
|
39
|
+
const textureKey = colorToTextureKey(path.color);
|
|
40
|
+
const carSize = cellSize * GameConfig.CAR_CELL_RATIO;
|
|
41
|
+
|
|
42
|
+
// 为路径的每个点创建一辆车
|
|
43
|
+
const carSprites: Phaser.GameObjects.Image[] = [];
|
|
44
|
+
for (let ptIdx = 0; ptIdx < path.points.length; ptIdx++) {
|
|
45
|
+
const pt = path.points[ptIdx];
|
|
46
|
+
const worldPos = boardRenderer.getCellWorldPos(pt.y, pt.x);
|
|
47
|
+
|
|
48
|
+
const car = this.scene.add.image(worldPos.x, worldPos.y, textureKey);
|
|
49
|
+
car.setOrigin(0.5);
|
|
50
|
+
|
|
51
|
+
// 所有车统一朝向路径推出方向
|
|
52
|
+
car.setRotation(directionToAngle(path.direction));
|
|
53
|
+
|
|
54
|
+
const scale = Math.min(carSize / car.width, carSize / car.height);
|
|
55
|
+
car.setScale(scale);
|
|
56
|
+
slideContainer.add(car);
|
|
57
|
+
carSprites.push(car);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// 阶段 1:整条路径沿方向滑出
|
|
61
|
+
this.scene.tweens.add({
|
|
62
|
+
targets: slideContainer,
|
|
63
|
+
x: dx * slideDistance,
|
|
64
|
+
y: dy * slideDistance,
|
|
65
|
+
duration: 350,
|
|
66
|
+
ease: "Power2",
|
|
67
|
+
onComplete: () => {
|
|
68
|
+
// 销毁 body 车,保留 head 车做飞入动画
|
|
69
|
+
const headCar = carSprites[carSprites.length - 1];
|
|
70
|
+
for (let i = 0; i < carSprites.length - 1; i++) {
|
|
71
|
+
carSprites[i].destroy();
|
|
72
|
+
}
|
|
73
|
+
slideContainer.remove(headCar);
|
|
74
|
+
slideContainer.destroy();
|
|
75
|
+
|
|
76
|
+
// head 车的当前世界位置
|
|
77
|
+
const currentX = headCar.x + dx * slideDistance;
|
|
78
|
+
const currentY = headCar.y + dy * slideDistance;
|
|
79
|
+
headCar.setPosition(currentX, currentY);
|
|
80
|
+
|
|
81
|
+
onSlideComplete();
|
|
82
|
+
|
|
83
|
+
// 阶段 2:head 车飞入篮子
|
|
84
|
+
const toPos = trayRenderer.getSlotWorldPos(trayInsertIndex);
|
|
85
|
+
const midX = (currentX + toPos.x) / 2;
|
|
86
|
+
const midY = Math.min(currentY, toPos.y) - 60;
|
|
87
|
+
|
|
88
|
+
const traySize = Math.min(cellSize * 0.5, GameConfig.CAR_TRAY_SIZE);
|
|
89
|
+
const endScale = Math.min(traySize / headCar.width, traySize / headCar.height);
|
|
90
|
+
const startX = currentX;
|
|
91
|
+
const startY = currentY;
|
|
92
|
+
const startScale = headCar.scaleX;
|
|
93
|
+
|
|
94
|
+
this.scene.tweens.add({
|
|
95
|
+
targets: { t: 0 },
|
|
96
|
+
t: 1,
|
|
97
|
+
duration: GameConfig.FLY_DURATION,
|
|
98
|
+
ease: "Power2",
|
|
99
|
+
onUpdate: (_tween: Phaser.Tweens.Tween, target: { t: number }) => {
|
|
100
|
+
const t = target.t;
|
|
101
|
+
const px = (1 - t) * (1 - t) * startX + 2 * (1 - t) * t * midX + t * t * toPos.x;
|
|
102
|
+
const py = (1 - t) * (1 - t) * startY + 2 * (1 - t) * t * midY + t * t * toPos.y;
|
|
103
|
+
headCar.setPosition(px, py);
|
|
104
|
+
headCar.setScale(startScale + (endScale - startScale) * t);
|
|
105
|
+
headCar.setRotation(headCar.rotation * (1 - t * 0.5));
|
|
106
|
+
},
|
|
107
|
+
onComplete: () => {
|
|
108
|
+
headCar.destroy();
|
|
109
|
+
onFlyComplete();
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* 物品入场弹跳动画
|
|
118
|
+
*/
|
|
119
|
+
bounceIn(sprite: Phaser.GameObjects.Image): void {
|
|
120
|
+
const targetScale = sprite.scaleX;
|
|
121
|
+
sprite.setScale(0);
|
|
122
|
+
this.scene.tweens.add({
|
|
123
|
+
targets: sprite,
|
|
124
|
+
scaleX: targetScale,
|
|
125
|
+
scaleY: targetScale,
|
|
126
|
+
duration: 200,
|
|
127
|
+
ease: "Back.easeOut",
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* 胜利粒子动画
|
|
133
|
+
*/
|
|
134
|
+
playWinAnimation(): void {
|
|
135
|
+
const { width, height } = this.scene.scale;
|
|
136
|
+
const particles = 25;
|
|
137
|
+
|
|
138
|
+
for (let i = 0; i < particles; i++) {
|
|
139
|
+
const x = Phaser.Math.Between(Math.round(width * 0.1), Math.round(width * 0.9));
|
|
140
|
+
const y = Phaser.Math.Between(Math.round(height * 0.2), Math.round(height * 0.7));
|
|
141
|
+
const size = Phaser.Math.Between(8, 20);
|
|
142
|
+
const color = Phaser.Math.Between(0x000000, 0xffffff);
|
|
143
|
+
|
|
144
|
+
const particle = this.scene.add.graphics();
|
|
145
|
+
particle.fillStyle(color, 1);
|
|
146
|
+
particle.fillCircle(0, 0, size);
|
|
147
|
+
particle.setPosition(x, y);
|
|
148
|
+
particle.setAlpha(0);
|
|
149
|
+
particle.setDepth(2000);
|
|
150
|
+
|
|
151
|
+
this.scene.tweens.add({
|
|
152
|
+
targets: particle,
|
|
153
|
+
alpha: 1,
|
|
154
|
+
y: y - Phaser.Math.Between(50, 150),
|
|
155
|
+
scaleX: 0,
|
|
156
|
+
scaleY: 0,
|
|
157
|
+
duration: Phaser.Math.Between(600, 1200),
|
|
158
|
+
delay: i * 50,
|
|
159
|
+
ease: "Power2",
|
|
160
|
+
onComplete: () => particle.destroy(),
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { quadraticBezier3D, easeOutQuad, lerp, type Vec3 } from "./BezierUtils";
|
|
3
|
+
|
|
4
|
+
export interface SlideOutConfig {
|
|
5
|
+
slideDuration?: number; // 滑出时长 ms,默认 350
|
|
6
|
+
flyDuration?: number; // 飞入时长 ms,默认 400
|
|
7
|
+
arcHeight?: number; // 飞入弧线高度(世界单位),默认 2.0
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface ActiveAnimation {
|
|
11
|
+
type: "slide" | "fly";
|
|
12
|
+
elapsed: number;
|
|
13
|
+
duration: number;
|
|
14
|
+
// slide 专用
|
|
15
|
+
container?: THREE.Group;
|
|
16
|
+
slideDirection?: THREE.Vector3;
|
|
17
|
+
slideDistance?: number;
|
|
18
|
+
// fly 专用
|
|
19
|
+
mesh?: THREE.Mesh;
|
|
20
|
+
startPos?: Vec3;
|
|
21
|
+
controlPos?: Vec3;
|
|
22
|
+
endPos?: Vec3;
|
|
23
|
+
startScale?: number;
|
|
24
|
+
endScale?: number;
|
|
25
|
+
// 回调
|
|
26
|
+
onComplete: () => void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Three.js 3D 滑出+飞入两阶段动画管理器
|
|
31
|
+
*
|
|
32
|
+
* 阶段1:整条路径(Group)沿方向滑出棋盘
|
|
33
|
+
* 阶段2:Head 模型沿 3D 贝塞尔曲线飞入篮子位置(带 Y 轴弧线)
|
|
34
|
+
*/
|
|
35
|
+
export class AnimationManager3D {
|
|
36
|
+
private scene: THREE.Scene;
|
|
37
|
+
private config: Required<SlideOutConfig>;
|
|
38
|
+
private activeAnimations: ActiveAnimation[] = [];
|
|
39
|
+
|
|
40
|
+
constructor(scene: THREE.Scene, config?: SlideOutConfig) {
|
|
41
|
+
this.scene = scene;
|
|
42
|
+
this.config = {
|
|
43
|
+
slideDuration: config?.slideDuration ?? 350,
|
|
44
|
+
flyDuration: config?.flyDuration ?? 400,
|
|
45
|
+
arcHeight: config?.arcHeight ?? 2.0,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 执行完整的滑出+飞入动画
|
|
51
|
+
* @param pathMeshes 路径上所有 cell 的 Mesh 数组
|
|
52
|
+
* @param direction 滑出方向 { dx, dz }
|
|
53
|
+
* @param stepsToExit 到边界的格子数
|
|
54
|
+
* @param cellSize 格子大小
|
|
55
|
+
* @param targetPos 篮子目标位置(世界坐标)
|
|
56
|
+
* @param onSlideComplete 滑出完成回调
|
|
57
|
+
* @param onFlyComplete 飞入完成回调
|
|
58
|
+
*/
|
|
59
|
+
slideOutAndFlyToTray(
|
|
60
|
+
pathMeshes: THREE.Mesh[],
|
|
61
|
+
direction: { dx: number; dz: number },
|
|
62
|
+
stepsToExit: number,
|
|
63
|
+
cellSize: number,
|
|
64
|
+
targetPos: THREE.Vector3,
|
|
65
|
+
onSlideComplete: () => void,
|
|
66
|
+
onFlyComplete: () => void,
|
|
67
|
+
): void {
|
|
68
|
+
if (pathMeshes.length === 0) {
|
|
69
|
+
onSlideComplete();
|
|
70
|
+
onFlyComplete();
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// 阶段1:创建容器,所有 mesh 放入其中统一移动
|
|
75
|
+
const container = new THREE.Group();
|
|
76
|
+
const meshPositions: THREE.Vector3[] = [];
|
|
77
|
+
|
|
78
|
+
for (const mesh of pathMeshes) {
|
|
79
|
+
meshPositions.push(mesh.position.clone());
|
|
80
|
+
container.add(mesh);
|
|
81
|
+
// mesh 在 container 内保持世界位置
|
|
82
|
+
mesh.position.copy(mesh.position);
|
|
83
|
+
}
|
|
84
|
+
this.scene.add(container);
|
|
85
|
+
|
|
86
|
+
const slideDistance = (stepsToExit + pathMeshes.length) * cellSize;
|
|
87
|
+
const slideDir = new THREE.Vector3(direction.dx, 0, direction.dz).normalize();
|
|
88
|
+
|
|
89
|
+
// 启动滑出动画
|
|
90
|
+
this.activeAnimations.push({
|
|
91
|
+
type: "slide",
|
|
92
|
+
elapsed: 0,
|
|
93
|
+
duration: this.config.slideDuration / 1000,
|
|
94
|
+
container,
|
|
95
|
+
slideDirection: slideDir,
|
|
96
|
+
slideDistance,
|
|
97
|
+
onComplete: () => {
|
|
98
|
+
// 滑出完成:取出 head mesh 做飞入,销毁其余
|
|
99
|
+
const headMesh = pathMeshes[pathMeshes.length - 1];
|
|
100
|
+
const headWorldPos = new THREE.Vector3();
|
|
101
|
+
headMesh.getWorldPosition(headWorldPos);
|
|
102
|
+
|
|
103
|
+
// 销毁 body meshes
|
|
104
|
+
for (let i = 0; i < pathMeshes.length - 1; i++) {
|
|
105
|
+
const m = pathMeshes[i];
|
|
106
|
+
m.geometry.dispose();
|
|
107
|
+
(m.material as THREE.Material).dispose();
|
|
108
|
+
}
|
|
109
|
+
container.remove(headMesh);
|
|
110
|
+
this.scene.remove(container);
|
|
111
|
+
|
|
112
|
+
// head 放回场景
|
|
113
|
+
headMesh.position.copy(headWorldPos);
|
|
114
|
+
this.scene.add(headMesh);
|
|
115
|
+
|
|
116
|
+
onSlideComplete();
|
|
117
|
+
|
|
118
|
+
// 阶段2:head 飞入篮子
|
|
119
|
+
const startPos: Vec3 = { x: headWorldPos.x, y: headWorldPos.y, z: headWorldPos.z };
|
|
120
|
+
const endPos: Vec3 = { x: targetPos.x, y: targetPos.y, z: targetPos.z };
|
|
121
|
+
|
|
122
|
+
// 控制点:中间位置 + Y 轴抬升
|
|
123
|
+
const controlPos: Vec3 = {
|
|
124
|
+
x: (startPos.x + endPos.x) / 2,
|
|
125
|
+
y: Math.max(startPos.y, endPos.y) + this.config.arcHeight,
|
|
126
|
+
z: (startPos.z + endPos.z) / 2,
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
this.activeAnimations.push({
|
|
130
|
+
type: "fly",
|
|
131
|
+
elapsed: 0,
|
|
132
|
+
duration: this.config.flyDuration / 1000,
|
|
133
|
+
mesh: headMesh,
|
|
134
|
+
startPos,
|
|
135
|
+
controlPos,
|
|
136
|
+
endPos,
|
|
137
|
+
startScale: headMesh.scale.x,
|
|
138
|
+
endScale: headMesh.scale.x * 0.5,
|
|
139
|
+
onComplete: () => {
|
|
140
|
+
this.scene.remove(headMesh);
|
|
141
|
+
headMesh.geometry.dispose();
|
|
142
|
+
(headMesh.material as THREE.Material).dispose();
|
|
143
|
+
onFlyComplete();
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* 每帧更新(驱动动画)
|
|
152
|
+
* @param dt 帧间隔(秒)
|
|
153
|
+
*/
|
|
154
|
+
update(dt: number): void {
|
|
155
|
+
for (let i = this.activeAnimations.length - 1; i >= 0; i--) {
|
|
156
|
+
const anim = this.activeAnimations[i];
|
|
157
|
+
anim.elapsed += dt;
|
|
158
|
+
const t = Math.min(anim.elapsed / anim.duration, 1);
|
|
159
|
+
const eased = easeOutQuad(t);
|
|
160
|
+
|
|
161
|
+
if (anim.type === "slide" && anim.container && anim.slideDirection) {
|
|
162
|
+
// 滑出:容器沿方向平移
|
|
163
|
+
const dist = eased * anim.slideDistance!;
|
|
164
|
+
anim.container.position.copy(anim.slideDirection.clone().multiplyScalar(dist));
|
|
165
|
+
} else if (anim.type === "fly" && anim.mesh && anim.startPos && anim.controlPos && anim.endPos) {
|
|
166
|
+
// 飞入:贝塞尔曲线
|
|
167
|
+
const pos = quadraticBezier3D(anim.startPos, anim.controlPos, anim.endPos, eased);
|
|
168
|
+
anim.mesh.position.set(pos.x, pos.y, pos.z);
|
|
169
|
+
|
|
170
|
+
// 缩放插值
|
|
171
|
+
const scale = lerp(anim.startScale!, anim.endScale!, eased);
|
|
172
|
+
anim.mesh.scale.setScalar(scale);
|
|
173
|
+
|
|
174
|
+
// 旋转衰减
|
|
175
|
+
anim.mesh.rotation.y *= (1 - eased * 0.5);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (t >= 1) {
|
|
179
|
+
anim.onComplete();
|
|
180
|
+
this.activeAnimations.splice(i, 1);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* 是否有动画正在播放
|
|
187
|
+
*/
|
|
188
|
+
isAnimating(): boolean {
|
|
189
|
+
return this.activeAnimations.length > 0;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* 销毁
|
|
194
|
+
*/
|
|
195
|
+
destroy(): void {
|
|
196
|
+
this.activeAnimations = [];
|
|
197
|
+
}
|
|
198
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 纯数学贝塞尔插值工具(引擎无关)
|
|
3
|
+
* 支持 2D 和 3D 贝塞尔曲线计算
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface Vec2 { x: number; y: number; }
|
|
7
|
+
export interface Vec3 { x: number; y: number; z: number; }
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 二次贝塞尔曲线插值(2D)
|
|
11
|
+
* @param p0 起点
|
|
12
|
+
* @param p1 控制点
|
|
13
|
+
* @param p2 终点
|
|
14
|
+
* @param t 插值参数 [0, 1]
|
|
15
|
+
*/
|
|
16
|
+
export function quadraticBezier2D(p0: Vec2, p1: Vec2, p2: Vec2, t: number): Vec2 {
|
|
17
|
+
const mt = 1 - t;
|
|
18
|
+
return {
|
|
19
|
+
x: mt * mt * p0.x + 2 * mt * t * p1.x + t * t * p2.x,
|
|
20
|
+
y: mt * mt * p0.y + 2 * mt * t * p1.y + t * t * p2.y,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 二次贝塞尔曲线插值(3D)
|
|
26
|
+
* @param p0 起点
|
|
27
|
+
* @param p1 控制点
|
|
28
|
+
* @param p2 终点
|
|
29
|
+
* @param t 插值参数 [0, 1]
|
|
30
|
+
*/
|
|
31
|
+
export function quadraticBezier3D(p0: Vec3, p1: Vec3, p2: Vec3, t: number): Vec3 {
|
|
32
|
+
const mt = 1 - t;
|
|
33
|
+
return {
|
|
34
|
+
x: mt * mt * p0.x + 2 * mt * t * p1.x + t * t * p2.x,
|
|
35
|
+
y: mt * mt * p0.y + 2 * mt * t * p1.y + t * t * p2.y,
|
|
36
|
+
z: mt * mt * p0.z + 2 * mt * t * p1.z + t * t * p2.z,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 缓动函数:easeOutQuad
|
|
42
|
+
*/
|
|
43
|
+
export function easeOutQuad(t: number): number {
|
|
44
|
+
return 1 - (1 - t) * (1 - t);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 缓动函数:easeInOutQuad
|
|
49
|
+
*/
|
|
50
|
+
export function easeInOutQuad(t: number): number {
|
|
51
|
+
return t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* 线性插值
|
|
56
|
+
*/
|
|
57
|
+
export function lerp(a: number, b: number, t: number): number {
|
|
58
|
+
return a + (b - a) * t;
|
|
59
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: slot_machine.aigameplay
|
|
3
|
+
description: 老虎机转轮玩法封包 - 经典3轴转轮老虎机,支持连线中奖、Wild通配符和Scatter散布奖励
|
|
4
|
+
triggers: 老虎机,slot,转轮,reel,spin,旋转,赌博,casino,中奖,win,连线,payline,wild,scatter,符号,symbol
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# slot_machine.aigameplay
|
|
8
|
+
|
|
9
|
+
老虎机转轮玩法封包。实现经典3轴(可扩展至5轴)转轮老虎机规则的 PGS JSON 和 reducer,玩家下注并旋转转轮,按连线规则判定中奖,支持 Wild 通配符和 Scatter 散布奖励。
|
|
10
|
+
|
|
11
|
+
## Recipe
|
|
12
|
+
|
|
13
|
+
- **玩法类型**:slot_machine(老虎机转轮)
|
|
14
|
+
- **参考文件**:
|
|
15
|
+
- `ref/pgs-schema.json`:PGS (PlayCraft Gameplay Schema, 玩法定义规范) 规则骨架(entities、rules、algorithm、testCases)
|
|
16
|
+
- `ref/reducer.template.ts`:reducer 接口约束模板(`init` / `dispatch` / `getState` + 分步函数)
|
|
17
|
+
- **核心规则**:
|
|
18
|
+
- `reelCount`: 3(默认3转轮,可配置为5)
|
|
19
|
+
- `symbolsPerReel`: 3(每轮显示3个符号,形成3行×3列展示区)
|
|
20
|
+
- `paylines`: 5条连线(水平3条 + 对角线2条)
|
|
21
|
+
- `wildSymbol`: WILD(通配符,可替代任意普通符号)
|
|
22
|
+
- `scatterSymbol`: SCATTER(散布,≥3个出现在任意位置触发奖励,不受连线限制)
|
|
23
|
+
- `scatterMinCount`: 3(触发散布奖励所需最少数量)
|
|
24
|
+
- `rngType`: uniform(均匀随机,可扩展为权重随机)
|
|
25
|
+
- **PGS Agent 操作流程**:
|
|
26
|
+
1. 读取 `ref/pgs-schema.json` 作为规则骨架起点
|
|
27
|
+
2. 读取 `ref/reducer.template.ts` 了解接口约束
|
|
28
|
+
3. 实现 `reducer.ts`,导出 `init(config)`、`dispatch(state, action)`、`getState(state)` 以及**全部分步函数**
|
|
29
|
+
4. 运行 `ref/pgs-schema.json` 中的所有 `testCases`,全部通过后才算完成
|
|
30
|
+
5. 更新 manifest 的 `generation.pgsVersion` 和 `result.outputFile`
|
|
31
|
+
- **可 fork 变体**:
|
|
32
|
+
- 5轴老虎机:修改 `reelCount` 为5,增加更多连线
|
|
33
|
+
- 权重随机:将 `rngType` 改为 `weighted`,配置各符号出现概率
|
|
34
|
+
- 免费旋转:Scatter 触发 `freeSpins` 次数而非直接奖励
|
|
35
|
+
|
|
36
|
+
## Result
|
|
37
|
+
|
|
38
|
+
- **产物文件**:`reducer.ts`
|
|
39
|
+
- **格式**:TypeScript,导出 `init(config)`、`dispatch(action)`、`getState()` + 分步函数接口
|
|
40
|
+
- **验证**:所有 testCases 必须通过
|
|
41
|
+
|
|
42
|
+
## 渲染集成(⚠️ 场景层必读)
|
|
43
|
+
|
|
44
|
+
### 设计原则:逻辑与动画分离
|
|
45
|
+
|
|
46
|
+
reducer 提供两套接口:
|
|
47
|
+
|
|
48
|
+
| 接口 | 适用场景 | 特点 |
|
|
49
|
+
|------|---------|------|
|
|
50
|
+
| `dispatch()` | 无头测试、AI 模拟、跳过动画 | 一步到位,只返回最终状态 |
|
|
51
|
+
| 分步函数 | **渲染层/GameScene** | 逐步执行,返回中间过程数据 |
|
|
52
|
+
|
|
53
|
+
### ⚠️ 转轮动画必须使用分步函数驱动
|
|
54
|
+
|
|
55
|
+
正确做法是**分步驱动动画链**:
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
// ✅ 正确做法:逐步调用分步函数,每步之间插入动画
|
|
59
|
+
// Step 1: 执行旋转(获取结果,但先不显示)
|
|
60
|
+
const spinResult = spin(state);
|
|
61
|
+
// spinResult.reels = [['A','A','A'], ['7','W','7'], ['S','S','K']]
|
|
62
|
+
|
|
63
|
+
// Step 2: 依次停止各转轮动画(每个转轮延迟约500ms)
|
|
64
|
+
for (let i = 0; i < reelCount; i++) {
|
|
65
|
+
await stopReelAnimation(i, spinResult.reels[i]); // 转轮停止动画
|
|
66
|
+
await delay(500);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Step 3: 计算连线和奖励
|
|
70
|
+
const matches = evaluatePaylines(spinResult.reels, paylines, symbolDefs);
|
|
71
|
+
const payout = calculatePayout(matches, state.currentBet);
|
|
72
|
+
|
|
73
|
+
// Step 4: 高亮中奖连线
|
|
74
|
+
if (matches.length > 0) {
|
|
75
|
+
await playWinAnimation(matches, payout); // 高亮连线 + 金币动画
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Step 5: 检查 Scatter
|
|
79
|
+
const scatterResult = checkScatter(spinResult.reels);
|
|
80
|
+
if (scatterResult.triggered) {
|
|
81
|
+
await playScatterAnimation(scatterResult.count); // Scatter 爆炸动画
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 分步函数返回值与动画映射
|
|
86
|
+
|
|
87
|
+
| 分步函数 | 返回值 | 场景层动画 |
|
|
88
|
+
|---------|--------|-----------|
|
|
89
|
+
| `spin()` | `SpinResult` | 各转轮滚动然后依次停止 |
|
|
90
|
+
| `evaluatePaylines()` | `PaylineMatch[]` | 高亮中奖连线,显示连线路径 |
|
|
91
|
+
| `calculatePayout()` | `number` | 金币飞入动画,余额增加特效 |
|
|
92
|
+
| `checkScatter()` | `{ triggered, count, bonus }` | Scatter 标记高亮 + 散布奖励动画 |
|
|
93
|
+
|
|
94
|
+
## Binding
|
|
95
|
+
|
|
96
|
+
- **Binding Role**:`gameplayRule`
|
|
97
|
+
- **挂载目标**:`game/gameplay/slot_machine/reducer.ts`
|
|
98
|
+
- **引用类型**:`gameplay-module-reference`
|
|
99
|
+
- **接口契约**:`init(config)` / `dispatch(state, action)` / `getState(state)` / `spin()` / `evaluatePaylines(result, paylines, symbols)` / `calculatePayout(matches, bet)` / `checkScatter(result)`
|
|
100
|
+
|
|
101
|
+
## Skill Definition
|
|
102
|
+
|
|
103
|
+
tools:
|
|
104
|
+
- bash
|
|
105
|
+
- write
|
|
106
|
+
- read
|
|
107
|
+
prompt_extension: |
|
|
108
|
+
You are implementing a slot machine gameplay module following the PGS specification.
|
|
109
|
+
Write the PGS JSON with entities (reels, paylines, symbols with isWild/isScatter, bet, balance, spin_result),
|
|
110
|
+
rules (spin with RNG, evaluate_paylines, wild_substitution, scatter_bonus, payout_calculation),
|
|
111
|
+
algorithm, and testCases (at least 3: 3-match win, no match, scatter bonus trigger).
|
|
112
|
+
Implement reducer.ts with:
|
|
113
|
+
- init/dispatch/getState (一体化接口,用于测试)
|
|
114
|
+
- spin/evaluatePaylines/calculatePayout/checkScatter (分步函数,用于渲染层动画驱动)
|
|
115
|
+
Wild symbols substitute for any non-scatter symbol in payline evaluation.
|
|
116
|
+
Scatter bonus triggers when ≥3 scatter symbols appear anywhere (not payline-constrained).
|
|
117
|
+
Payout = bet × multiplier, where multiplier comes from symbol match table.
|
|
118
|
+
Run all testCases to verify logic before finalizing.
|
|
119
|
+
Apply the Binding to wire the reducer into the game's gameplay module path.
|