react-native-games 1.1.0 → 1.3.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 +101 -30
- package/lib/module/games/balloon-blaster/BalloonBlaster.js +1 -167
- package/lib/module/games/balloon-blaster/BalloonBlaster.js.map +1 -1
- package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js +1 -182
- package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js.map +1 -1
- package/lib/module/games/balloon-blaster/BalloonBlasterService.js +1 -318
- package/lib/module/games/balloon-blaster/BalloonBlasterStore.js +1 -183
- package/lib/module/games/balloon-blaster/components/BalloonComponent.js +1 -237
- package/lib/module/games/balloon-blaster/components/GameArea.js +1 -156
- package/lib/module/games/balloon-blaster/components/GameBackground.js +1 -476
- package/lib/module/games/balloon-blaster/components/ScoreBoard.js +1 -112
- package/lib/module/games/balloon-blaster/components/ScoreBoard.js.map +1 -1
- package/lib/module/games/balloon-blaster/components/index.js +1 -7
- package/lib/module/games/bike-racing/BikeRacing.js +1 -0
- package/lib/module/games/bike-racing/BikeRacing.js.map +1 -0
- package/lib/module/games/bike-racing/BikeRacingConstants.js +1 -0
- package/lib/module/games/bike-racing/BikeRacingConstants.js.map +1 -0
- package/lib/module/games/bike-racing/BikeRacingService.js +1 -0
- package/lib/module/games/bike-racing/BikeRacingService.js.map +1 -0
- package/lib/module/games/bike-racing/BikeRacingStore.js +1 -0
- package/lib/module/games/bike-racing/BikeRacingStore.js.map +1 -0
- package/lib/module/games/bike-racing/components/BikeComponent.js +1 -0
- package/lib/module/games/bike-racing/components/BikeComponent.js.map +1 -0
- package/lib/module/games/bike-racing/components/GameBackground.js +1 -0
- package/lib/module/games/bike-racing/components/GameBackground.js.map +1 -0
- package/lib/module/games/bike-racing/components/ScoreBoard.js +1 -0
- package/lib/module/games/bike-racing/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/bike-racing/components/index.js +1 -0
- package/lib/module/games/bike-racing/components/index.js.map +1 -0
- package/lib/module/games/bike-racing/index.js +1 -0
- package/lib/module/games/bike-racing/index.js.map +1 -0
- package/lib/module/games/block-blast/BlockBlast.js +1 -0
- package/lib/module/games/block-blast/BlockBlast.js.map +1 -0
- package/lib/module/games/block-blast/BlockBlastConstants.js +1 -0
- package/lib/module/games/block-blast/BlockBlastConstants.js.map +1 -0
- package/lib/module/games/block-blast/BlockBlastService.js +1 -0
- package/lib/module/games/block-blast/BlockBlastService.js.map +1 -0
- package/lib/module/games/block-blast/BlockBlastStore.js +1 -0
- package/lib/module/games/block-blast/BlockBlastStore.js.map +1 -0
- package/lib/module/games/block-blast/components/BlockPieceComponent.js +1 -0
- package/lib/module/games/block-blast/components/BlockPieceComponent.js.map +1 -0
- package/lib/module/games/block-blast/components/GameArea.js +1 -0
- package/lib/module/games/block-blast/components/GameArea.js.map +1 -0
- package/lib/module/games/block-blast/components/GameBackground.js +1 -0
- package/lib/module/games/block-blast/components/GameBackground.js.map +1 -0
- package/lib/module/games/block-blast/components/GridComponent.js +1 -0
- package/lib/module/games/block-blast/components/GridComponent.js.map +1 -0
- package/lib/module/games/block-blast/components/ScoreBoard.js +1 -0
- package/lib/module/games/block-blast/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/block-blast/components/index.js +1 -0
- package/lib/module/games/block-blast/components/index.js.map +1 -0
- package/lib/module/games/block-blast/index.js +1 -0
- package/lib/module/games/block-blast/index.js.map +1 -0
- package/lib/module/games/bubble-shooter/BubbleShooter.js +1 -0
- package/lib/module/games/bubble-shooter/BubbleShooter.js.map +1 -0
- package/lib/module/games/bubble-shooter/BubbleShooterConstants.js +1 -0
- package/lib/module/games/bubble-shooter/BubbleShooterConstants.js.map +1 -0
- package/lib/module/games/bubble-shooter/BubbleShooterService.js +1 -0
- package/lib/module/games/bubble-shooter/BubbleShooterService.js.map +1 -0
- package/lib/module/games/bubble-shooter/BubbleShooterStore.js +1 -0
- package/lib/module/games/bubble-shooter/BubbleShooterStore.js.map +1 -0
- package/lib/module/games/bubble-shooter/components/GameArea.js +1 -0
- package/lib/module/games/bubble-shooter/components/GameArea.js.map +1 -0
- package/lib/module/games/bubble-shooter/components/GameBackground.js +1 -0
- package/lib/module/games/bubble-shooter/components/GameBackground.js.map +1 -0
- package/lib/module/games/bubble-shooter/components/ScoreBoard.js +1 -0
- package/lib/module/games/bubble-shooter/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/bubble-shooter/components/index.js +1 -0
- package/lib/module/games/bubble-shooter/components/index.js.map +1 -0
- package/lib/module/games/bubble-shooter/index.js +1 -0
- package/lib/module/games/bubble-shooter/index.js.map +1 -0
- package/lib/module/games/candy-crush/CandyCrush.js +1 -131
- package/lib/module/games/candy-crush/CandyCrush.js.map +1 -1
- package/lib/module/games/candy-crush/CandyCrushConstants.js +1 -125
- package/lib/module/games/candy-crush/CandyCrushConstants.js.map +1 -1
- package/lib/module/games/candy-crush/CandyCrushService.js +1 -370
- package/lib/module/games/candy-crush/CandyCrushStore.js +1 -303
- package/lib/module/games/candy-crush/components/CandyItem.js +1 -191
- package/lib/module/games/candy-crush/components/GameBackground.js +1 -85
- package/lib/module/games/candy-crush/components/GameGrid.js +1 -314
- package/lib/module/games/candy-crush/components/ScoreBoard.js +1 -79
- package/lib/module/games/candy-crush/components/index.js +1 -7
- package/lib/module/games/candy-crush/index.js +1 -6
- package/lib/module/games/car-racing/CarRacing.js +1 -0
- package/lib/module/games/car-racing/CarRacing.js.map +1 -0
- package/lib/module/games/car-racing/CarRacingConstants.js +1 -0
- package/lib/module/games/car-racing/CarRacingConstants.js.map +1 -0
- package/lib/module/games/car-racing/CarRacingService.js +1 -0
- package/lib/module/games/car-racing/CarRacingService.js.map +1 -0
- package/lib/module/games/car-racing/CarRacingStore.js +1 -0
- package/lib/module/games/car-racing/CarRacingStore.js.map +1 -0
- package/lib/module/games/car-racing/components/CarComponent.js +1 -0
- package/lib/module/games/car-racing/components/CarComponent.js.map +1 -0
- package/lib/module/games/car-racing/components/GameBackground.js +1 -0
- package/lib/module/games/car-racing/components/GameBackground.js.map +1 -0
- package/lib/module/games/car-racing/components/ScoreBoard.js +1 -0
- package/lib/module/games/car-racing/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/car-racing/components/index.js +1 -0
- package/lib/module/games/car-racing/components/index.js.map +1 -0
- package/lib/module/games/colors-sort/ColorsSort.js +1 -143
- package/lib/module/games/colors-sort/ColorsSort.js.map +1 -1
- package/lib/module/games/colors-sort/ColorsSortConstants.js +1 -72
- package/lib/module/games/colors-sort/ColorsSortConstants.js.map +1 -1
- package/lib/module/games/colors-sort/ColorsSortService.js +1 -255
- package/lib/module/games/colors-sort/ColorsSortStore.js +1 -257
- package/lib/module/games/colors-sort/ColorsSortStore.js.map +1 -1
- package/lib/module/games/colors-sort/components/ColorContainer.js +1 -140
- package/lib/module/games/colors-sort/components/GameBackground.js +1 -135
- package/lib/module/games/colors-sort/components/ScoreBoard.js +1 -70
- package/lib/module/games/colors-sort/components/index.js +1 -6
- package/lib/module/games/dino-jump/DinoJump.js +1 -209
- package/lib/module/games/dino-jump/DinoJump.js.map +1 -1
- package/lib/module/games/dino-jump/DinoJumpConstants.js +1 -189
- package/lib/module/games/dino-jump/DinoJumpConstants.js.map +1 -1
- package/lib/module/games/dino-jump/DinoJumpService.js +1 -270
- package/lib/module/games/dino-jump/DinoJumpStore.js +1 -381
- package/lib/module/games/dino-jump/components/DinoSprite.js +1 -418
- package/lib/module/games/dino-jump/components/DinoSprite.js.map +1 -1
- package/lib/module/games/dino-jump/components/GameArea.js +1 -68
- package/lib/module/games/dino-jump/components/GameBackground.js +1 -444
- package/lib/module/games/dino-jump/components/ObstacleSprite.js +1 -306
- package/lib/module/games/dino-jump/components/ScoreBoard.js +1 -105
- package/lib/module/games/dino-jump/components/ScoreBoard.js.map +1 -1
- package/lib/module/games/dino-jump/components/StarSprite.js +1 -45
- package/lib/module/games/dino-jump/components/index.js +1 -9
- package/lib/module/games/flappy-bird/FlappyBird.js +1 -126
- package/lib/module/games/flappy-bird/FlappyBird.js.map +1 -1
- package/lib/module/games/flappy-bird/FlappyBirdConstants.js +1 -90
- package/lib/module/games/flappy-bird/FlappyBirdConstants.js.map +1 -1
- package/lib/module/games/flappy-bird/FlappyBirdStore.js +1 -300
- package/lib/module/games/flappy-bird/components/Bird.js +1 -87
- package/lib/module/games/flappy-bird/components/GameArea.js +1 -87
- package/lib/module/games/flappy-bird/components/GameBackground.js +1 -79
- package/lib/module/games/flappy-bird/components/Pipes.js +1 -172
- package/lib/module/games/flappy-bird/components/ScoreBoard.js +1 -73
- package/lib/module/games/flappy-bird/components/index.js +1 -8
- package/lib/module/games/fruit-merger/FruitMerger.js +1 -120
- package/lib/module/games/fruit-merger/FruitMerger.js.map +1 -1
- package/lib/module/games/fruit-merger/FruitMergerConstants.js +1 -119
- package/lib/module/games/fruit-merger/FruitMergerConstants.js.map +1 -1
- package/lib/module/games/fruit-merger/FruitMergerService.js +1 -13
- package/lib/module/games/fruit-merger/FruitMergerStore.js +1 -315
- package/lib/module/games/fruit-merger/components/FruitItem.js +1 -102
- package/lib/module/games/fruit-merger/components/GameArea.js +1 -103
- package/lib/module/games/fruit-merger/components/GameBackground.js +1 -498
- package/lib/module/games/fruit-merger/components/ScoreBoard.js +1 -58
- package/lib/module/games/fruit-merger/components/index.js +1 -7
- package/lib/module/games/fruit-ninja/FruitNinja.js +1 -134
- package/lib/module/games/fruit-ninja/FruitNinja.js.map +1 -1
- package/lib/module/games/fruit-ninja/FruitNinjaConstants.js +1 -148
- package/lib/module/games/fruit-ninja/FruitNinjaConstants.js.map +1 -1
- package/lib/module/games/fruit-ninja/FruitNinjaService.js +1 -311
- package/lib/module/games/fruit-ninja/FruitNinjaStore.js +1 -191
- package/lib/module/games/fruit-ninja/FruitNinjaStore.js.map +1 -1
- package/lib/module/games/fruit-ninja/components/FruitComponent.js +1 -99
- package/lib/module/games/fruit-ninja/components/GameArea.js +1 -215
- package/lib/module/games/fruit-ninja/components/GameBackground.js +1 -1267
- package/lib/module/games/fruit-ninja/components/ScoreBoard.js +1 -92
- package/lib/module/games/fruit-ninja/components/ScoreBoard.js.map +1 -1
- package/lib/module/games/fruit-ninja/components/index.js +1 -7
- package/lib/module/games/game-2048/Game2048.js +1 -149
- package/lib/module/games/game-2048/Game2048.js.map +1 -1
- package/lib/module/games/game-2048/Game2048Constants.js +1 -263
- package/lib/module/games/game-2048/Game2048Constants.js.map +1 -1
- package/lib/module/games/game-2048/Game2048Service.js +1 -457
- package/lib/module/games/game-2048/Game2048Store.js +1 -236
- package/lib/module/games/game-2048/components/GameBackground.js +1 -247
- package/lib/module/games/game-2048/components/GameGrid.js +1 -139
- package/lib/module/games/game-2048/components/GameTile.js +1 -72
- package/lib/module/games/game-2048/components/ScoreBoard.js +1 -52
- package/lib/module/games/game-2048/components/index.js +1 -7
- package/lib/module/games/maze-runner/MazeRunner.js +1 -267
- package/lib/module/games/maze-runner/MazeRunner.js.map +1 -1
- package/lib/module/games/maze-runner/MazeRunnerConstants.js +1 -100
- package/lib/module/games/maze-runner/MazeRunnerConstants.js.map +1 -1
- package/lib/module/games/maze-runner/MazeRunnerService.js +1 -586
- package/lib/module/games/maze-runner/components/EnhancedBallComponent.js +1 -150
- package/lib/module/games/maze-runner/components/EnhancedGameArea.js +1 -370
- package/lib/module/games/maze-runner/components/GameBackground.js +1 -175
- package/lib/module/games/maze-runner/components/ScoreBoard.js +1 -61
- package/lib/module/games/maze-runner/components/SkiaPipeComponent.js +1 -209
- package/lib/module/games/maze-runner/components/StaticGameBackground.js +1 -169
- package/lib/module/games/maze-runner/components/WallComponent.js +1 -91
- package/lib/module/games/maze-runner/components/index.js +1 -8
- package/lib/module/games/perfect-circle/PerfectCircle.js +1 -0
- package/lib/module/games/perfect-circle/PerfectCircle.js.map +1 -0
- package/lib/module/games/perfect-circle/PerfectCircleConstants.js +1 -0
- package/lib/module/games/perfect-circle/PerfectCircleConstants.js.map +1 -0
- package/lib/module/games/perfect-circle/PerfectCircleService.js +1 -0
- package/lib/module/games/perfect-circle/PerfectCircleService.js.map +1 -0
- package/lib/module/games/perfect-circle/PerfectCircleStore.js +1 -0
- package/lib/module/games/perfect-circle/PerfectCircleStore.js.map +1 -0
- package/lib/module/games/perfect-circle/components/DrawingCanvas.js +1 -0
- package/lib/module/games/perfect-circle/components/DrawingCanvas.js.map +1 -0
- package/lib/module/games/perfect-circle/components/GameBackground.js +1 -0
- package/lib/module/games/perfect-circle/components/GameBackground.js.map +1 -0
- package/lib/module/games/perfect-circle/components/ScoreBoard.js +1 -0
- package/lib/module/games/perfect-circle/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/perfect-circle/index.js +1 -0
- package/lib/module/games/perfect-circle/index.js.map +1 -0
- package/lib/module/games/popit-fidget/PopitFidget.js +1 -285
- package/lib/module/games/popit-fidget/PopitFidget.js.map +1 -1
- package/lib/module/games/popit-fidget/PopitFidgetConstants.js +1 -113
- package/lib/module/games/popit-fidget/PopitFidgetConstants.js.map +1 -1
- package/lib/module/games/popit-fidget/PopitFidgetService.js +1 -132
- package/lib/module/games/popit-fidget/PopitFidgetStore.js +1 -125
- package/lib/module/games/popit-fidget/components/BubbleComponent.js +1 -198
- package/lib/module/games/popit-fidget/components/FidgetGrid.js +1 -165
- package/lib/module/games/popit-fidget/components/GameBackground.js +1 -177
- package/lib/module/games/popit-fidget/components/ScoreBoard.js +1 -61
- package/lib/module/games/popit-fidget/components/index.js +1 -7
- package/lib/module/games/sliding-numbers/SlidingNumbers.js +1 -159
- package/lib/module/games/sliding-numbers/SlidingNumbers.js.map +1 -1
- package/lib/module/games/sliding-numbers/SlidingNumbersConstants.js +1 -207
- package/lib/module/games/sliding-numbers/SlidingNumbersConstants.js.map +1 -1
- package/lib/module/games/sliding-numbers/SlidingNumbersService.js +1 -248
- package/lib/module/games/sliding-numbers/SlidingNumbersStore.js +1 -274
- package/lib/module/games/sliding-numbers/components/GameBackground.js +1 -259
- package/lib/module/games/sliding-numbers/components/NumbersGrid.js +1 -174
- package/lib/module/games/sliding-numbers/components/NumbersTile.js +1 -116
- package/lib/module/games/sliding-numbers/components/ScoreBoard.js +1 -64
- package/lib/module/games/sliding-numbers/components/index.js +1 -7
- package/lib/module/games/snake/Snake.js +1 -189
- package/lib/module/games/snake/Snake.js.map +1 -1
- package/lib/module/games/snake/SnakeConstants.js +1 -138
- package/lib/module/games/snake/SnakeConstants.js.map +1 -1
- package/lib/module/games/snake/SnakeService.js +1 -148
- package/lib/module/games/snake/SnakeStore.js +1 -182
- package/lib/module/games/snake/SnakeStore.js.map +1 -1
- package/lib/module/games/snake/components/GameBackground.js +1 -221
- package/lib/module/games/snake/components/GameGrid.js +1 -153
- package/lib/module/games/snake/components/ScoreBoard.js +1 -51
- package/lib/module/games/snake/components/ScoreBoard.js.map +1 -1
- package/lib/module/games/snake/components/index.js +1 -6
- package/lib/module/games/snake/index.js +1 -6
- package/lib/module/games/space-fighter/SpaceFighter.js +1 -165
- package/lib/module/games/space-fighter/SpaceFighter.js.map +1 -1
- package/lib/module/games/space-fighter/SpaceFighterConstants.js +1 -108
- package/lib/module/games/space-fighter/SpaceFighterConstants.js.map +1 -1
- package/lib/module/games/space-fighter/SpaceFighterService.js +1 -326
- package/lib/module/games/space-fighter/SpaceFighterStore.js +1 -209
- package/lib/module/games/space-fighter/components/AsteroidComponent.js +1 -113
- package/lib/module/games/space-fighter/components/GameArea.js +1 -289
- package/lib/module/games/space-fighter/components/GameBackground.js +1 -239
- package/lib/module/games/space-fighter/components/ScoreBoard.js +1 -136
- package/lib/module/games/space-fighter/components/Spacecraft3D.js +1 -202
- package/lib/module/games/space-fighter/components/SpacecraftPath.js +1 -52
- package/lib/module/games/space-fighter/components/index.js +1 -9
- package/lib/module/games/whack-a-mole/WhackAMole.js +1 -270
- package/lib/module/games/whack-a-mole/WhackAMole.js.map +1 -1
- package/lib/module/games/whack-a-mole/WhackAMoleConstants.js +1 -115
- package/lib/module/games/whack-a-mole/WhackAMoleConstants.js.map +1 -1
- package/lib/module/games/whack-a-mole/WhackAMoleService.js +1 -120
- package/lib/module/games/whack-a-mole/WhackAMoleStore.js +1 -172
- package/lib/module/games/whack-a-mole/components/GameBackground.js +1 -477
- package/lib/module/games/whack-a-mole/components/GameGrid.js +1 -97
- package/lib/module/games/whack-a-mole/components/GameHole.js +1 -196
- package/lib/module/games/whack-a-mole/components/MoleCharacter.js +1 -241
- package/lib/module/games/whack-a-mole/components/ScoreBoard.js +1 -67
- package/lib/module/games/whack-a-mole/components/ScoreBoard.js.map +1 -1
- package/lib/module/games/whack-a-mole/components/index.js +1 -8
- package/lib/module/helpers/AnimationFrame.js +1 -120
- package/lib/module/helpers/AnimationTracker.js +1 -89
- package/lib/module/helpers/ErrorHandler.js +1 -269
- package/lib/module/helpers/GameControlButton.js +1 -219
- package/lib/module/helpers/GameOverModal.js +1 -144
- package/lib/module/helpers/GameOverModal.js.map +1 -1
- package/lib/module/helpers/GameSettingsModal.js +1 -287
- package/lib/module/helpers/GameSettingsModal.js.map +1 -1
- package/lib/module/helpers/ParticleBlast.js +1 -134
- package/lib/module/helpers/ScoreBoardContainer.js +1 -34
- package/lib/module/helpers/ScoreBoardContainer.js.map +1 -1
- package/lib/module/helpers/index.js +1 -12
- package/lib/module/index.js +1 -22
- package/lib/module/index.js.map +1 -1
- package/lib/module/services/GamesConstants.js +1 -178
- package/lib/module/services/GamesConstants.js.map +1 -1
- package/lib/module/services/GamesService.js +1 -112
- package/lib/module/services/GamesService.js.map +1 -1
- package/lib/module/services/HapticsService.js +1 -77
- package/lib/module/services/ScoringService.js +1 -0
- package/lib/module/services/ScoringService.js.map +1 -0
- package/lib/module/services/SoundsService.js +1 -302
- package/lib/module/services/SoundsService.js.map +1 -1
- package/lib/module/services/UtilsService.js +1 -32
- package/lib/module/services/UtilsService.js.map +1 -1
- package/lib/typescript/src/games/balloon-blaster/BalloonBlaster.d.ts.map +1 -1
- package/lib/typescript/src/games/balloon-blaster/BalloonBlasterConstants.d.ts +1 -1
- package/lib/typescript/src/games/balloon-blaster/components/ScoreBoard.d.ts.map +1 -1
- package/lib/typescript/src/games/bike-racing/BikeRacing.d.ts +4 -0
- package/lib/typescript/src/games/bike-racing/BikeRacing.d.ts.map +1 -0
- package/lib/typescript/src/games/bike-racing/BikeRacingConstants.d.ts +76 -0
- package/lib/typescript/src/games/bike-racing/BikeRacingConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/bike-racing/BikeRacingService.d.ts +22 -0
- package/lib/typescript/src/games/bike-racing/BikeRacingService.d.ts.map +1 -0
- package/lib/typescript/src/games/bike-racing/BikeRacingStore.d.ts +72 -0
- package/lib/typescript/src/games/bike-racing/BikeRacingStore.d.ts.map +1 -0
- package/lib/typescript/src/games/bike-racing/components/BikeComponent.d.ts +12 -0
- package/lib/typescript/src/games/bike-racing/components/BikeComponent.d.ts.map +1 -0
- package/lib/typescript/src/games/bike-racing/components/GameBackground.d.ts +9 -0
- package/lib/typescript/src/games/bike-racing/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/bike-racing/components/ScoreBoard.d.ts +7 -0
- package/lib/typescript/src/games/bike-racing/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/bike-racing/components/index.d.ts +4 -0
- package/lib/typescript/src/games/bike-racing/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/bike-racing/index.d.ts +5 -0
- package/lib/typescript/src/games/bike-racing/index.d.ts.map +1 -0
- package/lib/typescript/src/games/block-blast/BlockBlast.d.ts +4 -0
- package/lib/typescript/src/games/block-blast/BlockBlast.d.ts.map +1 -0
- package/lib/typescript/src/games/block-blast/BlockBlastConstants.d.ts +82 -0
- package/lib/typescript/src/games/block-blast/BlockBlastConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/block-blast/BlockBlastService.d.ts +17 -0
- package/lib/typescript/src/games/block-blast/BlockBlastService.d.ts.map +1 -0
- package/lib/typescript/src/games/block-blast/BlockBlastStore.d.ts +62 -0
- package/lib/typescript/src/games/block-blast/BlockBlastStore.d.ts.map +1 -0
- package/lib/typescript/src/games/block-blast/components/BlockPieceComponent.d.ts +14 -0
- package/lib/typescript/src/games/block-blast/components/BlockPieceComponent.d.ts.map +1 -0
- package/lib/typescript/src/games/block-blast/components/GameArea.d.ts +12 -0
- package/lib/typescript/src/games/block-blast/components/GameArea.d.ts.map +1 -0
- package/lib/typescript/src/games/block-blast/components/GameBackground.d.ts +7 -0
- package/lib/typescript/src/games/block-blast/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/block-blast/components/GridComponent.d.ts +17 -0
- package/lib/typescript/src/games/block-blast/components/GridComponent.d.ts.map +1 -0
- package/lib/typescript/src/games/block-blast/components/ScoreBoard.d.ts +7 -0
- package/lib/typescript/src/games/block-blast/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/block-blast/components/index.d.ts +6 -0
- package/lib/typescript/src/games/block-blast/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/block-blast/index.d.ts +5 -0
- package/lib/typescript/src/games/block-blast/index.d.ts.map +1 -0
- package/lib/typescript/src/games/bubble-shooter/BubbleShooter.d.ts +4 -0
- package/lib/typescript/src/games/bubble-shooter/BubbleShooter.d.ts.map +1 -0
- package/lib/typescript/src/games/bubble-shooter/BubbleShooterConstants.d.ts +61 -0
- package/lib/typescript/src/games/bubble-shooter/BubbleShooterConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/bubble-shooter/BubbleShooterService.d.ts +26 -0
- package/lib/typescript/src/games/bubble-shooter/BubbleShooterService.d.ts.map +1 -0
- package/lib/typescript/src/games/bubble-shooter/BubbleShooterStore.d.ts +62 -0
- package/lib/typescript/src/games/bubble-shooter/BubbleShooterStore.d.ts.map +1 -0
- package/lib/typescript/src/games/bubble-shooter/components/GameArea.d.ts +9 -0
- package/lib/typescript/src/games/bubble-shooter/components/GameArea.d.ts.map +1 -0
- package/lib/typescript/src/games/bubble-shooter/components/GameBackground.d.ts +8 -0
- package/lib/typescript/src/games/bubble-shooter/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/bubble-shooter/components/ScoreBoard.d.ts +7 -0
- package/lib/typescript/src/games/bubble-shooter/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/bubble-shooter/components/index.d.ts +4 -0
- package/lib/typescript/src/games/bubble-shooter/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/bubble-shooter/index.d.ts +3 -0
- package/lib/typescript/src/games/bubble-shooter/index.d.ts.map +1 -0
- package/lib/typescript/src/games/candy-crush/CandyCrush.d.ts.map +1 -1
- package/lib/typescript/src/games/candy-crush/CandyCrushConstants.d.ts +7 -7
- package/lib/typescript/src/games/car-racing/CarRacing.d.ts +4 -0
- package/lib/typescript/src/games/car-racing/CarRacing.d.ts.map +1 -0
- package/lib/typescript/src/games/car-racing/CarRacingConstants.d.ts +76 -0
- package/lib/typescript/src/games/car-racing/CarRacingConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/car-racing/CarRacingService.d.ts +22 -0
- package/lib/typescript/src/games/car-racing/CarRacingService.d.ts.map +1 -0
- package/lib/typescript/src/games/car-racing/CarRacingStore.d.ts +72 -0
- package/lib/typescript/src/games/car-racing/CarRacingStore.d.ts.map +1 -0
- package/lib/typescript/src/games/car-racing/components/CarComponent.d.ts +13 -0
- package/lib/typescript/src/games/car-racing/components/CarComponent.d.ts.map +1 -0
- package/lib/typescript/src/games/car-racing/components/GameBackground.d.ts +9 -0
- package/lib/typescript/src/games/car-racing/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/car-racing/components/ScoreBoard.d.ts +7 -0
- package/lib/typescript/src/games/car-racing/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/car-racing/components/index.d.ts +4 -0
- package/lib/typescript/src/games/car-racing/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/colors-sort/ColorsSort.d.ts.map +1 -1
- package/lib/typescript/src/games/colors-sort/ColorsSortStore.d.ts.map +1 -1
- package/lib/typescript/src/games/dino-jump/DinoJump.d.ts.map +1 -1
- package/lib/typescript/src/games/dino-jump/components/DinoSprite.d.ts.map +1 -1
- package/lib/typescript/src/games/flappy-bird/FlappyBird.d.ts.map +1 -1
- package/lib/typescript/src/games/flappy-bird/FlappyBirdConstants.d.ts.map +1 -1
- package/lib/typescript/src/games/fruit-merger/FruitMerger.d.ts.map +1 -1
- package/lib/typescript/src/games/fruit-merger/FruitMergerConstants.d.ts.map +1 -1
- package/lib/typescript/src/games/fruit-ninja/FruitNinja.d.ts.map +1 -1
- package/lib/typescript/src/games/fruit-ninja/components/ScoreBoard.d.ts.map +1 -1
- package/lib/typescript/src/games/game-2048/Game2048.d.ts.map +1 -1
- package/lib/typescript/src/games/maze-runner/MazeRunner.d.ts.map +1 -1
- package/lib/typescript/src/games/perfect-circle/PerfectCircle.d.ts +4 -0
- package/lib/typescript/src/games/perfect-circle/PerfectCircle.d.ts.map +1 -0
- package/lib/typescript/src/games/perfect-circle/PerfectCircleConstants.d.ts +81 -0
- package/lib/typescript/src/games/perfect-circle/PerfectCircleConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/perfect-circle/PerfectCircleService.d.ts +14 -0
- package/lib/typescript/src/games/perfect-circle/PerfectCircleService.d.ts.map +1 -0
- package/lib/typescript/src/games/perfect-circle/PerfectCircleStore.d.ts +40 -0
- package/lib/typescript/src/games/perfect-circle/PerfectCircleStore.d.ts.map +1 -0
- package/lib/typescript/src/games/perfect-circle/components/DrawingCanvas.d.ts +9 -0
- package/lib/typescript/src/games/perfect-circle/components/DrawingCanvas.d.ts.map +1 -0
- package/lib/typescript/src/games/perfect-circle/components/GameBackground.d.ts +8 -0
- package/lib/typescript/src/games/perfect-circle/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/perfect-circle/components/ScoreBoard.d.ts +7 -0
- package/lib/typescript/src/games/perfect-circle/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/perfect-circle/index.d.ts +3 -0
- package/lib/typescript/src/games/perfect-circle/index.d.ts.map +1 -0
- package/lib/typescript/src/games/popit-fidget/PopitFidget.d.ts.map +1 -1
- package/lib/typescript/src/games/sliding-numbers/SlidingNumbers.d.ts.map +1 -1
- package/lib/typescript/src/games/snake/Snake.d.ts.map +1 -1
- package/lib/typescript/src/games/snake/SnakeStore.d.ts +4 -0
- package/lib/typescript/src/games/snake/SnakeStore.d.ts.map +1 -1
- package/lib/typescript/src/games/snake/components/ScoreBoard.d.ts.map +1 -1
- package/lib/typescript/src/games/space-fighter/SpaceFighter.d.ts.map +1 -1
- package/lib/typescript/src/games/whack-a-mole/WhackAMole.d.ts.map +1 -1
- package/lib/typescript/src/games/whack-a-mole/WhackAMoleConstants.d.ts +1 -1
- package/lib/typescript/src/games/whack-a-mole/components/ScoreBoard.d.ts.map +1 -1
- package/lib/typescript/src/helpers/GameOverModal.d.ts +3 -0
- package/lib/typescript/src/helpers/GameOverModal.d.ts.map +1 -1
- package/lib/typescript/src/helpers/ScoreBoardContainer.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +6 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/services/GamesConstants.d.ts +57 -7
- package/lib/typescript/src/services/GamesConstants.d.ts.map +1 -1
- package/lib/typescript/src/services/GamesService.d.ts +2 -1
- package/lib/typescript/src/services/GamesService.d.ts.map +1 -1
- package/lib/typescript/src/services/ScoringService.d.ts +2 -0
- package/lib/typescript/src/services/ScoringService.d.ts.map +1 -0
- package/lib/typescript/src/services/SoundsService.d.ts +88 -0
- package/lib/typescript/src/services/SoundsService.d.ts.map +1 -1
- package/lib/typescript/src/services/UtilsService.d.ts +12 -1
- package/lib/typescript/src/services/UtilsService.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,221 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { Canvas, Rect, LinearGradient, vec, Circle, RoundedRect } from '@shopify/react-native-skia';
|
|
5
|
-
import { Dimensions, View } from 'react-native';
|
|
6
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
const {
|
|
8
|
-
width,
|
|
9
|
-
height
|
|
10
|
-
} = Dimensions.get('window');
|
|
11
|
-
|
|
12
|
-
// Snake-themed vibrant neon colors
|
|
13
|
-
const SNAKE_NEON_COLORS = ['#00ff88',
|
|
14
|
-
// Neon green (primary)
|
|
15
|
-
'#00ffaa',
|
|
16
|
-
// Bright mint
|
|
17
|
-
'#00cc6a',
|
|
18
|
-
// Medium green
|
|
19
|
-
'#00dd77',
|
|
20
|
-
// Lime green
|
|
21
|
-
'#00ff99',
|
|
22
|
-
// Light green
|
|
23
|
-
'#00ee77',
|
|
24
|
-
// Bright green
|
|
25
|
-
'#00bb55',
|
|
26
|
-
// Forest green
|
|
27
|
-
'#00aa44' // Deep green
|
|
28
|
-
];
|
|
29
|
-
export const GameBackground = /*#__PURE__*/React.memo(({
|
|
30
|
-
children
|
|
31
|
-
}) => {
|
|
32
|
-
// Generate static floating snake-themed elements
|
|
33
|
-
const generateFloatingElements = React.useMemo(() => {
|
|
34
|
-
const elements = [];
|
|
35
|
-
const elementCount = 20;
|
|
36
|
-
for (let i = 0; i < elementCount; i++) {
|
|
37
|
-
const baseX = width / elementCount * i;
|
|
38
|
-
const baseY = height / elementCount * i;
|
|
39
|
-
|
|
40
|
-
// Add random offset for natural look
|
|
41
|
-
const x = baseX + Math.sin(i * 0.5) * 60 + Math.random() * 80;
|
|
42
|
-
const y = baseY + Math.cos(i * 0.7) * 70 + Math.random() * 100;
|
|
43
|
-
const size = 15 + Math.random() * 25;
|
|
44
|
-
const colorIndex = i % SNAKE_NEON_COLORS.length;
|
|
45
|
-
const opacity = 0.15 + Math.sin(i) * 0.1;
|
|
46
|
-
const elementX = Math.max(size / 2, Math.min(width - size, x));
|
|
47
|
-
const elementY = Math.max(size / 2, Math.min(height - size, y));
|
|
48
|
-
|
|
49
|
-
// Create different shapes for variety
|
|
50
|
-
if (i % 3 === 0) {
|
|
51
|
-
// Circular elements (like snake segments)
|
|
52
|
-
elements.push(/*#__PURE__*/_jsx(Circle, {
|
|
53
|
-
cx: elementX + size / 2,
|
|
54
|
-
cy: elementY + size / 2,
|
|
55
|
-
r: size / 2,
|
|
56
|
-
color: `${SNAKE_NEON_COLORS[colorIndex]}${Math.floor(opacity * 255).toString(16).padStart(2, '0')}`
|
|
57
|
-
}, `circle-${i}`));
|
|
58
|
-
} else {
|
|
59
|
-
// Rounded rectangles (like snake body parts)
|
|
60
|
-
elements.push(/*#__PURE__*/_jsx(RoundedRect, {
|
|
61
|
-
x: elementX,
|
|
62
|
-
y: elementY,
|
|
63
|
-
width: size,
|
|
64
|
-
height: size,
|
|
65
|
-
r: size * 0.3,
|
|
66
|
-
color: `${SNAKE_NEON_COLORS[colorIndex]}${Math.floor(opacity * 255).toString(16).padStart(2, '0')}`
|
|
67
|
-
}, `rect-${i}`));
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return elements;
|
|
71
|
-
}, []);
|
|
72
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
73
|
-
style: {
|
|
74
|
-
flex: 1
|
|
75
|
-
},
|
|
76
|
-
children: [/*#__PURE__*/_jsxs(Canvas, {
|
|
77
|
-
style: {
|
|
78
|
-
position: 'absolute',
|
|
79
|
-
top: 0,
|
|
80
|
-
left: 0,
|
|
81
|
-
right: 0,
|
|
82
|
-
bottom: 0,
|
|
83
|
-
width,
|
|
84
|
-
height
|
|
85
|
-
},
|
|
86
|
-
children: [/*#__PURE__*/_jsx(Rect, {
|
|
87
|
-
x: 0,
|
|
88
|
-
y: 0,
|
|
89
|
-
width: width,
|
|
90
|
-
height: height,
|
|
91
|
-
children: /*#__PURE__*/_jsx(LinearGradient, {
|
|
92
|
-
start: vec(0, 0),
|
|
93
|
-
end: vec(width, height),
|
|
94
|
-
colors: ['#1a1a2e',
|
|
95
|
-
// Dark base
|
|
96
|
-
'#252541',
|
|
97
|
-
// Purple-blue
|
|
98
|
-
'#1e3a3a',
|
|
99
|
-
// Dark teal
|
|
100
|
-
'#1a2e1a',
|
|
101
|
-
// Dark green
|
|
102
|
-
'#1a1a2e' // Back to dark
|
|
103
|
-
]
|
|
104
|
-
})
|
|
105
|
-
}), /*#__PURE__*/_jsx(Rect, {
|
|
106
|
-
x: 0,
|
|
107
|
-
y: 0,
|
|
108
|
-
width: width,
|
|
109
|
-
height: height,
|
|
110
|
-
children: /*#__PURE__*/_jsx(LinearGradient, {
|
|
111
|
-
start: vec(0, 0),
|
|
112
|
-
end: vec(width / 2, height / 2),
|
|
113
|
-
colors: [`${SNAKE_NEON_COLORS[0]}15`,
|
|
114
|
-
// Neon green
|
|
115
|
-
'transparent', `${SNAKE_NEON_COLORS[1]}10`,
|
|
116
|
-
// Bright mint
|
|
117
|
-
'transparent', `${SNAKE_NEON_COLORS[4]}15`,
|
|
118
|
-
// Light green
|
|
119
|
-
'transparent']
|
|
120
|
-
})
|
|
121
|
-
}), /*#__PURE__*/_jsx(Rect, {
|
|
122
|
-
x: 0,
|
|
123
|
-
y: 0,
|
|
124
|
-
width: width,
|
|
125
|
-
height: height,
|
|
126
|
-
children: /*#__PURE__*/_jsx(LinearGradient, {
|
|
127
|
-
start: vec(width, 0),
|
|
128
|
-
end: vec(0, height),
|
|
129
|
-
colors: [`${SNAKE_NEON_COLORS[2]}12`,
|
|
130
|
-
// Medium green
|
|
131
|
-
'transparent', `${SNAKE_NEON_COLORS[5]}10`,
|
|
132
|
-
// Bright green
|
|
133
|
-
'transparent', `${SNAKE_NEON_COLORS[3]}12`,
|
|
134
|
-
// Lime green
|
|
135
|
-
'transparent']
|
|
136
|
-
})
|
|
137
|
-
}), generateFloatingElements, /*#__PURE__*/_jsx(Circle, {
|
|
138
|
-
cx: width * 0.12,
|
|
139
|
-
cy: height * 0.15,
|
|
140
|
-
r: 35,
|
|
141
|
-
color: `${SNAKE_NEON_COLORS[0]}30`
|
|
142
|
-
}), /*#__PURE__*/_jsx(RoundedRect, {
|
|
143
|
-
x: width * 0.82,
|
|
144
|
-
y: height * 0.78,
|
|
145
|
-
width: 45,
|
|
146
|
-
height: 45,
|
|
147
|
-
r: 12,
|
|
148
|
-
color: `${SNAKE_NEON_COLORS[1]}35`
|
|
149
|
-
}), /*#__PURE__*/_jsx(Circle, {
|
|
150
|
-
cx: width * 0.85,
|
|
151
|
-
cy: height * 0.2,
|
|
152
|
-
r: 28,
|
|
153
|
-
color: `${SNAKE_NEON_COLORS[2]}30`
|
|
154
|
-
}), /*#__PURE__*/_jsx(RoundedRect, {
|
|
155
|
-
x: width * 0.08,
|
|
156
|
-
y: height * 0.75,
|
|
157
|
-
width: 50,
|
|
158
|
-
height: 50,
|
|
159
|
-
r: 15,
|
|
160
|
-
color: `${SNAKE_NEON_COLORS[3]}35`
|
|
161
|
-
}), /*#__PURE__*/_jsx(Circle, {
|
|
162
|
-
cx: width * 0.5,
|
|
163
|
-
cy: height * 0.1,
|
|
164
|
-
r: 25,
|
|
165
|
-
color: `${SNAKE_NEON_COLORS[4]}28`
|
|
166
|
-
}), /*#__PURE__*/_jsx(RoundedRect, {
|
|
167
|
-
x: width * 0.1,
|
|
168
|
-
y: height * 0.45,
|
|
169
|
-
width: 40,
|
|
170
|
-
height: 40,
|
|
171
|
-
r: 10,
|
|
172
|
-
color: `${SNAKE_NEON_COLORS[5]}32`
|
|
173
|
-
}), /*#__PURE__*/_jsx(Circle, {
|
|
174
|
-
cx: width * 0.88,
|
|
175
|
-
cy: height * 0.55,
|
|
176
|
-
r: 30,
|
|
177
|
-
color: `${SNAKE_NEON_COLORS[6]}30`
|
|
178
|
-
}), /*#__PURE__*/_jsx(RoundedRect, {
|
|
179
|
-
x: width * 0.55,
|
|
180
|
-
y: height * 0.85,
|
|
181
|
-
width: 35,
|
|
182
|
-
height: 35,
|
|
183
|
-
r: 8,
|
|
184
|
-
color: `${SNAKE_NEON_COLORS[7]}33`
|
|
185
|
-
}), /*#__PURE__*/_jsx(Circle, {
|
|
186
|
-
cx: width * 0.3,
|
|
187
|
-
cy: height * 0.3,
|
|
188
|
-
r: 20,
|
|
189
|
-
color: `${SNAKE_NEON_COLORS[0]}25`
|
|
190
|
-
}), /*#__PURE__*/_jsx(Circle, {
|
|
191
|
-
cx: width * 0.7,
|
|
192
|
-
cy: height * 0.4,
|
|
193
|
-
r: 24,
|
|
194
|
-
color: `${SNAKE_NEON_COLORS[1]}28`
|
|
195
|
-
}), /*#__PURE__*/_jsx(Circle, {
|
|
196
|
-
cx: width * 0.4,
|
|
197
|
-
cy: height * 0.65,
|
|
198
|
-
r: 18,
|
|
199
|
-
color: `${SNAKE_NEON_COLORS[2]}26`
|
|
200
|
-
}), Array.from({
|
|
201
|
-
length: Math.floor(width / 70)
|
|
202
|
-
}, (_, i) => /*#__PURE__*/_jsx(Rect, {
|
|
203
|
-
x: i * 70,
|
|
204
|
-
y: 0,
|
|
205
|
-
width: 1,
|
|
206
|
-
height: height,
|
|
207
|
-
color: "rgba(0, 255, 136, 0.04)"
|
|
208
|
-
}, `grid-v-${i}`)), Array.from({
|
|
209
|
-
length: Math.floor(height / 70)
|
|
210
|
-
}, (_, i) => /*#__PURE__*/_jsx(Rect, {
|
|
211
|
-
x: 0,
|
|
212
|
-
y: i * 70,
|
|
213
|
-
width: width,
|
|
214
|
-
height: 1,
|
|
215
|
-
color: "rgba(0, 255, 136, 0.04)"
|
|
216
|
-
}, `grid-h-${i}`))]
|
|
217
|
-
}), children]
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
-
GameBackground.displayName = 'GameBackground';
|
|
221
|
-
//# sourceMappingURL=GameBackground.js.map
|
|
1
|
+
"use strict";import React from 'react';import{Canvas,Rect,LinearGradient,vec,Circle,RoundedRect}from '@shopify/react-native-skia';import{Dimensions,View}from 'react-native';import{jsx as _jsx,jsxs as _jsxs}from "react/jsx-runtime";const{width,height}= Dimensions.get('window');const SNAKE_NEON_COLORS = ['#00ff88','#00ffaa','#00cc6a','#00dd77','#00ff99','#00ee77','#00bb55','#00aa44' ];export const GameBackground = React.memo(({children})=>{const generateFloatingElements = React.useMemo(()=>{const elements = [];const elementCount = 20;for(let i = 0;i < elementCount;i++){const baseX = width / elementCount * i;const baseY = height / elementCount * i;const x = baseX + Math.sin(i * 0.5)* 60 + Math.random()* 80;const y = baseY + Math.cos(i * 0.7)* 70 + Math.random()* 100;const size = 15 + Math.random()* 25;const colorIndex = i % SNAKE_NEON_COLORS.length;const opacity = 0.15 + Math.sin(i)* 0.1;const elementX = Math.max(size / 2,Math.min(width - size,x));const elementY = Math.max(size / 2,Math.min(height - size,y));if(i % 3 === 0){elements.push(_jsx(Circle,{cx:elementX + size / 2,cy:elementY + size / 2,r:size / 2,color:`${SNAKE_NEON_COLORS[colorIndex]}${Math.floor(opacity * 255).toString(16).padStart(2,'0')}`},`circle-${i}`));}else{elements.push(_jsx(RoundedRect,{x:elementX,y:elementY,width:size,height:size,r:size * 0.3,color:`${SNAKE_NEON_COLORS[colorIndex]}${Math.floor(opacity * 255).toString(16).padStart(2,'0')}`},`rect-${i}`));}}return elements;},[]);return _jsxs(View,{style:{flex:1},children:[_jsxs(Canvas,{style:{position:'absolute',top:0,left:0,right:0,bottom:0,width,height},children:[_jsx(Rect,{x:0,y:0,width:width,height:height,children:_jsx(LinearGradient,{start:vec(0,0),end:vec(width,height),colors:['#1a1a2e','#252541','#1e3a3a','#1a2e1a','#1a1a2e' ]})}),_jsx(Rect,{x:0,y:0,width:width,height:height,children:_jsx(LinearGradient,{start:vec(0,0),end:vec(width / 2,height / 2),colors:[`${SNAKE_NEON_COLORS[0]}15`,'transparent',`${SNAKE_NEON_COLORS[1]}10`,'transparent',`${SNAKE_NEON_COLORS[4]}15`,'transparent']})}),_jsx(Rect,{x:0,y:0,width:width,height:height,children:_jsx(LinearGradient,{start:vec(width,0),end:vec(0,height),colors:[`${SNAKE_NEON_COLORS[2]}12`,'transparent',`${SNAKE_NEON_COLORS[5]}10`,'transparent',`${SNAKE_NEON_COLORS[3]}12`,'transparent']})}),generateFloatingElements,_jsx(Circle,{cx:width * 0.12,cy:height * 0.15,r:35,color:`${SNAKE_NEON_COLORS[0]}30`}),_jsx(RoundedRect,{x:width * 0.82,y:height * 0.78,width:45,height:45,r:12,color:`${SNAKE_NEON_COLORS[1]}35`}),_jsx(Circle,{cx:width * 0.85,cy:height * 0.2,r:28,color:`${SNAKE_NEON_COLORS[2]}30`}),_jsx(RoundedRect,{x:width * 0.08,y:height * 0.75,width:50,height:50,r:15,color:`${SNAKE_NEON_COLORS[3]}35`}),_jsx(Circle,{cx:width * 0.5,cy:height * 0.1,r:25,color:`${SNAKE_NEON_COLORS[4]}28`}),_jsx(RoundedRect,{x:width * 0.1,y:height * 0.45,width:40,height:40,r:10,color:`${SNAKE_NEON_COLORS[5]}32`}),_jsx(Circle,{cx:width * 0.88,cy:height * 0.55,r:30,color:`${SNAKE_NEON_COLORS[6]}30`}),_jsx(RoundedRect,{x:width * 0.55,y:height * 0.85,width:35,height:35,r:8,color:`${SNAKE_NEON_COLORS[7]}33`}),_jsx(Circle,{cx:width * 0.3,cy:height * 0.3,r:20,color:`${SNAKE_NEON_COLORS[0]}25`}),_jsx(Circle,{cx:width * 0.7,cy:height * 0.4,r:24,color:`${SNAKE_NEON_COLORS[1]}28`}),_jsx(Circle,{cx:width * 0.4,cy:height * 0.65,r:18,color:`${SNAKE_NEON_COLORS[2]}26`}),Array.from({length:Math.floor(width / 70)},(_,i)=> _jsx(Rect,{x:i * 70,y:0,width:1,height:height,color:"rgba(0,255,136,0.04)"},`grid-v-${i}`)),Array.from({length:Math.floor(height / 70)},(_,i)=> _jsx(Rect,{x:0,y:i * 70,width:width,height:1,color:"rgba(0,255,136,0.04)"},`grid-h-${i}`))]}),children]});});GameBackground.displayName = 'GameBackground';
|
|
@@ -1,153 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { View, StyleSheet } from 'react-native';
|
|
5
|
-
import { Canvas, RoundedRect, Circle, Group, Shadow } from '@shopify/react-native-skia';
|
|
6
|
-
import { useSnake, useFood } from "../SnakeStore.js";
|
|
7
|
-
import { SNAKE_GAME_CONFIG, SNAKE_COLORS } from "../SnakeConstants.js";
|
|
8
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
9
|
-
export const GameGrid = /*#__PURE__*/React.memo(() => {
|
|
10
|
-
const snake = useSnake();
|
|
11
|
-
const food = useFood();
|
|
12
|
-
const cellSize = SNAKE_GAME_CONFIG.CELL_SIZE;
|
|
13
|
-
const gridSize = SNAKE_GAME_CONFIG.GRID_SIZE;
|
|
14
|
-
const canvasSize = cellSize * gridSize;
|
|
15
|
-
|
|
16
|
-
// Memoized grid lines
|
|
17
|
-
const gridLines = React.useMemo(() => {
|
|
18
|
-
const lines = [];
|
|
19
|
-
for (let i = 0; i <= gridSize; i++) {
|
|
20
|
-
lines.push(i);
|
|
21
|
-
}
|
|
22
|
-
return lines;
|
|
23
|
-
}, [gridSize]);
|
|
24
|
-
return /*#__PURE__*/_jsx(View, {
|
|
25
|
-
style: styles.container,
|
|
26
|
-
children: /*#__PURE__*/_jsx(View, {
|
|
27
|
-
style: [styles.gridContainer, {
|
|
28
|
-
width: canvasSize,
|
|
29
|
-
height: canvasSize
|
|
30
|
-
}],
|
|
31
|
-
children: /*#__PURE__*/_jsx(Canvas, {
|
|
32
|
-
style: {
|
|
33
|
-
width: canvasSize,
|
|
34
|
-
height: canvasSize
|
|
35
|
-
},
|
|
36
|
-
children: /*#__PURE__*/_jsxs(Group, {
|
|
37
|
-
children: [/*#__PURE__*/_jsx(RoundedRect, {
|
|
38
|
-
x: 0,
|
|
39
|
-
y: 0,
|
|
40
|
-
width: canvasSize,
|
|
41
|
-
height: canvasSize,
|
|
42
|
-
r: 15,
|
|
43
|
-
color: SNAKE_COLORS.BACKGROUND,
|
|
44
|
-
children: /*#__PURE__*/_jsx(Shadow, {
|
|
45
|
-
dx: 0,
|
|
46
|
-
dy: 4,
|
|
47
|
-
blur: 8,
|
|
48
|
-
color: "rgba(0, 0, 0, 0.3)"
|
|
49
|
-
})
|
|
50
|
-
}), gridLines.map(i => {
|
|
51
|
-
// Adjust last line position to be visible
|
|
52
|
-
const xPos = i === gridSize ? canvasSize - 2 : i * cellSize;
|
|
53
|
-
return /*#__PURE__*/_jsx(RoundedRect, {
|
|
54
|
-
x: xPos,
|
|
55
|
-
y: 0,
|
|
56
|
-
width: i === 0 || i === gridSize ? 2 : 1,
|
|
57
|
-
height: canvasSize,
|
|
58
|
-
r: 0,
|
|
59
|
-
color: SNAKE_COLORS.GRID_LINE
|
|
60
|
-
}, `v-${i}`);
|
|
61
|
-
}), gridLines.map(i => {
|
|
62
|
-
// Adjust last line position to be visible
|
|
63
|
-
const yPos = i === gridSize ? canvasSize - 2 : i * cellSize;
|
|
64
|
-
return /*#__PURE__*/_jsx(RoundedRect, {
|
|
65
|
-
x: 0,
|
|
66
|
-
y: yPos,
|
|
67
|
-
width: canvasSize,
|
|
68
|
-
height: i === 0 || i === gridSize ? 2 : 1,
|
|
69
|
-
r: 0,
|
|
70
|
-
color: SNAKE_COLORS.GRID_LINE
|
|
71
|
-
}, `h-${i}`);
|
|
72
|
-
}), food && /*#__PURE__*/_jsxs(Group, {
|
|
73
|
-
children: [/*#__PURE__*/_jsx(Circle, {
|
|
74
|
-
cx: food.x * cellSize + cellSize / 2,
|
|
75
|
-
cy: food.y * cellSize + cellSize / 2,
|
|
76
|
-
r: cellSize * 0.6,
|
|
77
|
-
color: food.isSpecial ? 'rgba(255, 165, 2, 0.3)' : SNAKE_COLORS.FOOD_GLOW
|
|
78
|
-
}), /*#__PURE__*/_jsx(Circle, {
|
|
79
|
-
cx: food.x * cellSize + cellSize / 2,
|
|
80
|
-
cy: food.y * cellSize + cellSize / 2,
|
|
81
|
-
r: cellSize * 0.4,
|
|
82
|
-
color: food.isSpecial ? SNAKE_COLORS.FOOD_SPECIAL : SNAKE_COLORS.FOOD_NORMAL,
|
|
83
|
-
children: /*#__PURE__*/_jsx(Shadow, {
|
|
84
|
-
dx: 0,
|
|
85
|
-
dy: 2,
|
|
86
|
-
blur: 4,
|
|
87
|
-
color: "rgba(0, 0, 0, 0.4)"
|
|
88
|
-
})
|
|
89
|
-
}), /*#__PURE__*/_jsx(Circle, {
|
|
90
|
-
cx: food.x * cellSize + cellSize / 2 - cellSize * 0.1,
|
|
91
|
-
cy: food.y * cellSize + cellSize / 2 - cellSize * 0.1,
|
|
92
|
-
r: cellSize * 0.15,
|
|
93
|
-
color: "rgba(255, 255, 255, 0.6)"
|
|
94
|
-
})]
|
|
95
|
-
}), snake.map((segment, index) => {
|
|
96
|
-
const isHead = index === 0;
|
|
97
|
-
const isTail = index === snake.length - 1;
|
|
98
|
-
|
|
99
|
-
// Calculate color based on position
|
|
100
|
-
const segmentColor = isHead ? SNAKE_COLORS.SNAKE_HEAD : isTail ? SNAKE_COLORS.SNAKE_TAIL : SNAKE_COLORS.SNAKE_BODY;
|
|
101
|
-
return /*#__PURE__*/_jsxs(Group, {
|
|
102
|
-
children: [/*#__PURE__*/_jsx(RoundedRect, {
|
|
103
|
-
x: segment.x * cellSize + 2,
|
|
104
|
-
y: segment.y * cellSize + 2,
|
|
105
|
-
width: cellSize - 4,
|
|
106
|
-
height: cellSize - 4,
|
|
107
|
-
r: isHead ? 8 : 6,
|
|
108
|
-
color: segmentColor,
|
|
109
|
-
children: /*#__PURE__*/_jsx(Shadow, {
|
|
110
|
-
dx: 0,
|
|
111
|
-
dy: 2,
|
|
112
|
-
blur: 4,
|
|
113
|
-
color: "rgba(0, 0, 0, 0.3)"
|
|
114
|
-
})
|
|
115
|
-
}), /*#__PURE__*/_jsx(RoundedRect, {
|
|
116
|
-
x: segment.x * cellSize + cellSize * 0.2,
|
|
117
|
-
y: segment.y * cellSize + cellSize * 0.2,
|
|
118
|
-
width: cellSize * 0.3,
|
|
119
|
-
height: cellSize * 0.3,
|
|
120
|
-
r: 4,
|
|
121
|
-
color: "rgba(255, 255, 255, 0.3)"
|
|
122
|
-
}), isHead && /*#__PURE__*/_jsxs(_Fragment, {
|
|
123
|
-
children: [/*#__PURE__*/_jsx(Circle, {
|
|
124
|
-
cx: segment.x * cellSize + cellSize * 0.35,
|
|
125
|
-
cy: segment.y * cellSize + cellSize * 0.4,
|
|
126
|
-
r: cellSize * 0.08,
|
|
127
|
-
color: "#000000"
|
|
128
|
-
}), /*#__PURE__*/_jsx(Circle, {
|
|
129
|
-
cx: segment.x * cellSize + cellSize * 0.65,
|
|
130
|
-
cy: segment.y * cellSize + cellSize * 0.4,
|
|
131
|
-
r: cellSize * 0.08,
|
|
132
|
-
color: "#000000"
|
|
133
|
-
})]
|
|
134
|
-
})]
|
|
135
|
-
}, segment.id);
|
|
136
|
-
})]
|
|
137
|
-
})
|
|
138
|
-
})
|
|
139
|
-
})
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
GameGrid.displayName = 'GameGrid';
|
|
143
|
-
const styles = StyleSheet.create({
|
|
144
|
-
container: {
|
|
145
|
-
flex: 1,
|
|
146
|
-
justifyContent: 'center',
|
|
147
|
-
alignItems: 'center'
|
|
148
|
-
},
|
|
149
|
-
gridContainer: {
|
|
150
|
-
// Shadow removed for Android compatibility
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
//# sourceMappingURL=GameGrid.js.map
|
|
1
|
+
"use strict";import React from 'react';import{View,StyleSheet}from 'react-native';import{Canvas,RoundedRect,Circle,Group,Shadow}from '@shopify/react-native-skia';import{useSnake,useFood}from "../SnakeStore.js";import{SNAKE_GAME_CONFIG,SNAKE_COLORS}from "../SnakeConstants.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from "react/jsx-runtime";export const GameGrid = React.memo(()=>{const snake = useSnake();const food = useFood();const cellSize = SNAKE_GAME_CONFIG.CELL_SIZE;const gridSize = SNAKE_GAME_CONFIG.GRID_SIZE;const canvasSize = cellSize * gridSize;const gridLines = React.useMemo(()=>{const lines = [];for(let i = 0;i <= gridSize;i++){lines.push(i);}return lines;},[gridSize]);return _jsx(View,{style:styles.container,children:_jsx(View,{style:[styles.gridContainer,{width:canvasSize,height:canvasSize}],children:_jsx(Canvas,{style:{width:canvasSize,height:canvasSize},children:_jsxs(Group,{children:[_jsx(RoundedRect,{x:0,y:0,width:canvasSize,height:canvasSize,r:15,color:SNAKE_COLORS.BACKGROUND,children:_jsx(Shadow,{dx:0,dy:4,blur:8,color:"rgba(0,0,0,0.3)"})}),gridLines.map(i =>{const xPos = i === gridSize ? canvasSize - 2:i * cellSize;return _jsx(RoundedRect,{x:xPos,y:0,width:i === 0 || i === gridSize ? 2:1,height:canvasSize,r:0,color:SNAKE_COLORS.GRID_LINE},`v-${i}`);}),gridLines.map(i =>{const yPos = i === gridSize ? canvasSize - 2:i * cellSize;return _jsx(RoundedRect,{x:0,y:yPos,width:canvasSize,height:i === 0 || i === gridSize ? 2:1,r:0,color:SNAKE_COLORS.GRID_LINE},`h-${i}`);}),food && _jsxs(Group,{children:[_jsx(Circle,{cx:food.x * cellSize + cellSize / 2,cy:food.y * cellSize + cellSize / 2,r:cellSize * 0.6,color:food.isSpecial ? 'rgba(255,165,2,0.3)':SNAKE_COLORS.FOOD_GLOW}),_jsx(Circle,{cx:food.x * cellSize + cellSize / 2,cy:food.y * cellSize + cellSize / 2,r:cellSize * 0.4,color:food.isSpecial ? SNAKE_COLORS.FOOD_SPECIAL:SNAKE_COLORS.FOOD_NORMAL,children:_jsx(Shadow,{dx:0,dy:2,blur:4,color:"rgba(0,0,0,0.4)"})}),_jsx(Circle,{cx:food.x * cellSize + cellSize / 2 - cellSize * 0.1,cy:food.y * cellSize + cellSize / 2 - cellSize * 0.1,r:cellSize * 0.15,color:"rgba(255,255,255,0.6)"})]}),snake.map((segment,index)=>{const isHead = index === 0;const isTail = index === snake.length - 1;const segmentColor = isHead ? SNAKE_COLORS.SNAKE_HEAD:isTail ? SNAKE_COLORS.SNAKE_TAIL:SNAKE_COLORS.SNAKE_BODY;return _jsxs(Group,{children:[_jsx(RoundedRect,{x:segment.x * cellSize + 2,y:segment.y * cellSize + 2,width:cellSize - 4,height:cellSize - 4,r:isHead ? 8:6,color:segmentColor,children:_jsx(Shadow,{dx:0,dy:2,blur:4,color:"rgba(0,0,0,0.3)"})}),_jsx(RoundedRect,{x:segment.x * cellSize + cellSize * 0.2,y:segment.y * cellSize + cellSize * 0.2,width:cellSize * 0.3,height:cellSize * 0.3,r:4,color:"rgba(255,255,255,0.3)"}),isHead && _jsxs(_Fragment,{children:[_jsx(Circle,{cx:segment.x * cellSize + cellSize * 0.35,cy:segment.y * cellSize + cellSize * 0.4,r:cellSize * 0.08,color:"#000000"}),_jsx(Circle,{cx:segment.x * cellSize + cellSize * 0.65,cy:segment.y * cellSize + cellSize * 0.4,r:cellSize * 0.08,color:"#000000"})]})]},segment.id);})]})})})});});GameGrid.displayName = 'GameGrid';const styles = StyleSheet.create({container:{flex:1,justifyContent:'center',alignItems:'center'},gridContainer:{}});
|
|
@@ -1,51 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { View, Text, StyleSheet } from 'react-native';
|
|
5
|
-
import { useScore } from "../SnakeStore.js";
|
|
6
|
-
import { SNAKE_COLORS } from "../SnakeConstants.js";
|
|
7
|
-
import { ScoreBoardContainer } from "../../../helpers/index.js";
|
|
8
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
-
export const ScoreBoard = /*#__PURE__*/React.memo(({
|
|
10
|
-
offset = 0
|
|
11
|
-
}) => {
|
|
12
|
-
const score = useScore();
|
|
13
|
-
return /*#__PURE__*/_jsx(ScoreBoardContainer, {
|
|
14
|
-
offset: offset,
|
|
15
|
-
backgroundColor: SNAKE_COLORS.SCORE_BACKGROUND,
|
|
16
|
-
borderColor: SNAKE_COLORS.SCORE_BACKGROUND,
|
|
17
|
-
children: /*#__PURE__*/_jsx(View, {
|
|
18
|
-
style: styles.scoreContainer,
|
|
19
|
-
children: /*#__PURE__*/_jsxs(View, {
|
|
20
|
-
style: styles.scoreItem,
|
|
21
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
22
|
-
style: styles.label,
|
|
23
|
-
children: "Score"
|
|
24
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
25
|
-
style: styles.value,
|
|
26
|
-
children: score
|
|
27
|
-
})]
|
|
28
|
-
})
|
|
29
|
-
})
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
ScoreBoard.displayName = 'ScoreBoard';
|
|
33
|
-
const styles = StyleSheet.create({
|
|
34
|
-
scoreContainer: {
|
|
35
|
-
alignItems: 'center'
|
|
36
|
-
},
|
|
37
|
-
scoreItem: {
|
|
38
|
-
alignItems: 'center'
|
|
39
|
-
},
|
|
40
|
-
label: {
|
|
41
|
-
fontSize: 18,
|
|
42
|
-
color: 'rgba(255, 255, 255, 0.7)',
|
|
43
|
-
marginBottom: 4
|
|
44
|
-
},
|
|
45
|
-
value: {
|
|
46
|
-
fontSize: 34,
|
|
47
|
-
color: SNAKE_COLORS.SCORE_TEXT,
|
|
48
|
-
fontWeight: 'bold'
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
//# sourceMappingURL=ScoreBoard.js.map
|
|
1
|
+
"use strict";import React from 'react';import{View,Text,StyleSheet}from 'react-native';import{useScore,useTimeLeft}from "../SnakeStore.js";import{SNAKE_COLORS}from "../SnakeConstants.js";import{ScoreBoardContainer}from "../../../helpers/index.js";import{jsx as _jsx,jsxs as _jsxs}from "react/jsx-runtime";export const ScoreBoard = React.memo(({offset = 0})=>{const score = useScore();const timeLeft = useTimeLeft();const formattedTime = React.useMemo(()=>{const minutes = Math.floor(timeLeft / 60);const seconds = timeLeft % 60;return `${minutes}:${seconds.toString().padStart(2,'0')}`;},[timeLeft]);return _jsx(ScoreBoardContainer,{offset:offset,backgroundColor:SNAKE_COLORS.SCORE_BACKGROUND,borderColor:SNAKE_COLORS.SCORE_BACKGROUND,children:_jsxs(View,{style:styles.scoreContainer,children:[_jsxs(View,{style:styles.scoreItem,children:[_jsx(Text,{style:styles.label,children:"Score"}),_jsx(Text,{style:styles.value,children:score})]}),_jsxs(View,{style:styles.scoreItem,children:[_jsx(Text,{style:styles.label,children:"Time"}),_jsx(Text,{style:styles.value,children:formattedTime})]})]})});});ScoreBoard.displayName = 'ScoreBoard';const styles = StyleSheet.create({scoreContainer:{flex:1,flexDirection:'row',justifyContent:'space-around',alignItems:'center'},scoreItem:{alignItems:'center'},label:{fontSize:16,color:'rgba(255,255,255,0.7)',marginBottom:4},value:{fontSize:25,color:SNAKE_COLORS.SCORE_TEXT,fontWeight:'bold'}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","Text","StyleSheet","useScore","SNAKE_COLORS","ScoreBoardContainer","jsx","_jsx","jsxs","_jsxs","ScoreBoard","memo","offset","score","backgroundColor","SCORE_BACKGROUND","borderColor","children","style","styles","scoreContainer","scoreItem","label","value","displayName","create","alignItems","fontSize","color","marginBottom","SCORE_TEXT","fontWeight"],"sourceRoot":"../../../../../src","sources":["games/snake/components/ScoreBoard.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AACrD,SAASC,QAAQ,QAAQ,kBAAe;
|
|
1
|
+
{"version":3,"names":["React","View","Text","StyleSheet","useScore","useTimeLeft","SNAKE_COLORS","ScoreBoardContainer","jsx","_jsx","jsxs","_jsxs","ScoreBoard","memo","offset","score","timeLeft","formattedTime","useMemo","minutes","Math","floor","seconds","toString","padStart","backgroundColor","SCORE_BACKGROUND","borderColor","children","style","styles","scoreContainer","scoreItem","label","value","displayName","create","flex","flexDirection","justifyContent","alignItems","fontSize","color","marginBottom","SCORE_TEXT","fontWeight"],"sourceRoot":"../../../../../src","sources":["games/snake/components/ScoreBoard.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AACrD,SAASC,QAAQ,EAAEC,WAAW,QAAQ,kBAAe;AACrD,SAASC,YAAY,QAAQ,sBAAmB;AAChD,SAASC,mBAAmB,QAAQ,2BAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAMvD,OAAO,MAAMC,UAAqC,gBAAGZ,KAAK,CAACa,IAAI,CAAC,CAAC;EAACC,MAAM,GAAG;AAAC,CAAC,KAAK;EAChF,MAAMC,KAAK,GAAGX,QAAQ,CAAC,CAAC;EACxB,MAAMY,QAAQ,GAAGX,WAAW,CAAC,CAAC;;EAE9B;EACA,MAAMY,aAAa,GAAGjB,KAAK,CAACkB,OAAO,CAAC,MAAM;IACxC,MAAMC,OAAO,GAAGC,IAAI,CAACC,KAAK,CAACL,QAAQ,GAAG,EAAE,CAAC;IACzC,MAAMM,OAAO,GAAGN,QAAQ,GAAG,EAAE;IAC7B,OAAO,GAAGG,OAAO,IAAIG,OAAO,CAACC,QAAQ,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE;EAC5D,CAAC,EAAE,CAACR,QAAQ,CAAC,CAAC;EAEd,oBACEP,IAAA,CAACF,mBAAmB;IAClBO,MAAM,EAAEA,MAAO;IACfW,eAAe,EAAEnB,YAAY,CAACoB,gBAAiB;IAC/CC,WAAW,EAAErB,YAAY,CAACoB,gBAAiB;IAAAE,QAAA,eAE3CjB,KAAA,CAACV,IAAI;MAAC4B,KAAK,EAAEC,MAAM,CAACC,cAAe;MAAAH,QAAA,gBACjCjB,KAAA,CAACV,IAAI;QAAC4B,KAAK,EAAEC,MAAM,CAACE,SAAU;QAAAJ,QAAA,gBAC5BnB,IAAA,CAACP,IAAI;UAAC2B,KAAK,EAAEC,MAAM,CAACG,KAAM;UAAAL,QAAA,EAAC;QAAK,CAAM,CAAC,eACvCnB,IAAA,CAACP,IAAI;UAAC2B,KAAK,EAAEC,MAAM,CAACI,KAAM;UAAAN,QAAA,EAAEb;QAAK,CAAO,CAAC;MAAA,CACrC,CAAC,eACPJ,KAAA,CAACV,IAAI;QAAC4B,KAAK,EAAEC,MAAM,CAACE,SAAU;QAAAJ,QAAA,gBAC5BnB,IAAA,CAACP,IAAI;UAAC2B,KAAK,EAAEC,MAAM,CAACG,KAAM;UAAAL,QAAA,EAAC;QAAI,CAAM,CAAC,eACtCnB,IAAA,CAACP,IAAI;UAAC2B,KAAK,EAAEC,MAAM,CAACI,KAAM;UAAAN,QAAA,EAAEX;QAAa,CAAO,CAAC;MAAA,CAC7C,CAAC;IAAA,CACH;EAAC,CACY,CAAC;AAE1B,CAAC,CAAC;AAEFL,UAAU,CAACuB,WAAW,GAAG,YAAY;AAErC,MAAML,MAAM,GAAG3B,UAAU,CAACiC,MAAM,CAAC;EAC/BL,cAAc,EAAE;IACdM,IAAI,EAAE,CAAC;IACPC,aAAa,EAAE,KAAK;IACpBC,cAAc,EAAE,cAAc;IAC9BC,UAAU,EAAE;EACd,CAAC;EACDR,SAAS,EAAE;IACTQ,UAAU,EAAE;EACd,CAAC;EACDP,KAAK,EAAE;IACLQ,QAAQ,EAAE,EAAE;IACZC,KAAK,EAAE,0BAA0B;IACjCC,YAAY,EAAE;EAChB,CAAC;EACDT,KAAK,EAAE;IACLO,QAAQ,EAAE,EAAE;IACZC,KAAK,EAAEpC,YAAY,CAACsC,UAAU;IAC9BC,UAAU,EAAE;EACd;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
export { GameBackground } from "./GameBackground.js";
|
|
4
|
-
export { GameGrid } from "./GameGrid.js";
|
|
5
|
-
export { ScoreBoard } from "./ScoreBoard.js";
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
"use strict";export{GameBackground}from "./GameBackground.js";export{GameGrid}from "./GameGrid.js";export{ScoreBoard}from "./ScoreBoard.js";
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
export { Snake } from "./Snake.js";
|
|
4
|
-
export { useSnakeStore } from "./SnakeStore.js";
|
|
5
|
-
export * from "./SnakeConstants.js";
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
"use strict";export{Snake}from "./Snake.js";export{useSnakeStore}from "./SnakeStore.js";export * from "./SnakeConstants.js";
|
|
@@ -1,165 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React, { useEffect, useCallback, useMemo } from 'react';
|
|
4
|
-
import { View, StyleSheet, Dimensions } from 'react-native';
|
|
5
|
-
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
6
|
-
import { useSpaceFighterStore } from "./SpaceFighterStore.js";
|
|
7
|
-
import { createSpaceFighterService } from "./SpaceFighterService.js";
|
|
8
|
-
import { getDifficultySettings } from "./SpaceFighterConstants.js";
|
|
9
|
-
import { ScoreBoard, GameArea, GameBackground } from "./components/index.js";
|
|
10
|
-
import { GameControlButton, GameOverModal, useGameErrorHandler, GameErrorType } from "../../helpers/index.js";
|
|
11
|
-
import { GameSettingsModal } from "../../helpers/index.js";
|
|
12
|
-
import { GAME_IDS, DEFAULT_GAME_SETTINGS } from "../../services/UtilsService.js";
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
const {
|
|
15
|
-
width,
|
|
16
|
-
height
|
|
17
|
-
} = Dimensions.get('window');
|
|
18
|
-
export const SpaceFighter = ({
|
|
19
|
-
settings = DEFAULT_GAME_SETTINGS,
|
|
20
|
-
onSettingsChange
|
|
21
|
-
}) => {
|
|
22
|
-
// Memoize settings destructuring to prevent unnecessary re-renders
|
|
23
|
-
const {
|
|
24
|
-
difficulty
|
|
25
|
-
} = useMemo(() => settings || DEFAULT_GAME_SETTINGS, [settings]);
|
|
26
|
-
|
|
27
|
-
// Read UI-critical state independently to minimize re-renders
|
|
28
|
-
const isPlaying = useSpaceFighterStore(state => state.isPlaying);
|
|
29
|
-
const gameOver = useSpaceFighterStore(state => state.gameOver);
|
|
30
|
-
const score = useSpaceFighterStore(state => state.score);
|
|
31
|
-
|
|
32
|
-
// Get store actions independently (these don't cause re-renders)
|
|
33
|
-
const setOffset = useSpaceFighterStore(state => state.setOffset);
|
|
34
|
-
const startGame = useSpaceFighterStore(state => state.startGame);
|
|
35
|
-
const stopGame = useSpaceFighterStore(state => state.stopGame);
|
|
36
|
-
const resetGame = useSpaceFighterStore(state => state.resetGame);
|
|
37
|
-
const decrementTime = useSpaceFighterStore(state => state.decrementTime);
|
|
38
|
-
const addAsteroids = useSpaceFighterStore(state => state.addAsteroids);
|
|
39
|
-
const removeAsteroid = useSpaceFighterStore(state => state.removeAsteroid);
|
|
40
|
-
const updateAsteroid = useSpaceFighterStore(state => state.updateAsteroid);
|
|
41
|
-
const updateSpacecraft = useSpaceFighterStore(state => state.updateSpacecraft);
|
|
42
|
-
|
|
43
|
-
// Get offset from settings
|
|
44
|
-
const offset = settings?.offset ?? 0;
|
|
45
|
-
|
|
46
|
-
// Update offset in store when it changes
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
setOffset(offset);
|
|
49
|
-
}, [offset, setOffset]);
|
|
50
|
-
|
|
51
|
-
// Error handling for the game
|
|
52
|
-
const {
|
|
53
|
-
wrapFunction,
|
|
54
|
-
safeExecute
|
|
55
|
-
} = useGameErrorHandler(GAME_IDS.SPACE_FIGHTER);
|
|
56
|
-
|
|
57
|
-
// Memoize game service to prevent recreation
|
|
58
|
-
const gameService = useMemo(() => safeExecute(() => createSpaceFighterService(width, height),
|
|
59
|
-
// Use actual screen dimensions
|
|
60
|
-
createSpaceFighterService(width, height),
|
|
61
|
-
// Fallback to direct creation
|
|
62
|
-
GameErrorType.INITIALIZATION_ERROR), [safeExecute]);
|
|
63
|
-
|
|
64
|
-
// Game service cleanup on unmount
|
|
65
|
-
useEffect(() => {
|
|
66
|
-
return () => {
|
|
67
|
-
handleResetGame();
|
|
68
|
-
if (gameService) {
|
|
69
|
-
gameService.cleanup();
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
}, [gameService]);
|
|
73
|
-
|
|
74
|
-
// Auto-stop physics when game over state changes
|
|
75
|
-
useEffect(() => {
|
|
76
|
-
if (gameOver && gameService) {
|
|
77
|
-
// Stop all timers and physics when game over
|
|
78
|
-
gameService.cleanup();
|
|
79
|
-
}
|
|
80
|
-
}, [gameOver, gameService]);
|
|
81
|
-
|
|
82
|
-
// Memoize difficulty settings to prevent recalculation
|
|
83
|
-
const difficultySettings = useMemo(() => getDifficultySettings(difficulty), [difficulty]);
|
|
84
|
-
|
|
85
|
-
// Game control functions with error handling and memoization
|
|
86
|
-
const handleStartGame = useCallback(() => wrapFunction(() => {
|
|
87
|
-
startGame(); // Store uses fixed 60s duration internally and sets spacecraft position
|
|
88
|
-
if (gameService) {
|
|
89
|
-
gameService.updateDifficultySettings(difficultySettings.asteroidSpeed, difficultySettings.asteroidSpawnInterval);
|
|
90
|
-
// Don't reset spacecraft position - store handles it with correct offset
|
|
91
|
-
gameService.startGameTimer(decrementTime);
|
|
92
|
-
gameService.startAsteroidSpawning(addAsteroids);
|
|
93
|
-
gameService.startPhysicsLoop(updateSpacecraft, updateAsteroid, removeAsteroid, () => useSpaceFighterStore.getState().spacecraft, () => useSpaceFighterStore.getState().asteroids);
|
|
94
|
-
}
|
|
95
|
-
}, GameErrorType.INITIALIZATION_ERROR)(), [wrapFunction, startGame, gameService, difficultySettings, updateSpacecraft, decrementTime, addAsteroids, updateAsteroid, removeAsteroid]);
|
|
96
|
-
const handleStopGame = useCallback(() => wrapFunction(() => {
|
|
97
|
-
stopGame();
|
|
98
|
-
if (gameService) {
|
|
99
|
-
gameService.cleanup();
|
|
100
|
-
}
|
|
101
|
-
}, GameErrorType.UNKNOWN_ERROR)(), [wrapFunction, stopGame, gameService]);
|
|
102
|
-
const handleResetGame = useCallback(() => wrapFunction(() => {
|
|
103
|
-
if (gameService) {
|
|
104
|
-
gameService.cleanup();
|
|
105
|
-
}
|
|
106
|
-
resetGame();
|
|
107
|
-
if (gameService) {
|
|
108
|
-
const initialSpacecraft = gameService.getInitialSpacecraft();
|
|
109
|
-
updateSpacecraft(initialSpacecraft);
|
|
110
|
-
}
|
|
111
|
-
}, GameErrorType.UNKNOWN_ERROR)(), [wrapFunction, gameService, resetGame, updateSpacecraft]);
|
|
112
|
-
|
|
113
|
-
// Memoize component props to prevent unnecessary re-renders
|
|
114
|
-
const gameControlButtonProps = useMemo(() => ({
|
|
115
|
-
isPlaying,
|
|
116
|
-
gameOver,
|
|
117
|
-
onStartGame: handleStartGame,
|
|
118
|
-
onStopGame: handleStopGame,
|
|
119
|
-
startButtonText: "START FLYING",
|
|
120
|
-
stopButtonText: "STOP GAME",
|
|
121
|
-
startButtonSubtext: "Navigate through space!",
|
|
122
|
-
stopButtonSubtext: "End current game",
|
|
123
|
-
startButtonColor: "#9370db",
|
|
124
|
-
stopButtonColor: "#dc2626",
|
|
125
|
-
startButtonBorderColor: "#ba68c8",
|
|
126
|
-
stopButtonBorderColor: "#f87171"
|
|
127
|
-
}), [isPlaying, gameOver, handleStartGame, handleStopGame]);
|
|
128
|
-
const gameOverModalProps = useMemo(() => ({
|
|
129
|
-
isVisible: gameOver,
|
|
130
|
-
score,
|
|
131
|
-
onPlayAgain: handleResetGame,
|
|
132
|
-
buttonText: "Fly Again!",
|
|
133
|
-
primaryColor: "rgba(147, 112, 219, 0.8)",
|
|
134
|
-
borderColor: "rgba(147, 112, 219, 0.9)",
|
|
135
|
-
buttonColor: "#9370db",
|
|
136
|
-
buttonBorderColor: "#ba68c8"
|
|
137
|
-
}), [gameOver, score, handleResetGame]);
|
|
138
|
-
const gameSettingsModalProps = useMemo(() => ({
|
|
139
|
-
gameId: GAME_IDS.SPACE_FIGHTER,
|
|
140
|
-
settings: settings || DEFAULT_GAME_SETTINGS,
|
|
141
|
-
onSettingsChange
|
|
142
|
-
}), [settings, onSettingsChange]);
|
|
143
|
-
return /*#__PURE__*/_jsx(View, {
|
|
144
|
-
style: styles.container,
|
|
145
|
-
children: /*#__PURE__*/_jsx(GestureHandlerRootView, {
|
|
146
|
-
children: /*#__PURE__*/_jsxs(GameBackground, {
|
|
147
|
-
children: [/*#__PURE__*/_jsx(GameArea, {}), /*#__PURE__*/_jsx(ScoreBoard, {
|
|
148
|
-
offset: offset
|
|
149
|
-
}), /*#__PURE__*/_jsx(GameControlButton, {
|
|
150
|
-
...gameControlButtonProps
|
|
151
|
-
}), /*#__PURE__*/_jsx(GameOverModal, {
|
|
152
|
-
...gameOverModalProps
|
|
153
|
-
}), /*#__PURE__*/_jsx(GameSettingsModal, {
|
|
154
|
-
...gameSettingsModalProps
|
|
155
|
-
})]
|
|
156
|
-
})
|
|
157
|
-
})
|
|
158
|
-
});
|
|
159
|
-
};
|
|
160
|
-
const styles = StyleSheet.create({
|
|
161
|
-
container: {
|
|
162
|
-
flex: 1
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
//# sourceMappingURL=SpaceFighter.js.map
|
|
1
|
+
"use strict";import React,{useEffect,useCallback,useMemo}from 'react';import{View,StyleSheet,Dimensions}from 'react-native';import{GestureHandlerRootView}from 'react-native-gesture-handler';import{useSpaceFighterStore}from "./SpaceFighterStore.js";import{createSpaceFighterService}from "./SpaceFighterService.js";import{getDifficultySettings}from "./SpaceFighterConstants.js";import{ScoreBoard,GameArea,GameBackground}from "./components/index.js";import{GameControlButton,GameOverModal,useGameErrorHandler,GameErrorType}from "../../helpers/index.js";import{GameSettingsModal}from "../../helpers/index.js";import{GAME_IDS,DEFAULT_GAME_SETTINGS}from "../../services/UtilsService.js";import{jsx as _jsx,jsxs as _jsxs}from "react/jsx-runtime";const{width,height}= Dimensions.get('window');export const SpaceFighter =({settings = DEFAULT_GAME_SETTINGS,onSettingsChange,onEndGame})=>{const{difficulty}= useMemo(()=> settings || DEFAULT_GAME_SETTINGS,[settings]);const isPlaying = useSpaceFighterStore(state => state.isPlaying);const gameOver = useSpaceFighterStore(state => state.gameOver);const score = useSpaceFighterStore(state => state.score);const gameReportedRef = React.useRef(false);const reportGameEnd = useCallback(status =>{if(onEndGame && !gameReportedRef.current){const currentState = useSpaceFighterStore.getState();onEndGame({status,score:currentState.score.toString()});gameReportedRef.current = true;}},[onEndGame]);const setOffset = useSpaceFighterStore(state => state.setOffset);const startGame = useSpaceFighterStore(state => state.startGame);const stopGame = useSpaceFighterStore(state => state.stopGame);const resetGame = useSpaceFighterStore(state => state.resetGame);const decrementTime = useSpaceFighterStore(state => state.decrementTime);const addAsteroids = useSpaceFighterStore(state => state.addAsteroids);const removeAsteroid = useSpaceFighterStore(state => state.removeAsteroid);const updateAsteroid = useSpaceFighterStore(state => state.updateAsteroid);const updateSpacecraft = useSpaceFighterStore(state => state.updateSpacecraft);const offset = settings?.offset ?? 0;useEffect(()=>{setOffset(offset);},[offset,setOffset]);const{wrapFunction,safeExecute}= useGameErrorHandler(GAME_IDS.SPACE_FIGHTER);const gameService = useMemo(()=> safeExecute(()=> createSpaceFighterService(width,height),createSpaceFighterService(width,height),GameErrorType.INITIALIZATION_ERROR),[safeExecute]);useEffect(()=>{return()=>{handleResetGame();if(gameService){gameService.cleanup();}};},[gameService]);useEffect(()=>{if(gameOver && !gameReportedRef.current){const currentState = useSpaceFighterStore.getState();const status = currentState.lives <= 0 ? 'lose':'win';reportGameEnd(status);}if(!gameOver){gameReportedRef.current = false;}},[gameOver,reportGameEnd]);useEffect(()=>{if(gameOver && gameService){gameService.cleanup();}},[gameOver,gameService]);const difficultySettings = useMemo(()=> getDifficultySettings(difficulty),[difficulty]);const handleStartGame = useCallback(()=> wrapFunction(()=>{gameReportedRef.current = false;startGame();if(gameService){gameService.updateDifficultySettings(difficultySettings.asteroidSpeed,difficultySettings.asteroidSpawnInterval);gameService.startGameTimer(decrementTime);gameService.startAsteroidSpawning(addAsteroids);gameService.startPhysicsLoop(updateSpacecraft,updateAsteroid,removeAsteroid,()=> useSpaceFighterStore.getState().spacecraft,()=> useSpaceFighterStore.getState().asteroids);}},GameErrorType.INITIALIZATION_ERROR)(),[wrapFunction,startGame,gameService,difficultySettings,updateSpacecraft,decrementTime,addAsteroids,updateAsteroid,removeAsteroid]);const handleStopGame = useCallback(()=> wrapFunction(()=>{reportGameEnd('cancel');stopGame();if(gameService){gameService.cleanup();}},GameErrorType.UNKNOWN_ERROR)(),[wrapFunction,stopGame,gameService,reportGameEnd]);const handleResetGame = useCallback(()=> wrapFunction(()=>{if(gameService){gameService.cleanup();}resetGame();if(gameService){const initialSpacecraft = gameService.getInitialSpacecraft();updateSpacecraft(initialSpacecraft);}},GameErrorType.UNKNOWN_ERROR)(),[wrapFunction,gameService,resetGame,updateSpacecraft]);const gameControlButtonProps = useMemo(()=>({isPlaying,gameOver,onStartGame:handleStartGame,onStopGame:handleStopGame,startButtonText:"START FLYING",stopButtonText:"STOP GAME",startButtonSubtext:"Navigate through space!",stopButtonSubtext:"End current game",startButtonColor:"#9370db",stopButtonColor:"#dc2626",startButtonBorderColor:"#ba68c8",stopButtonBorderColor:"#f87171"}),[isPlaying,gameOver,handleStartGame,handleStopGame]);const gameOverModalProps = useMemo(()=>({isVisible:gameOver,score,onPlayAgain:handleResetGame,buttonText:"Fly Again!",primaryColor:"rgba(147,112,219,0.5)",borderColor:"rgba(147,112,219,0.5)",buttonColor:"#ffffff",buttonBorderColor:"#ffffff",buttonTextColor:"#9370db"}),[gameOver,score,handleResetGame]);const gameSettingsModalProps = useMemo(()=>({gameId:GAME_IDS.SPACE_FIGHTER,settings:settings || DEFAULT_GAME_SETTINGS,onSettingsChange}),[settings,onSettingsChange]);return _jsx(View,{style:styles.container,children:_jsx(GestureHandlerRootView,{children:_jsxs(GameBackground,{children:[_jsx(GameArea,{}),_jsx(ScoreBoard,{offset:offset}),_jsx(GameControlButton,{...gameControlButtonProps}),_jsx(GameOverModal,{...gameOverModalProps}),_jsx(GameSettingsModal,{...gameSettingsModalProps})]})})});};const styles = StyleSheet.create({container:{flex:1}});
|