@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,362 @@
|
|
|
1
|
+
import * as Phaser from "phaser";
|
|
2
|
+
import { ComboSmallUI } from "./ComboSmallUI";
|
|
3
|
+
import { GAME_TOP_UI_BAR_HEIGHT } from "./GameTopUI";
|
|
4
|
+
import { computeUiLayout } from "../../utils/UiLayout";
|
|
5
|
+
|
|
6
|
+
/** 连续成功操作计为连击链的时间窗口(毫秒)。 */
|
|
7
|
+
const COMBO_CHAIN_WINDOW_MS = 1400;
|
|
8
|
+
|
|
9
|
+
export class ComboManager {
|
|
10
|
+
private scene: Phaser.Scene;
|
|
11
|
+
|
|
12
|
+
// ── 连击状态 ──
|
|
13
|
+
private comboClickCount = 0;
|
|
14
|
+
private comboLastSuccessAtMs = 0;
|
|
15
|
+
private comboUi: ComboSmallUI | undefined;
|
|
16
|
+
private comboUiLastCount = 0;
|
|
17
|
+
private comboPraiseText: Phaser.GameObjects.Text | undefined;
|
|
18
|
+
private comboPraiseTween: Phaser.Tweens.Tween | null = null;
|
|
19
|
+
private comboPraiseTimer: Phaser.Time.TimerEvent | null = null;
|
|
20
|
+
private comboPraiseLastShownComboCount = 0;
|
|
21
|
+
|
|
22
|
+
constructor(scene: Phaser.Scene) {
|
|
23
|
+
this.scene = scene;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// ── 公共 getter / setter ──────────────────────────────
|
|
27
|
+
|
|
28
|
+
/** 获取当前连击点击次数 */
|
|
29
|
+
get clickCount(): number {
|
|
30
|
+
return this.comboClickCount;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** 设置连击点击次数 */
|
|
34
|
+
set clickCount(v: number) {
|
|
35
|
+
this.comboClickCount = v;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** 获取上次成功操作的时间戳(毫秒) */
|
|
39
|
+
get lastSuccessAtMs(): number {
|
|
40
|
+
return this.comboLastSuccessAtMs;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** 设置上次成功操作的时间戳(毫秒) */
|
|
44
|
+
set lastSuccessAtMs(v: number) {
|
|
45
|
+
this.comboLastSuccessAtMs = v;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** 获取连击链时间窗口(毫秒) */
|
|
49
|
+
get chainWindowMs(): number {
|
|
50
|
+
return COMBO_CHAIN_WINDOW_MS;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// ── 生命周期 ──────────────────────────────────────────────
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 创建 ComboSmallUI 组件。在场景 create() 中调用一次。
|
|
57
|
+
* @param layout 包含宽度和UI缩放比例的布局信息
|
|
58
|
+
*/
|
|
59
|
+
createUi(layout: { width: number; uiScale: number }): void {
|
|
60
|
+
this.comboUi = new ComboSmallUI(this.scene, layout.width * 0.5, 0, {
|
|
61
|
+
uiScale: layout.uiScale,
|
|
62
|
+
progress: 1,
|
|
63
|
+
comboCount: 1,
|
|
64
|
+
depth: 1600,
|
|
65
|
+
});
|
|
66
|
+
this.comboUi.setScrollFactor(0);
|
|
67
|
+
this.comboUi.setVisible(false);
|
|
68
|
+
|
|
69
|
+
this.refreshComboUiPlacement();
|
|
70
|
+
|
|
71
|
+
// 定期刷新倒计时
|
|
72
|
+
this.scene.time.addEvent({
|
|
73
|
+
delay: 33,
|
|
74
|
+
loop: true,
|
|
75
|
+
callback: () => this.refreshComboUiCountdown(),
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* 重置所有连击状态。在每关开始时调用。
|
|
81
|
+
*/
|
|
82
|
+
resetState(): void {
|
|
83
|
+
this.comboClickCount = 0;
|
|
84
|
+
this.comboLastSuccessAtMs = 0;
|
|
85
|
+
this.comboUiLastCount = 0;
|
|
86
|
+
this.comboPraiseLastShownComboCount = 0;
|
|
87
|
+
this.clearComboPraiseText();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// ── 原先在 Game 上的方法 ─────────────────────────────
|
|
91
|
+
|
|
92
|
+
/** 成功消除路径后处理连击UI显示。 */
|
|
93
|
+
handleComboUiOnSuccess(): void {
|
|
94
|
+
const comboUi = this.comboUi;
|
|
95
|
+
if (!comboUi) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (this.comboClickCount < 3) {
|
|
100
|
+
this.hideComboUi();
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (!comboUi.visible) {
|
|
105
|
+
comboUi.setVisible(true);
|
|
106
|
+
this.refreshComboUiPlacement();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
comboUi.setProgress(1);
|
|
110
|
+
|
|
111
|
+
if (this.comboUiLastCount !== this.comboClickCount) {
|
|
112
|
+
comboUi.setCombo(this.comboClickCount);
|
|
113
|
+
comboUi.playComboPulse();
|
|
114
|
+
this.comboUiLastCount = this.comboClickCount;
|
|
115
|
+
this.refreshComboUiPlacement();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** 刷新连击UI倒计时进度条。 */
|
|
120
|
+
refreshComboUiCountdown(): void {
|
|
121
|
+
const comboUi = this.comboUi;
|
|
122
|
+
if (!comboUi || !comboUi.visible) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (this.comboClickCount < 3 || this.comboLastSuccessAtMs <= 0) {
|
|
127
|
+
this.hideComboUi();
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const now = this.scene.time.now;
|
|
132
|
+
const elapsed = now - this.comboLastSuccessAtMs;
|
|
133
|
+
const remain = COMBO_CHAIN_WINDOW_MS - elapsed;
|
|
134
|
+
if (remain <= 0) {
|
|
135
|
+
this.comboClickCount = 0;
|
|
136
|
+
this.comboLastSuccessAtMs = 0;
|
|
137
|
+
this.comboPraiseLastShownComboCount = 0;
|
|
138
|
+
this.clearComboPraiseText();
|
|
139
|
+
this.hideComboUi();
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
comboUi.setProgress(remain / COMBO_CHAIN_WINDOW_MS);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** 隐藏连击UI组件。 */
|
|
147
|
+
hideComboUi(): void {
|
|
148
|
+
if (this.comboUi) {
|
|
149
|
+
this.comboUi.setVisible(false);
|
|
150
|
+
this.comboUi.setProgress(0);
|
|
151
|
+
this.comboUi.setScale(1);
|
|
152
|
+
}
|
|
153
|
+
this.comboUiLastCount = 0;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/** 刷新连击UI组件的位置。 */
|
|
157
|
+
refreshComboUiPlacement(): void {
|
|
158
|
+
const comboUi = this.comboUi;
|
|
159
|
+
if (!comboUi) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const layout = computeUiLayout(this.scene);
|
|
164
|
+
const { width, height, uiScale, vScale } = layout;
|
|
165
|
+
|
|
166
|
+
const topUiBottom = GAME_TOP_UI_BAR_HEIGHT * vScale;
|
|
167
|
+
|
|
168
|
+
const targetComboLeft = 10 * uiScale;
|
|
169
|
+
const targetTextTop = topUiBottom + 10 * vScale;
|
|
170
|
+
const marginRight = 12 * uiScale;
|
|
171
|
+
|
|
172
|
+
comboUi.setScale(1);
|
|
173
|
+
comboUi.setPosition(0, 0);
|
|
174
|
+
|
|
175
|
+
const glyphLeftLocal = comboUi.getComboGlyphLeftLocal();
|
|
176
|
+
const glyphTopLocal = comboUi.getTextGlyphTopLocal();
|
|
177
|
+
|
|
178
|
+
const baseBounds = comboUi.getBounds();
|
|
179
|
+
const localRight = baseBounds.right;
|
|
180
|
+
const distToRight = localRight - glyphLeftLocal;
|
|
181
|
+
const availableW = Math.max(1, width - marginRight - targetComboLeft);
|
|
182
|
+
const fitScale =
|
|
183
|
+
distToRight > 0 ? Math.min(1, availableW / distToRight) : 1;
|
|
184
|
+
|
|
185
|
+
comboUi.setScale(fitScale);
|
|
186
|
+
|
|
187
|
+
const x = targetComboLeft - glyphLeftLocal * fitScale;
|
|
188
|
+
const y = targetTextTop - glyphTopLocal * fitScale;
|
|
189
|
+
comboUi.setPosition(x, y);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/** 清除连击表扬文本及其相关动画。 */
|
|
193
|
+
clearComboPraiseText(): void {
|
|
194
|
+
if (this.comboPraiseTween) {
|
|
195
|
+
this.comboPraiseTween.stop();
|
|
196
|
+
this.comboPraiseTween = null;
|
|
197
|
+
}
|
|
198
|
+
if (this.comboPraiseTimer) {
|
|
199
|
+
this.comboPraiseTimer.remove(false);
|
|
200
|
+
this.comboPraiseTimer = null;
|
|
201
|
+
}
|
|
202
|
+
if (this.comboPraiseText) {
|
|
203
|
+
this.scene.tweens.killTweensOf(this.comboPraiseText);
|
|
204
|
+
this.comboPraiseText.destroy();
|
|
205
|
+
this.comboPraiseText = undefined;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* 根据连击次数获取对应的表扬文本。
|
|
211
|
+
* @param comboCount 连击次数
|
|
212
|
+
* @returns 表扬文本,如果不需要显示则返回 null
|
|
213
|
+
*/
|
|
214
|
+
getComboPraiseMessage(comboCount: number): string | null {
|
|
215
|
+
const c = Math.max(0, Math.floor(comboCount || 0));
|
|
216
|
+
if (c < 3) {
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (c >= 15) {
|
|
221
|
+
if (c === 15 || (c > 15 && (c - 15) % 3 === 0)) {
|
|
222
|
+
const tiers = [
|
|
223
|
+
"LEGENDARY!",
|
|
224
|
+
"GODLIKE!",
|
|
225
|
+
"UNREAL!",
|
|
226
|
+
"PHENOMENAL!",
|
|
227
|
+
"SUPREME!",
|
|
228
|
+
];
|
|
229
|
+
const tierIndex = Math.floor((c - 15) / 3) % tiers.length;
|
|
230
|
+
return tiers[tierIndex] ?? "LEGENDARY!";
|
|
231
|
+
}
|
|
232
|
+
return null;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
switch (c) {
|
|
236
|
+
case 3:
|
|
237
|
+
return "GOOD!";
|
|
238
|
+
case 4:
|
|
239
|
+
return "NICE!";
|
|
240
|
+
case 5:
|
|
241
|
+
return "GREAT!";
|
|
242
|
+
case 6:
|
|
243
|
+
return "AWESOME!";
|
|
244
|
+
case 7:
|
|
245
|
+
return "AMAZING!";
|
|
246
|
+
case 8:
|
|
247
|
+
return "UNSTOPPABLE!";
|
|
248
|
+
case 10:
|
|
249
|
+
return "INCREDIBLE!";
|
|
250
|
+
case 12:
|
|
251
|
+
return "INSANE!";
|
|
252
|
+
default:
|
|
253
|
+
return null;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* 在点击位置(或屏幕中央)显示连击表扬文本。
|
|
259
|
+
* @param comboCount 当前连击次数
|
|
260
|
+
* @param lastTapScreenX 上次点击的屏幕X坐标
|
|
261
|
+
* @param lastTapScreenY 上次点击的屏幕Y坐标
|
|
262
|
+
* @param hasLastTapScreenPos 点击位置是否有效
|
|
263
|
+
*/
|
|
264
|
+
maybeShowComboPraiseText(
|
|
265
|
+
comboCount: number,
|
|
266
|
+
lastTapScreenX: number,
|
|
267
|
+
lastTapScreenY: number,
|
|
268
|
+
hasLastTapScreenPos: boolean,
|
|
269
|
+
): void {
|
|
270
|
+
const message = this.getComboPraiseMessage(comboCount);
|
|
271
|
+
if (!message) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
const c = Math.max(0, Math.floor(comboCount || 0));
|
|
276
|
+
if (c === this.comboPraiseLastShownComboCount) {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
this.comboPraiseLastShownComboCount = c;
|
|
280
|
+
|
|
281
|
+
this.clearComboPraiseText();
|
|
282
|
+
|
|
283
|
+
const layout = computeUiLayout(this.scene);
|
|
284
|
+
const { centerX, uiScale, vScale } = layout;
|
|
285
|
+
|
|
286
|
+
const baseX = hasLastTapScreenPos ? lastTapScreenX : centerX;
|
|
287
|
+
const baseY = hasLastTapScreenPos
|
|
288
|
+
? lastTapScreenY - 30 * uiScale
|
|
289
|
+
: GAME_TOP_UI_BAR_HEIGHT * vScale + 180 * vScale;
|
|
290
|
+
|
|
291
|
+
const hint = this.scene.add.text(baseX, baseY + 14 * uiScale, message, {
|
|
292
|
+
fontFamily: "Poppins, Arial, sans-serif",
|
|
293
|
+
fontSize: `${26 * uiScale}px`,
|
|
294
|
+
color: "#1184ff",
|
|
295
|
+
fontStyle: "bold",
|
|
296
|
+
align: "center",
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
hint.setOrigin(0.5, 0.5);
|
|
300
|
+
hint.setScale(0.6);
|
|
301
|
+
hint.setScrollFactor(0);
|
|
302
|
+
hint.setDepth(1700);
|
|
303
|
+
hint.setAlpha(0.98);
|
|
304
|
+
|
|
305
|
+
// 简洁描边
|
|
306
|
+
hint.setStroke("#FFFFFF", 2 * uiScale);
|
|
307
|
+
|
|
308
|
+
// 蓝色发光效果
|
|
309
|
+
hint.setShadow(0, 0, "#1184ff", 2 * uiScale, true, false);
|
|
310
|
+
|
|
311
|
+
this.comboPraiseText = hint;
|
|
312
|
+
|
|
313
|
+
/** 清理表扬文本 */
|
|
314
|
+
const cleanup = () => {
|
|
315
|
+
if (this.comboPraiseText === hint) {
|
|
316
|
+
this.comboPraiseText = undefined;
|
|
317
|
+
}
|
|
318
|
+
this.comboPraiseTween = null;
|
|
319
|
+
if (this.comboPraiseTimer) {
|
|
320
|
+
this.comboPraiseTimer.remove(false);
|
|
321
|
+
this.comboPraiseTimer = null;
|
|
322
|
+
}
|
|
323
|
+
hint.destroy();
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
const finalY = baseY;
|
|
327
|
+
const popStartY = baseY + 10 * uiScale;
|
|
328
|
+
hint.y = popStartY;
|
|
329
|
+
|
|
330
|
+
// 弹出动画:从下方弹出 -> 缩放回弹 -> 延迟后淡出上移
|
|
331
|
+
this.comboPraiseTween = this.scene.tweens.add({
|
|
332
|
+
targets: hint,
|
|
333
|
+
y: finalY,
|
|
334
|
+
alpha: 1,
|
|
335
|
+
scale: 1.12,
|
|
336
|
+
duration: 90,
|
|
337
|
+
ease: "Back.Out",
|
|
338
|
+
onComplete: () => {
|
|
339
|
+
this.comboPraiseTween = this.scene.tweens.add({
|
|
340
|
+
targets: hint,
|
|
341
|
+
scale: 1,
|
|
342
|
+
duration: 60,
|
|
343
|
+
ease: "Sine.Out",
|
|
344
|
+
onComplete: () => {
|
|
345
|
+
this.comboPraiseTween = null;
|
|
346
|
+
this.comboPraiseTimer = this.scene.time.delayedCall(260, () => {
|
|
347
|
+
this.comboPraiseTimer = null;
|
|
348
|
+
this.comboPraiseTween = this.scene.tweens.add({
|
|
349
|
+
targets: hint,
|
|
350
|
+
y: finalY - 70 * uiScale,
|
|
351
|
+
alpha: 0,
|
|
352
|
+
duration: 360,
|
|
353
|
+
ease: "Cubic.In",
|
|
354
|
+
onComplete: cleanup,
|
|
355
|
+
});
|
|
356
|
+
});
|
|
357
|
+
},
|
|
358
|
+
});
|
|
359
|
+
},
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: countdown_timer.aicomponent
|
|
3
|
+
description: 倒计时显示器。使用七段数码管风格显示剩余秒数,时间不足时触发闪烁警告动画,归零时通知 LevelLifecycle 触发超时失败。
|
|
4
|
+
triggers: 需要实现倒计时 UI 组件时触发。
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 倒计时显示器(Countdown Timer Display)
|
|
8
|
+
|
|
9
|
+
## Scaffold
|
|
10
|
+
|
|
11
|
+
`src/game/scenes/GameUI/CountdownDisplay.ts`
|
|
12
|
+
|
|
13
|
+
## Recipe
|
|
14
|
+
|
|
15
|
+
| 决策 | 原因 |
|
|
16
|
+
|------|------|
|
|
17
|
+
| **封装 display + 计时 + 警告 + 通知** | 倒计时组件的四个职责(显示、计时、闪烁警告、超时回调)高度关联,分开会造成 GameScene 过多编排逻辑 |
|
|
18
|
+
| **依赖 DigitRenderer 而非系统字体** | 七段数码管风格保持视觉一致性;DigitRenderer 是项目内部组件,无字体加载依赖 |
|
|
19
|
+
| **闪烁警告阈值** | 最后 10 秒(可配置)才开始闪烁,避免整个关卡都闪烁让玩家焦虑;阈值可通过 GameConfig 调整 |
|
|
20
|
+
|
|
21
|
+
## Adapter
|
|
22
|
+
|
|
23
|
+
- **Role**: `countdownTimer` — 倒计时显示器(七段数码管风格 + 警告闪烁 + 超时通知)
|
|
24
|
+
- **Provides**: `CountdownDisplay` 类(`start(seconds)`、`stop()`、`update(delta)` 每帧调用)
|
|
25
|
+
- **Requires**: `phaser.aicomponent`、`digit_renderer.aicomponent`(七段数码管 Graphics 渲染)
|
|
26
|
+
- **Consumed by**: `game_scene.aicomponent`(在 `update()` 中调用 `countdownDisplay.update(delta)`,接收超时回调)
|
|
27
|
+
- **Integration point**: `src/game/scenes/GameUI/CountdownDisplay.ts` → 顶部 UI 条或 GameScene 中实例化,`game_scene` `update()` 循环中每帧更新
|
|
28
|
+
|
|
29
|
+
## Imports
|
|
30
|
+
|
|
31
|
+
- `phaser.aicomponent`(硬依赖)
|
|
32
|
+
- `digit_renderer.aicomponent`(硬依赖:七段数码管绘制)
|
|
33
|
+
|
|
34
|
+
## Skill Definition
|
|
35
|
+
|
|
36
|
+
```yaml
|
|
37
|
+
tools:
|
|
38
|
+
- read_file
|
|
39
|
+
- write_file
|
|
40
|
+
inputs:
|
|
41
|
+
- source: src/game/scenes/GameUI/CountdownDisplay.ts
|
|
42
|
+
outputs:
|
|
43
|
+
- countdownDisplay: CountdownDisplay class
|
|
44
|
+
```
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"atomId": "countdown_timer.aicomponent",
|
|
4
|
+
"bundleType": "aicomponent",
|
|
5
|
+
"category": "component",
|
|
6
|
+
"mode": "fixed",
|
|
7
|
+
"label": { "zh": "倒计时显示器", "en": "Countdown timer display" },
|
|
8
|
+
"tags": ["ui", "countdown", "timer", "seven-segment", "digit"],
|
|
9
|
+
"bindingRoles": ["countdownTimer"],
|
|
10
|
+
"scaffold": {
|
|
11
|
+
"files": {
|
|
12
|
+
"src/game/scenes/GameUI/CountdownDisplay.ts": { "source": "ref/CountdownDisplay.ts", "mode": "full", "weight": 10 }
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"imports": [
|
|
16
|
+
{ "slot": "engine", "pinAtomId": "phaser.aicomponent", "edgeKind": "requires", "bindAs": "engine" },
|
|
17
|
+
{ "slot": "digitRenderer", "pinAtomId": "digit_renderer.aicomponent", "edgeKind": "requires", "bindAs": "digitRenderer" },
|
|
18
|
+
{
|
|
19
|
+
"slot": "clockIcon",
|
|
20
|
+
"description": "倒计时时钟图标",
|
|
21
|
+
"bindAs": "clockIcon",
|
|
22
|
+
"required": false,
|
|
23
|
+
"edgeKind": "compatibleWith",
|
|
24
|
+
"matchBindingRoles": ["clockIcon"],
|
|
25
|
+
"allowedBundleTypes": ["aiimage"]
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"exports": [
|
|
29
|
+
{ "name": "CountdownDisplay", "kind": "class", "location": "src/game/scenes/GameUI/CountdownDisplay.ts" }
|
|
30
|
+
],
|
|
31
|
+
"neutralDescriptor": {
|
|
32
|
+
"geometry": "countdown timer UI component that displays remaining time in seconds using a seven-segment digit renderer with flash animation when time is low"
|
|
33
|
+
},
|
|
34
|
+
"files": { "skill": "SKILL.md", "countdownDisplay": "ref/CountdownDisplay.ts" }
|
|
35
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import * as Phaser from "phaser";
|
|
2
|
+
import { DigitRenderer } from "./DigitRenderer";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 倒计时显示组件(LED / 七段数码管风格)。
|
|
6
|
+
* 同时处理视觉渲染和计时器逻辑(启动、停止、经过时间追踪)。
|
|
7
|
+
*/
|
|
8
|
+
export class CountdownDisplay {
|
|
9
|
+
private scene: Phaser.Scene;
|
|
10
|
+
private container: Phaser.GameObjects.Container;
|
|
11
|
+
private digitGraphics: Phaser.GameObjects.Graphics[] = [];
|
|
12
|
+
private digitWidth: number;
|
|
13
|
+
private digitHeight: number;
|
|
14
|
+
private digitSpacing: number;
|
|
15
|
+
private colonWidth: number;
|
|
16
|
+
|
|
17
|
+
// 计时器逻辑(使用毫秒以避免浮点精度漂移)
|
|
18
|
+
private elapsedMs = 0;
|
|
19
|
+
private totalMs = 0;
|
|
20
|
+
private lastTimerUpdateMs: number | undefined;
|
|
21
|
+
private timerRunning = false;
|
|
22
|
+
private timeoutTriggered = false;
|
|
23
|
+
private onTimeoutCallback: (() => void) | undefined;
|
|
24
|
+
|
|
25
|
+
constructor(
|
|
26
|
+
scene: Phaser.Scene,
|
|
27
|
+
parent: Phaser.GameObjects.Container,
|
|
28
|
+
options: {
|
|
29
|
+
xLeft: number;
|
|
30
|
+
y: number;
|
|
31
|
+
digitWidth: number;
|
|
32
|
+
digitHeight: number;
|
|
33
|
+
digitSpacing: number;
|
|
34
|
+
colonWidth: number;
|
|
35
|
+
totalSeconds: number;
|
|
36
|
+
onTimeout?: () => void;
|
|
37
|
+
},
|
|
38
|
+
) {
|
|
39
|
+
this.scene = scene;
|
|
40
|
+
this.digitWidth = options.digitWidth;
|
|
41
|
+
this.digitHeight = options.digitHeight;
|
|
42
|
+
this.digitSpacing = options.digitSpacing;
|
|
43
|
+
this.colonWidth = options.colonWidth;
|
|
44
|
+
this.totalMs = Math.max(0, Math.floor(options.totalSeconds * 1000));
|
|
45
|
+
this.onTimeoutCallback = options.onTimeout;
|
|
46
|
+
|
|
47
|
+
const totalWidth =
|
|
48
|
+
this.digitWidth * 4 + this.colonWidth + this.digitSpacing * 4;
|
|
49
|
+
|
|
50
|
+
this.container = scene.add.container(
|
|
51
|
+
options.xLeft + totalWidth / 2,
|
|
52
|
+
options.y,
|
|
53
|
+
);
|
|
54
|
+
this.container.setSize(totalWidth, this.digitHeight);
|
|
55
|
+
parent.add(this.container);
|
|
56
|
+
|
|
57
|
+
// 创建5个图形对象:分钟十位、分钟个位、冒号、秒钟十位、秒钟个位
|
|
58
|
+
let offsetX = -totalWidth / 2;
|
|
59
|
+
for (let i = 0; i < 5; i++) {
|
|
60
|
+
const g = scene.add.graphics();
|
|
61
|
+
|
|
62
|
+
const isColon = i === 2;
|
|
63
|
+
const w = isColon ? this.colonWidth : this.digitWidth;
|
|
64
|
+
|
|
65
|
+
g.setPosition(offsetX + w / 2, 0);
|
|
66
|
+
offsetX += w;
|
|
67
|
+
|
|
68
|
+
// 仅在元素之间添加间距(共4个间隔),最后一个元素后不加
|
|
69
|
+
if (i !== 4) {
|
|
70
|
+
offsetX += this.digitSpacing;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
this.digitGraphics.push(g);
|
|
74
|
+
this.container.add(g);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** 更新倒计时的视觉显示 */
|
|
79
|
+
public updateDisplay(remainingOverride?: number): void {
|
|
80
|
+
if (!this.digitGraphics || this.digitGraphics.length < 5) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const remainingMsRaw =
|
|
85
|
+
remainingOverride !== undefined
|
|
86
|
+
? remainingOverride
|
|
87
|
+
: Math.max(this.totalMs - this.elapsedMs, 0);
|
|
88
|
+
|
|
89
|
+
// 以向上取整到整秒来渲染,使显示每秒跳动一次
|
|
90
|
+
const remainingSeconds = Math.max(0, Math.ceil(remainingMsRaw / 1000));
|
|
91
|
+
|
|
92
|
+
const mins = Math.floor(remainingSeconds / 60);
|
|
93
|
+
const secs = remainingSeconds % 60;
|
|
94
|
+
|
|
95
|
+
// 颜色:正常灰色,剩余 ≤ 10秒时显示警告红色
|
|
96
|
+
const color = remainingSeconds <= 10 ? 0xff3333 : 0x50536b;
|
|
97
|
+
|
|
98
|
+
const digitWidth = this.digitWidth || 20;
|
|
99
|
+
const digitHeight = this.digitHeight || 36;
|
|
100
|
+
|
|
101
|
+
// 分钟十位
|
|
102
|
+
DigitRenderer.drawDigit(
|
|
103
|
+
this.digitGraphics[0],
|
|
104
|
+
Math.floor(mins / 10),
|
|
105
|
+
color,
|
|
106
|
+
digitWidth,
|
|
107
|
+
digitHeight,
|
|
108
|
+
);
|
|
109
|
+
// 分钟个位
|
|
110
|
+
DigitRenderer.drawDigit(
|
|
111
|
+
this.digitGraphics[1],
|
|
112
|
+
mins % 10,
|
|
113
|
+
color,
|
|
114
|
+
digitWidth,
|
|
115
|
+
digitHeight,
|
|
116
|
+
);
|
|
117
|
+
// 冒号
|
|
118
|
+
DigitRenderer.drawColon(this.digitGraphics[2], color, digitWidth);
|
|
119
|
+
// 秒钟十位
|
|
120
|
+
DigitRenderer.drawDigit(
|
|
121
|
+
this.digitGraphics[3],
|
|
122
|
+
Math.floor(secs / 10),
|
|
123
|
+
color,
|
|
124
|
+
digitWidth,
|
|
125
|
+
digitHeight,
|
|
126
|
+
);
|
|
127
|
+
// 秒钟个位
|
|
128
|
+
DigitRenderer.drawDigit(
|
|
129
|
+
this.digitGraphics[4],
|
|
130
|
+
secs % 10,
|
|
131
|
+
color,
|
|
132
|
+
digitWidth,
|
|
133
|
+
digitHeight,
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** 每帧调用以推进计时器 */
|
|
138
|
+
public updateTimer(deltaMs: number, nowMs?: number): void {
|
|
139
|
+
const prevRemainingMs = Math.max(this.totalMs - this.elapsedMs, 0);
|
|
140
|
+
|
|
141
|
+
if (this.timerRunning && prevRemainingMs > 0) {
|
|
142
|
+
// 优先使用绝对时间戳以避免帧增量平滑漂移
|
|
143
|
+
let usedDeltaMs = deltaMs;
|
|
144
|
+
if (nowMs !== undefined) {
|
|
145
|
+
if (this.lastTimerUpdateMs === undefined) {
|
|
146
|
+
this.lastTimerUpdateMs = nowMs;
|
|
147
|
+
usedDeltaMs = 0;
|
|
148
|
+
} else {
|
|
149
|
+
usedDeltaMs = nowMs - this.lastTimerUpdateMs;
|
|
150
|
+
this.lastTimerUpdateMs = nowMs;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (Number.isFinite(usedDeltaMs) && usedDeltaMs > 0) {
|
|
155
|
+
this.elapsedMs += usedDeltaMs;
|
|
156
|
+
}
|
|
157
|
+
} else {
|
|
158
|
+
// 未运行时同步时间戳,避免恢复时出现跳跃
|
|
159
|
+
if (nowMs !== undefined) {
|
|
160
|
+
this.lastTimerUpdateMs = nowMs;
|
|
161
|
+
} else {
|
|
162
|
+
this.lastTimerUpdateMs = undefined;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const remainingMs = Math.max(this.totalMs - this.elapsedMs, 0);
|
|
167
|
+
|
|
168
|
+
if (
|
|
169
|
+
this.timerRunning &&
|
|
170
|
+
!this.timeoutTriggered &&
|
|
171
|
+
prevRemainingMs > 0 &&
|
|
172
|
+
remainingMs <= 0
|
|
173
|
+
) {
|
|
174
|
+
this.timeoutTriggered = true;
|
|
175
|
+
if (this.onTimeoutCallback) {
|
|
176
|
+
this.onTimeoutCallback();
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
this.updateDisplay(remainingMs);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* 为倒计时添加额外时间。
|
|
185
|
+
* @param seconds 要添加的秒数
|
|
186
|
+
*/
|
|
187
|
+
public addTime(seconds: number): void {
|
|
188
|
+
if (seconds <= 0) return;
|
|
189
|
+
|
|
190
|
+
this.totalMs += seconds * 1000;
|
|
191
|
+
this.timeoutTriggered = false;
|
|
192
|
+
|
|
193
|
+
const remainingMs = Math.max(this.totalMs - this.elapsedMs, 0);
|
|
194
|
+
this.updateDisplay(remainingMs);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** 启动计时器 */
|
|
198
|
+
public startTimer(): void {
|
|
199
|
+
this.timerRunning = true;
|
|
200
|
+
this.lastTimerUpdateMs = undefined;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/** 停止计时器 */
|
|
204
|
+
public stopTimer(): void {
|
|
205
|
+
this.timerRunning = false;
|
|
206
|
+
this.lastTimerUpdateMs = undefined;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/** 获取已经过的秒数 */
|
|
210
|
+
public getElapsedSeconds(): number {
|
|
211
|
+
return Math.floor(this.elapsedMs / 1000);
|
|
212
|
+
}
|
|
213
|
+
}
|