react-native-games 0.3.0 → 0.4.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 (387) hide show
  1. package/README.md +45 -32
  2. package/lib/module/games/balloon-blaster/BalloonBlaster.js +160 -75
  3. package/lib/module/games/balloon-blaster/BalloonBlaster.js.map +1 -1
  4. package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js +183 -0
  5. package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js.map +1 -0
  6. package/lib/module/games/balloon-blaster/BalloonBlasterService.js +152 -55
  7. package/lib/module/games/balloon-blaster/BalloonBlasterService.js.map +1 -1
  8. package/lib/module/games/balloon-blaster/BalloonBlasterStore.js +108 -92
  9. package/lib/module/games/balloon-blaster/BalloonBlasterStore.js.map +1 -1
  10. package/lib/module/games/balloon-blaster/components/BalloonComponent.js +48 -65
  11. package/lib/module/games/balloon-blaster/components/BalloonComponent.js.map +1 -1
  12. package/lib/module/games/balloon-blaster/components/GameArea.js +7 -2
  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/ParticleSystem.js +9 -6
  17. package/lib/module/games/balloon-blaster/components/ParticleSystem.js.map +1 -1
  18. package/lib/module/games/balloon-blaster/components/ScoreBoard.js +8 -16
  19. package/lib/module/games/balloon-blaster/components/ScoreBoard.js.map +1 -1
  20. package/lib/module/games/balloon-blaster/components/index.js +0 -1
  21. package/lib/module/games/balloon-blaster/components/index.js.map +1 -1
  22. package/lib/module/games/{fruit-slicer/FruitSlicer.js → fruit-ninja/FruitNinja.js} +68 -54
  23. package/lib/module/games/fruit-ninja/FruitNinja.js.map +1 -0
  24. package/lib/module/games/fruit-ninja/FruitNinjaConstants.js +151 -0
  25. package/lib/module/games/fruit-ninja/FruitNinjaConstants.js.map +1 -0
  26. package/lib/module/games/{fruit-slicer/FruitSlicerService.js → fruit-ninja/FruitNinjaService.js} +13 -12
  27. package/lib/module/games/fruit-ninja/FruitNinjaService.js.map +1 -0
  28. package/lib/module/games/fruit-ninja/FruitNinjaStore.js +166 -0
  29. package/lib/module/games/fruit-ninja/FruitNinjaStore.js.map +1 -0
  30. package/lib/module/games/{fruit-slicer → fruit-ninja}/components/FruitComponent.js +1 -1
  31. package/lib/module/games/fruit-ninja/components/FruitComponent.js.map +1 -0
  32. package/lib/module/games/fruit-ninja/components/GameArea.js.map +1 -0
  33. package/lib/module/games/{fruit-slicer → fruit-ninja}/components/GameBackground.js +198 -169
  34. package/lib/module/games/fruit-ninja/components/GameBackground.js.map +1 -0
  35. package/lib/module/games/fruit-ninja/components/GameOverModal.js.map +1 -0
  36. package/lib/module/games/fruit-ninja/components/ParticleSystem.js.map +1 -0
  37. package/lib/module/games/{fruit-slicer → fruit-ninja}/components/ScoreBoard.js +8 -17
  38. package/lib/module/games/fruit-ninja/components/ScoreBoard.js.map +1 -0
  39. package/lib/module/games/{fruit-slicer → fruit-ninja}/components/SliceTrail.js +1 -1
  40. package/lib/module/games/fruit-ninja/components/SliceTrail.js.map +1 -0
  41. package/lib/module/games/{fruit-slicer → fruit-ninja}/components/index.js +0 -1
  42. package/lib/module/games/fruit-ninja/components/index.js.map +1 -0
  43. package/lib/module/games/maze-runner/MazeRunner.js +109 -91
  44. package/lib/module/games/maze-runner/MazeRunner.js.map +1 -1
  45. package/lib/module/games/maze-runner/MazeRunnerConstants.js +105 -0
  46. package/lib/module/games/maze-runner/MazeRunnerConstants.js.map +1 -0
  47. package/lib/module/games/maze-runner/MazeRunnerService.js +37 -14
  48. package/lib/module/games/maze-runner/MazeRunnerService.js.map +1 -1
  49. package/lib/module/games/maze-runner/components/EnhancedGameArea.js +5 -9
  50. package/lib/module/games/maze-runner/components/EnhancedGameArea.js.map +1 -1
  51. package/lib/module/games/maze-runner/components/GameBackground.js +151 -192
  52. package/lib/module/games/maze-runner/components/GameBackground.js.map +1 -1
  53. package/lib/module/games/maze-runner/components/ScoreBoard.js +8 -23
  54. package/lib/module/games/maze-runner/components/ScoreBoard.js.map +1 -1
  55. package/lib/module/games/maze-runner/components/index.js +0 -1
  56. package/lib/module/games/maze-runner/components/index.js.map +1 -1
  57. package/lib/module/games/popit-fidget/PopitFidget.js +293 -0
  58. package/lib/module/games/popit-fidget/PopitFidget.js.map +1 -0
  59. package/lib/module/games/popit-fidget/PopitFidgetConstants.js +116 -0
  60. package/lib/module/games/popit-fidget/PopitFidgetConstants.js.map +1 -0
  61. package/lib/module/games/popit-fidget/PopitFidgetService.js +191 -0
  62. package/lib/module/games/popit-fidget/PopitFidgetService.js.map +1 -0
  63. package/lib/module/games/popit-fidget/PopitFidgetStore.js +190 -0
  64. package/lib/module/games/popit-fidget/PopitFidgetStore.js.map +1 -0
  65. package/lib/module/games/popit-fidget/components/BubbleComponent.js +196 -0
  66. package/lib/module/games/popit-fidget/components/BubbleComponent.js.map +1 -0
  67. package/lib/module/games/popit-fidget/components/FidgetGrid.js +165 -0
  68. package/lib/module/games/popit-fidget/components/FidgetGrid.js.map +1 -0
  69. package/lib/module/games/popit-fidget/components/GameBackground.js +174 -0
  70. package/lib/module/games/popit-fidget/components/GameBackground.js.map +1 -0
  71. package/lib/module/games/popit-fidget/components/GameOverModal.js +132 -0
  72. package/lib/module/games/popit-fidget/components/GameOverModal.js.map +1 -0
  73. package/lib/module/games/popit-fidget/components/ParticleSystem.js +89 -0
  74. package/lib/module/games/popit-fidget/components/ParticleSystem.js.map +1 -0
  75. package/lib/module/games/popit-fidget/components/ScoreBoard.js +68 -0
  76. package/lib/module/games/popit-fidget/components/ScoreBoard.js.map +1 -0
  77. package/lib/module/games/popit-fidget/components/index.js +9 -0
  78. package/lib/module/games/popit-fidget/components/index.js.map +1 -0
  79. package/lib/module/games/{space-traveller/SpaceTraveller.js → space-fighter/SpaceFighter.js} +94 -70
  80. package/lib/module/games/space-fighter/SpaceFighter.js.map +1 -0
  81. package/lib/module/games/space-fighter/SpaceFighterConstants.js +110 -0
  82. package/lib/module/games/space-fighter/SpaceFighterConstants.js.map +1 -0
  83. package/lib/module/games/{space-traveller/SpaceTravellerService.js → space-fighter/SpaceFighterService.js} +18 -10
  84. package/lib/module/games/space-fighter/SpaceFighterService.js.map +1 -0
  85. package/lib/module/games/space-fighter/SpaceFighterStore.js +143 -0
  86. package/lib/module/games/space-fighter/SpaceFighterStore.js.map +1 -0
  87. package/lib/module/games/space-fighter/components/AsteroidComponent.js.map +1 -0
  88. package/lib/module/games/space-fighter/components/GameArea.js.map +1 -0
  89. package/lib/module/games/space-fighter/components/GameBackground.js.map +1 -0
  90. package/lib/module/games/space-fighter/components/GameOverModal.js.map +1 -0
  91. package/lib/module/games/space-fighter/components/ParticleComponent.js.map +1 -0
  92. package/lib/module/games/{space-traveller → space-fighter}/components/ScoreBoard.js +11 -19
  93. package/lib/module/games/space-fighter/components/ScoreBoard.js.map +1 -0
  94. package/lib/module/games/space-fighter/components/SettingsModal.js.map +1 -0
  95. package/lib/module/games/space-fighter/components/Spacecraft3D.js.map +1 -0
  96. package/lib/module/games/{space-traveller → space-fighter}/components/SpacecraftPath.js +1 -1
  97. package/lib/module/games/space-fighter/components/SpacecraftPath.js.map +1 -0
  98. package/lib/module/games/{space-traveller → space-fighter}/components/index.js +0 -1
  99. package/lib/module/games/space-fighter/components/index.js.map +1 -0
  100. package/lib/module/games/whack-a-mole/WhackAMole.js +273 -0
  101. package/lib/module/games/whack-a-mole/WhackAMole.js.map +1 -0
  102. package/lib/module/games/whack-a-mole/WhackAMoleConstants.js +117 -0
  103. package/lib/module/games/whack-a-mole/WhackAMoleConstants.js.map +1 -0
  104. package/lib/module/games/whack-a-mole/WhackAMoleService.js +120 -0
  105. package/lib/module/games/whack-a-mole/WhackAMoleService.js.map +1 -0
  106. package/lib/module/games/whack-a-mole/WhackAMoleStore.js +159 -0
  107. package/lib/module/games/whack-a-mole/WhackAMoleStore.js.map +1 -0
  108. package/lib/module/games/{cat-popper → whack-a-mole}/components/GameBackground.js +31 -91
  109. package/lib/module/games/whack-a-mole/components/GameBackground.js.map +1 -0
  110. package/lib/module/games/whack-a-mole/components/GameGrid.js +97 -0
  111. package/lib/module/games/whack-a-mole/components/GameGrid.js.map +1 -0
  112. package/lib/module/games/{cat-popper → whack-a-mole}/components/GameHole.js +67 -54
  113. package/lib/module/games/whack-a-mole/components/GameHole.js.map +1 -0
  114. package/lib/module/games/{cat-popper → whack-a-mole}/components/GameOverModal.js +2 -2
  115. package/lib/module/games/whack-a-mole/components/GameOverModal.js.map +1 -0
  116. package/lib/module/games/{cat-popper/components/CatCharacter.js → whack-a-mole/components/MoleCharacter.js} +75 -115
  117. package/lib/module/games/whack-a-mole/components/MoleCharacter.js.map +1 -0
  118. package/lib/module/games/{cat-popper → whack-a-mole}/components/ScoreBoard.js +8 -16
  119. package/lib/module/games/whack-a-mole/components/ScoreBoard.js.map +1 -0
  120. package/lib/module/games/{cat-popper → whack-a-mole}/components/index.js +1 -2
  121. package/lib/module/games/whack-a-mole/components/index.js.map +1 -0
  122. package/lib/module/index.js +4 -3
  123. package/lib/module/index.js.map +1 -1
  124. package/lib/module/services/GamesConstants.js +36 -506
  125. package/lib/module/services/GamesConstants.js.map +1 -1
  126. package/lib/module/services/GamesService.js +22 -14
  127. package/lib/module/services/GamesService.js.map +1 -1
  128. package/lib/module/services/HapticsService.js +77 -0
  129. package/lib/module/services/HapticsService.js.map +1 -0
  130. package/lib/module/services/SoundsService.js +171 -0
  131. package/lib/module/services/SoundsService.js.map +1 -0
  132. package/lib/module/{games/balloon-blaster/components/GameControls.js → shared/helpers/GameControlButton.js} +39 -58
  133. package/lib/module/shared/helpers/GameControlButton.js.map +1 -0
  134. package/lib/module/shared/helpers/ResponsiveScoreBoard.js +81 -0
  135. package/lib/module/shared/helpers/ResponsiveScoreBoard.js.map +1 -0
  136. package/lib/module/shared/helpers/index.js +5 -0
  137. package/lib/module/shared/helpers/index.js.map +1 -0
  138. package/lib/module/shared/settings/SettingsService.js +18 -12
  139. package/lib/module/shared/settings/SettingsService.js.map +1 -1
  140. package/lib/typescript/src/games/balloon-blaster/BalloonBlaster.d.ts.map +1 -1
  141. package/lib/typescript/src/games/balloon-blaster/BalloonBlasterConstants.d.ts +143 -0
  142. package/lib/typescript/src/games/balloon-blaster/BalloonBlasterConstants.d.ts.map +1 -0
  143. package/lib/typescript/src/games/balloon-blaster/BalloonBlasterService.d.ts +3 -1
  144. package/lib/typescript/src/games/balloon-blaster/BalloonBlasterService.d.ts.map +1 -1
  145. package/lib/typescript/src/games/balloon-blaster/BalloonBlasterStore.d.ts +12 -2
  146. package/lib/typescript/src/games/balloon-blaster/BalloonBlasterStore.d.ts.map +1 -1
  147. package/lib/typescript/src/games/balloon-blaster/components/BalloonComponent.d.ts.map +1 -1
  148. package/lib/typescript/src/games/balloon-blaster/components/GameArea.d.ts.map +1 -1
  149. package/lib/typescript/src/games/balloon-blaster/components/GameBackground.d.ts.map +1 -1
  150. package/lib/typescript/src/games/balloon-blaster/components/ParticleSystem.d.ts.map +1 -1
  151. package/lib/typescript/src/games/balloon-blaster/components/ScoreBoard.d.ts.map +1 -1
  152. package/lib/typescript/src/games/balloon-blaster/components/index.d.ts +0 -1
  153. package/lib/typescript/src/games/balloon-blaster/components/index.d.ts.map +1 -1
  154. package/lib/typescript/src/games/fruit-ninja/FruitNinja.d.ts +16 -0
  155. package/lib/typescript/src/games/fruit-ninja/FruitNinja.d.ts.map +1 -0
  156. package/lib/typescript/src/games/fruit-ninja/FruitNinjaConstants.d.ts +112 -0
  157. package/lib/typescript/src/games/fruit-ninja/FruitNinjaConstants.d.ts.map +1 -0
  158. package/lib/typescript/src/games/{fruit-slicer/FruitSlicerService.d.ts → fruit-ninja/FruitNinjaService.d.ts} +4 -4
  159. package/lib/typescript/src/games/fruit-ninja/FruitNinjaService.d.ts.map +1 -0
  160. package/lib/typescript/src/games/{fruit-slicer/FruitSlicerStore.d.ts → fruit-ninja/FruitNinjaStore.d.ts} +12 -4
  161. package/lib/typescript/src/games/fruit-ninja/FruitNinjaStore.d.ts.map +1 -0
  162. package/lib/typescript/src/games/{fruit-slicer → fruit-ninja}/components/FruitComponent.d.ts +1 -1
  163. package/lib/typescript/src/games/fruit-ninja/components/FruitComponent.d.ts.map +1 -0
  164. package/lib/typescript/src/games/{fruit-slicer → fruit-ninja}/components/GameArea.d.ts +1 -1
  165. package/lib/typescript/src/games/fruit-ninja/components/GameArea.d.ts.map +1 -0
  166. package/lib/typescript/src/games/fruit-ninja/components/GameBackground.d.ts.map +1 -0
  167. package/lib/typescript/src/games/fruit-ninja/components/GameOverModal.d.ts.map +1 -0
  168. package/lib/typescript/src/games/{fruit-slicer → fruit-ninja}/components/ParticleSystem.d.ts +1 -1
  169. package/lib/typescript/src/games/fruit-ninja/components/ParticleSystem.d.ts.map +1 -0
  170. package/lib/typescript/src/games/fruit-ninja/components/ScoreBoard.d.ts.map +1 -0
  171. package/lib/typescript/src/games/fruit-ninja/components/SliceTrail.d.ts.map +1 -0
  172. package/lib/typescript/src/games/{fruit-slicer → fruit-ninja}/components/index.d.ts +0 -1
  173. package/lib/typescript/src/games/fruit-ninja/components/index.d.ts.map +1 -0
  174. package/lib/typescript/src/games/maze-runner/MazeRunner.d.ts +1 -9
  175. package/lib/typescript/src/games/maze-runner/MazeRunner.d.ts.map +1 -1
  176. package/lib/typescript/src/games/maze-runner/MazeRunnerConstants.d.ts +41 -0
  177. package/lib/typescript/src/games/maze-runner/MazeRunnerConstants.d.ts.map +1 -0
  178. package/lib/typescript/src/games/maze-runner/MazeRunnerService.d.ts +4 -2
  179. package/lib/typescript/src/games/maze-runner/MazeRunnerService.d.ts.map +1 -1
  180. package/lib/typescript/src/games/maze-runner/components/EnhancedGameArea.d.ts.map +1 -1
  181. package/lib/typescript/src/games/maze-runner/components/GameBackground.d.ts +2 -1
  182. package/lib/typescript/src/games/maze-runner/components/GameBackground.d.ts.map +1 -1
  183. package/lib/typescript/src/games/maze-runner/components/ScoreBoard.d.ts.map +1 -1
  184. package/lib/typescript/src/games/maze-runner/components/index.d.ts +0 -1
  185. package/lib/typescript/src/games/maze-runner/components/index.d.ts.map +1 -1
  186. package/lib/typescript/src/games/popit-fidget/PopitFidget.d.ts +11 -0
  187. package/lib/typescript/src/games/popit-fidget/PopitFidget.d.ts.map +1 -0
  188. package/lib/typescript/src/games/popit-fidget/PopitFidgetConstants.d.ts +45 -0
  189. package/lib/typescript/src/games/popit-fidget/PopitFidgetConstants.d.ts.map +1 -0
  190. package/lib/typescript/src/games/popit-fidget/PopitFidgetService.d.ts +54 -0
  191. package/lib/typescript/src/games/popit-fidget/PopitFidgetService.d.ts.map +1 -0
  192. package/lib/typescript/src/games/popit-fidget/PopitFidgetStore.d.ts +40 -0
  193. package/lib/typescript/src/games/popit-fidget/PopitFidgetStore.d.ts.map +1 -0
  194. package/lib/typescript/src/games/popit-fidget/components/BubbleComponent.d.ts +12 -0
  195. package/lib/typescript/src/games/popit-fidget/components/BubbleComponent.d.ts.map +1 -0
  196. package/lib/typescript/src/games/popit-fidget/components/FidgetGrid.d.ts +12 -0
  197. package/lib/typescript/src/games/popit-fidget/components/FidgetGrid.d.ts.map +1 -0
  198. package/lib/typescript/src/games/popit-fidget/components/GameBackground.d.ts +9 -0
  199. package/lib/typescript/src/games/popit-fidget/components/GameBackground.d.ts.map +1 -0
  200. package/lib/typescript/src/games/popit-fidget/components/GameOverModal.d.ts +9 -0
  201. package/lib/typescript/src/games/popit-fidget/components/GameOverModal.d.ts.map +1 -0
  202. package/lib/typescript/src/games/popit-fidget/components/ParticleSystem.d.ts +9 -0
  203. package/lib/typescript/src/games/popit-fidget/components/ParticleSystem.d.ts.map +1 -0
  204. package/lib/typescript/src/games/popit-fidget/components/ScoreBoard.d.ts +8 -0
  205. package/lib/typescript/src/games/popit-fidget/components/ScoreBoard.d.ts.map +1 -0
  206. package/lib/typescript/src/games/popit-fidget/components/index.d.ts +7 -0
  207. package/lib/typescript/src/games/popit-fidget/components/index.d.ts.map +1 -0
  208. package/lib/typescript/src/games/space-fighter/SpaceFighter.d.ts +9 -0
  209. package/lib/typescript/src/games/space-fighter/SpaceFighter.d.ts.map +1 -0
  210. package/lib/typescript/src/games/space-fighter/SpaceFighterConstants.d.ts +71 -0
  211. package/lib/typescript/src/games/space-fighter/SpaceFighterConstants.d.ts.map +1 -0
  212. package/lib/typescript/src/games/{space-traveller/SpaceTravellerService.d.ts → space-fighter/SpaceFighterService.d.ts} +7 -4
  213. package/lib/typescript/src/games/space-fighter/SpaceFighterService.d.ts.map +1 -0
  214. package/lib/typescript/src/games/{space-traveller/SpaceTravellerStore.d.ts → space-fighter/SpaceFighterStore.d.ts} +12 -4
  215. package/lib/typescript/src/games/space-fighter/SpaceFighterStore.d.ts.map +1 -0
  216. package/lib/typescript/src/games/{space-traveller → space-fighter}/components/AsteroidComponent.d.ts +1 -1
  217. package/lib/typescript/src/games/space-fighter/components/AsteroidComponent.d.ts.map +1 -0
  218. package/lib/typescript/src/games/{space-traveller → space-fighter}/components/GameArea.d.ts +1 -1
  219. package/lib/typescript/src/games/space-fighter/components/GameArea.d.ts.map +1 -0
  220. package/lib/typescript/src/games/space-fighter/components/GameBackground.d.ts.map +1 -0
  221. package/lib/typescript/src/games/space-fighter/components/GameOverModal.d.ts.map +1 -0
  222. package/lib/typescript/src/games/{space-traveller → space-fighter}/components/ParticleComponent.d.ts +1 -1
  223. package/lib/typescript/src/games/space-fighter/components/ParticleComponent.d.ts.map +1 -0
  224. package/lib/typescript/src/games/space-fighter/components/ScoreBoard.d.ts.map +1 -0
  225. package/lib/typescript/src/games/space-fighter/components/SettingsModal.d.ts.map +1 -0
  226. package/lib/typescript/src/games/{space-traveller → space-fighter}/components/Spacecraft3D.d.ts +1 -1
  227. package/lib/typescript/src/games/space-fighter/components/Spacecraft3D.d.ts.map +1 -0
  228. package/lib/typescript/src/games/space-fighter/components/SpacecraftPath.d.ts.map +1 -0
  229. package/lib/typescript/src/games/{space-traveller → space-fighter}/components/index.d.ts +0 -1
  230. package/lib/typescript/src/games/space-fighter/components/index.d.ts.map +1 -0
  231. package/lib/typescript/src/games/{cat-popper/CatPopper.d.ts → whack-a-mole/WhackAMole.d.ts} +4 -4
  232. package/lib/typescript/src/games/whack-a-mole/WhackAMole.d.ts.map +1 -0
  233. package/lib/typescript/src/games/whack-a-mole/WhackAMoleConstants.d.ts +79 -0
  234. package/lib/typescript/src/games/whack-a-mole/WhackAMoleConstants.d.ts.map +1 -0
  235. package/lib/typescript/src/games/whack-a-mole/WhackAMoleService.d.ts +33 -0
  236. package/lib/typescript/src/games/whack-a-mole/WhackAMoleService.d.ts.map +1 -0
  237. package/lib/typescript/src/games/whack-a-mole/WhackAMoleStore.d.ts +41 -0
  238. package/lib/typescript/src/games/whack-a-mole/WhackAMoleStore.d.ts.map +1 -0
  239. package/lib/typescript/src/games/whack-a-mole/components/GameBackground.d.ts.map +1 -0
  240. package/lib/typescript/src/games/{cat-popper → whack-a-mole}/components/GameGrid.d.ts +2 -2
  241. package/lib/typescript/src/games/whack-a-mole/components/GameGrid.d.ts.map +1 -0
  242. package/lib/typescript/src/games/{cat-popper → whack-a-mole}/components/GameHole.d.ts +3 -2
  243. package/lib/typescript/src/games/whack-a-mole/components/GameHole.d.ts.map +1 -0
  244. package/lib/typescript/src/games/{fruit-slicer → whack-a-mole}/components/GameOverModal.d.ts.map +1 -1
  245. package/lib/typescript/src/games/whack-a-mole/components/MoleCharacter.d.ts +7 -0
  246. package/lib/typescript/src/games/whack-a-mole/components/MoleCharacter.d.ts.map +1 -0
  247. package/lib/typescript/src/games/whack-a-mole/components/ScoreBoard.d.ts.map +1 -0
  248. package/lib/typescript/src/games/{cat-popper → whack-a-mole}/components/index.d.ts +1 -2
  249. package/lib/typescript/src/games/whack-a-mole/components/index.d.ts.map +1 -0
  250. package/lib/typescript/src/index.d.ts +4 -3
  251. package/lib/typescript/src/index.d.ts.map +1 -1
  252. package/lib/typescript/src/services/GamesConstants.d.ts +30 -318
  253. package/lib/typescript/src/services/GamesConstants.d.ts.map +1 -1
  254. package/lib/typescript/src/services/GamesService.d.ts +1 -0
  255. package/lib/typescript/src/services/GamesService.d.ts.map +1 -1
  256. package/lib/typescript/src/services/HapticsService.d.ts +16 -0
  257. package/lib/typescript/src/services/HapticsService.d.ts.map +1 -0
  258. package/lib/typescript/src/services/SoundsService.d.ts +154 -0
  259. package/lib/typescript/src/services/SoundsService.d.ts.map +1 -0
  260. package/lib/typescript/src/shared/helpers/GameControlButton.d.ts +17 -0
  261. package/lib/typescript/src/shared/helpers/GameControlButton.d.ts.map +1 -0
  262. package/lib/typescript/src/shared/helpers/ResponsiveScoreBoard.d.ts +42 -0
  263. package/lib/typescript/src/shared/helpers/ResponsiveScoreBoard.d.ts.map +1 -0
  264. package/lib/typescript/src/shared/helpers/index.d.ts +4 -0
  265. package/lib/typescript/src/shared/helpers/index.d.ts.map +1 -0
  266. package/lib/typescript/src/shared/settings/SettingsService.d.ts +2 -1
  267. package/lib/typescript/src/shared/settings/SettingsService.d.ts.map +1 -1
  268. package/package.json +9 -6
  269. package/lib/module/games/balloon-blaster/components/GameControls.js.map +0 -1
  270. package/lib/module/games/cat-popper/CatPopper.js +0 -230
  271. package/lib/module/games/cat-popper/CatPopper.js.map +0 -1
  272. package/lib/module/games/cat-popper/CatPopperService.js +0 -100
  273. package/lib/module/games/cat-popper/CatPopperService.js.map +0 -1
  274. package/lib/module/games/cat-popper/CatPopperStore.js +0 -113
  275. package/lib/module/games/cat-popper/CatPopperStore.js.map +0 -1
  276. package/lib/module/games/cat-popper/components/CatCharacter.js.map +0 -1
  277. package/lib/module/games/cat-popper/components/GameBackground.js.map +0 -1
  278. package/lib/module/games/cat-popper/components/GameControls.js +0 -230
  279. package/lib/module/games/cat-popper/components/GameControls.js.map +0 -1
  280. package/lib/module/games/cat-popper/components/GameGrid.js +0 -66
  281. package/lib/module/games/cat-popper/components/GameGrid.js.map +0 -1
  282. package/lib/module/games/cat-popper/components/GameHole.js.map +0 -1
  283. package/lib/module/games/cat-popper/components/GameOverModal.js.map +0 -1
  284. package/lib/module/games/cat-popper/components/ScoreBoard.js.map +0 -1
  285. package/lib/module/games/cat-popper/components/index.js.map +0 -1
  286. package/lib/module/games/fruit-slicer/FruitSlicer.js.map +0 -1
  287. package/lib/module/games/fruit-slicer/FruitSlicerService.js.map +0 -1
  288. package/lib/module/games/fruit-slicer/FruitSlicerStore.js +0 -156
  289. package/lib/module/games/fruit-slicer/FruitSlicerStore.js.map +0 -1
  290. package/lib/module/games/fruit-slicer/components/FruitComponent.js.map +0 -1
  291. package/lib/module/games/fruit-slicer/components/GameArea.js.map +0 -1
  292. package/lib/module/games/fruit-slicer/components/GameBackground.js.map +0 -1
  293. package/lib/module/games/fruit-slicer/components/GameControls.js +0 -230
  294. package/lib/module/games/fruit-slicer/components/GameControls.js.map +0 -1
  295. package/lib/module/games/fruit-slicer/components/GameOverModal.js.map +0 -1
  296. package/lib/module/games/fruit-slicer/components/ParticleSystem.js.map +0 -1
  297. package/lib/module/games/fruit-slicer/components/ScoreBoard.js.map +0 -1
  298. package/lib/module/games/fruit-slicer/components/SliceTrail.js.map +0 -1
  299. package/lib/module/games/fruit-slicer/components/index.js.map +0 -1
  300. package/lib/module/games/maze-runner/components/GameControls.js +0 -129
  301. package/lib/module/games/maze-runner/components/GameControls.js.map +0 -1
  302. package/lib/module/games/space-traveller/SpaceTraveller.js.map +0 -1
  303. package/lib/module/games/space-traveller/SpaceTravellerService.js.map +0 -1
  304. package/lib/module/games/space-traveller/SpaceTravellerStore.js +0 -139
  305. package/lib/module/games/space-traveller/SpaceTravellerStore.js.map +0 -1
  306. package/lib/module/games/space-traveller/components/AsteroidComponent.js.map +0 -1
  307. package/lib/module/games/space-traveller/components/GameArea.js.map +0 -1
  308. package/lib/module/games/space-traveller/components/GameBackground.js.map +0 -1
  309. package/lib/module/games/space-traveller/components/GameControls.js +0 -177
  310. package/lib/module/games/space-traveller/components/GameControls.js.map +0 -1
  311. package/lib/module/games/space-traveller/components/GameOverModal.js.map +0 -1
  312. package/lib/module/games/space-traveller/components/ParticleComponent.js.map +0 -1
  313. package/lib/module/games/space-traveller/components/ScoreBoard.js.map +0 -1
  314. package/lib/module/games/space-traveller/components/SettingsModal.js.map +0 -1
  315. package/lib/module/games/space-traveller/components/Spacecraft3D.js.map +0 -1
  316. package/lib/module/games/space-traveller/components/SpacecraftPath.js.map +0 -1
  317. package/lib/module/games/space-traveller/components/index.js.map +0 -1
  318. package/lib/typescript/src/games/balloon-blaster/components/GameControls.d.ts +0 -10
  319. package/lib/typescript/src/games/balloon-blaster/components/GameControls.d.ts.map +0 -1
  320. package/lib/typescript/src/games/cat-popper/CatPopper.d.ts.map +0 -1
  321. package/lib/typescript/src/games/cat-popper/CatPopperService.d.ts +0 -32
  322. package/lib/typescript/src/games/cat-popper/CatPopperService.d.ts.map +0 -1
  323. package/lib/typescript/src/games/cat-popper/CatPopperStore.d.ts +0 -21
  324. package/lib/typescript/src/games/cat-popper/CatPopperStore.d.ts.map +0 -1
  325. package/lib/typescript/src/games/cat-popper/components/CatCharacter.d.ts +0 -7
  326. package/lib/typescript/src/games/cat-popper/components/CatCharacter.d.ts.map +0 -1
  327. package/lib/typescript/src/games/cat-popper/components/GameBackground.d.ts.map +0 -1
  328. package/lib/typescript/src/games/cat-popper/components/GameControls.d.ts +0 -10
  329. package/lib/typescript/src/games/cat-popper/components/GameControls.d.ts.map +0 -1
  330. package/lib/typescript/src/games/cat-popper/components/GameGrid.d.ts.map +0 -1
  331. package/lib/typescript/src/games/cat-popper/components/GameHole.d.ts.map +0 -1
  332. package/lib/typescript/src/games/cat-popper/components/GameOverModal.d.ts.map +0 -1
  333. package/lib/typescript/src/games/cat-popper/components/ScoreBoard.d.ts.map +0 -1
  334. package/lib/typescript/src/games/cat-popper/components/index.d.ts.map +0 -1
  335. package/lib/typescript/src/games/fruit-slicer/FruitSlicer.d.ts +0 -16
  336. package/lib/typescript/src/games/fruit-slicer/FruitSlicer.d.ts.map +0 -1
  337. package/lib/typescript/src/games/fruit-slicer/FruitSlicerService.d.ts.map +0 -1
  338. package/lib/typescript/src/games/fruit-slicer/FruitSlicerStore.d.ts.map +0 -1
  339. package/lib/typescript/src/games/fruit-slicer/components/FruitComponent.d.ts.map +0 -1
  340. package/lib/typescript/src/games/fruit-slicer/components/GameArea.d.ts.map +0 -1
  341. package/lib/typescript/src/games/fruit-slicer/components/GameBackground.d.ts.map +0 -1
  342. package/lib/typescript/src/games/fruit-slicer/components/GameControls.d.ts +0 -10
  343. package/lib/typescript/src/games/fruit-slicer/components/GameControls.d.ts.map +0 -1
  344. package/lib/typescript/src/games/fruit-slicer/components/ParticleSystem.d.ts.map +0 -1
  345. package/lib/typescript/src/games/fruit-slicer/components/ScoreBoard.d.ts.map +0 -1
  346. package/lib/typescript/src/games/fruit-slicer/components/SliceTrail.d.ts.map +0 -1
  347. package/lib/typescript/src/games/fruit-slicer/components/index.d.ts.map +0 -1
  348. package/lib/typescript/src/games/maze-runner/components/GameControls.d.ts +0 -10
  349. package/lib/typescript/src/games/maze-runner/components/GameControls.d.ts.map +0 -1
  350. package/lib/typescript/src/games/space-traveller/SpaceTraveller.d.ts +0 -17
  351. package/lib/typescript/src/games/space-traveller/SpaceTraveller.d.ts.map +0 -1
  352. package/lib/typescript/src/games/space-traveller/SpaceTravellerService.d.ts.map +0 -1
  353. package/lib/typescript/src/games/space-traveller/SpaceTravellerStore.d.ts.map +0 -1
  354. package/lib/typescript/src/games/space-traveller/components/AsteroidComponent.d.ts.map +0 -1
  355. package/lib/typescript/src/games/space-traveller/components/GameArea.d.ts.map +0 -1
  356. package/lib/typescript/src/games/space-traveller/components/GameBackground.d.ts.map +0 -1
  357. package/lib/typescript/src/games/space-traveller/components/GameControls.d.ts +0 -10
  358. package/lib/typescript/src/games/space-traveller/components/GameControls.d.ts.map +0 -1
  359. package/lib/typescript/src/games/space-traveller/components/GameOverModal.d.ts.map +0 -1
  360. package/lib/typescript/src/games/space-traveller/components/ParticleComponent.d.ts.map +0 -1
  361. package/lib/typescript/src/games/space-traveller/components/ScoreBoard.d.ts.map +0 -1
  362. package/lib/typescript/src/games/space-traveller/components/SettingsModal.d.ts.map +0 -1
  363. package/lib/typescript/src/games/space-traveller/components/Spacecraft3D.d.ts.map +0 -1
  364. package/lib/typescript/src/games/space-traveller/components/SpacecraftPath.d.ts.map +0 -1
  365. package/lib/typescript/src/games/space-traveller/components/index.d.ts.map +0 -1
  366. /package/lib/module/games/{fruit-slicer → fruit-ninja}/components/GameArea.js +0 -0
  367. /package/lib/module/games/{fruit-slicer → fruit-ninja}/components/GameOverModal.js +0 -0
  368. /package/lib/module/games/{fruit-slicer → fruit-ninja}/components/ParticleSystem.js +0 -0
  369. /package/lib/module/games/{space-traveller → space-fighter}/components/AsteroidComponent.js +0 -0
  370. /package/lib/module/games/{space-traveller → space-fighter}/components/GameArea.js +0 -0
  371. /package/lib/module/games/{space-traveller → space-fighter}/components/GameBackground.js +0 -0
  372. /package/lib/module/games/{space-traveller → space-fighter}/components/GameOverModal.js +0 -0
  373. /package/lib/module/games/{space-traveller → space-fighter}/components/ParticleComponent.js +0 -0
  374. /package/lib/module/games/{space-traveller → space-fighter}/components/SettingsModal.js +0 -0
  375. /package/lib/module/games/{space-traveller → space-fighter}/components/Spacecraft3D.js +0 -0
  376. /package/lib/typescript/src/games/{cat-popper → fruit-ninja}/components/GameBackground.d.ts +0 -0
  377. /package/lib/typescript/src/games/{cat-popper → fruit-ninja}/components/GameOverModal.d.ts +0 -0
  378. /package/lib/typescript/src/games/{fruit-slicer → fruit-ninja}/components/ScoreBoard.d.ts +0 -0
  379. /package/lib/typescript/src/games/{fruit-slicer → fruit-ninja}/components/SliceTrail.d.ts +0 -0
  380. /package/lib/typescript/src/games/{fruit-slicer → space-fighter}/components/GameBackground.d.ts +0 -0
  381. /package/lib/typescript/src/games/{fruit-slicer → space-fighter}/components/GameOverModal.d.ts +0 -0
  382. /package/lib/typescript/src/games/{cat-popper → space-fighter}/components/ScoreBoard.d.ts +0 -0
  383. /package/lib/typescript/src/games/{space-traveller → space-fighter}/components/SettingsModal.d.ts +0 -0
  384. /package/lib/typescript/src/games/{space-traveller → space-fighter}/components/SpacecraftPath.d.ts +0 -0
  385. /package/lib/typescript/src/games/{space-traveller → whack-a-mole}/components/GameBackground.d.ts +0 -0
  386. /package/lib/typescript/src/games/{space-traveller → whack-a-mole}/components/GameOverModal.d.ts +0 -0
  387. /package/lib/typescript/src/games/{space-traveller → whack-a-mole}/components/ScoreBoard.d.ts +0 -0
@@ -0,0 +1,273 @@
1
+ "use strict";
2
+
3
+ import React, { useEffect, useRef, useCallback } from 'react';
4
+ import { View, StyleSheet, Modal } from 'react-native';
5
+ import { useSharedValue, withSpring, withTiming } from 'react-native-reanimated';
6
+ import { playSound, GAME_SOUNDS } from "../../services/SoundsService.js";
7
+ import { useWhackAMoleStore } from "./WhackAMoleStore.js";
8
+ import { createWhackAMoleService, ANIMATION_CONFIG, GAME_CONFIG } from "./WhackAMoleService.js";
9
+ import { ScoreBoard, GameGrid, GameOverModal, GameBackground } from "./components/index.js";
10
+ import { GameControlButton } from "../../shared/helpers/index.js";
11
+ import { GameSettings } from "../../shared/settings/GameSettings.js";
12
+ import { createGameSettingsStore } from "../../shared/settings/SettingsService.js";
13
+ import { WHACK_A_MOLE_CONSTANTS } from "./WhackAMoleConstants.js";
14
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
+ // Constants now imported from centralized GamesConstants.ts
16
+
17
+ export const WhackAMole = ({
18
+ settings: externalSettings,
19
+ onSettingsChange,
20
+ showSettingsModal = false,
21
+ onToggleSettingsModal
22
+ }) => {
23
+ // Use optimized selectors to minimize re-renders while keeping all functionality
24
+ const {
25
+ score,
26
+ timeLeft,
27
+ isPlaying,
28
+ gameOver,
29
+ holes,
30
+ startGame,
31
+ stopGame,
32
+ resetGame,
33
+ whackMole,
34
+ decrementTime,
35
+ activateHole,
36
+ deactivateHole,
37
+ setHoles
38
+ } = useWhackAMoleStore();
39
+
40
+ // Create unified game settings store
41
+ const useSettings = React.useMemo(() => {
42
+ return createGameSettingsStore(externalSettings, onSettingsChange);
43
+ }, []); // Empty dependency array - create store only once
44
+
45
+ const settings = useSettings();
46
+ const difficulty = useSettings(state => state.difficulty);
47
+ const soundEnabled = useSettings(state => state.soundEnabled);
48
+ // Fixed game duration regardless of difficulty - configurable via constants
49
+ const gameDuration = GAME_CONFIG.GAME_DURATION;
50
+
51
+ // Get game-specific constants based on difficulty (reactive to difficulty changes)
52
+ const gameConstants = React.useMemo(() => ({
53
+ moleSpawnInterval: WHACK_A_MOLE_CONSTANTS.moleSpawnInterval[difficulty],
54
+ moleVisibleDuration: WHACK_A_MOLE_CONSTANTS.moleVisibleDuration[difficulty],
55
+ gridSize: WHACK_A_MOLE_CONSTANTS.gridSize[difficulty],
56
+ pointsPerMole: WHACK_A_MOLE_CONSTANTS.pointsPerMole[difficulty]
57
+ }), [difficulty]);
58
+ const {
59
+ moleSpawnInterval,
60
+ moleVisibleDuration,
61
+ gridSize,
62
+ pointsPerMole
63
+ } = gameConstants;
64
+
65
+ // Track previous settings to prevent infinite loops
66
+ const prevSettingsRef = React.useRef(externalSettings);
67
+
68
+ // Update settings when external settings change (only if actually different)
69
+ React.useEffect(() => {
70
+ if (!externalSettings) return;
71
+ const prev = prevSettingsRef.current;
72
+ if (!prev) {
73
+ settings.updateSettings(externalSettings);
74
+ prevSettingsRef.current = externalSettings;
75
+ return;
76
+ }
77
+ const hasChanged = prev.difficulty !== externalSettings.difficulty || prev.soundEnabled !== externalSettings.soundEnabled || prev.hapticEnabled !== externalSettings.hapticEnabled;
78
+ if (hasChanged) {
79
+ settings.updateSettings(externalSettings);
80
+ prevSettingsRef.current = externalSettings;
81
+ }
82
+ }, [externalSettings, settings]);
83
+ const createHolesForGrid = size => {
84
+ const totalHoles = size * size;
85
+ return Array.from({
86
+ length: totalHoles
87
+ }, (_, i) => ({
88
+ id: i,
89
+ isActive: false,
90
+ position: {
91
+ x: (i % size - 1) * (GAME_CONFIG.HOLE_SIZE + 20),
92
+ y: Math.floor(i / size - 1) * (GAME_CONFIG.HOLE_SIZE + 20),
93
+ z: 0
94
+ }
95
+ }));
96
+ };
97
+
98
+ // Track previous difficulty to detect changes during gameplay
99
+ const prevDifficultyRef = React.useRef(difficulty);
100
+ useEffect(() => {
101
+ if (!isPlaying && !gameOver) {
102
+ const newHoles = createHolesForGrid(gridSize);
103
+ setHoles(newHoles);
104
+ }
105
+ }, [gridSize, isPlaying, gameOver, setHoles]);
106
+ const maxHoles = 16;
107
+ const moleAnimations = useRef(Array.from({
108
+ length: maxHoles
109
+ }, () => useSharedValue(0))).current;
110
+ const hitAnimations = useRef(Array.from({
111
+ length: maxHoles
112
+ }, () => useSharedValue(0))).current;
113
+ const gameService = useRef(createWhackAMoleService(moleAnimations, hitAnimations)).current;
114
+ const playHitSound = useCallback(() => {
115
+ playSound(GAME_SOUNDS.WHACK_A_MOLE.HIT, soundEnabled);
116
+ }, [soundEnabled]);
117
+ const playMissSound = useCallback(() => {
118
+ playSound(GAME_SOUNDS.WHACK_A_MOLE.MISS, soundEnabled);
119
+ }, [soundEnabled]);
120
+
121
+ // Optimized mole spawning with efficient hole selection and preserved animations
122
+ const spawnMole = useCallback(() => {
123
+ const currentHoles = useWhackAMoleStore.getState().holes;
124
+ // Optimized filtering - use direct array access instead of filter + map
125
+ const availableHoles = [];
126
+ for (let i = 0; i < currentHoles.length; i++) {
127
+ if (currentHoles[i] && !currentHoles[i]?.isActive) {
128
+ availableHoles.push(i);
129
+ }
130
+ }
131
+ gameService.spawnRandomMole(availableHoles, holeId => {
132
+ // Preserve smooth spring animations
133
+ if (moleAnimations[holeId]) {
134
+ moleAnimations[holeId].value = withSpring(1, ANIMATION_CONFIG.MOLE_SPRING);
135
+ activateHole(holeId);
136
+ }
137
+ }, holeId => {
138
+ // Optimized state check with preserved animations
139
+ const currentState = useWhackAMoleStore.getState();
140
+ if (holeId < currentState.holes.length && currentState.holes[holeId] && currentState.holes[holeId].isActive && moleAnimations[holeId]) {
141
+ playMissSound();
142
+ moleAnimations[holeId].value = withSpring(0, ANIMATION_CONFIG.MOLE_SPRING);
143
+ deactivateHole(holeId);
144
+ }
145
+ }, moleVisibleDuration);
146
+ }, [playMissSound, activateHole, deactivateHole, moleVisibleDuration]);
147
+
148
+ // Stable callback references to prevent GameControlButton re-renders
149
+ const handleStartGame = useCallback(() => {
150
+ startGame(gameDuration, gridSize);
151
+ gameService.resetAnimations();
152
+ gameService.startGameTimer(decrementTime);
153
+ gameService.startMoleSpawning(spawnMole, moleSpawnInterval);
154
+ }, [gameDuration, gridSize, decrementTime, moleSpawnInterval, spawnMole]);
155
+ const handleStopGame = useCallback(() => {
156
+ stopGame();
157
+ gameService.cleanup();
158
+ gameService.resetAnimations();
159
+ }, [stopGame]);
160
+
161
+ // Stable callback reference to prevent GameGrid re-renders
162
+ const handleWhackMole = useCallback(holeId => {
163
+ const currentState = useWhackAMoleStore.getState();
164
+ if (!currentState.isPlaying) return;
165
+
166
+ // Optimized hole validation - direct array access instead of find
167
+ if (holeId < 0 || holeId >= currentState.holes.length || !currentState.holes[holeId] || !currentState.holes[holeId].isActive) return;
168
+ gameService.whackMole(holeId, () => {
169
+ playHitSound();
170
+ whackMole(holeId, pointsPerMole); // Pass difficulty-based points
171
+
172
+ // Preserve all smooth animations
173
+ if (moleAnimations[holeId]) {
174
+ moleAnimations[holeId].value = withSpring(0, ANIMATION_CONFIG.MOLE_SPRING);
175
+ }
176
+ if (hitAnimations[holeId]) {
177
+ hitAnimations[holeId].value = withTiming(1, ANIMATION_CONFIG.HIT_TIMING, finished => {
178
+ if (finished && hitAnimations[holeId]) {
179
+ hitAnimations[holeId].value = withTiming(0, ANIMATION_CONFIG.HIT_TIMING);
180
+ }
181
+ });
182
+ }
183
+ });
184
+ }, [playHitSound, whackMole, pointsPerMole]); // Removed isPlaying and holes dependencies
185
+
186
+ const handleResetGame = useCallback(() => {
187
+ gameService.cleanup();
188
+ resetGame();
189
+ gameService.resetAnimations();
190
+ }, [resetGame]);
191
+ useEffect(() => {
192
+ if (gameOver || !isPlaying) {
193
+ gameService.cleanup();
194
+ }
195
+ }, [gameOver, isPlaying]);
196
+ useEffect(() => {
197
+ return () => {
198
+ gameService.cleanup();
199
+ };
200
+ }, []);
201
+
202
+ // Optimized difficulty change handling with preserved animations
203
+ React.useEffect(() => {
204
+ if (isPlaying && prevDifficultyRef.current !== difficulty) {
205
+ // Difficulty changed during gameplay - restart with optimized cleanup
206
+ stopGame();
207
+ gameService.cleanup();
208
+ gameService.resetAnimations();
209
+
210
+ // Use requestAnimationFrame for smoother transition
211
+ requestAnimationFrame(() => {
212
+ startGame(gameDuration, gridSize);
213
+ gameService.resetAnimations();
214
+ gameService.startGameTimer(decrementTime);
215
+ gameService.startMoleSpawning(spawnMole, moleSpawnInterval);
216
+ });
217
+ }
218
+ prevDifficultyRef.current = difficulty;
219
+ }, [difficulty, isPlaying, gameDuration, gridSize, moleSpawnInterval, startGame, stopGame, decrementTime, spawnMole]);
220
+ return /*#__PURE__*/_jsx(GameBackground, {
221
+ children: /*#__PURE__*/_jsxs(View, {
222
+ style: styles.container,
223
+ children: [/*#__PURE__*/_jsx(ScoreBoard, {
224
+ score: score,
225
+ timeLeft: timeLeft
226
+ }), /*#__PURE__*/_jsx(GameGrid, {
227
+ holes: holes,
228
+ moleAnimations: moleAnimations,
229
+ hitAnimations: hitAnimations,
230
+ onHolePress: handleWhackMole,
231
+ gridSize: gridSize
232
+ }), /*#__PURE__*/_jsx(GameControlButton, {
233
+ isPlaying: isPlaying,
234
+ gameOver: gameOver,
235
+ onStartGame: handleStartGame,
236
+ onStopGame: handleStopGame,
237
+ startButtonText: "START WHACKING",
238
+ stopButtonText: "STOP GAME",
239
+ startButtonSubtext: "Whack moles to score!",
240
+ stopButtonSubtext: "End current game",
241
+ startButtonColor: "#10b981",
242
+ stopButtonColor: "#dc2626",
243
+ startButtonBorderColor: "#34d399",
244
+ stopButtonBorderColor: "#f87171"
245
+ }), /*#__PURE__*/_jsx(GameOverModal, {
246
+ isVisible: gameOver,
247
+ score: score,
248
+ onPlayAgain: handleResetGame
249
+ }), /*#__PURE__*/_jsx(Modal, {
250
+ visible: showSettingsModal,
251
+ animationType: "slide",
252
+ presentationStyle: "pageSheet",
253
+ onRequestClose: onToggleSettingsModal,
254
+ children: /*#__PURE__*/_jsx(GameSettings, {
255
+ gameId: "whack-a-mole",
256
+ onClose: onToggleSettingsModal || (() => {}),
257
+ settingsStore: settings
258
+ })
259
+ })]
260
+ })
261
+ });
262
+ };
263
+ const styles = StyleSheet.create({
264
+ container: {
265
+ flex: 1,
266
+ backgroundColor: 'transparent',
267
+ // Let GameBackground show through
268
+ paddingTop: 0,
269
+ paddingHorizontal: 20,
270
+ paddingBottom: 20
271
+ }
272
+ });
273
+ //# sourceMappingURL=WhackAMole.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useEffect","useRef","useCallback","View","StyleSheet","Modal","useSharedValue","withSpring","withTiming","playSound","GAME_SOUNDS","useWhackAMoleStore","createWhackAMoleService","ANIMATION_CONFIG","GAME_CONFIG","ScoreBoard","GameGrid","GameOverModal","GameBackground","GameControlButton","GameSettings","createGameSettingsStore","WHACK_A_MOLE_CONSTANTS","jsx","_jsx","jsxs","_jsxs","WhackAMole","settings","externalSettings","onSettingsChange","showSettingsModal","onToggleSettingsModal","score","timeLeft","isPlaying","gameOver","holes","startGame","stopGame","resetGame","whackMole","decrementTime","activateHole","deactivateHole","setHoles","useSettings","useMemo","difficulty","state","soundEnabled","gameDuration","GAME_DURATION","gameConstants","moleSpawnInterval","moleVisibleDuration","gridSize","pointsPerMole","prevSettingsRef","prev","current","updateSettings","hasChanged","hapticEnabled","createHolesForGrid","size","totalHoles","Array","from","length","_","i","id","isActive","position","x","HOLE_SIZE","y","Math","floor","z","prevDifficultyRef","newHoles","maxHoles","moleAnimations","hitAnimations","gameService","playHitSound","WHACK_A_MOLE","HIT","playMissSound","MISS","spawnMole","currentHoles","getState","availableHoles","push","spawnRandomMole","holeId","value","MOLE_SPRING","currentState","handleStartGame","resetAnimations","startGameTimer","startMoleSpawning","handleStopGame","cleanup","handleWhackMole","HIT_TIMING","finished","handleResetGame","requestAnimationFrame","children","style","styles","container","onHolePress","onStartGame","onStopGame","startButtonText","stopButtonText","startButtonSubtext","stopButtonSubtext","startButtonColor","stopButtonColor","startButtonBorderColor","stopButtonBorderColor","isVisible","onPlayAgain","visible","animationType","presentationStyle","onRequestClose","gameId","onClose","settingsStore","create","flex","backgroundColor","paddingTop","paddingHorizontal","paddingBottom"],"sourceRoot":"../../../../src","sources":["games/whack-a-mole/WhackAMole.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,EAAEC,WAAW,QAAQ,OAAO;AAC7D,SAASC,IAAI,EAAEC,UAAU,EAAEC,KAAK,QAAQ,cAAc;AACtD,SAASC,cAAc,EAAEC,UAAU,EAAEC,UAAU,QAAQ,yBAAyB;AAChF,SAASC,SAAS,EAAEC,WAAW,QAAQ,iCAA8B;AACrE,SAASC,kBAAkB,QAAQ,sBAAmB;AACtD,SAASC,uBAAuB,EAAEC,gBAAgB,EAAEC,WAAW,QAAQ,wBAAqB;AAC5F,SAASC,UAAU,EAAEC,QAAQ,EAAEC,aAAa,EAAEC,cAAc,QAAQ,uBAAc;AAClF,SAASC,iBAAiB,QAAQ,+BAAsB;AACxD,SAASC,YAAY,QAAQ,uCAAoC;AACjE,SAASC,uBAAuB,QAA+C,0CAAuC;AACtH,SAASC,sBAAsB,QAAQ,0BAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAS/D;;AAEA,OAAO,MAAMC,UAAqC,GAAGA,CAAC;EACpDC,QAAQ,EAAEC,gBAAgB;EAC1BC,gBAAgB;EAChBC,iBAAiB,GAAG,KAAK;EACzBC;AACF,CAAC,KAAK;EAEJ;EACA,MAAM;IACJC,KAAK;IACLC,QAAQ;IACRC,SAAS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QAAAiF,QAAA,eAEtCzF,IAAA,CAACJ,YAAY;UACXkH,MAAM,EAAC,cAAc;UACrBC,OAAO,EAAEvG,qBAAqB,KAAK,MAAM,CAAC,CAAC,CAAE;UAC7CwG,aAAa,EAAE5G;QAAS,CACzB;MAAC,CACG,CAAC;IAAA,CACJ;EAAC,CACO,CAAC;AAErB,CAAC;AAED,MAAMuF,MAAM,GAAG/G,UAAU,CAACqI,MAAM,CAAC;EAC/BrB,SAAS,EAAE;IACTsB,IAAI,EAAE,CAAC;IACPC,eAAe,EAAE,aAAa;IAAE;IAChCC,UAAU,EAAE,CAAC;IACbC,iBAAiB,EAAE,EAAE;IACrBC,aAAa,EAAE;EACjB;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+
3
+ import { Dimensions } from 'react-native';
4
+ const {
5
+ width
6
+ } = Dimensions.get('window');
7
+
8
+ // Whack A Mole Game Constants
9
+ export const WHACK_A_MOLE_CONSTANTS = {
10
+ moleSpawnInterval: {
11
+ easy: 2000,
12
+ medium: 1500,
13
+ hard: 1000
14
+ },
15
+ moleAppearDuration: {
16
+ easy: 2500,
17
+ medium: 2000,
18
+ hard: 1500
19
+ },
20
+ moleVisibleDuration: {
21
+ easy: 2500,
22
+ medium: 2000,
23
+ hard: 1500
24
+ },
25
+ gridSize: {
26
+ easy: 3,
27
+ medium: 3,
28
+ hard: 4
29
+ },
30
+ pointsPerMole: {
31
+ easy: 10,
32
+ medium: 15,
33
+ hard: 20
34
+ }
35
+ };
36
+ export const WHACK_A_MOLE_GAME_CONFIG = {
37
+ GRID_SIZE: 3,
38
+ HOLE_SIZE: width * 0.25,
39
+ MOLE_APPEAR_DURATION: 1500,
40
+ // ms
41
+ MOLE_DISAPPEAR_DURATION: 500,
42
+ // ms
43
+ GAME_DURATION: 60,
44
+ // seconds
45
+ INITIAL_SPAWN_DELAY: 1000,
46
+ // ms
47
+ MAX_SPAWN_INTERVAL: 2000 // ms
48
+ };
49
+ export const WHACK_A_MOLE_ANIMATION_CONFIG = {
50
+ MOLE_SPRING: {
51
+ damping: 15,
52
+ stiffness: 200
53
+ },
54
+ HOLE_SPRING: {
55
+ damping: 20,
56
+ stiffness: 300
57
+ },
58
+ HIT_TIMING: {
59
+ duration: 300
60
+ }
61
+ };
62
+ export const WHACK_A_MOLE_COLORS = {
63
+ BACKGROUND: '#2E7D32',
64
+ SCORE_BOARD: '#1B5E20',
65
+ HOLE: '#3E2723',
66
+ HOLE_BORDER: '#5D4037',
67
+ HOLE_SHADOW: '#2E2E2E',
68
+ MOLE_SHADOW: 'rgba(0,0,0,0.3)',
69
+ SCORE: '#FFEB3B',
70
+ SCORE_TEXT: '#FFD700',
71
+ TIMER_TEXT: '#FF5722',
72
+ UI: '#4CAF50',
73
+ BUTTON_ACTIVE: '#66BB6A',
74
+ BUTTON_INACTIVE: '#A5D6A7',
75
+ TEXT_PRIMARY: '#FFFFFF',
76
+ TEXT_SECONDARY: '#E8F5E8',
77
+ WHITE: '#FFFFFF',
78
+ START_BUTTON: '#4CAF50',
79
+ HIT_EFFECT_OUTER: '#FFD700',
80
+ HIT_EFFECT_INNER: '#FFA500',
81
+ GAME_OVER_OVERLAY: 'rgba(0, 0, 0, 0.85)',
82
+ BUTTON_BORDER: '#66BB6A'
83
+ };
84
+
85
+ // Whack A Mole Game Theme
86
+ export const WHACK_A_MOLE_THEME = {
87
+ backgroundColor: '#87CEEB',
88
+ // Sky blue
89
+ headerBackgroundColor: 'rgba(20, 83, 45, 0.8)',
90
+ // Green with transparency
91
+ headerTextColor: '#ffffff',
92
+ sectionBackgroundColor: 'rgba(255, 255, 255, 0.2)',
93
+ sectionTitleColor: '#1f2937',
94
+ // Dark gray
95
+ buttonSelectedColor: '#22c55e',
96
+ // Green
97
+ buttonUnselectedColor: 'rgba(255, 255, 255, 0.3)',
98
+ buttonSelectedTextColor: '#ffffff',
99
+ buttonUnselectedTextColor: '#1f2937',
100
+ switchTrackColorFalse: '#16a34a',
101
+ switchTrackColorTrue: '#22c55e',
102
+ switchThumbColor: '#fbbf24',
103
+ // Amber
104
+ infoTextColor: '#374151',
105
+ // Gray
106
+ resetButtonColor: '#ef4444',
107
+ // Red
108
+ resetButtonTextColor: '#ffffff'
109
+ };
110
+
111
+ // Whack A Mole Difficulty Descriptions
112
+ export const WHACK_A_MOLE_DIFFICULTY_DESCRIPTIONS = {
113
+ easy: 'Moles appear slower and stay longer',
114
+ medium: 'Balanced gameplay',
115
+ hard: 'Fast moles, quick reflexes needed!'
116
+ };
117
+ //# sourceMappingURL=WhackAMoleConstants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Dimensions","width","get","WHACK_A_MOLE_CONSTANTS","moleSpawnInterval","easy","medium","hard","moleAppearDuration","moleVisibleDuration","gridSize","pointsPerMole","WHACK_A_MOLE_GAME_CONFIG","GRID_SIZE","HOLE_SIZE","MOLE_APPEAR_DURATION","MOLE_DISAPPEAR_DURATION","GAME_DURATION","INITIAL_SPAWN_DELAY","MAX_SPAWN_INTERVAL","WHACK_A_MOLE_ANIMATION_CONFIG","MOLE_SPRING","damping","stiffness","HOLE_SPRING","HIT_TIMING","duration","WHACK_A_MOLE_COLORS","BACKGROUND","SCORE_BOARD","HOLE","HOLE_BORDER","HOLE_SHADOW","MOLE_SHADOW","SCORE","SCORE_TEXT","TIMER_TEXT","UI","BUTTON_ACTIVE","BUTTON_INACTIVE","TEXT_PRIMARY","TEXT_SECONDARY","WHITE","START_BUTTON","HIT_EFFECT_OUTER","HIT_EFFECT_INNER","GAME_OVER_OVERLAY","BUTTON_BORDER","WHACK_A_MOLE_THEME","backgroundColor","headerBackgroundColor","headerTextColor","sectionBackgroundColor","sectionTitleColor","buttonSelectedColor","buttonUnselectedColor","buttonSelectedTextColor","buttonUnselectedTextColor","switchTrackColorFalse","switchTrackColorTrue","switchThumbColor","infoTextColor","resetButtonColor","resetButtonTextColor","WHACK_A_MOLE_DIFFICULTY_DESCRIPTIONS"],"sourceRoot":"../../../../src","sources":["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ME_CONFIG as GAME_CONFIG, WHACK_A_MOLE_ANIMATION_CONFIG as ANIMATION_CONFIG, WHACK_A_MOLE_COLORS as COLORS } from "./WhackAMoleConstants.js";
4
+
5
+ // Constants now imported from WhackAMoleConstants.ts
6
+ // Re-export for backward compatibility
7
+ export { GAME_CONFIG, ANIMATION_CONFIG, COLORS };
8
+
9
+ // Types
10
+
11
+ export class WhackAMoleService {
12
+ gameTimerRef = null;
13
+ moleTimerRef = null;
14
+ // Optimized: Use Map instead of object for better performance
15
+ activeMoleTimers = new Map();
16
+ constructor(moleAnimations, hitAnimations) {
17
+ this.moleAnimations = moleAnimations;
18
+ this.hitAnimations = hitAnimations;
19
+ }
20
+
21
+ // Optimized random number generation
22
+ fastRandom(max) {
23
+ return Math.floor(Math.random() * max);
24
+ }
25
+
26
+ // Efficient hole selection algorithm
27
+ selectRandomHole(availableHoles) {
28
+ if (availableHoles.length === 0) return -1;
29
+ if (availableHoles.length === 1) return availableHoles[0];
30
+ const randomIndex = this.fastRandom(availableHoles.length);
31
+ return availableHoles[randomIndex];
32
+ }
33
+ startGameTimer(onTick) {
34
+ this.clearGameTimer();
35
+ this.gameTimerRef = setInterval(onTick, 1000);
36
+ }
37
+ startMoleSpawning(spawnMole, customSpawnInterval) {
38
+ this.clearMoleTimer();
39
+ const baseInterval = customSpawnInterval || GAME_CONFIG.MAX_SPAWN_INTERVAL;
40
+ const minInterval = Math.max(500, baseInterval * 0.7); // 30% faster minimum
41
+ const maxInterval = baseInterval;
42
+ const spawnLoop = () => {
43
+ spawnMole();
44
+ const nextSpawnTime = Math.random() * (maxInterval - minInterval) + minInterval;
45
+ this.moleTimerRef = setTimeout(spawnLoop, nextSpawnTime);
46
+ };
47
+ this.moleTimerRef = setTimeout(spawnLoop, GAME_CONFIG.INITIAL_SPAWN_DELAY);
48
+ }
49
+ spawnRandomMole(availableHoles, onMoleSpawned, onMoleHidden, customVisibleDuration) {
50
+ if (availableHoles.length === 0) return;
51
+
52
+ // Optimized hole selection
53
+ const randomHoleId = this.selectRandomHole(availableHoles);
54
+ if (randomHoleId === -1) return;
55
+
56
+ // Clear any existing timeout for this hole using optimized Map
57
+ const existingTimer = this.activeMoleTimers.get(randomHoleId);
58
+ if (existingTimer) {
59
+ clearTimeout(existingTimer);
60
+ this.activeMoleTimers.delete(randomHoleId);
61
+ }
62
+
63
+ // Trigger mole spawn
64
+ onMoleSpawned(randomHoleId);
65
+
66
+ // Schedule mole hide with custom duration and optimized cleanup
67
+ const visibleDuration = customVisibleDuration || GAME_CONFIG.MOLE_APPEAR_DURATION;
68
+ const deactivationTimer = setTimeout(() => {
69
+ onMoleHidden(randomHoleId);
70
+ this.activeMoleTimers.delete(randomHoleId);
71
+ }, visibleDuration);
72
+ this.activeMoleTimers.set(randomHoleId, deactivationTimer);
73
+ }
74
+ whackMole(holeId, onWhacked) {
75
+ // Optimized: Clear the timer using Map for better performance
76
+ const timer = this.activeMoleTimers.get(holeId);
77
+ if (timer) {
78
+ clearTimeout(timer);
79
+ this.activeMoleTimers.delete(holeId);
80
+ }
81
+
82
+ // Execute callback immediately for responsive feedback
83
+ onWhacked();
84
+ }
85
+ resetAnimations() {
86
+ // Optimized: Reset all animations efficiently
87
+ this.moleAnimations.forEach(anim => {
88
+ anim.value = 0;
89
+ });
90
+ this.hitAnimations.forEach(anim => {
91
+ anim.value = 0;
92
+ });
93
+ }
94
+ cleanup() {
95
+ this.clearGameTimer();
96
+ this.clearMoleTimer();
97
+ this.clearAllMoleHideTimeouts();
98
+ }
99
+ clearGameTimer() {
100
+ if (this.gameTimerRef) {
101
+ clearInterval(this.gameTimerRef);
102
+ this.gameTimerRef = null;
103
+ }
104
+ }
105
+ clearMoleTimer() {
106
+ if (this.moleTimerRef) {
107
+ clearTimeout(this.moleTimerRef);
108
+ this.moleTimerRef = null;
109
+ }
110
+ }
111
+ clearAllMoleHideTimeouts() {
112
+ // Optimized: Batch clear all active mole timers using Map
113
+ this.activeMoleTimers.forEach(timer => clearTimeout(timer));
114
+ this.activeMoleTimers.clear();
115
+ }
116
+ }
117
+ export const createWhackAMoleService = (moleAnimations, hitAnimations) => {
118
+ return new WhackAMoleService(moleAnimations, hitAnimations);
119
+ };
120
+ //# sourceMappingURL=WhackAMoleService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["WHACK_A_MOLE_GAME_CONFIG","GAME_CONFIG","WHACK_A_MOLE_ANIMATION_CONFIG","ANIMATION_CONFIG","WHACK_A_MOLE_COLORS","COLORS","WhackAMoleService","gameTimerRef","moleTimerRef","activeMoleTimers","Map","constructor","moleAnimations","hitAnimations","fastRandom","max","Math","floor","random","selectRandomHole","availableHoles","length","randomIndex","startGameTimer","onTick","clearGameTimer","setInterval","startMoleSpawning","spawnMole","customSpawnInterval","clearMoleTimer","baseInterval","MAX_SPAWN_INTERVAL","minInterval","maxInterval","spawnLoop","nextSpawnTime","setTimeout","INITIAL_SPAWN_DELAY","spawnRandomMole","onMoleSpawned","onMoleHidden","customVisibleDuration","randomHoleId","existingTimer","get","clearTimeout","delete","visibleDuration","MOLE_APPEAR_DURATION","deactivationTimer","set","whackMole","holeId","onWhacked","timer","resetAnimations","forEach","anim","value","cleanup","clearAllMoleHideTimeouts","clearInterval","clear","createWhackAMoleService"],"sourceRoot":"../../../../src","sources":["games/whack-a-mole/WhackAMoleService.ts"],"mappings":";;AACA,SACEA,wBAAwB,IAAIC,WAAW,EACvCC,6BAA6B,IAAIC,gBAAgB,EACjDC,mBAAmB,IAAIC,MAAM,QACxB,0BAAuB;;AAE9B;AACA;AACA,SAASJ,WAAW,EAAEE,gBAAgB,EAAEE,MAAM;;AAE9C;;AAOA,OAAO,MAAMC,iBAAiB,CAAC;EACrBC,YAAY,GAA0B,IAAI;EAC1CC,YAAY,GAA0B,IAAI;EAClD;EACQC,gBAAgB,GAAG,IAAIC,GAAG,CAAyB,CAAC;EAE5DC,WAAWA,CACDC,cAAqC,EACrCC,aAAoC,EAC5C;IAAA,KAFQD,cAAqC,GAArCA,cAAqC;IAAA,K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