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,311 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { Dimensions } from 'react-native';
|
|
4
|
-
import { FRUIT_NINJA_GAME_CONFIG as GAME_CONFIG, FRUIT_NINJA_ANIMATION_CONFIG as ANIMATION_CONFIG, FRUIT_NINJA_COLORS as COLORS, FRUIT_TYPES, FRUIT_SPECIAL_ITEMS as SPECIAL_ITEMS } from "./FruitNinjaConstants.js";
|
|
5
|
-
const {
|
|
6
|
-
width,
|
|
7
|
-
height
|
|
8
|
-
} = Dimensions.get('window');
|
|
9
|
-
|
|
10
|
-
// Constants now imported from FruitNinjaConstants.ts
|
|
11
|
-
// Re-export for backward compatibility
|
|
12
|
-
export { GAME_CONFIG, ANIMATION_CONFIG, COLORS, FRUIT_TYPES, SPECIAL_ITEMS };
|
|
13
|
-
|
|
14
|
-
// Types
|
|
15
|
-
|
|
16
|
-
// Define game-specific types and constants locally
|
|
17
|
-
|
|
18
|
-
export const DEFAULT_FRUIT_NINJA_SETTINGS = {
|
|
19
|
-
gameDuration: 60,
|
|
20
|
-
// Fixed 60 seconds for all games
|
|
21
|
-
difficulty: 'medium',
|
|
22
|
-
soundEnabled: true,
|
|
23
|
-
hapticEnabled: true
|
|
24
|
-
};
|
|
25
|
-
export const getDifficultySpawnInterval = difficulty => {
|
|
26
|
-
const intervals = {
|
|
27
|
-
easy: 2000,
|
|
28
|
-
medium: 1500,
|
|
29
|
-
hard: 1000
|
|
30
|
-
};
|
|
31
|
-
return intervals[difficulty];
|
|
32
|
-
};
|
|
33
|
-
export class FruitNinjaService {
|
|
34
|
-
gameTimerRef = null;
|
|
35
|
-
fruitSpawnRef = null;
|
|
36
|
-
animationRef = null;
|
|
37
|
-
comboTimeoutRef = null;
|
|
38
|
-
particles = [];
|
|
39
|
-
constructor(fruitAnimations, particleAnimations) {
|
|
40
|
-
this.fruitAnimations = fruitAnimations;
|
|
41
|
-
this.particleAnimations = particleAnimations;
|
|
42
|
-
}
|
|
43
|
-
startGameTimer(onTick) {
|
|
44
|
-
this.clearGameTimer();
|
|
45
|
-
this.gameTimerRef = setInterval(onTick, 1000);
|
|
46
|
-
}
|
|
47
|
-
startFruitSpawning(spawnFruit, customSpawnInterval) {
|
|
48
|
-
this.clearFruitSpawn();
|
|
49
|
-
const spawnInterval = customSpawnInterval || GAME_CONFIG.FRUIT_SPAWN_INTERVAL;
|
|
50
|
-
const spawnLoop = () => {
|
|
51
|
-
const fruit = this.createRandomFruit();
|
|
52
|
-
spawnFruit(fruit);
|
|
53
|
-
|
|
54
|
-
// Randomly vary spawn timing
|
|
55
|
-
const nextSpawnTime = spawnInterval + (Math.random() - 0.5) * 400;
|
|
56
|
-
this.fruitSpawnRef = setTimeout(spawnLoop, Math.max(300, nextSpawnTime));
|
|
57
|
-
};
|
|
58
|
-
this.fruitSpawnRef = setTimeout(spawnLoop, 1000);
|
|
59
|
-
}
|
|
60
|
-
startPhysicsLoop(updateFruit, removeFruit, getFruits) {
|
|
61
|
-
const updateLoop = () => {
|
|
62
|
-
const fruits = getFruits();
|
|
63
|
-
fruits.forEach(fruit => {
|
|
64
|
-
if (fruit.isSliced) return;
|
|
65
|
-
|
|
66
|
-
// Apply gravity
|
|
67
|
-
const newVelocityY = fruit.velocity.y + GAME_CONFIG.GRAVITY;
|
|
68
|
-
|
|
69
|
-
// Update position
|
|
70
|
-
let newX = fruit.position.x + fruit.velocity.x;
|
|
71
|
-
const newY = fruit.position.y + newVelocityY;
|
|
72
|
-
|
|
73
|
-
// Update rotation
|
|
74
|
-
const newRotation = fruit.rotation + fruit.rotationSpeed;
|
|
75
|
-
|
|
76
|
-
// Remove fruits that fall off screen (bottom only)
|
|
77
|
-
if (newY > height + 100) {
|
|
78
|
-
// Fruit fell off screen without being sliced
|
|
79
|
-
removeFruit(fruit.id);
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Prevent fruits from going too high off screen (top boundary)
|
|
84
|
-
// Handle wall bouncing properly
|
|
85
|
-
let newVelocityX = fruit.velocity.x;
|
|
86
|
-
if (newY < -50) {
|
|
87
|
-
// If fruit goes too high, start bringing it back down
|
|
88
|
-
const adjustedVelocityY = Math.max(newVelocityY, 0.5); // Ensure downward movement
|
|
89
|
-
updateFruit(fruit.id, {
|
|
90
|
-
position: {
|
|
91
|
-
x: newX,
|
|
92
|
-
y: -50
|
|
93
|
-
},
|
|
94
|
-
velocity: {
|
|
95
|
-
x: newVelocityX,
|
|
96
|
-
y: adjustedVelocityY
|
|
97
|
-
},
|
|
98
|
-
rotation: newRotation
|
|
99
|
-
});
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// Left wall bounce
|
|
104
|
-
if (newX <= 0) {
|
|
105
|
-
newX = 0;
|
|
106
|
-
newVelocityX = Math.abs(newVelocityX) * 0.8; // Bounce right with damping
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// Right wall bounce
|
|
110
|
-
if (newX >= width - GAME_CONFIG.FRUIT_SIZE) {
|
|
111
|
-
newX = width - GAME_CONFIG.FRUIT_SIZE;
|
|
112
|
-
newVelocityX = -Math.abs(newVelocityX) * 0.8; // Bounce left with damping
|
|
113
|
-
}
|
|
114
|
-
updateFruit(fruit.id, {
|
|
115
|
-
position: {
|
|
116
|
-
x: newX,
|
|
117
|
-
y: newY
|
|
118
|
-
},
|
|
119
|
-
velocity: {
|
|
120
|
-
x: newVelocityX,
|
|
121
|
-
y: newVelocityY
|
|
122
|
-
},
|
|
123
|
-
rotation: newRotation
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
// Update particles
|
|
128
|
-
this.updateParticles();
|
|
129
|
-
this.animationRef = requestAnimationFrame(updateLoop);
|
|
130
|
-
};
|
|
131
|
-
this.animationRef = requestAnimationFrame(updateLoop);
|
|
132
|
-
}
|
|
133
|
-
createRandomFruit() {
|
|
134
|
-
const isSpecial = Math.random() < 0.5;
|
|
135
|
-
const type = isSpecial ? SPECIAL_ITEMS[Math.floor(Math.random() * SPECIAL_ITEMS.length)] : FRUIT_TYPES[Math.floor(Math.random() * FRUIT_TYPES.length)];
|
|
136
|
-
if (!type) {
|
|
137
|
-
// Fallback to default fruit type if undefined
|
|
138
|
-
const defaultType = FRUIT_TYPES[0];
|
|
139
|
-
const spawnX = Math.random() * (width - GAME_CONFIG.FRUIT_SIZE);
|
|
140
|
-
const spawnY = height - 50; // Spawn slightly above bottom for higher trajectory
|
|
141
|
-
const velocityX = (Math.random() - 0.5) * GAME_CONFIG.INITIAL_VELOCITY_X_RANGE;
|
|
142
|
-
const velocityY = GAME_CONFIG.INITIAL_VELOCITY_Y - 3; // Stronger upward velocity for higher arc
|
|
143
|
-
|
|
144
|
-
return {
|
|
145
|
-
id: `fruit_${Date.now()}_${Math.random()}`,
|
|
146
|
-
type: defaultType,
|
|
147
|
-
position: {
|
|
148
|
-
x: spawnX,
|
|
149
|
-
y: spawnY
|
|
150
|
-
},
|
|
151
|
-
velocity: {
|
|
152
|
-
x: velocityX,
|
|
153
|
-
y: velocityY
|
|
154
|
-
},
|
|
155
|
-
rotation: 0,
|
|
156
|
-
rotationSpeed: (Math.random() - 0.5) * 0.2,
|
|
157
|
-
isSliced: false,
|
|
158
|
-
spawnTime: Date.now(),
|
|
159
|
-
isBomb: Boolean(defaultType.isBomb),
|
|
160
|
-
isBonus: Boolean(defaultType.isBonus),
|
|
161
|
-
isFreeze: Boolean(defaultType.isFreeze)
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// Random spawn position (slightly above bottom for higher trajectory)
|
|
166
|
-
const spawnX = Math.random() * (width - GAME_CONFIG.FRUIT_SIZE);
|
|
167
|
-
const spawnY = height - 50; // Spawn slightly above bottom for higher arc
|
|
168
|
-
|
|
169
|
-
// Random initial velocity with stronger upward force for higher trajectory
|
|
170
|
-
const velocityX = (Math.random() - 0.5) * GAME_CONFIG.INITIAL_VELOCITY_X_RANGE;
|
|
171
|
-
const velocityY = GAME_CONFIG.INITIAL_VELOCITY_Y - 3 + (Math.random() - 0.5) * 2; // Stronger upward velocity for higher arc
|
|
172
|
-
|
|
173
|
-
return {
|
|
174
|
-
id: `fruit_${Date.now()}_${Math.random()}`,
|
|
175
|
-
type,
|
|
176
|
-
position: {
|
|
177
|
-
x: spawnX,
|
|
178
|
-
y: spawnY
|
|
179
|
-
},
|
|
180
|
-
velocity: {
|
|
181
|
-
x: velocityX,
|
|
182
|
-
y: velocityY
|
|
183
|
-
},
|
|
184
|
-
rotation: 0,
|
|
185
|
-
rotationSpeed: (Math.random() - 0.5) * 0.2,
|
|
186
|
-
isSliced: false,
|
|
187
|
-
spawnTime: Date.now(),
|
|
188
|
-
isBomb: Boolean(type.isBomb),
|
|
189
|
-
isBonus: Boolean(type.isBonus),
|
|
190
|
-
isFreeze: Boolean(type.isFreeze)
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
createSliceParticles(fruit) {
|
|
194
|
-
const particles = [];
|
|
195
|
-
for (let i = 0; i < GAME_CONFIG.PARTICLE_COUNT; i++) {
|
|
196
|
-
const angle = i / GAME_CONFIG.PARTICLE_COUNT * Math.PI * 2;
|
|
197
|
-
const speed = 3 + Math.random() * 4;
|
|
198
|
-
particles.push({
|
|
199
|
-
id: `particle_${fruit.id}_${Date.now()}_${Math.random()}_${i}`,
|
|
200
|
-
position: {
|
|
201
|
-
...fruit.position
|
|
202
|
-
},
|
|
203
|
-
velocity: {
|
|
204
|
-
x: Math.cos(angle) * speed,
|
|
205
|
-
y: Math.sin(angle) * speed - 2
|
|
206
|
-
},
|
|
207
|
-
color: COLORS.PARTICLE_COLORS[Math.floor(Math.random() * COLORS.PARTICLE_COLORS.length)] || '#ff6b6b',
|
|
208
|
-
size: 4 + Math.random() * 6,
|
|
209
|
-
lifetime: 0,
|
|
210
|
-
maxLifetime: GAME_CONFIG.PARTICLE_LIFETIME
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
this.particles.push(...particles);
|
|
214
|
-
return particles;
|
|
215
|
-
}
|
|
216
|
-
updateParticles() {
|
|
217
|
-
this.particles = this.particles.filter(particle => {
|
|
218
|
-
particle.lifetime += 16; // Assume 60fps
|
|
219
|
-
|
|
220
|
-
if (particle.lifetime >= particle.maxLifetime) {
|
|
221
|
-
return false;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// Update particle physics
|
|
225
|
-
particle.position.x += particle.velocity.x;
|
|
226
|
-
particle.position.y += particle.velocity.y;
|
|
227
|
-
particle.velocity.y += 0.1; // Gravity
|
|
228
|
-
|
|
229
|
-
return true;
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
getParticles() {
|
|
233
|
-
return this.particles;
|
|
234
|
-
}
|
|
235
|
-
checkFruitSlice(fruit, slicePath) {
|
|
236
|
-
if (fruit.isSliced || slicePath.length < 2) return false;
|
|
237
|
-
const fruitCenter = {
|
|
238
|
-
x: fruit.position.x + GAME_CONFIG.FRUIT_SIZE / 2,
|
|
239
|
-
y: fruit.position.y + GAME_CONFIG.FRUIT_SIZE / 2
|
|
240
|
-
};
|
|
241
|
-
const fruitRadius = GAME_CONFIG.FRUIT_SIZE / 2;
|
|
242
|
-
|
|
243
|
-
// Check if slice path intersects with fruit
|
|
244
|
-
for (let i = 0; i < slicePath.length - 1; i++) {
|
|
245
|
-
const p1 = slicePath[i];
|
|
246
|
-
const p2 = slicePath[i + 1];
|
|
247
|
-
if (!p1 || !p2) continue;
|
|
248
|
-
const distance = this.distanceFromPointToLine(fruitCenter, p1, p2);
|
|
249
|
-
if (distance <= fruitRadius) {
|
|
250
|
-
return true;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
return false;
|
|
254
|
-
}
|
|
255
|
-
distanceFromPointToLine(point, lineStart, lineEnd) {
|
|
256
|
-
const A = point.x - lineStart.x;
|
|
257
|
-
const B = point.y - lineStart.y;
|
|
258
|
-
const C = lineEnd.x - lineStart.x;
|
|
259
|
-
const D = lineEnd.y - lineStart.y;
|
|
260
|
-
const dot = A * C + B * D;
|
|
261
|
-
const lenSq = C * C + D * D;
|
|
262
|
-
if (lenSq === 0) return Math.sqrt(A * A + B * B);
|
|
263
|
-
let param = dot / lenSq;
|
|
264
|
-
param = Math.max(0, Math.min(1, param));
|
|
265
|
-
const xx = lineStart.x + param * C;
|
|
266
|
-
const yy = lineStart.y + param * D;
|
|
267
|
-
const dx = point.x - xx;
|
|
268
|
-
const dy = point.y - yy;
|
|
269
|
-
return Math.sqrt(dx * dx + dy * dy);
|
|
270
|
-
}
|
|
271
|
-
resetAnimations() {
|
|
272
|
-
this.fruitAnimations.clear();
|
|
273
|
-
this.particleAnimations.clear();
|
|
274
|
-
this.particles = [];
|
|
275
|
-
}
|
|
276
|
-
cleanup() {
|
|
277
|
-
this.clearGameTimer();
|
|
278
|
-
this.clearFruitSpawn();
|
|
279
|
-
this.clearAnimationLoop();
|
|
280
|
-
this.clearComboTimeout();
|
|
281
|
-
this.particles = [];
|
|
282
|
-
}
|
|
283
|
-
clearGameTimer() {
|
|
284
|
-
if (this.gameTimerRef) {
|
|
285
|
-
clearInterval(this.gameTimerRef);
|
|
286
|
-
this.gameTimerRef = null;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
clearFruitSpawn() {
|
|
290
|
-
if (this.fruitSpawnRef) {
|
|
291
|
-
clearTimeout(this.fruitSpawnRef);
|
|
292
|
-
this.fruitSpawnRef = null;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
clearAnimationLoop() {
|
|
296
|
-
if (this.animationRef) {
|
|
297
|
-
cancelAnimationFrame(this.animationRef);
|
|
298
|
-
this.animationRef = null;
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
clearComboTimeout() {
|
|
302
|
-
if (this.comboTimeoutRef) {
|
|
303
|
-
clearTimeout(this.comboTimeoutRef);
|
|
304
|
-
this.comboTimeoutRef = null;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
export const createFruitNinjaService = (fruitAnimations, particleAnimations) => {
|
|
309
|
-
return new FruitNinjaService(fruitAnimations, particleAnimations);
|
|
310
|
-
};
|
|
311
|
-
//# sourceMappingURL=FruitNinjaService.js.map
|
|
1
|
+
"use strict";import{Dimensions}from 'react-native';import{FRUIT_NINJA_GAME_CONFIG as GAME_CONFIG,FRUIT_NINJA_ANIMATION_CONFIG as ANIMATION_CONFIG,FRUIT_NINJA_COLORS as COLORS,FRUIT_TYPES,FRUIT_SPECIAL_ITEMS as SPECIAL_ITEMS}from "./FruitNinjaConstants.js";const{width,height}= Dimensions.get('window');export{GAME_CONFIG,ANIMATION_CONFIG,COLORS,FRUIT_TYPES,SPECIAL_ITEMS};export const DEFAULT_FRUIT_NINJA_SETTINGS ={gameDuration:60,difficulty:'medium',soundEnabled:true,hapticEnabled:true};export const getDifficultySpawnInterval = difficulty =>{const intervals ={easy:2000,medium:1500,hard:1000};return intervals[difficulty];};export class FruitNinjaService{gameTimerRef = null;fruitSpawnRef = null;animationRef = null;comboTimeoutRef = null;particles = [];constructor(fruitAnimations,particleAnimations){this.fruitAnimations = fruitAnimations;this.particleAnimations = particleAnimations;}startGameTimer(onTick){this.clearGameTimer();this.gameTimerRef = setInterval(onTick,1000);}startFruitSpawning(spawnFruit,customSpawnInterval){this.clearFruitSpawn();const spawnInterval = customSpawnInterval || GAME_CONFIG.FRUIT_SPAWN_INTERVAL;const spawnLoop =()=>{const fruit = this.createRandomFruit();spawnFruit(fruit);const nextSpawnTime = spawnInterval +(Math.random()- 0.5)* 400;this.fruitSpawnRef = setTimeout(spawnLoop,Math.max(300,nextSpawnTime));};this.fruitSpawnRef = setTimeout(spawnLoop,1000);}startPhysicsLoop(updateFruit,removeFruit,getFruits){const updateLoop =()=>{const fruits = getFruits();fruits.forEach(fruit =>{if(fruit.isSliced)return;const newVelocityY = fruit.velocity.y + GAME_CONFIG.GRAVITY;let newX = fruit.position.x + fruit.velocity.x;const newY = fruit.position.y + newVelocityY;const newRotation = fruit.rotation + fruit.rotationSpeed;if(newY > height + 100){removeFruit(fruit.id);return;}let newVelocityX = fruit.velocity.x;if(newY < -50){const adjustedVelocityY = Math.max(newVelocityY,0.5);updateFruit(fruit.id,{position:{x:newX,y:-50},velocity:{x:newVelocityX,y:adjustedVelocityY},rotation:newRotation});return;}if(newX <= 0){newX = 0;newVelocityX = Math.abs(newVelocityX)* 0.8;}if(newX >= width - GAME_CONFIG.FRUIT_SIZE){newX = width - GAME_CONFIG.FRUIT_SIZE;newVelocityX = -Math.abs(newVelocityX)* 0.8;}updateFruit(fruit.id,{position:{x:newX,y:newY},velocity:{x:newVelocityX,y:newVelocityY},rotation:newRotation});});this.updateParticles();this.animationRef = requestAnimationFrame(updateLoop);};this.animationRef = requestAnimationFrame(updateLoop);}createRandomFruit(){const isSpecial = Math.random()< 0.5;const type = isSpecial ? SPECIAL_ITEMS[Math.floor(Math.random()* SPECIAL_ITEMS.length)]:FRUIT_TYPES[Math.floor(Math.random()* FRUIT_TYPES.length)];if(!type){const defaultType = FRUIT_TYPES[0];const spawnX = Math.random()*(width - GAME_CONFIG.FRUIT_SIZE);const spawnY = height - 50;const velocityX =(Math.random()- 0.5)* GAME_CONFIG.INITIAL_VELOCITY_X_RANGE;const velocityY = GAME_CONFIG.INITIAL_VELOCITY_Y - 3;return{id:`fruit_${Date.now()}_${Math.random()}`,type:defaultType,position:{x:spawnX,y:spawnY},velocity:{x:velocityX,y:velocityY},rotation:0,rotationSpeed:(Math.random()- 0.5)* 0.2,isSliced:false,spawnTime:Date.now(),isBomb:Boolean(defaultType.isBomb),isBonus:Boolean(defaultType.isBonus),isFreeze:Boolean(defaultType.isFreeze)};}const spawnX = Math.random()*(width - GAME_CONFIG.FRUIT_SIZE);const spawnY = height - 50;const velocityX =(Math.random()- 0.5)* GAME_CONFIG.INITIAL_VELOCITY_X_RANGE;const velocityY = GAME_CONFIG.INITIAL_VELOCITY_Y - 3 +(Math.random()- 0.5)* 2;return{id:`fruit_${Date.now()}_${Math.random()}`,type,position:{x:spawnX,y:spawnY},velocity:{x:velocityX,y:velocityY},rotation:0,rotationSpeed:(Math.random()- 0.5)* 0.2,isSliced:false,spawnTime:Date.now(),isBomb:Boolean(type.isBomb),isBonus:Boolean(type.isBonus),isFreeze:Boolean(type.isFreeze)};}createSliceParticles(fruit){const particles = [];for(let i = 0;i < GAME_CONFIG.PARTICLE_COUNT;i++){const angle = i / GAME_CONFIG.PARTICLE_COUNT * Math.PI * 2;const speed = 3 + Math.random()* 4;particles.push({id:`particle_${fruit.id}_${Date.now()}_${Math.random()}_${i}`,position:{...fruit.position},velocity:{x:Math.cos(angle)* speed,y:Math.sin(angle)* speed - 2},color:COLORS.PARTICLE_COLORS[Math.floor(Math.random()* COLORS.PARTICLE_COLORS.length)] || '#ff6b6b',size:4 + Math.random()* 6,lifetime:0,maxLifetime:GAME_CONFIG.PARTICLE_LIFETIME});}this.particles.push(...particles);return particles;}updateParticles(){this.particles = this.particles.filter(particle =>{particle.lifetime += 16;if(particle.lifetime >= particle.maxLifetime){return false;}particle.position.x += particle.velocity.x;particle.position.y += particle.velocity.y;particle.velocity.y += 0.1;return true;});}getParticles(){return this.particles;}checkFruitSlice(fruit,slicePath){if(fruit.isSliced || slicePath.length < 2)return false;const fruitCenter ={x:fruit.position.x + GAME_CONFIG.FRUIT_SIZE / 2,y:fruit.position.y + GAME_CONFIG.FRUIT_SIZE / 2};const fruitRadius = GAME_CONFIG.FRUIT_SIZE / 2;for(let i = 0;i < slicePath.length - 1;i++){const p1 = slicePath[i];const p2 = slicePath[i + 1];if(!p1 || !p2)continue;const distance = this.distanceFromPointToLine(fruitCenter,p1,p2);if(distance <= fruitRadius){return true;}}return false;}distanceFromPointToLine(point,lineStart,lineEnd){const A = point.x - lineStart.x;const B = point.y - lineStart.y;const C = lineEnd.x - lineStart.x;const D = lineEnd.y - lineStart.y;const dot = A * C + B * D;const lenSq = C * C + D * D;if(lenSq === 0)return Math.sqrt(A * A + B * B);let param = dot / lenSq;param = Math.max(0,Math.min(1,param));const xx = lineStart.x + param * C;const yy = lineStart.y + param * D;const dx = point.x - xx;const dy = point.y - yy;return Math.sqrt(dx * dx + dy * dy);}resetAnimations(){this.fruitAnimations.clear();this.particleAnimations.clear();this.particles = [];}cleanup(){this.clearGameTimer();this.clearFruitSpawn();this.clearAnimationLoop();this.clearComboTimeout();this.particles = [];}clearGameTimer(){if(this.gameTimerRef){clearInterval(this.gameTimerRef);this.gameTimerRef = null;}}clearFruitSpawn(){if(this.fruitSpawnRef){clearTimeout(this.fruitSpawnRef);this.fruitSpawnRef = null;}}clearAnimationLoop(){if(this.animationRef){cancelAnimationFrame(this.animationRef);this.animationRef = null;}}clearComboTimeout(){if(this.comboTimeoutRef){clearTimeout(this.comboTimeoutRef);this.comboTimeoutRef = null;}}}export const createFruitNinjaService =(fruitAnimations,particleAnimations)=>{return new FruitNinjaService(fruitAnimations,particleAnimations);};
|
|
@@ -1,191 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { create } from 'zustand';
|
|
4
|
-
import { subscribeWithSelector } from 'zustand/middleware';
|
|
5
|
-
import { GAME_CONFIG } from "./FruitNinjaService.js";
|
|
6
|
-
import { immerMiddleware } from "../../services/UtilsService.js";
|
|
7
|
-
// Optimized store with selective subscriptions for low-end devices
|
|
8
|
-
export const useFruitNinjaStore = create()(subscribeWithSelector(immerMiddleware((set, get) => ({
|
|
9
|
-
// Initial state
|
|
10
|
-
score: 0,
|
|
11
|
-
timeLeft: 60,
|
|
12
|
-
// Fixed 60 seconds regardless of difficulty
|
|
13
|
-
isPlaying: false,
|
|
14
|
-
gameOver: false,
|
|
15
|
-
combo: 0,
|
|
16
|
-
lives: GAME_CONFIG.MAX_LIVES,
|
|
17
|
-
fruits: [],
|
|
18
|
-
slicePath: [],
|
|
19
|
-
isSlicing: false,
|
|
20
|
-
// Actions
|
|
21
|
-
startGame: _gameDuration => {
|
|
22
|
-
// Always use fixed duration regardless of difficulty or passed duration
|
|
23
|
-
const duration = 60;
|
|
24
|
-
set(draft => {
|
|
25
|
-
draft.score = 0;
|
|
26
|
-
draft.timeLeft = duration;
|
|
27
|
-
draft.isPlaying = true;
|
|
28
|
-
draft.gameOver = false;
|
|
29
|
-
draft.combo = 0;
|
|
30
|
-
draft.lives = GAME_CONFIG.MAX_LIVES;
|
|
31
|
-
draft.fruits = [];
|
|
32
|
-
draft.slicePath = [];
|
|
33
|
-
draft.isSlicing = false;
|
|
34
|
-
});
|
|
35
|
-
},
|
|
36
|
-
stopGame: () => {
|
|
37
|
-
set(draft => {
|
|
38
|
-
draft.score = 0;
|
|
39
|
-
draft.timeLeft = 60; // Fixed 60 seconds
|
|
40
|
-
draft.isPlaying = false;
|
|
41
|
-
draft.gameOver = false;
|
|
42
|
-
draft.combo = 0;
|
|
43
|
-
draft.lives = GAME_CONFIG.MAX_LIVES;
|
|
44
|
-
draft.fruits = [];
|
|
45
|
-
draft.slicePath = [];
|
|
46
|
-
draft.isSlicing = false;
|
|
47
|
-
});
|
|
48
|
-
},
|
|
49
|
-
resetGame: () => {
|
|
50
|
-
set(draft => {
|
|
51
|
-
draft.score = 0;
|
|
52
|
-
draft.timeLeft = 60; // Fixed 60 seconds
|
|
53
|
-
draft.isPlaying = false;
|
|
54
|
-
draft.gameOver = false;
|
|
55
|
-
draft.combo = 0;
|
|
56
|
-
draft.lives = GAME_CONFIG.MAX_LIVES;
|
|
57
|
-
draft.fruits = [];
|
|
58
|
-
draft.slicePath = [];
|
|
59
|
-
draft.isSlicing = false;
|
|
60
|
-
});
|
|
61
|
-
},
|
|
62
|
-
sliceFruit: fruitId => {
|
|
63
|
-
const {
|
|
64
|
-
fruits,
|
|
65
|
-
isPlaying
|
|
66
|
-
} = get();
|
|
67
|
-
if (!isPlaying) return;
|
|
68
|
-
|
|
69
|
-
// Optimized: Use for-loop instead of find for better performance
|
|
70
|
-
let fruitIndex = -1;
|
|
71
|
-
for (let i = 0; i < fruits.length; i++) {
|
|
72
|
-
if (fruits[i].id === fruitId) {
|
|
73
|
-
fruitIndex = i;
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
if (fruitIndex === -1 || fruits[fruitIndex].isSliced) return;
|
|
78
|
-
|
|
79
|
-
// Simplified scoring: each fruit = 10 points (no combo multipliers)
|
|
80
|
-
const points = 10;
|
|
81
|
-
set(draft => {
|
|
82
|
-
draft.score = draft.score + points;
|
|
83
|
-
// Optimized: Direct array access instead of find
|
|
84
|
-
if (draft.fruits[fruitIndex]) {
|
|
85
|
-
draft.fruits[fruitIndex].isSliced = true;
|
|
86
|
-
draft.fruits[fruitIndex].sliceTime = Date.now();
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
},
|
|
90
|
-
updateScore: points => {
|
|
91
|
-
set(draft => {
|
|
92
|
-
draft.score = draft.score + points;
|
|
93
|
-
});
|
|
94
|
-
},
|
|
95
|
-
decrementTime: () => {
|
|
96
|
-
set(draft => {
|
|
97
|
-
const newTimeLeft = draft.timeLeft - 1;
|
|
98
|
-
if (newTimeLeft <= 0) {
|
|
99
|
-
draft.timeLeft = 0;
|
|
100
|
-
draft.isPlaying = false;
|
|
101
|
-
draft.gameOver = true;
|
|
102
|
-
} else {
|
|
103
|
-
draft.timeLeft = newTimeLeft;
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
},
|
|
107
|
-
addFruit: fruit => {
|
|
108
|
-
set(draft => {
|
|
109
|
-
draft.fruits.push(fruit);
|
|
110
|
-
});
|
|
111
|
-
},
|
|
112
|
-
removeFruit: fruitId => {
|
|
113
|
-
set(draft => {
|
|
114
|
-
draft.fruits = draft.fruits.filter(f => f.id !== fruitId);
|
|
115
|
-
});
|
|
116
|
-
},
|
|
117
|
-
updateFruit: (fruitId, updates) => {
|
|
118
|
-
set(draft => {
|
|
119
|
-
// Optimized: Use for-loop instead of find for better performance
|
|
120
|
-
for (let i = 0; i < draft.fruits.length; i++) {
|
|
121
|
-
if (draft.fruits[i].id === fruitId) {
|
|
122
|
-
Object.assign(draft.fruits[i], updates);
|
|
123
|
-
break;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
},
|
|
128
|
-
setSlicePath: path => {
|
|
129
|
-
set(draft => {
|
|
130
|
-
draft.slicePath = path;
|
|
131
|
-
});
|
|
132
|
-
},
|
|
133
|
-
setIsSlicing: isSlicing => {
|
|
134
|
-
set(draft => {
|
|
135
|
-
draft.isSlicing = isSlicing;
|
|
136
|
-
});
|
|
137
|
-
},
|
|
138
|
-
incrementCombo: () => {
|
|
139
|
-
set(draft => {
|
|
140
|
-
draft.combo = draft.combo + 1;
|
|
141
|
-
});
|
|
142
|
-
},
|
|
143
|
-
resetCombo: () => {
|
|
144
|
-
set(draft => {
|
|
145
|
-
draft.combo = 0;
|
|
146
|
-
});
|
|
147
|
-
},
|
|
148
|
-
loseLife: () => {
|
|
149
|
-
set(draft => {
|
|
150
|
-
const newLives = Math.max(0, draft.lives - 1);
|
|
151
|
-
draft.lives = newLives;
|
|
152
|
-
if (newLives <= 0) {
|
|
153
|
-
draft.isPlaying = false;
|
|
154
|
-
draft.gameOver = true;
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
},
|
|
158
|
-
addLife: () => {
|
|
159
|
-
set(draft => {
|
|
160
|
-
draft.lives = Math.min(draft.lives + 1, GAME_CONFIG.MAX_LIVES); // Cap at max lives
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
}))));
|
|
164
|
-
|
|
165
|
-
// Store reference to game service for cleanup
|
|
166
|
-
let gameServiceInstance = null;
|
|
167
|
-
|
|
168
|
-
// Function to register game service instance
|
|
169
|
-
export const registerGameService = gameService => {
|
|
170
|
-
gameServiceInstance = gameService;
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
// Automatic game cleanup when gameOver becomes true
|
|
174
|
-
// This replaces the cleanup logic that was previously in the FruitNinja component
|
|
175
|
-
useFruitNinjaStore.subscribe(state => state.gameOver, (gameOver, previousGameOver) => {
|
|
176
|
-
if (gameOver && !previousGameOver) {
|
|
177
|
-
// Game just ended, trigger automatic cleanup
|
|
178
|
-
setTimeout(() => {
|
|
179
|
-
// Stop game service to prevent new fruits from spawning
|
|
180
|
-
if (gameServiceInstance) {
|
|
181
|
-
gameServiceInstance.cleanup();
|
|
182
|
-
}
|
|
183
|
-
const state = useFruitNinjaStore.getState();
|
|
184
|
-
// Clear all fruits from the screen
|
|
185
|
-
state.fruits.forEach(fruit => {
|
|
186
|
-
useFruitNinjaStore.getState().removeFruit(fruit.id);
|
|
187
|
-
});
|
|
188
|
-
}, 50); // Small delay to ensure state consistency
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
//# sourceMappingURL=FruitNinjaStore.js.map
|
|
1
|
+
"use strict";import{create}from 'zustand';import{subscribeWithSelector}from 'zustand/middleware';import{GAME_CONFIG}from "./FruitNinjaService.js";import{immerMiddleware}from "../../services/UtilsService.js";export const useFruitNinjaStore = create()(subscribeWithSelector(immerMiddleware((set,get)=>({score:0,timeLeft:120,isPlaying:false,gameOver:false,combo:0,lives:GAME_CONFIG.MAX_LIVES,fruits:[],slicePath:[],isSlicing:false,startGame:_gameDuration =>{const duration = 120;set(draft =>{draft.score = 0;draft.timeLeft = duration;draft.isPlaying = true;draft.gameOver = false;draft.combo = 0;draft.lives = GAME_CONFIG.MAX_LIVES;draft.fruits = [];draft.slicePath = [];draft.isSlicing = false;});},stopGame:()=>{set(draft =>{draft.score = 0;draft.timeLeft = 120;draft.isPlaying = false;draft.gameOver = false;draft.combo = 0;draft.lives = GAME_CONFIG.MAX_LIVES;draft.fruits = [];draft.slicePath = [];draft.isSlicing = false;});},resetGame:()=>{set(draft =>{draft.score = 0;draft.timeLeft = 120;draft.isPlaying = false;draft.gameOver = false;draft.combo = 0;draft.lives = GAME_CONFIG.MAX_LIVES;draft.fruits = [];draft.slicePath = [];draft.isSlicing = false;});},sliceFruit:fruitId =>{const{fruits,isPlaying}= get();if(!isPlaying)return;let fruitIndex = -1;for(let i = 0;i < fruits.length;i++){if(fruits[i].id === fruitId){fruitIndex = i;break;}}if(fruitIndex === -1 || fruits[fruitIndex].isSliced)return;const points = 10;set(draft =>{draft.score = draft.score + points;if(draft.fruits[fruitIndex]){draft.fruits[fruitIndex].isSliced = true;draft.fruits[fruitIndex].sliceTime = Date.now();}});},updateScore:points =>{set(draft =>{draft.score = draft.score + points;});},decrementTime:()=>{set(draft =>{const newTimeLeft = draft.timeLeft - 1;if(newTimeLeft <= 0){draft.timeLeft = 0;draft.isPlaying = false;draft.gameOver = true;}else{draft.timeLeft = newTimeLeft;}});},addFruit:fruit =>{set(draft =>{draft.fruits.push(fruit);});},removeFruit:fruitId =>{set(draft =>{draft.fruits = draft.fruits.filter(f => f.id !== fruitId);});},updateFruit:(fruitId,updates)=>{set(draft =>{for(let i = 0;i < draft.fruits.length;i++){if(draft.fruits[i].id === fruitId){Object.assign(draft.fruits[i],updates);break;}}});},setSlicePath:path =>{set(draft =>{draft.slicePath = path;});},setIsSlicing:isSlicing =>{set(draft =>{draft.isSlicing = isSlicing;});},incrementCombo:()=>{set(draft =>{draft.combo = draft.combo + 1;});},resetCombo:()=>{set(draft =>{draft.combo = 0;});},loseLife:()=>{set(draft =>{const newLives = Math.max(0,draft.lives - 1);draft.lives = newLives;if(newLives <= 0){draft.isPlaying = false;draft.gameOver = true;}});},addLife:()=>{set(draft =>{draft.lives = Math.min(draft.lives + 1,GAME_CONFIG.MAX_LIVES);});}}))));let gameServiceInstance = null;export const registerGameService = gameService =>{gameServiceInstance = gameService;};useFruitNinjaStore.subscribe(state => state.gameOver,(gameOver,previousGameOver)=>{if(gameOver && !previousGameOver){setTimeout(()=>{if(gameServiceInstance){gameServiceInstance.cleanup();}const state = useFruitNinjaStore.getState();state.fruits.forEach(fruit =>{useFruitNinjaStore.getState().removeFruit(fruit.id);});},50);}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["create","subscribeWithSelector","GAME_CONFIG","immerMiddleware","useFruitNinjaStore","set","get","score","timeLeft","isPlaying","gameOver","combo","lives","MAX_LIVES","fruits","slicePath","isSlicing","startGame","_gameDuration","duration","draft","stopGame","resetGame","sliceFruit","fruitId","fruitIndex","i","length","id","isSliced","points","sliceTime","Date","now","updateScore","decrementTime","newTimeLeft","addFruit","fruit","push","removeFruit","filter","f","updateFruit","updates","Object","assign","setSlicePath","path","setIsSlicing","incrementCombo","resetCombo","loseLife","newLives","Math","max","addLife","min","gameServiceInstance","registerGameService","gameService","subscribe","state","previousGameOver","setTimeout","cleanup","getState","forEach"],"sourceRoot":"../../../../src","sources":["games/fruit-ninja/FruitNinjaStore.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,SAAS;AAChC,SAASC,qBAAqB,QAAQ,oBAAoB;AAE1D,SAASC,WAAW,QAAQ,wBAAqB;AACjD,SAASC,eAAe,QAAQ,gCAA6B;AAkC7D;AACA,OAAO,MAAMC,kBAAkB,GAAGJ,MAAM,CAAkB,CAAC,CACzDC,qBAAqB,CACnBE,eAAe,CAAC,CAACE,GAAQ,EAAEC,GAAQ,MAAM;EAC3C;EACAC,KAAK,EAAE,CAAC;EACRC,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"names":["create","subscribeWithSelector","GAME_CONFIG","immerMiddleware","useFruitNinjaStore","set","get","score","timeLeft","isPlaying","gameOver","combo","lives","MAX_LIVES","fruits","slicePath","isSlicing","startGame","_gameDuration","duration","draft","stopGame","resetGame","sliceFruit","fruitId","fruitIndex","i","length","id","isSliced","points","sliceTime","Date","now","updateScore","decrementTime","newTimeLeft","addFruit","fruit","push","removeFruit","filter","f","updateFruit","updates","Object","assign","setSlicePath","path","setIsSlicing","incrementCombo","resetCombo","loseLife","newLives","Math","max","addLife","min","gameServiceInstance","registerGameService","gameService","subscribe","state","previousGameOver","setTimeout","cleanup","getState","forEach"],"sourceRoot":"../../../../src","sources":["games/fruit-ninja/FruitNinjaStore.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,SAAS;AAChC,SAASC,qBAAqB,QAAQ,oBAAoB;AAE1D,SAASC,WAAW,QAAQ,wBAAqB;AACjD,SAASC,eAAe,QAAQ,gCAA6B;AAkC7D;AACA,OAAO,MAAMC,kBAAkB,GAAGJ,MAAM,CAAkB,CAAC,CACzDC,qBAAqB,CACnBE,eAAe,CAAC,CAACE,GAAQ,EAAEC,G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IAAI,CAACG,GAAG,CAACrC,KAAK,CAACR,KAAK,GAAG,CAAC,EAAEV,WAAW,CAACW,SAAS,CAAC,CAAC,CAAC;IAClE,CAAC,CAAC;EACJ;AACF,CAAC,CAAC,CAAC,CAAC,CAAC;;AAEL;AACA,IAAI6C,mBAAwB,GAAG,IAAI;;AAEnC;AACA,OAAO,MAAMC,mBAAmB,GAAIC,WAAgB,IAAK;EACvDF,mBAAmB,GAAGE,WAAW;AACnC,CAAC;;AAED;AACA;AACAxD,kBAAkB,CAACyD,SAAS,CACzBC,KAAK,IAAKA,KAAK,CAACpD,QAAQ,EACzB,CAACA,QAAQ,EAAEqD,gBAAgB,KAAK;EAC9B,IAAIrD,QAAQ,IAAI,CAACqD,gBAAgB,EAAE;IACjC;IACAC,UAAU,CAAC,MAAM;MACf;MACA,IAAIN,mBAAmB,EAAE;QACvBA,mBAAmB,CAACO,OAAO,CAAC,CAAC;MAC/B;MAEA,MAAMH,KAAK,GAAG1D,kBAAkB,CAAC8D,QAAQ,CAAC,CAAC;MAC3C;MACAJ,KAAK,CAAChD,MAAM,CAACqD,OAAO,CAAC7B,KAAK,IAAI;QAC5BlC,kBAAkB,CAAC8D,QAAQ,CAAC,CAAC,CAAC1B,WAAW,CAACF,KAAK,CAACV,EAAE,CAAC;MACrD,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;EACV;AACF,CACF,CAAC","ignoreList":[]}
|
|
@@ -1,99 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { View, TouchableOpacity, Text, StyleSheet } from 'react-native';
|
|
5
|
-
import { GAME_CONFIG } from "../FruitNinjaService.js";
|
|
6
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
export const FruitComponent = ({
|
|
8
|
-
fruit,
|
|
9
|
-
onSlice
|
|
10
|
-
}) => {
|
|
11
|
-
const scale = fruit.isSliced ? 0 : 1;
|
|
12
|
-
const opacity = fruit.isSliced ? 0 : 1;
|
|
13
|
-
const style = {
|
|
14
|
-
transform: [{
|
|
15
|
-
translateX: fruit.position.x
|
|
16
|
-
}, {
|
|
17
|
-
translateY: fruit.position.y
|
|
18
|
-
}, {
|
|
19
|
-
rotate: `${fruit.rotation}rad`
|
|
20
|
-
}, {
|
|
21
|
-
scale
|
|
22
|
-
}],
|
|
23
|
-
opacity,
|
|
24
|
-
position: 'absolute',
|
|
25
|
-
width: GAME_CONFIG.FRUIT_SIZE,
|
|
26
|
-
height: GAME_CONFIG.FRUIT_SIZE,
|
|
27
|
-
zIndex: fruit.isBomb ? 10 : 5
|
|
28
|
-
};
|
|
29
|
-
const getBorderColor = () => {
|
|
30
|
-
if (fruit.isBomb) return '#ef4444'; // red-500
|
|
31
|
-
if (fruit.isBonus) return '#fbbf24'; // yellow-400
|
|
32
|
-
if (fruit.isFreeze) return '#60a5fa'; // blue-400
|
|
33
|
-
return '#4ade80'; // green-400
|
|
34
|
-
};
|
|
35
|
-
const getBackgroundColor = () => {
|
|
36
|
-
if (fruit.isBomb) return '#fee2e2'; // red-100
|
|
37
|
-
if (fruit.isBonus) return '#fef3c7'; // yellow-100
|
|
38
|
-
if (fruit.isFreeze) return '#dbeafe'; // blue-100
|
|
39
|
-
return '#dcfce7'; // green-100
|
|
40
|
-
};
|
|
41
|
-
return /*#__PURE__*/_jsx(View, {
|
|
42
|
-
style: style,
|
|
43
|
-
children: /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
44
|
-
style: [styles.fruitButton, {
|
|
45
|
-
width: GAME_CONFIG.FRUIT_SIZE,
|
|
46
|
-
height: GAME_CONFIG.FRUIT_SIZE,
|
|
47
|
-
borderColor: getBorderColor(),
|
|
48
|
-
backgroundColor: getBackgroundColor()
|
|
49
|
-
}],
|
|
50
|
-
onPress: () => onSlice?.(fruit.id),
|
|
51
|
-
activeOpacity: 0.8,
|
|
52
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
53
|
-
style: styles.fruitEmoji,
|
|
54
|
-
children: fruit.type.emoji
|
|
55
|
-
}), (fruit.isBomb || fruit.isBonus || fruit.isFreeze) && /*#__PURE__*/_jsx(View, {
|
|
56
|
-
style: [styles.glowEffect, {
|
|
57
|
-
backgroundColor: fruit.isBomb ? '#ff4757' : fruit.isBonus ? '#ffa502' : '#3742fa',
|
|
58
|
-
shadowColor: fruit.isBomb ? '#ff4757' : fruit.isBonus ? '#ffa502' : '#3742fa',
|
|
59
|
-
shadowOffset: {
|
|
60
|
-
width: 0,
|
|
61
|
-
height: 0
|
|
62
|
-
},
|
|
63
|
-
shadowOpacity: 0.8,
|
|
64
|
-
shadowRadius: 10,
|
|
65
|
-
elevation: 10
|
|
66
|
-
}]
|
|
67
|
-
})]
|
|
68
|
-
})
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
const styles = StyleSheet.create({
|
|
72
|
-
fruitButton: {
|
|
73
|
-
justifyContent: 'center',
|
|
74
|
-
alignItems: 'center',
|
|
75
|
-
borderRadius: 50,
|
|
76
|
-
borderWidth: 2,
|
|
77
|
-
shadowColor: '#000',
|
|
78
|
-
shadowOffset: {
|
|
79
|
-
width: 0,
|
|
80
|
-
height: 4
|
|
81
|
-
},
|
|
82
|
-
shadowOpacity: 0.3,
|
|
83
|
-
shadowRadius: 8,
|
|
84
|
-
elevation: 8
|
|
85
|
-
},
|
|
86
|
-
fruitEmoji: {
|
|
87
|
-
fontSize: 32
|
|
88
|
-
},
|
|
89
|
-
glowEffect: {
|
|
90
|
-
position: 'absolute',
|
|
91
|
-
top: 0,
|
|
92
|
-
left: 0,
|
|
93
|
-
right: 0,
|
|
94
|
-
bottom: 0,
|
|
95
|
-
borderRadius: 50,
|
|
96
|
-
opacity: 0.3
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
//# sourceMappingURL=FruitComponent.js.map
|
|
1
|
+
"use strict";import React from 'react';import{View,TouchableOpacity,Text,StyleSheet}from 'react-native';import{GAME_CONFIG}from "../FruitNinjaService.js";import{jsx as _jsx,jsxs as _jsxs}from "react/jsx-runtime";export const FruitComponent =({fruit,onSlice})=>{const scale = fruit.isSliced ? 0:1;const opacity = fruit.isSliced ? 0:1;const style ={transform:[{translateX:fruit.position.x},{translateY:fruit.position.y},{rotate:`${fruit.rotation}rad`},{scale}],opacity,position:'absolute',width:GAME_CONFIG.FRUIT_SIZE,height:GAME_CONFIG.FRUIT_SIZE,zIndex:fruit.isBomb ? 10:5};const getBorderColor =()=>{if(fruit.isBomb)return '#ef4444';if(fruit.isBonus)return '#fbbf24';if(fruit.isFreeze)return '#60a5fa';return '#4ade80';};const getBackgroundColor =()=>{if(fruit.isBomb)return '#fee2e2';if(fruit.isBonus)return '#fef3c7';if(fruit.isFreeze)return '#dbeafe';return '#dcfce7';};return _jsx(View,{style:style,children:_jsxs(TouchableOpacity,{style:[styles.fruitButton,{width:GAME_CONFIG.FRUIT_SIZE,height:GAME_CONFIG.FRUIT_SIZE,borderColor:getBorderColor(),backgroundColor:getBackgroundColor()}],onPress:()=> onSlice?.(fruit.id),activeOpacity:0.8,children:[_jsx(Text,{style:styles.fruitEmoji,children:fruit.type.emoji}),(fruit.isBomb || fruit.isBonus || fruit.isFreeze)&& _jsx(View,{style:[styles.glowEffect,{backgroundColor:fruit.isBomb ? '#ff4757':fruit.isBonus ? '#ffa502':'#3742fa',shadowColor:fruit.isBomb ? '#ff4757':fruit.isBonus ? '#ffa502':'#3742fa',shadowOffset:{width:0,height:0},shadowOpacity:0.8,shadowRadius:10,elevation:10}]})]})});};const styles = StyleSheet.create({fruitButton:{justifyContent:'center',alignItems:'center',borderRadius:50,borderWidth:2,shadowColor:'#000',shadowOffset:{width:0,height:4},shadowOpacity:0.3,shadowRadius:8,elevation:8},fruitEmoji:{fontSize:32},glowEffect:{position:'absolute',top:0,left:0,right:0,bottom:0,borderRadius:50,opacity:0.3}});
|