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 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Canvas","Rect","LinearGradient","vec","Shadow","RoundedRect","jsx","_jsx","jsxs","_jsxs","WallComponent","walls","width","height","renderWall","wall","index","cornerRadius","shadowOffset","Fragment","children","x","y","r","start","end","type","colors","dx","dy","blur","color","Math","max","style","map"],"sourceRoot":"../../../../../src","sources":["games/maze-runner/components/WallComponent.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,MAAM,EAAEC,IAAI,EAAEC,cAAc,EAAEC,GAAG,EAAEC,MAAM,EAAEC,WAAW,QAAQ,4BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AASpG,OAAO,MAAMC,aAA2C,
|
|
1
|
+
{"version":3,"names":["React","Canvas","Rect","LinearGradient","vec","Shadow","RoundedRect","jsx","_jsx","jsxs","_jsxs","WallComponent","memo","walls","width","height","renderWall","wall","index","cornerRadius","shadowOffset","Fragment","children","x","y","r","start","end","type","colors","dx","dy","blur","color","Math","max","style","map"],"sourceRoot":"../../../../../src","sources":["games/maze-runner/components/WallComponent.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,MAAM,EAAEC,IAAI,EAAEC,cAAc,EAAEC,GAAG,EAAEC,MAAM,EAAEC,WAAW,QAAQ,4BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AASpG;AACA,OAAO,MAAMC,aAA2C,gBAAGX,KAAK,CAACY,IAAI,CAAC,CAAC;EAAEC,KAAK;EAAEC,KAAK;EAAEC;AAAO,CAAC,KAAK;EAClG;EACA,MAAMC,UAAU,GAAGA,CAACC,IAAU,EAAEC,KAAa,KAAK;IAChD,MAAMC,YAAY,GAAG,CAAC,CAAC,CAAC;IACxB,MAAMC,YAAY,GAAG,GAAG;IAExB,oBACEV,KAAA,CAACV,KAAK,CAACqB,QAAQ;MAAAC,QAAA,gBAEbZ,KAAA,CAACJ,WAAW;QACViB,CAAC,EAAEN,IAAI,CAACM,CAAE;QACVC,CAAC,EAAEP,IAAI,CAACO,CAAE;QACVV,KAAK,EAAEG,IAAI,CAACH,KAAM;QAClBC,MAAM,EAAEE,IAAI,CAACF,MAAO;QACpBU,CAAC,EAAEN,YAAa;QAAAG,QAAA,gBAEhBd,IAAA,CAACL,cAAc;UACbuB,KAAK,EAAEtB,GAAG,CAAC,CAAC,EAAE,CAAC,CAAE;UACjBuB,GAAG,EAAEV,IAAI,CAACW,IAAI,KAAK,YAAY,GAAGxB,GAAG,CAAC,CAAC,EAAEa,IAAI,CAACF,MAAM,CAAC,GAAGX,GAAG,CAACa,IAAI,CAACH,KAAK,EAAE,CAAC,CAAE;UAC3Ee,MAA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CAAE;QACVV,KAAK,EAAEG,IAAI,CAACH,KAAM;QAClBC,MAAM,EAAE,CAAE;QAAAO,QAAA,eAEVd,IAAA,CAACL,cAAc;UACbuB,KAAK,EAAEtB,GAAG,CAAC,CAAC,EAAE,CAAC,CAAE;UACjBuB,GAAG,EAAEvB,GAAG,CAACa,IAAI,CAACH,KAAK,EAAE,CAAC,CAAE;UACxBe,MAAM,EAAE,CAAC,0BAA0B,EAAE,0BAA0B;QAAE,CAClE;MAAC,CACE,CACP,EAGAZ,IAAI,CAACW,IAAI,KAAK,UAAU,iBACvBpB,IAAA,CAACN,IAAI;QACHqB,CAAC,EAAEN,IAAI,CAACM,CAAE;QACVC,CAAC,EAAEP,IAAI,CAACO,CAAE;QACVV,KAAK,EAAE,CAAE;QACTC,MAAM,EAAEE,IAAI,CAACF,MAAO;QAAAO,QAAA,eAEpBd,IAAA,CAACL,cAAc;UACbuB,KAAK,EAAEtB,GAAG,CAAC,CAAC,EAAE,CAAC,CAAE;UACjBuB,GAAG,EAAEvB,GAAG,CAAC,CAAC,EAAEa,IAAI,CAACF,MAAM,CAAE;UACzBc,MAAM,EAAE,CAAC,0BAA0B,EAAE,0BAA0B;QAAE,CAClE;MAAC,CACE,CACP;IAAA,GA9EkBX,KA+EL,CAAC;EAErB,CAAC;EAED,oBACEV,IAAA,CAACP,MAAM;IAACmC,KAAK,EAAE;MAAEtB,KAAK;MAAEC;IAAO,CAAE;IAAAO,QAAA,EAC9BT,KAAK,CAACwB,GAAG,CAAC,CAACpB,IAAI,EAAEC,KAAK,KAAKF,UAAU,CAACC,IAAI,EAAEC,KAAK,CAAC;EAAC,CAC9C,CAAC;AAEb,CAAC,CAAC","ignoreList":[]}
|
|
@@ -5,6 +5,4 @@ export { WallComponent } from "./WallComponent.js";
|
|
|
5
5
|
export { EnhancedGameArea } from "./EnhancedGameArea.js";
|
|
6
6
|
export { GameBackground } from "./GameBackground.js";
|
|
7
7
|
export { ScoreBoard } from "./ScoreBoard.js";
|
|
8
|
-
export { GameControls } from "./GameControls.js";
|
|
9
|
-
export { GameOverModal } from "./GameOverModal.js";
|
|
10
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["EnhancedBallComponent","WallComponent","EnhancedGameArea","GameBackground","ScoreBoard"
|
|
1
|
+
{"version":3,"names":["EnhancedBallComponent","WallComponent","EnhancedGameArea","GameBackground","ScoreBoard"],"sourceRoot":"../../../../../src","sources":["games/maze-runner/components/index.ts"],"mappings":";;AAAA,SAASA,qBAAqB,QAAQ,4BAAyB;AAC/D,SAASC,aAAa,QAAQ,oBAAiB;AAC/C,SAASC,gBAAgB,QAAQ,uBAAoB;AACrD,SAASC,cAAc,QAAQ,qBAAkB;AACjD,SAASC,UAAU,QAAQ,iBAAc","ignoreList":[]}
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useEffect, useRef, useCallback, useMemo } from 'react';
|
|
4
|
+
import { View, StyleSheet, Dimensions } from 'react-native';
|
|
5
|
+
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
6
|
+
import { usePopitFidgetStore } from "./PopitFidgetStore.js";
|
|
7
|
+
import { PopitFidgetService } from "./PopitFidgetService.js";
|
|
8
|
+
import { POPIT_FIDGET_GAME_CONFIG } from "./PopitFidgetConstants.js";
|
|
9
|
+
import { GAME_IDS } from "../../services/GamesService.js";
|
|
10
|
+
import { playSound, GAME_SOUNDS } from "../../services/SoundsService.js";
|
|
11
|
+
import { playHaptic, HapticType } from "../../services/HapticsService.js";
|
|
12
|
+
import { GameBackground, FidgetGrid as FidgetGridComponent, ScoreBoard } from "./components/index.js";
|
|
13
|
+
import { GameControlButton, GameOverModal } from "../../shared/helpers/index.js";
|
|
14
|
+
import { GameSettingsModal } from "../../shared/helpers/index.js";
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
const {
|
|
17
|
+
width,
|
|
18
|
+
height
|
|
19
|
+
} = Dimensions.get('window');
|
|
20
|
+
const PopitFidget = ({
|
|
21
|
+
settings,
|
|
22
|
+
onSettingsChange
|
|
23
|
+
}) => {
|
|
24
|
+
// Use selective subscriptions to prevent unnecessary re-renders
|
|
25
|
+
const fidgetGrid = usePopitFidgetStore(state => state.fidgetGrid);
|
|
26
|
+
const score = usePopitFidgetStore(state => state.score);
|
|
27
|
+
const timeLeft = usePopitFidgetStore(state => state.timeLeft);
|
|
28
|
+
const isPlaying = usePopitFidgetStore(state => state.isPlaying);
|
|
29
|
+
const gameOver = usePopitFidgetStore(state => state.gameOver);
|
|
30
|
+
const gameWon = usePopitFidgetStore(state => state.gameWon);
|
|
31
|
+
|
|
32
|
+
// Get store actions (these don't cause re-renders)
|
|
33
|
+
const startGame = usePopitFidgetStore(state => state.startGame);
|
|
34
|
+
const stopGame = usePopitFidgetStore(state => state.stopGame);
|
|
35
|
+
const resetGame = usePopitFidgetStore(state => state.resetGame);
|
|
36
|
+
const setFidgetGrid = usePopitFidgetStore(state => state.setFidgetGrid);
|
|
37
|
+
const popBubble = usePopitFidgetStore(state => state.popBubble);
|
|
38
|
+
const setTimeLeft = usePopitFidgetStore(state => state.setTimeLeft);
|
|
39
|
+
const serviceRef = useRef(null);
|
|
40
|
+
|
|
41
|
+
// Use settings from props
|
|
42
|
+
const {
|
|
43
|
+
difficulty,
|
|
44
|
+
enableSounds,
|
|
45
|
+
enableHaptics
|
|
46
|
+
} = settings;
|
|
47
|
+
|
|
48
|
+
// Initialize service and generate initial fidget grid
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (!serviceRef.current) {
|
|
51
|
+
serviceRef.current = new PopitFidgetService();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Generate initial fidget grid so it shows before game starts
|
|
55
|
+
if (serviceRef.current && !fidgetGrid) {
|
|
56
|
+
const grid = serviceRef.current.generateFidgetGrid(difficulty);
|
|
57
|
+
setFidgetGrid(grid);
|
|
58
|
+
}
|
|
59
|
+
}, [fidgetGrid, setFidgetGrid, difficulty]);
|
|
60
|
+
|
|
61
|
+
// Unmount-only cleanup to fully reset without causing state update loops
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
return () => {
|
|
64
|
+
// Stop timers and reset store, but do NOT generate a new grid on unmount
|
|
65
|
+
try {
|
|
66
|
+
serviceRef.current?.stopGameTimer();
|
|
67
|
+
} catch {}
|
|
68
|
+
try {
|
|
69
|
+
resetGame();
|
|
70
|
+
} catch {}
|
|
71
|
+
try {
|
|
72
|
+
serviceRef.current?.cleanup();
|
|
73
|
+
} catch {}
|
|
74
|
+
};
|
|
75
|
+
}, []);
|
|
76
|
+
|
|
77
|
+
// Memoize service to prevent recreation
|
|
78
|
+
const service = useMemo(() => {
|
|
79
|
+
if (!serviceRef.current) {
|
|
80
|
+
serviceRef.current = new PopitFidgetService();
|
|
81
|
+
}
|
|
82
|
+
return serviceRef.current;
|
|
83
|
+
}, []);
|
|
84
|
+
|
|
85
|
+
// Generate new fidget grid (simplified - always square based on difficulty)
|
|
86
|
+
const generateNewFidget = useCallback(() => {
|
|
87
|
+
const grid = service.generateFidgetGrid(difficulty);
|
|
88
|
+
setFidgetGrid(grid);
|
|
89
|
+
}, [service, setFidgetGrid, difficulty]);
|
|
90
|
+
|
|
91
|
+
// Track previous difficulty to avoid infinite loops
|
|
92
|
+
const prevDifficultyRef = React.useRef(difficulty);
|
|
93
|
+
|
|
94
|
+
// Watch for difficulty changes and regenerate grid when difficulty changes
|
|
95
|
+
const handleDifficultyChange = useCallback(() => {
|
|
96
|
+
// Only regenerate if difficulty actually changed
|
|
97
|
+
if (prevDifficultyRef.current !== difficulty) {
|
|
98
|
+
if (!isPlaying) {
|
|
99
|
+
// Game not playing - just regenerate grid
|
|
100
|
+
generateNewFidget();
|
|
101
|
+
} else {
|
|
102
|
+
// Game is playing - restart with new difficulty duration
|
|
103
|
+
const newDuration = POPIT_FIDGET_GAME_CONFIG.GAME_DURATION;
|
|
104
|
+
|
|
105
|
+
// Stop current timer
|
|
106
|
+
service.stopGameTimer();
|
|
107
|
+
|
|
108
|
+
// Start new timer with new duration
|
|
109
|
+
service.startGameTimer(newDuration, timeLeft => setTimeLeft(timeLeft), () => stopGame());
|
|
110
|
+
|
|
111
|
+
// Update store with new duration
|
|
112
|
+
setTimeLeft(newDuration);
|
|
113
|
+
}
|
|
114
|
+
prevDifficultyRef.current = difficulty;
|
|
115
|
+
}
|
|
116
|
+
}, [difficulty, isPlaying, generateNewFidget, service, setTimeLeft, stopGame]);
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
handleDifficultyChange();
|
|
119
|
+
}, [handleDifficultyChange]);
|
|
120
|
+
|
|
121
|
+
// Watch for game completion events and play appropriate sounds
|
|
122
|
+
React.useEffect(() => {
|
|
123
|
+
if (gameOver && !isPlaying) {
|
|
124
|
+
if (gameWon) {
|
|
125
|
+
// All bubbles popped - game completed successfully
|
|
126
|
+
playSound(GAME_SOUNDS.BUBBLE_POPPER.COMPLETE, enableSounds);
|
|
127
|
+
} else {
|
|
128
|
+
// Time ran out - game over
|
|
129
|
+
playSound(GAME_SOUNDS.TIME_UP, enableSounds);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}, [gameOver, gameWon, isPlaying, enableSounds]);
|
|
133
|
+
|
|
134
|
+
// Timer effect - handles countdown when game is playing
|
|
135
|
+
useEffect(() => {
|
|
136
|
+
let timerInterval = null;
|
|
137
|
+
if (isPlaying && timeLeft > 0) {
|
|
138
|
+
timerInterval = setInterval(() => {
|
|
139
|
+
const newTime = timeLeft - 1;
|
|
140
|
+
if (newTime <= 0) {
|
|
141
|
+
// Time's up - stop the game
|
|
142
|
+
setTimeLeft(0);
|
|
143
|
+
stopGame();
|
|
144
|
+
} else {
|
|
145
|
+
setTimeLeft(newTime);
|
|
146
|
+
}
|
|
147
|
+
}, 1000);
|
|
148
|
+
}
|
|
149
|
+
return () => {
|
|
150
|
+
if (timerInterval) {
|
|
151
|
+
clearInterval(timerInterval);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
}, [isPlaying, timeLeft, setTimeLeft, stopGame]);
|
|
155
|
+
|
|
156
|
+
// Start game
|
|
157
|
+
const startGameHandler = useCallback(() => {
|
|
158
|
+
// Always generate new fidget when starting a new game
|
|
159
|
+
generateNewFidget();
|
|
160
|
+
|
|
161
|
+
// Play game start sound
|
|
162
|
+
playSound(GAME_SOUNDS.BUBBLE_POPPER.START, enableSounds);
|
|
163
|
+
|
|
164
|
+
// Store uses fixed 60s duration internally
|
|
165
|
+
startGame();
|
|
166
|
+
|
|
167
|
+
// Haptic feedback
|
|
168
|
+
playHaptic(HapticType.MEDIUM, enableHaptics);
|
|
169
|
+
}, [startGame, enableSounds, enableHaptics, generateNewFidget]);
|
|
170
|
+
|
|
171
|
+
// Stop game - simply reset the game state without showing game over popup
|
|
172
|
+
const stopGameHandler = useCallback(() => {
|
|
173
|
+
service.stopGameTimer();
|
|
174
|
+
resetGame();
|
|
175
|
+
generateNewFidget();
|
|
176
|
+
}, [service, resetGame, generateNewFidget]);
|
|
177
|
+
|
|
178
|
+
// Reset game
|
|
179
|
+
const resetGameHandler = useCallback(() => {
|
|
180
|
+
service.stopGameTimer();
|
|
181
|
+
resetGame();
|
|
182
|
+
generateNewFidget();
|
|
183
|
+
}, [service, resetGame, generateNewFidget]);
|
|
184
|
+
|
|
185
|
+
// Handle bubble pop with stable callback reference
|
|
186
|
+
const handleBubblePop = useCallback((row, col) => {
|
|
187
|
+
if (!fidgetGrid) return;
|
|
188
|
+
const bubble = fidgetGrid.bubbles[row]?.[col];
|
|
189
|
+
if (!bubble || bubble.isPopped) return;
|
|
190
|
+
|
|
191
|
+
// Play pop sound
|
|
192
|
+
playSound(GAME_SOUNDS.BUBBLE_POPPER.POP, enableSounds);
|
|
193
|
+
|
|
194
|
+
// Pop the bubble in store
|
|
195
|
+
popBubble(row, col);
|
|
196
|
+
|
|
197
|
+
// Haptic feedback
|
|
198
|
+
playHaptic(HapticType.LIGHT, enableHaptics);
|
|
199
|
+
|
|
200
|
+
// Completion percentage is already calculated efficiently in the store
|
|
201
|
+
}, [fidgetGrid, popBubble, enableSounds, enableHaptics]);
|
|
202
|
+
|
|
203
|
+
// Memoize screen dimensions to prevent recalculation
|
|
204
|
+
const screenDimensions = useMemo(() => ({
|
|
205
|
+
width,
|
|
206
|
+
height
|
|
207
|
+
}), []);
|
|
208
|
+
|
|
209
|
+
// Calculate bubble size based on grid - made bigger for Pop It appearance
|
|
210
|
+
const bubbleSize = useMemo(() => {
|
|
211
|
+
if (!fidgetGrid) return 60;
|
|
212
|
+
const availableWidth = screenDimensions.width * 0.85;
|
|
213
|
+
const availableHeight = screenDimensions.height * 0.6;
|
|
214
|
+
const maxSize = Math.min(availableWidth / fidgetGrid.size, availableHeight / fidgetGrid.size);
|
|
215
|
+
// Increased minimum and maximum sizes for bigger, more prominent bubbles
|
|
216
|
+
return Math.max(45, Math.min(80, maxSize * 0.9));
|
|
217
|
+
}, [fidgetGrid, screenDimensions]);
|
|
218
|
+
|
|
219
|
+
// Memoize game control button props to prevent unnecessary re-renders
|
|
220
|
+
const gameControlButtonProps = useMemo(() => ({
|
|
221
|
+
isPlaying,
|
|
222
|
+
gameOver,
|
|
223
|
+
onStartGame: startGameHandler,
|
|
224
|
+
onStopGame: stopGameHandler,
|
|
225
|
+
startButtonText: "START POPPING",
|
|
226
|
+
stopButtonText: "STOP GAME",
|
|
227
|
+
startButtonSubtext: "Pop bubbles to relax!",
|
|
228
|
+
stopButtonSubtext: "End current game",
|
|
229
|
+
startButtonColor: "#9c27b0",
|
|
230
|
+
stopButtonColor: "#dc2626",
|
|
231
|
+
startButtonBorderColor: "#ce93d8",
|
|
232
|
+
stopButtonBorderColor: "#f87171"
|
|
233
|
+
}), [isPlaying, gameOver, startGameHandler, stopGameHandler]);
|
|
234
|
+
|
|
235
|
+
// Memoize game over modal props to prevent unnecessary re-renders
|
|
236
|
+
const gameOverModalProps = useMemo(() => ({
|
|
237
|
+
isVisible: gameOver,
|
|
238
|
+
score,
|
|
239
|
+
onPlayAgain: resetGameHandler,
|
|
240
|
+
buttonText: "Pop Again!",
|
|
241
|
+
primaryColor: "rgba(108, 92, 231, 0.85)",
|
|
242
|
+
borderColor: "rgba(108, 92, 231, 0.95)",
|
|
243
|
+
buttonColor: "#9c27b0",
|
|
244
|
+
buttonBorderColor: "#ce93d8"
|
|
245
|
+
}), [gameOver, score, resetGameHandler]);
|
|
246
|
+
return /*#__PURE__*/_jsx(GestureHandlerRootView, {
|
|
247
|
+
style: styles.container,
|
|
248
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
249
|
+
style: styles.gameContainer,
|
|
250
|
+
children: [/*#__PURE__*/_jsx(GameBackground, {
|
|
251
|
+
width: screenDimensions.width,
|
|
252
|
+
height: screenDimensions.height,
|
|
253
|
+
isPlaying: isPlaying
|
|
254
|
+
}), /*#__PURE__*/_jsx(ScoreBoard, {
|
|
255
|
+
score: score,
|
|
256
|
+
timeLeft: timeLeft
|
|
257
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
258
|
+
style: styles.gameArea,
|
|
259
|
+
children: fidgetGrid && /*#__PURE__*/_jsx(FidgetGridComponent, {
|
|
260
|
+
grid: fidgetGrid,
|
|
261
|
+
bubbleSize: bubbleSize,
|
|
262
|
+
onBubblePop: handleBubblePop,
|
|
263
|
+
hapticEnabled: enableHaptics,
|
|
264
|
+
isPlaying: isPlaying
|
|
265
|
+
})
|
|
266
|
+
}), /*#__PURE__*/_jsx(GameControlButton, {
|
|
267
|
+
...gameControlButtonProps
|
|
268
|
+
}), /*#__PURE__*/_jsx(GameOverModal, {
|
|
269
|
+
...gameOverModalProps
|
|
270
|
+
}), /*#__PURE__*/_jsx(GameSettingsModal, {
|
|
271
|
+
gameId: GAME_IDS.POPIT_FIDGET,
|
|
272
|
+
settings: settings,
|
|
273
|
+
onSettingsChange: onSettingsChange
|
|
274
|
+
})]
|
|
275
|
+
})
|
|
276
|
+
});
|
|
277
|
+
};
|
|
278
|
+
const styles = StyleSheet.create({
|
|
279
|
+
container: {
|
|
280
|
+
flex: 1
|
|
281
|
+
},
|
|
282
|
+
gameContainer: {
|
|
283
|
+
flex: 1,
|
|
284
|
+
backgroundColor: '#fef7ff' // Very light lavender to complement rainbow theme
|
|
285
|
+
},
|
|
286
|
+
gameArea: {
|
|
287
|
+
flex: 1,
|
|
288
|
+
justifyContent: 'center',
|
|
289
|
+
alignItems: 'center',
|
|
290
|
+
paddingHorizontal: 20
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
export { PopitFidget };
|
|
294
|
+
//# sourceMappingURL=PopitFidget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useEffect","useRef","useCallback","useMemo","View","StyleSheet","Dimensions","GestureHandlerRootView","usePopitFidgetStore","PopitFidgetService","POPIT_FIDGET_GAME_CONFIG","GAME_IDS","playSound","GAME_SOUNDS","playHaptic","HapticType","GameBackground","FidgetGrid","FidgetGridComponent","ScoreBoard","GameControlButton","GameOverModal","GameSettingsModal","jsx","_jsx","jsxs","_jsxs","width","height","get","PopitFidget","settings","onSettingsChange","fidgetGrid","state","score","timeLeft","isPlaying","gameOver","gameWon","startGame","stopGame","resetGame","setFidgetGrid","popBubble","setTimeLeft","serviceRef","difficulty","enableSounds","enableHaptics","current","grid","generateFidgetGrid","stopGameTimer","cleanup","service","generateNewFidget","prevDifficultyRef","handleDifficultyChange","newDuration","GAME_DURATION","startGameTimer","BUBBLE_POPPER","COMPLETE","TIME_UP","timerInterval","setInterval","newTime","clearInterval","startGameHandler","START","MEDIUM","stopGameHandler","resetGameHandler","handleBubblePop","row","col","bubble","bubbles","isPopped","POP","LIGHT","screenDimensions","bubbleSize","availableWidth","availableHeight","maxSize","Math","min","size","max","gameControlButtonProps","onStartGame","onStopGame","startButtonText","stopButtonText","startButtonSubtext","stopButtonSubtext","startButtonColor","stopButtonColor","startButtonBorderColor","stopButtonBorderColor","gameOverModalProps","isVisible","onPlayAgain","buttonText","primaryColor","borderColor","buttonColor","buttonBorderColor","style","styles","container","children","gameContainer","gameArea","onBubblePop","hapticEnabled","gameId","POPIT_FIDGET","create","flex","backgroundColor","justifyContent","alignItems","paddingHorizontal"],"sourceRoot":"../../../../src","sources":["games/popit-fidget/PopitFidget.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,EAAEC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AACtE,SAASC,IAAI,EAAEC,UAAU,EAAEC,UAAU,QAAQ,cAAc;AAC3D,SAASC,sBAAsB,QAAQ,8BAA8B;AACrE,SAASC,mBAAmB,QAA+B,uBAAoB;AAC/E,SAASC,kBAAkB,QAAQ,yBAAsB;AACzD,SAASC,wBAAwB,QAAQ,2BAAwB;AACjE,SAASC,QAAQ,QAAwB,gCAA6B;AACtE,SAASC,SAAS,EAAEC,WAAW,QAAQ,iCAA8B;AACrE,SAASC,UAAU,EAAEC,UAAU,QAAQ,kCAA+B;AACtE,SACEC,cAAc,EACdC,UAAU,IAAIC,mBAAmB,EACjCC,UAAU,QACL,uBAAc;AACrB,SAASC,iBAAiB,EAAEC,aAAa,QAAQ,+BAAsB;AACvE,SAASC,iBAAiB,QAAQ,+BAAsB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEzD,MAAM;EAAEC,KAAK;EAAEC;AAAO,CAAC,GAAGtB,UAAU,CAACuB,GAAG,CAAC,QAAQ,CAAC;AAElD,MAAMC,WAAgC,GAAGA,CAAC;EACxCC,QAAQ;EACRC;AACF,CAAC,KAAK;EACJ;EACA,MAAMC,UAAU,GAAGzB,mBAAmB,CAAE0B,KAAuB,IAAKA,KAAK,CAACD,UAAU,CAAC;EACrF,MAAME,KAAK,GAAG3B,mBAAmB,CAAE0B,KAAuB,IAAKA,KAAK,CAACC,KAAK,CAAC;EAC3E,MAAMC,QAAQ,GAAG5B,mBAAmB,CAAE0B,KAAuB,IAAKA,K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AAA,GACZuE;MAAsB,CAC3B,CAAC,eAGFnE,IAAA,CAACH,aAAa;QAAA,GACRiF;MAAkB,CACvB,CAAC,eAGF9E,IAAA,CAACF,iBAAiB;QAChBgG,MAAM,EAAE3G,QAAQ,CAAC4G,YAAa;QAC9BxF,QAAQ,EAAEA,QAAS;QACnBC,gBAAgB,EAAEA;MAAiB,CACpC,CAAC;IAAA,CACE;EAAC,CACe,CAAC;AAE7B,CAAC;AAED,MAAM+E,MAAM,GAAG1G,UAAU,CAACmH,MAAM,CAAC;EAC/BR,SAAS,EAAE;IACTS,IAAI,EAAE;EACR,CAAC;EACDP,aAAa,EAAE;IACbO,IAAI,EAAE,CAAC;IACPC,eAAe,EAAE,SAAS,CAAE;EAC9B,CAAC;EACDP,QAAQ,EAAE;IACRM,IAAI,EAAE,CAAC;IACPE,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,QAAQ;IACpBC,iBAAiB,EAAE;EACrB;AACF,CAAC,CAAC;AAEF,SAAS/F,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Popit Fidget Game Constants
|
|
4
|
+
export const POPIT_FIDGET_GAME_CONFIG = {
|
|
5
|
+
GAME_DURATION: 120,
|
|
6
|
+
// seconds
|
|
7
|
+
POINTS_PER_BUBBLE: 10,
|
|
8
|
+
COMPLETION_BONUS: 500,
|
|
9
|
+
TIME_BONUS_MULTIPLIER: 5,
|
|
10
|
+
BUBBLE_SIZE: 40,
|
|
11
|
+
ANIMATION_DURATION: 300,
|
|
12
|
+
PARTICLE_COUNT: 4,
|
|
13
|
+
// Reduced for better performance
|
|
14
|
+
PARTICLE_LIFETIME: 800,
|
|
15
|
+
// Difficulty-based square grid sizes
|
|
16
|
+
GRID_SIZES: {
|
|
17
|
+
easy: 5,
|
|
18
|
+
// 5x5 = 25 bubbles
|
|
19
|
+
medium: 6,
|
|
20
|
+
// 6x6 = 36 bubbles
|
|
21
|
+
hard: 7 // 7x7 = 49 bubbles
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
export const POPIT_FIDGET_ANIMATION_CONFIG = {
|
|
25
|
+
POP_SCALE: 1.3,
|
|
26
|
+
POP_DURATION: 200,
|
|
27
|
+
FADE_DURATION: 300,
|
|
28
|
+
BOUNCE_SCALE: 0.9,
|
|
29
|
+
PARTICLE_VELOCITY: 3,
|
|
30
|
+
PARTICLE_GRAVITY: 0.2
|
|
31
|
+
};
|
|
32
|
+
export const POPIT_FIDGET_COLORS = {
|
|
33
|
+
BACKGROUND: '#f5f5f5',
|
|
34
|
+
// Light gray background
|
|
35
|
+
FIDGET_BORDER: '#333',
|
|
36
|
+
FIDGET_SHADOW: 'rgba(0,0,0,0.3)',
|
|
37
|
+
SCORE: '#4a90e2',
|
|
38
|
+
UI: '#6c5ce7',
|
|
39
|
+
POPPED_BUBBLE: '#d0d0d0',
|
|
40
|
+
PARTICLE_GLOW: 'rgba(255,255,255,0.9)',
|
|
41
|
+
// Pop It fidget toy colors - rainbow gradient
|
|
42
|
+
FIDGET_BASE: '#ffffff',
|
|
43
|
+
BUBBLE_SHADOW: 'rgba(0,0,0,0.2)',
|
|
44
|
+
BUBBLE_HIGHLIGHT: 'rgba(255,255,255,0.6)'
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// Rainbow gradient colors for authentic Pop It fidget toy look - enhanced vibrancy
|
|
48
|
+
export const RAINBOW_COLORS = ['#E91E63',
|
|
49
|
+
// Vibrant pink/magenta (like image)
|
|
50
|
+
'#F44336',
|
|
51
|
+
// Bright red
|
|
52
|
+
'#FF5722',
|
|
53
|
+
// Deep orange
|
|
54
|
+
'#FF9800',
|
|
55
|
+
// Orange
|
|
56
|
+
'#FFC107',
|
|
57
|
+
// Amber/yellow
|
|
58
|
+
'#8E24AA',
|
|
59
|
+
// Deep purple
|
|
60
|
+
'#CDDC39',
|
|
61
|
+
// Lime
|
|
62
|
+
'#8BC34A',
|
|
63
|
+
// Light green
|
|
64
|
+
'#4CAF50',
|
|
65
|
+
// Green
|
|
66
|
+
'#009688',
|
|
67
|
+
// Teal
|
|
68
|
+
'#00BCD4',
|
|
69
|
+
// Cyan
|
|
70
|
+
'#03A9F4',
|
|
71
|
+
// Light blue
|
|
72
|
+
'#2196F3',
|
|
73
|
+
// Blue
|
|
74
|
+
'#3F51B5',
|
|
75
|
+
// Indigo
|
|
76
|
+
'#9C27B0',
|
|
77
|
+
// Purple
|
|
78
|
+
'#E91E63' // Back to vibrant pink for seamless loop
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
// Legacy bubble colors for backward compatibility
|
|
82
|
+
export const BUBBLE_COLORS = RAINBOW_COLORS;
|
|
83
|
+
|
|
84
|
+
// Popit Fidget Game Theme - Matches scoreboard purple
|
|
85
|
+
export const POPIT_FIDGET_THEME = {
|
|
86
|
+
backgroundColor: '#fef7ff',
|
|
87
|
+
// Very light lavender to match game background
|
|
88
|
+
headerBackgroundColor: 'rgba(108, 92, 231, 0.9)',
|
|
89
|
+
// Purple header to match scoreboard
|
|
90
|
+
headerTextColor: '#ffffff',
|
|
91
|
+
sectionBackgroundColor: 'rgba(108, 92, 231, 0.4)',
|
|
92
|
+
// Match scoreboard transparency
|
|
93
|
+
sectionTitleColor: '#ffffff',
|
|
94
|
+
// White text on purple sections
|
|
95
|
+
buttonSelectedColor: '#9c27b0',
|
|
96
|
+
// Match start button purple
|
|
97
|
+
buttonUnselectedColor: 'rgba(255, 255, 255, 0.3)',
|
|
98
|
+
buttonSelectedTextColor: '#ffffff',
|
|
99
|
+
buttonUnselectedTextColor: '#1f2937',
|
|
100
|
+
switchTrackColorFalse: 'rgba(108, 92, 231, 0.5)',
|
|
101
|
+
switchTrackColorTrue: '#9c27b0',
|
|
102
|
+
// Match start button
|
|
103
|
+
switchThumbColor: '#ffffff',
|
|
104
|
+
infoTextColor: '#1f2937' // Dark text for readability
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// Popit Fidget Difficulty Descriptions
|
|
108
|
+
export const POPIT_FIDGET_DIFFICULTY_DESCRIPTIONS = {
|
|
109
|
+
easy: 'Smaller fidget grids, relaxing pace',
|
|
110
|
+
medium: 'Medium grids, satisfying pops',
|
|
111
|
+
hard: 'Large complex shapes, ultimate satisfaction!'
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=PopitFidgetConstants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["POPIT_FIDGET_GAME_CONFIG","GAME_DURATION","POINTS_PER_BUBBLE","COMPLETION_BONUS","TIME_BONUS_MULTIPLIER","BUBBLE_SIZE","ANIMATION_DURATION","PARTICLE_COUNT","PARTICLE_LIFETIME","GRID_SIZES","easy","medium","hard","POPIT_FIDGET_ANIMATION_CONFIG","POP_SCALE","POP_DURATION","FADE_DURATION","BOUNCE_SCALE","PARTICLE_VELOCITY","PARTICLE_GRAVITY","POPIT_FIDGET_COLORS","BACKGROUND","FIDGET_BORDER","FIDGET_SHADOW","SCORE","UI","POPPED_BUBBLE","PARTICLE_GLOW","FIDGET_BASE","BUBBLE_SHADOW","BUBBLE_HIGHLIGHT","RAINBOW_COLORS","BUBBLE_COLORS","POPIT_FIDGET_THEME","backgroundColor","headerBackgroundColor","headerTextColor","sectionBackgroundColor","sectionTitleColor","buttonSelectedColor","buttonUnselectedColor","buttonSelectedTextColor","buttonUnselectedTextColor","switchTrackColorFalse","switchTrackColorTrue","switchThumbColor","infoTextColor","POPIT_FIDGET_DIFFICULTY_DESCRIPTIONS"],"sourceRoot":"../../../../src","sources":["games/popit-fidget/PopitFidgetConstants.ts"],"mappings":";;AAEA;AACA,OAAO,MAAMA,wBAAwB,GAAG;EACtCC,aAAa,EAAE,GAAG;EAAE;EACpBC,iBAAiB,EAAE,EAAE;EACrBC,gBAAgB,EAAE,GAAG;EACrBC,qBAAqB,EAAE,CAAC;EACxBC,WAAW,EAAE,EAAE;EACfC,kBAAkB,EAAE,GAAG;EACvBC,cAAc,EAAE,CAA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AAS;EAAE;EAC9BC,mBAAmB,EAAE,SAAS;EAAE;EAChCC,qBAAqB,EAAE,0BAA0B;EACjDC,uBAAuB,EAAE,SAAS;EAClCC,yBAAyB,EAAE,SAAS;EACpCC,qBAAqB,EAAE,yBAAyB;EAChDC,oBAAoB,EAAE,SAAS;EAAE;EACjCC,gBAAgB,EAAE,SAAS;EAC3BC,aAAa,EAAE,SAAS,CAAE;AAC5B,CAAC;;AAED;AACA,OAAO,MAAMC,oCAAoC,GAAG;EAClDrC,IAAI,EAAE,qCAAqC;EAC3CC,MAAM,EAAE,+BAA+B;EACvCC,IAAI,EAAE;AACR,CAAU","ignoreList":[]}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Dimensions } from 'react-native';
|
|
4
|
+
import { POPIT_FIDGET_GAME_CONFIG as GAME_CONFIG, POPIT_FIDGET_ANIMATION_CONFIG as ANIMATION_CONFIG, POPIT_FIDGET_COLORS as COLORS, RAINBOW_COLORS, BUBBLE_COLORS } from "./PopitFidgetConstants.js";
|
|
5
|
+
const {
|
|
6
|
+
width,
|
|
7
|
+
height
|
|
8
|
+
} = Dimensions.get('window');
|
|
9
|
+
|
|
10
|
+
// Constants now imported from PopitFidgetConstants.ts
|
|
11
|
+
// Re-export for backward compatibility
|
|
12
|
+
export { GAME_CONFIG, ANIMATION_CONFIG, COLORS, BUBBLE_COLORS };
|
|
13
|
+
|
|
14
|
+
// Types - Simplified to always use square grids
|
|
15
|
+
|
|
16
|
+
export class PopitFidgetService {
|
|
17
|
+
gameTimerRef = null;
|
|
18
|
+
constructor() {}
|
|
19
|
+
|
|
20
|
+
// Generate square fidget grid based on difficulty
|
|
21
|
+
generateFidgetGrid(difficulty) {
|
|
22
|
+
const availableWidth = width * 0.85; // Match PopitFidget component calculation
|
|
23
|
+
const availableHeight = height * 0.6; // Match PopitFidget component calculation
|
|
24
|
+
|
|
25
|
+
// Get grid size from difficulty-based configuration
|
|
26
|
+
const gridSize = GAME_CONFIG.GRID_SIZES[difficulty];
|
|
27
|
+
|
|
28
|
+
// Use same bubble size calculation as PopitFidget component
|
|
29
|
+
const maxSize = Math.min(availableWidth / gridSize, availableHeight / gridSize);
|
|
30
|
+
const bubbleSize = Math.max(45, Math.min(80, maxSize * 0.9));
|
|
31
|
+
|
|
32
|
+
// Calculate grid dimensions with proper spacing
|
|
33
|
+
const spacing = bubbleSize * 1.1;
|
|
34
|
+
const gridWidth = (gridSize - 1) * spacing + bubbleSize;
|
|
35
|
+
const gridHeight = (gridSize - 1) * spacing + bubbleSize;
|
|
36
|
+
const bubbles = [];
|
|
37
|
+
|
|
38
|
+
// Generate square grid - all bubbles are included (no shape filtering)
|
|
39
|
+
for (let row = 0; row < gridSize; row++) {
|
|
40
|
+
bubbles[row] = [];
|
|
41
|
+
for (let col = 0; col < gridSize; col++) {
|
|
42
|
+
// Position bubbles with proper spacing to prevent overlap
|
|
43
|
+
const x = col * spacing + bubbleSize / 2;
|
|
44
|
+
const y = row * spacing + bubbleSize / 2;
|
|
45
|
+
bubbles[row][col] = {
|
|
46
|
+
id: `${row}-${col}`,
|
|
47
|
+
row,
|
|
48
|
+
col,
|
|
49
|
+
x,
|
|
50
|
+
y,
|
|
51
|
+
isPopped: false,
|
|
52
|
+
color: this.getRainbowColorForPosition(row, gridSize),
|
|
53
|
+
animationProgress: 0
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
size: gridSize,
|
|
59
|
+
bubbles,
|
|
60
|
+
centerX: gridWidth / 2,
|
|
61
|
+
centerY: gridHeight / 2,
|
|
62
|
+
width: gridWidth,
|
|
63
|
+
height: gridHeight
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Get rainbow gradient color based on row position for authentic Pop It look
|
|
68
|
+
getRainbowColorForPosition(row, totalRows) {
|
|
69
|
+
// Create rainbow gradient effect like real Pop It fidget toys
|
|
70
|
+
const colorIndex = Math.floor(row / totalRows * RAINBOW_COLORS.length);
|
|
71
|
+
return RAINBOW_COLORS[colorIndex] || RAINBOW_COLORS[0];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Check if all bubbles are popped
|
|
75
|
+
checkAllBubblesPopped(grid) {
|
|
76
|
+
for (let row = 0; row < grid.size; row++) {
|
|
77
|
+
for (let col = 0; col < grid.size; col++) {
|
|
78
|
+
const bubble = grid.bubbles[row]?.[col];
|
|
79
|
+
if (bubble && !bubble.isPopped) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Calculate completion percentage
|
|
88
|
+
calculateCompletionPercentage(grid) {
|
|
89
|
+
let totalBubbles = 0;
|
|
90
|
+
let poppedBubbles = 0;
|
|
91
|
+
for (let row = 0; row < grid.size; row++) {
|
|
92
|
+
for (let col = 0; col < grid.size; col++) {
|
|
93
|
+
const bubble = grid.bubbles[row]?.[col];
|
|
94
|
+
if (bubble) {
|
|
95
|
+
totalBubbles++;
|
|
96
|
+
if (bubble.isPopped) {
|
|
97
|
+
poppedBubbles++;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return totalBubbles > 0 ? poppedBubbles / totalBubbles * 100 : 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Start game timer
|
|
106
|
+
startGameTimer(duration, onTick, onComplete) {
|
|
107
|
+
this.stopGameTimer();
|
|
108
|
+
let timeLeft = duration;
|
|
109
|
+
this.gameTimerRef = setInterval(() => {
|
|
110
|
+
timeLeft -= 1;
|
|
111
|
+
onTick(timeLeft);
|
|
112
|
+
if (timeLeft <= 0) {
|
|
113
|
+
this.stopGameTimer();
|
|
114
|
+
onComplete();
|
|
115
|
+
}
|
|
116
|
+
}, 1000);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Stop game timer
|
|
120
|
+
stopGameTimer() {
|
|
121
|
+
if (this.gameTimerRef) {
|
|
122
|
+
clearInterval(this.gameTimerRef);
|
|
123
|
+
this.gameTimerRef = null;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Cleanup
|
|
128
|
+
cleanup() {
|
|
129
|
+
this.stopGameTimer();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=PopitFidgetService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Dimensions","POPIT_FIDGET_GAME_CONFIG","GAME_CONFIG","POPIT_FIDGET_ANIMATION_CONFIG","ANIMATION_CONFIG","POPIT_FIDGET_COLORS","COLORS","RAINBOW_COLORS","BUBBLE_COLORS","width","height","get","PopitFidgetService","gameTimerRef","constructor","generateFidgetGrid","difficulty","availableWidth","availableHeight","gridSize","GRID_SIZES","maxSize","Math","min","bubbleSize","max","spacing","gridWidth","gridHeight","bubbles","row","col","x","y","id","isPopped","color","getRainbowColorForPosition","animationProgress","size","centerX","centerY","totalRows","colorIndex","floor","length","checkAllBubblesPopped","grid","bubble","calculateCompletionPercentage","totalBubbles","poppedBubbles","startGameTimer","duration","onTick","onComplete","stopGameTimer","timeLeft","setInterval","clearInterval","cleanup"],"sourceRoot":"../../../../src","sources":["games/popit-fidget/PopitFidgetService.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;AACzC,SACEC,wBAAwB,IAAIC,WAAW,EACvCC,6BAA6B,IAAIC,gBAAgB,EACjDC,mBAAmB,IAAIC,MAAM,EAC7BC,cAAc,EACdC,aAAa,QACR,2BAAwB;AAE/B,MAAM;EAAEC,KAAK;EAAEC;AAAO,CAAC,GAAGV,UAAU,CAACW,GAAG,CAAC,QAAQ,CAAC;;AAElD;AACA;AACA,SAAST,WAAW,EAAEE,gBAAgB,EAAEE,MAAM,EAAEE,aAAa;;AAE7D;;AAwBA,OAAO,MAAMI,kBAAkB,CAAC;EACtBC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