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,207 +1 @@
1
- "use strict";
2
-
3
- import { Dimensions } from 'react-native';
4
- // Memoize screen dimensions for better performance
5
- const {
6
- width
7
- } = Dimensions.get('window');
8
-
9
- // Sliding Numbers Game Constants
10
- export const SLIDING_NUMBERS_CONSTANTS = {
11
- gridSize: {
12
- easy: 3,
13
- // 3x3 grid (numbers 1-8 + empty)
14
- medium: 4,
15
- // 4x4 grid (numbers 1-15 + empty)
16
- hard: 5 // 5x5 grid (numbers 1-24 + empty)
17
- },
18
- maxNumbers: {
19
- easy: 8,
20
- // 1-8 numbers
21
- medium: 15,
22
- // 1-15 numbers
23
- hard: 24 // 1-24 numbers
24
- },
25
- baseScore: {
26
- easy: 1000,
27
- medium: 2000,
28
- hard: 3000
29
- },
30
- // Score decreases over time - faster completion = higher score
31
- scoreMultiplier: {
32
- easy: 5,
33
- medium: 10,
34
- hard: 15
35
- }
36
- };
37
- export const SLIDING_NUMBERS_GAME_CONFIG = {
38
- TILE_SIZE: Math.min(width * 0.16, 70),
39
- // Responsive tile size that fits all difficulties
40
- TILE_GAP: 4,
41
- GRID_PADDING: 20,
42
- GAME_DURATION: 600,
43
- // 10 minutes
44
- SHUFFLE_MOVES: 100,
45
- // Number of moves to shuffle the puzzle
46
- ANIMATION_DURATION: 200 // ms for tile sliding animation
47
- };
48
- export const SLIDING_NUMBERS_ANIMATION_CONFIG = {
49
- TILE_SLIDE: {
50
- damping: 25,
51
- stiffness: 400,
52
- mass: 1,
53
- restDisplacementThreshold: 0.01,
54
- restSpeedThreshold: 0.01
55
- },
56
- TILE_PRESS: {
57
- damping: 15,
58
- stiffness: 200
59
- },
60
- GESTURE: {
61
- activeScale: 1.05,
62
- snapThreshold: 0.3,
63
- // 30% of tile size to trigger snap
64
- velocityThreshold: 500 // minimum velocity for gesture recognition
65
- },
66
- COMPLETION_CELEBRATION: {
67
- duration: 500
68
- }
69
- };
70
- export const SLIDING_NUMBERS_COLORS = {
71
- BACKGROUND: '#F5F5DC',
72
- // Beige background like the physical puzzle
73
- GRID_BACKGROUND: '#FFFFFF',
74
- // White grid background
75
- GRID_BORDER: '#E0E0E0',
76
- // Light gray border
77
- TILE_COLORS: ['#FFB3D9',
78
- // Soft pink (like tiles 1, 14, 11 in image)
79
- '#B3E5FC',
80
- // Soft light blue (like tiles 2, 13, 15 in image)
81
- '#C8E6C9',
82
- // Soft light green (like tiles 6, 9 in image)
83
- '#FFF9C4',
84
- // Soft light yellow (like tile 3 in image)
85
- '#E1BEE7',
86
- // Soft lavender (like tiles 7, 10 in image)
87
- '#FFCDD2',
88
- // Soft coral pink
89
- '#B2DFDB',
90
- // Soft mint green
91
- '#F8BBD9',
92
- // Soft rose pink
93
- '#A5D6A7',
94
- // Soft green
95
- '#FFECB3',
96
- // Soft cream yellow
97
- '#D1C4E9',
98
- // Soft purple
99
- '#B3E5FC',
100
- // Soft sky blue
101
- '#FFE0B2',
102
- // Soft peach
103
- '#C8E6C9',
104
- // Soft mint
105
- '#F8BBD9',
106
- // Soft pink
107
- '#E0F2F1',
108
- // Very soft mint
109
- '#FCE4EC',
110
- // Very soft pink
111
- '#E8F5E8',
112
- // Very soft green
113
- '#FFF3E0',
114
- // Very soft orange
115
- '#F3E5F5',
116
- // Very soft purple
117
- '#E1F5FE',
118
- // Very soft blue
119
- '#F9FBE7',
120
- // Very soft lime
121
- '#FFF8E1',
122
- // Very soft yellow
123
- '#EFEBE9' // Very soft brown
124
- ],
125
- TILE_BORDER: '#D0D0D0',
126
- TILE_SHADOW: 'rgba(0,0,0,0.1)',
127
- NUMBER_TEXT: '#333333',
128
- WORD_TEXT: '#666666',
129
- EMPTY_TILE: '#F8F8F8',
130
- SCORE_BOARD: '#f59e0b',
131
- // Yellow to match scoreboard
132
- SCORE_TEXT: '#FFFFFF',
133
- TIMER_TEXT: '#f59e0b',
134
- // Yellow for timer
135
- UI: '#f59e0b',
136
- // Yellow UI elements
137
- BUTTON_ACTIVE: '#f59e0b',
138
- // Yellow active button
139
- BUTTON_INACTIVE: '#fbbf24',
140
- // Lighter yellow for inactive
141
- TEXT_PRIMARY: '#FFFFFF',
142
- TEXT_SECONDARY: '#fef3c7',
143
- // Light yellow text
144
- WHITE: '#FFFFFF',
145
- START_BUTTON: '#f59e0b',
146
- // Yellow start button
147
- COMPLETION_OVERLAY: 'rgba(245, 158, 11, 0.9)',
148
- // Yellow overlay
149
- BUTTON_BORDER: '#fbbf24' // Light yellow border
150
- };
151
-
152
- // Number word mappings for tiles
153
- export const NUMBER_WORDS = {
154
- 1: 'one',
155
- 2: 'two',
156
- 3: 'three',
157
- 4: 'four',
158
- 5: 'five',
159
- 6: 'six',
160
- 7: 'seven',
161
- 8: 'eight',
162
- 9: 'nine',
163
- 10: 'ten',
164
- 11: 'eleven',
165
- 12: 'twelve',
166
- 13: 'thirteen',
167
- 14: 'fourteen',
168
- 15: 'fifteen',
169
- 16: 'sixteen',
170
- 17: 'seventeen',
171
- 18: 'eighteen',
172
- 19: 'nineteen',
173
- 20: 'twenty',
174
- 21: 'twenty-one',
175
- 22: 'twenty-two',
176
- 23: 'twenty-three',
177
- 24: 'twenty-four'
178
- };
179
-
180
- // Sliding Numbers Game Theme - Yellow theme matching the scoreboard
181
- export const SLIDING_NUMBERS_THEME = {
182
- backgroundColor: '#F5F5DC',
183
- // Beige background like physical puzzle
184
- headerBackgroundColor: 'rgba(245, 158, 11, 0.9)',
185
- // Yellow header
186
- headerTextColor: '#ffffff',
187
- sectionBackgroundColor: 'rgba(245, 158, 11, 0.4)',
188
- // Light yellow sections
189
- sectionTitleColor: '#ffffff',
190
- buttonSelectedColor: '#f59e0b',
191
- // Yellow for selected
192
- buttonUnselectedColor: 'rgba(255, 255, 255, 0.3)',
193
- buttonSelectedTextColor: '#ffffff',
194
- buttonUnselectedTextColor: '#1f2937',
195
- switchTrackColorFalse: 'rgba(245, 158, 11, 0.5)',
196
- switchTrackColorTrue: '#f59e0b',
197
- switchThumbColor: '#ffffff',
198
- infoTextColor: '#1f2937' // Dark text for readability
199
- };
200
-
201
- // Sliding Numbers Difficulty Descriptions
202
- export const SLIDING_NUMBERS_DIFFICULTY_DESCRIPTIONS = {
203
- easy: '3x3 grid with numbers 1-8, perfect for beginners',
204
- medium: '4x4 grid with numbers 1-15, moderate challenge',
205
- hard: '5x5 grid with numbers 1-24, expert level puzzle'
206
- };
207
- //# sourceMappingURL=SlidingNumbersConstants.js.map
1
+ "use strict";import{Dimensions}from 'react-native';const{width}= Dimensions.get('window');export const SLIDING_NUMBERS_CONSTANTS ={gridSize:{easy:3,medium:4,hard:5},maxNumbers:{easy:8,medium:15,hard:24},baseScore:{easy:1000,medium:2000,hard:3000},scoreMultiplier:{easy:5,medium:10,hard:15}};export const SLIDING_NUMBERS_GAME_CONFIG ={TILE_SIZE:Math.min(width * 0.16,70),TILE_GAP:4,GRID_PADDING:20,GAME_DURATION:600,SHUFFLE_MOVES:100,ANIMATION_DURATION:200};export const SLIDING_NUMBERS_ANIMATION_CONFIG ={TILE_SLIDE:{damping:25,stiffness:400,mass:1,restDisplacementThreshold:0.01,restSpeedThreshold:0.01},TILE_PRESS:{damping:15,stiffness:200},GESTURE:{activeScale:1.05,snapThreshold:0.3,velocityThreshold:500},COMPLETION_CELEBRATION:{duration:500}};export const SLIDING_NUMBERS_COLORS ={BACKGROUND:'#F5F5DC',GRID_BACKGROUND:'#FFFFFF',GRID_BORDER:'#E0E0E0',TILE_COLORS:['#FFB3D9','#B3E5FC','#C8E6C9','#FFF9C4','#E1BEE7','#FFCDD2','#B2DFDB','#F8BBD9','#A5D6A7','#FFECB3','#D1C4E9','#B3E5FC','#FFE0B2','#C8E6C9','#F8BBD9','#E0F2F1','#FCE4EC','#E8F5E8','#FFF3E0','#F3E5F5','#E1F5FE','#F9FBE7','#FFF8E1','#EFEBE9' ],TILE_BORDER:'#D0D0D0',TILE_SHADOW:'rgba(0,0,0,0.1)',NUMBER_TEXT:'#333333',WORD_TEXT:'#666666',EMPTY_TILE:'#F8F8F8',SCORE_BOARD:'#f59e0b',SCORE_TEXT:'#FFFFFF',TIMER_TEXT:'#f59e0b',UI:'#f59e0b',BUTTON_ACTIVE:'#f59e0b',BUTTON_INACTIVE:'#fbbf24',TEXT_PRIMARY:'#FFFFFF',TEXT_SECONDARY:'#fef3c7',WHITE:'#FFFFFF',START_BUTTON:'#f59e0b',COMPLETION_OVERLAY:'rgba(245,158,11,0.9)',BUTTON_BORDER:'#fbbf24'};export const NUMBER_WORDS ={1:'one',2:'two',3:'three',4:'four',5:'five',6:'six',7:'seven',8:'eight',9:'nine',10:'ten',11:'eleven',12:'twelve',13:'thirteen',14:'fourteen',15:'fifteen',16:'sixteen',17:'seventeen',18:'eighteen',19:'nineteen',20:'twenty',21:'twenty-one',22:'twenty-two',23:'twenty-three',24:'twenty-four'};export const SLIDING_NUMBERS_THEME ={backgroundColor:'rgba(0,0,0,0.7)',headerBackgroundColor:'#f59e0b',headerTextColor:'#ffffff',sectionBackgroundColor:'rgba(245,158,11,0.15)',sectionTitleColor:'#f59e0b',buttonSelectedColor:'#f59e0b',buttonUnselectedColor:'rgba(255,255,255,0.2)',buttonSelectedTextColor:'#ffffff',buttonUnselectedTextColor:'rgba(255,255,255,0.7)',switchTrackColorFalse:'rgba(245,158,11,0.3)',switchTrackColorTrue:'#f59e0b',switchThumbColor:'#ffffff',infoTextColor:'rgba(255,255,255,0.9)'};export const SLIDING_NUMBERS_DIFFICULTY_DESCRIPTIONS ={easy:'3x3 grid with numbers 1-8,perfect for beginners',medium:'4x4 grid with numbers 1-15,moderate challenge',hard:'5x5 grid with numbers 1-24,expert level puzzle'};
@@ -1 +1 @@
1
- {"version":3,"names":["Dimensions","width","get","SLIDING_NUMBERS_CONSTANTS","gridSize","easy","medium","hard","maxNumbers","baseScore","scoreMultiplier","SLIDING_NUMBERS_GAME_CONFIG","TILE_SIZE","Math","min","TILE_GAP","GRID_PADDING","GAME_DURATION","SHUFFLE_MOVES","ANIMATION_DURATION","SLIDING_NUMBERS_ANIMATION_CONFIG","TILE_SLIDE","damping","stiffness","mass","restDisplacementThreshold","restSpeedThreshold","TILE_PRESS","GESTURE","activeScale","snapThreshold","velocityThreshold","COMPLETION_CELEBRATION","duration","SLIDING_NUMBERS_COLORS","BACKGROUND","GRID_BACKGROUND","GRID_BORDER","TILE_COLORS","TILE_BORDER","TILE_SHADOW","NUMBER_TEXT","WORD_TEXT","EMPTY_TILE","SCORE_BOARD","SCORE_TEXT","TIMER_TEXT","UI","BUTTON_ACTIVE","BUTTON_INACTIVE","TEXT_PRIMARY","TEXT_SECONDARY","WHITE","START_BUTTON","COMPLETION_OVERLAY","BUTTON_BORDER","NUMBER_WORDS","SLIDING_NUMBERS_THEME","backgroundColor","headerBackgroundColor","headerTextColor","sectionBackgroundColor","sectionTitleColor","buttonSelectedColor","buttonUnselectedColor","buttonSelectedTextColor","buttonUnselectedTextColor","switchTrackColorFalse","switchTrackColorTrue","switchThumbColor","infoTextColor","SLIDING_NUMBERS_DIFFICULTY_DESCRIPTIONS"],"sourceRoot":"../../../../src","sources":["games/sliding-numbers/SlidingNumbersConstants.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;AAGzC;AACA,MAAM;EAAEC;AAAM,CAAC,GAAGD,UAAU,CAACE,GAAG,CAAC,QAAQ,CAAC;;AAE1C;AACA,OAAO,MAAMC,yBAAyB,GAAG;EACvCC,QAAQ,EAAE;IACRC,IAAI,EAAE,CAAC;IAAE;IACTC,MAAM,EAAE,CAAC;IAAE;IACXC,IAAI,EAAE,CAAC,CAAE;EACX,CAAC;EACDC,UAAU,EAAE;IACVH,IAAI,EAAE,CAAC;IAAE;IACTC,MAAM,EAAE,EAAE;IAAE;IACZC,IAAI,EAAE,EAAE,CAAE;EACZ,CAAC;EACDE,SAAS,EAAE;IACTJ,IAAI,EAAE,IAAI;IACVC,MAAM,EAAE,IAAI;IACZC,IAAI,EAAE;EACR,CAAC;EACD;EACAG,eAAe,EAAE;IACfL,IAAI,EAAE,CAAC;IACPC,MAAM,EAAE,EAAE;IACVC,IAAI,EAAE;EACR;AACF,CAAU;AAEV,OAAO,MAAMI,2BAA2B,GAAG;EACzCC,SAAS,EAAEC,IAAI,CAACC,GAAG,CAACb,KAAK,GAAG,IAAI,EAAE,EAAE,CAAC;EAAE;EACvCc,QAAQ,EAAE,CAAC;EACXC,YAAY,EAAE,EAAE;EAChBC,aAAa,EAAE,GAAG;EAAE;EACpBC,aAAa,EAAE,GAAG;EAAE;EACpBC,kBAAkB,EAAE,GAAG,CAAE;AAC3B,CAAU;AAEV,OAAO,MAAMC,gCAAgC,GAAG;EAC9CC,UAAU,EAAE;IACVC,OAAO,EAAE,EAAE;IACXC,SAAS,EAAE,GAAG;IACdC,IAAI,EAAE,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MC,uCAAuC,GAAG;EACrDlE,IAAI,EAAE,kDAAkD;EACxDC,MAAM,EAAE,gDAAgD;EACxDC,IAAI,EAAE;AACR,CAAU","ignoreList":[]}
1
+ {"version":3,"names":["Dimensions","width","get","SLIDING_NUMBERS_CONSTANTS","gridSize","easy","medium","hard","maxNumbers","baseScore","scoreMultiplier","SLIDING_NUMBERS_GAME_CONFIG","TILE_SIZE","Math","min","TILE_GAP","GRID_PADDING","GAME_DURATION","SHUFFLE_MOVES","ANIMATION_DURATION","SLIDING_NUMBERS_ANIMATION_CONFIG","TILE_SLIDE","damping","stiffness","mass","restDisplacementThreshold","restSpeedThreshold","TILE_PRESS","GESTURE","activeScale","snapThreshold","velocityThreshold","COMPLETION_CELEBRATION","duration","SLIDING_NUMBERS_COLORS","BACKGROUND","GRID_BACKGROUND","GRID_BORDER","TILE_COLORS","TILE_BORDER","TILE_SHADOW","NUMBER_TEXT","WORD_TEXT","EMPTY_TILE","SCORE_BOARD","SCORE_TEXT","TIMER_TEXT","UI","BUTTON_ACTIVE","BUTTON_INACTIVE","TEXT_PRIMARY","TEXT_SECONDARY","WHITE","START_BUTTON","COMPLETION_OVERLAY","BUTTON_BORDER","NUMBER_WORDS","SLIDING_NUMBERS_THEME","backgroundColor","headerBackgroundColor","headerTextColor","sectionBackgroundColor","sectionTitleColor","buttonSelectedColor","buttonUnselectedColor","buttonSelectedTextColor","buttonUnselectedTextColor","switchTrackColorFalse","switchTrackColorTrue","switchThumbColor","infoTextColor","SLIDING_NUMBERS_DIFFICULTY_DESCRIPTIONS"],"sourceRoot":"../../../../src","sources":["games/sliding-numbers/SlidingNumbersConstants.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;AAGzC;AACA,MAAM;EAAEC;AAAM,CAAC,GAAGD,UAAU,CAACE,GAAG,CAAC,QAAQ,CAAC;;AAE1C;AACA,OAAO,MAAMC,yBAAyB,GAAG;EACvCC,QAAQ,EAAE;IACRC,IAAI,EAAE,CAAC;IAAE;I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,QAAQ;EACZ,EAAE,EAAE,QAAQ;EACZ,EAAE,EAAE,UAAU;EACd,EAAE,EAAE,UAAU;EACd,EAAE,EAAE,SAAS;EACb,EAAE,EAAE,SAAS;EACb,EAAE,EAAE,WAAW;EACf,EAAE,EAAE,UAAU;EACd,EAAE,EAAE,UAAU;EACd,EAAE,EAAE,QAAQ;EACZ,EAAE,EAAE,YAAY;EAChB,EAAE,EAAE,YAAY;EAChB,EAAE,EAAE,cAAc;EAClB,EAAE,EAAE;AACN,CAAU;;AAEV;AACA,OAAO,MAAMC,qBAAwC,GAAG;EACtDC,eAAe,EAAE,oBAAoB;EAAE;EACvCC,qBAAqB,EAAE,SAAS;EAAE;EAClCC,eAAe,EAAE,SAAS;EAC1BC,sBAAsB,EAAE,0BAA0B;EAAE;EACpDC,iBAAiB,EAAE,SAAS;EAAE;EAC9BC,mBAAmB,EAAE,SAAS;EAAE;EAChCC,qBAAqB,EAAE,0BAA0B;EACjDC,uBAAuB,EAAE,SAAS;EAClCC,yBAAyB,EAAE,0BAA0B;EAAE;EACvDC,qBAAqB,EAAE,yBAAyB;EAChDC,oBAAoB,EAAE,SAAS;EAAE;EACjCC,gBAAgB,EAAE,SAAS;EAC3BC,aAAa,EAAE,0BAA0B,CAAE;AAC7C,CAAC;;AAED;AACA,OAAO,MAAMC,uCAAuC,GAAG;EACrDlE,IAAI,EAAE,kDAAkD;EACxDC,MAAM,EAAE,gDAAgD;EACxDC,IAAI,EAAE;AACR,CAAU","ignoreList":[]}
@@ -1,248 +1 @@
1
- "use strict";
2
-
3
- import { SLIDING_NUMBERS_CONSTANTS } from "./SlidingNumbersConstants.js";
4
- export class SlidingNumbersService {
5
- gameTimer = null;
6
-
7
- // Initialize a solved puzzle
8
- createSolvedPuzzle(gridSize) {
9
- const tiles = [];
10
- const totalTiles = gridSize * gridSize;
11
- for (let i = 0; i < totalTiles; i++) {
12
- const row = Math.floor(i / gridSize);
13
- const col = i % gridSize;
14
- const value = i === totalTiles - 1 ? 0 : i + 1; // Last tile is empty (0)
15
-
16
- tiles.push({
17
- id: i,
18
- value,
19
- position: {
20
- row,
21
- col
22
- },
23
- isCorrect: true
24
- });
25
- }
26
- return tiles;
27
- }
28
-
29
- // Check if a tile can be moved (is adjacent to empty space)
30
- canMoveTile(tile, emptyPosition) {
31
- const rowDiff = Math.abs(tile.position.row - emptyPosition.row);
32
- const colDiff = Math.abs(tile.position.col - emptyPosition.col);
33
- return rowDiff === 1 && colDiff === 0 || rowDiff === 0 && colDiff === 1;
34
- }
35
-
36
- // Get all tiles that can be moved (adjacent to empty space)
37
- getMovableTiles(tiles, emptyPosition) {
38
- return tiles.filter(tile => tile.value !== 0 && this.canMoveTile(tile, emptyPosition));
39
- }
40
-
41
- // Check if puzzle is solvable using inversion count
42
- isPuzzleSolvable(tiles, gridSize) {
43
- const flatArray = [];
44
- let emptyRow = 0;
45
-
46
- // Create flat array and find empty tile row
47
- for (let row = 0; row < gridSize; row++) {
48
- for (let col = 0; col < gridSize; col++) {
49
- const tile = tiles.find(t => t.position.row === row && t.position.col === col);
50
- if (tile) {
51
- if (tile.value === 0) {
52
- emptyRow = row;
53
- } else {
54
- flatArray.push(tile.value);
55
- }
56
- }
57
- }
58
- }
59
-
60
- // Count inversions
61
- let inversions = 0;
62
- for (let i = 0; i < flatArray.length - 1; i++) {
63
- for (let j = i + 1; j < flatArray.length; j++) {
64
- if ((flatArray[i] || 0) > (flatArray[j] || 0)) {
65
- inversions++;
66
- }
67
- }
68
- }
69
-
70
- // For odd grid size, puzzle is solvable if inversions are even
71
- if (gridSize % 2 === 1) {
72
- return inversions % 2 === 0;
73
- }
74
-
75
- // For even grid size, puzzle is solvable if:
76
- // - Empty tile is on even row from bottom and inversions are odd
77
- // - Empty tile is on odd row from bottom and inversions are even
78
- const emptyRowFromBottom = gridSize - emptyRow;
79
- if (emptyRowFromBottom % 2 === 0) {
80
- return inversions % 2 === 1;
81
- } else {
82
- return inversions % 2 === 0;
83
- }
84
- }
85
-
86
- // Shuffle puzzle ensuring it remains solvable
87
- shufflePuzzle(tiles, gridSize) {
88
- const shuffledTiles = [...tiles];
89
- let attempts = 0;
90
- const maxAttempts = 100;
91
- do {
92
- // Fisher-Yates shuffle for positions
93
- const positions = [];
94
- for (let row = 0; row < gridSize; row++) {
95
- for (let col = 0; col < gridSize; col++) {
96
- positions.push({
97
- row,
98
- col
99
- });
100
- }
101
- }
102
- for (let i = positions.length - 1; i > 0; i--) {
103
- const j = Math.floor(Math.random() * (i + 1));
104
- const posI = positions[i];
105
- const posJ = positions[j];
106
- if (posI && posJ) {
107
- [positions[i], positions[j]] = [posJ, posI];
108
- }
109
- }
110
-
111
- // Assign shuffled positions to tiles
112
- shuffledTiles.forEach((tile, index) => {
113
- const position = positions[index];
114
- if (position) {
115
- tile.position = position;
116
- }
117
- });
118
- attempts++;
119
- } while (!this.isPuzzleSolvable(shuffledTiles, gridSize) && attempts < maxAttempts);
120
-
121
- // If we couldn't find a solvable configuration, use a simple swap method
122
- if (attempts >= maxAttempts) {
123
- return this.shuffleWithValidMoves(tiles, gridSize);
124
- }
125
-
126
- // Update correctness after shuffle
127
- shuffledTiles.forEach((tile, index) => {
128
- const correctRow = Math.floor(index / gridSize);
129
- const correctCol = index % gridSize;
130
- tile.isCorrect = tile.position.row === correctRow && tile.position.col === correctCol;
131
- });
132
- return shuffledTiles;
133
- }
134
-
135
- // Alternative shuffle method using valid moves
136
- shuffleWithValidMoves(tiles, gridSize) {
137
- const shuffledTiles = [...tiles];
138
- let emptyPosition = {
139
- row: gridSize - 1,
140
- col: gridSize - 1
141
- };
142
- const shuffleMoves = 1000;
143
- for (let i = 0; i < shuffleMoves; i++) {
144
- const movableTiles = this.getMovableTiles(shuffledTiles, emptyPosition);
145
- if (movableTiles.length > 0) {
146
- const randomTile = movableTiles[Math.floor(Math.random() * movableTiles.length)];
147
- const emptyTile = shuffledTiles.find(t => t.value === 0);
148
- if (emptyTile && randomTile) {
149
- // Swap positions
150
- const tilePos = randomTile.position;
151
- randomTile.position = emptyPosition;
152
- emptyTile.position = tilePos;
153
- emptyPosition = tilePos;
154
- }
155
- }
156
- }
157
-
158
- // Update correctness after shuffle
159
- shuffledTiles.forEach((tile, index) => {
160
- const correctRow = Math.floor(index / gridSize);
161
- const correctCol = index % gridSize;
162
- tile.isCorrect = tile.position.row === correctRow && tile.position.col === correctCol;
163
- });
164
- return shuffledTiles;
165
- }
166
-
167
- // Check if puzzle is completed
168
- isPuzzleCompleted(tiles, gridSize) {
169
- return tiles.every((tile, index) => {
170
- const correctRow = Math.floor(index / gridSize);
171
- const correctCol = index % gridSize;
172
- return tile.position.row === correctRow && tile.position.col === correctCol;
173
- });
174
- }
175
-
176
- // Calculate score based on time elapsed
177
- calculateScore(timeElapsed, difficulty) {
178
- const baseScore = SLIDING_NUMBERS_CONSTANTS.baseScore[difficulty];
179
- const multiplier = SLIDING_NUMBERS_CONSTANTS.scoreMultiplier[difficulty];
180
- const timeScore = Math.max(0, baseScore - timeElapsed * multiplier);
181
- return timeScore;
182
- }
183
-
184
- // Get optimal move count for difficulty (for scoring reference)
185
- getOptimalMoveCount(difficulty) {
186
- switch (difficulty) {
187
- case 'easy':
188
- return 50;
189
- // 3x3 puzzle
190
- case 'medium':
191
- return 100;
192
- // 4x4 puzzle
193
- case 'hard':
194
- return 200;
195
- // 5x5 puzzle
196
- default:
197
- return 50;
198
- }
199
- }
200
-
201
- // Start game timer
202
- startTimer(onTick) {
203
- this.stopTimer();
204
- this.gameTimer = setInterval(onTick, 1000);
205
- }
206
-
207
- // Stop game timer
208
- stopTimer() {
209
- if (this.gameTimer) {
210
- clearInterval(this.gameTimer);
211
- this.gameTimer = null;
212
- }
213
- }
214
-
215
- // Get hint for next best move
216
- getHint(tiles, emptyPosition) {
217
- // Simple heuristic: find a tile that's not in correct position and can be moved
218
- const movableTiles = this.getMovableTiles(tiles, emptyPosition);
219
- const incorrectMovableTiles = movableTiles.filter(tile => !tile.isCorrect);
220
- if (incorrectMovableTiles.length > 0) {
221
- return incorrectMovableTiles[0] || null;
222
- }
223
- return movableTiles.length > 0 ? movableTiles[0] || null : null;
224
- }
225
-
226
- // Format time for display
227
- formatTime(seconds) {
228
- const minutes = Math.floor(seconds / 60);
229
- const remainingSeconds = seconds % 60;
230
- return `${minutes}:${remainingSeconds.toString().padStart(2, '0')}`;
231
- }
232
-
233
- // Get difficulty settings
234
- getDifficultySettings(difficulty) {
235
- return {
236
- gridSize: SLIDING_NUMBERS_CONSTANTS.gridSize[difficulty],
237
- maxNumbers: SLIDING_NUMBERS_CONSTANTS.maxNumbers[difficulty],
238
- baseScore: SLIDING_NUMBERS_CONSTANTS.baseScore[difficulty],
239
- scoreMultiplier: SLIDING_NUMBERS_CONSTANTS.scoreMultiplier[difficulty]
240
- };
241
- }
242
-
243
- // Clean up resources
244
- cleanup() {
245
- this.stopTimer();
246
- }
247
- }
248
- //# sourceMappingURL=SlidingNumbersService.js.map
1
+ "use strict";import{SLIDING_NUMBERS_CONSTANTS}from "./SlidingNumbersConstants.js";export class SlidingNumbersService{gameTimer = null;createSolvedPuzzle(gridSize){const tiles = [];const totalTiles = gridSize * gridSize;for(let i = 0;i < totalTiles;i++){const row = Math.floor(i / gridSize);const col = i % gridSize;const value = i === totalTiles - 1 ? 0:i + 1;tiles.push({id:i,value,position:{row,col},isCorrect:true});}return tiles;}canMoveTile(tile,emptyPosition){const rowDiff = Math.abs(tile.position.row - emptyPosition.row);const colDiff = Math.abs(tile.position.col - emptyPosition.col);return rowDiff === 1 && colDiff === 0 || rowDiff === 0 && colDiff === 1;}getMovableTiles(tiles,emptyPosition){return tiles.filter(tile => tile.value !== 0 && this.canMoveTile(tile,emptyPosition));}isPuzzleSolvable(tiles,gridSize){const flatArray = [];let emptyRow = 0;for(let row = 0;row < gridSize;row++){for(let col = 0;col < gridSize;col++){const tile = tiles.find(t => t.position.row === row && t.position.col === col);if(tile){if(tile.value === 0){emptyRow = row;}else{flatArray.push(tile.value);}}}}let inversions = 0;for(let i = 0;i < flatArray.length - 1;i++){for(let j = i + 1;j < flatArray.length;j++){if((flatArray[i] || 0)>(flatArray[j] || 0)){inversions++;}}}if(gridSize % 2 === 1){return inversions % 2 === 0;}const emptyRowFromBottom = gridSize - emptyRow;if(emptyRowFromBottom % 2 === 0){return inversions % 2 === 1;}else{return inversions % 2 === 0;}}shufflePuzzle(tiles,gridSize){const shuffledTiles = [...tiles];let attempts = 0;const maxAttempts = 100;do{const positions = [];for(let row = 0;row < gridSize;row++){for(let col = 0;col < gridSize;col++){positions.push({row,col});}}for(let i = positions.length - 1;i > 0;i--){const j = Math.floor(Math.random()*(i + 1));const posI = positions[i];const posJ = positions[j];if(posI && posJ){[positions[i],positions[j]] = [posJ,posI];}}shuffledTiles.forEach((tile,index)=>{const position = positions[index];if(position){tile.position = position;}});attempts++;}while(!this.isPuzzleSolvable(shuffledTiles,gridSize)&& attempts < maxAttempts);if(attempts >= maxAttempts){return this.shuffleWithValidMoves(tiles,gridSize);}shuffledTiles.forEach((tile,index)=>{const correctRow = Math.floor(index / gridSize);const correctCol = index % gridSize;tile.isCorrect = tile.position.row === correctRow && tile.position.col === correctCol;});return shuffledTiles;}shuffleWithValidMoves(tiles,gridSize){const shuffledTiles = [...tiles];let emptyPosition ={row:gridSize - 1,col:gridSize - 1};const shuffleMoves = 1000;for(let i = 0;i < shuffleMoves;i++){const movableTiles = this.getMovableTiles(shuffledTiles,emptyPosition);if(movableTiles.length > 0){const randomTile = movableTiles[Math.floor(Math.random()* movableTiles.length)];const emptyTile = shuffledTiles.find(t => t.value === 0);if(emptyTile && randomTile){const tilePos = randomTile.position;randomTile.position = emptyPosition;emptyTile.position = tilePos;emptyPosition = tilePos;}}}shuffledTiles.forEach((tile,index)=>{const correctRow = Math.floor(index / gridSize);const correctCol = index % gridSize;tile.isCorrect = tile.position.row === correctRow && tile.position.col === correctCol;});return shuffledTiles;}isPuzzleCompleted(tiles,gridSize){return tiles.every((tile,index)=>{const correctRow = Math.floor(index / gridSize);const correctCol = index % gridSize;return tile.position.row === correctRow && tile.position.col === correctCol;});}calculateScore(timeElapsed,difficulty){const baseScore = SLIDING_NUMBERS_CONSTANTS.baseScore[difficulty];const multiplier = SLIDING_NUMBERS_CONSTANTS.scoreMultiplier[difficulty];const timeScore = Math.max(0,baseScore - timeElapsed * multiplier);return timeScore;}getOptimalMoveCount(difficulty){switch(difficulty){case 'easy':return 50;case 'medium':return 100;case 'hard':return 200;default:return 50;}}startTimer(onTick){this.stopTimer();this.gameTimer = setInterval(onTick,1000);}stopTimer(){if(this.gameTimer){clearInterval(this.gameTimer);this.gameTimer = null;}}getHint(tiles,emptyPosition){const movableTiles = this.getMovableTiles(tiles,emptyPosition);const incorrectMovableTiles = movableTiles.filter(tile => !tile.isCorrect);if(incorrectMovableTiles.length > 0){return incorrectMovableTiles[0] || null;}return movableTiles.length > 0 ? movableTiles[0] || null:null;}formatTime(seconds){const minutes = Math.floor(seconds / 60);const remainingSeconds = seconds % 60;return `${minutes}:${remainingSeconds.toString().padStart(2,'0')}`;}getDifficultySettings(difficulty){return{gridSize:SLIDING_NUMBERS_CONSTANTS.gridSize[difficulty],maxNumbers:SLIDING_NUMBERS_CONSTANTS.maxNumbers[difficulty],baseScore:SLIDING_NUMBERS_CONSTANTS.baseScore[difficulty],scoreMultiplier:SLIDING_NUMBERS_CONSTANTS.scoreMultiplier[difficulty]};}cleanup(){this.stopTimer();}}