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.
Files changed (419) hide show
  1. package/README.md +101 -30
  2. package/lib/module/games/balloon-blaster/BalloonBlaster.js +1 -167
  3. package/lib/module/games/balloon-blaster/BalloonBlaster.js.map +1 -1
  4. package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js +1 -182
  5. package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js.map +1 -1
  6. package/lib/module/games/balloon-blaster/BalloonBlasterService.js +1 -318
  7. package/lib/module/games/balloon-blaster/BalloonBlasterStore.js +1 -183
  8. package/lib/module/games/balloon-blaster/components/BalloonComponent.js +1 -237
  9. package/lib/module/games/balloon-blaster/components/GameArea.js +1 -156
  10. package/lib/module/games/balloon-blaster/components/GameBackground.js +1 -476
  11. package/lib/module/games/balloon-blaster/components/ScoreBoard.js +1 -112
  12. package/lib/module/games/balloon-blaster/components/ScoreBoard.js.map +1 -1
  13. package/lib/module/games/balloon-blaster/components/index.js +1 -7
  14. package/lib/module/games/bike-racing/BikeRacing.js +1 -0
  15. package/lib/module/games/bike-racing/BikeRacing.js.map +1 -0
  16. package/lib/module/games/bike-racing/BikeRacingConstants.js +1 -0
  17. package/lib/module/games/bike-racing/BikeRacingConstants.js.map +1 -0
  18. package/lib/module/games/bike-racing/BikeRacingService.js +1 -0
  19. package/lib/module/games/bike-racing/BikeRacingService.js.map +1 -0
  20. package/lib/module/games/bike-racing/BikeRacingStore.js +1 -0
  21. package/lib/module/games/bike-racing/BikeRacingStore.js.map +1 -0
  22. package/lib/module/games/bike-racing/components/BikeComponent.js +1 -0
  23. package/lib/module/games/bike-racing/components/BikeComponent.js.map +1 -0
  24. package/lib/module/games/bike-racing/components/GameBackground.js +1 -0
  25. package/lib/module/games/bike-racing/components/GameBackground.js.map +1 -0
  26. package/lib/module/games/bike-racing/components/ScoreBoard.js +1 -0
  27. package/lib/module/games/bike-racing/components/ScoreBoard.js.map +1 -0
  28. package/lib/module/games/bike-racing/components/index.js +1 -0
  29. package/lib/module/games/bike-racing/components/index.js.map +1 -0
  30. package/lib/module/games/bike-racing/index.js +1 -0
  31. package/lib/module/games/bike-racing/index.js.map +1 -0
  32. package/lib/module/games/block-blast/BlockBlast.js +1 -0
  33. package/lib/module/games/block-blast/BlockBlast.js.map +1 -0
  34. package/lib/module/games/block-blast/BlockBlastConstants.js +1 -0
  35. package/lib/module/games/block-blast/BlockBlastConstants.js.map +1 -0
  36. package/lib/module/games/block-blast/BlockBlastService.js +1 -0
  37. package/lib/module/games/block-blast/BlockBlastService.js.map +1 -0
  38. package/lib/module/games/block-blast/BlockBlastStore.js +1 -0
  39. package/lib/module/games/block-blast/BlockBlastStore.js.map +1 -0
  40. package/lib/module/games/block-blast/components/BlockPieceComponent.js +1 -0
  41. package/lib/module/games/block-blast/components/BlockPieceComponent.js.map +1 -0
  42. package/lib/module/games/block-blast/components/GameArea.js +1 -0
  43. package/lib/module/games/block-blast/components/GameArea.js.map +1 -0
  44. package/lib/module/games/block-blast/components/GameBackground.js +1 -0
  45. package/lib/module/games/block-blast/components/GameBackground.js.map +1 -0
  46. package/lib/module/games/block-blast/components/GridComponent.js +1 -0
  47. package/lib/module/games/block-blast/components/GridComponent.js.map +1 -0
  48. package/lib/module/games/block-blast/components/ScoreBoard.js +1 -0
  49. package/lib/module/games/block-blast/components/ScoreBoard.js.map +1 -0
  50. package/lib/module/games/block-blast/components/index.js +1 -0
  51. package/lib/module/games/block-blast/components/index.js.map +1 -0
  52. package/lib/module/games/block-blast/index.js +1 -0
  53. package/lib/module/games/block-blast/index.js.map +1 -0
  54. package/lib/module/games/bubble-shooter/BubbleShooter.js +1 -0
  55. package/lib/module/games/bubble-shooter/BubbleShooter.js.map +1 -0
  56. package/lib/module/games/bubble-shooter/BubbleShooterConstants.js +1 -0
  57. package/lib/module/games/bubble-shooter/BubbleShooterConstants.js.map +1 -0
  58. package/lib/module/games/bubble-shooter/BubbleShooterService.js +1 -0
  59. package/lib/module/games/bubble-shooter/BubbleShooterService.js.map +1 -0
  60. package/lib/module/games/bubble-shooter/BubbleShooterStore.js +1 -0
  61. package/lib/module/games/bubble-shooter/BubbleShooterStore.js.map +1 -0
  62. package/lib/module/games/bubble-shooter/components/GameArea.js +1 -0
  63. package/lib/module/games/bubble-shooter/components/GameArea.js.map +1 -0
  64. package/lib/module/games/bubble-shooter/components/GameBackground.js +1 -0
  65. package/lib/module/games/bubble-shooter/components/GameBackground.js.map +1 -0
  66. package/lib/module/games/bubble-shooter/components/ScoreBoard.js +1 -0
  67. package/lib/module/games/bubble-shooter/components/ScoreBoard.js.map +1 -0
  68. package/lib/module/games/bubble-shooter/components/index.js +1 -0
  69. package/lib/module/games/bubble-shooter/components/index.js.map +1 -0
  70. package/lib/module/games/bubble-shooter/index.js +1 -0
  71. package/lib/module/games/bubble-shooter/index.js.map +1 -0
  72. package/lib/module/games/candy-crush/CandyCrush.js +1 -131
  73. package/lib/module/games/candy-crush/CandyCrush.js.map +1 -1
  74. package/lib/module/games/candy-crush/CandyCrushConstants.js +1 -125
  75. package/lib/module/games/candy-crush/CandyCrushConstants.js.map +1 -1
  76. package/lib/module/games/candy-crush/CandyCrushService.js +1 -370
  77. package/lib/module/games/candy-crush/CandyCrushStore.js +1 -303
  78. package/lib/module/games/candy-crush/components/CandyItem.js +1 -191
  79. package/lib/module/games/candy-crush/components/GameBackground.js +1 -85
  80. package/lib/module/games/candy-crush/components/GameGrid.js +1 -314
  81. package/lib/module/games/candy-crush/components/ScoreBoard.js +1 -79
  82. package/lib/module/games/candy-crush/components/index.js +1 -7
  83. package/lib/module/games/candy-crush/index.js +1 -6
  84. package/lib/module/games/car-racing/CarRacing.js +1 -0
  85. package/lib/module/games/car-racing/CarRacing.js.map +1 -0
  86. package/lib/module/games/car-racing/CarRacingConstants.js +1 -0
  87. package/lib/module/games/car-racing/CarRacingConstants.js.map +1 -0
  88. package/lib/module/games/car-racing/CarRacingService.js +1 -0
  89. package/lib/module/games/car-racing/CarRacingService.js.map +1 -0
  90. package/lib/module/games/car-racing/CarRacingStore.js +1 -0
  91. package/lib/module/games/car-racing/CarRacingStore.js.map +1 -0
  92. package/lib/module/games/car-racing/components/CarComponent.js +1 -0
  93. package/lib/module/games/car-racing/components/CarComponent.js.map +1 -0
  94. package/lib/module/games/car-racing/components/GameBackground.js +1 -0
  95. package/lib/module/games/car-racing/components/GameBackground.js.map +1 -0
  96. package/lib/module/games/car-racing/components/ScoreBoard.js +1 -0
  97. package/lib/module/games/car-racing/components/ScoreBoard.js.map +1 -0
  98. package/lib/module/games/car-racing/components/index.js +1 -0
  99. package/lib/module/games/car-racing/components/index.js.map +1 -0
  100. package/lib/module/games/colors-sort/ColorsSort.js +1 -143
  101. package/lib/module/games/colors-sort/ColorsSort.js.map +1 -1
  102. package/lib/module/games/colors-sort/ColorsSortConstants.js +1 -72
  103. package/lib/module/games/colors-sort/ColorsSortConstants.js.map +1 -1
  104. package/lib/module/games/colors-sort/ColorsSortService.js +1 -255
  105. package/lib/module/games/colors-sort/ColorsSortStore.js +1 -257
  106. package/lib/module/games/colors-sort/ColorsSortStore.js.map +1 -1
  107. package/lib/module/games/colors-sort/components/ColorContainer.js +1 -140
  108. package/lib/module/games/colors-sort/components/GameBackground.js +1 -135
  109. package/lib/module/games/colors-sort/components/ScoreBoard.js +1 -70
  110. package/lib/module/games/colors-sort/components/index.js +1 -6
  111. package/lib/module/games/dino-jump/DinoJump.js +1 -209
  112. package/lib/module/games/dino-jump/DinoJump.js.map +1 -1
  113. package/lib/module/games/dino-jump/DinoJumpConstants.js +1 -189
  114. package/lib/module/games/dino-jump/DinoJumpConstants.js.map +1 -1
  115. package/lib/module/games/dino-jump/DinoJumpService.js +1 -270
  116. package/lib/module/games/dino-jump/DinoJumpStore.js +1 -381
  117. package/lib/module/games/dino-jump/components/DinoSprite.js +1 -418
  118. package/lib/module/games/dino-jump/components/DinoSprite.js.map +1 -1
  119. package/lib/module/games/dino-jump/components/GameArea.js +1 -68
  120. package/lib/module/games/dino-jump/components/GameBackground.js +1 -444
  121. package/lib/module/games/dino-jump/components/ObstacleSprite.js +1 -306
  122. package/lib/module/games/dino-jump/components/ScoreBoard.js +1 -105
  123. package/lib/module/games/dino-jump/components/ScoreBoard.js.map +1 -1
  124. package/lib/module/games/dino-jump/components/StarSprite.js +1 -45
  125. package/lib/module/games/dino-jump/components/index.js +1 -9
  126. package/lib/module/games/flappy-bird/FlappyBird.js +1 -126
  127. package/lib/module/games/flappy-bird/FlappyBird.js.map +1 -1
  128. package/lib/module/games/flappy-bird/FlappyBirdConstants.js +1 -90
  129. package/lib/module/games/flappy-bird/FlappyBirdConstants.js.map +1 -1
  130. package/lib/module/games/flappy-bird/FlappyBirdStore.js +1 -300
  131. package/lib/module/games/flappy-bird/components/Bird.js +1 -87
  132. package/lib/module/games/flappy-bird/components/GameArea.js +1 -87
  133. package/lib/module/games/flappy-bird/components/GameBackground.js +1 -79
  134. package/lib/module/games/flappy-bird/components/Pipes.js +1 -172
  135. package/lib/module/games/flappy-bird/components/ScoreBoard.js +1 -73
  136. package/lib/module/games/flappy-bird/components/index.js +1 -8
  137. package/lib/module/games/fruit-merger/FruitMerger.js +1 -120
  138. package/lib/module/games/fruit-merger/FruitMerger.js.map +1 -1
  139. package/lib/module/games/fruit-merger/FruitMergerConstants.js +1 -119
  140. package/lib/module/games/fruit-merger/FruitMergerConstants.js.map +1 -1
  141. package/lib/module/games/fruit-merger/FruitMergerService.js +1 -13
  142. package/lib/module/games/fruit-merger/FruitMergerStore.js +1 -315
  143. package/lib/module/games/fruit-merger/components/FruitItem.js +1 -102
  144. package/lib/module/games/fruit-merger/components/GameArea.js +1 -103
  145. package/lib/module/games/fruit-merger/components/GameBackground.js +1 -498
  146. package/lib/module/games/fruit-merger/components/ScoreBoard.js +1 -58
  147. package/lib/module/games/fruit-merger/components/index.js +1 -7
  148. package/lib/module/games/fruit-ninja/FruitNinja.js +1 -134
  149. package/lib/module/games/fruit-ninja/FruitNinja.js.map +1 -1
  150. package/lib/module/games/fruit-ninja/FruitNinjaConstants.js +1 -148
  151. package/lib/module/games/fruit-ninja/FruitNinjaConstants.js.map +1 -1
  152. package/lib/module/games/fruit-ninja/FruitNinjaService.js +1 -311
  153. package/lib/module/games/fruit-ninja/FruitNinjaStore.js +1 -191
  154. package/lib/module/games/fruit-ninja/FruitNinjaStore.js.map +1 -1
  155. package/lib/module/games/fruit-ninja/components/FruitComponent.js +1 -99
  156. package/lib/module/games/fruit-ninja/components/GameArea.js +1 -215
  157. package/lib/module/games/fruit-ninja/components/GameBackground.js +1 -1267
  158. package/lib/module/games/fruit-ninja/components/ScoreBoard.js +1 -92
  159. package/lib/module/games/fruit-ninja/components/ScoreBoard.js.map +1 -1
  160. package/lib/module/games/fruit-ninja/components/index.js +1 -7
  161. package/lib/module/games/game-2048/Game2048.js +1 -149
  162. package/lib/module/games/game-2048/Game2048.js.map +1 -1
  163. package/lib/module/games/game-2048/Game2048Constants.js +1 -263
  164. package/lib/module/games/game-2048/Game2048Constants.js.map +1 -1
  165. package/lib/module/games/game-2048/Game2048Service.js +1 -457
  166. package/lib/module/games/game-2048/Game2048Store.js +1 -236
  167. package/lib/module/games/game-2048/components/GameBackground.js +1 -247
  168. package/lib/module/games/game-2048/components/GameGrid.js +1 -139
  169. package/lib/module/games/game-2048/components/GameTile.js +1 -72
  170. package/lib/module/games/game-2048/components/ScoreBoard.js +1 -52
  171. package/lib/module/games/game-2048/components/index.js +1 -7
  172. package/lib/module/games/maze-runner/MazeRunner.js +1 -267
  173. package/lib/module/games/maze-runner/MazeRunner.js.map +1 -1
  174. package/lib/module/games/maze-runner/MazeRunnerConstants.js +1 -100
  175. package/lib/module/games/maze-runner/MazeRunnerConstants.js.map +1 -1
  176. package/lib/module/games/maze-runner/MazeRunnerService.js +1 -586
  177. package/lib/module/games/maze-runner/components/EnhancedBallComponent.js +1 -150
  178. package/lib/module/games/maze-runner/components/EnhancedGameArea.js +1 -370
  179. package/lib/module/games/maze-runner/components/GameBackground.js +1 -175
  180. package/lib/module/games/maze-runner/components/ScoreBoard.js +1 -61
  181. package/lib/module/games/maze-runner/components/SkiaPipeComponent.js +1 -209
  182. package/lib/module/games/maze-runner/components/StaticGameBackground.js +1 -169
  183. package/lib/module/games/maze-runner/components/WallComponent.js +1 -91
  184. package/lib/module/games/maze-runner/components/index.js +1 -8
  185. package/lib/module/games/perfect-circle/PerfectCircle.js +1 -0
  186. package/lib/module/games/perfect-circle/PerfectCircle.js.map +1 -0
  187. package/lib/module/games/perfect-circle/PerfectCircleConstants.js +1 -0
  188. package/lib/module/games/perfect-circle/PerfectCircleConstants.js.map +1 -0
  189. package/lib/module/games/perfect-circle/PerfectCircleService.js +1 -0
  190. package/lib/module/games/perfect-circle/PerfectCircleService.js.map +1 -0
  191. package/lib/module/games/perfect-circle/PerfectCircleStore.js +1 -0
  192. package/lib/module/games/perfect-circle/PerfectCircleStore.js.map +1 -0
  193. package/lib/module/games/perfect-circle/components/DrawingCanvas.js +1 -0
  194. package/lib/module/games/perfect-circle/components/DrawingCanvas.js.map +1 -0
  195. package/lib/module/games/perfect-circle/components/GameBackground.js +1 -0
  196. package/lib/module/games/perfect-circle/components/GameBackground.js.map +1 -0
  197. package/lib/module/games/perfect-circle/components/ScoreBoard.js +1 -0
  198. package/lib/module/games/perfect-circle/components/ScoreBoard.js.map +1 -0
  199. package/lib/module/games/perfect-circle/index.js +1 -0
  200. package/lib/module/games/perfect-circle/index.js.map +1 -0
  201. package/lib/module/games/popit-fidget/PopitFidget.js +1 -285
  202. package/lib/module/games/popit-fidget/PopitFidget.js.map +1 -1
  203. package/lib/module/games/popit-fidget/PopitFidgetConstants.js +1 -113
  204. package/lib/module/games/popit-fidget/PopitFidgetConstants.js.map +1 -1
  205. package/lib/module/games/popit-fidget/PopitFidgetService.js +1 -132
  206. package/lib/module/games/popit-fidget/PopitFidgetStore.js +1 -125
  207. package/lib/module/games/popit-fidget/components/BubbleComponent.js +1 -198
  208. package/lib/module/games/popit-fidget/components/FidgetGrid.js +1 -165
  209. package/lib/module/games/popit-fidget/components/GameBackground.js +1 -177
  210. package/lib/module/games/popit-fidget/components/ScoreBoard.js +1 -61
  211. package/lib/module/games/popit-fidget/components/index.js +1 -7
  212. package/lib/module/games/sliding-numbers/SlidingNumbers.js +1 -159
  213. package/lib/module/games/sliding-numbers/SlidingNumbers.js.map +1 -1
  214. package/lib/module/games/sliding-numbers/SlidingNumbersConstants.js +1 -207
  215. package/lib/module/games/sliding-numbers/SlidingNumbersConstants.js.map +1 -1
  216. package/lib/module/games/sliding-numbers/SlidingNumbersService.js +1 -248
  217. package/lib/module/games/sliding-numbers/SlidingNumbersStore.js +1 -274
  218. package/lib/module/games/sliding-numbers/components/GameBackground.js +1 -259
  219. package/lib/module/games/sliding-numbers/components/NumbersGrid.js +1 -174
  220. package/lib/module/games/sliding-numbers/components/NumbersTile.js +1 -116
  221. package/lib/module/games/sliding-numbers/components/ScoreBoard.js +1 -64
  222. package/lib/module/games/sliding-numbers/components/index.js +1 -7
  223. package/lib/module/games/snake/Snake.js +1 -189
  224. package/lib/module/games/snake/Snake.js.map +1 -1
  225. package/lib/module/games/snake/SnakeConstants.js +1 -138
  226. package/lib/module/games/snake/SnakeConstants.js.map +1 -1
  227. package/lib/module/games/snake/SnakeService.js +1 -148
  228. package/lib/module/games/snake/SnakeStore.js +1 -182
  229. package/lib/module/games/snake/SnakeStore.js.map +1 -1
  230. package/lib/module/games/snake/components/GameBackground.js +1 -221
  231. package/lib/module/games/snake/components/GameGrid.js +1 -153
  232. package/lib/module/games/snake/components/ScoreBoard.js +1 -51
  233. package/lib/module/games/snake/components/ScoreBoard.js.map +1 -1
  234. package/lib/module/games/snake/components/index.js +1 -6
  235. package/lib/module/games/snake/index.js +1 -6
  236. package/lib/module/games/space-fighter/SpaceFighter.js +1 -165
  237. package/lib/module/games/space-fighter/SpaceFighter.js.map +1 -1
  238. package/lib/module/games/space-fighter/SpaceFighterConstants.js +1 -108
  239. package/lib/module/games/space-fighter/SpaceFighterConstants.js.map +1 -1
  240. package/lib/module/games/space-fighter/SpaceFighterService.js +1 -326
  241. package/lib/module/games/space-fighter/SpaceFighterStore.js +1 -209
  242. package/lib/module/games/space-fighter/components/AsteroidComponent.js +1 -113
  243. package/lib/module/games/space-fighter/components/GameArea.js +1 -289
  244. package/lib/module/games/space-fighter/components/GameBackground.js +1 -239
  245. package/lib/module/games/space-fighter/components/ScoreBoard.js +1 -136
  246. package/lib/module/games/space-fighter/components/Spacecraft3D.js +1 -202
  247. package/lib/module/games/space-fighter/components/SpacecraftPath.js +1 -52
  248. package/lib/module/games/space-fighter/components/index.js +1 -9
  249. package/lib/module/games/whack-a-mole/WhackAMole.js +1 -270
  250. package/lib/module/games/whack-a-mole/WhackAMole.js.map +1 -1
  251. package/lib/module/games/whack-a-mole/WhackAMoleConstants.js +1 -115
  252. package/lib/module/games/whack-a-mole/WhackAMoleConstants.js.map +1 -1
  253. package/lib/module/games/whack-a-mole/WhackAMoleService.js +1 -120
  254. package/lib/module/games/whack-a-mole/WhackAMoleStore.js +1 -172
  255. package/lib/module/games/whack-a-mole/components/GameBackground.js +1 -477
  256. package/lib/module/games/whack-a-mole/components/GameGrid.js +1 -97
  257. package/lib/module/games/whack-a-mole/components/GameHole.js +1 -196
  258. package/lib/module/games/whack-a-mole/components/MoleCharacter.js +1 -241
  259. package/lib/module/games/whack-a-mole/components/ScoreBoard.js +1 -67
  260. package/lib/module/games/whack-a-mole/components/ScoreBoard.js.map +1 -1
  261. package/lib/module/games/whack-a-mole/components/index.js +1 -8
  262. package/lib/module/helpers/AnimationFrame.js +1 -120
  263. package/lib/module/helpers/AnimationTracker.js +1 -89
  264. package/lib/module/helpers/ErrorHandler.js +1 -269
  265. package/lib/module/helpers/GameControlButton.js +1 -219
  266. package/lib/module/helpers/GameOverModal.js +1 -144
  267. package/lib/module/helpers/GameOverModal.js.map +1 -1
  268. package/lib/module/helpers/GameSettingsModal.js +1 -287
  269. package/lib/module/helpers/GameSettingsModal.js.map +1 -1
  270. package/lib/module/helpers/ParticleBlast.js +1 -134
  271. package/lib/module/helpers/ScoreBoardContainer.js +1 -34
  272. package/lib/module/helpers/ScoreBoardContainer.js.map +1 -1
  273. package/lib/module/helpers/index.js +1 -12
  274. package/lib/module/index.js +1 -22
  275. package/lib/module/index.js.map +1 -1
  276. package/lib/module/services/GamesConstants.js +1 -178
  277. package/lib/module/services/GamesConstants.js.map +1 -1
  278. package/lib/module/services/GamesService.js +1 -112
  279. package/lib/module/services/GamesService.js.map +1 -1
  280. package/lib/module/services/HapticsService.js +1 -77
  281. package/lib/module/services/ScoringService.js +1 -0
  282. package/lib/module/services/ScoringService.js.map +1 -0
  283. package/lib/module/services/SoundsService.js +1 -302
  284. package/lib/module/services/SoundsService.js.map +1 -1
  285. package/lib/module/services/UtilsService.js +1 -32
  286. package/lib/module/services/UtilsService.js.map +1 -1
  287. package/lib/typescript/src/games/balloon-blaster/BalloonBlaster.d.ts.map +1 -1
  288. package/lib/typescript/src/games/balloon-blaster/BalloonBlasterConstants.d.ts +1 -1
  289. package/lib/typescript/src/games/balloon-blaster/components/ScoreBoard.d.ts.map +1 -1
  290. package/lib/typescript/src/games/bike-racing/BikeRacing.d.ts +4 -0
  291. package/lib/typescript/src/games/bike-racing/BikeRacing.d.ts.map +1 -0
  292. package/lib/typescript/src/games/bike-racing/BikeRacingConstants.d.ts +76 -0
  293. package/lib/typescript/src/games/bike-racing/BikeRacingConstants.d.ts.map +1 -0
  294. package/lib/typescript/src/games/bike-racing/BikeRacingService.d.ts +22 -0
  295. package/lib/typescript/src/games/bike-racing/BikeRacingService.d.ts.map +1 -0
  296. package/lib/typescript/src/games/bike-racing/BikeRacingStore.d.ts +72 -0
  297. package/lib/typescript/src/games/bike-racing/BikeRacingStore.d.ts.map +1 -0
  298. package/lib/typescript/src/games/bike-racing/components/BikeComponent.d.ts +12 -0
  299. package/lib/typescript/src/games/bike-racing/components/BikeComponent.d.ts.map +1 -0
  300. package/lib/typescript/src/games/bike-racing/components/GameBackground.d.ts +9 -0
  301. package/lib/typescript/src/games/bike-racing/components/GameBackground.d.ts.map +1 -0
  302. package/lib/typescript/src/games/bike-racing/components/ScoreBoard.d.ts +7 -0
  303. package/lib/typescript/src/games/bike-racing/components/ScoreBoard.d.ts.map +1 -0
  304. package/lib/typescript/src/games/bike-racing/components/index.d.ts +4 -0
  305. package/lib/typescript/src/games/bike-racing/components/index.d.ts.map +1 -0
  306. package/lib/typescript/src/games/bike-racing/index.d.ts +5 -0
  307. package/lib/typescript/src/games/bike-racing/index.d.ts.map +1 -0
  308. package/lib/typescript/src/games/block-blast/BlockBlast.d.ts +4 -0
  309. package/lib/typescript/src/games/block-blast/BlockBlast.d.ts.map +1 -0
  310. package/lib/typescript/src/games/block-blast/BlockBlastConstants.d.ts +82 -0
  311. package/lib/typescript/src/games/block-blast/BlockBlastConstants.d.ts.map +1 -0
  312. package/lib/typescript/src/games/block-blast/BlockBlastService.d.ts +17 -0
  313. package/lib/typescript/src/games/block-blast/BlockBlastService.d.ts.map +1 -0
  314. package/lib/typescript/src/games/block-blast/BlockBlastStore.d.ts +62 -0
  315. package/lib/typescript/src/games/block-blast/BlockBlastStore.d.ts.map +1 -0
  316. package/lib/typescript/src/games/block-blast/components/BlockPieceComponent.d.ts +14 -0
  317. package/lib/typescript/src/games/block-blast/components/BlockPieceComponent.d.ts.map +1 -0
  318. package/lib/typescript/src/games/block-blast/components/GameArea.d.ts +12 -0
  319. package/lib/typescript/src/games/block-blast/components/GameArea.d.ts.map +1 -0
  320. package/lib/typescript/src/games/block-blast/components/GameBackground.d.ts +7 -0
  321. package/lib/typescript/src/games/block-blast/components/GameBackground.d.ts.map +1 -0
  322. package/lib/typescript/src/games/block-blast/components/GridComponent.d.ts +17 -0
  323. package/lib/typescript/src/games/block-blast/components/GridComponent.d.ts.map +1 -0
  324. package/lib/typescript/src/games/block-blast/components/ScoreBoard.d.ts +7 -0
  325. package/lib/typescript/src/games/block-blast/components/ScoreBoard.d.ts.map +1 -0
  326. package/lib/typescript/src/games/block-blast/components/index.d.ts +6 -0
  327. package/lib/typescript/src/games/block-blast/components/index.d.ts.map +1 -0
  328. package/lib/typescript/src/games/block-blast/index.d.ts +5 -0
  329. package/lib/typescript/src/games/block-blast/index.d.ts.map +1 -0
  330. package/lib/typescript/src/games/bubble-shooter/BubbleShooter.d.ts +4 -0
  331. package/lib/typescript/src/games/bubble-shooter/BubbleShooter.d.ts.map +1 -0
  332. package/lib/typescript/src/games/bubble-shooter/BubbleShooterConstants.d.ts +61 -0
  333. package/lib/typescript/src/games/bubble-shooter/BubbleShooterConstants.d.ts.map +1 -0
  334. package/lib/typescript/src/games/bubble-shooter/BubbleShooterService.d.ts +26 -0
  335. package/lib/typescript/src/games/bubble-shooter/BubbleShooterService.d.ts.map +1 -0
  336. package/lib/typescript/src/games/bubble-shooter/BubbleShooterStore.d.ts +62 -0
  337. package/lib/typescript/src/games/bubble-shooter/BubbleShooterStore.d.ts.map +1 -0
  338. package/lib/typescript/src/games/bubble-shooter/components/GameArea.d.ts +9 -0
  339. package/lib/typescript/src/games/bubble-shooter/components/GameArea.d.ts.map +1 -0
  340. package/lib/typescript/src/games/bubble-shooter/components/GameBackground.d.ts +8 -0
  341. package/lib/typescript/src/games/bubble-shooter/components/GameBackground.d.ts.map +1 -0
  342. package/lib/typescript/src/games/bubble-shooter/components/ScoreBoard.d.ts +7 -0
  343. package/lib/typescript/src/games/bubble-shooter/components/ScoreBoard.d.ts.map +1 -0
  344. package/lib/typescript/src/games/bubble-shooter/components/index.d.ts +4 -0
  345. package/lib/typescript/src/games/bubble-shooter/components/index.d.ts.map +1 -0
  346. package/lib/typescript/src/games/bubble-shooter/index.d.ts +3 -0
  347. package/lib/typescript/src/games/bubble-shooter/index.d.ts.map +1 -0
  348. package/lib/typescript/src/games/candy-crush/CandyCrush.d.ts.map +1 -1
  349. package/lib/typescript/src/games/candy-crush/CandyCrushConstants.d.ts +7 -7
  350. package/lib/typescript/src/games/car-racing/CarRacing.d.ts +4 -0
  351. package/lib/typescript/src/games/car-racing/CarRacing.d.ts.map +1 -0
  352. package/lib/typescript/src/games/car-racing/CarRacingConstants.d.ts +76 -0
  353. package/lib/typescript/src/games/car-racing/CarRacingConstants.d.ts.map +1 -0
  354. package/lib/typescript/src/games/car-racing/CarRacingService.d.ts +22 -0
  355. package/lib/typescript/src/games/car-racing/CarRacingService.d.ts.map +1 -0
  356. package/lib/typescript/src/games/car-racing/CarRacingStore.d.ts +72 -0
  357. package/lib/typescript/src/games/car-racing/CarRacingStore.d.ts.map +1 -0
  358. package/lib/typescript/src/games/car-racing/components/CarComponent.d.ts +13 -0
  359. package/lib/typescript/src/games/car-racing/components/CarComponent.d.ts.map +1 -0
  360. package/lib/typescript/src/games/car-racing/components/GameBackground.d.ts +9 -0
  361. package/lib/typescript/src/games/car-racing/components/GameBackground.d.ts.map +1 -0
  362. package/lib/typescript/src/games/car-racing/components/ScoreBoard.d.ts +7 -0
  363. package/lib/typescript/src/games/car-racing/components/ScoreBoard.d.ts.map +1 -0
  364. package/lib/typescript/src/games/car-racing/components/index.d.ts +4 -0
  365. package/lib/typescript/src/games/car-racing/components/index.d.ts.map +1 -0
  366. package/lib/typescript/src/games/colors-sort/ColorsSort.d.ts.map +1 -1
  367. package/lib/typescript/src/games/colors-sort/ColorsSortStore.d.ts.map +1 -1
  368. package/lib/typescript/src/games/dino-jump/DinoJump.d.ts.map +1 -1
  369. package/lib/typescript/src/games/dino-jump/components/DinoSprite.d.ts.map +1 -1
  370. package/lib/typescript/src/games/flappy-bird/FlappyBird.d.ts.map +1 -1
  371. package/lib/typescript/src/games/flappy-bird/FlappyBirdConstants.d.ts.map +1 -1
  372. package/lib/typescript/src/games/fruit-merger/FruitMerger.d.ts.map +1 -1
  373. package/lib/typescript/src/games/fruit-merger/FruitMergerConstants.d.ts.map +1 -1
  374. package/lib/typescript/src/games/fruit-ninja/FruitNinja.d.ts.map +1 -1
  375. package/lib/typescript/src/games/fruit-ninja/components/ScoreBoard.d.ts.map +1 -1
  376. package/lib/typescript/src/games/game-2048/Game2048.d.ts.map +1 -1
  377. package/lib/typescript/src/games/maze-runner/MazeRunner.d.ts.map +1 -1
  378. package/lib/typescript/src/games/perfect-circle/PerfectCircle.d.ts +4 -0
  379. package/lib/typescript/src/games/perfect-circle/PerfectCircle.d.ts.map +1 -0
  380. package/lib/typescript/src/games/perfect-circle/PerfectCircleConstants.d.ts +81 -0
  381. package/lib/typescript/src/games/perfect-circle/PerfectCircleConstants.d.ts.map +1 -0
  382. package/lib/typescript/src/games/perfect-circle/PerfectCircleService.d.ts +14 -0
  383. package/lib/typescript/src/games/perfect-circle/PerfectCircleService.d.ts.map +1 -0
  384. package/lib/typescript/src/games/perfect-circle/PerfectCircleStore.d.ts +40 -0
  385. package/lib/typescript/src/games/perfect-circle/PerfectCircleStore.d.ts.map +1 -0
  386. package/lib/typescript/src/games/perfect-circle/components/DrawingCanvas.d.ts +9 -0
  387. package/lib/typescript/src/games/perfect-circle/components/DrawingCanvas.d.ts.map +1 -0
  388. package/lib/typescript/src/games/perfect-circle/components/GameBackground.d.ts +8 -0
  389. package/lib/typescript/src/games/perfect-circle/components/GameBackground.d.ts.map +1 -0
  390. package/lib/typescript/src/games/perfect-circle/components/ScoreBoard.d.ts +7 -0
  391. package/lib/typescript/src/games/perfect-circle/components/ScoreBoard.d.ts.map +1 -0
  392. package/lib/typescript/src/games/perfect-circle/index.d.ts +3 -0
  393. package/lib/typescript/src/games/perfect-circle/index.d.ts.map +1 -0
  394. package/lib/typescript/src/games/popit-fidget/PopitFidget.d.ts.map +1 -1
  395. package/lib/typescript/src/games/sliding-numbers/SlidingNumbers.d.ts.map +1 -1
  396. package/lib/typescript/src/games/snake/Snake.d.ts.map +1 -1
  397. package/lib/typescript/src/games/snake/SnakeStore.d.ts +4 -0
  398. package/lib/typescript/src/games/snake/SnakeStore.d.ts.map +1 -1
  399. package/lib/typescript/src/games/snake/components/ScoreBoard.d.ts.map +1 -1
  400. package/lib/typescript/src/games/space-fighter/SpaceFighter.d.ts.map +1 -1
  401. package/lib/typescript/src/games/whack-a-mole/WhackAMole.d.ts.map +1 -1
  402. package/lib/typescript/src/games/whack-a-mole/WhackAMoleConstants.d.ts +1 -1
  403. package/lib/typescript/src/games/whack-a-mole/components/ScoreBoard.d.ts.map +1 -1
  404. package/lib/typescript/src/helpers/GameOverModal.d.ts +3 -0
  405. package/lib/typescript/src/helpers/GameOverModal.d.ts.map +1 -1
  406. package/lib/typescript/src/helpers/ScoreBoardContainer.d.ts.map +1 -1
  407. package/lib/typescript/src/index.d.ts +6 -1
  408. package/lib/typescript/src/index.d.ts.map +1 -1
  409. package/lib/typescript/src/services/GamesConstants.d.ts +57 -7
  410. package/lib/typescript/src/services/GamesConstants.d.ts.map +1 -1
  411. package/lib/typescript/src/services/GamesService.d.ts +2 -1
  412. package/lib/typescript/src/services/GamesService.d.ts.map +1 -1
  413. package/lib/typescript/src/services/ScoringService.d.ts +2 -0
  414. package/lib/typescript/src/services/ScoringService.d.ts.map +1 -0
  415. package/lib/typescript/src/services/SoundsService.d.ts +88 -0
  416. package/lib/typescript/src/services/SoundsService.d.ts.map +1 -1
  417. package/lib/typescript/src/services/UtilsService.d.ts +12 -1
  418. package/lib/typescript/src/services/UtilsService.d.ts.map +1 -1
  419. package/package.json +2 -2
@@ -1,236 +1 @@
1
- "use strict";
2
-
3
- import { create } from 'zustand';
4
- import { subscribeWithSelector } from 'zustand/middleware';
5
- import { Game2048Service } from "./Game2048Service.js";
6
- import { GAME_CONFIG, GAME_2048_SOUNDS, GAME_2048_SETTINGS } from "./Game2048Constants.js";
7
- import { immerMiddleware } from "../../services/UtilsService.js";
8
- import { playSound } from "../../services/SoundsService.js";
9
- import { playHaptic, HapticType } from "../../services/HapticsService.js";
10
- // Ultra-minimal store with memory-safe implementation
11
- export const useGame2048Store = create()(subscribeWithSelector(immerMiddleware((set, get) => {
12
- const gameService = new Game2048Service();
13
- return {
14
- // Initial state - minimal for memory efficiency
15
- timeElapsed: 0,
16
- isPlaying: false,
17
- isGameOver: false,
18
- isWon: false,
19
- isAnimating: false,
20
- grid: gameService.createGrid(),
21
- nextTileId: 1,
22
- difficulty: 'easy',
23
- targetValue: 2048,
24
- gridSize: 4,
25
- enableSounds: true,
26
- enableHaptics: true,
27
- // Actions
28
- startGame: () => {
29
- set(state => {
30
- state.isPlaying = true;
31
- state.timeElapsed = 0; // Reset time when starting
32
- });
33
- },
34
- stopGame: () => {
35
- const state = get();
36
- // Reset the game instead of showing game over modal
37
- state.initializeGame(state.difficulty);
38
- },
39
- resetGame: () => {
40
- const state = get();
41
- state.initializeGame(state.difficulty);
42
- },
43
- initializeGame: (difficulty = 'easy') => {
44
- set(state => {
45
- // Get difficulty settings
46
- const difficultySettings = GAME_2048_SETTINGS.DIFFICULTY_SETTINGS[difficulty];
47
-
48
- // Clear existing grid to prevent memory leaks
49
- state.grid = gameService.createGrid();
50
-
51
- // Add initial tiles with animations
52
- let tileId = 1;
53
- const tile1 = gameService.addRandomTile(state.grid, tileId++);
54
- const tile2 = gameService.addRandomTile(state.grid, tileId++);
55
-
56
- // Reset state with difficulty settings
57
- state.timeElapsed = 0;
58
- state.isPlaying = false;
59
- state.isGameOver = false;
60
- state.isWon = false;
61
- state.isAnimating = false;
62
- state.nextTileId = tileId;
63
- state.difficulty = difficulty;
64
- state.targetValue = difficultySettings.targetTile;
65
- state.gridSize = difficultySettings.gridSize;
66
-
67
- // Animate initial tiles
68
- [tile1, tile2].forEach(tile => {
69
- if (tile?.scaleValue) {
70
- setTimeout(() => {
71
- tile.scaleValue?.setValue(0);
72
- // Use React Native's Animated API
73
- const {
74
- Animated
75
- } = require('react-native');
76
- Animated.spring(tile.scaleValue, {
77
- toValue: 1,
78
- useNativeDriver: true,
79
- tension: GAME_CONFIG.ANIMATION_CONFIG.TENSION,
80
- friction: GAME_CONFIG.ANIMATION_CONFIG.FRICTION
81
- }).start();
82
- }, 100);
83
- }
84
- });
85
- });
86
- },
87
- updateGrid: newGrid => {
88
- set(state => {
89
- state.grid = newGrid;
90
- });
91
- },
92
- incrementTime: () => {
93
- set(state => {
94
- state.timeElapsed += 1;
95
- });
96
- },
97
- setIsAnimating: animating => {
98
- set(state => {
99
- state.isAnimating = animating;
100
- });
101
- },
102
- setGameOver: gameOver => {
103
- set(state => {
104
- state.isGameOver = gameOver;
105
- if (gameOver) {
106
- state.isPlaying = false;
107
- }
108
- });
109
- },
110
- setWon: won => {
111
- set(state => {
112
- state.isWon = won;
113
- });
114
- },
115
- incrementTileId: () => {
116
- const state = get();
117
- const newId = state.nextTileId;
118
- set(draft => {
119
- draft.nextTileId = newId + 1;
120
- });
121
- return newId;
122
- },
123
- handleMove: direction => {
124
- const state = get();
125
-
126
- // Early returns for better performance
127
- if (state.isGameOver || state.isWon || state.isAnimating) {
128
- return false;
129
- }
130
-
131
- // Batch state updates for better performance
132
- set(draft => {
133
- // Auto-start the game if not playing
134
- if (!draft.isPlaying) {
135
- draft.isPlaying = true;
136
- }
137
- draft.isAnimating = true;
138
- });
139
-
140
- // Create a shallow copy for better memory performance
141
- const gridCopy = state.grid.map(row => row.slice());
142
- const {
143
- moved,
144
- score: moveScore
145
- } = gameService.moveTiles(gridCopy, direction);
146
- if (moved) {
147
- // Batch all state updates together
148
- const newTileId = state.nextTileId;
149
- const newTile = gameService.addRandomTile(gridCopy, newTileId);
150
-
151
- // Check game state before updating
152
- const hasWon = gameService.hasWon(gridCopy, state.targetValue);
153
- const isGameOver = gameService.checkGameOver(gridCopy);
154
-
155
- // Single state update for all changes
156
- set(draft => {
157
- draft.grid = gridCopy;
158
- draft.nextTileId = newTileId + 1;
159
- if (hasWon) draft.isWon = true;
160
- if (isGameOver) draft.isGameOver = true;
161
- });
162
-
163
- // Async sound/haptic feedback (non-blocking)
164
- Promise.resolve().then(() => {
165
- playSound(GAME_2048_SOUNDS.TILE_MOVE, state.enableSounds);
166
- playHaptic(HapticType.LIGHT, state.enableHaptics);
167
- if (moveScore > 0) {
168
- playSound(GAME_2048_SOUNDS.TILE_MERGE, state.enableSounds);
169
- playHaptic(HapticType.MEDIUM, state.enableHaptics);
170
- }
171
- if (newTile) {
172
- playSound(GAME_2048_SOUNDS.NEW_TILE, state.enableSounds);
173
- }
174
- if (hasWon) {
175
- playSound(GAME_2048_SOUNDS.GAME_WIN, state.enableSounds);
176
- playHaptic(HapticType.SUCCESS, state.enableHaptics);
177
- } else if (isGameOver) {
178
- playSound(GAME_2048_SOUNDS.GAME_OVER, state.enableSounds);
179
- playHaptic(HapticType.ERROR, state.enableHaptics);
180
- }
181
- });
182
-
183
- // Optimized animation handling
184
- if (newTile?.scaleValue) {
185
- const {
186
- Animated
187
- } = require('react-native');
188
- newTile.scaleValue.setValue(0);
189
- Animated.spring(newTile.scaleValue, {
190
- toValue: 1,
191
- useNativeDriver: true,
192
- tension: GAME_CONFIG.ANIMATION_CONFIG.TENSION,
193
- friction: GAME_CONFIG.ANIMATION_CONFIG.FRICTION
194
- }).start(() => {
195
- set(draft => {
196
- draft.isAnimating = false;
197
- });
198
- });
199
- } else {
200
- set(draft => {
201
- draft.isAnimating = false;
202
- });
203
- }
204
- return true;
205
- } else {
206
- // Async invalid move feedback
207
- Promise.resolve().then(() => {
208
- playSound(GAME_2048_SOUNDS.INVALID_MOVE, state.enableSounds);
209
- playHaptic(HapticType.WARNING, state.enableHaptics);
210
- });
211
- set(draft => {
212
- draft.isAnimating = false;
213
- });
214
- return false;
215
- }
216
- },
217
- updateSettings: (enableSounds, enableHaptics) => {
218
- set(state => {
219
- state.enableSounds = enableSounds;
220
- state.enableHaptics = enableHaptics;
221
- });
222
- }
223
- };
224
- })));
225
-
226
- // Selector hooks for performance optimization
227
- export const useTimeElapsed = () => useGame2048Store(state => state.timeElapsed);
228
- export const useGrid = () => useGame2048Store(state => state.grid);
229
- export const useIsPlaying = () => useGame2048Store(state => state.isPlaying);
230
- export const useIsGameOver = () => useGame2048Store(state => state.isGameOver);
231
- export const useIsWon = () => useGame2048Store(state => state.isWon);
232
- export const useIsAnimating = () => useGame2048Store(state => state.isAnimating);
233
- export const useDifficulty = () => useGame2048Store(state => state.difficulty);
234
- export const useTargetValue = () => useGame2048Store(state => state.targetValue);
235
- export const useGridSize = () => useGame2048Store(state => state.gridSize);
236
- //# sourceMappingURL=Game2048Store.js.map
1
+ "use strict";import{create}from 'zustand';import{subscribeWithSelector}from 'zustand/middleware';import{Game2048Service}from "./Game2048Service.js";import{GAME_CONFIG,GAME_2048_SOUNDS,GAME_2048_SETTINGS}from "./Game2048Constants.js";import{immerMiddleware}from "../../services/UtilsService.js";import{playSound}from "../../services/SoundsService.js";import{playHaptic,HapticType}from "../../services/HapticsService.js";export const useGame2048Store = create()(subscribeWithSelector(immerMiddleware((set,get)=>{const gameService = new Game2048Service();return{timeElapsed:0,isPlaying:false,isGameOver:false,isWon:false,isAnimating:false,grid:gameService.createGrid(),nextTileId:1,difficulty:'easy',targetValue:2048,gridSize:4,enableSounds:true,enableHaptics:true,startGame:()=>{set(state =>{state.isPlaying = true;state.timeElapsed = 0;});},stopGame:()=>{const state = get();state.initializeGame(state.difficulty);},resetGame:()=>{const state = get();state.initializeGame(state.difficulty);},initializeGame:(difficulty = 'easy')=>{set(state =>{const difficultySettings = GAME_2048_SETTINGS.DIFFICULTY_SETTINGS[difficulty];state.grid = gameService.createGrid();let tileId = 1;const tile1 = gameService.addRandomTile(state.grid,tileId++);const tile2 = gameService.addRandomTile(state.grid,tileId++);state.timeElapsed = 0;state.isPlaying = false;state.isGameOver = false;state.isWon = false;state.isAnimating = false;state.nextTileId = tileId;state.difficulty = difficulty;state.targetValue = difficultySettings.targetTile;state.gridSize = difficultySettings.gridSize;[tile1,tile2].forEach(tile =>{if(tile?.scaleValue){setTimeout(()=>{tile.scaleValue?.setValue(0);const{Animated}= require('react-native');Animated.spring(tile.scaleValue,{toValue:1,useNativeDriver:true,tension:GAME_CONFIG.ANIMATION_CONFIG.TENSION,friction:GAME_CONFIG.ANIMATION_CONFIG.FRICTION}).start();},100);}});});},updateGrid:newGrid =>{set(state =>{state.grid = newGrid;});},incrementTime:()=>{set(state =>{state.timeElapsed += 1;});},setIsAnimating:animating =>{set(state =>{state.isAnimating = animating;});},setGameOver:gameOver =>{set(state =>{state.isGameOver = gameOver;if(gameOver){state.isPlaying = false;}});},setWon:won =>{set(state =>{state.isWon = won;});},incrementTileId:()=>{const state = get();const newId = state.nextTileId;set(draft =>{draft.nextTileId = newId + 1;});return newId;},handleMove:direction =>{const state = get();if(state.isGameOver || state.isWon || state.isAnimating){return false;}set(draft =>{if(!draft.isPlaying){draft.isPlaying = true;}draft.isAnimating = true;});const gridCopy = state.grid.map(row => row.slice());const{moved,score:moveScore}= gameService.moveTiles(gridCopy,direction);if(moved){const newTileId = state.nextTileId;const newTile = gameService.addRandomTile(gridCopy,newTileId);const hasWon = gameService.hasWon(gridCopy,state.targetValue);const isGameOver = gameService.checkGameOver(gridCopy);set(draft =>{draft.grid = gridCopy;draft.nextTileId = newTileId + 1;if(hasWon)draft.isWon = true;if(isGameOver)draft.isGameOver = true;});Promise.resolve().then(()=>{playSound(GAME_2048_SOUNDS.TILE_MOVE,state.enableSounds);playHaptic(HapticType.LIGHT,state.enableHaptics);if(moveScore > 0){playSound(GAME_2048_SOUNDS.TILE_MERGE,state.enableSounds);playHaptic(HapticType.MEDIUM,state.enableHaptics);}if(newTile){playSound(GAME_2048_SOUNDS.NEW_TILE,state.enableSounds);}if(hasWon){playSound(GAME_2048_SOUNDS.GAME_WIN,state.enableSounds);playHaptic(HapticType.SUCCESS,state.enableHaptics);}else if(isGameOver){playSound(GAME_2048_SOUNDS.GAME_OVER,state.enableSounds);playHaptic(HapticType.ERROR,state.enableHaptics);}});if(newTile?.scaleValue){const{Animated}= require('react-native');newTile.scaleValue.setValue(0);Animated.spring(newTile.scaleValue,{toValue:1,useNativeDriver:true,tension:GAME_CONFIG.ANIMATION_CONFIG.TENSION,friction:GAME_CONFIG.ANIMATION_CONFIG.FRICTION}).start(()=>{set(draft =>{draft.isAnimating = false;});});}else{set(draft =>{draft.isAnimating = false;});}return true;}else{Promise.resolve().then(()=>{playSound(GAME_2048_SOUNDS.INVALID_MOVE,state.enableSounds);playHaptic(HapticType.WARNING,state.enableHaptics);});set(draft =>{draft.isAnimating = false;});return false;}},updateSettings:(enableSounds,enableHaptics)=>{set(state =>{state.enableSounds = enableSounds;state.enableHaptics = enableHaptics;});}};})));export const useTimeElapsed =()=> useGame2048Store(state => state.timeElapsed);export const useGrid =()=> useGame2048Store(state => state.grid);export const useIsPlaying =()=> useGame2048Store(state => state.isPlaying);export const useIsGameOver =()=> useGame2048Store(state => state.isGameOver);export const useIsWon =()=> useGame2048Store(state => state.isWon);export const useIsAnimating =()=> useGame2048Store(state => state.isAnimating);export const useDifficulty =()=> useGame2048Store(state => state.difficulty);export const useTargetValue =()=> useGame2048Store(state => state.targetValue);export const useGridSize =()=> useGame2048Store(state => state.gridSize);
@@ -1,247 +1 @@
1
- "use strict";
2
-
3
- import React from 'react';
4
- import { View, StyleSheet, Dimensions } from 'react-native';
5
- import { Canvas, LinearGradient, Rect, vec, Circle, RoundedRect } from '@shopify/react-native-skia';
6
- import { BACKGROUND_TILE_COLORS } from "../Game2048Constants.js";
7
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
- const {
9
- width,
10
- height
11
- } = Dimensions.get('window');
12
- export const GameBackground = /*#__PURE__*/React.memo(({
13
- children
14
- }) => {
15
- // Generate beautiful floating 2048 tiles
16
- const generateFloatingTiles = React.useMemo(() => {
17
- const elements = [];
18
- const tileCount = 30;
19
- for (let i = 0; i < tileCount; i++) {
20
- const baseX = width / tileCount * i;
21
- const baseY = height / tileCount * i;
22
-
23
- // Add subtle random offset for natural look
24
- const x = baseX + Math.sin(i * 0.5) * 60 + Math.random() * 120;
25
- const y = baseY + Math.cos(i * 0.7) * 80 + Math.random() * 140;
26
- const tileSize = 15 + Math.random() * 25;
27
- const colorIndex = i % BACKGROUND_TILE_COLORS.length;
28
- const opacity = 0.25 + Math.sin(i) * 0.15;
29
-
30
- // 2048 tile with varied shapes to suggest numbers
31
- const tileX = Math.max(tileSize / 2, Math.min(width - tileSize, x));
32
- const tileY = Math.max(tileSize / 2, Math.min(height - tileSize, y));
33
-
34
- // Create different tile patterns inspired by 2048 numbers
35
- if (i % 5 === 0) {
36
- // Square tiles (like 2, 4, 8)
37
- elements.push(/*#__PURE__*/_jsx(RoundedRect, {
38
- x: tileX,
39
- y: tileY,
40
- width: tileSize,
41
- height: tileSize,
42
- r: tileSize * 0.25,
43
- color: `${BACKGROUND_TILE_COLORS[colorIndex]}${Math.floor(opacity * 255).toString(16).padStart(2, '0')}`
44
- }, `square-tile-${i}`));
45
- } else if (i % 5 === 1) {
46
- // Rectangular tiles (like 16, 32)
47
- elements.push(/*#__PURE__*/_jsx(RoundedRect, {
48
- x: tileX,
49
- y: tileY,
50
- width: tileSize * 0.7,
51
- height: tileSize,
52
- r: tileSize * 0.2,
53
- color: `${BACKGROUND_TILE_COLORS[colorIndex]}${Math.floor(opacity * 255).toString(16).padStart(2, '0')}`
54
- }, `rect-tile-${i}`));
55
- } else if (i % 5 === 2) {
56
- // Wide tiles (like 64, 128)
57
- elements.push(/*#__PURE__*/_jsx(RoundedRect, {
58
- x: tileX,
59
- y: tileY,
60
- width: tileSize * 1.3,
61
- height: tileSize * 0.8,
62
- r: tileSize * 0.15,
63
- color: `${BACKGROUND_TILE_COLORS[colorIndex]}${Math.floor(opacity * 255).toString(16).padStart(2, '0')}`
64
- }, `wide-tile-${i}`));
65
- } else if (i % 5 === 3) {
66
- // Circular tiles (like 256, 512)
67
- elements.push(/*#__PURE__*/_jsx(Circle, {
68
- cx: tileX + tileSize / 2,
69
- cy: tileY + tileSize / 2,
70
- r: tileSize / 2,
71
- color: `${BACKGROUND_TILE_COLORS[colorIndex]}${Math.floor(opacity * 255).toString(16).padStart(2, '0')}`
72
- }, `circle-tile-${i}`));
73
- } else {
74
- // Diamond-like tiles (like 1024, 2048)
75
- elements.push(/*#__PURE__*/_jsx(RoundedRect, {
76
- x: tileX,
77
- y: tileY,
78
- width: tileSize * 0.9,
79
- height: tileSize * 0.9,
80
- r: tileSize * 0.3,
81
- color: `${BACKGROUND_TILE_COLORS[colorIndex]}${Math.floor(opacity * 255).toString(16).padStart(2, '0')}`
82
- }, `diamond-tile-${i}`));
83
- }
84
- }
85
- return elements;
86
- }, []);
87
- return /*#__PURE__*/_jsxs(View, {
88
- style: styles.container,
89
- children: [/*#__PURE__*/_jsxs(Canvas, {
90
- style: styles.backgroundCanvas,
91
- children: [/*#__PURE__*/_jsx(Rect, {
92
- x: 0,
93
- y: 0,
94
- width: width,
95
- height: height,
96
- children: /*#__PURE__*/_jsx(LinearGradient, {
97
- start: vec(0, 0),
98
- end: vec(width, height),
99
- colors: [`${BACKGROUND_TILE_COLORS[0]}35`,
100
- // Vibrant pink
101
- `${BACKGROUND_TILE_COLORS[3]}30`,
102
- // Orange
103
- `${BACKGROUND_TILE_COLORS[6]}35`,
104
- // Green
105
- `${BACKGROUND_TILE_COLORS[9]}30`,
106
- // Blue
107
- `${BACKGROUND_TILE_COLORS[11]}35` // Purple
108
- ]
109
- })
110
- }), /*#__PURE__*/_jsx(Rect, {
111
- x: 0,
112
- y: 0,
113
- width: width,
114
- height: height,
115
- children: /*#__PURE__*/_jsx(LinearGradient, {
116
- start: vec(0, 0),
117
- end: vec(width / 2, height / 2),
118
- colors: [`${BACKGROUND_TILE_COLORS[1]}25`,
119
- // Bright red
120
- 'transparent', `${BACKGROUND_TILE_COLORS[4]}25`,
121
- // Yellow
122
- 'transparent', `${BACKGROUND_TILE_COLORS[7]}25`,
123
- // Teal
124
- 'transparent']
125
- })
126
- }), /*#__PURE__*/_jsx(Rect, {
127
- x: 0,
128
- y: 0,
129
- width: width,
130
- height: height,
131
- children: /*#__PURE__*/_jsx(LinearGradient, {
132
- start: vec(width, 0),
133
- end: vec(0, height),
134
- colors: [`${BACKGROUND_TILE_COLORS[2]}20`,
135
- // Deep orange
136
- 'transparent', `${BACKGROUND_TILE_COLORS[5]}20`,
137
- // Lime
138
- 'transparent', `${BACKGROUND_TILE_COLORS[8]}20`,
139
- // Cyan
140
- 'transparent']
141
- })
142
- }), generateFloatingTiles, /*#__PURE__*/_jsx(RoundedRect, {
143
- x: width * 0.08,
144
- y: height * 0.12,
145
- width: 55,
146
- height: 55,
147
- r: 12,
148
- color: `${BACKGROUND_TILE_COLORS[10]}60` // Indigo
149
- }), /*#__PURE__*/_jsx(RoundedRect, {
150
- x: width * 0.82,
151
- y: height * 0.78,
152
- width: 50,
153
- height: 50,
154
- r: 10,
155
- color: `${BACKGROUND_TILE_COLORS[9]}60` // Blue
156
- }), /*#__PURE__*/_jsx(RoundedRect, {
157
- x: width * 0.78,
158
- y: height * 0.15,
159
- width: 45,
160
- height: 45,
161
- r: 9,
162
- color: `${BACKGROUND_TILE_COLORS[8]}60` // Cyan
163
- }), /*#__PURE__*/_jsx(RoundedRect, {
164
- x: width * 0.12,
165
- y: height * 0.72,
166
- width: 60,
167
- height: 60,
168
- r: 14,
169
- color: `${BACKGROUND_TILE_COLORS[7]}60` // Teal
170
- }), /*#__PURE__*/_jsx(RoundedRect, {
171
- x: width * 0.45,
172
- y: height * 0.08,
173
- width: 40,
174
- height: 40,
175
- r: 8,
176
- color: `${BACKGROUND_TILE_COLORS[6]}60` // Green
177
- }), /*#__PURE__*/_jsx(RoundedRect, {
178
- x: width * 0.15,
179
- y: height * 0.45,
180
- width: 48,
181
- height: 48,
182
- r: 10,
183
- color: `${BACKGROUND_TILE_COLORS[5]}60` // Lime
184
- }), /*#__PURE__*/_jsx(RoundedRect, {
185
- x: width * 0.72,
186
- y: height * 0.55,
187
- width: 42,
188
- height: 42,
189
- r: 8,
190
- color: `${BACKGROUND_TILE_COLORS[4]}60` // Yellow
191
- }), /*#__PURE__*/_jsx(RoundedRect, {
192
- x: width * 0.55,
193
- y: height * 0.85,
194
- width: 38,
195
- height: 38,
196
- r: 7,
197
- color: `${BACKGROUND_TILE_COLORS[3]}60` // Orange
198
- }), /*#__PURE__*/_jsx(Circle, {
199
- cx: width * 0.25,
200
- cy: height * 0.28,
201
- r: 22,
202
- color: `${BACKGROUND_TILE_COLORS[2]}50` // Deep orange
203
- }), /*#__PURE__*/_jsx(Circle, {
204
- cx: width * 0.62,
205
- cy: height * 0.32,
206
- r: 26,
207
- color: `${BACKGROUND_TILE_COLORS[1]}50` // Red
208
- }), /*#__PURE__*/_jsx(Circle, {
209
- cx: width * 0.38,
210
- cy: height * 0.68,
211
- r: 20,
212
- color: `${BACKGROUND_TILE_COLORS[0]}50` // Pink
213
- }), Array.from({
214
- length: Math.floor(width / 80)
215
- }, (_, i) => /*#__PURE__*/_jsx(Rect, {
216
- x: i * 80,
217
- y: 0,
218
- width: 1,
219
- height: height,
220
- color: "rgba(255, 255, 255, 0.08)"
221
- }, `grid-v-${i}`)), Array.from({
222
- length: Math.floor(height / 80)
223
- }, (_, i) => /*#__PURE__*/_jsx(Rect, {
224
- x: 0,
225
- y: i * 80,
226
- width: width,
227
- height: 1,
228
- color: "rgba(255, 255, 255, 0.08)"
229
- }, `grid-h-${i}`))]
230
- }), children]
231
- });
232
- });
233
- const styles = StyleSheet.create({
234
- container: {
235
- flex: 1
236
- },
237
- backgroundCanvas: {
238
- position: 'absolute',
239
- top: 0,
240
- left: 0,
241
- right: 0,
242
- bottom: 0,
243
- width,
244
- height
245
- }
246
- });
247
- //# sourceMappingURL=GameBackground.js.map
1
+ "use strict";import React from 'react';import{View,StyleSheet,Dimensions}from 'react-native';import{Canvas,LinearGradient,Rect,vec,Circle,RoundedRect}from '@shopify/react-native-skia';import{BACKGROUND_TILE_COLORS}from "../Game2048Constants.js";import{jsx as _jsx,jsxs as _jsxs}from "react/jsx-runtime";const{width,height}= Dimensions.get('window');export const GameBackground = React.memo(({children})=>{const generateFloatingTiles = React.useMemo(()=>{const elements = [];const tileCount = 30;for(let i = 0;i < tileCount;i++){const baseX = width / tileCount * i;const baseY = height / tileCount * i;const x = baseX + Math.sin(i * 0.5)* 60 + Math.random()* 120;const y = baseY + Math.cos(i * 0.7)* 80 + Math.random()* 140;const tileSize = 15 + Math.random()* 25;const colorIndex = i % BACKGROUND_TILE_COLORS.length;const opacity = 0.25 + Math.sin(i)* 0.15;const tileX = Math.max(tileSize / 2,Math.min(width - tileSize,x));const tileY = Math.max(tileSize / 2,Math.min(height - tileSize,y));if(i % 5 === 0){elements.push(_jsx(RoundedRect,{x:tileX,y:tileY,width:tileSize,height:tileSize,r:tileSize * 0.25,color:`${BACKGROUND_TILE_COLORS[colorIndex]}${Math.floor(opacity * 255).toString(16).padStart(2,'0')}`},`square-tile-${i}`));}else if(i % 5 === 1){elements.push(_jsx(RoundedRect,{x:tileX,y:tileY,width:tileSize * 0.7,height:tileSize,r:tileSize * 0.2,color:`${BACKGROUND_TILE_COLORS[colorIndex]}${Math.floor(opacity * 255).toString(16).padStart(2,'0')}`},`rect-tile-${i}`));}else if(i % 5 === 2){elements.push(_jsx(RoundedRect,{x:tileX,y:tileY,width:tileSize * 1.3,height:tileSize * 0.8,r:tileSize * 0.15,color:`${BACKGROUND_TILE_COLORS[colorIndex]}${Math.floor(opacity * 255).toString(16).padStart(2,'0')}`},`wide-tile-${i}`));}else if(i % 5 === 3){elements.push(_jsx(Circle,{cx:tileX + tileSize / 2,cy:tileY + tileSize / 2,r:tileSize / 2,color:`${BACKGROUND_TILE_COLORS[colorIndex]}${Math.floor(opacity * 255).toString(16).padStart(2,'0')}`},`circle-tile-${i}`));}else{elements.push(_jsx(RoundedRect,{x:tileX,y:tileY,width:tileSize * 0.9,height:tileSize * 0.9,r:tileSize * 0.3,color:`${BACKGROUND_TILE_COLORS[colorIndex]}${Math.floor(opacity * 255).toString(16).padStart(2,'0')}`},`diamond-tile-${i}`));}}return elements;},[]);return _jsxs(View,{style:styles.container,children:[_jsxs(Canvas,{style:styles.backgroundCanvas,children:[_jsx(Rect,{x:0,y:0,width:width,height:height,children:_jsx(LinearGradient,{start:vec(0,0),end:vec(width,height),colors:[`${BACKGROUND_TILE_COLORS[0]}35`,`${BACKGROUND_TILE_COLORS[3]}30`,`${BACKGROUND_TILE_COLORS[6]}35`,`${BACKGROUND_TILE_COLORS[9]}30`,`${BACKGROUND_TILE_COLORS[11]}35` ]})}),_jsx(Rect,{x:0,y:0,width:width,height:height,children:_jsx(LinearGradient,{start:vec(0,0),end:vec(width / 2,height / 2),colors:[`${BACKGROUND_TILE_COLORS[1]}25`,'transparent',`${BACKGROUND_TILE_COLORS[4]}25`,'transparent',`${BACKGROUND_TILE_COLORS[7]}25`,'transparent']})}),_jsx(Rect,{x:0,y:0,width:width,height:height,children:_jsx(LinearGradient,{start:vec(width,0),end:vec(0,height),colors:[`${BACKGROUND_TILE_COLORS[2]}20`,'transparent',`${BACKGROUND_TILE_COLORS[5]}20`,'transparent',`${BACKGROUND_TILE_COLORS[8]}20`,'transparent']})}),generateFloatingTiles,_jsx(RoundedRect,{x:width * 0.08,y:height * 0.12,width:55,height:55,r:12,color:`${BACKGROUND_TILE_COLORS[10]}60`}),_jsx(RoundedRect,{x:width * 0.82,y:height * 0.78,width:50,height:50,r:10,color:`${BACKGROUND_TILE_COLORS[9]}60`}),_jsx(RoundedRect,{x:width * 0.78,y:height * 0.15,width:45,height:45,r:9,color:`${BACKGROUND_TILE_COLORS[8]}60`}),_jsx(RoundedRect,{x:width * 0.12,y:height * 0.72,width:60,height:60,r:14,color:`${BACKGROUND_TILE_COLORS[7]}60`}),_jsx(RoundedRect,{x:width * 0.45,y:height * 0.08,width:40,height:40,r:8,color:`${BACKGROUND_TILE_COLORS[6]}60`}),_jsx(RoundedRect,{x:width * 0.15,y:height * 0.45,width:48,height:48,r:10,color:`${BACKGROUND_TILE_COLORS[5]}60`}),_jsx(RoundedRect,{x:width * 0.72,y:height * 0.55,width:42,height:42,r:8,color:`${BACKGROUND_TILE_COLORS[4]}60`}),_jsx(RoundedRect,{x:width * 0.55,y:height * 0.85,width:38,height:38,r:7,color:`${BACKGROUND_TILE_COLORS[3]}60`}),_jsx(Circle,{cx:width * 0.25,cy:height * 0.28,r:22,color:`${BACKGROUND_TILE_COLORS[2]}50`}),_jsx(Circle,{cx:width * 0.62,cy:height * 0.32,r:26,color:`${BACKGROUND_TILE_COLORS[1]}50`}),_jsx(Circle,{cx:width * 0.38,cy:height * 0.68,r:20,color:`${BACKGROUND_TILE_COLORS[0]}50`}),Array.from({length:Math.floor(width / 80)},(_,i)=> _jsx(Rect,{x:i * 80,y:0,width:1,height:height,color:"rgba(255,255,255,0.08)"},`grid-v-${i}`)),Array.from({length:Math.floor(height / 80)},(_,i)=> _jsx(Rect,{x:0,y:i * 80,width:width,height:1,color:"rgba(255,255,255,0.08)"},`grid-h-${i}`))]}),children]});});const styles = StyleSheet.create({container:{flex:1},backgroundCanvas:{position:'absolute',top:0,left:0,right:0,bottom:0,width,height}});
@@ -1,139 +1 @@
1
- "use strict";
2
-
3
- import React from 'react';
4
- import { View, StyleSheet, Dimensions } from 'react-native';
5
- import { Gesture, GestureDetector } from 'react-native-gesture-handler';
6
- import { useGrid, useGame2048Store } from "../Game2048Store.js";
7
- import { GameTile } from "./GameTile.js";
8
- import { GAME_CONFIG } from "../Game2048Constants.js";
9
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
- const {
11
- width: screenWidth
12
- } = Dimensions.get('window');
13
- export const GameGrid = /*#__PURE__*/React.memo(() => {
14
- const grid = useGrid();
15
- const {
16
- handleMove
17
- } = useGame2048Store();
18
-
19
- // Memoize calculations for better performance
20
- const gridCalculations = React.useMemo(() => {
21
- const horizontalPadding = 40;
22
- const availableWidth = screenWidth - horizontalPadding;
23
- const margin = GAME_CONFIG.TILE_MARGIN;
24
- const responsiveTileSize = Math.floor((availableWidth - margin * 5) / 4);
25
- const tileSize = Math.max(responsiveTileSize, 60);
26
- const gridContainerSize = tileSize * 4 + margin * 5;
27
- return {
28
- margin,
29
- tileSize,
30
- gridContainerSize
31
- };
32
- }, []);
33
-
34
- // Memoized tile renderer for better performance
35
- const renderTile = React.useCallback(tile => {
36
- const {
37
- margin,
38
- tileSize
39
- } = gridCalculations;
40
- const x = margin + tile.col * (tileSize + margin);
41
- const y = margin + tile.row * (tileSize + margin);
42
- return /*#__PURE__*/_jsx(GameTile, {
43
- tile: tile,
44
- position: {
45
- x,
46
- y
47
- },
48
- size: tileSize
49
- }, tile.id);
50
- }, [gridCalculations]);
51
-
52
- // Optimized gesture handler with memoization
53
- const panGesture = React.useMemo(() => Gesture.Pan().onEnd(event => {
54
- const {
55
- translationX,
56
- translationY
57
- } = event;
58
- const minDistance = 50;
59
- const absX = Math.abs(translationX);
60
- const absY = Math.abs(translationY);
61
- if (absX > absY && absX > minDistance) {
62
- handleMove(translationX > 0 ? 'right' : 'left');
63
- } else if (absY > minDistance) {
64
- handleMove(translationY > 0 ? 'down' : 'up');
65
- }
66
- }).runOnJS(true), [handleMove]);
67
- return /*#__PURE__*/_jsx(View, {
68
- style: styles.gameContainer,
69
- children: /*#__PURE__*/_jsx(GestureDetector, {
70
- gesture: panGesture,
71
- children: /*#__PURE__*/_jsxs(View, {
72
- style: [styles.grid, {
73
- width: gridCalculations.gridContainerSize,
74
- height: gridCalculations.gridContainerSize
75
- }],
76
- children: [React.useMemo(() => Array(16).fill(0).map((_, index) => {
77
- const row = Math.floor(index / 4);
78
- const col = index % 4;
79
- const {
80
- margin,
81
- tileSize
82
- } = gridCalculations;
83
- const x = margin + col * (tileSize + margin);
84
- const y = margin + row * (tileSize + margin);
85
- return /*#__PURE__*/_jsx(View, {
86
- style: [styles.cell, {
87
- left: x,
88
- top: y,
89
- width: tileSize,
90
- height: tileSize
91
- }]
92
- }, index);
93
- }), [gridCalculations]), React.useMemo(() => {
94
- const tiles = [];
95
- for (const row of grid) {
96
- for (const tile of row) {
97
- if (tile) tiles.push(renderTile(tile));
98
- }
99
- }
100
- return tiles;
101
- }, [grid, renderTile])]
102
- })
103
- })
104
- });
105
- });
106
- const styles = StyleSheet.create({
107
- gameContainer: {
108
- flex: 1,
109
- justifyContent: 'center',
110
- alignItems: 'center',
111
- paddingHorizontal: 20,
112
- // Responsive horizontal padding
113
- paddingVertical: 10,
114
- zIndex: 10,
115
- position: 'relative'
116
- },
117
- grid: {
118
- backgroundColor: 'rgba(187, 173, 160, 0.9)',
119
- borderRadius: 15,
120
- position: 'relative',
121
- shadowColor: '#000',
122
- shadowOffset: {
123
- width: 0,
124
- height: 8
125
- },
126
- shadowOpacity: 0.25,
127
- shadowRadius: 15,
128
- elevation: 15,
129
- // Ensure grid doesn't overflow screen
130
- maxWidth: screenWidth - 40
131
- },
132
- cell: {
133
- position: 'absolute',
134
- backgroundColor: 'rgba(238, 228, 218, 0.4)',
135
- borderRadius: 6 // Slightly smaller border radius for better fit
136
- }
137
- });
138
- GameGrid.displayName = 'GameGrid';
139
- //# sourceMappingURL=GameGrid.js.map
1
+ "use strict";import React from 'react';import{View,StyleSheet,Dimensions}from 'react-native';import{Gesture,GestureDetector}from 'react-native-gesture-handler';import{useGrid,useGame2048Store}from "../Game2048Store.js";import{GameTile}from "./GameTile.js";import{GAME_CONFIG}from "../Game2048Constants.js";import{jsx as _jsx,jsxs as _jsxs}from "react/jsx-runtime";const{width:screenWidth}= Dimensions.get('window');export const GameGrid = React.memo(()=>{const grid = useGrid();const{handleMove}= useGame2048Store();const gridCalculations = React.useMemo(()=>{const horizontalPadding = 40;const availableWidth = screenWidth - horizontalPadding;const margin = GAME_CONFIG.TILE_MARGIN;const responsiveTileSize = Math.floor((availableWidth - margin * 5)/ 4);const tileSize = Math.max(responsiveTileSize,60);const gridContainerSize = tileSize * 4 + margin * 5;return{margin,tileSize,gridContainerSize};},[]);const renderTile = React.useCallback(tile =>{const{margin,tileSize}= gridCalculations;const x = margin + tile.col *(tileSize + margin);const y = margin + tile.row *(tileSize + margin);return _jsx(GameTile,{tile:tile,position:{x,y},size:tileSize},tile.id);},[gridCalculations]);const panGesture = React.useMemo(()=> Gesture.Pan().onEnd(event =>{const{translationX,translationY}= event;const minDistance = 50;const absX = Math.abs(translationX);const absY = Math.abs(translationY);if(absX > absY && absX > minDistance){handleMove(translationX > 0 ? 'right':'left');}else if(absY > minDistance){handleMove(translationY > 0 ? 'down':'up');}}).runOnJS(true),[handleMove]);return _jsx(View,{style:styles.gameContainer,children:_jsx(GestureDetector,{gesture:panGesture,children:_jsxs(View,{style:[styles.grid,{width:gridCalculations.gridContainerSize,height:gridCalculations.gridContainerSize}],children:[React.useMemo(()=> Array(16).fill(0).map((_,index)=>{const row = Math.floor(index / 4);const col = index % 4;const{margin,tileSize}= gridCalculations;const x = margin + col *(tileSize + margin);const y = margin + row *(tileSize + margin);return _jsx(View,{style:[styles.cell,{left:x,top:y,width:tileSize,height:tileSize}]},index);}),[gridCalculations]),React.useMemo(()=>{const tiles = [];for(const row of grid){for(const tile of row){if(tile)tiles.push(renderTile(tile));}}return tiles;},[grid,renderTile])]})})});});const styles = StyleSheet.create({gameContainer:{flex:1,justifyContent:'center',alignItems:'center',paddingHorizontal:20,paddingVertical:10,zIndex:10,position:'relative'},grid:{backgroundColor:'rgba(187,173,160,0.9)',borderRadius:15,position:'relative',shadowColor:'#000',shadowOffset:{width:0,height:8},shadowOpacity:0.25,shadowRadius:15,elevation:15,maxWidth:screenWidth - 40},cell:{position:'absolute',backgroundColor:'rgba(238,228,218,0.4)',borderRadius:6}});GameGrid.displayName = 'GameGrid';