react-native-games 0.3.0 → 0.5.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 +134 -130
- package/lib/module/games/balloon-blaster/BalloonBlaster.js +116 -343
- package/lib/module/games/balloon-blaster/BalloonBlaster.js.map +1 -1
- package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js +182 -0
- package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js.map +1 -0
- package/lib/module/games/balloon-blaster/BalloonBlasterService.js +123 -101
- package/lib/module/games/balloon-blaster/BalloonBlasterService.js.map +1 -1
- package/lib/module/games/balloon-blaster/BalloonBlasterStore.js +119 -92
- package/lib/module/games/balloon-blaster/BalloonBlasterStore.js.map +1 -1
- package/lib/module/games/balloon-blaster/components/BalloonComponent.js +123 -113
- package/lib/module/games/balloon-blaster/components/BalloonComponent.js.map +1 -1
- package/lib/module/games/balloon-blaster/components/GameArea.js +137 -23
- 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/ScoreBoard.js +15 -22
- package/lib/module/games/balloon-blaster/components/ScoreBoard.js.map +1 -1
- package/lib/module/games/balloon-blaster/components/index.js +0 -4
- package/lib/module/games/balloon-blaster/components/index.js.map +1 -1
- package/lib/module/games/fruit-ninja/FruitNinja.js +143 -0
- package/lib/module/games/fruit-ninja/FruitNinja.js.map +1 -0
- package/lib/module/games/fruit-ninja/FruitNinjaConstants.js +148 -0
- package/lib/module/games/fruit-ninja/FruitNinjaConstants.js.map +1 -0
- package/lib/module/games/{fruit-slicer/FruitSlicerService.js → fruit-ninja/FruitNinjaService.js} +43 -21
- package/lib/module/games/fruit-ninja/FruitNinjaService.js.map +1 -0
- package/lib/module/games/fruit-ninja/FruitNinjaStore.js +191 -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 +215 -0
- package/lib/module/games/fruit-ninja/components/GameArea.js.map +1 -0
- package/lib/module/games/{fruit-slicer → fruit-ninja}/components/GameBackground.js +250 -304
- package/lib/module/games/fruit-ninja/components/GameBackground.js.map +1 -0
- package/lib/module/games/{fruit-slicer → fruit-ninja}/components/ScoreBoard.js +17 -47
- package/lib/module/games/fruit-ninja/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/fruit-ninja/components/index.js +7 -0
- package/lib/module/games/fruit-ninja/components/index.js.map +1 -0
- package/lib/module/games/maze-runner/MazeRunner.js +184 -169
- package/lib/module/games/maze-runner/MazeRunner.js.map +1 -1
- package/lib/module/games/maze-runner/MazeRunnerConstants.js +100 -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/EnhancedBallComponent.js +5 -4
- package/lib/module/games/maze-runner/components/EnhancedBallComponent.js.map +1 -1
- package/lib/module/games/maze-runner/components/EnhancedGameArea.js +20 -15
- 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 +15 -25
- package/lib/module/games/maze-runner/components/ScoreBoard.js.map +1 -1
- package/lib/module/games/maze-runner/components/WallComponent.js +3 -2
- package/lib/module/games/maze-runner/components/WallComponent.js.map +1 -1
- package/lib/module/games/maze-runner/components/index.js +0 -2
- package/lib/module/games/maze-runner/components/index.js.map +1 -1
- package/lib/module/games/popit-fidget/PopitFidget.js +294 -0
- package/lib/module/games/popit-fidget/PopitFidget.js.map +1 -0
- package/lib/module/games/popit-fidget/PopitFidgetConstants.js +113 -0
- package/lib/module/games/popit-fidget/PopitFidgetConstants.js.map +1 -0
- package/lib/module/games/popit-fidget/PopitFidgetService.js +132 -0
- package/lib/module/games/popit-fidget/PopitFidgetService.js.map +1 -0
- package/lib/module/games/popit-fidget/PopitFidgetStore.js +163 -0
- package/lib/module/games/popit-fidget/PopitFidgetStore.js.map +1 -0
- package/lib/module/games/popit-fidget/components/BubbleComponent.js +198 -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 +177 -0
- package/lib/module/games/popit-fidget/components/GameBackground.js.map +1 -0
- package/lib/module/games/popit-fidget/components/ScoreBoard.js +75 -0
- package/lib/module/games/popit-fidget/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/popit-fidget/components/index.js +7 -0
- package/lib/module/games/popit-fidget/components/index.js.map +1 -0
- package/lib/module/games/space-fighter/SpaceFighter.js +169 -0
- package/lib/module/games/space-fighter/SpaceFighter.js.map +1 -0
- package/lib/module/games/space-fighter/SpaceFighterConstants.js +108 -0
- package/lib/module/games/space-fighter/SpaceFighterConstants.js.map +1 -0
- package/lib/module/games/{space-traveller/SpaceTravellerService.js → space-fighter/SpaceFighterService.js} +48 -21
- package/lib/module/games/space-fighter/SpaceFighterService.js.map +1 -0
- package/lib/module/games/space-fighter/SpaceFighterStore.js +195 -0
- package/lib/module/games/space-fighter/SpaceFighterStore.js.map +1 -0
- package/lib/module/games/{space-traveller → space-fighter}/components/AsteroidComponent.js +7 -5
- package/lib/module/games/space-fighter/components/AsteroidComponent.js.map +1 -0
- package/lib/module/games/space-fighter/components/GameArea.js +295 -0
- package/lib/module/games/space-fighter/components/GameArea.js.map +1 -0
- package/lib/module/games/{space-traveller → space-fighter}/components/GameBackground.js +10 -65
- package/lib/module/games/space-fighter/components/GameBackground.js.map +1 -0
- package/lib/module/games/{space-traveller → space-fighter}/components/ScoreBoard.js +20 -26
- package/lib/module/games/space-fighter/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/{space-traveller → space-fighter}/components/Spacecraft3D.js +72 -111
- package/lib/module/games/space-fighter/components/Spacecraft3D.js.map +1 -0
- package/lib/module/games/space-fighter/components/SpacecraftPath.js +52 -0
- package/lib/module/games/space-fighter/components/SpacecraftPath.js.map +1 -0
- package/lib/module/games/{space-traveller → space-fighter}/components/index.js +0 -4
- package/lib/module/games/space-fighter/components/index.js.map +1 -0
- package/lib/module/games/whack-a-mole/WhackAMole.js +263 -0
- package/lib/module/games/whack-a-mole/WhackAMole.js.map +1 -0
- package/lib/module/games/whack-a-mole/WhackAMoleConstants.js +115 -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 +172 -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/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 +13 -17
- 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 -3
- 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 +41 -519
- package/lib/module/services/GamesConstants.js.map +1 -1
- package/lib/module/services/GamesService.js +35 -23
- 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/shared/helpers/AnimationFrame.js +120 -0
- package/lib/module/shared/helpers/AnimationFrame.js.map +1 -0
- package/lib/module/shared/helpers/AnimationTracker.js +89 -0
- package/lib/module/shared/helpers/AnimationTracker.js.map +1 -0
- package/lib/module/shared/helpers/ErrorHandler.js +269 -0
- package/lib/module/shared/helpers/ErrorHandler.js.map +1 -0
- package/lib/module/shared/helpers/GameControlButton.js +219 -0
- package/lib/module/shared/helpers/GameControlButton.js.map +1 -0
- package/lib/module/{games/balloon-blaster/components → shared/helpers}/GameOverModal.js +25 -17
- package/lib/module/shared/helpers/GameOverModal.js.map +1 -0
- package/lib/module/shared/helpers/GameSettingsModal.js +287 -0
- package/lib/module/shared/helpers/GameSettingsModal.js.map +1 -0
- package/lib/module/shared/helpers/ParticleBlast.js +133 -0
- package/lib/module/shared/helpers/ParticleBlast.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 +12 -0
- package/lib/module/shared/helpers/index.js.map +1 -0
- package/lib/typescript/src/games/balloon-blaster/BalloonBlaster.d.ts +2 -14
- package/lib/typescript/src/games/balloon-blaster/BalloonBlaster.d.ts.map +1 -1
- package/lib/typescript/src/games/balloon-blaster/BalloonBlasterConstants.d.ts +144 -0
- package/lib/typescript/src/games/balloon-blaster/BalloonBlasterConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/balloon-blaster/BalloonBlasterService.d.ts +1 -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 +1 -15
- 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/ScoreBoard.d.ts +1 -7
- 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 -4
- package/lib/typescript/src/games/balloon-blaster/components/index.d.ts.map +1 -1
- package/lib/typescript/src/games/fruit-ninja/FruitNinja.d.ts +4 -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} +13 -5
- 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} +13 -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-ninja/components/GameArea.d.ts +3 -0
- 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/ScoreBoard.d.ts +3 -0
- package/lib/typescript/src/games/fruit-ninja/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-ninja/components/index.d.ts +5 -0
- package/lib/typescript/src/games/fruit-ninja/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/maze-runner/MazeRunner.d.ts +2 -16
- 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/EnhancedBallComponent.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/WallComponent.d.ts.map +1 -1
- package/lib/typescript/src/games/maze-runner/components/index.d.ts +0 -2
- package/lib/typescript/src/games/maze-runner/components/index.d.ts.map +1 -1
- package/lib/typescript/src/games/popit-fidget/PopitFidget.d.ts +5 -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 +33 -0
- package/lib/typescript/src/games/popit-fidget/PopitFidgetService.d.ts.map +1 -0
- package/lib/typescript/src/games/popit-fidget/PopitFidgetStore.d.ts +36 -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/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 +5 -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 +4 -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-fighter/components/AsteroidComponent.d.ts +8 -0
- package/lib/typescript/src/games/space-fighter/components/AsteroidComponent.d.ts.map +1 -0
- package/lib/typescript/src/games/space-fighter/components/GameArea.d.ts +3 -0
- 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/ScoreBoard.d.ts +3 -0
- package/lib/typescript/src/games/space-fighter/components/ScoreBoard.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 -4
- package/lib/typescript/src/games/space-fighter/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/whack-a-mole/WhackAMole.d.ts +4 -0
- 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/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/whack-a-mole/components/index.d.ts +6 -0
- 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 +61 -340
- package/lib/typescript/src/services/GamesConstants.d.ts.map +1 -1
- package/lib/typescript/src/services/GamesService.d.ts +21 -3
- 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/AnimationFrame.d.ts +41 -0
- package/lib/typescript/src/shared/helpers/AnimationFrame.d.ts.map +1 -0
- package/lib/typescript/src/shared/helpers/AnimationTracker.d.ts +45 -0
- package/lib/typescript/src/shared/helpers/AnimationTracker.d.ts.map +1 -0
- package/lib/typescript/src/shared/helpers/ErrorHandler.d.ts +124 -0
- package/lib/typescript/src/shared/helpers/ErrorHandler.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/{games/cat-popper/components → shared/helpers}/GameOverModal.d.ts +5 -0
- package/lib/typescript/src/shared/helpers/GameOverModal.d.ts.map +1 -0
- package/lib/typescript/src/shared/helpers/GameSettingsModal.d.ts +9 -0
- package/lib/typescript/src/shared/helpers/GameSettingsModal.d.ts.map +1 -0
- package/lib/typescript/src/shared/helpers/ParticleBlast.d.ts +12 -0
- package/lib/typescript/src/shared/helpers/ParticleBlast.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 +13 -0
- package/lib/typescript/src/shared/helpers/index.d.ts.map +1 -0
- package/package.json +9 -6
- package/lib/module/games/balloon-blaster/components/GameControls.js +0 -229
- package/lib/module/games/balloon-blaster/components/GameControls.js.map +0 -1
- package/lib/module/games/balloon-blaster/components/GameOverModal.js.map +0 -1
- package/lib/module/games/balloon-blaster/components/ParticleSystem.js +0 -52
- package/lib/module/games/balloon-blaster/components/ParticleSystem.js.map +0 -1
- package/lib/module/games/balloon-blaster/components/SliceTrail.js +0 -58
- package/lib/module/games/balloon-blaster/components/SliceTrail.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 +0 -131
- 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 +0 -411
- 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 +0 -50
- 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 +0 -189
- package/lib/module/games/fruit-slicer/components/GameOverModal.js.map +0 -1
- package/lib/module/games/fruit-slicer/components/ParticleSystem.js +0 -52
- 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 +0 -58
- package/lib/module/games/fruit-slicer/components/SliceTrail.js.map +0 -1
- package/lib/module/games/fruit-slicer/components/index.js +0 -11
- 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/maze-runner/components/GameOverModal.js +0 -134
- package/lib/module/games/maze-runner/components/GameOverModal.js.map +0 -1
- package/lib/module/games/space-traveller/SpaceTraveller.js +0 -393
- 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 +0 -75
- 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 +0 -182
- package/lib/module/games/space-traveller/components/GameOverModal.js.map +0 -1
- package/lib/module/games/space-traveller/components/ParticleComponent.js +0 -34
- 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 +0 -222
- 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 +0 -37
- 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/module/shared/settings/GameSettings.js +0 -295
- package/lib/module/shared/settings/GameSettings.js.map +0 -1
- package/lib/module/shared/settings/SettingsService.js +0 -119
- package/lib/module/shared/settings/SettingsService.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/balloon-blaster/components/GameOverModal.d.ts +0 -9
- package/lib/typescript/src/games/balloon-blaster/components/GameOverModal.d.ts.map +0 -1
- package/lib/typescript/src/games/balloon-blaster/components/ParticleSystem.d.ts +0 -8
- package/lib/typescript/src/games/balloon-blaster/components/ParticleSystem.d.ts.map +0 -1
- package/lib/typescript/src/games/balloon-blaster/components/SliceTrail.d.ts +0 -11
- package/lib/typescript/src/games/balloon-blaster/components/SliceTrail.d.ts.map +0 -1
- package/lib/typescript/src/games/cat-popper/CatPopper.d.ts +0 -13
- 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 +0 -8
- 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 +0 -17
- 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/GameOverModal.d.ts +0 -9
- package/lib/typescript/src/games/fruit-slicer/components/GameOverModal.d.ts.map +0 -1
- package/lib/typescript/src/games/fruit-slicer/components/ParticleSystem.d.ts +0 -8
- 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 +0 -9
- 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 +0 -11
- 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 +0 -9
- 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/maze-runner/components/GameOverModal.d.ts +0 -11
- package/lib/typescript/src/games/maze-runner/components/GameOverModal.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 +0 -9
- 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 +0 -17
- 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 +0 -9
- 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 +0 -8
- 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 +0 -8
- 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 +0 -9
- 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/typescript/src/shared/settings/GameSettings.d.ts +0 -36
- package/lib/typescript/src/shared/settings/GameSettings.d.ts.map +0 -1
- package/lib/typescript/src/shared/settings/SettingsService.d.ts +0 -32
- package/lib/typescript/src/shared/settings/SettingsService.d.ts.map +0 -1
- /package/lib/typescript/src/games/{cat-popper → fruit-ninja}/components/GameBackground.d.ts +0 -0
- /package/lib/typescript/src/games/{fruit-slicer → space-fighter}/components/GameBackground.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/{cat-popper → whack-a-mole}/components/ScoreBoard.d.ts +0 -0
|
@@ -1,34 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { produce } from 'immer';
|
|
4
|
+
export const DEFAULT_GAME_SETTINGS = {
|
|
5
|
+
isVisible: false,
|
|
6
|
+
difficulty: 'medium',
|
|
7
|
+
enableSounds: true,
|
|
8
|
+
enableHaptics: true
|
|
9
|
+
};
|
|
10
|
+
export let GAME_IDS = /*#__PURE__*/function (GAME_IDS) {
|
|
11
|
+
GAME_IDS["WHACK_A_MOLE"] = "whack-a-mole";
|
|
12
|
+
GAME_IDS["POPIT_FIDGET"] = "popit-fidget";
|
|
13
|
+
GAME_IDS["FRUIT_NINJA"] = "fruit-ninja";
|
|
14
|
+
GAME_IDS["BALLOON_BLASTER"] = "balloon-blaster";
|
|
15
|
+
GAME_IDS["SPACE_FIGHTER"] = "space-fighter";
|
|
16
|
+
GAME_IDS["MAZE_RUNNER"] = "maze-runner";
|
|
17
|
+
return GAME_IDS;
|
|
18
|
+
}({});
|
|
19
|
+
;
|
|
3
20
|
export const gamesList = [{
|
|
4
|
-
id:
|
|
5
|
-
title: '
|
|
6
|
-
description: '
|
|
7
|
-
icon: 'hammer',
|
|
8
|
-
color: '#ff6b6b'
|
|
21
|
+
id: GAME_IDS.WHACK_A_MOLE,
|
|
22
|
+
title: 'Whack A Mole',
|
|
23
|
+
description: 'Whack cute cats popping from holes - fast reflexes needed!'
|
|
9
24
|
}, {
|
|
10
|
-
id:
|
|
11
|
-
title: '
|
|
12
|
-
description: '
|
|
13
|
-
icon: 'cut',
|
|
14
|
-
color: '#4ecdc4'
|
|
25
|
+
id: GAME_IDS.POPIT_FIDGET,
|
|
26
|
+
title: 'Popit Fidget',
|
|
27
|
+
description: 'Pop satisfying bubbles in this relaxing fidget toy game'
|
|
15
28
|
}, {
|
|
16
|
-
id:
|
|
29
|
+
id: GAME_IDS.FRUIT_NINJA,
|
|
30
|
+
title: 'Fruit Ninja',
|
|
31
|
+
description: 'Slice flying fruits with finger swipes - avoid the bombs!'
|
|
32
|
+
}, {
|
|
33
|
+
id: GAME_IDS.BALLOON_BLASTER,
|
|
17
34
|
title: 'Balloon Blaster',
|
|
18
|
-
description: 'Pop
|
|
19
|
-
icon: 'balloon',
|
|
20
|
-
color: '#ff9ff3'
|
|
35
|
+
description: 'Pop rising balloons before they escape - quick taps win!'
|
|
21
36
|
}, {
|
|
22
|
-
id:
|
|
23
|
-
title: 'Space
|
|
24
|
-
description: '
|
|
25
|
-
icon: 'rocket',
|
|
26
|
-
color: '#45b7d1'
|
|
37
|
+
id: GAME_IDS.SPACE_FIGHTER,
|
|
38
|
+
title: 'Space Fighter',
|
|
39
|
+
description: 'Pilot spaceship through asteroid fields in endless space'
|
|
27
40
|
}, {
|
|
28
|
-
id:
|
|
41
|
+
id: GAME_IDS.MAZE_RUNNER,
|
|
29
42
|
title: 'Maze Runner',
|
|
30
|
-
description: '
|
|
31
|
-
icon: 'trail-sign',
|
|
32
|
-
color: '#96ceb4'
|
|
43
|
+
description: 'Navigate ball through mazes using tilt and physics controls'
|
|
33
44
|
}];
|
|
45
|
+
export const immerMiddleware = config => (set, get, api) => config(fn => set(produce(fn)), get, api);
|
|
34
46
|
//# sourceMappingURL=GamesService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["gamesList","id","title","description","
|
|
1
|
+
{"version":3,"names":["produce","DEFAULT_GAME_SETTINGS","isVisible","difficulty","enableSounds","enableHaptics","GAME_IDS","gamesList","id","WHACK_A_MOLE","title","description","POPIT_FIDGET","FRUIT_NINJA","BALLOON_BLASTER","SPACE_FIGHTER","MAZE_RUNNER","immerMiddleware","config","set","get","api","fn"],"sourceRoot":"../../../src","sources":["services/GamesService.ts"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,OAAO;AAc/B,OAAO,MAAMC,qBAAmC,GAAG;EACjDC,SAAS,EAAE,KAAK;EAChBC,UAAU,EAAE,QAAQ;EACpBC,YAAY,EAAE,IAAI;EAClBC,aAAa,EAAE;AACjB,CAAC;AAED,WAAYC,QAAQ,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AAOnB;AAED,OAAO,MAAMC,SAAS,GAAG,CACvB;EACEC,EAAE,EAAEF,QAAQ,CAACG,YAAY;EACzBC,KAAK,EAAE,cAAc;EACrBC,WAAW,EAAE;AACf,CAAC,EACD;EACEH,EAAE,EAAEF,QAAQ,CAACM,YAAY;EACzBF,KAAK,EAAE,cAAc;EACrBC,WAAW,EAAE;AACf,CAAC,EACD;EACEH,EAAE,EAAEF,QAAQ,CAACO,WAAW;EACxBH,KAAK,EAAE,aAAa;EACpBC,WAAW,EAAE;AACf,CAAC,EACD;EACEH,EAAE,EAAEF,QAAQ,CAACQ,eAAe;EAC5BJ,KAAK,EAAE,iBAAiB;EACxBC,WAAW,EAAE;AACf,CAAC,EACD;EACEH,EAAE,EAAEF,QAAQ,CAACS,aAAa;EAC1BL,KAAK,EAAE,eAAe;EACtBC,WAAW,EAAE;AACf,CAAC,EACD;EACEH,EAAE,EAAEF,QAAQ,CAACU,WAAW;EACxBN,KAAK,EAAE,aAAa;EACpBC,WAAW,EAAE;AACf,CAAC,CACF;AAED,OAAO,MAAMM,eAAe,GAAIC,MAAW,IAAK,CAACC,GAAQ,EAAEC,GAAQ,EAAEC,GAAQ,KAAKH,MAAM,CAAEI,EAAO,IAAKH,GAAG,CAACnB,OAAO,CAACsB,EAAE,CAAC,CAAC,EAAEF,GAAG,EAAEC,GAAG,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as Haptics from 'expo-haptics';
|
|
4
|
+
export let HapticType = /*#__PURE__*/function (HapticType) {
|
|
5
|
+
HapticType["LIGHT"] = "light";
|
|
6
|
+
HapticType["MEDIUM"] = "medium";
|
|
7
|
+
HapticType["HEAVY"] = "heavy";
|
|
8
|
+
HapticType["SUCCESS"] = "success";
|
|
9
|
+
HapticType["WARNING"] = "warning";
|
|
10
|
+
HapticType["ERROR"] = "error";
|
|
11
|
+
HapticType["SELECTION"] = "selection";
|
|
12
|
+
return HapticType;
|
|
13
|
+
}({});
|
|
14
|
+
|
|
15
|
+
// Cache haptics availability to avoid repeated failed attempts
|
|
16
|
+
let hapticsDisabled = false;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Play haptic feedback with robust error handling
|
|
20
|
+
* @param type - Type of haptic feedback to play
|
|
21
|
+
* @param hapticEnabled - Whether haptic feedback is enabled in settings
|
|
22
|
+
*/
|
|
23
|
+
export const playHaptic = (type, hapticEnabled = false) => {
|
|
24
|
+
// Early return if haptics are disabled in settings or previously failed
|
|
25
|
+
if (!hapticEnabled || hapticsDisabled) return;
|
|
26
|
+
try {
|
|
27
|
+
switch (type) {
|
|
28
|
+
case HapticType.LIGHT:
|
|
29
|
+
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light).catch(error => {
|
|
30
|
+
console.warn('Light haptic failed:', error);
|
|
31
|
+
hapticsDisabled = true;
|
|
32
|
+
});
|
|
33
|
+
break;
|
|
34
|
+
case HapticType.MEDIUM:
|
|
35
|
+
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium).catch(error => {
|
|
36
|
+
console.warn('Medium haptic failed:', error);
|
|
37
|
+
hapticsDisabled = true;
|
|
38
|
+
});
|
|
39
|
+
break;
|
|
40
|
+
case HapticType.HEAVY:
|
|
41
|
+
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Heavy).catch(error => {
|
|
42
|
+
console.warn('Heavy haptic failed:', error);
|
|
43
|
+
hapticsDisabled = true;
|
|
44
|
+
});
|
|
45
|
+
break;
|
|
46
|
+
case HapticType.SUCCESS:
|
|
47
|
+
Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success).catch(error => {
|
|
48
|
+
console.warn('Success haptic failed:', error);
|
|
49
|
+
hapticsDisabled = true;
|
|
50
|
+
});
|
|
51
|
+
break;
|
|
52
|
+
case HapticType.WARNING:
|
|
53
|
+
Haptics.notificationAsync(Haptics.NotificationFeedbackType.Warning).catch(error => {
|
|
54
|
+
console.warn('Warning haptic failed:', error);
|
|
55
|
+
hapticsDisabled = true;
|
|
56
|
+
});
|
|
57
|
+
break;
|
|
58
|
+
case HapticType.ERROR:
|
|
59
|
+
Haptics.notificationAsync(Haptics.NotificationFeedbackType.Error).catch(error => {
|
|
60
|
+
console.warn('Error haptic failed:', error);
|
|
61
|
+
hapticsDisabled = true;
|
|
62
|
+
});
|
|
63
|
+
break;
|
|
64
|
+
case HapticType.SELECTION:
|
|
65
|
+
Haptics.selectionAsync().catch(error => {
|
|
66
|
+
console.warn('Selection haptic failed:', error);
|
|
67
|
+
hapticsDisabled = true;
|
|
68
|
+
});
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
} catch (error) {
|
|
72
|
+
// Synchronous error handling - disable haptics completely
|
|
73
|
+
console.warn('Haptic feedback failed, disabling haptics:', error);
|
|
74
|
+
hapticsDisabled = true;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=HapticsService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Haptics","HapticType","hapticsDisabled","playHaptic","type","hapticEnabled","LIGHT","impactAsync","ImpactFeedbackStyle","Light","catch","error","console","warn","MEDIUM","Medium","HEAVY","Heavy","SUCCESS","notificationAsync","NotificationFeedbackType","Success","WARNING","Warning","ERROR","Error","SELECTION","selectionAsync"],"sourceRoot":"../../../src","sources":["services/HapticsService.ts"],"mappings":";;AAAA,OAAO,KAAKA,OAAO,MAAM,cAAc;AAEvC,WAAYC,UAAU,0BAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA;;AAUtB;AACA,IAAIC,eAAe,GAAG,KAAK;;AAE3B;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,GAAGA,CAACC,IAAgB,EAAEC,aAAsB,GAAG,KAAK,KAAW;EACpF;EACA,IAAI,CAACA,aAAa,IAAIH,eAAe,EAAE;EAEvC,IAAI;IACF,QAAQE,IAAI;MACV,KAAKH,UAAU,CAACK,KAAK;QACnBN,OAAO,CAACO,WAAW,CAACP,OAAO,CAACQ,mBAAmB,CAACC,KAAK,CAAC,CAACC,KAAK,CAAEC,KAAK,IAAK;UACtEC,OAAO,CAACC,IAAI,CAAC,sBAAsB,EAAEF,KAAK,CAAC;UAC3CT,eAAe,GAAG,IAAI;QACxB,CAAC,CAAC;QACF;MACF,KAAKD,UAAU,CAACa,MAAM;QACpBd,OAAO,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C2B,cAAc,CAAC,CAAC,CAACjB,KAAK,CAAEC,KAAK,IAAK;UACxCC,OAAO,CAACC,IAAI,CAAC,0BAA0B,EAAEF,KAAK,CAAC;UAC/CT,eAAe,GAAG,IAAI;QACxB,CAAC,CAAC;QACF;IACJ;EACF,CAAC,CAAC,OAAOS,KAAK,EAAE;IACd;IACAC,OAAO,CAACC,IAAI,CAAC,4CAA4C,EAAEF,KAAK,CAAC;IACjET,eAAe,GAAG,IAAI;EACxB;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as Speech from 'expo-speech';
|
|
4
|
+
export const playSound = (soundConfig, soundEnabled) => {
|
|
5
|
+
if (!soundEnabled) return;
|
|
6
|
+
Speech.speak(soundConfig.text, {
|
|
7
|
+
pitch: soundConfig.pitch || 1.0,
|
|
8
|
+
rate: soundConfig.rate || 1.5,
|
|
9
|
+
language: soundConfig.language || 'en'
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
export const stopAllSounds = () => {
|
|
13
|
+
Speech.stop();
|
|
14
|
+
};
|
|
15
|
+
export const isSpeechAvailable = async () => {
|
|
16
|
+
try {
|
|
17
|
+
return await Speech.isSpeakingAsync();
|
|
18
|
+
} catch {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// Predefined sound configurations for common game events
|
|
24
|
+
export const GAME_SOUNDS = {
|
|
25
|
+
// Generic game sounds
|
|
26
|
+
POP: {
|
|
27
|
+
text: 'Pop!',
|
|
28
|
+
pitch: 1.6,
|
|
29
|
+
rate: 2.2
|
|
30
|
+
},
|
|
31
|
+
SWOOSH: {
|
|
32
|
+
text: 'Swoosh!',
|
|
33
|
+
pitch: 1.5,
|
|
34
|
+
rate: 2.5
|
|
35
|
+
},
|
|
36
|
+
BOOM: {
|
|
37
|
+
text: 'Boom!',
|
|
38
|
+
pitch: 0.8,
|
|
39
|
+
rate: 1.5
|
|
40
|
+
},
|
|
41
|
+
WHOOSH: {
|
|
42
|
+
text: 'Whoosh',
|
|
43
|
+
pitch: 0.7,
|
|
44
|
+
rate: 1.8
|
|
45
|
+
},
|
|
46
|
+
// Game state sounds - slower and more understandable
|
|
47
|
+
GAME_START: {
|
|
48
|
+
text: 'Game started!',
|
|
49
|
+
pitch: 1.1,
|
|
50
|
+
rate: 0.9
|
|
51
|
+
},
|
|
52
|
+
GAME_OVER: {
|
|
53
|
+
text: 'Game over!',
|
|
54
|
+
pitch: 0.9,
|
|
55
|
+
rate: 0.8
|
|
56
|
+
},
|
|
57
|
+
TIME_UP: {
|
|
58
|
+
text: 'Time up! Game over!',
|
|
59
|
+
pitch: 0.9,
|
|
60
|
+
rate: 0.8
|
|
61
|
+
},
|
|
62
|
+
WELL_DONE: {
|
|
63
|
+
text: 'Well done!',
|
|
64
|
+
pitch: 1.2,
|
|
65
|
+
rate: 1.0
|
|
66
|
+
},
|
|
67
|
+
CONGRATULATIONS: {
|
|
68
|
+
text: 'Congratulations!',
|
|
69
|
+
pitch: 1.1,
|
|
70
|
+
rate: 0.9
|
|
71
|
+
},
|
|
72
|
+
// Specific game sounds
|
|
73
|
+
BUBBLE_POPPER: {
|
|
74
|
+
START: {
|
|
75
|
+
text: 'Bubble Popper started!',
|
|
76
|
+
pitch: 1.1,
|
|
77
|
+
rate: 0.9
|
|
78
|
+
},
|
|
79
|
+
COMPLETE: {
|
|
80
|
+
text: 'All bubbles popped! Well done!',
|
|
81
|
+
pitch: 1.2,
|
|
82
|
+
rate: 1.0
|
|
83
|
+
},
|
|
84
|
+
POP: {
|
|
85
|
+
text: 'Pop!',
|
|
86
|
+
pitch: 1.6,
|
|
87
|
+
rate: 2.2
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
WHACK_A_MOLE: {
|
|
91
|
+
HIT: {
|
|
92
|
+
text: 'Pop!',
|
|
93
|
+
pitch: 1.8,
|
|
94
|
+
rate: 2.0
|
|
95
|
+
},
|
|
96
|
+
MISS: {
|
|
97
|
+
text: 'Whoosh',
|
|
98
|
+
pitch: 0.7,
|
|
99
|
+
rate: 1.8
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
BALLOON_BLASTER: {
|
|
103
|
+
POP: {
|
|
104
|
+
text: 'Pop!',
|
|
105
|
+
pitch: 1.5,
|
|
106
|
+
rate: 2.5
|
|
107
|
+
},
|
|
108
|
+
BOMB: {
|
|
109
|
+
text: 'Boom!',
|
|
110
|
+
pitch: 0.8,
|
|
111
|
+
rate: 1.5
|
|
112
|
+
},
|
|
113
|
+
BONUS: {
|
|
114
|
+
text: 'bonus life!',
|
|
115
|
+
pitch: 1.8,
|
|
116
|
+
rate: 2.0
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
FRUIT_NINJA: {
|
|
120
|
+
SLICE: {
|
|
121
|
+
text: 'Swoosh!',
|
|
122
|
+
pitch: 1.5,
|
|
123
|
+
rate: 2.5
|
|
124
|
+
},
|
|
125
|
+
BOMB: {
|
|
126
|
+
text: 'Boom!',
|
|
127
|
+
pitch: 0.8,
|
|
128
|
+
rate: 1.5
|
|
129
|
+
},
|
|
130
|
+
BONUS: {
|
|
131
|
+
text: 'bonus life!',
|
|
132
|
+
pitch: 1.8,
|
|
133
|
+
rate: 2.0
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
MAZE_RUNNER: {
|
|
137
|
+
START: {
|
|
138
|
+
text: 'Maze started! Navigate to the exit!',
|
|
139
|
+
pitch: 1.0,
|
|
140
|
+
rate: 0.9
|
|
141
|
+
},
|
|
142
|
+
COMPLETE: {
|
|
143
|
+
text: 'Congratulations! Maze completed!',
|
|
144
|
+
pitch: 1.1,
|
|
145
|
+
rate: 0.9
|
|
146
|
+
},
|
|
147
|
+
STOP: {
|
|
148
|
+
text: 'Maze stopped!',
|
|
149
|
+
pitch: 0.9,
|
|
150
|
+
rate: 0.8
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
SPACE_FIGHTER: {
|
|
154
|
+
START: {
|
|
155
|
+
text: 'Mission started! Navigate through the asteroid field!',
|
|
156
|
+
pitch: 1.0,
|
|
157
|
+
rate: 0.9
|
|
158
|
+
},
|
|
159
|
+
SUCCESS: {
|
|
160
|
+
text: 'Nice!',
|
|
161
|
+
pitch: 1.8,
|
|
162
|
+
rate: 2.0
|
|
163
|
+
},
|
|
164
|
+
COLLISION: {
|
|
165
|
+
text: 'Ouch!',
|
|
166
|
+
pitch: 0.8,
|
|
167
|
+
rate: 1.5
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
//# sourceMappingURL=SoundsService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Speech","playSound","soundConfig","soundEnabled","speak","text","pitch","rate","language","stopAllSounds","stop","isSpeechAvailable","isSpeakingAsync","GAME_SOUNDS","POP","SWOOSH","BOOM","WHOOSH","GAME_START","GAME_OVER","TIME_UP","WELL_DONE","CONGRATULATIONS","BUBBLE_POPPER","START","COMPLETE","WHACK_A_MOLE","HIT","MISS","BALLOON_BLASTER","BOMB","BONUS","FRUIT_NINJA","SLICE","MAZE_RUNNER","STOP","SPACE_FIGHTER","SUCCESS","COLLISION"],"sourceRoot":"../../../src","sources":["services/SoundsService.ts"],"mappings":";;AAAA,OAAO,KAAKA,MAAM,MAAM,aAAa;AASrC,OAAO,MAAMC,SAAS,GAAGA,CAACC,WAAwB,EAAEC,YAAqB,KAAW;EAClF,IAAI,CAACA,YAAY,EAAE;EAEnBH,MAAM,CAACI,KAAK,CAACF,WAAW,CAACG,IAAI,EAAE;IAC7BC,KAAK,EAAEJ,WAAW,CAACI,KAAK,IAAI,GAAG;IAC/BC,IAAI,EAAEL,WAAW,CAACK,IAAI,IAAI,GAAG;IAC7BC,QAAQ,EAAEN,WAAW,CAACM,QAAQ,IAAI;EACpC,CAAC,CAAC;AACJ,CAAC;AAED,OAAO,MAAMC,aAAa,GAAGA,CAAA,K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ACXV,KAAK,EAAE;MAAEnB,IAAI,EAAE,qCAAqC;MAAEC,KAAK,EAAE,GAAG;MAAEC,IAAI,EAAE;IAAI,CAAC;IAC7EkB,QAAQ,EAAE;MAAEpB,IAAI,EAAE,kCAAkC;MAAEC,KAAK,EAAE,GAAG;MAAEC,IAAI,EAAE;IAAI,CAAC;IAC7E4B,IAAI,EAAE;MAAE9B,IAAI,EAAE,eAAe;MAAEC,KAAK,EAAE,GAAG;MAAEC,IAAI,EAAE;IAAI;EACvD,CAAC;EAED6B,aAAa,EAAE;IACbZ,KAAK,EAAE;MAAEnB,IAAI,EAAE,uDAAuD;MAAEC,KAAK,EAAE,GAAG;MAAEC,IAAI,EAAE;IAAI,CAAC;IAC/F8B,OAAO,EAAE;MAAEhC,IAAI,EAAE,OAAO;MAAEC,KAAK,EAAE,GAAG;MAAEC,IAAI,EAAE;IAAI,CAAC;IACjD+B,SAAS,EAAE;MAAEjC,IAAI,EAAE,OAAO;MAAEC,KAAK,EAAE,GAAG;MAAEC,IAAI,EAAE;IAAI;EACpD;AACF,CAAU","ignoreList":[]}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef } from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Optimized animation frame utility for smooth game object cleanup and updates
|
|
7
|
+
* Uses requestAnimationFrame instead of setInterval for better performance
|
|
8
|
+
*/
|
|
9
|
+
export class AnimationFrameManager {
|
|
10
|
+
animationId = null;
|
|
11
|
+
isRunning = false;
|
|
12
|
+
lastTime = 0;
|
|
13
|
+
constructor(callback, interval = 100) {
|
|
14
|
+
this.callback = callback;
|
|
15
|
+
this.interval = interval;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Start the animation frame loop
|
|
20
|
+
*/
|
|
21
|
+
start() {
|
|
22
|
+
if (this.isRunning) return;
|
|
23
|
+
this.isRunning = true;
|
|
24
|
+
this.lastTime = performance.now();
|
|
25
|
+
this.loop();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Stop the animation frame loop
|
|
30
|
+
*/
|
|
31
|
+
stop() {
|
|
32
|
+
if (this.animationId) {
|
|
33
|
+
cancelAnimationFrame(this.animationId);
|
|
34
|
+
this.animationId = null;
|
|
35
|
+
}
|
|
36
|
+
this.isRunning = false;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Internal animation frame loop
|
|
41
|
+
*/
|
|
42
|
+
loop = () => {
|
|
43
|
+
if (!this.isRunning) return;
|
|
44
|
+
const currentTime = performance.now();
|
|
45
|
+
const deltaTime = currentTime - this.lastTime;
|
|
46
|
+
if (deltaTime >= this.interval) {
|
|
47
|
+
this.callback();
|
|
48
|
+
this.lastTime = currentTime;
|
|
49
|
+
}
|
|
50
|
+
this.animationId = requestAnimationFrame(this.loop);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Update the callback function
|
|
55
|
+
*/
|
|
56
|
+
updateCallback(callback) {
|
|
57
|
+
this.callback = callback;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Update the interval
|
|
62
|
+
*/
|
|
63
|
+
updateInterval(interval) {
|
|
64
|
+
this.interval = interval;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* React hook for using optimized animation frame cleanup
|
|
70
|
+
*/
|
|
71
|
+
export function useAnimationFrame(callback, interval = 100, dependencies = []) {
|
|
72
|
+
const managerRef = useRef(null);
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
// Create or update the manager
|
|
75
|
+
if (!managerRef.current) {
|
|
76
|
+
managerRef.current = new AnimationFrameManager(callback, interval);
|
|
77
|
+
} else {
|
|
78
|
+
managerRef.current.updateCallback(callback);
|
|
79
|
+
managerRef.current.updateInterval(interval);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Start the animation frame loop
|
|
83
|
+
managerRef.current.start();
|
|
84
|
+
|
|
85
|
+
// Cleanup on unmount or dependency change
|
|
86
|
+
return () => {
|
|
87
|
+
if (managerRef.current) {
|
|
88
|
+
managerRef.current.stop();
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}, dependencies);
|
|
92
|
+
|
|
93
|
+
// Cleanup on unmount
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
return () => {
|
|
96
|
+
if (managerRef.current) {
|
|
97
|
+
managerRef.current.stop();
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}, []);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* React hook for creating a reusable animation frame manager
|
|
105
|
+
*/
|
|
106
|
+
export function useAnimationFrameManager(interval = 100) {
|
|
107
|
+
const managerRef = useRef(null);
|
|
108
|
+
if (!managerRef.current) {
|
|
109
|
+
managerRef.current = new AnimationFrameManager(() => {}, interval);
|
|
110
|
+
}
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
return () => {
|
|
113
|
+
if (managerRef.current) {
|
|
114
|
+
managerRef.current.stop();
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}, []);
|
|
118
|
+
return managerRef.current;
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=AnimationFrame.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","AnimationFrameManager","animationId","isRunning","lastTime","constructor","callback","interval","start","performance","now","loop","stop","cancelAnimationFrame","currentTime","deltaTime","requestAnimationFrame","updateCallback","updateInterval","useAnimationFrame","dependencies","managerRef","current","useAnimationFrameManager"],"sourceRoot":"../../../../src","sources":["shared/helpers/AnimationFrame.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;;AAEzC;AACA;AACA;AACA;AACA,OAAO,MAAMC,qBAAqB,CAAC;EACzBC,WAAW,GAAkB,IAAI;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AE;QACtBD,UAAU,CAACC,OAAO,CAACV,IAAI,CAAC,CAAC;MAC3B;IACF,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOS,UAAU,CAACC,OAAO;AAC3B","ignoreList":[]}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useRef } from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Animation state interface for tracking game object animations
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Default animation state values
|
|
11
|
+
*/
|
|
12
|
+
export const DEFAULT_ANIMATION_STATE = {
|
|
13
|
+
scale: 1,
|
|
14
|
+
opacity: 1,
|
|
15
|
+
rotation: 0,
|
|
16
|
+
translateX: 0,
|
|
17
|
+
translateY: 0
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Animation tracker class for managing game object animations
|
|
22
|
+
* Extends Map to maintain compatibility with existing game services
|
|
23
|
+
*/
|
|
24
|
+
export class AnimationTracker extends Map {
|
|
25
|
+
constructor() {
|
|
26
|
+
super();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Override set to merge with default animation state
|
|
31
|
+
*/
|
|
32
|
+
set(id, state) {
|
|
33
|
+
const currentState = super.get(id) || {
|
|
34
|
+
...DEFAULT_ANIMATION_STATE
|
|
35
|
+
};
|
|
36
|
+
const newState = {
|
|
37
|
+
...currentState,
|
|
38
|
+
...state
|
|
39
|
+
};
|
|
40
|
+
super.set(id, newState);
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Initialize animation for object if it doesn't exist
|
|
46
|
+
*/
|
|
47
|
+
initialize(id, initialState) {
|
|
48
|
+
if (!this.has(id)) {
|
|
49
|
+
const state = {
|
|
50
|
+
...DEFAULT_ANIMATION_STATE,
|
|
51
|
+
...initialState
|
|
52
|
+
};
|
|
53
|
+
super.set(id, state);
|
|
54
|
+
return state;
|
|
55
|
+
}
|
|
56
|
+
return this.get(id);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Update multiple objects at once
|
|
61
|
+
*/
|
|
62
|
+
updateBatch(updates) {
|
|
63
|
+
updates.forEach(({
|
|
64
|
+
id,
|
|
65
|
+
state
|
|
66
|
+
}) => {
|
|
67
|
+
this.set(id, state);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* React hook for creating and managing animation trackers
|
|
74
|
+
*/
|
|
75
|
+
export function useAnimationTracker() {
|
|
76
|
+
return useRef(new AnimationTracker()).current;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* React hook for creating multiple animation trackers
|
|
81
|
+
*/
|
|
82
|
+
export function useAnimationTrackers(trackerNames) {
|
|
83
|
+
const trackers = useRef(trackerNames.reduce((acc, name) => {
|
|
84
|
+
acc[name] = new AnimationTracker();
|
|
85
|
+
return acc;
|
|
86
|
+
}, {})).current;
|
|
87
|
+
return trackers;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=AnimationTracker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useRef","DEFAULT_ANIMATION_STATE","scale","opacity","rotation","translateX","translateY","AnimationTracker","Map","constructor","set","id","state","currentState","get","newState","initialize","initialState","has","updateBatch","updates","forEach","useAnimationTracker","current","useAnimationTrackers","trackerNames","trackers","reduce","acc","name"],"sourceRoot":"../../../../src","sources":["shared/helpers/AnimationTracker.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,OAAO;;AAE9B;AACA;AACA;;AASA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuC,GAAG;EACrDC,KAAK,EAAE,CAAC;EACRC,OAAO,EAAE,CAAC;EACVC,QAAQ,EAAE,CAAC;EACXC,UAAU,EAAE,CAA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