@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,229 @@
|
|
|
1
|
+
import * as Phaser from "phaser";
|
|
2
|
+
import { computeUiLayout } from "../../utils/UiLayout";
|
|
3
|
+
import {
|
|
4
|
+
ENABLE_GAME_TOP_PROGRESS_DISPLAY,
|
|
5
|
+
GAME_UI_BAR_BACKGROUND_COLOR,
|
|
6
|
+
} from "../../DebugConfig";
|
|
7
|
+
import { ThemeManager } from "./ThemeManager";
|
|
8
|
+
import { HeartDisplay } from "./HeartDisplay";
|
|
9
|
+
import { CountdownDisplay } from "./CountdownDisplay";
|
|
10
|
+
import { ProgressDisplay } from "./ProgressDisplay";
|
|
11
|
+
|
|
12
|
+
/** 顶部UI栏的设计高度常量 */
|
|
13
|
+
export const GAME_TOP_UI_BAR_HEIGHT = 150;
|
|
14
|
+
|
|
15
|
+
/** 顶部UI的配置选项 */
|
|
16
|
+
export interface GameTopUIConfig {
|
|
17
|
+
levelText: string;
|
|
18
|
+
initialLives: number;
|
|
19
|
+
maxLives: number;
|
|
20
|
+
initialTimeSeconds: number;
|
|
21
|
+
onTimeout?: () => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 游戏顶部UI组件。
|
|
26
|
+
* 包含关卡标题、生命值显示、倒计时器和进度显示。
|
|
27
|
+
* 布局为上下垂直结构,顺序:生命值 → 关卡标题 → 倒计时 → 进度。
|
|
28
|
+
*/
|
|
29
|
+
export class GameTopUI extends Phaser.GameObjects.Container {
|
|
30
|
+
private levelLabel!: Phaser.GameObjects.Text;
|
|
31
|
+
private heartDisplay!: HeartDisplay;
|
|
32
|
+
private countdownDisplay!: CountdownDisplay;
|
|
33
|
+
private progressDisplay?: ProgressDisplay;
|
|
34
|
+
|
|
35
|
+
constructor(scene: Phaser.Scene, config: GameTopUIConfig) {
|
|
36
|
+
super(scene);
|
|
37
|
+
scene.add.existing(this);
|
|
38
|
+
// Ensure top UI renders above the board container
|
|
39
|
+
this.setDepth(500);
|
|
40
|
+
|
|
41
|
+
const layout = computeUiLayout(scene);
|
|
42
|
+
const { width, height, uiScale, vScale } = layout;
|
|
43
|
+
|
|
44
|
+
// 获取栏背景颜色:优先使用配置,否则使用主题颜色
|
|
45
|
+
const themeBarColor = ThemeManager.instance.getUiBarBackgroundColorNumber();
|
|
46
|
+
const barBgColor =
|
|
47
|
+
GAME_UI_BAR_BACKGROUND_COLOR >= 0
|
|
48
|
+
? GAME_UI_BAR_BACKGROUND_COLOR
|
|
49
|
+
: themeBarColor;
|
|
50
|
+
|
|
51
|
+
const barHeight = GAME_TOP_UI_BAR_HEIGHT * vScale;
|
|
52
|
+
const bg = scene.add.rectangle(
|
|
53
|
+
width / 2,
|
|
54
|
+
barHeight / 2,
|
|
55
|
+
width,
|
|
56
|
+
barHeight,
|
|
57
|
+
barBgColor,
|
|
58
|
+
);
|
|
59
|
+
this.add(bg);
|
|
60
|
+
|
|
61
|
+
// --- Vertical layout: top-to-bottom ---
|
|
62
|
+
// All vertical sizes use vScale so total height fits within barHeight.
|
|
63
|
+
// Horizontal sizes (spacing, widths) still use uiScale for proper proportions.
|
|
64
|
+
const rowGap = 6 * vScale;
|
|
65
|
+
const topPadding = 10 * vScale;
|
|
66
|
+
let currentY = topPadding;
|
|
67
|
+
|
|
68
|
+
// --- Row 1: Hearts (lives) ---
|
|
69
|
+
const heartSpacing = 45 * uiScale;
|
|
70
|
+
const heartsGroupWidth = config.maxLives * heartSpacing;
|
|
71
|
+
const heartStartX = (width - heartsGroupWidth) / 2 + heartSpacing / 2;
|
|
72
|
+
const heartDrawSize = 16 * uiScale;
|
|
73
|
+
const heartRowHeight = 30 * vScale;
|
|
74
|
+
const heartsY = currentY + heartRowHeight / 2;
|
|
75
|
+
|
|
76
|
+
this.heartDisplay = new HeartDisplay(scene, this, {
|
|
77
|
+
startX: heartStartX,
|
|
78
|
+
y: heartsY,
|
|
79
|
+
spacing: heartSpacing,
|
|
80
|
+
drawSize: heartDrawSize,
|
|
81
|
+
maxLives: config.maxLives,
|
|
82
|
+
initialLives: config.initialLives,
|
|
83
|
+
});
|
|
84
|
+
currentY += heartRowHeight + rowGap;
|
|
85
|
+
|
|
86
|
+
// --- Row 2: Level label ---
|
|
87
|
+
const hasLevelText = config.levelText && config.levelText.trim().length > 0;
|
|
88
|
+
const levelFontSize = 28 * uiScale;
|
|
89
|
+
const levelRowHeight = 30 * vScale;
|
|
90
|
+
|
|
91
|
+
if (hasLevelText) {
|
|
92
|
+
this.levelLabel = scene.add
|
|
93
|
+
.text(width / 2, currentY + levelRowHeight / 2, config.levelText, {
|
|
94
|
+
fontFamily: "Poppins",
|
|
95
|
+
fontSize: `${levelFontSize}px`,
|
|
96
|
+
color: ThemeManager.instance.getUiLevelTextColor(),
|
|
97
|
+
fontStyle: "bold",
|
|
98
|
+
})
|
|
99
|
+
.setOrigin(0.5, 0.5);
|
|
100
|
+
this.add(this.levelLabel);
|
|
101
|
+
currentY += levelRowHeight + rowGap;
|
|
102
|
+
} else {
|
|
103
|
+
this.levelLabel = scene.add
|
|
104
|
+
.text(0, 0, "", {
|
|
105
|
+
fontFamily: "Poppins",
|
|
106
|
+
fontSize: `${levelFontSize}px`,
|
|
107
|
+
color: ThemeManager.instance.getUiLevelTextColor(),
|
|
108
|
+
fontStyle: "bold",
|
|
109
|
+
})
|
|
110
|
+
.setOrigin(0.5, 0.5)
|
|
111
|
+
.setVisible(false);
|
|
112
|
+
this.add(this.levelLabel);
|
|
113
|
+
// No row height added when hidden
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// --- Row 3: Countdown (icon + digits) ---
|
|
117
|
+
const timeIconSize = 36 * uiScale;
|
|
118
|
+
const iconTextGap = 8 * uiScale;
|
|
119
|
+
const digitWidth = 20 * uiScale;
|
|
120
|
+
const digitHeight = 36 * uiScale;
|
|
121
|
+
const digitSpacing = 4 * uiScale;
|
|
122
|
+
const colonWidth = 10 * uiScale;
|
|
123
|
+
const timerDisplayWidth = digitWidth * 4 + colonWidth + digitSpacing * 4;
|
|
124
|
+
const timerGroupWidth = timeIconSize + iconTextGap + timerDisplayWidth;
|
|
125
|
+
const timerRowHeight = 36 * vScale;
|
|
126
|
+
const timerY = currentY + timerRowHeight / 2;
|
|
127
|
+
|
|
128
|
+
// Center the timer group horizontally
|
|
129
|
+
const timerGroupStartX = (width - timerGroupWidth) / 2;
|
|
130
|
+
const timeIconX = timerGroupStartX + timeIconSize / 2;
|
|
131
|
+
|
|
132
|
+
const timeIcon = scene.add.image(timeIconX, timerY, "time");
|
|
133
|
+
timeIcon.setScale(uiScale * 0.2).setOrigin(0.5);
|
|
134
|
+
this.add(timeIcon);
|
|
135
|
+
|
|
136
|
+
this.countdownDisplay = new CountdownDisplay(scene, this, {
|
|
137
|
+
xLeft: timeIconX + timeIconSize / 2 + iconTextGap,
|
|
138
|
+
y: timerY + vScale - 1,
|
|
139
|
+
digitWidth,
|
|
140
|
+
digitHeight,
|
|
141
|
+
digitSpacing,
|
|
142
|
+
colonWidth,
|
|
143
|
+
totalSeconds: config.initialTimeSeconds,
|
|
144
|
+
onTimeout: config.onTimeout,
|
|
145
|
+
});
|
|
146
|
+
this.countdownDisplay.updateDisplay();
|
|
147
|
+
currentY += timerRowHeight + rowGap;
|
|
148
|
+
|
|
149
|
+
// --- Row 4: Progress display (controlled by config) ---
|
|
150
|
+
if (ENABLE_GAME_TOP_PROGRESS_DISPLAY) {
|
|
151
|
+
const progressDigitWidth = 18 * uiScale;
|
|
152
|
+
const progressDigitHeight = 36 * uiScale;
|
|
153
|
+
const progressDigitSpacing = 3 * uiScale;
|
|
154
|
+
const percentWidth = 14 * uiScale;
|
|
155
|
+
// Approximate total width: 3 digits + percent sign + spacing
|
|
156
|
+
const progressTotalWidth =
|
|
157
|
+
progressDigitWidth * 3 + progressDigitSpacing * 3 + percentWidth;
|
|
158
|
+
const progressStartX = (width - progressTotalWidth) / 2;
|
|
159
|
+
const progressRowHeight = 36 * vScale;
|
|
160
|
+
const progressY = currentY + progressRowHeight / 2;
|
|
161
|
+
|
|
162
|
+
this.progressDisplay = new ProgressDisplay(scene, this, {
|
|
163
|
+
xLeft: progressStartX,
|
|
164
|
+
y: progressY + vScale,
|
|
165
|
+
digitWidth: progressDigitWidth,
|
|
166
|
+
digitHeight: progressDigitHeight,
|
|
167
|
+
digitSpacing: progressDigitSpacing,
|
|
168
|
+
percentWidth,
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
// Initialize to 0%
|
|
172
|
+
this.progressDisplay.updateProgress(0, 0);
|
|
173
|
+
currentY += progressRowHeight + rowGap;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// --- 委托公共API(为外部调用者保持相同接口) ---
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* 设置当前生命值。
|
|
181
|
+
* @param lives 生命值数量
|
|
182
|
+
*/
|
|
183
|
+
public setLives(lives: number): void {
|
|
184
|
+
this.heartDisplay.setLives(lives);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* 更新计时器。
|
|
189
|
+
* @param deltaMs 帧间隔时间(毫秒)
|
|
190
|
+
* @param nowMs 当前时间戳(毫秒,可选)
|
|
191
|
+
*/
|
|
192
|
+
public updateTimer(deltaMs: number, nowMs?: number): void {
|
|
193
|
+
this.countdownDisplay.updateTimer(deltaMs, nowMs);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* 为倒计时添加额外时间。
|
|
198
|
+
* @param seconds 要添加的秒数
|
|
199
|
+
*/
|
|
200
|
+
public addTime(seconds: number): void {
|
|
201
|
+
this.countdownDisplay.addTime(seconds);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** 启动计时器 */
|
|
205
|
+
public startTimer(): void {
|
|
206
|
+
this.countdownDisplay.startTimer();
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/** 停止计时器 */
|
|
210
|
+
public stopTimer(): void {
|
|
211
|
+
this.countdownDisplay.stopTimer();
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/** 获取已经过的秒数 */
|
|
215
|
+
public getElapsedSeconds(): number {
|
|
216
|
+
return this.countdownDisplay.getElapsedSeconds();
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* 更新进度显示。
|
|
221
|
+
* @param removed 已消除的路径数
|
|
222
|
+
* @param total 总路径数
|
|
223
|
+
*/
|
|
224
|
+
public updateProgress(removed: number, total: number): void {
|
|
225
|
+
if (this.progressDisplay) {
|
|
226
|
+
this.progressDisplay.updateProgress(removed, total);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tower_defence.aigameplay
|
|
3
|
+
description: 经典塔防核心玩法封包 - 波次敌人、格子放塔、自动攻击、金币经济的 PGS 实现
|
|
4
|
+
triggers: 塔防,tower defence,tower defense,防御,波次,waves,enemy,敌人,炮塔,tower,strategy,策略,grid,格子
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# tower_defence.aigameplay
|
|
8
|
+
|
|
9
|
+
经典塔防核心玩法封包。实现标准塔防玩法的 PGS (PlayCraft Gameplay Schema, 玩法定义规范) JSON 和 reducer。敌人沿预设路径前进,玩家在路径旁放置防御塔自动攻击,消灭敌人获金币,敌人到达终点扣生命。全波次通关则胜利,生命归零则失败。
|
|
10
|
+
|
|
11
|
+
## Recipe
|
|
12
|
+
|
|
13
|
+
- **玩法类型**:tower_defence(经典塔防)
|
|
14
|
+
- **参考文件**:
|
|
15
|
+
- `ref/pgs-schema.json`:PGS 规则骨架(entities、rules、algorithm、testCases)
|
|
16
|
+
- `ref/reducer.template.ts`:reducer 接口约束模板
|
|
17
|
+
- **核心规则**:
|
|
18
|
+
- `initialLives`: 20(初始生命值)
|
|
19
|
+
- `initialGold`: 150(初始金币)
|
|
20
|
+
- `tickRateMs`: 100(游戏逻辑帧率,每帧 100ms)
|
|
21
|
+
- `towerTypes`: `["arrow", "cannon", "magic"]`(弓箭塔/炮塔/魔法塔)
|
|
22
|
+
- `enemyTypes`: `["basic", "fast", "armored", "boss"]`(普通/快速/装甲/Boss)
|
|
23
|
+
- **PGS Agent 操作流程**:
|
|
24
|
+
1. 读取 `ref/pgs-schema.json` 作为规则骨架起点
|
|
25
|
+
2. 读取 `ref/reducer.template.ts` 了解接口约束
|
|
26
|
+
3. 实现 `reducer.ts`,导出所有必需函数
|
|
27
|
+
4. 路径表示:`path` 是格子坐标序列 `{x, y}[]`,敌人维护 `pathIndex`(当前目标路径点索引)和 `progress`(到下一路径点的进度 0~1)
|
|
28
|
+
5. 塔攻击:每次 tick 检查攻击冷却,范围内有敌人则攻击
|
|
29
|
+
6. 运行 `ref/pgs-schema.json` 中的所有 `testCases`,全部通过后才算完成
|
|
30
|
+
- **塔属性**:
|
|
31
|
+
- `arrow`:低伤害,高攻速,低造价,攻击单体
|
|
32
|
+
- `cannon`:高伤害,低攻速,高造价,范围攻击
|
|
33
|
+
- `magic`:中等伤害,减速效果,对装甲有额外伤害
|
|
34
|
+
- **敌人属性**:
|
|
35
|
+
- `basic`:标准属性
|
|
36
|
+
- `fast`:速度 2x,血量 0.5x
|
|
37
|
+
- `armored`:速度 0.7x,血量 3x,物理伤害减半
|
|
38
|
+
- `boss`:速度 0.5x,血量 10x,每波最多 1 个
|
|
39
|
+
- **可 fork 变体**:
|
|
40
|
+
- 经济难度调整:修改 `initialGold` 和塔造价
|
|
41
|
+
- 多路径地图:path 改为多条,敌人随机选路
|
|
42
|
+
- 英雄技能:玩家可放置限定次数的超级技能(冰冻/轰炸)
|
|
43
|
+
|
|
44
|
+
## Result
|
|
45
|
+
|
|
46
|
+
- **产物文件**:`reducer.ts`
|
|
47
|
+
- **格式**:TypeScript,导出 `init(config)`、`dispatch(action)`、`getState()` + 分步函数接口
|
|
48
|
+
- **验证**:所有 testCases 必须通过
|
|
49
|
+
|
|
50
|
+
## 渲染集成(⚠️ 场景层必读)
|
|
51
|
+
|
|
52
|
+
### 设计原则:游戏循环驱动渲染
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
// ✅ 正确做法:固定 tick 循环
|
|
56
|
+
function gameLoop(deltaMs: number) {
|
|
57
|
+
// Step 1: tick 游戏逻辑(敌人移动 + 塔攻击 + 波次生成)
|
|
58
|
+
const prevState = state;
|
|
59
|
+
state = tickGameLoop(state, deltaMs);
|
|
60
|
+
|
|
61
|
+
// Step 2: 渲染敌人移动
|
|
62
|
+
const movedEnemies = diffEnemyPositions(prevState.enemies, state.enemies);
|
|
63
|
+
movedEnemies.forEach(e => updateEnemySprite(e.id, e.position));
|
|
64
|
+
|
|
65
|
+
// Step 3: 渲染攻击特效
|
|
66
|
+
state.lastAttackEvents.forEach(evt => {
|
|
67
|
+
playAttackEffect(evt.towerId, evt.enemyId, evt.towerType);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// Step 4: 渲染敌人死亡
|
|
71
|
+
state.lastDeathEvents.forEach(evt => {
|
|
72
|
+
playDeathAnimation(evt.enemyId);
|
|
73
|
+
showGoldPopup(evt.reward);
|
|
74
|
+
removeEnemySprite(evt.enemyId);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Step 5: 渲染敌人逃跑(到达终点)
|
|
78
|
+
state.lastEscapeEvents.forEach(evt => {
|
|
79
|
+
removeEnemySprite(evt.enemyId);
|
|
80
|
+
updateLivesUI(state.resources.lives);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// 放塔(玩家点击)
|
|
85
|
+
function onPlaceTower(gridPos, towerType) {
|
|
86
|
+
const newState = placeTower(state, gridPos, towerType);
|
|
87
|
+
if (newState !== state) {
|
|
88
|
+
state = newState;
|
|
89
|
+
createTowerSprite(gridPos, towerType);
|
|
90
|
+
updateGoldUI(state.resources.gold);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Binding
|
|
96
|
+
|
|
97
|
+
- **Binding Role**:`gameplayRule`
|
|
98
|
+
- **挂载目标**:`game/gameplay/tower_defence/reducer.ts`
|
|
99
|
+
- **引用类型**:`gameplay-module-reference`
|
|
100
|
+
- **接口契约**:`init(config)` / `dispatch(action)` / `getState()` / `placeTower()` / `upgradeTower()` / `tickGameLoop()` / `processAttacks()` / `moveEnemies()` / `spawnNextWave()`
|
|
101
|
+
|
|
102
|
+
## Skill Definition
|
|
103
|
+
|
|
104
|
+
tools:
|
|
105
|
+
- bash
|
|
106
|
+
- write
|
|
107
|
+
- read
|
|
108
|
+
prompt_extension: |
|
|
109
|
+
You are implementing a classic tower defence gameplay module following the PGS specification.
|
|
110
|
+
Write the PGS JSON with entities, rules, algorithm, and testCases.
|
|
111
|
+
Implement the reducer.ts with:
|
|
112
|
+
- init/dispatch/getState (一体化接口,用于测试)
|
|
113
|
+
- placeTower/upgradeTower/tickGameLoop/processAttacks/moveEnemies/spawnNextWave (分步函数)
|
|
114
|
+
Enemy movement: enemies follow a predefined path (array of grid positions), advance by speed*deltaMs per tick.
|
|
115
|
+
Tower attack: each tick, tower attacks nearest enemy within range if cooldown elapsed.
|
|
116
|
+
Wave spawning: new enemies spawn at path entrance per wave definition at set intervals.
|
|
117
|
+
Run the testCases to verify the logic before finalizing.
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"atomId": "tower_defence.aigameplay",
|
|
4
|
+
"bundleType": "aigameplay",
|
|
5
|
+
"category": "gameplay",
|
|
6
|
+
"mode": "fixed",
|
|
7
|
+
"label": {
|
|
8
|
+
"zh": "经典塔防玩法",
|
|
9
|
+
"en": "Classic tower defence gameplay"
|
|
10
|
+
},
|
|
11
|
+
"tags": [
|
|
12
|
+
"gameplay",
|
|
13
|
+
"tower-defence",
|
|
14
|
+
"strategy",
|
|
15
|
+
"waves",
|
|
16
|
+
"grid",
|
|
17
|
+
"casual"
|
|
18
|
+
],
|
|
19
|
+
"bindingRoles": [
|
|
20
|
+
"gameplayRule"
|
|
21
|
+
],
|
|
22
|
+
"imports": [
|
|
23
|
+
{
|
|
24
|
+
"slot": "engine",
|
|
25
|
+
"pinAtomId": "phaser.aicomponent",
|
|
26
|
+
"edgeKind": "requires",
|
|
27
|
+
"bindAs": "engine"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"slot": "bgMusic",
|
|
31
|
+
"description": "背景循环音乐",
|
|
32
|
+
"bindAs": "bgm",
|
|
33
|
+
"required": false,
|
|
34
|
+
"edgeKind": "compatibleWith",
|
|
35
|
+
"matchBindingRoles": [
|
|
36
|
+
"bgMusic"
|
|
37
|
+
],
|
|
38
|
+
"allowedBundleTypes": [
|
|
39
|
+
"aiaudio"
|
|
40
|
+
],
|
|
41
|
+
"constraints": {
|
|
42
|
+
"loop": true
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"slot": "background",
|
|
47
|
+
"description": "地图背景图",
|
|
48
|
+
"bindAs": "bg",
|
|
49
|
+
"required": false,
|
|
50
|
+
"edgeKind": "compatibleWith",
|
|
51
|
+
"matchBindingRoles": [
|
|
52
|
+
"backgroundTexture"
|
|
53
|
+
],
|
|
54
|
+
"allowedBundleTypes": [
|
|
55
|
+
"aiimage"
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"slot": "levelDataPack",
|
|
60
|
+
"description": "关卡地图与波次数据包",
|
|
61
|
+
"bindAs": "levels",
|
|
62
|
+
"required": false,
|
|
63
|
+
"edgeKind": "compatibleWith",
|
|
64
|
+
"matchBindingRoles": [
|
|
65
|
+
"levelDataPack"
|
|
66
|
+
],
|
|
67
|
+
"allowedBundleTypes": [
|
|
68
|
+
"aiconfig"
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"slot": "tutorial",
|
|
73
|
+
"description": "新手引导浮层",
|
|
74
|
+
"bindAs": "tutorial",
|
|
75
|
+
"required": false,
|
|
76
|
+
"edgeKind": "compatibleWith",
|
|
77
|
+
"matchBindingRoles": [
|
|
78
|
+
"tutorialOverlay"
|
|
79
|
+
],
|
|
80
|
+
"allowedBundleTypes": [
|
|
81
|
+
"aicomponent"
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"slot": "winPanel",
|
|
86
|
+
"description": "通关反馈面板视觉",
|
|
87
|
+
"bindAs": "winPanel",
|
|
88
|
+
"required": false,
|
|
89
|
+
"edgeKind": "compatibleWith",
|
|
90
|
+
"matchBindingRoles": [
|
|
91
|
+
"successFeedbackPanel"
|
|
92
|
+
],
|
|
93
|
+
"allowedBundleTypes": [
|
|
94
|
+
"aiimage"
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"slot": "losePanel",
|
|
99
|
+
"description": "失败反馈面板视觉",
|
|
100
|
+
"bindAs": "losePanel",
|
|
101
|
+
"required": false,
|
|
102
|
+
"edgeKind": "compatibleWith",
|
|
103
|
+
"matchBindingRoles": [
|
|
104
|
+
"failFeedbackPanel"
|
|
105
|
+
],
|
|
106
|
+
"allowedBundleTypes": [
|
|
107
|
+
"aiimage"
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"slot": "endScreen",
|
|
112
|
+
"description": "可玩广告结算屏(含 CTA 按钮)",
|
|
113
|
+
"bindAs": "endScreen",
|
|
114
|
+
"required": false,
|
|
115
|
+
"edgeKind": "compatibleWith",
|
|
116
|
+
"matchBindingRoles": [
|
|
117
|
+
"playableEndScreenLayout"
|
|
118
|
+
],
|
|
119
|
+
"allowedBundleTypes": [
|
|
120
|
+
"aicomponent"
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
"generation": {
|
|
125
|
+
"kind": "pgs",
|
|
126
|
+
"pgsVersion": "1.0",
|
|
127
|
+
"gameplayType": "tower_defence",
|
|
128
|
+
"rules": {
|
|
129
|
+
"initialLives": 20,
|
|
130
|
+
"initialGold": 150,
|
|
131
|
+
"tickRateMs": 100,
|
|
132
|
+
"towerTypes": [
|
|
133
|
+
"arrow",
|
|
134
|
+
"cannon",
|
|
135
|
+
"magic"
|
|
136
|
+
],
|
|
137
|
+
"enemyTypes": [
|
|
138
|
+
"basic",
|
|
139
|
+
"fast",
|
|
140
|
+
"armored",
|
|
141
|
+
"boss"
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"result": {
|
|
146
|
+
"outputFile": "reducer.ts",
|
|
147
|
+
"format": "typescript",
|
|
148
|
+
"constraints": {
|
|
149
|
+
"testCasesMustPass": true
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
"binding": {
|
|
153
|
+
"role": "gameplayRule",
|
|
154
|
+
"target": "game/gameplay/tower_defence/reducer.ts",
|
|
155
|
+
"type": "gameplay-module-reference",
|
|
156
|
+
"constraints": {
|
|
157
|
+
"interface": [
|
|
158
|
+
"init(config)",
|
|
159
|
+
"dispatch(action)",
|
|
160
|
+
"getState()",
|
|
161
|
+
"placeTower(state, position, towerType)",
|
|
162
|
+
"upgradeTower(state, towerId)",
|
|
163
|
+
"tickGameLoop(state, deltaMs)",
|
|
164
|
+
"processAttacks(state)",
|
|
165
|
+
"moveEnemies(state, deltaMs)",
|
|
166
|
+
"spawnNextWave(state)"
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
"files": {
|
|
171
|
+
"skill": "SKILL.md",
|
|
172
|
+
"pgsSchema": "ref/pgs-schema.json",
|
|
173
|
+
"reducerTemplate": "ref/reducer.template.ts"
|
|
174
|
+
}
|
|
175
|
+
}
|