react-native-games 0.7.0 → 1.0.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 +507 -84
- package/lib/module/games/balloon-blaster/BalloonBlaster.js +13 -21
- package/lib/module/games/balloon-blaster/BalloonBlaster.js.map +1 -1
- package/lib/module/games/balloon-blaster/BalloonBlasterStore.js +1 -1
- package/lib/module/games/balloon-blaster/components/GameArea.js +1 -1
- package/lib/module/games/balloon-blaster/components/GameArea.js.map +1 -1
- package/lib/module/games/balloon-blaster/components/GameBackground.js +24 -17
- package/lib/module/games/balloon-blaster/components/GameBackground.js.map +1 -1
- package/lib/module/games/balloon-blaster/components/ScoreBoard.js +47 -47
- package/lib/module/games/balloon-blaster/components/ScoreBoard.js.map +1 -1
- package/lib/module/games/candy-crush/CandyCrush.js +131 -0
- package/lib/module/games/candy-crush/CandyCrush.js.map +1 -0
- package/lib/module/games/candy-crush/CandyCrushConstants.js +125 -0
- package/lib/module/games/candy-crush/CandyCrushConstants.js.map +1 -0
- package/lib/module/games/candy-crush/CandyCrushService.js +370 -0
- package/lib/module/games/candy-crush/CandyCrushService.js.map +1 -0
- package/lib/module/games/candy-crush/CandyCrushStore.js +303 -0
- package/lib/module/games/candy-crush/CandyCrushStore.js.map +1 -0
- package/lib/module/games/candy-crush/components/CandyItem.js +191 -0
- package/lib/module/games/candy-crush/components/CandyItem.js.map +1 -0
- package/lib/module/games/candy-crush/components/GameBackground.js +85 -0
- package/lib/module/games/candy-crush/components/GameBackground.js.map +1 -0
- package/lib/module/games/candy-crush/components/GameGrid.js +314 -0
- package/lib/module/games/candy-crush/components/GameGrid.js.map +1 -0
- package/lib/module/games/candy-crush/components/ScoreBoard.js +79 -0
- package/lib/module/games/candy-crush/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/candy-crush/components/index.js +7 -0
- package/lib/module/games/candy-crush/components/index.js.map +1 -0
- package/lib/module/games/candy-crush/index.js +6 -0
- package/lib/module/games/candy-crush/index.js.map +1 -0
- package/lib/module/games/colors-sort/ColorsSort.js +143 -0
- package/lib/module/games/colors-sort/ColorsSort.js.map +1 -0
- package/lib/module/games/colors-sort/ColorsSortConstants.js +72 -0
- package/lib/module/games/colors-sort/ColorsSortConstants.js.map +1 -0
- package/lib/module/games/colors-sort/ColorsSortService.js +255 -0
- package/lib/module/games/colors-sort/ColorsSortService.js.map +1 -0
- package/lib/module/games/colors-sort/ColorsSortStore.js +257 -0
- package/lib/module/games/colors-sort/ColorsSortStore.js.map +1 -0
- package/lib/module/games/colors-sort/components/ColorContainer.js +140 -0
- package/lib/module/games/colors-sort/components/ColorContainer.js.map +1 -0
- package/lib/module/games/colors-sort/components/GameBackground.js +135 -0
- package/lib/module/games/colors-sort/components/GameBackground.js.map +1 -0
- package/lib/module/games/colors-sort/components/ScoreBoard.js +70 -0
- package/lib/module/games/colors-sort/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/colors-sort/components/index.js +6 -0
- package/lib/module/games/colors-sort/components/index.js.map +1 -0
- package/lib/module/games/dino-jump/DinoJump.js +209 -0
- package/lib/module/games/dino-jump/DinoJump.js.map +1 -0
- package/lib/module/games/dino-jump/DinoJumpConstants.js +189 -0
- package/lib/module/games/dino-jump/DinoJumpConstants.js.map +1 -0
- package/lib/module/games/dino-jump/DinoJumpService.js +270 -0
- package/lib/module/games/dino-jump/DinoJumpService.js.map +1 -0
- package/lib/module/games/dino-jump/DinoJumpStore.js +381 -0
- package/lib/module/games/dino-jump/DinoJumpStore.js.map +1 -0
- package/lib/module/games/dino-jump/components/DinoSprite.js +418 -0
- package/lib/module/games/dino-jump/components/DinoSprite.js.map +1 -0
- package/lib/module/games/dino-jump/components/GameArea.js +68 -0
- package/lib/module/games/dino-jump/components/GameArea.js.map +1 -0
- package/lib/module/games/dino-jump/components/GameBackground.js +444 -0
- package/lib/module/games/dino-jump/components/GameBackground.js.map +1 -0
- package/lib/module/games/dino-jump/components/ObstacleSprite.js +306 -0
- package/lib/module/games/dino-jump/components/ObstacleSprite.js.map +1 -0
- package/lib/module/games/dino-jump/components/ScoreBoard.js +105 -0
- package/lib/module/games/dino-jump/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/dino-jump/components/StarSprite.js +45 -0
- package/lib/module/games/dino-jump/components/StarSprite.js.map +1 -0
- package/lib/module/games/dino-jump/components/index.js +9 -0
- package/lib/module/games/dino-jump/components/index.js.map +1 -0
- package/lib/module/games/flappy-bird/FlappyBird.js +126 -0
- package/lib/module/games/flappy-bird/FlappyBird.js.map +1 -0
- package/lib/module/games/flappy-bird/FlappyBirdConstants.js +90 -0
- package/lib/module/games/flappy-bird/FlappyBirdConstants.js.map +1 -0
- package/lib/module/games/flappy-bird/FlappyBirdStore.js +300 -0
- package/lib/module/games/flappy-bird/FlappyBirdStore.js.map +1 -0
- package/lib/module/games/flappy-bird/components/Bird.js +87 -0
- package/lib/module/games/flappy-bird/components/Bird.js.map +1 -0
- package/lib/module/games/flappy-bird/components/GameArea.js +87 -0
- package/lib/module/games/flappy-bird/components/GameArea.js.map +1 -0
- package/lib/module/games/flappy-bird/components/GameBackground.js +79 -0
- package/lib/module/games/flappy-bird/components/GameBackground.js.map +1 -0
- package/lib/module/games/flappy-bird/components/Pipes.js +172 -0
- package/lib/module/games/flappy-bird/components/Pipes.js.map +1 -0
- package/lib/module/games/flappy-bird/components/ScoreBoard.js +73 -0
- package/lib/module/games/flappy-bird/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/flappy-bird/components/index.js +8 -0
- package/lib/module/games/flappy-bird/components/index.js.map +1 -0
- package/lib/module/games/fruit-merger/FruitMerger.js +120 -0
- package/lib/module/games/fruit-merger/FruitMerger.js.map +1 -0
- package/lib/module/games/fruit-merger/FruitMergerConstants.js +119 -0
- package/lib/module/games/fruit-merger/FruitMergerConstants.js.map +1 -0
- package/lib/module/games/fruit-merger/FruitMergerService.js +13 -0
- package/lib/module/games/fruit-merger/FruitMergerService.js.map +1 -0
- package/lib/module/games/fruit-merger/FruitMergerStore.js +315 -0
- package/lib/module/games/fruit-merger/FruitMergerStore.js.map +1 -0
- package/lib/module/games/fruit-merger/components/FruitItem.js +102 -0
- package/lib/module/games/fruit-merger/components/FruitItem.js.map +1 -0
- package/lib/module/games/fruit-merger/components/GameArea.js +103 -0
- package/lib/module/games/fruit-merger/components/GameArea.js.map +1 -0
- package/lib/module/games/fruit-merger/components/GameBackground.js +498 -0
- package/lib/module/games/fruit-merger/components/GameBackground.js.map +1 -0
- package/lib/module/games/fruit-merger/components/ScoreBoard.js +58 -0
- package/lib/module/games/fruit-merger/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/fruit-merger/components/index.js +7 -0
- package/lib/module/games/fruit-merger/components/index.js.map +1 -0
- package/lib/module/games/fruit-ninja/FruitNinja.js +14 -22
- package/lib/module/games/fruit-ninja/FruitNinja.js.map +1 -1
- package/lib/module/games/fruit-ninja/FruitNinjaStore.js +1 -1
- package/lib/module/games/fruit-ninja/components/GameArea.js +1 -1
- package/lib/module/games/fruit-ninja/components/GameArea.js.map +1 -1
- package/lib/module/games/fruit-ninja/components/GameBackground.js +70 -45
- package/lib/module/games/fruit-ninja/components/GameBackground.js.map +1 -1
- package/lib/module/games/fruit-ninja/components/ScoreBoard.js +47 -46
- package/lib/module/games/fruit-ninja/components/ScoreBoard.js.map +1 -1
- package/lib/module/games/game-2048/Game2048.js +149 -0
- package/lib/module/games/game-2048/Game2048.js.map +1 -0
- package/lib/module/games/game-2048/Game2048Constants.js +263 -0
- package/lib/module/games/game-2048/Game2048Constants.js.map +1 -0
- package/lib/module/games/game-2048/Game2048Service.js +457 -0
- package/lib/module/games/game-2048/Game2048Service.js.map +1 -0
- package/lib/module/games/game-2048/Game2048Store.js +236 -0
- package/lib/module/games/game-2048/Game2048Store.js.map +1 -0
- package/lib/module/games/game-2048/components/GameBackground.js +247 -0
- package/lib/module/games/game-2048/components/GameBackground.js.map +1 -0
- package/lib/module/games/game-2048/components/GameGrid.js +139 -0
- package/lib/module/games/game-2048/components/GameGrid.js.map +1 -0
- package/lib/module/games/game-2048/components/GameTile.js +72 -0
- package/lib/module/games/game-2048/components/GameTile.js.map +1 -0
- package/lib/module/games/game-2048/components/ScoreBoard.js +52 -0
- package/lib/module/games/game-2048/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/game-2048/components/index.js +7 -0
- package/lib/module/games/game-2048/components/index.js.map +1 -0
- package/lib/module/games/maze-runner/MazeRunner.js +51 -41
- package/lib/module/games/maze-runner/MazeRunner.js.map +1 -1
- package/lib/module/games/maze-runner/MazeRunnerService.js +19 -17
- package/lib/module/games/maze-runner/MazeRunnerService.js.map +1 -1
- package/lib/module/games/maze-runner/components/ScoreBoard.js +32 -42
- package/lib/module/games/maze-runner/components/ScoreBoard.js.map +1 -1
- package/lib/module/games/popit-fidget/PopitFidget.js +57 -66
- package/lib/module/games/popit-fidget/PopitFidget.js.map +1 -1
- package/lib/module/games/popit-fidget/PopitFidgetStore.js +6 -44
- package/lib/module/games/popit-fidget/PopitFidgetStore.js.map +1 -1
- package/lib/module/games/popit-fidget/components/ScoreBoard.js +31 -45
- package/lib/module/games/popit-fidget/components/ScoreBoard.js.map +1 -1
- package/lib/module/games/sliding-numbers/SlidingNumbers.js +159 -0
- package/lib/module/games/sliding-numbers/SlidingNumbers.js.map +1 -0
- package/lib/module/games/sliding-numbers/SlidingNumbersConstants.js +207 -0
- package/lib/module/games/sliding-numbers/SlidingNumbersConstants.js.map +1 -0
- package/lib/module/games/sliding-numbers/SlidingNumbersService.js +248 -0
- package/lib/module/games/sliding-numbers/SlidingNumbersService.js.map +1 -0
- package/lib/module/games/sliding-numbers/SlidingNumbersStore.js +274 -0
- package/lib/module/games/sliding-numbers/SlidingNumbersStore.js.map +1 -0
- package/lib/module/games/sliding-numbers/components/GameBackground.js +259 -0
- package/lib/module/games/sliding-numbers/components/GameBackground.js.map +1 -0
- package/lib/module/games/sliding-numbers/components/NumbersGrid.js +174 -0
- package/lib/module/games/sliding-numbers/components/NumbersGrid.js.map +1 -0
- package/lib/module/games/sliding-numbers/components/NumbersTile.js +116 -0
- package/lib/module/games/sliding-numbers/components/NumbersTile.js.map +1 -0
- package/lib/module/games/sliding-numbers/components/ScoreBoard.js +64 -0
- package/lib/module/games/sliding-numbers/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/sliding-numbers/components/index.js +7 -0
- package/lib/module/games/sliding-numbers/components/index.js.map +1 -0
- package/lib/module/games/snake/Snake.js +189 -0
- package/lib/module/games/snake/Snake.js.map +1 -0
- package/lib/module/games/snake/SnakeConstants.js +138 -0
- package/lib/module/games/snake/SnakeConstants.js.map +1 -0
- package/lib/module/games/snake/SnakeService.js +148 -0
- package/lib/module/games/snake/SnakeService.js.map +1 -0
- package/lib/module/games/snake/SnakeStore.js +182 -0
- package/lib/module/games/snake/SnakeStore.js.map +1 -0
- package/lib/module/games/snake/components/GameBackground.js +221 -0
- package/lib/module/games/snake/components/GameBackground.js.map +1 -0
- package/lib/module/games/snake/components/GameGrid.js +153 -0
- package/lib/module/games/snake/components/GameGrid.js.map +1 -0
- package/lib/module/games/snake/components/ScoreBoard.js +51 -0
- package/lib/module/games/snake/components/ScoreBoard.js.map +1 -0
- package/lib/module/games/snake/components/index.js +6 -0
- package/lib/module/games/snake/components/index.js.map +1 -0
- package/lib/module/games/snake/index.js +6 -0
- package/lib/module/games/snake/index.js.map +1 -0
- package/lib/module/games/space-fighter/SpaceFighter.js +22 -26
- package/lib/module/games/space-fighter/SpaceFighter.js.map +1 -1
- package/lib/module/games/space-fighter/SpaceFighterService.js +7 -6
- package/lib/module/games/space-fighter/SpaceFighterService.js.map +1 -1
- package/lib/module/games/space-fighter/SpaceFighterStore.js +25 -11
- package/lib/module/games/space-fighter/SpaceFighterStore.js.map +1 -1
- package/lib/module/games/space-fighter/components/GameArea.js +1 -7
- package/lib/module/games/space-fighter/components/GameArea.js.map +1 -1
- package/lib/module/games/space-fighter/components/ScoreBoard.js +47 -48
- package/lib/module/games/space-fighter/components/ScoreBoard.js.map +1 -1
- package/lib/module/games/whack-a-mole/WhackAMole.js +17 -10
- package/lib/module/games/whack-a-mole/WhackAMole.js.map +1 -1
- package/lib/module/games/whack-a-mole/WhackAMoleStore.js +1 -1
- package/lib/module/games/whack-a-mole/components/GameBackground.js +37 -30
- package/lib/module/games/whack-a-mole/components/GameBackground.js.map +1 -1
- package/lib/module/games/whack-a-mole/components/ScoreBoard.js +32 -38
- package/lib/module/games/whack-a-mole/components/ScoreBoard.js.map +1 -1
- package/lib/module/helpers/AnimationFrame.js.map +1 -0
- package/lib/module/helpers/AnimationTracker.js.map +1 -0
- package/lib/module/helpers/ErrorHandler.js.map +1 -0
- package/lib/module/helpers/GameControlButton.js.map +1 -0
- package/lib/module/{shared/helpers → helpers}/GameOverModal.js +6 -3
- package/lib/module/helpers/GameOverModal.js.map +1 -0
- package/lib/module/{shared/helpers → helpers}/GameSettingsModal.js +5 -5
- package/lib/module/helpers/GameSettingsModal.js.map +1 -0
- package/lib/module/{shared/helpers → helpers}/ParticleBlast.js +3 -2
- package/lib/module/helpers/ParticleBlast.js.map +1 -0
- package/lib/module/helpers/ScoreBoardContainer.js +34 -0
- package/lib/module/helpers/ScoreBoardContainer.js.map +1 -0
- package/lib/module/{shared/helpers → helpers}/index.js +1 -1
- package/lib/module/helpers/index.js.map +1 -0
- package/lib/module/index.js +9 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/services/GamesConstants.js +100 -5
- package/lib/module/services/GamesConstants.js.map +1 -1
- package/lib/module/services/GamesService.js +108 -42
- package/lib/module/services/GamesService.js.map +1 -1
- package/lib/module/services/SoundsService.js +132 -1
- package/lib/module/services/SoundsService.js.map +1 -1
- package/lib/module/services/UtilsService.js +32 -0
- package/lib/module/services/UtilsService.js.map +1 -0
- package/lib/typescript/src/games/balloon-blaster/BalloonBlaster.d.ts +1 -1
- package/lib/typescript/src/games/balloon-blaster/BalloonBlaster.d.ts.map +1 -1
- package/lib/typescript/src/games/balloon-blaster/components/GameBackground.d.ts +1 -0
- 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 +5 -1
- package/lib/typescript/src/games/balloon-blaster/components/ScoreBoard.d.ts.map +1 -1
- package/lib/typescript/src/games/candy-crush/CandyCrush.d.ts +4 -0
- package/lib/typescript/src/games/candy-crush/CandyCrush.d.ts.map +1 -0
- package/lib/typescript/src/games/candy-crush/CandyCrushConstants.d.ts +104 -0
- package/lib/typescript/src/games/candy-crush/CandyCrushConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/candy-crush/CandyCrushService.d.ts +40 -0
- package/lib/typescript/src/games/candy-crush/CandyCrushService.d.ts.map +1 -0
- package/lib/typescript/src/games/candy-crush/CandyCrushStore.d.ts +48 -0
- package/lib/typescript/src/games/candy-crush/CandyCrushStore.d.ts.map +1 -0
- package/lib/typescript/src/games/candy-crush/components/CandyItem.d.ts +13 -0
- package/lib/typescript/src/games/candy-crush/components/CandyItem.d.ts.map +1 -0
- package/lib/typescript/src/games/candy-crush/components/GameBackground.d.ts +5 -0
- package/lib/typescript/src/games/candy-crush/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/candy-crush/components/GameGrid.d.ts +3 -0
- package/lib/typescript/src/games/candy-crush/components/GameGrid.d.ts.map +1 -0
- package/lib/typescript/src/games/candy-crush/components/ScoreBoard.d.ts +6 -0
- package/lib/typescript/src/games/candy-crush/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/candy-crush/components/index.d.ts +5 -0
- package/lib/typescript/src/games/candy-crush/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/candy-crush/index.d.ts +4 -0
- package/lib/typescript/src/games/candy-crush/index.d.ts.map +1 -0
- package/lib/typescript/src/games/colors-sort/ColorsSort.d.ts +4 -0
- package/lib/typescript/src/games/colors-sort/ColorsSort.d.ts.map +1 -0
- package/lib/typescript/src/games/colors-sort/ColorsSortConstants.d.ts +54 -0
- package/lib/typescript/src/games/colors-sort/ColorsSortConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/colors-sort/ColorsSortService.d.ts +66 -0
- package/lib/typescript/src/games/colors-sort/ColorsSortService.d.ts.map +1 -0
- package/lib/typescript/src/games/colors-sort/ColorsSortStore.d.ts +48 -0
- package/lib/typescript/src/games/colors-sort/ColorsSortStore.d.ts.map +1 -0
- package/lib/typescript/src/games/colors-sort/components/ColorContainer.d.ts +11 -0
- package/lib/typescript/src/games/colors-sort/components/ColorContainer.d.ts.map +1 -0
- package/lib/typescript/src/games/colors-sort/components/GameBackground.d.ts +7 -0
- package/lib/typescript/src/games/colors-sort/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/colors-sort/components/ScoreBoard.d.ts +7 -0
- package/lib/typescript/src/games/colors-sort/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/colors-sort/components/index.d.ts +4 -0
- package/lib/typescript/src/games/colors-sort/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/dino-jump/DinoJump.d.ts +4 -0
- package/lib/typescript/src/games/dino-jump/DinoJump.d.ts.map +1 -0
- package/lib/typescript/src/games/dino-jump/DinoJumpConstants.d.ts +97 -0
- package/lib/typescript/src/games/dino-jump/DinoJumpConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/dino-jump/DinoJumpService.d.ts +40 -0
- package/lib/typescript/src/games/dino-jump/DinoJumpService.d.ts.map +1 -0
- package/lib/typescript/src/games/dino-jump/DinoJumpStore.d.ts +103 -0
- package/lib/typescript/src/games/dino-jump/DinoJumpStore.d.ts.map +1 -0
- package/lib/typescript/src/games/dino-jump/components/DinoSprite.d.ts +3 -0
- package/lib/typescript/src/games/dino-jump/components/DinoSprite.d.ts.map +1 -0
- package/lib/typescript/src/games/dino-jump/components/GameArea.d.ts +8 -0
- package/lib/typescript/src/games/dino-jump/components/GameArea.d.ts.map +1 -0
- package/lib/typescript/src/games/dino-jump/components/GameBackground.d.ts +8 -0
- package/lib/typescript/src/games/dino-jump/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/dino-jump/components/ObstacleSprite.d.ts +3 -0
- package/lib/typescript/src/games/dino-jump/components/ObstacleSprite.d.ts.map +1 -0
- package/lib/typescript/src/games/dino-jump/components/ScoreBoard.d.ts +7 -0
- package/lib/typescript/src/games/dino-jump/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/dino-jump/components/StarSprite.d.ts +3 -0
- package/lib/typescript/src/games/dino-jump/components/StarSprite.d.ts.map +1 -0
- package/lib/typescript/src/games/dino-jump/components/index.d.ts +7 -0
- package/lib/typescript/src/games/dino-jump/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/flappy-bird/FlappyBird.d.ts +4 -0
- package/lib/typescript/src/games/flappy-bird/FlappyBird.d.ts.map +1 -0
- package/lib/typescript/src/games/flappy-bird/FlappyBirdConstants.d.ts +83 -0
- package/lib/typescript/src/games/flappy-bird/FlappyBirdConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/flappy-bird/FlappyBirdStore.d.ts +53 -0
- package/lib/typescript/src/games/flappy-bird/FlappyBirdStore.d.ts.map +1 -0
- package/lib/typescript/src/games/flappy-bird/components/Bird.d.ts +8 -0
- package/lib/typescript/src/games/flappy-bird/components/Bird.d.ts.map +1 -0
- package/lib/typescript/src/games/flappy-bird/components/GameArea.d.ts +8 -0
- package/lib/typescript/src/games/flappy-bird/components/GameArea.d.ts.map +1 -0
- package/lib/typescript/src/games/flappy-bird/components/GameBackground.d.ts +8 -0
- package/lib/typescript/src/games/flappy-bird/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/flappy-bird/components/Pipes.d.ts +9 -0
- package/lib/typescript/src/games/flappy-bird/components/Pipes.d.ts.map +1 -0
- package/lib/typescript/src/games/flappy-bird/components/ScoreBoard.d.ts +7 -0
- package/lib/typescript/src/games/flappy-bird/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/flappy-bird/components/index.d.ts +6 -0
- package/lib/typescript/src/games/flappy-bird/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-merger/FruitMerger.d.ts +4 -0
- package/lib/typescript/src/games/fruit-merger/FruitMerger.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-merger/FruitMergerConstants.d.ts +115 -0
- package/lib/typescript/src/games/fruit-merger/FruitMergerConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-merger/FruitMergerService.d.ts +5 -0
- package/lib/typescript/src/games/fruit-merger/FruitMergerService.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-merger/FruitMergerStore.d.ts +43 -0
- package/lib/typescript/src/games/fruit-merger/FruitMergerStore.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-merger/components/FruitItem.d.ts +10 -0
- package/lib/typescript/src/games/fruit-merger/components/FruitItem.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-merger/components/GameArea.d.ts +8 -0
- package/lib/typescript/src/games/fruit-merger/components/GameArea.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-merger/components/GameBackground.d.ts +8 -0
- package/lib/typescript/src/games/fruit-merger/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-merger/components/ScoreBoard.d.ts +7 -0
- package/lib/typescript/src/games/fruit-merger/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-merger/components/index.d.ts +5 -0
- package/lib/typescript/src/games/fruit-merger/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/fruit-ninja/FruitNinja.d.ts +1 -1
- package/lib/typescript/src/games/fruit-ninja/FruitNinja.d.ts.map +1 -1
- package/lib/typescript/src/games/fruit-ninja/components/GameBackground.d.ts +1 -0
- package/lib/typescript/src/games/fruit-ninja/components/GameBackground.d.ts.map +1 -1
- package/lib/typescript/src/games/fruit-ninja/components/ScoreBoard.d.ts +5 -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 +4 -0
- package/lib/typescript/src/games/game-2048/Game2048.d.ts.map +1 -0
- package/lib/typescript/src/games/game-2048/Game2048Constants.d.ts +163 -0
- package/lib/typescript/src/games/game-2048/Game2048Constants.d.ts.map +1 -0
- package/lib/typescript/src/games/game-2048/Game2048Service.d.ts +113 -0
- package/lib/typescript/src/games/game-2048/Game2048Service.d.ts.map +1 -0
- package/lib/typescript/src/games/game-2048/Game2048Store.d.ts +48 -0
- package/lib/typescript/src/games/game-2048/Game2048Store.d.ts.map +1 -0
- package/lib/typescript/src/games/game-2048/components/GameBackground.d.ts +7 -0
- package/lib/typescript/src/games/game-2048/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/game-2048/components/GameGrid.d.ts +7 -0
- package/lib/typescript/src/games/game-2048/components/GameGrid.d.ts.map +1 -0
- package/lib/typescript/src/games/game-2048/components/GameTile.d.ts +13 -0
- package/lib/typescript/src/games/game-2048/components/GameTile.d.ts.map +1 -0
- package/lib/typescript/src/games/game-2048/components/ScoreBoard.d.ts +7 -0
- package/lib/typescript/src/games/game-2048/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/game-2048/components/index.d.ts +5 -0
- package/lib/typescript/src/games/game-2048/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/maze-runner/MazeRunner.d.ts +1 -1
- package/lib/typescript/src/games/maze-runner/MazeRunner.d.ts.map +1 -1
- package/lib/typescript/src/games/maze-runner/MazeRunnerService.d.ts +1 -0
- package/lib/typescript/src/games/maze-runner/MazeRunnerService.d.ts.map +1 -1
- package/lib/typescript/src/games/maze-runner/components/ScoreBoard.d.ts +1 -0
- package/lib/typescript/src/games/maze-runner/components/ScoreBoard.d.ts.map +1 -1
- package/lib/typescript/src/games/popit-fidget/PopitFidget.d.ts +1 -1
- package/lib/typescript/src/games/popit-fidget/PopitFidget.d.ts.map +1 -1
- package/lib/typescript/src/games/popit-fidget/PopitFidgetStore.d.ts +2 -5
- package/lib/typescript/src/games/popit-fidget/PopitFidgetStore.d.ts.map +1 -1
- package/lib/typescript/src/games/popit-fidget/components/ScoreBoard.d.ts +2 -2
- package/lib/typescript/src/games/popit-fidget/components/ScoreBoard.d.ts.map +1 -1
- package/lib/typescript/src/games/sliding-numbers/SlidingNumbers.d.ts +4 -0
- package/lib/typescript/src/games/sliding-numbers/SlidingNumbers.d.ts.map +1 -0
- package/lib/typescript/src/games/sliding-numbers/SlidingNumbersConstants.d.ts +108 -0
- package/lib/typescript/src/games/sliding-numbers/SlidingNumbersConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/sliding-numbers/SlidingNumbersService.d.ts +34 -0
- package/lib/typescript/src/games/sliding-numbers/SlidingNumbersService.d.ts.map +1 -0
- package/lib/typescript/src/games/sliding-numbers/SlidingNumbersStore.d.ts +56 -0
- package/lib/typescript/src/games/sliding-numbers/SlidingNumbersStore.d.ts.map +1 -0
- package/lib/typescript/src/games/sliding-numbers/components/GameBackground.d.ts +7 -0
- package/lib/typescript/src/games/sliding-numbers/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/sliding-numbers/components/NumbersGrid.d.ts +7 -0
- package/lib/typescript/src/games/sliding-numbers/components/NumbersGrid.d.ts.map +1 -0
- package/lib/typescript/src/games/sliding-numbers/components/NumbersTile.d.ts +11 -0
- package/lib/typescript/src/games/sliding-numbers/components/NumbersTile.d.ts.map +1 -0
- package/lib/typescript/src/games/sliding-numbers/components/ScoreBoard.d.ts +7 -0
- package/lib/typescript/src/games/sliding-numbers/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/sliding-numbers/components/index.d.ts +5 -0
- package/lib/typescript/src/games/sliding-numbers/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/snake/Snake.d.ts +4 -0
- package/lib/typescript/src/games/snake/Snake.d.ts.map +1 -0
- package/lib/typescript/src/games/snake/SnakeConstants.d.ts +93 -0
- package/lib/typescript/src/games/snake/SnakeConstants.d.ts.map +1 -0
- package/lib/typescript/src/games/snake/SnakeService.d.ts +30 -0
- package/lib/typescript/src/games/snake/SnakeService.d.ts.map +1 -0
- package/lib/typescript/src/games/snake/SnakeStore.d.ts +43 -0
- package/lib/typescript/src/games/snake/SnakeStore.d.ts.map +1 -0
- package/lib/typescript/src/games/snake/components/GameBackground.d.ts +5 -0
- package/lib/typescript/src/games/snake/components/GameBackground.d.ts.map +1 -0
- package/lib/typescript/src/games/snake/components/GameGrid.d.ts +3 -0
- package/lib/typescript/src/games/snake/components/GameGrid.d.ts.map +1 -0
- package/lib/typescript/src/games/snake/components/ScoreBoard.d.ts +7 -0
- package/lib/typescript/src/games/snake/components/ScoreBoard.d.ts.map +1 -0
- package/lib/typescript/src/games/snake/components/index.d.ts +4 -0
- package/lib/typescript/src/games/snake/components/index.d.ts.map +1 -0
- package/lib/typescript/src/games/snake/index.d.ts +4 -0
- package/lib/typescript/src/games/snake/index.d.ts.map +1 -0
- package/lib/typescript/src/games/space-fighter/SpaceFighter.d.ts +1 -1
- package/lib/typescript/src/games/space-fighter/SpaceFighter.d.ts.map +1 -1
- package/lib/typescript/src/games/space-fighter/SpaceFighterService.d.ts.map +1 -1
- package/lib/typescript/src/games/space-fighter/SpaceFighterStore.d.ts +2 -0
- package/lib/typescript/src/games/space-fighter/SpaceFighterStore.d.ts.map +1 -1
- package/lib/typescript/src/games/space-fighter/components/GameArea.d.ts.map +1 -1
- package/lib/typescript/src/games/space-fighter/components/ScoreBoard.d.ts +5 -1
- package/lib/typescript/src/games/space-fighter/components/ScoreBoard.d.ts.map +1 -1
- package/lib/typescript/src/games/whack-a-mole/WhackAMole.d.ts +1 -1
- package/lib/typescript/src/games/whack-a-mole/WhackAMole.d.ts.map +1 -1
- package/lib/typescript/src/games/whack-a-mole/components/GameBackground.d.ts +1 -0
- package/lib/typescript/src/games/whack-a-mole/components/GameBackground.d.ts.map +1 -1
- package/lib/typescript/src/games/whack-a-mole/components/ScoreBoard.d.ts +1 -0
- package/lib/typescript/src/games/whack-a-mole/components/ScoreBoard.d.ts.map +1 -1
- package/lib/typescript/src/helpers/AnimationFrame.d.ts.map +1 -0
- package/lib/typescript/src/helpers/AnimationTracker.d.ts.map +1 -0
- package/lib/typescript/src/helpers/ErrorHandler.d.ts.map +1 -0
- package/lib/typescript/src/helpers/GameControlButton.d.ts.map +1 -0
- package/lib/typescript/src/{shared/helpers → helpers}/GameOverModal.d.ts +2 -0
- package/lib/typescript/src/helpers/GameOverModal.d.ts.map +1 -0
- package/lib/typescript/src/{shared/helpers → helpers}/GameSettingsModal.d.ts +1 -1
- package/lib/typescript/src/helpers/GameSettingsModal.d.ts.map +1 -0
- package/lib/typescript/src/helpers/ParticleBlast.d.ts.map +1 -0
- package/lib/typescript/src/helpers/ScoreBoardContainer.d.ts +9 -0
- package/lib/typescript/src/helpers/ScoreBoardContainer.d.ts.map +1 -0
- package/lib/typescript/src/{shared/helpers → helpers}/index.d.ts +2 -1
- package/lib/typescript/src/helpers/index.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +9 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/services/GamesConstants.d.ts +162 -0
- package/lib/typescript/src/services/GamesConstants.d.ts.map +1 -1
- package/lib/typescript/src/services/GamesService.d.ts +3 -25
- package/lib/typescript/src/services/GamesService.d.ts.map +1 -1
- package/lib/typescript/src/services/SoundsService.d.ts +103 -0
- package/lib/typescript/src/services/SoundsService.d.ts.map +1 -1
- package/lib/typescript/src/services/UtilsService.d.ts +38 -0
- package/lib/typescript/src/services/UtilsService.d.ts.map +1 -0
- package/package.json +1 -1
- package/lib/module/shared/helpers/AnimationFrame.js.map +0 -1
- package/lib/module/shared/helpers/AnimationTracker.js.map +0 -1
- package/lib/module/shared/helpers/ErrorHandler.js.map +0 -1
- package/lib/module/shared/helpers/GameControlButton.js.map +0 -1
- package/lib/module/shared/helpers/GameOverModal.js.map +0 -1
- package/lib/module/shared/helpers/GameSettingsModal.js.map +0 -1
- package/lib/module/shared/helpers/ParticleBlast.js.map +0 -1
- package/lib/module/shared/helpers/ResponsiveScoreBoard.js +0 -81
- package/lib/module/shared/helpers/ResponsiveScoreBoard.js.map +0 -1
- package/lib/module/shared/helpers/index.js.map +0 -1
- package/lib/typescript/src/shared/helpers/AnimationFrame.d.ts.map +0 -1
- package/lib/typescript/src/shared/helpers/AnimationTracker.d.ts.map +0 -1
- package/lib/typescript/src/shared/helpers/ErrorHandler.d.ts.map +0 -1
- package/lib/typescript/src/shared/helpers/GameControlButton.d.ts.map +0 -1
- package/lib/typescript/src/shared/helpers/GameOverModal.d.ts.map +0 -1
- package/lib/typescript/src/shared/helpers/GameSettingsModal.d.ts.map +0 -1
- package/lib/typescript/src/shared/helpers/ParticleBlast.d.ts.map +0 -1
- package/lib/typescript/src/shared/helpers/ResponsiveScoreBoard.d.ts +0 -42
- package/lib/typescript/src/shared/helpers/ResponsiveScoreBoard.d.ts.map +0 -1
- package/lib/typescript/src/shared/helpers/index.d.ts.map +0 -1
- /package/lib/module/{shared/helpers → helpers}/AnimationFrame.js +0 -0
- /package/lib/module/{shared/helpers → helpers}/AnimationTracker.js +0 -0
- /package/lib/module/{shared/helpers → helpers}/ErrorHandler.js +0 -0
- /package/lib/module/{shared/helpers → helpers}/GameControlButton.js +0 -0
- /package/lib/typescript/src/{shared/helpers → helpers}/AnimationFrame.d.ts +0 -0
- /package/lib/typescript/src/{shared/helpers → helpers}/AnimationTracker.d.ts +0 -0
- /package/lib/typescript/src/{shared/helpers → helpers}/ErrorHandler.d.ts +0 -0
- /package/lib/typescript/src/{shared/helpers → helpers}/GameControlButton.d.ts +0 -0
- /package/lib/typescript/src/{shared/helpers → helpers}/ParticleBlast.d.ts +0 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useMemo } from 'react';
|
|
4
|
+
import { View, StyleSheet, Dimensions } from 'react-native';
|
|
5
|
+
import Animated, { useAnimatedStyle, withSpring, useSharedValue, withSequence } from 'react-native-reanimated';
|
|
6
|
+
import { NumbersTile } from "./NumbersTile.js";
|
|
7
|
+
import { useTiles, useGridSize, useEmptyPosition, useSlidingNumbersStore } from "../SlidingNumbersStore.js";
|
|
8
|
+
import { SLIDING_NUMBERS_GAME_CONFIG, SLIDING_NUMBERS_ANIMATION_CONFIG } from "../SlidingNumbersConstants.js";
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
export const NumbersGrid = /*#__PURE__*/React.memo(({
|
|
11
|
+
difficulty
|
|
12
|
+
}) => {
|
|
13
|
+
const tiles = useTiles();
|
|
14
|
+
const gridSize = useGridSize();
|
|
15
|
+
const emptyPosition = useEmptyPosition();
|
|
16
|
+
const isPlaying = useSlidingNumbersStore(state => state.isPlaying);
|
|
17
|
+
const isCompleted = useSlidingNumbersStore(state => state.isCompleted);
|
|
18
|
+
const moveTile = useSlidingNumbersStore(state => state.moveTile);
|
|
19
|
+
const checkCompletion = useSlidingNumbersStore(state => state.checkCompletion);
|
|
20
|
+
const completionScale = useSharedValue(1);
|
|
21
|
+
|
|
22
|
+
// Calculate grid dimensions
|
|
23
|
+
const gridDimensions = useMemo(() => {
|
|
24
|
+
const gap = SLIDING_NUMBERS_GAME_CONFIG.TILE_GAP;
|
|
25
|
+
const padding = (gap + 8) * 2; // padding from grid container
|
|
26
|
+
|
|
27
|
+
// Calculate available space for the grid content
|
|
28
|
+
const {
|
|
29
|
+
width: screenWidth
|
|
30
|
+
} = Dimensions.get('window');
|
|
31
|
+
const maxAvailableWidth = screenWidth - padding - 40; // Leave margin for screen edges
|
|
32
|
+
|
|
33
|
+
// Calculate optimal tile size based on grid size
|
|
34
|
+
const availableForTiles = maxAvailableWidth - gap * (gridSize - 1);
|
|
35
|
+
const optimalTileSize = Math.floor(availableForTiles / gridSize);
|
|
36
|
+
|
|
37
|
+
// Ensure minimum tile size for usability
|
|
38
|
+
const minTileSize = 45;
|
|
39
|
+
const maxTileSize = 80;
|
|
40
|
+
const tileSize = Math.max(minTileSize, Math.min(maxTileSize, optimalTileSize));
|
|
41
|
+
|
|
42
|
+
// Calculate actual content size: tiles + gaps between them
|
|
43
|
+
const tilesWidth = tileSize * gridSize;
|
|
44
|
+
const gapsWidth = gap * (gridSize - 1);
|
|
45
|
+
const contentSize = tilesWidth + gapsWidth;
|
|
46
|
+
const totalSize = contentSize + padding;
|
|
47
|
+
return {
|
|
48
|
+
width: totalSize,
|
|
49
|
+
height: totalSize,
|
|
50
|
+
contentWidth: contentSize,
|
|
51
|
+
contentHeight: contentSize,
|
|
52
|
+
tileSize,
|
|
53
|
+
gap
|
|
54
|
+
};
|
|
55
|
+
}, [gridSize]);
|
|
56
|
+
|
|
57
|
+
// Create grid layout
|
|
58
|
+
const gridLayout = useMemo(() => {
|
|
59
|
+
const layout = [];
|
|
60
|
+
|
|
61
|
+
// Initialize empty grid
|
|
62
|
+
for (let row = 0; row < gridSize; row++) {
|
|
63
|
+
layout[row] = [];
|
|
64
|
+
for (let col = 0; col < gridSize; col++) {
|
|
65
|
+
const rowArray = layout[row];
|
|
66
|
+
if (rowArray) {
|
|
67
|
+
rowArray[col] = null;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Place tiles in their current positions
|
|
73
|
+
tiles.forEach(tile => {
|
|
74
|
+
const {
|
|
75
|
+
row,
|
|
76
|
+
col
|
|
77
|
+
} = tile.position;
|
|
78
|
+
if (row >= 0 && row < gridSize && col >= 0 && col < gridSize && layout[row]) {
|
|
79
|
+
layout[row][col] = tile;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
return layout;
|
|
83
|
+
}, [tiles, gridSize]);
|
|
84
|
+
|
|
85
|
+
// Memoized tile press handler with useCallback
|
|
86
|
+
const handleTilePress = React.useCallback(tileId => {
|
|
87
|
+
if (!isPlaying || isCompleted) return;
|
|
88
|
+
const success = moveTile(tileId);
|
|
89
|
+
if (success) {
|
|
90
|
+
// Check completion after successful move
|
|
91
|
+
checkCompletion(difficulty);
|
|
92
|
+
}
|
|
93
|
+
}, [isPlaying, isCompleted, moveTile, checkCompletion, difficulty]);
|
|
94
|
+
|
|
95
|
+
// Memoized tile movability checker with useCallback
|
|
96
|
+
const isTileMovable = React.useCallback(tile => {
|
|
97
|
+
if (!tile || tile.value === 0 || !isPlaying || isCompleted) return false;
|
|
98
|
+
const emptyPos = emptyPosition;
|
|
99
|
+
const rowDiff = Math.abs(tile.position.row - emptyPos.row);
|
|
100
|
+
const colDiff = Math.abs(tile.position.col - emptyPos.col);
|
|
101
|
+
return rowDiff === 1 && colDiff === 0 || rowDiff === 0 && colDiff === 1;
|
|
102
|
+
}, [emptyPosition, isPlaying, isCompleted]);
|
|
103
|
+
|
|
104
|
+
// Animated style for completion celebration
|
|
105
|
+
const animatedGridStyle = useAnimatedStyle(() => ({
|
|
106
|
+
transform: [{
|
|
107
|
+
scale: completionScale.value
|
|
108
|
+
}]
|
|
109
|
+
}));
|
|
110
|
+
|
|
111
|
+
// Trigger completion animation
|
|
112
|
+
React.useEffect(() => {
|
|
113
|
+
if (isCompleted) {
|
|
114
|
+
completionScale.value = withSequence(withSpring(1.1, SLIDING_NUMBERS_ANIMATION_CONFIG.COMPLETION_CELEBRATION), withSpring(1, SLIDING_NUMBERS_ANIMATION_CONFIG.COMPLETION_CELEBRATION));
|
|
115
|
+
}
|
|
116
|
+
}, [isCompleted]);
|
|
117
|
+
|
|
118
|
+
// Memoize grid container style
|
|
119
|
+
const gridContainerStyle = useMemo(() => [styles.gridContainer, {
|
|
120
|
+
width: gridDimensions.width,
|
|
121
|
+
height: gridDimensions.height
|
|
122
|
+
}, animatedGridStyle], [gridDimensions.width, gridDimensions.height, animatedGridStyle]);
|
|
123
|
+
|
|
124
|
+
// Memoize tile slot style factory
|
|
125
|
+
const getTileSlotStyle = React.useCallback(tileSize => [styles.tileSlot, {
|
|
126
|
+
width: tileSize,
|
|
127
|
+
height: tileSize
|
|
128
|
+
}], []);
|
|
129
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
130
|
+
style: gridContainerStyle,
|
|
131
|
+
children: gridLayout.map((row, rowIndex) => /*#__PURE__*/_jsx(View, {
|
|
132
|
+
style: styles.row,
|
|
133
|
+
children: row.map((tile, colIndex) => /*#__PURE__*/_jsx(View, {
|
|
134
|
+
style: getTileSlotStyle(gridDimensions.tileSize),
|
|
135
|
+
children: tile && tile.value !== 0 && /*#__PURE__*/_jsx(NumbersTile, {
|
|
136
|
+
tile: tile,
|
|
137
|
+
onPress: handleTilePress,
|
|
138
|
+
isMovable: isTileMovable(tile),
|
|
139
|
+
tileSize: gridDimensions.tileSize
|
|
140
|
+
})
|
|
141
|
+
}, `${rowIndex}-${colIndex}`))
|
|
142
|
+
}, rowIndex))
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
const styles = StyleSheet.create({
|
|
146
|
+
gridContainer: {
|
|
147
|
+
backgroundColor: '#FFFFFF',
|
|
148
|
+
borderRadius: 20,
|
|
149
|
+
padding: SLIDING_NUMBERS_GAME_CONFIG.TILE_GAP + 8,
|
|
150
|
+
// Clean shadow like the physical puzzle frame
|
|
151
|
+
shadowColor: '#000',
|
|
152
|
+
shadowOffset: {
|
|
153
|
+
width: 0,
|
|
154
|
+
height: 4
|
|
155
|
+
},
|
|
156
|
+
shadowOpacity: 0.1,
|
|
157
|
+
shadowRadius: 8,
|
|
158
|
+
elevation: 8,
|
|
159
|
+
// Ensure the container fits its content properly
|
|
160
|
+
alignSelf: 'center'
|
|
161
|
+
},
|
|
162
|
+
row: {
|
|
163
|
+
flexDirection: 'row',
|
|
164
|
+
justifyContent: 'center',
|
|
165
|
+
alignItems: 'center'
|
|
166
|
+
},
|
|
167
|
+
tileSlot: {
|
|
168
|
+
justifyContent: 'center',
|
|
169
|
+
alignItems: 'center',
|
|
170
|
+
margin: SLIDING_NUMBERS_GAME_CONFIG.TILE_GAP / 2
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
NumbersGrid.displayName = 'NumbersGrid';
|
|
174
|
+
//# sourceMappingURL=NumbersGrid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useMemo","View","StyleSheet","Dimensions","Animated","useAnimatedStyle","withSpring","useSharedValue","withSequence","NumbersTile","useTiles","useGridSize","useEmptyPosition","useSlidingNumbersStore","SLIDING_NUMBERS_GAME_CONFIG","SLIDING_NUMBERS_ANIMATION_CONFIG","jsx","_jsx","NumbersGrid","memo","difficulty","tiles","gridSize","emptyPosition","isPlaying","state","isCompleted","moveTile","checkCompletion","completionScale","gridDimensions","gap","TILE_GAP","padding","width","screenWidth","get","maxAvailableWidth","availableForTiles","optimalTileSize","Math","floor","minTileSize","maxTileSize","tileSize","max","min","tilesWidth","gapsWidth","contentSize","totalSize","height","contentWidth","contentHeight","gridLayout","layout","row","col","rowArray","forEach","tile","position","handleTilePress","useCallback","tileId","success","isTileMovable","value","emptyPos","rowDiff","abs","colDiff","animatedGridStyle","transform","scale","useEffect","COMPLETION_CELEBRATION","gridContainerStyle","styles","gridContainer","getTileSlotStyle","tileSlot","style","children","map","rowIndex","colIndex","onPress","isMovable","create","backgroundColor","borderRadius","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","alignSelf","flexDirection","justifyContent","alignItems","margin","displayName"],"sourceRoot":"../../../../../src","sources":["games/sliding-numbers/components/NumbersGrid.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,SAASC,IAAI,EAAEC,UAAU,EAAEC,UAAU,QAAQ,cAAc;AAC3D,OAAOC,QAAQ,IACbC,gBAAgB,EAChBC,UAAU,EACVC,cAAc,EACdC,YAAY,QACP,yBAAyB;AAChC,SAASC,WAAW,QAAQ,kBAAe;AAC3C,SACEC,QAAQ,EACRC,WAAW,EACXC,gBAAgB,EAChBC,sBAAsB,QACjB,2BAAwB;AAC/B,SACEC,2BAA2B,EAC3BC,gCAAgC,QAC3B,+BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAMpC,OAAO,MAAMC,WAAu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AAA,EAEhDvB,IAAI,IAAIA,IAAI,CAACO,KAAK,KAAK,CAAC,iBACvBlD,IAAA,CAACR,WAAW;UACVmD,IAAI,EAAEA,IAAK;UACX2B,OAAO,EAAEzB,eAAgB;UACzB0B,SAAS,EAAEtB,aAAa,CAACN,IAAI,CAAE;UAC/BhB,QAAQ,EAAEd,cAAc,CAACc;QAAS,CACnC;MACF,GAVI,GAAGyC,QAAQ,IAAIC,QAAQ,EAWxB,CACP;IAAC,GAfOD,QAgBL,CACP;EAAC,CACW,CAAC;AAEpB,CAAC,CAAC;AAEF,MAAMP,MAAM,GAAG5E,UAAU,CAACuF,MAAM,CAAC;EAC/BV,aAAa,EAAE;IACbW,eAAe,EAAE,SAAS;IAC1BC,YAAY,EAAE,EAAE;IAChB1D,OAAO,EAAEnB,2BAA2B,CAACkB,QAAQ,GAAG,CAAC;IAEjD;IACA4D,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MACZ3D,KAAK,EAAE,CAAC;MACRiB,MAAM,EAAE;IACV,CAAC;IACD2C,aAAa,EAAE,GAAG;IAClBC,YAAY,EAAE,CAAC;IACfC,SAAS,EAAE,CAAC;IAEZ;IACAC,SAAS,EAAE;EACb,CAAC;EACDzC,GAAG,EAAE;IACH0C,aAAa,EAAE,KAAK;IACpBC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd,CAAC;EACDnB,QAAQ,EAAE;IACRkB,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,QAAQ;IACpBC,MAAM,EAAEvF,2BAA2B,CAACkB,QAAQ,GAAG;EACjD;AACF,CAAC,CAAC;AAEFd,WAAW,CAACoF,WAAW,GAAG,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { StyleSheet, TouchableOpacity, Text } from 'react-native';
|
|
5
|
+
import Animated, { useSharedValue, useAnimatedStyle, withSpring, runOnJS } from 'react-native-reanimated';
|
|
6
|
+
import { SLIDING_NUMBERS_COLORS, SLIDING_NUMBERS_GAME_CONFIG, SLIDING_NUMBERS_ANIMATION_CONFIG, NUMBER_WORDS } from "../SlidingNumbersConstants.js";
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
const AnimatedTouchableOpacity = Animated.createAnimatedComponent(TouchableOpacity);
|
|
9
|
+
export const NumbersTile = /*#__PURE__*/React.memo(({
|
|
10
|
+
tile,
|
|
11
|
+
onPress,
|
|
12
|
+
isMovable,
|
|
13
|
+
tileSize
|
|
14
|
+
}) => {
|
|
15
|
+
const scale = useSharedValue(1);
|
|
16
|
+
const opacity = useSharedValue(tile.value === 0 ? 0 : 1);
|
|
17
|
+
const handlePress = React.useCallback(() => {
|
|
18
|
+
if (tile.value !== 0 && isMovable) {
|
|
19
|
+
// Animate press feedback
|
|
20
|
+
scale.value = withSpring(0.95, SLIDING_NUMBERS_ANIMATION_CONFIG.TILE_PRESS, () => {
|
|
21
|
+
scale.value = withSpring(1, SLIDING_NUMBERS_ANIMATION_CONFIG.TILE_PRESS);
|
|
22
|
+
});
|
|
23
|
+
runOnJS(onPress)(tile.id);
|
|
24
|
+
}
|
|
25
|
+
}, [tile.value, tile.id, isMovable, onPress, scale]);
|
|
26
|
+
const animatedStyle = useAnimatedStyle(() => ({
|
|
27
|
+
transform: [{
|
|
28
|
+
scale: scale.value
|
|
29
|
+
}],
|
|
30
|
+
opacity: opacity.value
|
|
31
|
+
}));
|
|
32
|
+
|
|
33
|
+
// Don't render empty tile
|
|
34
|
+
if (tile.value === 0) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Memoized tile color and word
|
|
39
|
+
const {
|
|
40
|
+
tileColor,
|
|
41
|
+
numberWord
|
|
42
|
+
} = React.useMemo(() => {
|
|
43
|
+
const colorIndex = (tile.value - 1) % SLIDING_NUMBERS_COLORS.TILE_COLORS.length;
|
|
44
|
+
const color = SLIDING_NUMBERS_COLORS.TILE_COLORS[colorIndex] || SLIDING_NUMBERS_COLORS.TILE_COLORS[0];
|
|
45
|
+
const word = NUMBER_WORDS[tile.value] || '';
|
|
46
|
+
return {
|
|
47
|
+
tileColor: color,
|
|
48
|
+
numberWord: word
|
|
49
|
+
};
|
|
50
|
+
}, [tile.value]);
|
|
51
|
+
|
|
52
|
+
// Memoized font sizes
|
|
53
|
+
const {
|
|
54
|
+
numberFontSize,
|
|
55
|
+
wordFontSize
|
|
56
|
+
} = React.useMemo(() => ({
|
|
57
|
+
numberFontSize: Math.max(16, tileSize * 0.4),
|
|
58
|
+
wordFontSize: Math.max(8, tileSize * 0.15)
|
|
59
|
+
}), [tileSize]);
|
|
60
|
+
return /*#__PURE__*/_jsxs(AnimatedTouchableOpacity, {
|
|
61
|
+
style: [styles.tile, {
|
|
62
|
+
width: tileSize,
|
|
63
|
+
height: tileSize,
|
|
64
|
+
backgroundColor: tileColor,
|
|
65
|
+
borderColor: tile.isCorrect ? 'transparent' : '#FF4444',
|
|
66
|
+
borderWidth: tile.isCorrect ? 0 : 2
|
|
67
|
+
}, animatedStyle],
|
|
68
|
+
onPress: handlePress,
|
|
69
|
+
activeOpacity: 0.8,
|
|
70
|
+
disabled: !isMovable || tile.value === 0,
|
|
71
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
72
|
+
style: [styles.number, {
|
|
73
|
+
fontSize: numberFontSize
|
|
74
|
+
}],
|
|
75
|
+
children: tile.value
|
|
76
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
77
|
+
style: [styles.word, {
|
|
78
|
+
fontSize: wordFontSize
|
|
79
|
+
}],
|
|
80
|
+
children: numberWord
|
|
81
|
+
})]
|
|
82
|
+
});
|
|
83
|
+
}, (prevProps, nextProps) => {
|
|
84
|
+
// Custom comparison for better memoization
|
|
85
|
+
return prevProps.tile.id === nextProps.tile.id && prevProps.tile.value === nextProps.tile.value && prevProps.tile.isCorrect === nextProps.tile.isCorrect && prevProps.tile.position.row === nextProps.tile.position.row && prevProps.tile.position.col === nextProps.tile.position.col && prevProps.isMovable === nextProps.isMovable && prevProps.tileSize === nextProps.tileSize;
|
|
86
|
+
});
|
|
87
|
+
const styles = StyleSheet.create({
|
|
88
|
+
tile: {
|
|
89
|
+
margin: SLIDING_NUMBERS_GAME_CONFIG.TILE_GAP / 2,
|
|
90
|
+
justifyContent: 'center',
|
|
91
|
+
alignItems: 'center',
|
|
92
|
+
borderRadius: 16,
|
|
93
|
+
// Soft shadow like in the image
|
|
94
|
+
shadowColor: '#000',
|
|
95
|
+
shadowOffset: {
|
|
96
|
+
width: 0,
|
|
97
|
+
height: 3
|
|
98
|
+
},
|
|
99
|
+
shadowOpacity: 0.15,
|
|
100
|
+
shadowRadius: 6,
|
|
101
|
+
elevation: 6
|
|
102
|
+
},
|
|
103
|
+
number: {
|
|
104
|
+
fontWeight: 'bold',
|
|
105
|
+
color: '#000000',
|
|
106
|
+
textAlign: 'center',
|
|
107
|
+
marginBottom: 2
|
|
108
|
+
},
|
|
109
|
+
word: {
|
|
110
|
+
fontWeight: 'normal',
|
|
111
|
+
color: '#000000',
|
|
112
|
+
textAlign: 'center'
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
NumbersTile.displayName = 'NumbersTile';
|
|
116
|
+
//# sourceMappingURL=NumbersTile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","StyleSheet","TouchableOpacity","Text","Animated","useSharedValue","useAnimatedStyle","withSpring","runOnJS","SLIDING_NUMBERS_COLORS","SLIDING_NUMBERS_GAME_CONFIG","SLIDING_NUMBERS_ANIMATION_CONFIG","NUMBER_WORDS","jsx","_jsx","jsxs","_jsxs","AnimatedTouchableOpacity","createAnimatedComponent","NumbersTile","memo","tile","onPress","isMovable","tileSize","scale","opacity","value","handlePress","useCallback","TILE_PRESS","id","animatedStyle","transform","tileColor","numberWord","useMemo","colorIndex","TILE_COLORS","length","color","word","numberFontSize","wordFontSize","Math","max","style","styles","width","height","backgroundColor","borderColor","isCorrect","borderWidth","activeOpacity","disabled","children","number","fontSize","prevProps","nextProps","position","row","col","create","margin","TILE_GAP","justifyContent","alignItems","borderRadius","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation","fontWeight","textAlign","marginBottom","displayName"],"sourceRoot":"../../../../../src","sources":["games/sliding-numbers/components/NumbersTile.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,cAAc;AACjE,OAAOC,QAAQ,IACbC,cAAc,EACdC,gBAAgB,EAChBC,UAAU,EACVC,OAAO,QACF,yBAAyB;AAChC,SACEC,sBAAsB,EACtBC,2BAA2B,EAC3BC,gCAAgC,EAChCC,YAAY,QACP,+BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAUpC,MAAMC,wBAAwB,GAAGb,QAAQ,CAACc,uBAAuB,CAAChB,gBAAgB,CAAC;AAEnF,OAAO,MAAMiB,WAAuC,gBAAGnB,KAAK,CAACoB,IAAI,CAAC,CAAC;EACjEC,IAAI;EACJC,OAAO;EACPC,SAAS;EACTC;AACF,CAAC,KAAK;EACJ,MAAMC,KAAK,GAAGpB,cAAc,CAAC,CAAC,CAAC;EAC/B,MAAMqB,OAAO,GAAGrB,cAAc,CAACgB,IAAI,CAACM,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;EAExD,MAAMC,WAAW,GAAG5B,KAAK,CAAC6B,WAAW,CAAC,MAAM;IAC1C,IAAIR,IAAI,CAACM,KAAK,KAAK,CAAC,IAAIJ,SAAS,EAAE;MACjC;MACAE,KAAK,CAACE,KAAK,GAAGpB,UAAU,CAAC,IAAI,EAAEI,gCAAgC,CAACmB,UAAU,EAAE,MAAM;QAChFL,KAAK,CAACE,KAAK,GAAGpB,UAAU,CAAC,CAAC,EAAEI,gCAAgC,CAACmB,UAAU,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AG,KAAKF,SAAS,CAACvC,IAAI,CAACwC,QAAQ,CAACC,GAAG,IAC3DH,SAAS,CAACtC,IAAI,CAACwC,QAAQ,CAACE,GAAG,KAAKH,SAAS,CAACvC,IAAI,CAACwC,QAAQ,CAACE,GAAG,IAC3DJ,SAAS,CAACpC,SAAS,KAAKqC,SAAS,CAACrC,SAAS,IAC3CoC,SAAS,CAACnC,QAAQ,KAAKoC,SAAS,CAACpC,QAAQ;AAE7C,CAAC,CAAC;AAEF,MAAMuB,MAAM,GAAG9C,UAAU,CAAC+D,MAAM,CAAC;EAC/B3C,IAAI,EAAE;IACJ4C,MAAM,EAAEvD,2BAA2B,CAACwD,QAAQ,GAAG,CAAC;IAChDC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,QAAQ;IACpBC,YAAY,EAAE,EAAE;IAEhB;IACAC,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MACZvB,KAAK,EAAE,CAAC;MACRC,MAAM,EAAE;IACV,CAAC;IACDuB,aAAa,EAAE,IAAI;IACnBC,YAAY,EAAE,CAAC;IACfC,SAAS,EAAE;EACb,CAAC;EACDjB,MAAM,EAAE;IACNkB,UAAU,EAAE,MAAM;IAClBnC,KAAK,EAAE,SAAS;IAChBoC,SAAS,EAAE,QAAQ;IACnBC,YAAY,EAAE;EAChB,CAAC;EACDpC,IAAI,EAAE;IACJkC,UAAU,EAAE,QAAQ;IACpBnC,KAAK,EAAE,SAAS;IAChBoC,SAAS,EAAE;EACb;AACF,CAAC,CAAC;AAEFzD,WAAW,CAAC2D,WAAW,GAAG,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useMemo } from 'react';
|
|
4
|
+
import { View, Text, StyleSheet } from 'react-native';
|
|
5
|
+
import { useTimeElapsed } from "../SlidingNumbersStore.js";
|
|
6
|
+
import { SlidingNumbersService } from "../SlidingNumbersService.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 gameService = useMemo(() => new SlidingNumbersService(), []);
|
|
13
|
+
const timeElapsed = useTimeElapsed();
|
|
14
|
+
const formattedTime = useMemo(() => gameService.formatTime(timeElapsed), [gameService, timeElapsed]);
|
|
15
|
+
return /*#__PURE__*/_jsx(ScoreBoardContainer, {
|
|
16
|
+
offset: offset,
|
|
17
|
+
backgroundColor: "rgba(245, 245, 220, 0.6)",
|
|
18
|
+
borderColor: "rgba(255, 255, 255, 0.3)",
|
|
19
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
20
|
+
style: styles.scoreBoard,
|
|
21
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
22
|
+
style: styles.scoreSection,
|
|
23
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
24
|
+
style: styles.scoreLabel,
|
|
25
|
+
children: "Time Elapsed"
|
|
26
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
27
|
+
style: [styles.timeValue, {
|
|
28
|
+
color: '#3b82f6'
|
|
29
|
+
}],
|
|
30
|
+
children: formattedTime
|
|
31
|
+
})]
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
const styles = StyleSheet.create({
|
|
37
|
+
scoreBoard: {
|
|
38
|
+
flexDirection: 'row',
|
|
39
|
+
justifyContent: 'space-between',
|
|
40
|
+
alignItems: 'center'
|
|
41
|
+
},
|
|
42
|
+
scoreSection: {
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
flex: 1
|
|
45
|
+
},
|
|
46
|
+
scoreLabel: {
|
|
47
|
+
fontSize: 18,
|
|
48
|
+
fontWeight: 'bold',
|
|
49
|
+
color: '#4a5568',
|
|
50
|
+
// Dark gray for better contrast
|
|
51
|
+
marginBottom: 4
|
|
52
|
+
},
|
|
53
|
+
timeValue: {
|
|
54
|
+
fontSize: 30,
|
|
55
|
+
fontWeight: 'bold'
|
|
56
|
+
},
|
|
57
|
+
hintText: {
|
|
58
|
+
fontSize: 18,
|
|
59
|
+
fontWeight: '600',
|
|
60
|
+
color: '#10b981' // Green color for motivation
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
ScoreBoard.displayName = 'ScoreBoard';
|
|
64
|
+
//# sourceMappingURL=ScoreBoard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useMemo","View","Text","StyleSheet","useTimeElapsed","SlidingNumbersService","ScoreBoardContainer","jsx","_jsx","jsxs","_jsxs","ScoreBoard","memo","offset","gameService","timeElapsed","formattedTime","formatTime","backgroundColor","borderColor","children","style","styles","scoreBoard","scoreSection","scoreLabel","timeValue","color","create","flexDirection","justifyContent","alignItems","flex","fontSize","fontWeight","marginBottom","hintText","displayName"],"sourceRoot":"../../../../../src","sources":["games/sliding-numbers/components/ScoreBoard.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,SAASC,IAAI,EAAEC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AACrD,SAASC,cAAc,QAAQ,2BAAwB;AACvD,SAASC,qBAAqB,QAAQ,6BAA0B;AAChE,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,WAAW,GAAGd,OAAO,CAAC,MAAM,IAAIK,qBAAqB,CAAC,CAAC,EAAE,EAAE,CAAC;EAClE,MAAMU,WAAW,GAAGX,cAAc,CAAC,CAAC;EAEpC,MAAMY,aAAa,GAAGhB,OAAO,CAAC,MAAMc,WAA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;AAEFhB,UAAU,CAAC0B,WAAW,GAAG,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NumbersTile","NumbersGrid","ScoreBoard","GameBackground"],"sourceRoot":"../../../../../src","sources":["games/sliding-numbers/components/index.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,kBAAe;AAC3C,SAASC,WAAW,QAAQ,kBAAe;AAC3C,SAASC,UAAU,QAAQ,iBAAc;AACzC,SAASC,cAAc,QAAQ,qBAAkB","ignoreList":[]}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { View, StyleSheet } from 'react-native';
|
|
5
|
+
import { GestureHandlerRootView, Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
6
|
+
import { runOnJS } from 'react-native-reanimated';
|
|
7
|
+
import { GameControlButton, GameOverModal, GameSettingsModal } from "../../helpers/index.js";
|
|
8
|
+
import { DEFAULT_GAME_SETTINGS, GAME_IDS } from "../../services/UtilsService.js";
|
|
9
|
+
import { GameBackground, GameGrid, ScoreBoard } from "./components/index.js";
|
|
10
|
+
import { useSnakeStore, useScore, useIsPlaying, useIsGameOver } from "./SnakeStore.js";
|
|
11
|
+
import { SNAKE_COLORS } from "./SnakeConstants.js";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
export const Snake = /*#__PURE__*/React.memo(({
|
|
14
|
+
settings,
|
|
15
|
+
onSettingsChange
|
|
16
|
+
}) => {
|
|
17
|
+
// Zustand store selectors for optimal re-renders
|
|
18
|
+
const score = useScore();
|
|
19
|
+
const isPlaying = useIsPlaying();
|
|
20
|
+
const isGameOver = useIsGameOver();
|
|
21
|
+
|
|
22
|
+
// Store actions - use stable references to prevent re-renders
|
|
23
|
+
const startGame = useSnakeStore(state => state.startGame);
|
|
24
|
+
const stopGame = useSnakeStore(state => state.stopGame);
|
|
25
|
+
const resetGame = useSnakeStore(state => state.resetGame);
|
|
26
|
+
const initializeGame = useSnakeStore(state => state.initializeGame);
|
|
27
|
+
const updateSettings = useSnakeStore(state => state.updateSettings);
|
|
28
|
+
const changeDirection = useSnakeStore(state => state.changeDirection);
|
|
29
|
+
|
|
30
|
+
// Track previous values to prevent unnecessary updates
|
|
31
|
+
const prevSettingsRef = React.useRef({
|
|
32
|
+
enableSounds: true,
|
|
33
|
+
enableHaptics: true
|
|
34
|
+
});
|
|
35
|
+
const prevDifficultyRef = React.useRef('easy');
|
|
36
|
+
|
|
37
|
+
// Update settings when they change
|
|
38
|
+
React.useEffect(() => {
|
|
39
|
+
const enableSounds = settings?.enableSounds ?? true;
|
|
40
|
+
const enableHaptics = settings?.enableHaptics ?? true;
|
|
41
|
+
|
|
42
|
+
// Only update if values actually changed
|
|
43
|
+
if (prevSettingsRef.current.enableSounds !== enableSounds || prevSettingsRef.current.enableHaptics !== enableHaptics) {
|
|
44
|
+
prevSettingsRef.current = {
|
|
45
|
+
enableSounds,
|
|
46
|
+
enableHaptics
|
|
47
|
+
};
|
|
48
|
+
updateSettings(enableSounds, enableHaptics);
|
|
49
|
+
}
|
|
50
|
+
}, [updateSettings, settings?.enableSounds, settings?.enableHaptics]);
|
|
51
|
+
|
|
52
|
+
// Initialize on mount and when difficulty changes
|
|
53
|
+
React.useEffect(() => {
|
|
54
|
+
const difficulty = settings?.difficulty || 'easy';
|
|
55
|
+
|
|
56
|
+
// Only initialize if difficulty actually changed
|
|
57
|
+
if (prevDifficultyRef.current !== difficulty) {
|
|
58
|
+
prevDifficultyRef.current = difficulty;
|
|
59
|
+
initializeGame(difficulty);
|
|
60
|
+
}
|
|
61
|
+
}, [initializeGame, settings?.difficulty]);
|
|
62
|
+
|
|
63
|
+
// Game control handlers
|
|
64
|
+
const handleStartGame = React.useCallback(() => {
|
|
65
|
+
startGame();
|
|
66
|
+
}, [startGame]);
|
|
67
|
+
const handleResetGame = React.useCallback(() => {
|
|
68
|
+
resetGame();
|
|
69
|
+
}, [resetGame]);
|
|
70
|
+
const handleStopGame = React.useCallback(() => {
|
|
71
|
+
stopGame();
|
|
72
|
+
}, [stopGame]);
|
|
73
|
+
|
|
74
|
+
// Gesture handler for swipe controls with safe state updates
|
|
75
|
+
const handleSwipe = React.useCallback(direction => {
|
|
76
|
+
try {
|
|
77
|
+
if (!isPlaying) return;
|
|
78
|
+
|
|
79
|
+
// Use requestAnimationFrame for safer state updates
|
|
80
|
+
requestAnimationFrame(() => {
|
|
81
|
+
try {
|
|
82
|
+
changeDirection(direction);
|
|
83
|
+
} catch (error) {
|
|
84
|
+
console.error('Direction change error:', error);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
} catch (error) {
|
|
88
|
+
console.error('Swipe handler error:', error);
|
|
89
|
+
}
|
|
90
|
+
}, [isPlaying, changeDirection]);
|
|
91
|
+
|
|
92
|
+
// Pan gesture for swipe detection
|
|
93
|
+
const panGesture = React.useMemo(() => Gesture.Pan().onEnd(event => {
|
|
94
|
+
const threshold = 30; // Minimum swipe distance
|
|
95
|
+
const absX = Math.abs(event.translationX);
|
|
96
|
+
const absY = Math.abs(event.translationY);
|
|
97
|
+
if (absX > threshold || absY > threshold) {
|
|
98
|
+
if (absX > absY) {
|
|
99
|
+
// Horizontal swipe
|
|
100
|
+
if (event.translationX > 0) {
|
|
101
|
+
runOnJS(handleSwipe)('RIGHT');
|
|
102
|
+
} else {
|
|
103
|
+
runOnJS(handleSwipe)('LEFT');
|
|
104
|
+
}
|
|
105
|
+
} else {
|
|
106
|
+
// Vertical swipe
|
|
107
|
+
if (event.translationY > 0) {
|
|
108
|
+
runOnJS(handleSwipe)('DOWN');
|
|
109
|
+
} else {
|
|
110
|
+
runOnJS(handleSwipe)('UP');
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}), [handleSwipe]);
|
|
115
|
+
|
|
116
|
+
// Memoized GameControlButton props
|
|
117
|
+
const gameControlButtonProps = React.useMemo(() => ({
|
|
118
|
+
isPlaying,
|
|
119
|
+
gameOver: isGameOver,
|
|
120
|
+
onStartGame: handleStartGame,
|
|
121
|
+
onStopGame: handleStopGame,
|
|
122
|
+
onResetGame: handleResetGame,
|
|
123
|
+
startButtonText: 'Start Slithering!',
|
|
124
|
+
startButtonSubtext: 'Swipe to move or turn.',
|
|
125
|
+
startButtonColor: SNAKE_COLORS.BUTTON_PRIMARY,
|
|
126
|
+
startButtonBorderColor: SNAKE_COLORS.BUTTON_SECONDARY
|
|
127
|
+
}), [isPlaying, isGameOver, handleStartGame, handleStopGame, handleResetGame]);
|
|
128
|
+
|
|
129
|
+
// Memoized GameOverModal props
|
|
130
|
+
const gameOverModalProps = React.useMemo(() => ({
|
|
131
|
+
isVisible: isGameOver,
|
|
132
|
+
score,
|
|
133
|
+
onPlayAgain: handleResetGame,
|
|
134
|
+
buttonText: 'Play Again!',
|
|
135
|
+
primaryColor: SNAKE_COLORS.MODAL_PRIMARY,
|
|
136
|
+
borderColor: SNAKE_COLORS.MODAL_BORDER,
|
|
137
|
+
buttonColor: SNAKE_COLORS.MODAL_BUTTON,
|
|
138
|
+
buttonBorderColor: SNAKE_COLORS.MODAL_BUTTON_BORDER,
|
|
139
|
+
scoreFormatter: s => `${s}`,
|
|
140
|
+
additionalInfo: 'Great slithering!'
|
|
141
|
+
}), [isGameOver, score, handleResetGame]);
|
|
142
|
+
|
|
143
|
+
// Memoized GameSettingsModal props
|
|
144
|
+
const gameSettingsModalProps = React.useMemo(() => ({
|
|
145
|
+
gameId: GAME_IDS.SNAKE,
|
|
146
|
+
settings: settings || DEFAULT_GAME_SETTINGS,
|
|
147
|
+
onSettingsChange
|
|
148
|
+
}), [settings, onSettingsChange]);
|
|
149
|
+
|
|
150
|
+
// Get offset from settings
|
|
151
|
+
const offset = settings?.offset ?? 0;
|
|
152
|
+
return /*#__PURE__*/_jsx(GameBackground, {
|
|
153
|
+
children: /*#__PURE__*/_jsxs(GestureHandlerRootView, {
|
|
154
|
+
style: styles.container,
|
|
155
|
+
children: [/*#__PURE__*/_jsx(GestureDetector, {
|
|
156
|
+
gesture: panGesture,
|
|
157
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
158
|
+
style: styles.container,
|
|
159
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
160
|
+
style: [styles.gridContainer, {
|
|
161
|
+
paddingTop: offset
|
|
162
|
+
}],
|
|
163
|
+
children: /*#__PURE__*/_jsx(GameGrid, {})
|
|
164
|
+
})
|
|
165
|
+
})
|
|
166
|
+
}), /*#__PURE__*/_jsx(ScoreBoard, {
|
|
167
|
+
offset: offset
|
|
168
|
+
}), /*#__PURE__*/_jsx(GameControlButton, {
|
|
169
|
+
...gameControlButtonProps
|
|
170
|
+
}), /*#__PURE__*/_jsx(GameOverModal, {
|
|
171
|
+
...gameOverModalProps
|
|
172
|
+
}), /*#__PURE__*/_jsx(GameSettingsModal, {
|
|
173
|
+
...gameSettingsModalProps
|
|
174
|
+
})]
|
|
175
|
+
})
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
Snake.displayName = 'Snake';
|
|
179
|
+
const styles = StyleSheet.create({
|
|
180
|
+
container: {
|
|
181
|
+
flex: 1
|
|
182
|
+
},
|
|
183
|
+
gridContainer: {
|
|
184
|
+
flex: 1,
|
|
185
|
+
justifyContent: 'center',
|
|
186
|
+
alignItems: 'center'
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
//# sourceMappingURL=Snake.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","View","StyleSheet","GestureHandlerRootView","Gesture","GestureDetector","runOnJS","GameControlButton","GameOverModal","GameSettingsModal","DEFAULT_GAME_SETTINGS","GAME_IDS","GameBackground","GameGrid","ScoreBoard","useSnakeStore","useScore","useIsPlaying","useIsGameOver","SNAKE_COLORS","jsx","_jsx","jsxs","_jsxs","Snake","memo","settings","onSettingsChange","score","isPlaying","isGameOver","startGame","state","stopGame","resetGame","initializeGame","updateSettings","changeDirection","prevSettingsRef","useRef","enableSounds","enableHaptics","prevDifficultyRef","useEffect","current","difficulty","handleStartGame","useCallback","handleResetGame","handleStopGame","handleSwipe","direction","requestAnimationFrame","error","console","panGesture","useMemo","Pan","onEnd","event","threshold","absX","Math","abs","translationX","absY","translationY","gameControlButtonProps","gameOver","onStartGame","onStopGame","onResetGame","startButtonText","startButtonSubtext","startButtonColor","BUTTON_PRIMARY","startButtonBorderColor","BUTTON_SECONDARY","gameOverModalProps","isVisible","onPlayAgain","buttonText","primaryColor","MODAL_PRIMARY","borderColor","MODAL_BORDER","buttonColor","MODAL_BUTTON","buttonBorderColor","MODAL_BUTTON_BORDER","scoreFormatter","s","additionalInfo","gameSettingsModalProps","gameId","SNAKE","offset","children","style","styles","container","gesture","gridContainer","paddingTop","displayName","create","flex","justifyContent","alignItems"],"sourceRoot":"../../../../src","sources":["games/snake/Snake.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AAC/C,SAASC,sBAAsB,EAAEC,OAAO,EAAEC,eAAe,QAAQ,8BAA8B;AAC/F,SAASC,OAAO,QAAQ,yBAAyB;AACjD,SAASC,iBAAiB,EAAEC,aAAa,EAAEC,iBAAiB,QAAQ,wBAAe;AACnF,SAAyBC,qBAAqB,EAAEC,QAAQ,QAAQ,gCAA6B;AAC7F,SAASC,cAAc,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,uBAAc;AACnE,SACEC,aAAa,EACbC,QAAQ,EACRC,YAAY,EACZC,aAAa,QACR,iBAAc;AACrB,SAASC,YAAY,QAAwB,qBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGhE,OAAO,MAAMC,KAA0B,gBAAGxB,KAAK,CAACyB,IAAI,CAAC,CAAC;EAAEC,QAAQ;EAAEC;AAAiB,CAAC,KAAK;EACvF;EACA,MAAMC,KAAK,GAAGZ,QAAQ,C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