react-native-games 0.3.0 → 0.5.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 (429) hide show
  1. package/README.md +134 -130
  2. package/lib/module/games/balloon-blaster/BalloonBlaster.js +116 -343
  3. package/lib/module/games/balloon-blaster/BalloonBlaster.js.map +1 -1
  4. package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js +182 -0
  5. package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js.map +1 -0
  6. package/lib/module/games/balloon-blaster/BalloonBlasterService.js +123 -101
  7. package/lib/module/games/balloon-blaster/BalloonBlasterService.js.map +1 -1
  8. package/lib/module/games/balloon-blaster/BalloonBlasterStore.js +119 -92
  9. package/lib/module/games/balloon-blaster/BalloonBlasterStore.js.map +1 -1
  10. package/lib/module/games/balloon-blaster/components/BalloonComponent.js +123 -113
  11. package/lib/module/games/balloon-blaster/components/BalloonComponent.js.map +1 -1
  12. package/lib/module/games/balloon-blaster/components/GameArea.js +137 -23
  13. package/lib/module/games/balloon-blaster/components/GameArea.js.map +1 -1
  14. package/lib/module/games/balloon-blaster/components/GameBackground.js +8 -83
  15. package/lib/module/games/balloon-blaster/components/GameBackground.js.map +1 -1
  16. package/lib/module/games/balloon-blaster/components/ScoreBoard.js +15 -22
  17. package/lib/module/games/balloon-blaster/components/ScoreBoard.js.map +1 -1
  18. package/lib/module/games/balloon-blaster/components/index.js +0 -4
  19. package/lib/module/games/balloon-blaster/components/index.js.map +1 -1
  20. package/lib/module/games/fruit-ninja/FruitNinja.js +143 -0
  21. package/lib/module/games/fruit-ninja/FruitNinja.js.map +1 -0
  22. package/lib/module/games/fruit-ninja/FruitNinjaConstants.js +148 -0
  23. package/lib/module/games/fruit-ninja/FruitNinjaConstants.js.map +1 -0
  24. package/lib/module/games/{fruit-slicer/FruitSlicerService.js → fruit-ninja/FruitNinjaService.js} +43 -21
  25. package/lib/module/games/fruit-ninja/FruitNinjaService.js.map +1 -0
  26. package/lib/module/games/fruit-ninja/FruitNinjaStore.js +191 -0
  27. package/lib/module/games/fruit-ninja/FruitNinjaStore.js.map +1 -0
  28. package/lib/module/games/{fruit-slicer → fruit-ninja}/components/FruitComponent.js +1 -1
  29. package/lib/module/games/fruit-ninja/components/FruitComponent.js.map +1 -0
  30. package/lib/module/games/fruit-ninja/components/GameArea.js +215 -0
  31. package/lib/module/games/fruit-ninja/components/GameArea.js.map +1 -0
  32. package/lib/module/games/{fruit-slicer → fruit-ninja}/components/GameBackground.js +250 -304
  33. package/lib/module/games/fruit-ninja/components/GameBackground.js.map +1 -0
  34. package/lib/module/games/{fruit-slicer → fruit-ninja}/components/ScoreBoard.js +17 -47
  35. package/lib/module/games/fruit-ninja/components/ScoreBoard.js.map +1 -0
  36. package/lib/module/games/fruit-ninja/components/index.js +7 -0
  37. package/lib/module/games/fruit-ninja/components/index.js.map +1 -0
  38. package/lib/module/games/maze-runner/MazeRunner.js +184 -169
  39. package/lib/module/games/maze-runner/MazeRunner.js.map +1 -1
  40. package/lib/module/games/maze-runner/MazeRunnerConstants.js +100 -0
  41. package/lib/module/games/maze-runner/MazeRunnerConstants.js.map +1 -0
  42. package/lib/module/games/maze-runner/MazeRunnerService.js +37 -14
  43. package/lib/module/games/maze-runner/MazeRunnerService.js.map +1 -1
  44. package/lib/module/games/maze-runner/components/EnhancedBallComponent.js +5 -4
  45. package/lib/module/games/maze-runner/components/EnhancedBallComponent.js.map +1 -1
  46. package/lib/module/games/maze-runner/components/EnhancedGameArea.js +20 -15
  47. package/lib/module/games/maze-runner/components/EnhancedGameArea.js.map +1 -1
  48. package/lib/module/games/maze-runner/components/GameBackground.js +151 -192
  49. package/lib/module/games/maze-runner/components/GameBackground.js.map +1 -1
  50. package/lib/module/games/maze-runner/components/ScoreBoard.js +15 -25
  51. package/lib/module/games/maze-runner/components/ScoreBoard.js.map +1 -1
  52. package/lib/module/games/maze-runner/components/WallComponent.js +3 -2
  53. package/lib/module/games/maze-runner/components/WallComponent.js.map +1 -1
  54. package/lib/module/games/maze-runner/components/index.js +0 -2
  55. package/lib/module/games/maze-runner/components/index.js.map +1 -1
  56. package/lib/module/games/popit-fidget/PopitFidget.js +294 -0
  57. package/lib/module/games/popit-fidget/PopitFidget.js.map +1 -0
  58. package/lib/module/games/popit-fidget/PopitFidgetConstants.js +113 -0
  59. package/lib/module/games/popit-fidget/PopitFidgetConstants.js.map +1 -0
  60. package/lib/module/games/popit-fidget/PopitFidgetService.js +132 -0
  61. package/lib/module/games/popit-fidget/PopitFidgetService.js.map +1 -0
  62. package/lib/module/games/popit-fidget/PopitFidgetStore.js +163 -0
  63. package/lib/module/games/popit-fidget/PopitFidgetStore.js.map +1 -0
  64. package/lib/module/games/popit-fidget/components/BubbleComponent.js +198 -0
  65. package/lib/module/games/popit-fidget/components/BubbleComponent.js.map +1 -0
  66. package/lib/module/games/popit-fidget/components/FidgetGrid.js +165 -0
  67. package/lib/module/games/popit-fidget/components/FidgetGrid.js.map +1 -0
  68. package/lib/module/games/popit-fidget/components/GameBackground.js +177 -0
  69. package/lib/module/games/popit-fidget/components/GameBackground.js.map +1 -0
  70. package/lib/module/games/popit-fidget/components/ScoreBoard.js +75 -0
  71. package/lib/module/games/popit-fidget/components/ScoreBoard.js.map +1 -0
  72. package/lib/module/games/popit-fidget/components/index.js +7 -0
  73. package/lib/module/games/popit-fidget/components/index.js.map +1 -0
  74. package/lib/module/games/space-fighter/SpaceFighter.js +169 -0
  75. package/lib/module/games/space-fighter/SpaceFighter.js.map +1 -0
  76. package/lib/module/games/space-fighter/SpaceFighterConstants.js +108 -0
  77. package/lib/module/games/space-fighter/SpaceFighterConstants.js.map +1 -0
  78. package/lib/module/games/{space-traveller/SpaceTravellerService.js → space-fighter/SpaceFighterService.js} +48 -21
  79. package/lib/module/games/space-fighter/SpaceFighterService.js.map +1 -0
  80. package/lib/module/games/space-fighter/SpaceFighterStore.js +195 -0
  81. package/lib/module/games/space-fighter/SpaceFighterStore.js.map +1 -0
  82. package/lib/module/games/{space-traveller → space-fighter}/components/AsteroidComponent.js +7 -5
  83. package/lib/module/games/space-fighter/components/AsteroidComponent.js.map +1 -0
  84. package/lib/module/games/space-fighter/components/GameArea.js +295 -0
  85. package/lib/module/games/space-fighter/components/GameArea.js.map +1 -0
  86. package/lib/module/games/{space-traveller → space-fighter}/components/GameBackground.js +10 -65
  87. package/lib/module/games/space-fighter/components/GameBackground.js.map +1 -0
  88. package/lib/module/games/{space-traveller → space-fighter}/components/ScoreBoard.js +20 -26
  89. package/lib/module/games/space-fighter/components/ScoreBoard.js.map +1 -0
  90. package/lib/module/games/{space-traveller → space-fighter}/components/Spacecraft3D.js +72 -111
  91. package/lib/module/games/space-fighter/components/Spacecraft3D.js.map +1 -0
  92. package/lib/module/games/space-fighter/components/SpacecraftPath.js +52 -0
  93. package/lib/module/games/space-fighter/components/SpacecraftPath.js.map +1 -0
  94. package/lib/module/games/{space-traveller → space-fighter}/components/index.js +0 -4
  95. package/lib/module/games/space-fighter/components/index.js.map +1 -0
  96. package/lib/module/games/whack-a-mole/WhackAMole.js +263 -0
  97. package/lib/module/games/whack-a-mole/WhackAMole.js.map +1 -0
  98. package/lib/module/games/whack-a-mole/WhackAMoleConstants.js +115 -0
  99. package/lib/module/games/whack-a-mole/WhackAMoleConstants.js.map +1 -0
  100. package/lib/module/games/whack-a-mole/WhackAMoleService.js +120 -0
  101. package/lib/module/games/whack-a-mole/WhackAMoleService.js.map +1 -0
  102. package/lib/module/games/whack-a-mole/WhackAMoleStore.js +172 -0
  103. package/lib/module/games/whack-a-mole/WhackAMoleStore.js.map +1 -0
  104. package/lib/module/games/{cat-popper → whack-a-mole}/components/GameBackground.js +31 -91
  105. package/lib/module/games/whack-a-mole/components/GameBackground.js.map +1 -0
  106. package/lib/module/games/whack-a-mole/components/GameGrid.js +97 -0
  107. package/lib/module/games/whack-a-mole/components/GameGrid.js.map +1 -0
  108. package/lib/module/games/{cat-popper → whack-a-mole}/components/GameHole.js +67 -54
  109. package/lib/module/games/whack-a-mole/components/GameHole.js.map +1 -0
  110. package/lib/module/games/{cat-popper/components/CatCharacter.js → whack-a-mole/components/MoleCharacter.js} +75 -115
  111. package/lib/module/games/whack-a-mole/components/MoleCharacter.js.map +1 -0
  112. package/lib/module/games/{cat-popper → whack-a-mole}/components/ScoreBoard.js +13 -17
  113. package/lib/module/games/whack-a-mole/components/ScoreBoard.js.map +1 -0
  114. package/lib/module/games/{cat-popper → whack-a-mole}/components/index.js +1 -3
  115. package/lib/module/games/whack-a-mole/components/index.js.map +1 -0
  116. package/lib/module/index.js +4 -3
  117. package/lib/module/index.js.map +1 -1
  118. package/lib/module/services/GamesConstants.js +41 -519
  119. package/lib/module/services/GamesConstants.js.map +1 -1
  120. package/lib/module/services/GamesService.js +35 -23
  121. package/lib/module/services/GamesService.js.map +1 -1
  122. package/lib/module/services/HapticsService.js +77 -0
  123. package/lib/module/services/HapticsService.js.map +1 -0
  124. package/lib/module/services/SoundsService.js +171 -0
  125. package/lib/module/services/SoundsService.js.map +1 -0
  126. package/lib/module/shared/helpers/AnimationFrame.js +120 -0
  127. package/lib/module/shared/helpers/AnimationFrame.js.map +1 -0
  128. package/lib/module/shared/helpers/AnimationTracker.js +89 -0
  129. package/lib/module/shared/helpers/AnimationTracker.js.map +1 -0
  130. package/lib/module/shared/helpers/ErrorHandler.js +269 -0
  131. package/lib/module/shared/helpers/ErrorHandler.js.map +1 -0
  132. package/lib/module/shared/helpers/GameControlButton.js +219 -0
  133. package/lib/module/shared/helpers/GameControlButton.js.map +1 -0
  134. package/lib/module/{games/balloon-blaster/components → shared/helpers}/GameOverModal.js +25 -17
  135. package/lib/module/shared/helpers/GameOverModal.js.map +1 -0
  136. package/lib/module/shared/helpers/GameSettingsModal.js +287 -0
  137. package/lib/module/shared/helpers/GameSettingsModal.js.map +1 -0
  138. package/lib/module/shared/helpers/ParticleBlast.js +133 -0
  139. package/lib/module/shared/helpers/ParticleBlast.js.map +1 -0
  140. package/lib/module/shared/helpers/ResponsiveScoreBoard.js +81 -0
  141. package/lib/module/shared/helpers/ResponsiveScoreBoard.js.map +1 -0
  142. package/lib/module/shared/helpers/index.js +12 -0
  143. package/lib/module/shared/helpers/index.js.map +1 -0
  144. package/lib/typescript/src/games/balloon-blaster/BalloonBlaster.d.ts +2 -14
  145. package/lib/typescript/src/games/balloon-blaster/BalloonBlaster.d.ts.map +1 -1
  146. package/lib/typescript/src/games/balloon-blaster/BalloonBlasterConstants.d.ts +144 -0
  147. package/lib/typescript/src/games/balloon-blaster/BalloonBlasterConstants.d.ts.map +1 -0
  148. package/lib/typescript/src/games/balloon-blaster/BalloonBlasterService.d.ts +1 -1
  149. package/lib/typescript/src/games/balloon-blaster/BalloonBlasterService.d.ts.map +1 -1
  150. package/lib/typescript/src/games/balloon-blaster/BalloonBlasterStore.d.ts +12 -2
  151. package/lib/typescript/src/games/balloon-blaster/BalloonBlasterStore.d.ts.map +1 -1
  152. package/lib/typescript/src/games/balloon-blaster/components/BalloonComponent.d.ts.map +1 -1
  153. package/lib/typescript/src/games/balloon-blaster/components/GameArea.d.ts +1 -15
  154. package/lib/typescript/src/games/balloon-blaster/components/GameArea.d.ts.map +1 -1
  155. package/lib/typescript/src/games/balloon-blaster/components/GameBackground.d.ts.map +1 -1
  156. package/lib/typescript/src/games/balloon-blaster/components/ScoreBoard.d.ts +1 -7
  157. package/lib/typescript/src/games/balloon-blaster/components/ScoreBoard.d.ts.map +1 -1
  158. package/lib/typescript/src/games/balloon-blaster/components/index.d.ts +0 -4
  159. package/lib/typescript/src/games/balloon-blaster/components/index.d.ts.map +1 -1
  160. package/lib/typescript/src/games/fruit-ninja/FruitNinja.d.ts +4 -0
  161. package/lib/typescript/src/games/fruit-ninja/FruitNinja.d.ts.map +1 -0
  162. package/lib/typescript/src/games/fruit-ninja/FruitNinjaConstants.d.ts +112 -0
  163. package/lib/typescript/src/games/fruit-ninja/FruitNinjaConstants.d.ts.map +1 -0
  164. package/lib/typescript/src/games/{fruit-slicer/FruitSlicerService.d.ts → fruit-ninja/FruitNinjaService.d.ts} +13 -5
  165. package/lib/typescript/src/games/fruit-ninja/FruitNinjaService.d.ts.map +1 -0
  166. package/lib/typescript/src/games/{fruit-slicer/FruitSlicerStore.d.ts → fruit-ninja/FruitNinjaStore.d.ts} +13 -4
  167. package/lib/typescript/src/games/fruit-ninja/FruitNinjaStore.d.ts.map +1 -0
  168. package/lib/typescript/src/games/{fruit-slicer → fruit-ninja}/components/FruitComponent.d.ts +1 -1
  169. package/lib/typescript/src/games/fruit-ninja/components/FruitComponent.d.ts.map +1 -0
  170. package/lib/typescript/src/games/fruit-ninja/components/GameArea.d.ts +3 -0
  171. package/lib/typescript/src/games/fruit-ninja/components/GameArea.d.ts.map +1 -0
  172. package/lib/typescript/src/games/fruit-ninja/components/GameBackground.d.ts.map +1 -0
  173. package/lib/typescript/src/games/fruit-ninja/components/ScoreBoard.d.ts +3 -0
  174. package/lib/typescript/src/games/fruit-ninja/components/ScoreBoard.d.ts.map +1 -0
  175. package/lib/typescript/src/games/fruit-ninja/components/index.d.ts +5 -0
  176. package/lib/typescript/src/games/fruit-ninja/components/index.d.ts.map +1 -0
  177. package/lib/typescript/src/games/maze-runner/MazeRunner.d.ts +2 -16
  178. package/lib/typescript/src/games/maze-runner/MazeRunner.d.ts.map +1 -1
  179. package/lib/typescript/src/games/maze-runner/MazeRunnerConstants.d.ts +41 -0
  180. package/lib/typescript/src/games/maze-runner/MazeRunnerConstants.d.ts.map +1 -0
  181. package/lib/typescript/src/games/maze-runner/MazeRunnerService.d.ts +4 -2
  182. package/lib/typescript/src/games/maze-runner/MazeRunnerService.d.ts.map +1 -1
  183. package/lib/typescript/src/games/maze-runner/components/EnhancedBallComponent.d.ts.map +1 -1
  184. package/lib/typescript/src/games/maze-runner/components/EnhancedGameArea.d.ts.map +1 -1
  185. package/lib/typescript/src/games/maze-runner/components/GameBackground.d.ts +2 -1
  186. package/lib/typescript/src/games/maze-runner/components/GameBackground.d.ts.map +1 -1
  187. package/lib/typescript/src/games/maze-runner/components/ScoreBoard.d.ts.map +1 -1
  188. package/lib/typescript/src/games/maze-runner/components/WallComponent.d.ts.map +1 -1
  189. package/lib/typescript/src/games/maze-runner/components/index.d.ts +0 -2
  190. package/lib/typescript/src/games/maze-runner/components/index.d.ts.map +1 -1
  191. package/lib/typescript/src/games/popit-fidget/PopitFidget.d.ts +5 -0
  192. package/lib/typescript/src/games/popit-fidget/PopitFidget.d.ts.map +1 -0
  193. package/lib/typescript/src/games/popit-fidget/PopitFidgetConstants.d.ts +45 -0
  194. package/lib/typescript/src/games/popit-fidget/PopitFidgetConstants.d.ts.map +1 -0
  195. package/lib/typescript/src/games/popit-fidget/PopitFidgetService.d.ts +33 -0
  196. package/lib/typescript/src/games/popit-fidget/PopitFidgetService.d.ts.map +1 -0
  197. package/lib/typescript/src/games/popit-fidget/PopitFidgetStore.d.ts +36 -0
  198. package/lib/typescript/src/games/popit-fidget/PopitFidgetStore.d.ts.map +1 -0
  199. package/lib/typescript/src/games/popit-fidget/components/BubbleComponent.d.ts +12 -0
  200. package/lib/typescript/src/games/popit-fidget/components/BubbleComponent.d.ts.map +1 -0
  201. package/lib/typescript/src/games/popit-fidget/components/FidgetGrid.d.ts +12 -0
  202. package/lib/typescript/src/games/popit-fidget/components/FidgetGrid.d.ts.map +1 -0
  203. package/lib/typescript/src/games/popit-fidget/components/GameBackground.d.ts +9 -0
  204. package/lib/typescript/src/games/popit-fidget/components/GameBackground.d.ts.map +1 -0
  205. package/lib/typescript/src/games/popit-fidget/components/ScoreBoard.d.ts +8 -0
  206. package/lib/typescript/src/games/popit-fidget/components/ScoreBoard.d.ts.map +1 -0
  207. package/lib/typescript/src/games/popit-fidget/components/index.d.ts +5 -0
  208. package/lib/typescript/src/games/popit-fidget/components/index.d.ts.map +1 -0
  209. package/lib/typescript/src/games/space-fighter/SpaceFighter.d.ts +4 -0
  210. package/lib/typescript/src/games/space-fighter/SpaceFighter.d.ts.map +1 -0
  211. package/lib/typescript/src/games/space-fighter/SpaceFighterConstants.d.ts +71 -0
  212. package/lib/typescript/src/games/space-fighter/SpaceFighterConstants.d.ts.map +1 -0
  213. package/lib/typescript/src/games/{space-traveller/SpaceTravellerService.d.ts → space-fighter/SpaceFighterService.d.ts} +7 -4
  214. package/lib/typescript/src/games/space-fighter/SpaceFighterService.d.ts.map +1 -0
  215. package/lib/typescript/src/games/{space-traveller/SpaceTravellerStore.d.ts → space-fighter/SpaceFighterStore.d.ts} +12 -4
  216. package/lib/typescript/src/games/space-fighter/SpaceFighterStore.d.ts.map +1 -0
  217. package/lib/typescript/src/games/space-fighter/components/AsteroidComponent.d.ts +8 -0
  218. package/lib/typescript/src/games/space-fighter/components/AsteroidComponent.d.ts.map +1 -0
  219. package/lib/typescript/src/games/space-fighter/components/GameArea.d.ts +3 -0
  220. package/lib/typescript/src/games/space-fighter/components/GameArea.d.ts.map +1 -0
  221. package/lib/typescript/src/games/space-fighter/components/GameBackground.d.ts.map +1 -0
  222. package/lib/typescript/src/games/space-fighter/components/ScoreBoard.d.ts +3 -0
  223. package/lib/typescript/src/games/space-fighter/components/ScoreBoard.d.ts.map +1 -0
  224. package/lib/typescript/src/games/{space-traveller → space-fighter}/components/Spacecraft3D.d.ts +1 -1
  225. package/lib/typescript/src/games/space-fighter/components/Spacecraft3D.d.ts.map +1 -0
  226. package/lib/typescript/src/games/space-fighter/components/SpacecraftPath.d.ts.map +1 -0
  227. package/lib/typescript/src/games/{space-traveller → space-fighter}/components/index.d.ts +0 -4
  228. package/lib/typescript/src/games/space-fighter/components/index.d.ts.map +1 -0
  229. package/lib/typescript/src/games/whack-a-mole/WhackAMole.d.ts +4 -0
  230. package/lib/typescript/src/games/whack-a-mole/WhackAMole.d.ts.map +1 -0
  231. package/lib/typescript/src/games/whack-a-mole/WhackAMoleConstants.d.ts +79 -0
  232. package/lib/typescript/src/games/whack-a-mole/WhackAMoleConstants.d.ts.map +1 -0
  233. package/lib/typescript/src/games/whack-a-mole/WhackAMoleService.d.ts +33 -0
  234. package/lib/typescript/src/games/whack-a-mole/WhackAMoleService.d.ts.map +1 -0
  235. package/lib/typescript/src/games/whack-a-mole/WhackAMoleStore.d.ts +41 -0
  236. package/lib/typescript/src/games/whack-a-mole/WhackAMoleStore.d.ts.map +1 -0
  237. package/lib/typescript/src/games/whack-a-mole/components/GameBackground.d.ts.map +1 -0
  238. package/lib/typescript/src/games/{cat-popper → whack-a-mole}/components/GameGrid.d.ts +2 -2
  239. package/lib/typescript/src/games/whack-a-mole/components/GameGrid.d.ts.map +1 -0
  240. package/lib/typescript/src/games/{cat-popper → whack-a-mole}/components/GameHole.d.ts +3 -2
  241. package/lib/typescript/src/games/whack-a-mole/components/GameHole.d.ts.map +1 -0
  242. package/lib/typescript/src/games/whack-a-mole/components/MoleCharacter.d.ts +7 -0
  243. package/lib/typescript/src/games/whack-a-mole/components/MoleCharacter.d.ts.map +1 -0
  244. package/lib/typescript/src/games/whack-a-mole/components/ScoreBoard.d.ts.map +1 -0
  245. package/lib/typescript/src/games/whack-a-mole/components/index.d.ts +6 -0
  246. package/lib/typescript/src/games/whack-a-mole/components/index.d.ts.map +1 -0
  247. package/lib/typescript/src/index.d.ts +4 -3
  248. package/lib/typescript/src/index.d.ts.map +1 -1
  249. package/lib/typescript/src/services/GamesConstants.d.ts +61 -340
  250. package/lib/typescript/src/services/GamesConstants.d.ts.map +1 -1
  251. package/lib/typescript/src/services/GamesService.d.ts +21 -3
  252. package/lib/typescript/src/services/GamesService.d.ts.map +1 -1
  253. package/lib/typescript/src/services/HapticsService.d.ts +16 -0
  254. package/lib/typescript/src/services/HapticsService.d.ts.map +1 -0
  255. package/lib/typescript/src/services/SoundsService.d.ts +154 -0
  256. package/lib/typescript/src/services/SoundsService.d.ts.map +1 -0
  257. package/lib/typescript/src/shared/helpers/AnimationFrame.d.ts +41 -0
  258. package/lib/typescript/src/shared/helpers/AnimationFrame.d.ts.map +1 -0
  259. package/lib/typescript/src/shared/helpers/AnimationTracker.d.ts +45 -0
  260. package/lib/typescript/src/shared/helpers/AnimationTracker.d.ts.map +1 -0
  261. package/lib/typescript/src/shared/helpers/ErrorHandler.d.ts +124 -0
  262. package/lib/typescript/src/shared/helpers/ErrorHandler.d.ts.map +1 -0
  263. package/lib/typescript/src/shared/helpers/GameControlButton.d.ts +17 -0
  264. package/lib/typescript/src/shared/helpers/GameControlButton.d.ts.map +1 -0
  265. package/lib/typescript/src/{games/cat-popper/components → shared/helpers}/GameOverModal.d.ts +5 -0
  266. package/lib/typescript/src/shared/helpers/GameOverModal.d.ts.map +1 -0
  267. package/lib/typescript/src/shared/helpers/GameSettingsModal.d.ts +9 -0
  268. package/lib/typescript/src/shared/helpers/GameSettingsModal.d.ts.map +1 -0
  269. package/lib/typescript/src/shared/helpers/ParticleBlast.d.ts +12 -0
  270. package/lib/typescript/src/shared/helpers/ParticleBlast.d.ts.map +1 -0
  271. package/lib/typescript/src/shared/helpers/ResponsiveScoreBoard.d.ts +42 -0
  272. package/lib/typescript/src/shared/helpers/ResponsiveScoreBoard.d.ts.map +1 -0
  273. package/lib/typescript/src/shared/helpers/index.d.ts +13 -0
  274. package/lib/typescript/src/shared/helpers/index.d.ts.map +1 -0
  275. package/package.json +9 -6
  276. package/lib/module/games/balloon-blaster/components/GameControls.js +0 -229
  277. package/lib/module/games/balloon-blaster/components/GameControls.js.map +0 -1
  278. package/lib/module/games/balloon-blaster/components/GameOverModal.js.map +0 -1
  279. package/lib/module/games/balloon-blaster/components/ParticleSystem.js +0 -52
  280. package/lib/module/games/balloon-blaster/components/ParticleSystem.js.map +0 -1
  281. package/lib/module/games/balloon-blaster/components/SliceTrail.js +0 -58
  282. package/lib/module/games/balloon-blaster/components/SliceTrail.js.map +0 -1
  283. package/lib/module/games/cat-popper/CatPopper.js +0 -230
  284. package/lib/module/games/cat-popper/CatPopper.js.map +0 -1
  285. package/lib/module/games/cat-popper/CatPopperService.js +0 -100
  286. package/lib/module/games/cat-popper/CatPopperService.js.map +0 -1
  287. package/lib/module/games/cat-popper/CatPopperStore.js +0 -113
  288. package/lib/module/games/cat-popper/CatPopperStore.js.map +0 -1
  289. package/lib/module/games/cat-popper/components/CatCharacter.js.map +0 -1
  290. package/lib/module/games/cat-popper/components/GameBackground.js.map +0 -1
  291. package/lib/module/games/cat-popper/components/GameControls.js +0 -230
  292. package/lib/module/games/cat-popper/components/GameControls.js.map +0 -1
  293. package/lib/module/games/cat-popper/components/GameGrid.js +0 -66
  294. package/lib/module/games/cat-popper/components/GameGrid.js.map +0 -1
  295. package/lib/module/games/cat-popper/components/GameHole.js.map +0 -1
  296. package/lib/module/games/cat-popper/components/GameOverModal.js +0 -131
  297. package/lib/module/games/cat-popper/components/GameOverModal.js.map +0 -1
  298. package/lib/module/games/cat-popper/components/ScoreBoard.js.map +0 -1
  299. package/lib/module/games/cat-popper/components/index.js.map +0 -1
  300. package/lib/module/games/fruit-slicer/FruitSlicer.js +0 -411
  301. package/lib/module/games/fruit-slicer/FruitSlicer.js.map +0 -1
  302. package/lib/module/games/fruit-slicer/FruitSlicerService.js.map +0 -1
  303. package/lib/module/games/fruit-slicer/FruitSlicerStore.js +0 -156
  304. package/lib/module/games/fruit-slicer/FruitSlicerStore.js.map +0 -1
  305. package/lib/module/games/fruit-slicer/components/FruitComponent.js.map +0 -1
  306. package/lib/module/games/fruit-slicer/components/GameArea.js +0 -50
  307. package/lib/module/games/fruit-slicer/components/GameArea.js.map +0 -1
  308. package/lib/module/games/fruit-slicer/components/GameBackground.js.map +0 -1
  309. package/lib/module/games/fruit-slicer/components/GameControls.js +0 -230
  310. package/lib/module/games/fruit-slicer/components/GameControls.js.map +0 -1
  311. package/lib/module/games/fruit-slicer/components/GameOverModal.js +0 -189
  312. package/lib/module/games/fruit-slicer/components/GameOverModal.js.map +0 -1
  313. package/lib/module/games/fruit-slicer/components/ParticleSystem.js +0 -52
  314. package/lib/module/games/fruit-slicer/components/ParticleSystem.js.map +0 -1
  315. package/lib/module/games/fruit-slicer/components/ScoreBoard.js.map +0 -1
  316. package/lib/module/games/fruit-slicer/components/SliceTrail.js +0 -58
  317. package/lib/module/games/fruit-slicer/components/SliceTrail.js.map +0 -1
  318. package/lib/module/games/fruit-slicer/components/index.js +0 -11
  319. package/lib/module/games/fruit-slicer/components/index.js.map +0 -1
  320. package/lib/module/games/maze-runner/components/GameControls.js +0 -129
  321. package/lib/module/games/maze-runner/components/GameControls.js.map +0 -1
  322. package/lib/module/games/maze-runner/components/GameOverModal.js +0 -134
  323. package/lib/module/games/maze-runner/components/GameOverModal.js.map +0 -1
  324. package/lib/module/games/space-traveller/SpaceTraveller.js +0 -393
  325. package/lib/module/games/space-traveller/SpaceTraveller.js.map +0 -1
  326. package/lib/module/games/space-traveller/SpaceTravellerService.js.map +0 -1
  327. package/lib/module/games/space-traveller/SpaceTravellerStore.js +0 -139
  328. package/lib/module/games/space-traveller/SpaceTravellerStore.js.map +0 -1
  329. package/lib/module/games/space-traveller/components/AsteroidComponent.js.map +0 -1
  330. package/lib/module/games/space-traveller/components/GameArea.js +0 -75
  331. package/lib/module/games/space-traveller/components/GameArea.js.map +0 -1
  332. package/lib/module/games/space-traveller/components/GameBackground.js.map +0 -1
  333. package/lib/module/games/space-traveller/components/GameControls.js +0 -177
  334. package/lib/module/games/space-traveller/components/GameControls.js.map +0 -1
  335. package/lib/module/games/space-traveller/components/GameOverModal.js +0 -182
  336. package/lib/module/games/space-traveller/components/GameOverModal.js.map +0 -1
  337. package/lib/module/games/space-traveller/components/ParticleComponent.js +0 -34
  338. package/lib/module/games/space-traveller/components/ParticleComponent.js.map +0 -1
  339. package/lib/module/games/space-traveller/components/ScoreBoard.js.map +0 -1
  340. package/lib/module/games/space-traveller/components/SettingsModal.js +0 -222
  341. package/lib/module/games/space-traveller/components/SettingsModal.js.map +0 -1
  342. package/lib/module/games/space-traveller/components/Spacecraft3D.js.map +0 -1
  343. package/lib/module/games/space-traveller/components/SpacecraftPath.js +0 -37
  344. package/lib/module/games/space-traveller/components/SpacecraftPath.js.map +0 -1
  345. package/lib/module/games/space-traveller/components/index.js.map +0 -1
  346. package/lib/module/shared/settings/GameSettings.js +0 -295
  347. package/lib/module/shared/settings/GameSettings.js.map +0 -1
  348. package/lib/module/shared/settings/SettingsService.js +0 -119
  349. package/lib/module/shared/settings/SettingsService.js.map +0 -1
  350. package/lib/typescript/src/games/balloon-blaster/components/GameControls.d.ts +0 -10
  351. package/lib/typescript/src/games/balloon-blaster/components/GameControls.d.ts.map +0 -1
  352. package/lib/typescript/src/games/balloon-blaster/components/GameOverModal.d.ts +0 -9
  353. package/lib/typescript/src/games/balloon-blaster/components/GameOverModal.d.ts.map +0 -1
  354. package/lib/typescript/src/games/balloon-blaster/components/ParticleSystem.d.ts +0 -8
  355. package/lib/typescript/src/games/balloon-blaster/components/ParticleSystem.d.ts.map +0 -1
  356. package/lib/typescript/src/games/balloon-blaster/components/SliceTrail.d.ts +0 -11
  357. package/lib/typescript/src/games/balloon-blaster/components/SliceTrail.d.ts.map +0 -1
  358. package/lib/typescript/src/games/cat-popper/CatPopper.d.ts +0 -13
  359. package/lib/typescript/src/games/cat-popper/CatPopper.d.ts.map +0 -1
  360. package/lib/typescript/src/games/cat-popper/CatPopperService.d.ts +0 -32
  361. package/lib/typescript/src/games/cat-popper/CatPopperService.d.ts.map +0 -1
  362. package/lib/typescript/src/games/cat-popper/CatPopperStore.d.ts +0 -21
  363. package/lib/typescript/src/games/cat-popper/CatPopperStore.d.ts.map +0 -1
  364. package/lib/typescript/src/games/cat-popper/components/CatCharacter.d.ts +0 -7
  365. package/lib/typescript/src/games/cat-popper/components/CatCharacter.d.ts.map +0 -1
  366. package/lib/typescript/src/games/cat-popper/components/GameBackground.d.ts.map +0 -1
  367. package/lib/typescript/src/games/cat-popper/components/GameControls.d.ts +0 -10
  368. package/lib/typescript/src/games/cat-popper/components/GameControls.d.ts.map +0 -1
  369. package/lib/typescript/src/games/cat-popper/components/GameGrid.d.ts.map +0 -1
  370. package/lib/typescript/src/games/cat-popper/components/GameHole.d.ts.map +0 -1
  371. package/lib/typescript/src/games/cat-popper/components/GameOverModal.d.ts.map +0 -1
  372. package/lib/typescript/src/games/cat-popper/components/ScoreBoard.d.ts.map +0 -1
  373. package/lib/typescript/src/games/cat-popper/components/index.d.ts +0 -8
  374. package/lib/typescript/src/games/cat-popper/components/index.d.ts.map +0 -1
  375. package/lib/typescript/src/games/fruit-slicer/FruitSlicer.d.ts +0 -16
  376. package/lib/typescript/src/games/fruit-slicer/FruitSlicer.d.ts.map +0 -1
  377. package/lib/typescript/src/games/fruit-slicer/FruitSlicerService.d.ts.map +0 -1
  378. package/lib/typescript/src/games/fruit-slicer/FruitSlicerStore.d.ts.map +0 -1
  379. package/lib/typescript/src/games/fruit-slicer/components/FruitComponent.d.ts.map +0 -1
  380. package/lib/typescript/src/games/fruit-slicer/components/GameArea.d.ts +0 -17
  381. package/lib/typescript/src/games/fruit-slicer/components/GameArea.d.ts.map +0 -1
  382. package/lib/typescript/src/games/fruit-slicer/components/GameBackground.d.ts.map +0 -1
  383. package/lib/typescript/src/games/fruit-slicer/components/GameControls.d.ts +0 -10
  384. package/lib/typescript/src/games/fruit-slicer/components/GameControls.d.ts.map +0 -1
  385. package/lib/typescript/src/games/fruit-slicer/components/GameOverModal.d.ts +0 -9
  386. package/lib/typescript/src/games/fruit-slicer/components/GameOverModal.d.ts.map +0 -1
  387. package/lib/typescript/src/games/fruit-slicer/components/ParticleSystem.d.ts +0 -8
  388. package/lib/typescript/src/games/fruit-slicer/components/ParticleSystem.d.ts.map +0 -1
  389. package/lib/typescript/src/games/fruit-slicer/components/ScoreBoard.d.ts +0 -9
  390. package/lib/typescript/src/games/fruit-slicer/components/ScoreBoard.d.ts.map +0 -1
  391. package/lib/typescript/src/games/fruit-slicer/components/SliceTrail.d.ts +0 -11
  392. package/lib/typescript/src/games/fruit-slicer/components/SliceTrail.d.ts.map +0 -1
  393. package/lib/typescript/src/games/fruit-slicer/components/index.d.ts +0 -9
  394. package/lib/typescript/src/games/fruit-slicer/components/index.d.ts.map +0 -1
  395. package/lib/typescript/src/games/maze-runner/components/GameControls.d.ts +0 -10
  396. package/lib/typescript/src/games/maze-runner/components/GameControls.d.ts.map +0 -1
  397. package/lib/typescript/src/games/maze-runner/components/GameOverModal.d.ts +0 -11
  398. package/lib/typescript/src/games/maze-runner/components/GameOverModal.d.ts.map +0 -1
  399. package/lib/typescript/src/games/space-traveller/SpaceTraveller.d.ts +0 -17
  400. package/lib/typescript/src/games/space-traveller/SpaceTraveller.d.ts.map +0 -1
  401. package/lib/typescript/src/games/space-traveller/SpaceTravellerService.d.ts.map +0 -1
  402. package/lib/typescript/src/games/space-traveller/SpaceTravellerStore.d.ts.map +0 -1
  403. package/lib/typescript/src/games/space-traveller/components/AsteroidComponent.d.ts +0 -9
  404. package/lib/typescript/src/games/space-traveller/components/AsteroidComponent.d.ts.map +0 -1
  405. package/lib/typescript/src/games/space-traveller/components/GameArea.d.ts +0 -17
  406. package/lib/typescript/src/games/space-traveller/components/GameArea.d.ts.map +0 -1
  407. package/lib/typescript/src/games/space-traveller/components/GameBackground.d.ts.map +0 -1
  408. package/lib/typescript/src/games/space-traveller/components/GameControls.d.ts +0 -10
  409. package/lib/typescript/src/games/space-traveller/components/GameControls.d.ts.map +0 -1
  410. package/lib/typescript/src/games/space-traveller/components/GameOverModal.d.ts +0 -9
  411. package/lib/typescript/src/games/space-traveller/components/GameOverModal.d.ts.map +0 -1
  412. package/lib/typescript/src/games/space-traveller/components/ParticleComponent.d.ts +0 -8
  413. package/lib/typescript/src/games/space-traveller/components/ParticleComponent.d.ts.map +0 -1
  414. package/lib/typescript/src/games/space-traveller/components/ScoreBoard.d.ts +0 -8
  415. package/lib/typescript/src/games/space-traveller/components/ScoreBoard.d.ts.map +0 -1
  416. package/lib/typescript/src/games/space-traveller/components/SettingsModal.d.ts +0 -9
  417. package/lib/typescript/src/games/space-traveller/components/SettingsModal.d.ts.map +0 -1
  418. package/lib/typescript/src/games/space-traveller/components/Spacecraft3D.d.ts.map +0 -1
  419. package/lib/typescript/src/games/space-traveller/components/SpacecraftPath.d.ts.map +0 -1
  420. package/lib/typescript/src/games/space-traveller/components/index.d.ts.map +0 -1
  421. package/lib/typescript/src/shared/settings/GameSettings.d.ts +0 -36
  422. package/lib/typescript/src/shared/settings/GameSettings.d.ts.map +0 -1
  423. package/lib/typescript/src/shared/settings/SettingsService.d.ts +0 -32
  424. package/lib/typescript/src/shared/settings/SettingsService.d.ts.map +0 -1
  425. /package/lib/typescript/src/games/{cat-popper → fruit-ninja}/components/GameBackground.d.ts +0 -0
  426. /package/lib/typescript/src/games/{fruit-slicer → space-fighter}/components/GameBackground.d.ts +0 -0
  427. /package/lib/typescript/src/games/{space-traveller → space-fighter}/components/SpacecraftPath.d.ts +0 -0
  428. /package/lib/typescript/src/games/{space-traveller → whack-a-mole}/components/GameBackground.d.ts +0 -0
  429. /package/lib/typescript/src/games/{cat-popper → whack-a-mole}/components/ScoreBoard.d.ts +0 -0
@@ -0,0 +1,143 @@
1
+ "use strict";
2
+
3
+ import React, { useEffect, useRef } from 'react';
4
+ import { View, StyleSheet } from 'react-native';
5
+ import { GestureHandlerRootView } from 'react-native-gesture-handler';
6
+ import { useFruitNinjaStore, registerGameService } from "./FruitNinjaStore.js";
7
+ import { createFruitNinjaService, getDifficultySpawnInterval } from "./FruitNinjaService.js";
8
+ import { ScoreBoard, GameArea, GameBackground } from "./components/index.js";
9
+ import { GameControlButton, GameOverModal, useAnimationTrackers, useGameErrorHandler, GameErrorType } from "../../shared/helpers/index.js";
10
+ import { GameSettingsModal } from "../../shared/helpers/index.js";
11
+ import { GAME_IDS } from "../../services/GamesService.js";
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ export const FruitNinja = ({
14
+ settings,
15
+ onSettingsChange
16
+ }) => {
17
+ // Read UI-critical state independently to minimize re-renders
18
+ const isPlaying = useFruitNinjaStore(state => state.isPlaying);
19
+ const gameOver = useFruitNinjaStore(state => state.gameOver);
20
+ const score = useFruitNinjaStore(state => state.score);
21
+
22
+ // Get store actions independently (these don't cause re-renders)
23
+ const startGame = useFruitNinjaStore(state => state.startGame);
24
+ const stopGame = useFruitNinjaStore(state => state.stopGame);
25
+ const resetGame = useFruitNinjaStore(state => state.resetGame);
26
+ const decrementTime = useFruitNinjaStore(state => state.decrementTime);
27
+ const addFruit = useFruitNinjaStore(state => state.addFruit);
28
+ const removeFruit = useFruitNinjaStore(state => state.removeFruit);
29
+ const updateFruit = useFruitNinjaStore(state => state.updateFruit);
30
+ const loseLife = useFruitNinjaStore(state => state.loseLife);
31
+
32
+ // Use shared animation tracking utility
33
+ const {
34
+ fruitAnimations,
35
+ particleAnimations
36
+ } = useAnimationTrackers(['fruitAnimations', 'particleAnimations']);
37
+
38
+ // Error handling for the game
39
+ const {
40
+ wrapFunction,
41
+ safeExecute
42
+ } = useGameErrorHandler(GAME_IDS.FRUIT_NINJA);
43
+
44
+ // Game service for main game control only with error handling
45
+ const gameService = useRef(safeExecute(() => createFruitNinjaService(fruitAnimations, particleAnimations), createFruitNinjaService(fruitAnimations, particleAnimations),
46
+ // Fallback to direct creation
47
+ GameErrorType.INITIALIZATION_ERROR)).current;
48
+
49
+ // Register game service with store for automatic cleanup
50
+ useEffect(() => {
51
+ registerGameService(gameService);
52
+ return () => {
53
+ handleResetGame();
54
+ };
55
+ }, [gameService]);
56
+
57
+ // Game control functions with error handling
58
+ const handleStartGame = wrapFunction(() => {
59
+ startGame(); // Store uses fixed 60s duration internally
60
+ if (gameService) {
61
+ gameService.resetAnimations();
62
+ gameService.startGameTimer(decrementTime);
63
+ gameService.startFruitSpawning(spawnFruit, getDifficultySpawnInterval(settings.difficulty));
64
+ gameService.startPhysicsLoop(updateFruit, removeFruit, () => useFruitNinjaStore.getState().fruits, loseLife);
65
+ }
66
+ }, GameErrorType.INITIALIZATION_ERROR);
67
+ const handleStopGame = wrapFunction(() => {
68
+ stopGame();
69
+ if (gameService) {
70
+ gameService.cleanup();
71
+ gameService.resetAnimations();
72
+ }
73
+ }, GameErrorType.UNKNOWN_ERROR);
74
+ const handleResetGame = wrapFunction(() => {
75
+ if (gameService) {
76
+ gameService.cleanup();
77
+ }
78
+ resetGame();
79
+ if (gameService) {
80
+ gameService.resetAnimations();
81
+ }
82
+ }, GameErrorType.UNKNOWN_ERROR);
83
+
84
+ // Fruit spawning
85
+ const spawnFruit = fruit => {
86
+ addFruit(fruit);
87
+ };
88
+ return /*#__PURE__*/_jsx(GestureHandlerRootView, {
89
+ style: {
90
+ flex: 1
91
+ },
92
+ children: /*#__PURE__*/_jsx(View, {
93
+ style: styles.container,
94
+ children: /*#__PURE__*/_jsxs(GameBackground, {
95
+ children: [/*#__PURE__*/_jsx(GameArea, {}), /*#__PURE__*/_jsx(View, {
96
+ style: styles.scoreboardContainer,
97
+ children: /*#__PURE__*/_jsx(ScoreBoard, {})
98
+ }), /*#__PURE__*/_jsx(GameControlButton, {
99
+ isPlaying: isPlaying,
100
+ gameOver: gameOver,
101
+ onStartGame: handleStartGame,
102
+ onStopGame: handleStopGame,
103
+ startButtonText: "START SLICING",
104
+ stopButtonText: "STOP GAME",
105
+ startButtonSubtext: "Slice fruits to score!",
106
+ stopButtonSubtext: "End current game",
107
+ startButtonColor: "#10b981",
108
+ stopButtonColor: "#dc2626",
109
+ startButtonBorderColor: "#34d399",
110
+ stopButtonBorderColor: "#f87171"
111
+ }), /*#__PURE__*/_jsx(GameOverModal, {
112
+ isVisible: gameOver,
113
+ score: score,
114
+ onPlayAgain: handleResetGame,
115
+ buttonText: "Slice Again!",
116
+ primaryColor: "rgba(34, 139, 34, 0.8)" // Green theme for Fruit Ninja
117
+ ,
118
+ borderColor: "rgba(34, 139, 34, 0.9)",
119
+ buttonColor: "#10b981",
120
+ buttonBorderColor: "#34d399"
121
+ }), /*#__PURE__*/_jsx(GameSettingsModal, {
122
+ gameId: GAME_IDS.FRUIT_NINJA,
123
+ settings: settings,
124
+ onSettingsChange: onSettingsChange
125
+ })]
126
+ })
127
+ })
128
+ });
129
+ };
130
+ const styles = StyleSheet.create({
131
+ container: {
132
+ flex: 1
133
+ },
134
+ scoreboardContainer: {
135
+ position: 'absolute',
136
+ top: 0,
137
+ left: 20,
138
+ right: 20,
139
+ zIndex: 100,
140
+ pointerEvents: 'none' // Allow touches to pass through to fruits below
141
+ }
142
+ });
143
+ //# sourceMappingURL=FruitNinja.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useEffect","useRef","View","StyleSheet","GestureHandlerRootView","useFruitNinjaStore","registerGameService","createFruitNinjaService","getDifficultySpawnInterval","ScoreBoard","GameArea","GameBackground","GameControlButton","GameOverModal","useAnimationTrackers","useGameErrorHandler","GameErrorType","GameSettingsModal","GAME_IDS","jsx","_jsx","jsxs","_jsxs","FruitNinja","settings","onSettingsChange","isPlaying","state","gameOver","score","startGame","stopGame","resetGame","decrementTime","addFruit","removeFruit","updateFruit","loseLife","fruitAnimations","particleAnimations","wrapFunction","safeExecute","FRUIT_NINJA","gameService","INITIALIZATION_ERROR","current","handleResetGame","handleStartGame","resetAnimations","startGameTimer","startFruitSpawning","spawnFruit","difficulty","startPhysicsLoop","getState","fruits","handleStopGame","cleanup","UNKNOWN_ERROR","fruit","style","flex","children","styles","container","scoreboardContainer","onStartGame","onStopGame","startButtonText","stopButtonText","startButtonSubtext","stopButtonSubtext","startButtonColor","stopButtonColor","startButtonBorderColor","stopButtonBorderColor","isVisible","onPlayAgain","buttonText","primaryColor","borderColor","buttonColor","buttonBorderColor","gameId","create","position","top","left","right","zIndex","pointerEvents"],"sourceRoot":"../../../../src","sources":["games/fruit-ninja/FruitNinja.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAChD,SAASC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AAC/C,SAASC,sBAAsB,QAAQ,8BAA8B;AACrE,SAASC,kBAAkB,EAAEC,mBAAmB,QAAQ,sBAAmB;AAC3E,SAASC,uBAAuB,EAAEC,0BAA0B,QAAQ,wBAAqB;AACzF,SAASC,UAA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FvD,IAAA,CAACP,aAAa;UACZ+D,SAAS,EAAEhD,QAAS;UACpBC,KAAK,EAAEA,KAAM;UACbgD,WAAW,EAAE/B,eAAgB;UAC7BgC,UAAU,EAAC,cAAc;UACzBC,YAAY,EAAC,wBAAwB,CAAC;UAAA;UACtCC,WAAW,EAAC,wBAAwB;UACpCC,WAAW,EAAC,SAAS;UACrBC,iBAAiB,EAAC;QAAS,CAC5B,CAAC,eAGF9D,IAAA,CAACH,iBAAiB;UAChBkE,MAAM,EAAEjE,QAAQ,CAACwB,WAAY;UAC7BlB,QAAQ,EAAEA,QAAS;UACnBC,gBAAgB,EAAEA;QAAiB,CACpC,CAAC;MAAA,CACc;IAAC,CACb;EAAC,CACe,CAAC;AAE7B,CAAC;AAED,MAAMsC,MAAM,GAAG5D,UAAU,CAACiF,MAAM,CAAC;EAC/BpB,SAAS,EAAE;IACTH,IAAI,EAAE;EACR,CAAC;EACDI,mBAAmB,EAAE;IACnBoB,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,CAAC;IACNC,IAAI,EAAE,EAAE;IACRC,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,GAAG;IACXC,aAAa,EAAE,MAAM,CAAE;EACzB;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+
3
+ // Fruit Ninja Game Constants
4
+ export const FRUIT_NINJA_GAME_CONFIG = {
5
+ GAME_DURATION: 60,
6
+ // seconds
7
+ MAX_LIVES: 3,
8
+ FRUIT_SPAWN_INTERVAL: 1500,
9
+ // ms - even slower spawning for better gameplay
10
+ FRUIT_FALL_SPEED: 2,
11
+ // pixels per frame
12
+ GRAVITY: 0.12,
13
+ // acceleration - further reduced for even slower movement
14
+ INITIAL_VELOCITY_Y: -10,
15
+ // upward velocity - further reduced for slower, more manageable arc
16
+ INITIAL_VELOCITY_X_RANGE: 1.5,
17
+ // horizontal velocity range - further reduced for slower horizontal movement
18
+ FRUIT_SIZE: 60,
19
+ SLICE_TRAIL_LENGTH: 10,
20
+ SLICE_TRAIL_WIDTH: 8,
21
+ COMBO_TIMEOUT: 2000,
22
+ // ms
23
+ PARTICLE_COUNT: 6,
24
+ PARTICLE_LIFETIME: 1000 // ms
25
+ };
26
+ export const FRUIT_NINJA_ANIMATION_CONFIG = {
27
+ FRUIT_SPRING: {
28
+ damping: 15,
29
+ stiffness: 200
30
+ },
31
+ SLICE_SPRING: {
32
+ damping: 20,
33
+ stiffness: 300
34
+ },
35
+ PARTICLE_SPRING: {
36
+ damping: 25,
37
+ stiffness: 400
38
+ }
39
+ };
40
+ export const FRUIT_NINJA_COLORS = {
41
+ BACKGROUND: '#87CEEB',
42
+ // Sky blue
43
+ SCORE_BOARD: '#4169E1',
44
+ SLICE_TRAIL: '#FFD700',
45
+ PARTICLE_COLORS: ['#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#FFEAA7', '#DDA0DD'],
46
+ PARTICLE_GLOW: 'rgba(255,255,255,0.9)',
47
+ COMBO_TEXT: '#FF4757',
48
+ LIVES_COLOR: '#FF6B6B',
49
+ SCORE: '#FFFFFF',
50
+ UI: '#FF6347',
51
+ BUTTON_ACTIVE: '#FF7F50',
52
+ BUTTON_INACTIVE: '#FFA07A',
53
+ TEXT_PRIMARY: '#FFFFFF',
54
+ TEXT_SECONDARY: '#F0F8FF',
55
+ WHITE: '#FFFFFF',
56
+ START_BUTTON: '#4CAF50',
57
+ GAME_OVER_OVERLAY: 'rgba(0, 0, 0, 0.85)'
58
+ };
59
+
60
+ // Fruit types and their properties
61
+ export const FRUIT_TYPES = [{
62
+ emoji: '🍎',
63
+ points: 10,
64
+ name: 'apple'
65
+ }, {
66
+ emoji: '🍊',
67
+ points: 10,
68
+ name: 'orange'
69
+ }, {
70
+ emoji: '🍌',
71
+ points: 15,
72
+ name: 'banana'
73
+ }, {
74
+ emoji: '🍇',
75
+ points: 20,
76
+ name: 'grapes'
77
+ }, {
78
+ emoji: '🥝',
79
+ points: 25,
80
+ name: 'kiwi'
81
+ }, {
82
+ emoji: '🍓',
83
+ points: 15,
84
+ name: 'strawberry'
85
+ }, {
86
+ emoji: '🥭',
87
+ points: 30,
88
+ name: 'mango'
89
+ }, {
90
+ emoji: '🍑',
91
+ points: 25,
92
+ name: 'cherry'
93
+ }, {
94
+ emoji: '🍒',
95
+ points: 35,
96
+ name: 'cherries'
97
+ }, {
98
+ emoji: '🥥',
99
+ points: 40,
100
+ name: 'coconut'
101
+ }];
102
+ export const FRUIT_SPECIAL_ITEMS = [{
103
+ emoji: '💣',
104
+ points: -50,
105
+ name: 'bomb',
106
+ isBomb: true
107
+ }, {
108
+ emoji: '⭐',
109
+ points: 50,
110
+ name: 'star',
111
+ isBonus: true
112
+ }, {
113
+ emoji: '❄️',
114
+ points: 0,
115
+ name: 'freeze',
116
+ isFreeze: true
117
+ }];
118
+
119
+ // Fruit Ninja Game Theme - Matches scoreboard forest green
120
+ export const FRUIT_NINJA_THEME = {
121
+ backgroundColor: '#87CEEB',
122
+ // Sky blue background
123
+ headerBackgroundColor: 'rgba(34, 139, 34, 0.9)',
124
+ // Forest green header to match scoreboard
125
+ headerTextColor: '#ffffff',
126
+ sectionBackgroundColor: 'rgba(34, 139, 34, 0.3)',
127
+ // Match scoreboard transparency
128
+ sectionTitleColor: '#ffffff',
129
+ // White text on green sections
130
+ buttonSelectedColor: '#166534',
131
+ // Darker green for better contrast
132
+ buttonUnselectedColor: 'rgba(255, 255, 255, 0.3)',
133
+ buttonSelectedTextColor: '#ffffff',
134
+ buttonUnselectedTextColor: '#1f2937',
135
+ switchTrackColorFalse: 'rgba(34, 139, 34, 0.5)',
136
+ switchTrackColorTrue: '#166534',
137
+ // Darker green for better contrast
138
+ switchThumbColor: '#ffffff',
139
+ infoTextColor: '#1f2937' // Dark text for readability
140
+ };
141
+
142
+ // Fruit Ninja Difficulty Descriptions
143
+ export const FRUIT_NINJA_DIFFICULTY_DESCRIPTIONS = {
144
+ easy: 'Fruits spawn slower, more forgiving',
145
+ medium: 'Balanced gameplay and fruit speed',
146
+ hard: 'Fast fruits, quick reflexes needed!'
147
+ };
148
+ //# sourceMappingURL=FruitNinjaConstants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["FRUIT_NINJA_GAME_CONFIG","GAME_DURATION","MAX_LIVES","FRUIT_SPAWN_INTERVAL","FRUIT_FALL_SPEED","GRAVITY","INITIAL_VELOCITY_Y","INITIAL_VELOCITY_X_RANGE","FRUIT_SIZE","SLICE_TRAIL_LENGTH","SLICE_TRAIL_WIDTH","COMBO_TIMEOUT","PARTICLE_COUNT","PARTICLE_LIFETIME","FRUIT_NINJA_ANIMATION_CONFIG","FRUIT_SPRING","damping","stiffness","SLICE_SPRING","PARTICLE_SPRING","FRUIT_NINJA_COLORS","BACKGROUND","SCORE_BOARD","SLICE_TRAIL","PARTICLE_COLORS","PARTICLE_GLOW","COMBO_TEXT","LIVES_COLOR","SCORE","UI","BUTTON_ACTIVE","BUTTON_INACTIVE","TEXT_PRIMARY","TEXT_SECONDARY","WHITE","START_BUTTON","GAME_OVER_OVERLAY","FRUIT_TYPES","emoji","points","name","FRUIT_SPECIAL_ITEMS","isBomb","isBonus","isFreeze","FRUIT_NINJA_THEME","backgroundColor","headerBackgroundColor","headerTextColor","sectionBackgroundColor","sectionTitleColor","buttonSelectedColor","buttonUnselectedColor","buttonSelectedTextColor","buttonUnselectedTextColor","switchTrackColorFalse","switchTrackColorTrue","switchThumbColor","infoTextColor","FRUIT_NINJA_DIFFICULTY_DESCRIPTIONS","easy","medium","hard"],"sourceRoot":"../../../../src","sources":["games/fruit-ninja/FruitNinjaConstants.ts"],"mappings":";;AAEA;AACA,OAAO,MAAMA,uBAAuB,GAAG;EACrCC,aAAa,EAAE,EAAE;EAAE;EACnBC,SAAS,EAAE,CAAC;EACZC,oBAAoB,EAAE,IAAI;EAAE;EAC5BC,gBAAgB,EAAE,CAAC;EAAE;EACrBC,OAAO,EAAE,IAAI;EAAE;EACfC,kBAAkB,EAAE,CAAC,EAAE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C1BC,sBAAsB,EAAE,wBAAwB;EAAE;EAClDC,iBAAiB,EAAE,SAAS;EAAE;EAC9BC,mBAAmB,EAAE,SAAS;EAAE;EAChCC,qBAAqB,EAAE,0BAA0B;EACjDC,uBAAuB,EAAE,SAAS;EAClCC,yBAAyB,EAAE,SAAS;EACpCC,qBAAqB,EAAE,wBAAwB;EAC/CC,oBAAoB,EAAE,SAAS;EAAE;EACjCC,gBAAgB,EAAE,SAAS;EAC3BC,aAAa,EAAE,SAAS,CAAE;AAC5B,CAAC;;AAED;AACA,OAAO,MAAMC,mCAAmC,GAAG;EACjDC,IAAI,EAAE,qCAAqC;EAC3CC,MAAM,EAAE,mCAAmC;EAC3CC,IAAI,EAAE;AACR,CAAU","ignoreList":[]}
@@ -1,19 +1,36 @@
1
1
  "use strict";
2
2
 
3
3
  import { Dimensions } from 'react-native';
4
- import { FRUIT_SLICER_GAME_CONFIG as GAME_CONFIG, FRUIT_SLICER_ANIMATION_CONFIG as ANIMATION_CONFIG, FRUIT_SLICER_COLORS as COLORS, FRUIT_TYPES, FRUIT_SPECIAL_ITEMS as SPECIAL_ITEMS } from "../../services/GamesConstants.js";
4
+ import { FRUIT_NINJA_GAME_CONFIG as GAME_CONFIG, FRUIT_NINJA_ANIMATION_CONFIG as ANIMATION_CONFIG, FRUIT_NINJA_COLORS as COLORS, FRUIT_TYPES, FRUIT_SPECIAL_ITEMS as SPECIAL_ITEMS } from "./FruitNinjaConstants.js";
5
5
  const {
6
6
  width,
7
7
  height
8
8
  } = Dimensions.get('window');
9
9
 
10
- // Constants now imported from centralized GamesConstants.ts
10
+ // Constants now imported from FruitNinjaConstants.ts
11
11
  // Re-export for backward compatibility
12
12
  export { GAME_CONFIG, ANIMATION_CONFIG, COLORS, FRUIT_TYPES, SPECIAL_ITEMS };
13
13
 
14
14
  // Types
15
15
 
16
- export class FruitSlicerService {
16
+ // Define game-specific types and constants locally
17
+
18
+ export const DEFAULT_FRUIT_NINJA_SETTINGS = {
19
+ gameDuration: 60,
20
+ // Fixed 60 seconds for all games
21
+ difficulty: 'medium',
22
+ soundEnabled: true,
23
+ hapticEnabled: true
24
+ };
25
+ export const getDifficultySpawnInterval = difficulty => {
26
+ const intervals = {
27
+ easy: 2000,
28
+ medium: 1500,
29
+ hard: 1000
30
+ };
31
+ return intervals[difficulty];
32
+ };
33
+ export class FruitNinjaService {
17
34
  gameTimerRef = null;
18
35
  fruitSpawnRef = null;
19
36
  animationRef = null;
@@ -40,7 +57,7 @@ export class FruitSlicerService {
40
57
  };
41
58
  this.fruitSpawnRef = setTimeout(spawnLoop, 1000);
42
59
  }
43
- startPhysicsLoop(updateFruit, removeFruit, getFruits) {
60
+ startPhysicsLoop(updateFruit, removeFruit, getFruits, loseLife) {
44
61
  const updateLoop = () => {
45
62
  const fruits = getFruits();
46
63
  fruits.forEach(fruit => {
@@ -58,6 +75,11 @@ export class FruitSlicerService {
58
75
 
59
76
  // Remove fruits that fall off screen (bottom only)
60
77
  if (newY > height + 100) {
78
+ // Fruit fell off screen without being sliced
79
+ if (!fruit.isBomb && !fruit.isBonus && !fruit.isFreeze) {
80
+ // Only lose life for regular fruits
81
+ loseLife();
82
+ }
61
83
  removeFruit(fruit.id);
62
84
  return;
63
85
  }
@@ -113,16 +135,16 @@ export class FruitSlicerService {
113
135
  this.animationRef = requestAnimationFrame(updateLoop);
114
136
  }
115
137
  createRandomFruit() {
116
- // 10% chance for special items
117
- const isSpecial = Math.random() < 0.1;
138
+ const isSpecial = Math.random() < 0.5;
118
139
  const type = isSpecial ? SPECIAL_ITEMS[Math.floor(Math.random() * SPECIAL_ITEMS.length)] : FRUIT_TYPES[Math.floor(Math.random() * FRUIT_TYPES.length)];
119
140
  if (!type) {
120
141
  // Fallback to default fruit type if undefined
121
142
  const defaultType = FRUIT_TYPES[0];
122
143
  const spawnX = Math.random() * (width - GAME_CONFIG.FRUIT_SIZE);
123
- const spawnY = height + 20;
144
+ const spawnY = height - 50; // Spawn slightly above bottom for higher trajectory
124
145
  const velocityX = (Math.random() - 0.5) * GAME_CONFIG.INITIAL_VELOCITY_X_RANGE;
125
- const velocityY = GAME_CONFIG.INITIAL_VELOCITY_Y + (Math.random() - 0.5) * 2;
146
+ const velocityY = GAME_CONFIG.INITIAL_VELOCITY_Y - 3; // Stronger upward velocity for higher arc
147
+
126
148
  return {
127
149
  id: `fruit_${Date.now()}_${Math.random()}`,
128
150
  type: defaultType,
@@ -138,19 +160,19 @@ export class FruitSlicerService {
138
160
  rotationSpeed: (Math.random() - 0.5) * 0.2,
139
161
  isSliced: false,
140
162
  spawnTime: Date.now(),
141
- isBomb: 'isBomb' in defaultType && Boolean(defaultType.isBomb),
142
- isBonus: 'isBonus' in defaultType && Boolean(defaultType.isBonus),
143
- isFreeze: 'isFreeze' in defaultType && Boolean(defaultType.isFreeze)
163
+ isBomb: Boolean(defaultType.isBomb),
164
+ isBonus: Boolean(defaultType.isBonus),
165
+ isFreeze: Boolean(defaultType.isFreeze)
144
166
  };
145
167
  }
146
168
 
147
- // Random spawn position (bottom of screen with some variety)
169
+ // Random spawn position (slightly above bottom for higher trajectory)
148
170
  const spawnX = Math.random() * (width - GAME_CONFIG.FRUIT_SIZE);
149
- const spawnY = height + 20; // Closer to screen for better visibility
171
+ const spawnY = height - 50; // Spawn slightly above bottom for higher arc
150
172
 
151
- // Random initial velocity with minimal variation for very predictable, slow arcs
173
+ // Random initial velocity with stronger upward force for higher trajectory
152
174
  const velocityX = (Math.random() - 0.5) * GAME_CONFIG.INITIAL_VELOCITY_X_RANGE;
153
- const velocityY = GAME_CONFIG.INITIAL_VELOCITY_Y + (Math.random() - 0.5) * 2; // Minimal velocity variation for consistent arcs
175
+ const velocityY = GAME_CONFIG.INITIAL_VELOCITY_Y - 3 + (Math.random() - 0.5) * 2; // Stronger upward velocity for higher arc
154
176
 
155
177
  return {
156
178
  id: `fruit_${Date.now()}_${Math.random()}`,
@@ -167,9 +189,9 @@ export class FruitSlicerService {
167
189
  rotationSpeed: (Math.random() - 0.5) * 0.2,
168
190
  isSliced: false,
169
191
  spawnTime: Date.now(),
170
- isBomb: 'isBomb' in type && type.isBomb,
171
- isBonus: 'isBonus' in type && type.isBonus,
172
- isFreeze: 'isFreeze' in type && type.isFreeze
192
+ isBomb: Boolean(type.isBomb),
193
+ isBonus: Boolean(type.isBonus),
194
+ isFreeze: Boolean(type.isFreeze)
173
195
  };
174
196
  }
175
197
  createSliceParticles(fruit) {
@@ -287,7 +309,7 @@ export class FruitSlicerService {
287
309
  }
288
310
  }
289
311
  }
290
- export const createFruitSlicerService = (fruitAnimations, particleAnimations) => {
291
- return new FruitSlicerService(fruitAnimations, particleAnimations);
312
+ export const createFruitNinjaService = (fruitAnimations, particleAnimations) => {
313
+ return new FruitNinjaService(fruitAnimations, particleAnimations);
292
314
  };
293
- //# sourceMappingURL=FruitSlicerService.js.map
315
+ //# sourceMappingURL=FruitNinjaService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Dimensions","FRUIT_NINJA_GAME_CONFIG","GAME_CONFIG","FRUIT_NINJA_ANIMATION_CONFIG","ANIMATION_CONFIG","FRUIT_NINJA_COLORS","COLORS","FRUIT_TYPES","FRUIT_SPECIAL_ITEMS","SPECIAL_ITEMS","width","height","get","DEFAULT_FRUIT_NINJA_SETTINGS","gameDuration","difficulty","soundEnabled","hapticEnabled","getDifficultySpawnInterval","intervals","easy","medium","hard","FruitNinjaService","gameTimerRef","fruitSpawnRef","animationRef","comboTimeoutRef","particles","constructor","fruitAnimations","particleAnimations","startGameTimer","onTick","clearGameTimer","setInterval","startFruitSpawning","spawnFruit","customSpawnInterval","clearFruitSpawn","spawnInterval","FRUIT_SPAWN_INTERVAL","spawnLoop","fruit","createRandomFruit","nextSpawnTime","Math","random","setTimeout","max","startPhysicsLoop","updateFruit","removeFruit","getFruits","loseLife","updateLoop","fruits","forEach","isSliced","newVelocityY","velocity","y","GRAVITY","newX","position","x","newY","newRotation","rotation","rotationSpeed","isBomb","isBonus","isFreeze","id","newVelocityX","adjustedVelocityY","abs","FRUIT_SIZE","updateParticles","requestAnimationFrame","isSpecial","type","floor","length","defaultType","spawnX","spawnY","velocityX","INITIAL_VELOCITY_X_RANGE","velocityY","INITIAL_VELOCITY_Y","Date","now","spawnTime","Boolean","createSliceParticles","i","PARTICLE_COUNT","angle","PI","speed","push","cos","sin","color","PARTICLE_COLORS","size","lifetime","maxLifetime","PARTICLE_LIFETIME","filter","particle","getParticles","checkFruitSlice","slicePath","fruitCenter","fruitRadius","p1","p2","distance","distanceFromPointToLine","point","lineStart","lineEnd","A","B","C","D","dot","lenSq","sqrt","param","min","xx","yy","dx","dy","resetAnimations","clear","cleanup","clearAnimationLoop","clearComboTimeout","clearInterval","clearTimeout","cancelAnimationFrame","createFruitNinjaService"],"sourceRoot":"../../../../src","sources":["games/fruit-ninja/FruitNinjaService.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;AACzC,SACEC,uBAAuB,IAAIC,WAAW,EACtCC,4BAA4B,IAAIC,gBAAgB,EAChDC,kBAAkB,IAAIC,MAAM,EAC5BC,WAAW,EACXC,mBAAmB,IAAIC,aAAa,QAC/B,0BAAuB;AAE9B,MAAM;EAAEC,KAAK;EAAEC;AAAO,CAAC,GAAGX,UAAU,CAACY,GAAG,CAAC,QAAQ,CAAC;;AAElD;AACA;AACA,SAASV,WAAW,EAAEE,gBAAgB,EAAEE,MAAM,EAAEC,WAAW,EAAEE,aAAa;;AAE1E;;AA0BA;;AAQA,OAAO,MAAMI,4BAAoD,GAAG;EAClEC,YAAY,EAAE,EAAE;EAAE;EAClBC,UAAU,EAAE,QAAQ;EACpBC,YAAY,EAAE,IAAI;EAClBC,aAAa,EAAE;AACjB,CAAC;AAED,OAAO,MAAMC,0BAA0B,GAAIH,UAAsC,IAAa;EAC5F,MAAMI,SAAS,GAAG;IAAEC,IAAI,EAAE,IAAI;IAAEC,MAAM,EAAE,IAAI;IAAEC,IAAI,EAAE;EAAK,CAAC;EAC1D,OAAOH,SAAS,CAACJ,UAAU,C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AAC2G,KAAK,CAAC,CAAC;IAC/B,IAAI,CAAC9G,SAAS,GAAG,EAAE;EACrB;EAEA+G,OAAOA,CAAA,EAAG;IACR,IAAI,CAACzG,cAAc,CAAC,CAAC;IACrB,IAAI,CAACK,eAAe,CAAC,CAAC;IACtB,IAAI,CAACqG,kBAAkB,CAAC,CAAC;IACzB,IAAI,CAACC,iBAAiB,CAAC,CAAC;IACxB,IAAI,CAACjH,SAAS,GAAG,EAAE;EACrB;EAEQM,cAAcA,CAAA,EAAG;IACvB,IAAI,IAAI,CAACV,YAAY,EAAE;MACrBsH,aAAa,CAAC,IAAI,CAACtH,YAAY,CAAC;MAChC,IAAI,CAACA,YAAY,GAAG,IAAI;IAC1B;EACF;EAEQe,eAAeA,CAAA,EAAG;IACxB,IAAI,IAAI,CAACd,aAAa,EAAE;MACtBsH,YAAY,CAAC,IAAI,CAACtH,aAAa,CAAC;MAChC,IAAI,CAACA,aAAa,GAAG,IAAI;IAC3B;EACF;EAEQmH,kBAAkBA,CAAA,EAAG;IAC3B,IAAI,IAAI,CAAClH,YAAY,EAAE;MACrBsH,oBAAoB,CAAC,IAAI,CAACtH,YAAY,CAAC;MACvC,IAAI,CAACA,YAAY,GAAG,IAAI;IAC1B;EACF;EAEQmH,iBAAiBA,CAAA,EAAG;IAC1B,IAAI,IAAI,CAAClH,eAAe,EAAE;MACxBoH,YAAY,CAAC,IAAI,CAACpH,eAAe,CAAC;MAClC,IAAI,CAACA,eAAe,GAAG,IAAI;IAC7B;EACF;AACF;AAEA,OAAO,MAAMsH,uBAAuB,GAAGA,CAACnH,eAAiC,EAAEC,kBAAoC,KAAK;EAClH,OAAO,IAAIR,iBAAiB,CAACO,eAAe,EAAEC,kBAAkB,CAAC;AACnE,CAAC","ignoreList":[]}
@@ -0,0 +1,191 @@
1
+ "use strict";
2
+
3
+ import { create } from 'zustand';
4
+ import { subscribeWithSelector } from 'zustand/middleware';
5
+ import { GAME_CONFIG } from "./FruitNinjaService.js";
6
+ import { immerMiddleware } from "../../services/GamesService.js";
7
+ // Optimized store with selective subscriptions for low-end devices
8
+ export const useFruitNinjaStore = create()(subscribeWithSelector(immerMiddleware((set, get) => ({
9
+ // Initial state
10
+ score: 0,
11
+ timeLeft: 60,
12
+ // Fixed 60 seconds regardless of difficulty
13
+ isPlaying: false,
14
+ gameOver: false,
15
+ combo: 0,
16
+ lives: GAME_CONFIG.MAX_LIVES,
17
+ fruits: [],
18
+ slicePath: [],
19
+ isSlicing: false,
20
+ // Actions
21
+ startGame: _gameDuration => {
22
+ // Always use fixed duration regardless of difficulty or passed duration
23
+ const duration = 60;
24
+ set(draft => {
25
+ draft.score = 0;
26
+ draft.timeLeft = duration;
27
+ draft.isPlaying = true;
28
+ draft.gameOver = false;
29
+ draft.combo = 0;
30
+ draft.lives = GAME_CONFIG.MAX_LIVES;
31
+ draft.fruits = [];
32
+ draft.slicePath = [];
33
+ draft.isSlicing = false;
34
+ });
35
+ },
36
+ stopGame: () => {
37
+ set(draft => {
38
+ draft.score = 0;
39
+ draft.timeLeft = 60; // Fixed 60 seconds
40
+ draft.isPlaying = false;
41
+ draft.gameOver = false;
42
+ draft.combo = 0;
43
+ draft.lives = GAME_CONFIG.MAX_LIVES;
44
+ draft.fruits = [];
45
+ draft.slicePath = [];
46
+ draft.isSlicing = false;
47
+ });
48
+ },
49
+ resetGame: () => {
50
+ set(draft => {
51
+ draft.score = 0;
52
+ draft.timeLeft = 60; // Fixed 60 seconds
53
+ draft.isPlaying = false;
54
+ draft.gameOver = false;
55
+ draft.combo = 0;
56
+ draft.lives = GAME_CONFIG.MAX_LIVES;
57
+ draft.fruits = [];
58
+ draft.slicePath = [];
59
+ draft.isSlicing = false;
60
+ });
61
+ },
62
+ sliceFruit: fruitId => {
63
+ const {
64
+ fruits,
65
+ isPlaying
66
+ } = get();
67
+ if (!isPlaying) return;
68
+
69
+ // Optimized: Use for-loop instead of find for better performance
70
+ let fruitIndex = -1;
71
+ for (let i = 0; i < fruits.length; i++) {
72
+ if (fruits[i].id === fruitId) {
73
+ fruitIndex = i;
74
+ break;
75
+ }
76
+ }
77
+ if (fruitIndex === -1 || fruits[fruitIndex].isSliced) return;
78
+
79
+ // Simplified scoring: each fruit = 10 points (no combo multipliers)
80
+ const points = 10;
81
+ set(draft => {
82
+ draft.score = draft.score + points;
83
+ // Optimized: Direct array access instead of find
84
+ if (draft.fruits[fruitIndex]) {
85
+ draft.fruits[fruitIndex].isSliced = true;
86
+ draft.fruits[fruitIndex].sliceTime = Date.now();
87
+ }
88
+ });
89
+ },
90
+ updateScore: points => {
91
+ set(draft => {
92
+ draft.score = draft.score + points;
93
+ });
94
+ },
95
+ decrementTime: () => {
96
+ set(draft => {
97
+ const newTimeLeft = draft.timeLeft - 1;
98
+ if (newTimeLeft <= 0) {
99
+ draft.timeLeft = 0;
100
+ draft.isPlaying = false;
101
+ draft.gameOver = true;
102
+ } else {
103
+ draft.timeLeft = newTimeLeft;
104
+ }
105
+ });
106
+ },
107
+ addFruit: fruit => {
108
+ set(draft => {
109
+ draft.fruits.push(fruit);
110
+ });
111
+ },
112
+ removeFruit: fruitId => {
113
+ set(draft => {
114
+ draft.fruits = draft.fruits.filter(f => f.id !== fruitId);
115
+ });
116
+ },
117
+ updateFruit: (fruitId, updates) => {
118
+ set(draft => {
119
+ // Optimized: Use for-loop instead of find for better performance
120
+ for (let i = 0; i < draft.fruits.length; i++) {
121
+ if (draft.fruits[i].id === fruitId) {
122
+ Object.assign(draft.fruits[i], updates);
123
+ break;
124
+ }
125
+ }
126
+ });
127
+ },
128
+ setSlicePath: path => {
129
+ set(draft => {
130
+ draft.slicePath = path;
131
+ });
132
+ },
133
+ setIsSlicing: isSlicing => {
134
+ set(draft => {
135
+ draft.isSlicing = isSlicing;
136
+ });
137
+ },
138
+ incrementCombo: () => {
139
+ set(draft => {
140
+ draft.combo = draft.combo + 1;
141
+ });
142
+ },
143
+ resetCombo: () => {
144
+ set(draft => {
145
+ draft.combo = 0;
146
+ });
147
+ },
148
+ loseLife: () => {
149
+ set(draft => {
150
+ const newLives = Math.max(0, draft.lives - 1);
151
+ draft.lives = newLives;
152
+ if (newLives <= 0) {
153
+ draft.isPlaying = false;
154
+ draft.gameOver = true;
155
+ }
156
+ });
157
+ },
158
+ addLife: () => {
159
+ set(draft => {
160
+ draft.lives = Math.min(draft.lives + 1, GAME_CONFIG.MAX_LIVES); // Cap at max lives
161
+ });
162
+ }
163
+ }))));
164
+
165
+ // Store reference to game service for cleanup
166
+ let gameServiceInstance = null;
167
+
168
+ // Function to register game service instance
169
+ export const registerGameService = gameService => {
170
+ gameServiceInstance = gameService;
171
+ };
172
+
173
+ // Automatic game cleanup when gameOver becomes true
174
+ // This replaces the cleanup logic that was previously in the FruitNinja component
175
+ useFruitNinjaStore.subscribe(state => state.gameOver, (gameOver, previousGameOver) => {
176
+ if (gameOver && !previousGameOver) {
177
+ // Game just ended, trigger automatic cleanup
178
+ setTimeout(() => {
179
+ // Stop game service to prevent new fruits from spawning
180
+ if (gameServiceInstance) {
181
+ gameServiceInstance.cleanup();
182
+ }
183
+ const state = useFruitNinjaStore.getState();
184
+ // Clear all fruits from the screen
185
+ state.fruits.forEach(fruit => {
186
+ useFruitNinjaStore.getState().removeFruit(fruit.id);
187
+ });
188
+ }, 50); // Small delay to ensure state consistency
189
+ }
190
+ });
191
+ //# sourceMappingURL=FruitNinjaStore.js.map