react-native-games 0.3.0 → 0.4.0
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 +45 -32
- package/lib/module/games/balloon-blaster/BalloonBlaster.js +160 -75
- package/lib/module/games/balloon-blaster/BalloonBlaster.js.map +1 -1
- package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js +183 -0
- package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js.map +1 -0
- package/lib/module/games/balloon-blaster/BalloonBlasterService.js +152 -55
- package/lib/module/games/balloon-blaster/BalloonBlasterService.js.map +1 -1
- package/lib/module/games/balloon-blaster/BalloonBlasterStore.js +108 -92
- package/lib/module/games/balloon-blaster/BalloonBlasterStore.js.map +1 -1
- package/lib/module/games/balloon-blaster/components/BalloonComponent.js +48 -65
- package/lib/module/games/balloon-blaster/components/BalloonComponent.js.map +1 -1
- package/lib/module/games/balloon-blaster/components/GameArea.js +7 -2
- package/lib/module/games/balloon-blaster/components/GameArea.js.map +1 -1
- package/lib/module/games/balloon-blaster/components/GameBackground.js +8 -83
- package/lib/module/games/balloon-blaster/components/GameBackground.js.map +1 -1
- package/lib/module/games/balloon-blaster/components/ParticleSystem.js +9 -6
- package/lib/module/games/balloon-blaster/components/ParticleSystem.js.map +1 -1
- package/lib/module/games/balloon-blaster/components/ScoreBoard.js +8 -16
- package/lib/module/games/balloon-blaster/components/ScoreBoard.js.map +1 -1
- package/lib/module/games/balloon-blaster/components/index.js +0 -1
- package/lib/module/games/balloon-blaster/components/index.js.map +1 -1
- package/lib/module/games/{fruit-slicer/FruitSlicer.js → fruit-ninja/FruitNinja.js} +68 -54
- package/lib/module/games/fruit-ninja/FruitNinja.js.map +1 -0
- package/lib/module/games/fruit-ninja/FruitNinjaConstants.js +151 -0
- package/lib/module/games/fruit-ninja/FruitNinjaConstants.js.map +1 -0
- package/lib/module/games/{fruit-slicer/FruitSlicerService.js → fruit-ninja/FruitNinjaService.js} +13 -12
- package/lib/module/games/fruit-ninja/FruitNinjaService.js.map +1 -0
- package/lib/module/games/fruit-ninja/FruitNinjaStore.js +166 -0
- package/lib/module/games/fruit-ninja/FruitNinjaStore.js.map +1 -0
- package/lib/module/games/{fruit-slicer → fruit-ninja}/components/FruitComponent.js +1 -1
- package/lib/module/games/fruit-ninja/components/FruitComponent.js.map +1 -0
- package/lib/module/games/fruit-ninja/components/GameArea.js.map +1 -0
- package/lib/module/games/{fruit-slicer → fruit-ninja}/components/GameBackground.js +198 -169
- package/lib/module/games/fruit-ninja/components/GameBackground.js.map +1 -0
- package/lib/module/games/fruit-ninja/components/GameOverModal.js.map +1 -0
- package/lib/module/games/fruit-ninja/components/ParticleSystem.js.map +1 -0
- package/lib/module/games/{fruit-slicer → fruit-ninja}/components/ScoreBoard.js +8 -17
- package/lib/module/games/fruit-ninja/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/{fruit-slicer → fruit-ninja}/components/SliceTrail.js +1 -1
- package/lib/module/games/fruit-ninja/components/SliceTrail.js.map +1 -0
- package/lib/module/games/{fruit-slicer → fruit-ninja}/components/index.js +0 -1
- package/lib/module/games/fruit-ninja/components/index.js.map +1 -0
- package/lib/module/games/maze-runner/MazeRunner.js +109 -91
- package/lib/module/games/maze-runner/MazeRunner.js.map +1 -1
- package/lib/module/games/maze-runner/MazeRunnerConstants.js +105 -0
- package/lib/module/games/maze-runner/MazeRunnerConstants.js.map +1 -0
- package/lib/module/games/maze-runner/MazeRunnerService.js +37 -14
- package/lib/module/games/maze-runner/MazeRunnerService.js.map +1 -1
- package/lib/module/games/maze-runner/components/EnhancedGameArea.js +5 -9
- package/lib/module/games/maze-runner/components/EnhancedGameArea.js.map +1 -1
- package/lib/module/games/maze-runner/components/GameBackground.js +151 -192
- package/lib/module/games/maze-runner/components/GameBackground.js.map +1 -1
- package/lib/module/games/maze-runner/components/ScoreBoard.js +8 -23
- package/lib/module/games/maze-runner/components/ScoreBoard.js.map +1 -1
- package/lib/module/games/maze-runner/components/index.js +0 -1
- package/lib/module/games/maze-runner/components/index.js.map +1 -1
- package/lib/module/games/popit-fidget/PopitFidget.js +293 -0
- package/lib/module/games/popit-fidget/PopitFidget.js.map +1 -0
- package/lib/module/games/popit-fidget/PopitFidgetConstants.js +116 -0
- package/lib/module/games/popit-fidget/PopitFidgetConstants.js.map +1 -0
- package/lib/module/games/popit-fidget/PopitFidgetService.js +191 -0
- package/lib/module/games/popit-fidget/PopitFidgetService.js.map +1 -0
- package/lib/module/games/popit-fidget/PopitFidgetStore.js +190 -0
- package/lib/module/games/popit-fidget/PopitFidgetStore.js.map +1 -0
- package/lib/module/games/popit-fidget/components/BubbleComponent.js +196 -0
- package/lib/module/games/popit-fidget/components/BubbleComponent.js.map +1 -0
- package/lib/module/games/popit-fidget/components/FidgetGrid.js +165 -0
- package/lib/module/games/popit-fidget/components/FidgetGrid.js.map +1 -0
- package/lib/module/games/popit-fidget/components/GameBackground.js +174 -0
- package/lib/module/games/popit-fidget/components/GameBackground.js.map +1 -0
- package/lib/module/games/popit-fidget/components/GameOverModal.js +132 -0
- package/lib/module/games/popit-fidget/components/GameOverModal.js.map +1 -0
- package/lib/module/games/popit-fidget/components/ParticleSystem.js +89 -0
- package/lib/module/games/popit-fidget/components/ParticleSystem.js.map +1 -0
- package/lib/module/games/popit-fidget/components/ScoreBoard.js +68 -0
- package/lib/module/games/popit-fidget/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/popit-fidget/components/index.js +9 -0
- package/lib/module/games/popit-fidget/components/index.js.map +1 -0
- package/lib/module/games/{space-traveller/SpaceTraveller.js → space-fighter/SpaceFighter.js} +94 -70
- package/lib/module/games/space-fighter/SpaceFighter.js.map +1 -0
- package/lib/module/games/space-fighter/SpaceFighterConstants.js +110 -0
- package/lib/module/games/space-fighter/SpaceFighterConstants.js.map +1 -0
- package/lib/module/games/{space-traveller/SpaceTravellerService.js → space-fighter/SpaceFighterService.js} +18 -10
- package/lib/module/games/space-fighter/SpaceFighterService.js.map +1 -0
- package/lib/module/games/space-fighter/SpaceFighterStore.js +143 -0
- package/lib/module/games/space-fighter/SpaceFighterStore.js.map +1 -0
- package/lib/module/games/space-fighter/components/AsteroidComponent.js.map +1 -0
- package/lib/module/games/space-fighter/components/GameArea.js.map +1 -0
- package/lib/module/games/space-fighter/components/GameBackground.js.map +1 -0
- package/lib/module/games/space-fighter/components/GameOverModal.js.map +1 -0
- package/lib/module/games/space-fighter/components/ParticleComponent.js.map +1 -0
- package/lib/module/games/{space-traveller → space-fighter}/components/ScoreBoard.js +11 -19
- package/lib/module/games/space-fighter/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/space-fighter/components/SettingsModal.js.map +1 -0
- package/lib/module/games/space-fighter/components/Spacecraft3D.js.map +1 -0
- package/lib/module/games/{space-traveller → space-fighter}/components/SpacecraftPath.js +1 -1
- package/lib/module/games/space-fighter/components/SpacecraftPath.js.map +1 -0
- package/lib/module/games/{space-traveller → space-fighter}/components/index.js +0 -1
- package/lib/module/games/space-fighter/components/index.js.map +1 -0
- package/lib/module/games/whack-a-mole/WhackAMole.js +273 -0
- package/lib/module/games/whack-a-mole/WhackAMole.js.map +1 -0
- package/lib/module/games/whack-a-mole/WhackAMoleConstants.js +117 -0
- package/lib/module/games/whack-a-mole/WhackAMoleConstants.js.map +1 -0
- package/lib/module/games/whack-a-mole/WhackAMoleService.js +120 -0
- package/lib/module/games/whack-a-mole/WhackAMoleService.js.map +1 -0
- package/lib/module/games/whack-a-mole/WhackAMoleStore.js +159 -0
- package/lib/module/games/whack-a-mole/WhackAMoleStore.js.map +1 -0
- package/lib/module/games/{cat-popper → whack-a-mole}/components/GameBackground.js +31 -91
- package/lib/module/games/whack-a-mole/components/GameBackground.js.map +1 -0
- package/lib/module/games/whack-a-mole/components/GameGrid.js +97 -0
- package/lib/module/games/whack-a-mole/components/GameGrid.js.map +1 -0
- package/lib/module/games/{cat-popper → whack-a-mole}/components/GameHole.js +67 -54
- package/lib/module/games/whack-a-mole/components/GameHole.js.map +1 -0
- package/lib/module/games/{cat-popper → whack-a-mole}/components/GameOverModal.js +2 -2
- package/lib/module/games/whack-a-mole/components/GameOverModal.js.map +1 -0
- package/lib/module/games/{cat-popper/components/CatCharacter.js → whack-a-mole/components/MoleCharacter.js} +75 -115
- package/lib/module/games/whack-a-mole/components/MoleCharacter.js.map +1 -0
- package/lib/module/games/{cat-popper → whack-a-mole}/components/ScoreBoard.js +8 -16
- package/lib/module/games/whack-a-mole/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/{cat-popper → whack-a-mole}/components/index.js +1 -2
- package/lib/module/games/whack-a-mole/components/index.js.map +1 -0
- package/lib/module/index.js +4 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/services/GamesConstants.js +36 -506
- package/lib/module/services/GamesConstants.js.map +1 -1
- package/lib/module/services/GamesService.js +22 -14
- package/lib/module/services/GamesService.js.map +1 -1
- package/lib/module/services/HapticsService.js +77 -0
- package/lib/module/services/HapticsService.js.map +1 -0
- package/lib/module/services/SoundsService.js +171 -0
- package/lib/module/services/SoundsService.js.map +1 -0
- package/lib/module/{games/balloon-blaster/components/GameControls.js → shared/helpers/GameControlButton.js} +39 -58
- package/lib/module/shared/helpers/GameControlButton.js.map +1 -0
- package/lib/module/shared/helpers/ResponsiveScoreBoard.js +81 -0
- package/lib/module/shared/helpers/ResponsiveScoreBoard.js.map +1 -0
- package/lib/module/shared/helpers/index.js +5 -0
- package/lib/module/shared/helpers/index.js.map +1 -0
- package/lib/module/shared/settings/SettingsService.js +18 -12
- package/lib/module/shared/settings/SettingsService.js.map +1 -1
- package/lib/typescript/src/games/balloon-blaster/BalloonBlaster.d.ts.map +1 -1
- package/lib/typescript/src/games/balloon-blaster/BalloonBlasterConstants.d.ts +143 -0
- package/lib/typescript/src/games/balloon-blaster/BalloonBlasterConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/balloon-blaster/BalloonBlasterService.d.ts +3 -1
- package/lib/typescript/src/games/balloon-blaster/BalloonBlasterService.d.ts.map +1 -1
- package/lib/typescript/src/games/balloon-blaster/BalloonBlasterStore.d.ts +12 -2
- package/lib/typescript/src/games/balloon-blaster/BalloonBlasterStore.d.ts.map +1 -1
- package/lib/typescript/src/games/balloon-blaster/components/BalloonComponent.d.ts.map +1 -1
- package/lib/typescript/src/games/balloon-blaster/components/GameArea.d.ts.map +1 -1
- package/lib/typescript/src/games/balloon-blaster/components/GameBackground.d.ts.map +1 -1
- package/lib/typescript/src/games/balloon-blaster/components/ParticleSystem.d.ts.map +1 -1
- package/lib/typescript/src/games/balloon-blaster/components/ScoreBoard.d.ts.map +1 -1
- package/lib/typescript/src/games/balloon-blaster/components/index.d.ts +0 -1
- package/lib/typescript/src/games/balloon-blaster/components/index.d.ts.map +1 -1
- package/lib/typescript/src/games/fruit-ninja/FruitNinja.d.ts +16 -0
- package/lib/typescript/src/games/fruit-ninja/FruitNinja.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-ninja/FruitNinjaConstants.d.ts +112 -0
- package/lib/typescript/src/games/fruit-ninja/FruitNinjaConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/{fruit-slicer/FruitSlicerService.d.ts → fruit-ninja/FruitNinjaService.d.ts} +4 -4
- package/lib/typescript/src/games/fruit-ninja/FruitNinjaService.d.ts.map +1 -0
- package/lib/typescript/src/games/{fruit-slicer/FruitSlicerStore.d.ts → fruit-ninja/FruitNinjaStore.d.ts} +12 -4
- package/lib/typescript/src/games/fruit-ninja/FruitNinjaStore.d.ts.map +1 -0
- package/lib/typescript/src/games/{fruit-slicer → fruit-ninja}/components/FruitComponent.d.ts +1 -1
- package/lib/typescript/src/games/fruit-ninja/components/FruitComponent.d.ts.map +1 -0
- package/lib/typescript/src/games/{fruit-slicer → fruit-ninja}/components/GameArea.d.ts +1 -1
- package/lib/typescript/src/games/fruit-ninja/components/GameArea.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-ninja/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-ninja/components/GameOverModal.d.ts.map +1 -0
- package/lib/typescript/src/games/{fruit-slicer → fruit-ninja}/components/ParticleSystem.d.ts +1 -1
- package/lib/typescript/src/games/fruit-ninja/components/ParticleSystem.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-ninja/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-ninja/components/SliceTrail.d.ts.map +1 -0
- package/lib/typescript/src/games/{fruit-slicer → fruit-ninja}/components/index.d.ts +0 -1
- package/lib/typescript/src/games/fruit-ninja/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/maze-runner/MazeRunner.d.ts +1 -9
- package/lib/typescript/src/games/maze-runner/MazeRunner.d.ts.map +1 -1
- package/lib/typescript/src/games/maze-runner/MazeRunnerConstants.d.ts +41 -0
- package/lib/typescript/src/games/maze-runner/MazeRunnerConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/maze-runner/MazeRunnerService.d.ts +4 -2
- package/lib/typescript/src/games/maze-runner/MazeRunnerService.d.ts.map +1 -1
- package/lib/typescript/src/games/maze-runner/components/EnhancedGameArea.d.ts.map +1 -1
- package/lib/typescript/src/games/maze-runner/components/GameBackground.d.ts +2 -1
- package/lib/typescript/src/games/maze-runner/components/GameBackground.d.ts.map +1 -1
- package/lib/typescript/src/games/maze-runner/components/ScoreBoard.d.ts.map +1 -1
- package/lib/typescript/src/games/maze-runner/components/index.d.ts +0 -1
- package/lib/typescript/src/games/maze-runner/components/index.d.ts.map +1 -1
- package/lib/typescript/src/games/popit-fidget/PopitFidget.d.ts +11 -0
- package/lib/typescript/src/games/popit-fidget/PopitFidget.d.ts.map +1 -0
- package/lib/typescript/src/games/popit-fidget/PopitFidgetConstants.d.ts +45 -0
- package/lib/typescript/src/games/popit-fidget/PopitFidgetConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/popit-fidget/PopitFidgetService.d.ts +54 -0
- package/lib/typescript/src/games/popit-fidget/PopitFidgetService.d.ts.map +1 -0
- package/lib/typescript/src/games/popit-fidget/PopitFidgetStore.d.ts +40 -0
- package/lib/typescript/src/games/popit-fidget/PopitFidgetStore.d.ts.map +1 -0
- package/lib/typescript/src/games/popit-fidget/components/BubbleComponent.d.ts +12 -0
- package/lib/typescript/src/games/popit-fidget/components/BubbleComponent.d.ts.map +1 -0
- package/lib/typescript/src/games/popit-fidget/components/FidgetGrid.d.ts +12 -0
- package/lib/typescript/src/games/popit-fidget/components/FidgetGrid.d.ts.map +1 -0
- package/lib/typescript/src/games/popit-fidget/components/GameBackground.d.ts +9 -0
- package/lib/typescript/src/games/popit-fidget/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/popit-fidget/components/GameOverModal.d.ts +9 -0
- package/lib/typescript/src/games/popit-fidget/components/GameOverModal.d.ts.map +1 -0
- package/lib/typescript/src/games/popit-fidget/components/ParticleSystem.d.ts +9 -0
- package/lib/typescript/src/games/popit-fidget/components/ParticleSystem.d.ts.map +1 -0
- package/lib/typescript/src/games/popit-fidget/components/ScoreBoard.d.ts +8 -0
- package/lib/typescript/src/games/popit-fidget/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/popit-fidget/components/index.d.ts +7 -0
- package/lib/typescript/src/games/popit-fidget/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/space-fighter/SpaceFighter.d.ts +9 -0
- package/lib/typescript/src/games/space-fighter/SpaceFighter.d.ts.map +1 -0
- package/lib/typescript/src/games/space-fighter/SpaceFighterConstants.d.ts +71 -0
- package/lib/typescript/src/games/space-fighter/SpaceFighterConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/{space-traveller/SpaceTravellerService.d.ts → space-fighter/SpaceFighterService.d.ts} +7 -4
- package/lib/typescript/src/games/space-fighter/SpaceFighterService.d.ts.map +1 -0
- package/lib/typescript/src/games/{space-traveller/SpaceTravellerStore.d.ts → space-fighter/SpaceFighterStore.d.ts} +12 -4
- package/lib/typescript/src/games/space-fighter/SpaceFighterStore.d.ts.map +1 -0
- package/lib/typescript/src/games/{space-traveller → space-fighter}/components/AsteroidComponent.d.ts +1 -1
- package/lib/typescript/src/games/space-fighter/components/AsteroidComponent.d.ts.map +1 -0
- package/lib/typescript/src/games/{space-traveller → space-fighter}/components/GameArea.d.ts +1 -1
- package/lib/typescript/src/games/space-fighter/components/GameArea.d.ts.map +1 -0
- package/lib/typescript/src/games/space-fighter/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/space-fighter/components/GameOverModal.d.ts.map +1 -0
- package/lib/typescript/src/games/{space-traveller → space-fighter}/components/ParticleComponent.d.ts +1 -1
- package/lib/typescript/src/games/space-fighter/components/ParticleComponent.d.ts.map +1 -0
- package/lib/typescript/src/games/space-fighter/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/space-fighter/components/SettingsModal.d.ts.map +1 -0
- package/lib/typescript/src/games/{space-traveller → space-fighter}/components/Spacecraft3D.d.ts +1 -1
- package/lib/typescript/src/games/space-fighter/components/Spacecraft3D.d.ts.map +1 -0
- package/lib/typescript/src/games/space-fighter/components/SpacecraftPath.d.ts.map +1 -0
- package/lib/typescript/src/games/{space-traveller → space-fighter}/components/index.d.ts +0 -1
- package/lib/typescript/src/games/space-fighter/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/{cat-popper/CatPopper.d.ts → whack-a-mole/WhackAMole.d.ts} +4 -4
- package/lib/typescript/src/games/whack-a-mole/WhackAMole.d.ts.map +1 -0
- package/lib/typescript/src/games/whack-a-mole/WhackAMoleConstants.d.ts +79 -0
- package/lib/typescript/src/games/whack-a-mole/WhackAMoleConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/whack-a-mole/WhackAMoleService.d.ts +33 -0
- package/lib/typescript/src/games/whack-a-mole/WhackAMoleService.d.ts.map +1 -0
- package/lib/typescript/src/games/whack-a-mole/WhackAMoleStore.d.ts +41 -0
- package/lib/typescript/src/games/whack-a-mole/WhackAMoleStore.d.ts.map +1 -0
- package/lib/typescript/src/games/whack-a-mole/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/{cat-popper → whack-a-mole}/components/GameGrid.d.ts +2 -2
- package/lib/typescript/src/games/whack-a-mole/components/GameGrid.d.ts.map +1 -0
- package/lib/typescript/src/games/{cat-popper → whack-a-mole}/components/GameHole.d.ts +3 -2
- package/lib/typescript/src/games/whack-a-mole/components/GameHole.d.ts.map +1 -0
- package/lib/typescript/src/games/{fruit-slicer → whack-a-mole}/components/GameOverModal.d.ts.map +1 -1
- package/lib/typescript/src/games/whack-a-mole/components/MoleCharacter.d.ts +7 -0
- package/lib/typescript/src/games/whack-a-mole/components/MoleCharacter.d.ts.map +1 -0
- package/lib/typescript/src/games/whack-a-mole/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/{cat-popper → whack-a-mole}/components/index.d.ts +1 -2
- package/lib/typescript/src/games/whack-a-mole/components/index.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/services/GamesConstants.d.ts +30 -318
- package/lib/typescript/src/services/GamesConstants.d.ts.map +1 -1
- package/lib/typescript/src/services/GamesService.d.ts +1 -0
- package/lib/typescript/src/services/GamesService.d.ts.map +1 -1
- package/lib/typescript/src/services/HapticsService.d.ts +16 -0
- package/lib/typescript/src/services/HapticsService.d.ts.map +1 -0
- package/lib/typescript/src/services/SoundsService.d.ts +154 -0
- package/lib/typescript/src/services/SoundsService.d.ts.map +1 -0
- package/lib/typescript/src/shared/helpers/GameControlButton.d.ts +17 -0
- package/lib/typescript/src/shared/helpers/GameControlButton.d.ts.map +1 -0
- package/lib/typescript/src/shared/helpers/ResponsiveScoreBoard.d.ts +42 -0
- package/lib/typescript/src/shared/helpers/ResponsiveScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/shared/helpers/index.d.ts +4 -0
- package/lib/typescript/src/shared/helpers/index.d.ts.map +1 -0
- package/lib/typescript/src/shared/settings/SettingsService.d.ts +2 -1
- package/lib/typescript/src/shared/settings/SettingsService.d.ts.map +1 -1
- package/package.json +9 -6
- package/lib/module/games/balloon-blaster/components/GameControls.js.map +0 -1
- package/lib/module/games/cat-popper/CatPopper.js +0 -230
- package/lib/module/games/cat-popper/CatPopper.js.map +0 -1
- package/lib/module/games/cat-popper/CatPopperService.js +0 -100
- package/lib/module/games/cat-popper/CatPopperService.js.map +0 -1
- package/lib/module/games/cat-popper/CatPopperStore.js +0 -113
- package/lib/module/games/cat-popper/CatPopperStore.js.map +0 -1
- package/lib/module/games/cat-popper/components/CatCharacter.js.map +0 -1
- package/lib/module/games/cat-popper/components/GameBackground.js.map +0 -1
- package/lib/module/games/cat-popper/components/GameControls.js +0 -230
- package/lib/module/games/cat-popper/components/GameControls.js.map +0 -1
- package/lib/module/games/cat-popper/components/GameGrid.js +0 -66
- package/lib/module/games/cat-popper/components/GameGrid.js.map +0 -1
- package/lib/module/games/cat-popper/components/GameHole.js.map +0 -1
- package/lib/module/games/cat-popper/components/GameOverModal.js.map +0 -1
- package/lib/module/games/cat-popper/components/ScoreBoard.js.map +0 -1
- package/lib/module/games/cat-popper/components/index.js.map +0 -1
- package/lib/module/games/fruit-slicer/FruitSlicer.js.map +0 -1
- package/lib/module/games/fruit-slicer/FruitSlicerService.js.map +0 -1
- package/lib/module/games/fruit-slicer/FruitSlicerStore.js +0 -156
- package/lib/module/games/fruit-slicer/FruitSlicerStore.js.map +0 -1
- package/lib/module/games/fruit-slicer/components/FruitComponent.js.map +0 -1
- package/lib/module/games/fruit-slicer/components/GameArea.js.map +0 -1
- package/lib/module/games/fruit-slicer/components/GameBackground.js.map +0 -1
- package/lib/module/games/fruit-slicer/components/GameControls.js +0 -230
- package/lib/module/games/fruit-slicer/components/GameControls.js.map +0 -1
- package/lib/module/games/fruit-slicer/components/GameOverModal.js.map +0 -1
- package/lib/module/games/fruit-slicer/components/ParticleSystem.js.map +0 -1
- package/lib/module/games/fruit-slicer/components/ScoreBoard.js.map +0 -1
- package/lib/module/games/fruit-slicer/components/SliceTrail.js.map +0 -1
- package/lib/module/games/fruit-slicer/components/index.js.map +0 -1
- package/lib/module/games/maze-runner/components/GameControls.js +0 -129
- package/lib/module/games/maze-runner/components/GameControls.js.map +0 -1
- package/lib/module/games/space-traveller/SpaceTraveller.js.map +0 -1
- package/lib/module/games/space-traveller/SpaceTravellerService.js.map +0 -1
- package/lib/module/games/space-traveller/SpaceTravellerStore.js +0 -139
- package/lib/module/games/space-traveller/SpaceTravellerStore.js.map +0 -1
- package/lib/module/games/space-traveller/components/AsteroidComponent.js.map +0 -1
- package/lib/module/games/space-traveller/components/GameArea.js.map +0 -1
- package/lib/module/games/space-traveller/components/GameBackground.js.map +0 -1
- package/lib/module/games/space-traveller/components/GameControls.js +0 -177
- package/lib/module/games/space-traveller/components/GameControls.js.map +0 -1
- package/lib/module/games/space-traveller/components/GameOverModal.js.map +0 -1
- package/lib/module/games/space-traveller/components/ParticleComponent.js.map +0 -1
- package/lib/module/games/space-traveller/components/ScoreBoard.js.map +0 -1
- package/lib/module/games/space-traveller/components/SettingsModal.js.map +0 -1
- package/lib/module/games/space-traveller/components/Spacecraft3D.js.map +0 -1
- package/lib/module/games/space-traveller/components/SpacecraftPath.js.map +0 -1
- package/lib/module/games/space-traveller/components/index.js.map +0 -1
- package/lib/typescript/src/games/balloon-blaster/components/GameControls.d.ts +0 -10
- package/lib/typescript/src/games/balloon-blaster/components/GameControls.d.ts.map +0 -1
- package/lib/typescript/src/games/cat-popper/CatPopper.d.ts.map +0 -1
- package/lib/typescript/src/games/cat-popper/CatPopperService.d.ts +0 -32
- package/lib/typescript/src/games/cat-popper/CatPopperService.d.ts.map +0 -1
- package/lib/typescript/src/games/cat-popper/CatPopperStore.d.ts +0 -21
- package/lib/typescript/src/games/cat-popper/CatPopperStore.d.ts.map +0 -1
- package/lib/typescript/src/games/cat-popper/components/CatCharacter.d.ts +0 -7
- package/lib/typescript/src/games/cat-popper/components/CatCharacter.d.ts.map +0 -1
- package/lib/typescript/src/games/cat-popper/components/GameBackground.d.ts.map +0 -1
- package/lib/typescript/src/games/cat-popper/components/GameControls.d.ts +0 -10
- package/lib/typescript/src/games/cat-popper/components/GameControls.d.ts.map +0 -1
- package/lib/typescript/src/games/cat-popper/components/GameGrid.d.ts.map +0 -1
- package/lib/typescript/src/games/cat-popper/components/GameHole.d.ts.map +0 -1
- package/lib/typescript/src/games/cat-popper/components/GameOverModal.d.ts.map +0 -1
- package/lib/typescript/src/games/cat-popper/components/ScoreBoard.d.ts.map +0 -1
- package/lib/typescript/src/games/cat-popper/components/index.d.ts.map +0 -1
- package/lib/typescript/src/games/fruit-slicer/FruitSlicer.d.ts +0 -16
- package/lib/typescript/src/games/fruit-slicer/FruitSlicer.d.ts.map +0 -1
- package/lib/typescript/src/games/fruit-slicer/FruitSlicerService.d.ts.map +0 -1
- package/lib/typescript/src/games/fruit-slicer/FruitSlicerStore.d.ts.map +0 -1
- package/lib/typescript/src/games/fruit-slicer/components/FruitComponent.d.ts.map +0 -1
- package/lib/typescript/src/games/fruit-slicer/components/GameArea.d.ts.map +0 -1
- package/lib/typescript/src/games/fruit-slicer/components/GameBackground.d.ts.map +0 -1
- package/lib/typescript/src/games/fruit-slicer/components/GameControls.d.ts +0 -10
- package/lib/typescript/src/games/fruit-slicer/components/GameControls.d.ts.map +0 -1
- package/lib/typescript/src/games/fruit-slicer/components/ParticleSystem.d.ts.map +0 -1
- package/lib/typescript/src/games/fruit-slicer/components/ScoreBoard.d.ts.map +0 -1
- package/lib/typescript/src/games/fruit-slicer/components/SliceTrail.d.ts.map +0 -1
- package/lib/typescript/src/games/fruit-slicer/components/index.d.ts.map +0 -1
- package/lib/typescript/src/games/maze-runner/components/GameControls.d.ts +0 -10
- package/lib/typescript/src/games/maze-runner/components/GameControls.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/SpaceTraveller.d.ts +0 -17
- package/lib/typescript/src/games/space-traveller/SpaceTraveller.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/SpaceTravellerService.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/SpaceTravellerStore.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/components/AsteroidComponent.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/components/GameArea.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/components/GameBackground.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/components/GameControls.d.ts +0 -10
- package/lib/typescript/src/games/space-traveller/components/GameControls.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/components/GameOverModal.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/components/ParticleComponent.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/components/ScoreBoard.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/components/SettingsModal.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/components/Spacecraft3D.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/components/SpacecraftPath.d.ts.map +0 -1
- package/lib/typescript/src/games/space-traveller/components/index.d.ts.map +0 -1
- /package/lib/module/games/{fruit-slicer → fruit-ninja}/components/GameArea.js +0 -0
- /package/lib/module/games/{fruit-slicer → fruit-ninja}/components/GameOverModal.js +0 -0
- /package/lib/module/games/{fruit-slicer → fruit-ninja}/components/ParticleSystem.js +0 -0
- /package/lib/module/games/{space-traveller → space-fighter}/components/AsteroidComponent.js +0 -0
- /package/lib/module/games/{space-traveller → space-fighter}/components/GameArea.js +0 -0
- /package/lib/module/games/{space-traveller → space-fighter}/components/GameBackground.js +0 -0
- /package/lib/module/games/{space-traveller → space-fighter}/components/GameOverModal.js +0 -0
- /package/lib/module/games/{space-traveller → space-fighter}/components/ParticleComponent.js +0 -0
- /package/lib/module/games/{space-traveller → space-fighter}/components/SettingsModal.js +0 -0
- /package/lib/module/games/{space-traveller → space-fighter}/components/Spacecraft3D.js +0 -0
- /package/lib/typescript/src/games/{cat-popper → fruit-ninja}/components/GameBackground.d.ts +0 -0
- /package/lib/typescript/src/games/{cat-popper → fruit-ninja}/components/GameOverModal.d.ts +0 -0
- /package/lib/typescript/src/games/{fruit-slicer → fruit-ninja}/components/ScoreBoard.d.ts +0 -0
- /package/lib/typescript/src/games/{fruit-slicer → fruit-ninja}/components/SliceTrail.d.ts +0 -0
- /package/lib/typescript/src/games/{fruit-slicer → space-fighter}/components/GameBackground.d.ts +0 -0
- /package/lib/typescript/src/games/{fruit-slicer → space-fighter}/components/GameOverModal.d.ts +0 -0
- /package/lib/typescript/src/games/{cat-popper → space-fighter}/components/ScoreBoard.d.ts +0 -0
- /package/lib/typescript/src/games/{space-traveller → space-fighter}/components/SettingsModal.d.ts +0 -0
- /package/lib/typescript/src/games/{space-traveller → space-fighter}/components/SpacecraftPath.d.ts +0 -0
- /package/lib/typescript/src/games/{space-traveller → whack-a-mole}/components/GameBackground.d.ts +0 -0
- /package/lib/typescript/src/games/{space-traveller → whack-a-mole}/components/GameOverModal.d.ts +0 -0
- /package/lib/typescript/src/games/{space-traveller → whack-a-mole}/components/ScoreBoard.d.ts +0 -0
package/lib/module/games/{space-traveller/SpaceTraveller.js → space-fighter/SpaceFighter.js}
RENAMED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { useEffect, useRef } from 'react';
|
|
3
|
+
import { useEffect, useRef, useMemo } from 'react';
|
|
4
4
|
import { View, Dimensions, StyleSheet, Modal } from 'react-native';
|
|
5
5
|
import { Gesture, GestureDetector, GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { ScoreBoard, GameArea,
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
import { playSound, stopAllSounds, GAME_SOUNDS } from "../../services/SoundsService.js";
|
|
7
|
+
import { playHaptic, HapticType } from "../../services/HapticsService.js";
|
|
8
|
+
import { useSpaceFighterStore } from "./SpaceFighterStore.js";
|
|
9
|
+
import { createSpaceFighterService } from "./SpaceFighterService.js";
|
|
10
|
+
import { ScoreBoard, GameArea, GameOverModal, GameBackground } from "./components/index.js";
|
|
11
|
+
import { GameControlButton } from "../../shared/helpers/index.js";
|
|
12
|
+
import { DEFAULT_SPACE_FIGHTER_SETTINGS, getDifficultySettings } from "./SpaceFighterConstants.js";
|
|
13
13
|
import { GameSettings } from "../../shared/settings/GameSettings.js";
|
|
14
14
|
import { createGameSettingsStore } from "../../shared/settings/SettingsService.js";
|
|
15
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -17,42 +17,69 @@ const {
|
|
|
17
17
|
width,
|
|
18
18
|
height
|
|
19
19
|
} = Dimensions.get('window');
|
|
20
|
-
export const
|
|
20
|
+
export const SpaceFighter = ({
|
|
21
21
|
showSettingsModal = false,
|
|
22
22
|
onToggleSettingsModal,
|
|
23
|
-
settings,
|
|
23
|
+
settings: externalSettings,
|
|
24
24
|
onSettingsChange
|
|
25
25
|
}) => {
|
|
26
|
-
let gameService = useRef(
|
|
26
|
+
let gameService = useRef(createSpaceFighterService(width, height)).current;
|
|
27
27
|
|
|
28
28
|
// Create unified game settings store
|
|
29
|
-
const
|
|
29
|
+
const settingsStore = useMemo(() => {
|
|
30
30
|
const defaultSettings = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
hapticEnabled: true,
|
|
34
|
-
gameDuration: 120
|
|
31
|
+
...DEFAULT_SPACE_FIGHTER_SETTINGS,
|
|
32
|
+
...externalSettings
|
|
35
33
|
};
|
|
36
34
|
|
|
37
35
|
// Wrapper function to handle the callback type mismatch
|
|
38
36
|
const handleSettingsChange = onSettingsChange ? newSettings => {
|
|
39
|
-
const
|
|
40
|
-
...
|
|
37
|
+
const spaceFighterSettings = {
|
|
38
|
+
...DEFAULT_SPACE_FIGHTER_SETTINGS,
|
|
39
|
+
...externalSettings,
|
|
41
40
|
difficulty: newSettings.difficulty,
|
|
42
41
|
soundEnabled: newSettings.soundEnabled,
|
|
43
42
|
hapticEnabled: newSettings.hapticEnabled,
|
|
44
|
-
gameDuration: newSettings.gameDuration
|
|
45
|
-
asteroidSpawnInterval: settings?.asteroidSpawnInterval || 1000,
|
|
46
|
-
asteroidSpeed: settings?.asteroidSpeed || 2
|
|
43
|
+
gameDuration: newSettings.gameDuration
|
|
47
44
|
};
|
|
48
|
-
onSettingsChange(
|
|
45
|
+
onSettingsChange(spaceFighterSettings);
|
|
49
46
|
} : undefined;
|
|
50
|
-
return createGameSettingsStore(
|
|
51
|
-
})
|
|
52
|
-
|
|
47
|
+
return createGameSettingsStore(defaultSettings, handleSettingsChange);
|
|
48
|
+
}, [externalSettings, onSettingsChange]);
|
|
49
|
+
|
|
50
|
+
// Add infinite loop prevention
|
|
51
|
+
const prevSettingsRef = useRef(externalSettings);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
const prev = prevSettingsRef.current;
|
|
54
|
+
const current = externalSettings;
|
|
55
|
+
if (!prev && !current) return;
|
|
56
|
+
const hasChanged = prev?.difficulty !== current?.difficulty || prev?.soundEnabled !== current?.soundEnabled || prev?.hapticEnabled !== current?.hapticEnabled || prev?.gameDuration !== current?.gameDuration;
|
|
57
|
+
if (hasChanged) {
|
|
58
|
+
const commonSettings = {
|
|
59
|
+
difficulty: current?.difficulty || 'medium',
|
|
60
|
+
soundEnabled: current?.soundEnabled ?? true,
|
|
61
|
+
hapticEnabled: current?.hapticEnabled ?? true
|
|
62
|
+
};
|
|
63
|
+
settingsStore().updateSettings(commonSettings);
|
|
64
|
+
prevSettingsRef.current = current;
|
|
65
|
+
}
|
|
66
|
+
}, [externalSettings, settingsStore]);
|
|
67
|
+
const settings = settingsStore();
|
|
53
68
|
const {
|
|
54
|
-
soundEnabled
|
|
55
|
-
|
|
69
|
+
soundEnabled,
|
|
70
|
+
hapticEnabled,
|
|
71
|
+
difficulty
|
|
72
|
+
} = settings;
|
|
73
|
+
|
|
74
|
+
// Make game constants reactive to difficulty changes
|
|
75
|
+
const gameConstants = useMemo(() => {
|
|
76
|
+
const difficultySettings = getDifficultySettings(difficulty);
|
|
77
|
+
return {
|
|
78
|
+
asteroidSpawnInterval: difficultySettings.asteroidSpawnInterval,
|
|
79
|
+
asteroidSpeed: difficultySettings.asteroidSpeed,
|
|
80
|
+
gameDuration: difficultySettings.gameDuration
|
|
81
|
+
};
|
|
82
|
+
}, [difficulty]);
|
|
56
83
|
const {
|
|
57
84
|
score,
|
|
58
85
|
timeLeft,
|
|
@@ -74,7 +101,7 @@ export const SpaceTraveller = ({
|
|
|
74
101
|
setIsControllingSpacecraft,
|
|
75
102
|
markAsteroidPassed,
|
|
76
103
|
loseLife
|
|
77
|
-
} =
|
|
104
|
+
} = useSpaceFighterStore();
|
|
78
105
|
const currentSpacecraftPath = useRef([]);
|
|
79
106
|
const dragOffset = useRef(null);
|
|
80
107
|
const initialSpacecraftPosition = useRef(null);
|
|
@@ -83,7 +110,7 @@ export const SpaceTraveller = ({
|
|
|
83
110
|
const animationFrameId = useRef(null);
|
|
84
111
|
const lastCollisionTime = useRef(0);
|
|
85
112
|
const handleSpacecraftControlStart = (x, y) => {
|
|
86
|
-
const currentSpacecraft =
|
|
113
|
+
const currentSpacecraft = useSpaceFighterStore.getState().spacecraft;
|
|
87
114
|
const controlledSpacecraft = gameService.controlSpacecraft({
|
|
88
115
|
...currentSpacecraft
|
|
89
116
|
}, x, y);
|
|
@@ -104,7 +131,7 @@ export const SpaceTraveller = ({
|
|
|
104
131
|
x,
|
|
105
132
|
y
|
|
106
133
|
} = pendingSpacecraftUpdate.current;
|
|
107
|
-
const currentSpacecraft =
|
|
134
|
+
const currentSpacecraft = useSpaceFighterStore.getState().spacecraft;
|
|
108
135
|
const controlledSpacecraft = gameService.controlSpacecraft({
|
|
109
136
|
...currentSpacecraft
|
|
110
137
|
}, x, y);
|
|
@@ -138,7 +165,7 @@ export const SpaceTraveller = ({
|
|
|
138
165
|
if (pendingSpacecraftUpdate.current) {
|
|
139
166
|
processPendingSpacecraftUpdate();
|
|
140
167
|
}
|
|
141
|
-
const currentSpacecraft =
|
|
168
|
+
const currentSpacecraft = useSpaceFighterStore.getState().spacecraft;
|
|
142
169
|
const releasedSpacecraft = gameService.releaseSpacecraft({
|
|
143
170
|
...currentSpacecraft
|
|
144
171
|
});
|
|
@@ -154,47 +181,30 @@ export const SpaceTraveller = ({
|
|
|
154
181
|
|
|
155
182
|
// Sound and haptic feedback
|
|
156
183
|
const playSuccessSound = () => {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
pitch: 1.8,
|
|
160
|
-
rate: 2.0,
|
|
161
|
-
volume: 0.6
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
|
|
184
|
+
playSound(GAME_SOUNDS.SPACE_FIGHTER.SUCCESS, soundEnabled);
|
|
185
|
+
playHaptic(HapticType.LIGHT, hapticEnabled);
|
|
165
186
|
};
|
|
166
187
|
const playCollisionSound = () => {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
pitch: 0.8,
|
|
170
|
-
rate: 1.5,
|
|
171
|
-
volume: 0.8
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Heavy);
|
|
188
|
+
playSound(GAME_SOUNDS.SPACE_FIGHTER.COLLISION, soundEnabled);
|
|
189
|
+
playHaptic(HapticType.HEAVY, hapticEnabled);
|
|
175
190
|
};
|
|
176
191
|
const playGameOverSound = () => {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
pitch: 1.0,
|
|
180
|
-
rate: 1.2,
|
|
181
|
-
volume: 0.7
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Heavy);
|
|
192
|
+
playSound(GAME_SOUNDS.GAME_OVER, soundEnabled);
|
|
193
|
+
playHaptic(HapticType.HEAVY, hapticEnabled);
|
|
185
194
|
};
|
|
186
195
|
const handleStartGame = async () => {
|
|
187
|
-
startGame(
|
|
196
|
+
startGame(); // Store uses fixed 60s duration internally
|
|
197
|
+
|
|
198
|
+
// Update game service with current difficulty settings
|
|
199
|
+
gameService.updateDifficultySettings(gameConstants.asteroidSpeed, gameConstants.asteroidSpawnInterval);
|
|
188
200
|
const initialSpacecraft = gameService.getInitialSpacecraft();
|
|
189
201
|
updateSpacecraft(initialSpacecraft);
|
|
190
202
|
gameService.startGameTimer(decrementTime);
|
|
191
203
|
gameService.startAsteroidSpawning(addAsteroids);
|
|
192
|
-
gameService.startPhysicsLoop(updateSpacecraft, updateAsteroid, removeAsteroid, () =>
|
|
204
|
+
gameService.startPhysicsLoop(updateSpacecraft, updateAsteroid, removeAsteroid, () => useSpaceFighterStore.getState().spacecraft, () => useSpaceFighterStore.getState().asteroids);
|
|
193
205
|
if (soundEnabled) {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
Speech.speak('Mission started! Navigate through the asteroid field!');
|
|
206
|
+
stopAllSounds();
|
|
207
|
+
playSound(GAME_SOUNDS.SPACE_FIGHTER.START, soundEnabled);
|
|
198
208
|
}
|
|
199
209
|
};
|
|
200
210
|
const handleStopGame = () => {
|
|
@@ -218,8 +228,8 @@ export const SpaceTraveller = ({
|
|
|
218
228
|
useEffect(() => {
|
|
219
229
|
if (!isPlaying) return;
|
|
220
230
|
const interval = setInterval(() => {
|
|
221
|
-
const currentSpacecraft =
|
|
222
|
-
const currentAsteroids =
|
|
231
|
+
const currentSpacecraft = useSpaceFighterStore.getState().spacecraft;
|
|
232
|
+
const currentAsteroids = useSpaceFighterStore.getState().asteroids;
|
|
223
233
|
const collision = gameService.checkCollision(currentSpacecraft, currentAsteroids);
|
|
224
234
|
const now = Date.now();
|
|
225
235
|
if (collision.collision && now - lastCollisionTime.current > 1000) {
|
|
@@ -250,6 +260,11 @@ export const SpaceTraveller = ({
|
|
|
250
260
|
}
|
|
251
261
|
}, [gameOver]);
|
|
252
262
|
|
|
263
|
+
// Update game service when difficulty changes
|
|
264
|
+
useEffect(() => {
|
|
265
|
+
gameService.updateDifficultySettings(gameConstants.asteroidSpeed, gameConstants.asteroidSpawnInterval);
|
|
266
|
+
}, [gameConstants.asteroidSpeed, gameConstants.asteroidSpawnInterval]);
|
|
267
|
+
|
|
253
268
|
// Initialize and cleanup
|
|
254
269
|
useEffect(() => {
|
|
255
270
|
const initialSpacecraft = gameService.getInitialSpacecraft();
|
|
@@ -259,7 +274,7 @@ export const SpaceTraveller = ({
|
|
|
259
274
|
};
|
|
260
275
|
}, []);
|
|
261
276
|
const panGesture = Gesture.Pan().onStart(event => {
|
|
262
|
-
const currentSpacecraft =
|
|
277
|
+
const currentSpacecraft = useSpaceFighterStore.getState().spacecraft;
|
|
263
278
|
initialSpacecraftPosition.current = {
|
|
264
279
|
x: currentSpacecraft.x,
|
|
265
280
|
y: currentSpacecraft.y
|
|
@@ -295,7 +310,8 @@ export const SpaceTraveller = ({
|
|
|
295
310
|
style: {
|
|
296
311
|
zIndex: 100,
|
|
297
312
|
position: 'relative',
|
|
298
|
-
|
|
313
|
+
paddingTop: 0,
|
|
314
|
+
paddingHorizontal: 20
|
|
299
315
|
},
|
|
300
316
|
children: /*#__PURE__*/_jsx(ScoreBoard, {
|
|
301
317
|
score: score,
|
|
@@ -328,11 +344,19 @@ export const SpaceTraveller = ({
|
|
|
328
344
|
}
|
|
329
345
|
})
|
|
330
346
|
})]
|
|
331
|
-
}), /*#__PURE__*/_jsx(
|
|
347
|
+
}), /*#__PURE__*/_jsx(GameControlButton, {
|
|
332
348
|
isPlaying: isPlaying,
|
|
333
349
|
gameOver: gameOver,
|
|
334
350
|
onStartGame: handleStartGame,
|
|
335
|
-
onStopGame: handleStopGame
|
|
351
|
+
onStopGame: handleStopGame,
|
|
352
|
+
startButtonText: "START FLYING",
|
|
353
|
+
stopButtonText: "STOP GAME",
|
|
354
|
+
startButtonSubtext: "Navigate through space!",
|
|
355
|
+
stopButtonSubtext: "End current game",
|
|
356
|
+
startButtonColor: "#9370db",
|
|
357
|
+
stopButtonColor: "#dc2626",
|
|
358
|
+
startButtonBorderColor: "#ba68c8",
|
|
359
|
+
stopButtonBorderColor: "#f87171"
|
|
336
360
|
}), /*#__PURE__*/_jsx(GameOverModal, {
|
|
337
361
|
isVisible: gameOver,
|
|
338
362
|
score: score,
|
|
@@ -343,9 +367,9 @@ export const SpaceTraveller = ({
|
|
|
343
367
|
presentationStyle: "pageSheet",
|
|
344
368
|
onRequestClose: onToggleSettingsModal,
|
|
345
369
|
children: /*#__PURE__*/_jsx(GameSettings, {
|
|
346
|
-
gameId: "space-
|
|
370
|
+
gameId: "space-fighter",
|
|
347
371
|
onClose: onToggleSettingsModal || (() => {}),
|
|
348
|
-
settingsStore:
|
|
372
|
+
settingsStore: settings
|
|
349
373
|
})
|
|
350
374
|
})]
|
|
351
375
|
})
|
|
@@ -390,4 +414,4 @@ const styles = StyleSheet.create({
|
|
|
390
414
|
fontWeight: '600'
|
|
391
415
|
}
|
|
392
416
|
});
|
|
393
|
-
//# sourceMappingURL=
|
|
417
|
+
//# sourceMappingURL=SpaceFighter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","useMemo","View","Dimensions","StyleSheet","Modal","Gesture","GestureDetector","GestureHandlerRootView","playSound","stopAllSounds","GAME_SOUNDS","playHaptic","HapticType","useSpaceFighterStore","createSpaceFighterService","ScoreBoard","GameArea","GameOverModal","GameBackground","GameControlButton","DEFAULT_SPACE_FIGHTER_SETTINGS","getDifficultySettings","GameSettings","createGameSettingsStore","jsx","_jsx","jsxs","_jsxs","width","height","get","SpaceFighter","showSettingsModal","onToggleSettingsModal","settings","externalSettings","onSettingsChange","gameService","current","settingsStore","defaultSettings","handleSettingsChange","newSettings","spaceFighterSettings","difficulty","soundEnabled","hapticEnabled","gameDuration","undefined","prevSettingsRef","prev","hasChanged","commonSettings","updateSettings","gameConstants","difficultySettings","asteroidSpawnInterval","asteroidSpeed","score","timeLeft","isPlaying","gameOver","asteroids","spacecraft","spacecraftPath","isControllingSpacecraft","startGame","stopGame","resetGame","decrementTime","addAsteroids","removeAsteroid","updateAsteroid","updateSpacecraft","setSpacecraftPath","setIsControllingSpacecraft","markAsteroidPassed","loseLife","currentSpacecraftPath","dragOffset","initialSpacecraftPosition","initialTouchPosition","pendingSpacecraftUpdate","animationFrameId","lastCollisionTime","handleSpacecraftControlStart","x","y","currentSpacecraft","getState","controlledSpacecraft","controlSpacecraft","processPendingSpacecraftUpdate","push","length","shift","handleSpacecraftControlMove","requestAnimationFrame","handleSpacecraftControlEnd","cancelAnimationFrame","releasedSpacecraft","releaseSpacecraft","setTimeout","playSuccessSound","SPACE_FIGHTER","SUCCESS","LIGHT","playCollisionSound","COLLISION","HEAVY","playGameOverSound","GAME_OVER","handleStartGame","updateDifficultySettings","initialSpacecraft","getInitialSpacecraft","startGameTimer","startAsteroidSpawning","startPhysicsLoop","START","handleStopGame","cleanup","handleResetGame","interval","setInterval","currentAsteroids","collision","checkCollision","now","Date","createCollisionParticles","resetSpacecraft","passedAsteroids","checkAsteroidPass","forEach","pairId","clearInterval","panGesture","Pan","onStart","event","absoluteX","absoluteY","onUpdate","dx","newX","newY","onEnd","onFinalize","runOnJS","style","flex","children","styles","container","zIndex","position","paddingTop","paddingHorizontal","particles","getParticles","onSpacecraftControl","onSpacecraftRelease","gesture","top","left","right","bottom","backgroundColor","onStartGame","onStopGame","startButtonText","stopButtonText","startButtonSubtext","stopButtonSubtext","startButtonColor","stopButtonColor","startButtonBorderColor","stopButtonBorderColor","isVisible","onPlayAgain","visible","animationType","presentationStyle","onRequestClose","gameId","onClose","create","settingsOverlay","justifyContent","alignItems","settingsModal","padding","borderRadius","settingsTitle","color","fontSize","fontWeight","marginBottom","closeButton","paddingVertical","closeButtonText"],"sourceRoot":"../../../../src","sources":["games/space-fighter/SpaceFighter.tsx"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,EAAEC,OAAO,QAAQ,OAAO;AAClD,SAASC,IAAI,EAAEC,UAAU,EAAEC,UAAU,EAAEC,KAAK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0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Space Fighter Settings Interface
|
|
4
|
+
|
|
5
|
+
// Space Fighter Difficulty Configuration
|
|
6
|
+
export const SPACE_FIGHTER_DIFFICULTY_CONFIG = {
|
|
7
|
+
easy: {
|
|
8
|
+
gameDuration: 60,
|
|
9
|
+
asteroidSpawnInterval: 4000,
|
|
10
|
+
// Slower spawn rate
|
|
11
|
+
asteroidSpeed: 1.5 // Slower asteroids
|
|
12
|
+
},
|
|
13
|
+
medium: {
|
|
14
|
+
gameDuration: 60,
|
|
15
|
+
asteroidSpawnInterval: 3000,
|
|
16
|
+
// Balanced spawn rate
|
|
17
|
+
asteroidSpeed: 2 // Normal speed
|
|
18
|
+
},
|
|
19
|
+
hard: {
|
|
20
|
+
gameDuration: 60,
|
|
21
|
+
asteroidSpawnInterval: 2000,
|
|
22
|
+
// Faster spawn rate
|
|
23
|
+
asteroidSpeed: 3 // Faster asteroids for challenge
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// Helper function to get difficulty settings
|
|
28
|
+
export const getDifficultySettings = difficulty => {
|
|
29
|
+
return SPACE_FIGHTER_DIFFICULTY_CONFIG[difficulty];
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// Default Space Fighter Settings
|
|
33
|
+
export const DEFAULT_SPACE_FIGHTER_SETTINGS = {
|
|
34
|
+
difficulty: 'medium',
|
|
35
|
+
soundEnabled: true,
|
|
36
|
+
hapticEnabled: true,
|
|
37
|
+
gameDuration: SPACE_FIGHTER_DIFFICULTY_CONFIG.medium.gameDuration,
|
|
38
|
+
asteroidSpawnInterval: SPACE_FIGHTER_DIFFICULTY_CONFIG.medium.asteroidSpawnInterval,
|
|
39
|
+
asteroidSpeed: SPACE_FIGHTER_DIFFICULTY_CONFIG.medium.asteroidSpeed
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// Space Fighter Game Constants
|
|
43
|
+
export const SPACE_FIGHTER_GAME_CONFIG = {
|
|
44
|
+
GAME_DURATION: 120,
|
|
45
|
+
// seconds
|
|
46
|
+
SPACECRAFT_SIZE: 28,
|
|
47
|
+
// Increased from 20 for better visibility
|
|
48
|
+
SPACECRAFT_SPEED: 3,
|
|
49
|
+
ASTEROID_WIDTH: 80,
|
|
50
|
+
ASTEROID_GAP: 120,
|
|
51
|
+
// Increased gap between asteroid pairs for easier navigation
|
|
52
|
+
ASTEROID_SPAWN_INTERVAL: 3000,
|
|
53
|
+
// Increased from 2000ms to 3500ms for better spacing
|
|
54
|
+
ASTEROID_SPEED: 2,
|
|
55
|
+
GRAVITY: 0.3,
|
|
56
|
+
BOUNCE_DAMPING: 0.7,
|
|
57
|
+
FRICTION: 0.98,
|
|
58
|
+
MAX_VELOCITY: 8,
|
|
59
|
+
COLLISION_TOLERANCE: 2,
|
|
60
|
+
COLLISION_COOLDOWN: 2000 // 2 seconds between collisions
|
|
61
|
+
};
|
|
62
|
+
export const SPACE_FIGHTER_COLORS = {
|
|
63
|
+
BACKGROUND: '#0a0a1a',
|
|
64
|
+
// Deep space black
|
|
65
|
+
SPACECRAFT: '#00d4ff',
|
|
66
|
+
// Bright cyan for spacecraft
|
|
67
|
+
ASTEROID: '#8b4513',
|
|
68
|
+
// Brown for asteroids
|
|
69
|
+
ASTEROID_SHADOW: '#654321',
|
|
70
|
+
// Darker brown shadow
|
|
71
|
+
SCORE: '#ffd700',
|
|
72
|
+
// Gold for score
|
|
73
|
+
UI: '#9370db',
|
|
74
|
+
// Purple for UI elements
|
|
75
|
+
STARS: '#ffffff' // White for stars
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// Space Fighter Game Theme
|
|
79
|
+
export const SPACE_FIGHTER_THEME = {
|
|
80
|
+
backgroundColor: '#87CEEB',
|
|
81
|
+
// Sky blue
|
|
82
|
+
headerBackgroundColor: 'rgba(20, 83, 45, 0.8)',
|
|
83
|
+
// Green with transparency
|
|
84
|
+
headerTextColor: '#ffffff',
|
|
85
|
+
sectionBackgroundColor: 'rgba(255, 255, 255, 0.2)',
|
|
86
|
+
sectionTitleColor: '#1f2937',
|
|
87
|
+
// Dark gray
|
|
88
|
+
buttonSelectedColor: '#22c55e',
|
|
89
|
+
// Green
|
|
90
|
+
buttonUnselectedColor: 'rgba(255, 255, 255, 0.3)',
|
|
91
|
+
buttonSelectedTextColor: '#ffffff',
|
|
92
|
+
buttonUnselectedTextColor: '#1f2937',
|
|
93
|
+
switchTrackColorFalse: '#16a34a',
|
|
94
|
+
switchTrackColorTrue: '#22c55e',
|
|
95
|
+
switchThumbColor: '#fbbf24',
|
|
96
|
+
// Amber
|
|
97
|
+
infoTextColor: '#374151',
|
|
98
|
+
// Gray
|
|
99
|
+
resetButtonColor: '#ef4444',
|
|
100
|
+
// Red
|
|
101
|
+
resetButtonTextColor: '#ffffff'
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// Space Fighter Difficulty Descriptions
|
|
105
|
+
export const SPACE_FIGHTER_DIFFICULTY_DESCRIPTIONS = {
|
|
106
|
+
easy: '60 seconds, slow asteroids, relaxed gameplay',
|
|
107
|
+
medium: '120 seconds, normal asteroid speed, balanced challenge',
|
|
108
|
+
hard: '180 seconds, fast asteroids, quick reflexes needed!'
|
|
109
|
+
};
|
|
110
|
+
//# sourceMappingURL=SpaceFighterConstants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SPACE_FIGHTER_DIFFICULTY_CONFIG","easy","gameDuration","asteroidSpawnInterval","asteroidSpeed","medium","hard","getDifficultySettings","difficulty","DEFAULT_SPACE_FIGHTER_SETTINGS","soundEnabled","hapticEnabled","SPACE_FIGHTER_GAME_CONFIG","GAME_DURATION","SPACECRAFT_SIZE","SPACECRAFT_SPEED","ASTEROID_WIDTH","ASTEROID_GAP","ASTEROID_SPAWN_INTERVAL","ASTEROID_SPEED","GRAVITY","BOUNCE_DAMPING","FRICTION","MAX_VELOCITY","COLLISION_TOLERANCE","COLLISION_COOLDOWN","SPACE_FIGHTER_COLORS","BACKGROUND","SPACECRAFT","ASTEROID","ASTEROID_SHADOW","SCORE","UI","STARS","SPACE_FIGHTER_THEME","backgroundColor","headerBackgroundColor","headerTextColor","sectionBackgroundColor","sectionTitleColor","buttonSelectedColor","buttonUnselectedColor","buttonSelectedTextColor","buttonUnselectedTextColor","switchTrackColorFalse","switchTrackColorTrue","switchThumbColor","infoTextColor","resetButtonColor","resetButtonTextColor","SPACE_FIGHTER_DIFFICULTY_DESCRIPTIONS"],"sourceRoot":"../../../../src","sources":["games/space-fighter/SpaceFighterConstants.ts"],"mappings":";;AAEA;;AAUA;AACA,OAAO,MAAMA,+BAA+B,GAAG;EAC7CC,IAAI,EAAE;IACJC,YAAY,EAAE,EAAE;IAChBC,qBAAqB,EAAE,IAAI;IAAE;IAC7BC,aAAa,EAAE,GAAG,CAAE;EACtB,CAAC;EACDC,MAAM,EAAE;IACNH,YAAY,EAAE,EAAE;IAChBC,qBAAqB,EAAE,IAAI;IAAE;IAC7BC,aAAa,EAAE,CAAC,CAAE;EACpB,CAAC;EACDE,IAAI,EAAE;IACJJ,YAAY,EAAE,EAAE;IAChBC,qBAAqB,EAAE,IAAI;IAAE;IAC7BC,aAAa,EAAE,CAAC,CAAE;EACpB;AACF,CAAU;;AAEV;AACA,OAAO,MAAMG,qBAAqB,GAAIC,UAAsC,IAAK;EAC/E,OAAOR,+BAA+B,CAACQ,UAAU,CAAC;AACpD,CAAC;;AAED;AACA,OAAO,MAAMC,8BAAoD,GAAG;EAClED,UAAU,EAAE,QAAQ;EACpBE,YAAY,EAAE,IAAI;EAClBC,aAAa,EAAE,IAAI;EACnBT,YAAY,EAAEF,+BAA+B,CAACK,MAAM,CAACH,YAAY;EACjEC,qBAAqB,EAAEH,+BAA+B,CAACK,MAAM,CAACF,qBAAqB;EACnFC,aAAa,EAAEJ,+BAA+B,CAACK,MAAM,CAACD;AACxD,CAAC;;AAED;AACA,OAAO,MAAMQ,yBAAyB,GAAG;EACv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M,EAAE,wDAAwD;EAChEC,IAAI,EAAE;AACR,CAAU","ignoreList":[]}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { SPACE_FIGHTER_GAME_CONFIG as GAME_CONFIG, SPACE_FIGHTER_COLORS as COLORS } from "./SpaceFighterConstants.js";
|
|
4
4
|
|
|
5
|
-
// Constants now imported from
|
|
5
|
+
// Constants now imported from SpaceFighterConstants.ts
|
|
6
6
|
// Re-export for backward compatibility
|
|
7
7
|
export { GAME_CONFIG, COLORS };
|
|
8
8
|
|
|
9
9
|
// Asteroid Types (space obstacles)
|
|
10
10
|
|
|
11
11
|
// Game Service Class
|
|
12
|
-
class
|
|
12
|
+
class SpaceFighterGameService {
|
|
13
13
|
gameTimer = null;
|
|
14
14
|
asteroidSpawnTimer = null;
|
|
15
15
|
physicsTimer = null;
|
|
16
16
|
particles = [];
|
|
17
17
|
lastCollisionTime = 0;
|
|
18
|
+
currentAsteroidSpeed = GAME_CONFIG.ASTEROID_SPEED;
|
|
19
|
+
currentSpawnInterval = GAME_CONFIG.ASTEROID_SPAWN_INTERVAL;
|
|
18
20
|
constructor(screenWidth, screenHeight) {
|
|
19
21
|
this.width = screenWidth;
|
|
20
22
|
this.height = screenHeight;
|
|
@@ -45,16 +47,22 @@ class SpaceTravellerGameService {
|
|
|
45
47
|
startGameTimer(decrementTime) {
|
|
46
48
|
this.gameTimer = setInterval(decrementTime, 1000);
|
|
47
49
|
}
|
|
50
|
+
|
|
51
|
+
// Method to update difficulty settings
|
|
52
|
+
updateDifficultySettings(asteroidSpeed, spawnInterval) {
|
|
53
|
+
this.currentAsteroidSpeed = asteroidSpeed;
|
|
54
|
+
this.currentSpawnInterval = spawnInterval;
|
|
55
|
+
}
|
|
48
56
|
startAsteroidSpawning(spawnAsteroid) {
|
|
49
57
|
// Spawn first asteroid pair immediately
|
|
50
58
|
const initialAsteroids = this.generateAsteroidPair();
|
|
51
59
|
spawnAsteroid(initialAsteroids);
|
|
52
60
|
|
|
53
|
-
// Then continue spawning at regular intervals
|
|
61
|
+
// Then continue spawning at regular intervals using dynamic spawn interval
|
|
54
62
|
this.asteroidSpawnTimer = setInterval(() => {
|
|
55
63
|
const asteroids = this.generateAsteroidPair();
|
|
56
64
|
spawnAsteroid(asteroids);
|
|
57
|
-
},
|
|
65
|
+
}, this.currentSpawnInterval);
|
|
58
66
|
}
|
|
59
67
|
startPhysicsLoop(updateSpacecraft, updateAsteroid, removeAsteroid, getSpacecraft, getAsteroids) {
|
|
60
68
|
this.physicsTimer = setInterval(() => {
|
|
@@ -129,9 +137,9 @@ class SpaceTravellerGameService {
|
|
|
129
137
|
|
|
130
138
|
updateSpacecraft(newSpacecraft);
|
|
131
139
|
|
|
132
|
-
// Update asteroids - move vertically from top to bottom
|
|
140
|
+
// Update asteroids - move vertically from top to bottom using dynamic speed
|
|
133
141
|
asteroids.forEach(asteroid => {
|
|
134
|
-
const newY = asteroid.y +
|
|
142
|
+
const newY = asteroid.y + this.currentAsteroidSpeed;
|
|
135
143
|
if (newY > this.height) {
|
|
136
144
|
removeAsteroid(asteroid.id);
|
|
137
145
|
} else {
|
|
@@ -292,7 +300,7 @@ class SpaceTravellerGameService {
|
|
|
292
300
|
};
|
|
293
301
|
}
|
|
294
302
|
}
|
|
295
|
-
export const
|
|
296
|
-
return new
|
|
303
|
+
export const createSpaceFighterService = (width, height) => {
|
|
304
|
+
return new SpaceFighterGameService(width, height);
|
|
297
305
|
};
|
|
298
|
-
//# sourceMappingURL=
|
|
306
|
+
//# sourceMappingURL=SpaceFighterService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SPACE_FIGHTER_GAME_CONFIG","GAME_CONFIG","SPACE_FIGHTER_COLORS","COLORS","SpaceFighterGameService","gameTimer","asteroidSpawnTimer","physicsTimer","particles","lastCollisionTime","currentAsteroidSpeed","ASTEROID_SPEED","currentSpawnInterval","ASTEROID_SPAWN_INTERVAL","constructor","screenWidth","screenHeight","width","height","startGame","cleanup","clearInterval","startGameTimer","decrementTime","setInterval","updateDifficultySettings","asteroidSpeed","spawnInterval","startAsteroidSpawning","spawnAsteroid","initialAsteroids","generateAsteroidPair","asteroids","startPhysicsLoop","updateSpacecraft","updateAsteroid","removeAsteroid","getSpacecraft","getAsteroids","updatePhysics","pairId","Date","now","Math","random","minGapX","maxGapX","ASTEROID_GAP","gapX","leftAsteroid","id","x","y","ASTEROID_WIDTH","type","passed","spawnTime","rightAsteroid","spacecraft","newSpacecraft","velocityY","isControlled","velocityX","size","forEach","asteroid","newY","updateParticles","controlSpacecraft","targetX","_targetY","minX","maxX","constrainedX","max","min","releaseSpacecraft","checkCollision","currentTime","COLLISION_COOLDOWN","collision","spacecraftAsteroidCollision","asteroidId","spacecraftLeft","spacecraftRight","spacecraftTop","spacecraftBottom","asteroidLeft","asteroidRight","asteroidTop","asteroidBottom","checkAsteroidPass","passedAsteroids","push","createCollisionParticles","i","particle","color","SPACECRAFT","life","maxLife","bigParticle","filter","getParticles","isInCollisionImmunity","getRemainingImmunityTime","elapsed","getInitialSpacecraft","SPACECRAFT_SIZE","createSpaceFighterService"],"sourceRoot":"../../../../src","sources":["games/space-fighter/SpaceFighterService.ts"],"mappings":";;AAAA,SACEA,yBAAyB,IAAIC,WAAW,EACxCC,oBAAoB,IAAIC,MAAM,QACzB,4BAAyB;;AAEhC;AACA;AACA,SAASF,WAAW,EAAEE,MAAM;;AAE5B;;AAkCA;AACA,MAAMC,uBAAuB,CAAC;EAGpBC,SAAS,GAA0C,IAAI;EACvDC,kBAAkB,GAA0C,IAAI;EAChEC,YAAY,GAA0C,IAAI;EAC1DC,SAAS,GAAe,EAAE;EAC1BC,iBAAiB,GAAW,CAAC;EAC7BC,oBAAoB,GAAWT,WAAW,CAACU,cAAc;EACzDC,oBAAoB,GAAWX,WAAW,CAACY,uBAAuB;EAE1EC,WAAWA,CAACC,WAAmB,EAAEC,YAAoB,EAAE;IACrD,IA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