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
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useRef, useEffect, useCallback, useState, useMemo } from 'react';
|
|
4
|
+
import { View, Text, StyleSheet, Dimensions } from 'react-native';
|
|
5
|
+
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
6
|
+
import { useSpaceFighterStore } from "../SpaceFighterStore.js";
|
|
7
|
+
import { createSpaceFighterService } from "../SpaceFighterService.js";
|
|
8
|
+
import { playSound, GAME_SOUNDS } from "../../../services/SoundsService.js";
|
|
9
|
+
import { playHaptic, HapticType } from "../../../services/HapticsService.js";
|
|
10
|
+
import { ParticleBlast } from "../../../shared/helpers/index.js";
|
|
11
|
+
import { AsteroidComponent } from "./AsteroidComponent.js";
|
|
12
|
+
import { Spacecraft3D } from "./Spacecraft3D.js";
|
|
13
|
+
import { SpacecraftPath } from "./SpacecraftPath.js";
|
|
14
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
const {
|
|
16
|
+
width,
|
|
17
|
+
height
|
|
18
|
+
} = Dimensions.get('window');
|
|
19
|
+
|
|
20
|
+
// Self-contained GameArea component following FruitNinja pattern with performance optimizations
|
|
21
|
+
export const GameArea = /*#__PURE__*/React.memo(() => {
|
|
22
|
+
// Optimized store subscriptions - read only what's needed for rendering
|
|
23
|
+
const asteroids = useSpaceFighterStore(state => state.asteroids);
|
|
24
|
+
const spacecraft = useSpaceFighterStore(state => state.spacecraft);
|
|
25
|
+
const spacecraftPath = useSpaceFighterStore(state => state.spacecraftPath);
|
|
26
|
+
const isControllingSpacecraft = useSpaceFighterStore(state => state.isControllingSpacecraft);
|
|
27
|
+
const isPlaying = useSpaceFighterStore(state => state.isPlaying);
|
|
28
|
+
|
|
29
|
+
// Get store actions independently (these don't cause re-renders)
|
|
30
|
+
const updateSpacecraft = useSpaceFighterStore(state => state.updateSpacecraft);
|
|
31
|
+
const setSpacecraftPath = useSpaceFighterStore(state => state.setSpacecraftPath);
|
|
32
|
+
const setIsControllingSpacecraft = useSpaceFighterStore(state => state.setIsControllingSpacecraft);
|
|
33
|
+
const markAsteroidPassed = useSpaceFighterStore(state => state.markAsteroidPassed);
|
|
34
|
+
const loseLife = useSpaceFighterStore(state => state.loseLife);
|
|
35
|
+
|
|
36
|
+
// Self-contained component - no external settings needed
|
|
37
|
+
|
|
38
|
+
// Game service ref
|
|
39
|
+
const gameService = useRef(createSpaceFighterService(width, height)).current;
|
|
40
|
+
|
|
41
|
+
// Initialize spacecraft position on mount
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
const initialSpacecraft = gameService.getInitialSpacecraft();
|
|
44
|
+
updateSpacecraft(initialSpacecraft);
|
|
45
|
+
}, [gameService, updateSpacecraft]);
|
|
46
|
+
|
|
47
|
+
// Spacecraft control refs
|
|
48
|
+
const currentSpacecraftPath = useRef([]);
|
|
49
|
+
const initialSpacecraftPosition = useRef(null);
|
|
50
|
+
const initialTouchPosition = useRef(null);
|
|
51
|
+
const pendingSpacecraftUpdate = useRef(null);
|
|
52
|
+
const animationFrameId = useRef(null);
|
|
53
|
+
const lastCollisionTime = useRef(0);
|
|
54
|
+
|
|
55
|
+
// State for managing active particle blasts
|
|
56
|
+
const [activeBlasts, setActiveBlasts] = useState([]);
|
|
57
|
+
|
|
58
|
+
// Memoized particle blast colors for performance
|
|
59
|
+
const particleColors = useMemo(() => ['#ff6b6b', '#ff8e53', '#ff6b35'], []);
|
|
60
|
+
|
|
61
|
+
// Sound and haptic feedback functions (using default enabled state)
|
|
62
|
+
const playSuccessSound = useCallback(() => {
|
|
63
|
+
playSound(GAME_SOUNDS.SPACE_FIGHTER.SUCCESS, true);
|
|
64
|
+
playHaptic(HapticType.LIGHT, true);
|
|
65
|
+
}, []);
|
|
66
|
+
const playCollisionSound = useCallback(() => {
|
|
67
|
+
playSound(GAME_SOUNDS.SPACE_FIGHTER.COLLISION, true);
|
|
68
|
+
playHaptic(HapticType.HEAVY, true);
|
|
69
|
+
}, []);
|
|
70
|
+
|
|
71
|
+
// Spacecraft control functions
|
|
72
|
+
const handleSpacecraftControlStart = useCallback((x, y) => {
|
|
73
|
+
const currentSpacecraft = useSpaceFighterStore.getState().spacecraft;
|
|
74
|
+
const controlledSpacecraft = gameService.controlSpacecraft({
|
|
75
|
+
...currentSpacecraft
|
|
76
|
+
}, x, y);
|
|
77
|
+
updateSpacecraft(controlledSpacecraft);
|
|
78
|
+
setIsControllingSpacecraft(true);
|
|
79
|
+
currentSpacecraftPath.current = [{
|
|
80
|
+
x,
|
|
81
|
+
y
|
|
82
|
+
}];
|
|
83
|
+
setSpacecraftPath([{
|
|
84
|
+
x,
|
|
85
|
+
y
|
|
86
|
+
}]);
|
|
87
|
+
}, [gameService, updateSpacecraft, setIsControllingSpacecraft, setSpacecraftPath]);
|
|
88
|
+
const processPendingSpacecraftUpdate = useCallback(() => {
|
|
89
|
+
if (pendingSpacecraftUpdate.current) {
|
|
90
|
+
const {
|
|
91
|
+
x,
|
|
92
|
+
y
|
|
93
|
+
} = pendingSpacecraftUpdate.current;
|
|
94
|
+
const currentSpacecraft = useSpaceFighterStore.getState().spacecraft;
|
|
95
|
+
const controlledSpacecraft = gameService.controlSpacecraft({
|
|
96
|
+
...currentSpacecraft
|
|
97
|
+
}, x, y);
|
|
98
|
+
updateSpacecraft(controlledSpacecraft);
|
|
99
|
+
|
|
100
|
+
// Throttle path updates to reduce re-renders
|
|
101
|
+
currentSpacecraftPath.current.push({
|
|
102
|
+
x,
|
|
103
|
+
y
|
|
104
|
+
});
|
|
105
|
+
if (currentSpacecraftPath.current.length > 8) {
|
|
106
|
+
currentSpacecraftPath.current.shift();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Only update path every 3rd update to reduce re-renders
|
|
110
|
+
if (currentSpacecraftPath.current.length % 3 === 0) {
|
|
111
|
+
setSpacecraftPath([...currentSpacecraftPath.current]);
|
|
112
|
+
}
|
|
113
|
+
pendingSpacecraftUpdate.current = null;
|
|
114
|
+
}
|
|
115
|
+
animationFrameId.current = null;
|
|
116
|
+
}, [gameService, updateSpacecraft, setSpacecraftPath]);
|
|
117
|
+
const handleSpacecraftControlMove = useCallback((x, y) => {
|
|
118
|
+
pendingSpacecraftUpdate.current = {
|
|
119
|
+
x,
|
|
120
|
+
y
|
|
121
|
+
};
|
|
122
|
+
if (animationFrameId.current === null) {
|
|
123
|
+
animationFrameId.current = requestAnimationFrame(processPendingSpacecraftUpdate);
|
|
124
|
+
}
|
|
125
|
+
}, [processPendingSpacecraftUpdate]);
|
|
126
|
+
const handleSpacecraftControlEnd = useCallback(() => {
|
|
127
|
+
if (animationFrameId.current !== null) {
|
|
128
|
+
cancelAnimationFrame(animationFrameId.current);
|
|
129
|
+
animationFrameId.current = null;
|
|
130
|
+
}
|
|
131
|
+
if (pendingSpacecraftUpdate.current) {
|
|
132
|
+
processPendingSpacecraftUpdate();
|
|
133
|
+
}
|
|
134
|
+
const currentSpacecraft = useSpaceFighterStore.getState().spacecraft;
|
|
135
|
+
const releasedSpacecraft = gameService.releaseSpacecraft({
|
|
136
|
+
...currentSpacecraft
|
|
137
|
+
});
|
|
138
|
+
updateSpacecraft(releasedSpacecraft);
|
|
139
|
+
setIsControllingSpacecraft(false);
|
|
140
|
+
setTimeout(() => {
|
|
141
|
+
currentSpacecraftPath.current = [];
|
|
142
|
+
setSpacecraftPath([]);
|
|
143
|
+
}, 300);
|
|
144
|
+
}, [gameService, updateSpacecraft, setIsControllingSpacecraft, setSpacecraftPath, processPendingSpacecraftUpdate]);
|
|
145
|
+
|
|
146
|
+
// Optimized collision detection with reduced store access
|
|
147
|
+
useEffect(() => {
|
|
148
|
+
if (!isPlaying) return;
|
|
149
|
+
const interval = setInterval(() => {
|
|
150
|
+
// Single store access for better performance
|
|
151
|
+
const state = useSpaceFighterStore.getState();
|
|
152
|
+
const currentSpacecraft = state.spacecraft;
|
|
153
|
+
const currentAsteroids = state.asteroids;
|
|
154
|
+
|
|
155
|
+
// Skip if no asteroids to check
|
|
156
|
+
if (currentAsteroids.length === 0) return;
|
|
157
|
+
const collision = gameService.checkCollision(currentSpacecraft, currentAsteroids);
|
|
158
|
+
const now = Date.now();
|
|
159
|
+
if (collision.collision && now - lastCollisionTime.current > 1000) {
|
|
160
|
+
lastCollisionTime.current = now;
|
|
161
|
+
playCollisionSound();
|
|
162
|
+
|
|
163
|
+
// Create particle blast at collision point
|
|
164
|
+
const blastId = `blast-${now}`;
|
|
165
|
+
setActiveBlasts(prev => [...prev, {
|
|
166
|
+
id: blastId,
|
|
167
|
+
x: currentSpacecraft.x,
|
|
168
|
+
y: currentSpacecraft.y
|
|
169
|
+
}]);
|
|
170
|
+
|
|
171
|
+
// Remove blast after animation
|
|
172
|
+
setTimeout(() => {
|
|
173
|
+
setActiveBlasts(prev => prev.filter(blast => blast.id !== blastId));
|
|
174
|
+
}, 800);
|
|
175
|
+
loseLife(); // This now handles spacecraft position reset internally
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Check asteroid passes for scoring
|
|
180
|
+
const passedAsteroids = gameService.checkAsteroidPass(currentSpacecraft, currentAsteroids);
|
|
181
|
+
if (passedAsteroids.length > 0) {
|
|
182
|
+
passedAsteroids.forEach(pairId => {
|
|
183
|
+
markAsteroidPassed(pairId);
|
|
184
|
+
playSuccessSound();
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
}, 100); // Slightly increased interval for better performance (was 80ms)
|
|
188
|
+
|
|
189
|
+
return () => clearInterval(interval);
|
|
190
|
+
}, [isPlaying, gameService, playCollisionSound, loseLife, updateSpacecraft, markAsteroidPassed, playSuccessSound]);
|
|
191
|
+
|
|
192
|
+
// Memoized gesture handling for better performance
|
|
193
|
+
const panGesture = useMemo(() => Gesture.Pan().onStart(event => {
|
|
194
|
+
const currentSpacecraft = useSpaceFighterStore.getState().spacecraft;
|
|
195
|
+
initialSpacecraftPosition.current = {
|
|
196
|
+
x: currentSpacecraft.x,
|
|
197
|
+
y: currentSpacecraft.y
|
|
198
|
+
};
|
|
199
|
+
initialTouchPosition.current = {
|
|
200
|
+
x: event.absoluteX,
|
|
201
|
+
y: event.absoluteY
|
|
202
|
+
};
|
|
203
|
+
handleSpacecraftControlStart(currentSpacecraft.x, currentSpacecraft.y);
|
|
204
|
+
}).onUpdate(event => {
|
|
205
|
+
if (!initialSpacecraftPosition.current || !initialTouchPosition.current) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
const dx = event.absoluteX - initialTouchPosition.current.x;
|
|
209
|
+
const newX = initialSpacecraftPosition.current.x + dx;
|
|
210
|
+
const newY = initialSpacecraftPosition.current.y;
|
|
211
|
+
handleSpacecraftControlMove(newX, newY);
|
|
212
|
+
}).onEnd(() => {
|
|
213
|
+
initialTouchPosition.current = null;
|
|
214
|
+
handleSpacecraftControlEnd();
|
|
215
|
+
}).onFinalize(() => {
|
|
216
|
+
initialTouchPosition.current = null;
|
|
217
|
+
handleSpacecraftControlEnd();
|
|
218
|
+
}).runOnJS(true), [handleSpacecraftControlStart, handleSpacecraftControlMove, handleSpacecraftControlEnd]);
|
|
219
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
220
|
+
style: [styles.gameArea],
|
|
221
|
+
children: [/*#__PURE__*/_jsx(SpacecraftPath, {
|
|
222
|
+
path: spacecraftPath
|
|
223
|
+
}), asteroids.map(asteroid => /*#__PURE__*/_jsx(AsteroidComponent, {
|
|
224
|
+
asteroid: asteroid
|
|
225
|
+
}, asteroid.id)), activeBlasts.map(blast => /*#__PURE__*/_jsx(ParticleBlast, {
|
|
226
|
+
x: blast.x,
|
|
227
|
+
y: blast.y,
|
|
228
|
+
colors: particleColors,
|
|
229
|
+
particleCount: 12,
|
|
230
|
+
duration: 800
|
|
231
|
+
}, blast.id)), /*#__PURE__*/_jsx(Spacecraft3D, {
|
|
232
|
+
spacecraft: spacecraft,
|
|
233
|
+
isControlled: isControllingSpacecraft
|
|
234
|
+
}), /*#__PURE__*/_jsx(GestureDetector, {
|
|
235
|
+
gesture: panGesture,
|
|
236
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
237
|
+
style: styles.gestureOverlay
|
|
238
|
+
})
|
|
239
|
+
}), asteroids.length === 0 && /*#__PURE__*/_jsxs(View, {
|
|
240
|
+
style: styles.instructionsContainer,
|
|
241
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
242
|
+
style: styles.instructionsEmoji,
|
|
243
|
+
children: "\uD83D\uDE80"
|
|
244
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
245
|
+
style: styles.instructionsTitle,
|
|
246
|
+
children: "Navigate your spacecraft through the space!"
|
|
247
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
248
|
+
style: styles.instructionsSubtitle,
|
|
249
|
+
children: "Touch and drag to control your spacecraft"
|
|
250
|
+
})]
|
|
251
|
+
})]
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
const styles = StyleSheet.create({
|
|
255
|
+
gameArea: {
|
|
256
|
+
flex: 1,
|
|
257
|
+
position: 'relative'
|
|
258
|
+
},
|
|
259
|
+
gestureOverlay: {
|
|
260
|
+
position: 'absolute',
|
|
261
|
+
top: 0,
|
|
262
|
+
left: 0,
|
|
263
|
+
right: 0,
|
|
264
|
+
bottom: 0,
|
|
265
|
+
backgroundColor: 'transparent',
|
|
266
|
+
zIndex: 10
|
|
267
|
+
},
|
|
268
|
+
instructionsContainer: {
|
|
269
|
+
position: 'absolute',
|
|
270
|
+
top: '33%',
|
|
271
|
+
left: 0,
|
|
272
|
+
right: 0,
|
|
273
|
+
opacity: 0.6,
|
|
274
|
+
alignItems: 'center',
|
|
275
|
+
justifyContent: 'center'
|
|
276
|
+
},
|
|
277
|
+
instructionsEmoji: {
|
|
278
|
+
textAlign: 'center',
|
|
279
|
+
fontSize: 24,
|
|
280
|
+
marginBottom: 12
|
|
281
|
+
},
|
|
282
|
+
instructionsTitle: {
|
|
283
|
+
color: '#ffffff',
|
|
284
|
+
textAlign: 'center',
|
|
285
|
+
fontSize: 18,
|
|
286
|
+
fontWeight: 'bold',
|
|
287
|
+
marginBottom: 8
|
|
288
|
+
},
|
|
289
|
+
instructionsSubtitle: {
|
|
290
|
+
color: '#ffffff',
|
|
291
|
+
textAlign: 'center',
|
|
292
|
+
marginTop: 8
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
//# sourceMappingURL=GameArea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useRef","useEffect","useCallback","useState","useMemo","View","Text","StyleSheet","Dimensions","Gesture","GestureDetector","useSpaceFighterStore","createSpaceFighterService","playSound","GAME_SOUNDS","playHaptic","HapticType","ParticleBlast","AsteroidComponent","Spacecraft3D","SpacecraftPath","jsx","_jsx","jsxs","_jsxs","width","height","get","GameArea","memo","asteroids","state","spacecraft","spacecraftPath","isControllingSpacecraft","isPlaying","updateSpacecraft","setSpacecraftPath","setIsControllingSpacecraft","markAsteroidPassed","loseLife","gameService","current","initialSpacecraft","getInitialSpacecraft","currentSpacecraftPath","initialSpacecraftPosition","initialTouchPosition","pendingSpacecraftUpdate","animationFrameId","lastCollisionTime","activeBlasts","setActiveBlasts","particleColors","playSuccessSound","SPACE_FIGHTER","SUCCESS","LIGHT","playCollisionSound","COLLISION","HEAVY","handleSpacecraftControlStart","x","y","currentSpacecraft","getState","controlledSpacecraft","controlSpacecraft","processPendingSpacecraftUpdate","push","length","shift","handleSpacecraftControlMove","requestAnimationFrame","handleSpacecraftControlEnd","cancelAnimationFrame","releasedSpacecraft","releaseSpacecraft","setTimeout","interval","setInterval","currentAsteroids","collision","checkCollision","now","Date","blastId","prev","id","filter","blast","passedAsteroids","checkAsteroidPass","forEach","pairId","clearInterval","panGesture","Pan","onStart","event","absoluteX","absoluteY","onUpdate","dx","newX","newY","onEnd","onFinalize","runOnJS","style","styles","gameArea","children","path","map","asteroid","colors","particleCount","duration","isControlled","gesture","gestureOverlay","instructionsContainer","instructionsEmoji","instructionsTitle","instructionsSubtitle","create","flex","position","top","left","right","bottom","backgroundColor","zIndex","opacity","alignItems","justifyContent","textAlign","fontSize","marginBottom","color","fontWeight","marginTop"],"sourceRoot":"../../../../../src","sources":["games/space-fighter/components/GameArea.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,MAAM,EAAEC,SAAS,EAAEC,WAAW,EAAEC,QAAQ,EAAEC,OAAO,QAAQ,OAAO;AAChF,SAASC,IAAI,EAAEC,IAAI,EAAEC,UAAU,EAAEC,UAAU,QAAQ,cAAc;AACjE,SAASC,OAAO,EAAEC,eAAe,QAAQ,8BAA8B;AACvE,SAASC,oBAAoB,QAAQ,yBAAsB;AAC3D,SAASC,yBAAyB,QAAQ,2BAAwB;AAClE,SAASC,SAAS,EAAEC,WAAW,QAAQ,oCAAiC;AACxE,SAASC,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,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB,CAAC;EACDd,iBAAiB,EAAE;IACjBe,SAAS,EAAE,QAAQ;IACnBC,QAAQ,EAAE,EAAE;IACZC,YAAY,EAAE;EAChB,CAAC;EACDhB,iBAAiB,EAAE;IACjBiB,KAAK,EAAE,SAAS;IAChBH,SAAS,EAAE,QAAQ;IACnBC,QAAQ,EAAE,EAAE;IACZG,UAAU,EAAE,MAAM;IAClBF,YAAY,EAAE;EAChB,CAAC;EACDf,oBAAoB,EAAE;IACpBgB,KAAK,EAAE,SAAS;IAChBH,SAAS,EAAE,QAAQ;IACnBK,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,48 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import React
|
|
4
|
-
import { Dimensions } from 'react-native';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { View, Dimensions } from 'react-native';
|
|
5
5
|
import { Canvas, LinearGradient, Rect, Circle, Group, Shadow, vec } from '@shopify/react-native-skia';
|
|
6
|
-
import { useSharedValue, withRepeat, withTiming, withSequence, interpolate, Extrapolation, Easing } from 'react-native-reanimated';
|
|
7
|
-
import Animated, { useAnimatedStyle } from 'react-native-reanimated';
|
|
8
6
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
7
|
const {
|
|
10
8
|
width,
|
|
11
9
|
height
|
|
12
10
|
} = Dimensions.get('window');
|
|
13
|
-
export const GameBackground = ({
|
|
11
|
+
export const GameBackground = /*#__PURE__*/React.memo(({
|
|
14
12
|
children
|
|
15
13
|
}) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const spaceFloat = useSharedValue(0); // Combined animation for planet, nebula, and asteroids
|
|
19
|
-
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
// Optimized star twinkling with easing for smoother animation
|
|
22
|
-
starTwinkle.value = withRepeat(withSequence(withTiming(1, {
|
|
23
|
-
duration: 3000,
|
|
24
|
-
easing: Easing.inOut(Easing.ease)
|
|
25
|
-
}), withTiming(0.4, {
|
|
26
|
-
duration: 3000,
|
|
27
|
-
easing: Easing.inOut(Easing.ease)
|
|
28
|
-
})), -1, false);
|
|
29
|
-
|
|
30
|
-
// Combined space animation for all floating elements
|
|
31
|
-
spaceFloat.value = withRepeat(withTiming(1, {
|
|
32
|
-
duration: 15000,
|
|
33
|
-
easing: Easing.inOut(Easing.ease)
|
|
34
|
-
}), -1, true // Reverse for smooth back-and-forth motion
|
|
35
|
-
);
|
|
36
|
-
}, []);
|
|
37
|
-
const animatedBackgroundStyle = useAnimatedStyle(() => {
|
|
38
|
-
return {
|
|
39
|
-
transform: []
|
|
40
|
-
};
|
|
41
|
-
});
|
|
42
|
-
return /*#__PURE__*/_jsxs(Animated.View, {
|
|
43
|
-
style: [{
|
|
14
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
15
|
+
style: {
|
|
44
16
|
flex: 1
|
|
45
|
-
},
|
|
17
|
+
},
|
|
46
18
|
children: [/*#__PURE__*/_jsxs(Canvas, {
|
|
47
19
|
style: {
|
|
48
20
|
position: 'absolute',
|
|
@@ -70,14 +42,12 @@ export const GameBackground = ({
|
|
|
70
42
|
const x = width / 8 * (i % 8) + i % 5 * 25;
|
|
71
43
|
const y = height / 5 * Math.floor(i / 8) + i % 3 * 40;
|
|
72
44
|
const size = 1 + i % 3 * 0.4;
|
|
73
|
-
const isAnimated = i % 3 === 0; // Only animate every 3rd star for performance
|
|
74
|
-
|
|
75
45
|
return /*#__PURE__*/_jsx(Circle, {
|
|
76
46
|
cx: x,
|
|
77
47
|
cy: y,
|
|
78
48
|
r: size,
|
|
79
49
|
color: "#ffffff",
|
|
80
|
-
opacity:
|
|
50
|
+
opacity: 0.6
|
|
81
51
|
}, `star-${i}`);
|
|
82
52
|
})
|
|
83
53
|
}), /*#__PURE__*/_jsx(Group, {
|
|
@@ -112,37 +82,23 @@ export const GameBackground = ({
|
|
|
112
82
|
const pos = positions[i];
|
|
113
83
|
if (!pos) return null;
|
|
114
84
|
const size = 2.5 + i % 2 * 0.5;
|
|
115
|
-
const isAnimated = i % 2 === 0; // Only animate every other bright star
|
|
116
|
-
|
|
117
85
|
return /*#__PURE__*/_jsx(Group, {
|
|
118
86
|
children: /*#__PURE__*/_jsx(Circle, {
|
|
119
87
|
cx: pos.x,
|
|
120
88
|
cy: pos.y,
|
|
121
89
|
r: size,
|
|
122
90
|
color: "#ffffff",
|
|
123
|
-
opacity:
|
|
91
|
+
opacity: 0.8,
|
|
124
92
|
children: /*#__PURE__*/_jsx(Shadow, {
|
|
125
93
|
dx: 0,
|
|
126
94
|
dy: 0,
|
|
127
|
-
blur: 10
|
|
128
|
-
,
|
|
95
|
+
blur: 10,
|
|
129
96
|
color: "#ffffff"
|
|
130
97
|
})
|
|
131
98
|
})
|
|
132
99
|
}, `bright-star-${i}`);
|
|
133
100
|
})
|
|
134
101
|
}), /*#__PURE__*/_jsxs(Group, {
|
|
135
|
-
transform: [{
|
|
136
|
-
translateX: width * 0.85
|
|
137
|
-
}, {
|
|
138
|
-
translateY: height * 0.2
|
|
139
|
-
}, {
|
|
140
|
-
rotate: interpolate(spaceFloat.value, [0, 1], [0, Math.PI * 2], Extrapolation.CLAMP)
|
|
141
|
-
}, {
|
|
142
|
-
translateX: -width * 0.85
|
|
143
|
-
}, {
|
|
144
|
-
translateY: -height * 0.2
|
|
145
|
-
}],
|
|
146
102
|
children: [/*#__PURE__*/_jsx(Circle, {
|
|
147
103
|
cx: width * 0.85,
|
|
148
104
|
cy: height * 0.2,
|
|
@@ -176,9 +132,6 @@ export const GameBackground = ({
|
|
|
176
132
|
})]
|
|
177
133
|
}), /*#__PURE__*/_jsxs(Group, {
|
|
178
134
|
children: [/*#__PURE__*/_jsxs(Group, {
|
|
179
|
-
transform: [{
|
|
180
|
-
translateX: interpolate(spaceFloat.value, [0, 1], [-3, 3], Extrapolation.CLAMP)
|
|
181
|
-
}],
|
|
182
135
|
children: [/*#__PURE__*/_jsx(Circle, {
|
|
183
136
|
cx: width * 0.2,
|
|
184
137
|
cy: height * 0.6,
|
|
@@ -199,9 +152,6 @@ export const GameBackground = ({
|
|
|
199
152
|
opacity: 0.1
|
|
200
153
|
})]
|
|
201
154
|
}), /*#__PURE__*/_jsxs(Group, {
|
|
202
|
-
transform: [{
|
|
203
|
-
translateX: interpolate(spaceFloat.value, [0, 1], [2, -2], Extrapolation.CLAMP)
|
|
204
|
-
}],
|
|
205
155
|
children: [/*#__PURE__*/_jsx(Circle, {
|
|
206
156
|
cx: width * 0.7,
|
|
207
157
|
cy: height * 0.4,
|
|
@@ -245,12 +195,7 @@ export const GameBackground = ({
|
|
|
245
195
|
const pos = positions[i];
|
|
246
196
|
if (!pos) return null;
|
|
247
197
|
const size = 3 + i % 3;
|
|
248
|
-
const isAnimated = i % 2 === 0; // Only animate every other asteroid
|
|
249
|
-
|
|
250
198
|
return /*#__PURE__*/_jsxs(Group, {
|
|
251
|
-
transform: isAnimated ? [{
|
|
252
|
-
translateX: interpolate(spaceFloat.value, [0, 1], [-1.5, 1.5], Extrapolation.CLAMP)
|
|
253
|
-
}] : [],
|
|
254
199
|
children: [/*#__PURE__*/_jsx(Circle, {
|
|
255
200
|
cx: pos.x,
|
|
256
201
|
cy: pos.y,
|
|
@@ -290,5 +235,5 @@ export const GameBackground = ({
|
|
|
290
235
|
})]
|
|
291
236
|
}), children]
|
|
292
237
|
});
|
|
293
|
-
};
|
|
238
|
+
});
|
|
294
239
|
//# sourceMappingURL=GameBackground.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","View","Dimensions","Canvas","LinearGradient","Rect","Circle","Group","Shadow","vec","jsx","_jsx","jsxs","_jsxs","width","height","get","GameBackground","memo","children","style","flex","position","top","left","right","bottom","x","y","start","end","colors","Array","from","length","_","i","Math","floor","size","cx","cy","r","color","opacity","positions","pos","dx","dy","blur"],"sourceRoot":"../../../../../src","sources":["games/space-fighter/components/GameBackground.tsx"],"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AG,CAAC,GAAIsB,IAAI,CAACC,KAAK,CAACF,CAAC,GAAG,CAAC,CAAC,GAAIA,CAAC,GAAG,CAAC,GAAI,EAAE;UACzD,MAAMG,IAAI,GAAG,GAAG,GAAIH,CAAC,GAAG,CAAC,GAAI,GAAG;UAEhC,oBACEzB,IAAA,CAACL,MAAM;YAELkC,EAAE,EAAEb,CAAE;YACNc,EAAE,EAAEb,CAAE;YACNc,CAAC,EAAEH,IAAK;YACRI,KAAK,EAAC,SAAS;YACfC,OAAO,EAAE;UAAK,GALT,QAAQR,CAAC,EAMf,CAAC;QAEN,CAAC;MAAC,CACG,CAAC;IAAA,CACF,CAAC,EAGRjB,QAAQ;EAAA,CACL,CAAC;AAEX,CAAC,CAAC","ignoreList":[]}
|
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { View, Text, StyleSheet } from 'react-native';
|
|
5
|
-
import {
|
|
5
|
+
import { useSpaceFighterStore } from "../SpaceFighterStore.js";
|
|
6
|
+
import { RESPONSIVE_SCOREBOARD_CONTAINER, RESPONSIVE_SCOREBOARD_FONTS } from "../../../shared/helpers/index.js";
|
|
7
|
+
|
|
8
|
+
// Self-contained ScoreBoard component that reads directly from store
|
|
6
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
export const ScoreBoard = ({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const currentLives =
|
|
10
|
+
export const ScoreBoard = /*#__PURE__*/React.memo(() => {
|
|
11
|
+
// Read state directly from store to minimize re-renders
|
|
12
|
+
const score = useSpaceFighterStore(state => state.score);
|
|
13
|
+
const timeLeft = useSpaceFighterStore(state => state.timeLeft);
|
|
14
|
+
const currentLives = useSpaceFighterStore(state => state.lives);
|
|
12
15
|
const maxLives = 3;
|
|
13
16
|
return /*#__PURE__*/_jsxs(View, {
|
|
14
17
|
style: [styles.scoreBoard, {
|
|
@@ -28,9 +31,9 @@ export const ScoreBoard = ({
|
|
|
28
31
|
children: [/*#__PURE__*/_jsx(Text, {
|
|
29
32
|
style: styles.scoreLabel,
|
|
30
33
|
children: "Time"
|
|
31
|
-
}), /*#__PURE__*/
|
|
34
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
32
35
|
style: styles.timeValue,
|
|
33
|
-
children:
|
|
36
|
+
children: timeLeft
|
|
34
37
|
})]
|
|
35
38
|
}), /*#__PURE__*/_jsxs(View, {
|
|
36
39
|
style: styles.scoreItem,
|
|
@@ -48,34 +51,25 @@ export const ScoreBoard = ({
|
|
|
48
51
|
})]
|
|
49
52
|
})]
|
|
50
53
|
});
|
|
51
|
-
};
|
|
54
|
+
});
|
|
52
55
|
const styles = StyleSheet.create({
|
|
53
56
|
scoreBoard: {
|
|
57
|
+
...RESPONSIVE_SCOREBOARD_CONTAINER,
|
|
54
58
|
flexDirection: 'row',
|
|
55
59
|
justifyContent: 'space-between',
|
|
56
60
|
alignItems: 'center',
|
|
57
|
-
backgroundColor: 'rgba(
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
padding: 20,
|
|
61
|
+
backgroundColor: 'rgba(147, 112, 219, 0.4)',
|
|
62
|
+
// Matches start/stop button purple color with 0.4 opacity
|
|
63
|
+
marginBottom: 20,
|
|
61
64
|
borderWidth: 2,
|
|
62
|
-
borderColor: 'rgba(139, 92, 246, 0.3)'
|
|
63
|
-
// Purple space border
|
|
64
|
-
shadowColor: '#000',
|
|
65
|
-
shadowOffset: {
|
|
66
|
-
width: 0,
|
|
67
|
-
height: 4
|
|
68
|
-
},
|
|
69
|
-
shadowOpacity: 0.3,
|
|
70
|
-
shadowRadius: 8,
|
|
71
|
-
elevation: 8
|
|
65
|
+
borderColor: 'rgba(139, 92, 246, 0.3)' // Purple space border
|
|
72
66
|
},
|
|
73
67
|
scoreItem: {
|
|
74
68
|
alignItems: 'center',
|
|
75
69
|
flex: 1
|
|
76
70
|
},
|
|
77
71
|
scoreLabel: {
|
|
78
|
-
fontSize:
|
|
72
|
+
fontSize: RESPONSIVE_SCOREBOARD_FONTS.labelSize,
|
|
79
73
|
fontWeight: 'bold',
|
|
80
74
|
color: '#e2e8f0',
|
|
81
75
|
// Light space gray
|
|
@@ -88,7 +82,7 @@ const styles = StyleSheet.create({
|
|
|
88
82
|
textShadowRadius: 2
|
|
89
83
|
},
|
|
90
84
|
scoreValue: {
|
|
91
|
-
fontSize:
|
|
85
|
+
fontSize: RESPONSIVE_SCOREBOARD_FONTS.valueSize,
|
|
92
86
|
fontWeight: 'bold',
|
|
93
87
|
color: '#fbbf24',
|
|
94
88
|
// Bright yellow for score
|
|
@@ -100,7 +94,7 @@ const styles = StyleSheet.create({
|
|
|
100
94
|
textShadowRadius: 2
|
|
101
95
|
},
|
|
102
96
|
timeValue: {
|
|
103
|
-
fontSize:
|
|
97
|
+
fontSize: RESPONSIVE_SCOREBOARD_FONTS.timeSize,
|
|
104
98
|
fontWeight: 'bold',
|
|
105
99
|
color: '#34d399',
|
|
106
100
|
// Bright green for time
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","View","Text","StyleSheet","useSpaceFighterStore","RESPONSIVE_SCOREBOARD_CONTAINER","RESPONSIVE_SCOREBOARD_FONTS","jsx","_jsx","jsxs","_jsxs","ScoreBoard","memo","score","state","timeLeft","currentLives","lives","maxLives","style","styles","scoreBoard","zIndex","children","scoreItem","scoreLabel","scoreValue","timeValue","livesContainer","Array","from","length","_","i","lifeIcon","lifeActive","lifeInactive","create","flexDirection","justifyContent","alignItems","backgroundColor","marginBottom","borderWidth","borderColor","flex","fontSize","labelSize","fontWeight","color","textShadowColor","textShadowOffset","width","height","textShadowRadius","valueSize","timeSize","marginHorizontal"],"sourceRoot":"../../../../../src","sources":["games/space-fighter/components/ScoreBoard.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AACrD,SAASC,oBAAoB,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