@nayan-ui/games 1.20.0 → 1.21.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 (552) hide show
  1. package/lib/module/games/arrows/Arrows.js +1 -1
  2. package/lib/module/games/arrows/ArrowsScene.js +1 -1
  3. package/lib/module/games/balloon-blaster/BalloonBlaster.js +1 -1
  4. package/lib/module/games/balloon-blaster/BalloonBlasterScene.js +1 -1
  5. package/lib/module/games/bike-racing/BikeMeshes.js +1 -1
  6. package/lib/module/games/bike-racing/BikeRacing.js +1 -1
  7. package/lib/module/games/bike-racing/BikeRacingConstants.js +1 -1
  8. package/lib/module/games/bike-racing/BikeRacingScene.js +1 -1
  9. package/lib/module/games/block-blast/BlockBlast.js +1 -1
  10. package/lib/module/games/block-blast/BlockBlastScene.js +1 -1
  11. package/lib/module/games/block-breaker/BlockBreaker.js +1 -1
  12. package/lib/module/games/block-breaker/BlockBreakerScene.js +1 -1
  13. package/lib/module/games/bluk/Bluk.js +1 -1
  14. package/lib/module/games/bluk/BlukScene.js +1 -1
  15. package/lib/module/games/bubble-shooter/BubbleShooter.js +1 -1
  16. package/lib/module/games/bubble-shooter/BubbleShooterScene.js +1 -1
  17. package/lib/module/games/candy-crush/CandyCrush.js +1 -1
  18. package/lib/module/games/candy-crush/CandyCrushScene.js +1 -1
  19. package/lib/module/games/car-racing/CarMeshes.js +1 -1
  20. package/lib/module/games/car-racing/CarRacing.js +1 -1
  21. package/lib/module/games/car-racing/CarRacingScene.js +1 -1
  22. package/lib/module/games/chameleon-run/ChameleonRun.js +1 -1
  23. package/lib/module/games/chameleon-run/ChameleonRunBackdrop.js +1 -1
  24. package/lib/module/games/chameleon-run/ChameleonRunMeshes.js +1 -1
  25. package/lib/module/games/checkers/Checkers.js +1 -1
  26. package/lib/module/games/checkers/CheckersScene.js +1 -1
  27. package/lib/module/games/color-switch/ColorSwitch.js +1 -1
  28. package/lib/module/games/color-switch/ColorSwitchScene.js +1 -1
  29. package/lib/module/games/colors-sort/ColorsSort.js +1 -1
  30. package/lib/module/games/colors-sort/ColorsSortScene.js +1 -1
  31. package/lib/module/games/connect-em-all/ConnectEmAll.js +1 -1
  32. package/lib/module/games/connect-em-all/ConnectEmAllScene.js +1 -1
  33. package/lib/module/games/crossy-road/CrossyRoad.js +1 -1
  34. package/lib/module/games/crossy-road/CrossyRoadMeshes.js +1 -1
  35. package/lib/module/games/crossy-road/CrossyRoadPerson.js +1 -1
  36. package/lib/module/games/dino-jump/DinoJump.js +1 -1
  37. package/lib/module/games/dino-jump/DinoJumpScene.js +1 -1
  38. package/lib/module/games/dots-and-boxes/DotsAndBoxes.js +1 -1
  39. package/lib/module/games/dots-and-boxes/DotsAndBoxesScene.js +1 -1
  40. package/lib/module/games/falling-sticks/FallingSticks.js +1 -1
  41. package/lib/module/games/falling-sticks/FallingSticksScene.js +1 -1
  42. package/lib/module/games/find-different-number/FindDifferentNumber.js +1 -1
  43. package/lib/module/games/find-different-number/FindDifferentNumberScene.js +1 -1
  44. package/lib/module/games/flappy-bird/FlappyBird.js +1 -1
  45. package/lib/module/games/flappy-bird/FlappyBirdScene.js +1 -1
  46. package/lib/module/games/fruit-merger/FruitMerger.js +1 -1
  47. package/lib/module/games/fruit-merger/FruitMergerScene.js +1 -1
  48. package/lib/module/games/fruit-ninja/FruitNinja.js +1 -1
  49. package/lib/module/games/fruit-ninja/FruitNinjaScene.js +1 -1
  50. package/lib/module/games/fruit-ninja/FruitNinjaWorld.js +1 -1
  51. package/lib/module/games/game-2048/Game2048.js +1 -1
  52. package/lib/module/games/game-2048/Game2048Scene.js +1 -1
  53. package/lib/module/games/knife-hit/KnifeHit.js +1 -1
  54. package/lib/module/games/knife-hit/KnifeHitScene.js +1 -1
  55. package/lib/module/games/ludo-king/LudoKing.js +1 -1
  56. package/lib/module/games/ludo-king/LudoKingScene.js +1 -1
  57. package/lib/module/games/maze-runner/MazeRunner.js +1 -1
  58. package/lib/module/games/maze-runner/MazeRunnerScene.js +1 -1
  59. package/lib/module/games/memory-match/MemoryMatch.js +1 -1
  60. package/lib/module/games/memory-match/MemoryMatchScene.js +1 -1
  61. package/lib/module/games/mine-sweeper/MineSweeper.js +1 -1
  62. package/lib/module/games/mine-sweeper/MineSweeperScene.js +1 -1
  63. package/lib/module/games/mob-control/MobControl.js +1 -1
  64. package/lib/module/games/mob-control/MobControlGame.js +1 -1
  65. package/lib/module/games/mob-control/MobControlMeshes.js +1 -1
  66. package/lib/module/games/mob-control/MobControlRenderer.js +1 -1
  67. package/lib/module/games/mob-control/MobControlRules.js +1 -1
  68. package/lib/module/games/mob-control/MobControlScene.js +1 -1
  69. package/lib/module/games/nuts-and-bolts/NutsAndBolts.js +1 -1
  70. package/lib/module/games/nuts-and-bolts/NutsAndBoltsScene.js +1 -1
  71. package/lib/module/games/pac-man/PacMan.js +1 -1
  72. package/lib/module/games/pac-man/PacManGame.js +1 -1
  73. package/lib/module/games/pac-man/PacManScene.js +1 -1
  74. package/lib/module/games/paper-io/PaperIo.js +1 -1
  75. package/lib/module/games/paper-io/PaperIoMeshes.js +1 -1
  76. package/lib/module/games/paper-io/PaperIoScene.js +1 -1
  77. package/lib/module/games/penguin-run/PenguinMeshes.js +1 -1
  78. package/lib/module/games/penguin-run/PenguinRun.js +1 -1
  79. package/lib/module/games/penguin-run/PenguinRunScene.js +1 -1
  80. package/lib/module/games/perfect-circle/PerfectCircle.js +1 -1
  81. package/lib/module/games/perfect-circle/PerfectCircleScene.js +1 -1
  82. package/lib/module/games/pipe-connect/PipeConnect.js +1 -1
  83. package/lib/module/games/pipe-connect/PipeConnectScene.js +1 -1
  84. package/lib/module/games/play-with-tua/PlayWithTua.js +1 -1
  85. package/lib/module/games/popit-fidget/PopitFidget.js +1 -1
  86. package/lib/module/games/popit-fidget/PopitFidgetScene.js +1 -1
  87. package/lib/module/games/reversi/Reversi.js +1 -1
  88. package/lib/module/games/reversi/ReversiScene.js +1 -1
  89. package/lib/module/games/search-grid/SearchGrid.js +1 -1
  90. package/lib/module/games/search-grid/SearchGridScene.js +1 -1
  91. package/lib/module/games/shared/BackdropCard.js +1 -1
  92. package/lib/module/games/shared/EngineBackdrop.js +1 -1
  93. package/lib/module/games/shared/EngineBlasts.js +1 -1
  94. package/lib/module/games/shared/EngineBlocks.js +1 -1
  95. package/lib/module/games/shared/EngineDice.js +1 -1
  96. package/lib/module/games/shared/EngineFruits.js +1 -1
  97. package/lib/module/games/shared/EngineGameLoader.js +1 -1
  98. package/lib/module/games/shared/EngineGameScreen.js +1 -1
  99. package/lib/module/games/shared/EngineGlyphs.js +1 -1
  100. package/lib/module/games/shared/EngineHud.js +1 -1
  101. package/lib/module/games/shared/EngineMeadow.js +1 -1
  102. package/lib/module/games/shared/EngineTouchSurface.js +1 -1
  103. package/lib/module/games/shared/GameActivity.js +1 -1
  104. package/lib/module/games/shared/GameLoading.js +1 -1
  105. package/lib/module/games/shared/GameLoadingTransition.js +1 -1
  106. package/lib/module/games/sliding-numbers/SlidingNumbers.js +1 -1
  107. package/lib/module/games/sliding-numbers/SlidingNumbersScene.js +1 -1
  108. package/lib/module/games/snake-3d/Snake3D.js +1 -1
  109. package/lib/module/games/snake-3d/Snake3DScene.js +1 -1
  110. package/lib/module/games/snakes-and-ladders/SnakesAndLadders.js +1 -1
  111. package/lib/module/games/snakes-and-ladders/SnakesAndLaddersScene.js +1 -1
  112. package/lib/module/games/space-fighter/SpaceFighter.js +1 -1
  113. package/lib/module/games/space-fighter/SpaceFighterScene.js +1 -1
  114. package/lib/module/games/spider-solitaire/SpiderSolitaire.js +1 -1
  115. package/lib/module/games/spider-solitaire/SpiderSolitaireScene.js +1 -1
  116. package/lib/module/games/stack-tower/StackTower.js +1 -1
  117. package/lib/module/games/stack-tower/StackTowerScene.js +1 -1
  118. package/lib/module/games/sudoku/Sudoku.js +1 -1
  119. package/lib/module/games/sudoku/SudokuScene.js +1 -1
  120. package/lib/module/games/tangram/Tangram.js +1 -1
  121. package/lib/module/games/tangram/TangramScene.js +1 -1
  122. package/lib/module/games/tank-1990/Tank1990.js +1 -1
  123. package/lib/module/games/tank-1990/Tank1990Scene.js +1 -1
  124. package/lib/module/games/tic-tac-toe/TicTacToe.js +1 -1
  125. package/lib/module/games/tic-tac-toe/TicTacToeScene.js +1 -1
  126. package/lib/module/games/tile-home/TileHome.js +1 -1
  127. package/lib/module/games/tile-home/TileHomeScene.js +1 -1
  128. package/lib/module/games/treasure-hunt/TreasureHunt.js +1 -1
  129. package/lib/module/games/treasure-hunt/TreasureHuntConstants.js +1 -1
  130. package/lib/module/games/treasure-hunt/TreasureHuntModel.js +1 -1
  131. package/lib/module/games/treasure-hunt/TreasureHuntScene.js +1 -1
  132. package/lib/module/games/whack-a-mole/WhackAMole.js +1 -1
  133. package/lib/module/games/whack-a-mole/WhackAMoleScene.js +1 -1
  134. package/lib/module/helpers/GameSettingsModal.js +1 -1
  135. package/lib/module/helpers/GameTheme.js +1 -1
  136. package/package.json +1 -2
  137. package/src/assets/fonts/Inter-SemiBold.ttf +0 -0
  138. package/src/assets/models/explorer/explorer.glb +0 -0
  139. package/src/assets/models/explorer/params.json +0 -51
  140. package/src/assets/models/explorer/source.json +0 -222
  141. package/src/assets/models/play-with-tua/play-with-tua.glb +0 -0
  142. package/src/assets/models/play-with-tua/sources.json +0 -141
  143. package/src/assets/sfx/balloon_pop.wav +0 -0
  144. package/src/assets/sfx/blocked.wav +0 -0
  145. package/src/assets/sfx/boing.wav +0 -0
  146. package/src/assets/sfx/bonus.wav +0 -0
  147. package/src/assets/sfx/boom.wav +0 -0
  148. package/src/assets/sfx/bump.wav +0 -0
  149. package/src/assets/sfx/cannon.wav +0 -0
  150. package/src/assets/sfx/capture.wav +0 -0
  151. package/src/assets/sfx/card_flip.wav +0 -0
  152. package/src/assets/sfx/card_place.wav +0 -0
  153. package/src/assets/sfx/catch.wav +0 -0
  154. package/src/assets/sfx/chime.wav +0 -0
  155. package/src/assets/sfx/chomp.wav +0 -0
  156. package/src/assets/sfx/chomp_alt.wav +0 -0
  157. package/src/assets/sfx/clack.wav +0 -0
  158. package/src/assets/sfx/clang.wav +0 -0
  159. package/src/assets/sfx/clash.wav +0 -0
  160. package/src/assets/sfx/click.wav +0 -0
  161. package/src/assets/sfx/coin.wav +0 -0
  162. package/src/assets/sfx/combo.wav +0 -0
  163. package/src/assets/sfx/crash.wav +0 -0
  164. package/src/assets/sfx/crunch.wav +0 -0
  165. package/src/assets/sfx/dance.wav +0 -0
  166. package/src/assets/sfx/deselect.wav +0 -0
  167. package/src/assets/sfx/dice_roll.wav +0 -0
  168. package/src/assets/sfx/die.wav +0 -0
  169. package/src/assets/sfx/draw.wav +0 -0
  170. package/src/assets/sfx/drop.wav +0 -0
  171. package/src/assets/sfx/eat.wav +0 -0
  172. package/src/assets/sfx/engine.wav +0 -0
  173. package/src/assets/sfx/error.wav +0 -0
  174. package/src/assets/sfx/flag.wav +0 -0
  175. package/src/assets/sfx/flap.wav +0 -0
  176. package/src/assets/sfx/flip_disc.wav +0 -0
  177. package/src/assets/sfx/footstep_run.wav +0 -0
  178. package/src/assets/sfx/footstep_walk.wav +0 -0
  179. package/src/assets/sfx/game_over.wav +0 -0
  180. package/src/assets/sfx/gate.wav +0 -0
  181. package/src/assets/sfx/hit.wav +0 -0
  182. package/src/assets/sfx/hop.wav +0 -0
  183. package/src/assets/sfx/hurt.wav +0 -0
  184. package/src/assets/sfx/invalid.wav +0 -0
  185. package/src/assets/sfx/jump.wav +0 -0
  186. package/src/assets/sfx/ladder.wav +0 -0
  187. package/src/assets/sfx/land.wav +0 -0
  188. package/src/assets/sfx/laugh.wav +0 -0
  189. package/src/assets/sfx/lose.wav +0 -0
  190. package/src/assets/sfx/merge.wav +0 -0
  191. package/src/assets/sfx/miss.wav +0 -0
  192. package/src/assets/sfx/nitro.wav +0 -0
  193. package/src/assets/sfx/pew.wav +0 -0
  194. package/src/assets/sfx/place.wav +0 -0
  195. package/src/assets/sfx/pling.wav +0 -0
  196. package/src/assets/sfx/point.wav +0 -0
  197. package/src/assets/sfx/pop.wav +0 -0
  198. package/src/assets/sfx/pop_soft.wav +0 -0
  199. package/src/assets/sfx/power_up.wav +0 -0
  200. package/src/assets/sfx/reveal.wav +0 -0
  201. package/src/assets/sfx/robot.wav +0 -0
  202. package/src/assets/sfx/rotate.wav +0 -0
  203. package/src/assets/sfx/run_steps.wav +0 -0
  204. package/src/assets/sfx/select.wav +0 -0
  205. package/src/assets/sfx/shuffle.wav +0 -0
  206. package/src/assets/sfx/six.wav +0 -0
  207. package/src/assets/sfx/slice.wav +0 -0
  208. package/src/assets/sfx/slide.wav +0 -0
  209. package/src/assets/sfx/snake.wav +0 -0
  210. package/src/assets/sfx/snap.wav +0 -0
  211. package/src/assets/sfx/splash.wav +0 -0
  212. package/src/assets/sfx/star.wav +0 -0
  213. package/src/assets/sfx/start.wav +0 -0
  214. package/src/assets/sfx/swoosh.wav +0 -0
  215. package/src/assets/sfx/tap.wav +0 -0
  216. package/src/assets/sfx/thud.wav +0 -0
  217. package/src/assets/sfx/thunk.wav +0 -0
  218. package/src/assets/sfx/tick.wav +0 -0
  219. package/src/assets/sfx/time_up.wav +0 -0
  220. package/src/assets/sfx/tock.wav +0 -0
  221. package/src/assets/sfx/walk_steps.wav +0 -0
  222. package/src/assets/sfx/warning.wav +0 -0
  223. package/src/assets/sfx/whack.wav +0 -0
  224. package/src/assets/sfx/whoosh.wav +0 -0
  225. package/src/assets/sfx/win.wav +0 -0
  226. package/src/assets/sfx/zap.wav +0 -0
  227. package/src/assets/textures/ad_bolt.png +0 -0
  228. package/src/assets/textures/ad_bubbles.png +0 -0
  229. package/src/assets/textures/ad_chevrons.png +0 -0
  230. package/src/assets/textures/asphalt.png +0 -0
  231. package/src/assets/textures/bark.jpg +0 -0
  232. package/src/assets/textures/explorer-atlas.png +0 -0
  233. package/src/assets/textures/facade.png +0 -0
  234. package/src/assets/textures/grass.png +0 -0
  235. package/src/assets/textures/leaves.png +0 -0
  236. package/src/assets/textures/limestone.jpg +0 -0
  237. package/src/assets/textures/meadow.jpg +0 -0
  238. package/src/assets/textures/nature-sources.json +0 -87
  239. package/src/assets/textures/pine.png +0 -0
  240. package/src/assets/textures/river.jpg +0 -0
  241. package/src/assets/textures/soft_glow.png +0 -0
  242. package/src/games/arrows/Arrows.tsx +0 -69
  243. package/src/games/arrows/ArrowsConstants.ts +0 -107
  244. package/src/games/arrows/ArrowsGame.ts +0 -735
  245. package/src/games/arrows/ArrowsScene.ts +0 -395
  246. package/src/games/balloon-blaster/BalloonBlaster.tsx +0 -75
  247. package/src/games/balloon-blaster/BalloonBlasterConstants.ts +0 -79
  248. package/src/games/balloon-blaster/BalloonBlasterGame.ts +0 -287
  249. package/src/games/balloon-blaster/BalloonBlasterPhysics.ts +0 -95
  250. package/src/games/balloon-blaster/BalloonBlasterScene.ts +0 -225
  251. package/src/games/bike-racing/BikeMeshes.ts +0 -273
  252. package/src/games/bike-racing/BikeRacing.tsx +0 -211
  253. package/src/games/bike-racing/BikeRacingConstants.ts +0 -103
  254. package/src/games/bike-racing/BikeRacingGame.ts +0 -557
  255. package/src/games/bike-racing/BikeRacingScene.ts +0 -119
  256. package/src/games/block-blast/BlockBlast.tsx +0 -73
  257. package/src/games/block-blast/BlockBlastConstants.ts +0 -179
  258. package/src/games/block-blast/BlockBlastGame.ts +0 -471
  259. package/src/games/block-blast/BlockBlastScene.ts +0 -156
  260. package/src/games/block-breaker/BlockBreaker.tsx +0 -79
  261. package/src/games/block-breaker/BlockBreakerConstants.ts +0 -139
  262. package/src/games/block-breaker/BlockBreakerGame.ts +0 -459
  263. package/src/games/block-breaker/BlockBreakerScene.ts +0 -257
  264. package/src/games/bluk/Bluk.tsx +0 -82
  265. package/src/games/bluk/BlukConstants.ts +0 -121
  266. package/src/games/bluk/BlukGame.ts +0 -323
  267. package/src/games/bluk/BlukRules.ts +0 -154
  268. package/src/games/bluk/BlukScene.ts +0 -514
  269. package/src/games/bubble-shooter/BubbleShooter.tsx +0 -76
  270. package/src/games/bubble-shooter/BubbleShooterConstants.ts +0 -103
  271. package/src/games/bubble-shooter/BubbleShooterGame.ts +0 -459
  272. package/src/games/bubble-shooter/BubbleShooterScene.ts +0 -158
  273. package/src/games/candy-crush/CandyCrush.tsx +0 -77
  274. package/src/games/candy-crush/CandyCrushConstants.ts +0 -94
  275. package/src/games/candy-crush/CandyCrushGame.ts +0 -477
  276. package/src/games/candy-crush/CandyCrushScene.ts +0 -209
  277. package/src/games/car-racing/CarMeshes.ts +0 -440
  278. package/src/games/car-racing/CarRacing.tsx +0 -211
  279. package/src/games/car-racing/CarRacingConstants.ts +0 -167
  280. package/src/games/car-racing/CarRacingFacade.ts +0 -40
  281. package/src/games/car-racing/CarRacingGame.ts +0 -539
  282. package/src/games/car-racing/CarRacingScene.ts +0 -1026
  283. package/src/games/car-racing/CarRacingScenery.ts +0 -265
  284. package/src/games/chameleon-run/ChameleonRun.tsx +0 -96
  285. package/src/games/chameleon-run/ChameleonRunBackdrop.ts +0 -186
  286. package/src/games/chameleon-run/ChameleonRunConstants.ts +0 -47
  287. package/src/games/chameleon-run/ChameleonRunGame.ts +0 -309
  288. package/src/games/chameleon-run/ChameleonRunMeshes.ts +0 -305
  289. package/src/games/chameleon-run/ChameleonRunRules.ts +0 -252
  290. package/src/games/chameleon-run/ChameleonRunScene.ts +0 -310
  291. package/src/games/checkers/Checkers.tsx +0 -83
  292. package/src/games/checkers/CheckersAI.ts +0 -255
  293. package/src/games/checkers/CheckersConstants.ts +0 -68
  294. package/src/games/checkers/CheckersGame.ts +0 -322
  295. package/src/games/checkers/CheckersRules.ts +0 -167
  296. package/src/games/checkers/CheckersScene.ts +0 -308
  297. package/src/games/color-switch/ColorSwitch.tsx +0 -75
  298. package/src/games/color-switch/ColorSwitchConstants.ts +0 -61
  299. package/src/games/color-switch/ColorSwitchGame.ts +0 -329
  300. package/src/games/color-switch/ColorSwitchScene.ts +0 -220
  301. package/src/games/colors-sort/ColorsSort.tsx +0 -82
  302. package/src/games/colors-sort/ColorsSortConstants.ts +0 -119
  303. package/src/games/colors-sort/ColorsSortGame.ts +0 -246
  304. package/src/games/colors-sort/ColorsSortScene.ts +0 -315
  305. package/src/games/connect-em-all/ConnectEmAll.tsx +0 -70
  306. package/src/games/connect-em-all/ConnectEmAllConstants.ts +0 -77
  307. package/src/games/connect-em-all/ConnectEmAllGame.ts +0 -401
  308. package/src/games/connect-em-all/ConnectEmAllScene.ts +0 -235
  309. package/src/games/crossy-road/CrossyRoad.tsx +0 -74
  310. package/src/games/crossy-road/CrossyRoadCamera.ts +0 -59
  311. package/src/games/crossy-road/CrossyRoadConstants.ts +0 -132
  312. package/src/games/crossy-road/CrossyRoadGame.ts +0 -293
  313. package/src/games/crossy-road/CrossyRoadMeshes.ts +0 -195
  314. package/src/games/crossy-road/CrossyRoadPerson.ts +0 -198
  315. package/src/games/crossy-road/CrossyRoadRules.ts +0 -99
  316. package/src/games/crossy-road/CrossyRoadScene.ts +0 -355
  317. package/src/games/dino-jump/DinoJump.tsx +0 -77
  318. package/src/games/dino-jump/DinoJumpConstants.ts +0 -80
  319. package/src/games/dino-jump/DinoJumpGame.ts +0 -344
  320. package/src/games/dino-jump/DinoJumpScene.ts +0 -686
  321. package/src/games/dots-and-boxes/DotsAndBoxes.tsx +0 -83
  322. package/src/games/dots-and-boxes/DotsAndBoxesConstants.ts +0 -77
  323. package/src/games/dots-and-boxes/DotsAndBoxesGame.ts +0 -271
  324. package/src/games/dots-and-boxes/DotsAndBoxesScene.ts +0 -249
  325. package/src/games/falling-sticks/FallingSticks.tsx +0 -72
  326. package/src/games/falling-sticks/FallingSticksConstants.ts +0 -62
  327. package/src/games/falling-sticks/FallingSticksGame.ts +0 -220
  328. package/src/games/falling-sticks/FallingSticksRules.ts +0 -145
  329. package/src/games/falling-sticks/FallingSticksScene.ts +0 -245
  330. package/src/games/find-different-number/FindDifferentNumber.tsx +0 -74
  331. package/src/games/find-different-number/FindDifferentNumberConstants.ts +0 -74
  332. package/src/games/find-different-number/FindDifferentNumberGame.ts +0 -174
  333. package/src/games/find-different-number/FindDifferentNumberRules.ts +0 -43
  334. package/src/games/find-different-number/FindDifferentNumberScene.ts +0 -193
  335. package/src/games/flappy-bird/FlappyBird.tsx +0 -73
  336. package/src/games/flappy-bird/FlappyBirdConstants.ts +0 -95
  337. package/src/games/flappy-bird/FlappyBirdGame.ts +0 -375
  338. package/src/games/flappy-bird/FlappyBirdScene.ts +0 -630
  339. package/src/games/fruit-merger/FruitMerger.tsx +0 -73
  340. package/src/games/fruit-merger/FruitMergerConstants.ts +0 -102
  341. package/src/games/fruit-merger/FruitMergerGame.ts +0 -285
  342. package/src/games/fruit-merger/FruitMergerRules.ts +0 -286
  343. package/src/games/fruit-merger/FruitMergerScene.ts +0 -498
  344. package/src/games/fruit-ninja/FruitNinja.tsx +0 -129
  345. package/src/games/fruit-ninja/FruitNinjaConstants.ts +0 -107
  346. package/src/games/fruit-ninja/FruitNinjaGame.ts +0 -391
  347. package/src/games/fruit-ninja/FruitNinjaScene.ts +0 -319
  348. package/src/games/fruit-ninja/FruitNinjaWorld.ts +0 -17
  349. package/src/games/game-2048/Game2048.tsx +0 -84
  350. package/src/games/game-2048/Game2048Constants.ts +0 -68
  351. package/src/games/game-2048/Game2048Game.ts +0 -181
  352. package/src/games/game-2048/Game2048Rules.ts +0 -101
  353. package/src/games/game-2048/Game2048Scene.ts +0 -206
  354. package/src/games/knife-hit/KnifeHit.tsx +0 -78
  355. package/src/games/knife-hit/KnifeHitConstants.ts +0 -89
  356. package/src/games/knife-hit/KnifeHitGame.ts +0 -264
  357. package/src/games/knife-hit/KnifeHitScene.ts +0 -360
  358. package/src/games/ludo-king/LudoKing.tsx +0 -86
  359. package/src/games/ludo-king/LudoKingConstants.ts +0 -212
  360. package/src/games/ludo-king/LudoKingGame.ts +0 -326
  361. package/src/games/ludo-king/LudoKingRules.ts +0 -143
  362. package/src/games/ludo-king/LudoKingScene.ts +0 -397
  363. package/src/games/maze-runner/MazeRunner.tsx +0 -88
  364. package/src/games/maze-runner/MazeRunnerConstants.ts +0 -65
  365. package/src/games/maze-runner/MazeRunnerGame.ts +0 -176
  366. package/src/games/maze-runner/MazeRunnerRules.ts +0 -161
  367. package/src/games/maze-runner/MazeRunnerScene.ts +0 -245
  368. package/src/games/memory-match/MemoryMatch.tsx +0 -77
  369. package/src/games/memory-match/MemoryMatchConstants.ts +0 -105
  370. package/src/games/memory-match/MemoryMatchGame.ts +0 -222
  371. package/src/games/memory-match/MemoryMatchRules.ts +0 -38
  372. package/src/games/memory-match/MemoryMatchScene.ts +0 -268
  373. package/src/games/mine-sweeper/MineSweeper.tsx +0 -77
  374. package/src/games/mine-sweeper/MineSweeperConstants.ts +0 -94
  375. package/src/games/mine-sweeper/MineSweeperGame.ts +0 -234
  376. package/src/games/mine-sweeper/MineSweeperRules.ts +0 -67
  377. package/src/games/mine-sweeper/MineSweeperScene.ts +0 -262
  378. package/src/games/mob-control/MobControl.tsx +0 -73
  379. package/src/games/mob-control/MobControlConstants.ts +0 -106
  380. package/src/games/mob-control/MobControlGame.ts +0 -176
  381. package/src/games/mob-control/MobControlMeshes.ts +0 -85
  382. package/src/games/mob-control/MobControlRenderer.ts +0 -108
  383. package/src/games/mob-control/MobControlRules.ts +0 -522
  384. package/src/games/mob-control/MobControlScene.ts +0 -399
  385. package/src/games/number-search/NumberSearch.tsx +0 -18
  386. package/src/games/number-search/NumberSearchNumbers.ts +0 -623
  387. package/src/games/nuts-and-bolts/NutsAndBolts.tsx +0 -85
  388. package/src/games/nuts-and-bolts/NutsAndBoltsConstants.ts +0 -75
  389. package/src/games/nuts-and-bolts/NutsAndBoltsGame.ts +0 -298
  390. package/src/games/nuts-and-bolts/NutsAndBoltsRules.ts +0 -474
  391. package/src/games/nuts-and-bolts/NutsAndBoltsScene.ts +0 -498
  392. package/src/games/pac-man/PacMan.tsx +0 -86
  393. package/src/games/pac-man/PacManConstants.ts +0 -169
  394. package/src/games/pac-man/PacManGame.ts +0 -406
  395. package/src/games/pac-man/PacManRules.ts +0 -255
  396. package/src/games/pac-man/PacManScene.ts +0 -387
  397. package/src/games/paper-io/PaperIo.tsx +0 -91
  398. package/src/games/paper-io/PaperIoConstants.ts +0 -86
  399. package/src/games/paper-io/PaperIoGame.ts +0 -193
  400. package/src/games/paper-io/PaperIoMeshes.ts +0 -233
  401. package/src/games/paper-io/PaperIoRules.ts +0 -315
  402. package/src/games/paper-io/PaperIoScene.ts +0 -310
  403. package/src/games/penguin-run/PenguinMeshes.ts +0 -269
  404. package/src/games/penguin-run/PenguinModel.ts +0 -712
  405. package/src/games/penguin-run/PenguinRun.tsx +0 -77
  406. package/src/games/penguin-run/PenguinRunConstants.ts +0 -69
  407. package/src/games/penguin-run/PenguinRunGame.ts +0 -406
  408. package/src/games/penguin-run/PenguinRunScene.ts +0 -949
  409. package/src/games/perfect-circle/PerfectCircle.tsx +0 -74
  410. package/src/games/perfect-circle/PerfectCircleConstants.ts +0 -52
  411. package/src/games/perfect-circle/PerfectCircleGame.ts +0 -153
  412. package/src/games/perfect-circle/PerfectCircleRules.ts +0 -111
  413. package/src/games/perfect-circle/PerfectCircleScene.ts +0 -176
  414. package/src/games/pipe-connect/PipeConnect.tsx +0 -69
  415. package/src/games/pipe-connect/PipeConnectConstants.ts +0 -101
  416. package/src/games/pipe-connect/PipeConnectGame.ts +0 -179
  417. package/src/games/pipe-connect/PipeConnectRules.ts +0 -326
  418. package/src/games/pipe-connect/PipeConnectScene.ts +0 -271
  419. package/src/games/play-with-tua/PlayWithTua.tsx +0 -123
  420. package/src/games/play-with-tua/PlayWithTuaConstants.ts +0 -70
  421. package/src/games/play-with-tua/PlayWithTuaGame.ts +0 -167
  422. package/src/games/play-with-tua/PlayWithTuaModel.ts +0 -42
  423. package/src/games/play-with-tua/PlayWithTuaScene.ts +0 -36
  424. package/src/games/popit-fidget/PopitFidget.tsx +0 -72
  425. package/src/games/popit-fidget/PopitFidgetConstants.ts +0 -71
  426. package/src/games/popit-fidget/PopitFidgetGame.ts +0 -148
  427. package/src/games/popit-fidget/PopitFidgetScene.ts +0 -242
  428. package/src/games/reversi/Reversi.tsx +0 -94
  429. package/src/games/reversi/ReversiConstants.ts +0 -67
  430. package/src/games/reversi/ReversiGame.ts +0 -266
  431. package/src/games/reversi/ReversiRules.ts +0 -176
  432. package/src/games/reversi/ReversiScene.ts +0 -240
  433. package/src/games/search-grid/SearchGrid.tsx +0 -92
  434. package/src/games/search-grid/SearchGridConstants.ts +0 -178
  435. package/src/games/search-grid/SearchGridGame.ts +0 -209
  436. package/src/games/search-grid/SearchGridScene.ts +0 -301
  437. package/src/games/shared/BackdropCard.tsx +0 -54
  438. package/src/games/shared/EngineBackdrop.ts +0 -300
  439. package/src/games/shared/EngineBlasts.ts +0 -136
  440. package/src/games/shared/EngineBlocks.ts +0 -91
  441. package/src/games/shared/EngineControlText.ts +0 -17
  442. package/src/games/shared/EngineDice.ts +0 -250
  443. package/src/games/shared/EngineFootprint.ts +0 -35
  444. package/src/games/shared/EngineFruits.ts +0 -1435
  445. package/src/games/shared/EngineGameLoader.tsx +0 -88
  446. package/src/games/shared/EngineGameScreen.tsx +0 -325
  447. package/src/games/shared/EngineGameWidth.ts +0 -3
  448. package/src/games/shared/EngineGameWidth.web.ts +0 -3
  449. package/src/games/shared/EngineGlyphs.ts +0 -178
  450. package/src/games/shared/EngineHud.ts +0 -815
  451. package/src/games/shared/EngineLoading.ts +0 -477
  452. package/src/games/shared/EngineMeadow.ts +0 -725
  453. package/src/games/shared/EngineMeshCache.ts +0 -15
  454. package/src/games/shared/EngineMeshes.ts +0 -10
  455. package/src/games/shared/EngineRacingChase.ts +0 -21
  456. package/src/games/shared/EngineRacingHandling.ts +0 -48
  457. package/src/games/shared/EngineReadyContext.ts +0 -4
  458. package/src/games/shared/EngineTilt.ts +0 -44
  459. package/src/games/shared/EngineTouchSurface.tsx +0 -103
  460. package/src/games/shared/EngineUtils.ts +0 -52
  461. package/src/games/shared/GameActivity.ts +0 -13
  462. package/src/games/shared/GameLoading.tsx +0 -202
  463. package/src/games/shared/GameLoadingTransition.tsx +0 -61
  464. package/src/games/shared/ProceduralCacheVersion.ts +0 -2
  465. package/src/games/shared/useEngineGame.ts +0 -240
  466. package/src/games/shared/useGameResource.ts +0 -21
  467. package/src/games/shared/useLiveState.ts +0 -58
  468. package/src/games/sliding-numbers/SlidingNumbers.tsx +0 -71
  469. package/src/games/sliding-numbers/SlidingNumbersConstants.ts +0 -65
  470. package/src/games/sliding-numbers/SlidingNumbersGame.ts +0 -192
  471. package/src/games/sliding-numbers/SlidingNumbersRules.ts +0 -79
  472. package/src/games/sliding-numbers/SlidingNumbersScene.ts +0 -193
  473. package/src/games/snake-3d/Snake3D.tsx +0 -76
  474. package/src/games/snake-3d/Snake3DConstants.ts +0 -61
  475. package/src/games/snake-3d/Snake3DGame.ts +0 -192
  476. package/src/games/snake-3d/Snake3DMotion.ts +0 -22
  477. package/src/games/snake-3d/Snake3DRules.ts +0 -116
  478. package/src/games/snake-3d/Snake3DScene.ts +0 -322
  479. package/src/games/snakes-and-ladders/SnakesAndLadders.tsx +0 -87
  480. package/src/games/snakes-and-ladders/SnakesAndLaddersConstants.ts +0 -136
  481. package/src/games/snakes-and-ladders/SnakesAndLaddersGame.ts +0 -310
  482. package/src/games/snakes-and-ladders/SnakesAndLaddersScene.ts +0 -515
  483. package/src/games/space-fighter/SpaceFighter.tsx +0 -74
  484. package/src/games/space-fighter/SpaceFighterConstants.ts +0 -86
  485. package/src/games/space-fighter/SpaceFighterGame.ts +0 -292
  486. package/src/games/space-fighter/SpaceFighterScene.ts +0 -550
  487. package/src/games/spider-solitaire/SpiderSolitaire.tsx +0 -80
  488. package/src/games/spider-solitaire/SpiderSolitaireConstants.ts +0 -107
  489. package/src/games/spider-solitaire/SpiderSolitaireGame.ts +0 -387
  490. package/src/games/spider-solitaire/SpiderSolitaireRules.ts +0 -123
  491. package/src/games/spider-solitaire/SpiderSolitaireScene.ts +0 -352
  492. package/src/games/stack-tower/StackTower.tsx +0 -76
  493. package/src/games/stack-tower/StackTowerConstants.ts +0 -74
  494. package/src/games/stack-tower/StackTowerGame.ts +0 -236
  495. package/src/games/stack-tower/StackTowerScene.ts +0 -186
  496. package/src/games/sudoku/Sudoku.tsx +0 -73
  497. package/src/games/sudoku/SudokuConstants.ts +0 -127
  498. package/src/games/sudoku/SudokuGame.ts +0 -250
  499. package/src/games/sudoku/SudokuRules.ts +0 -125
  500. package/src/games/sudoku/SudokuScene.ts +0 -304
  501. package/src/games/tangram/Tangram.tsx +0 -79
  502. package/src/games/tangram/TangramConstants.ts +0 -64
  503. package/src/games/tangram/TangramGame.ts +0 -356
  504. package/src/games/tangram/TangramRules.ts +0 -409
  505. package/src/games/tangram/TangramScene.ts +0 -203
  506. package/src/games/tank-1990/Tank1990.tsx +0 -78
  507. package/src/games/tank-1990/Tank1990Constants.ts +0 -81
  508. package/src/games/tank-1990/Tank1990Game.ts +0 -331
  509. package/src/games/tank-1990/Tank1990Rules.ts +0 -390
  510. package/src/games/tank-1990/Tank1990Scene.ts +0 -434
  511. package/src/games/tic-tac-toe/TicTacToe.tsx +0 -98
  512. package/src/games/tic-tac-toe/TicTacToeConstants.ts +0 -69
  513. package/src/games/tic-tac-toe/TicTacToeGame.ts +0 -200
  514. package/src/games/tic-tac-toe/TicTacToeRules.ts +0 -103
  515. package/src/games/tic-tac-toe/TicTacToeScene.ts +0 -245
  516. package/src/games/tile-home/TileHome.tsx +0 -92
  517. package/src/games/tile-home/TileHomeConstants.ts +0 -139
  518. package/src/games/tile-home/TileHomeGame.ts +0 -435
  519. package/src/games/tile-home/TileHomeScene.ts +0 -154
  520. package/src/games/treasure-hunt/TreasureHunt.tsx +0 -206
  521. package/src/games/treasure-hunt/TreasureHuntConstants.ts +0 -266
  522. package/src/games/treasure-hunt/TreasureHuntControls.ts +0 -280
  523. package/src/games/treasure-hunt/TreasureHuntGame.ts +0 -402
  524. package/src/games/treasure-hunt/TreasureHuntMeshes.ts +0 -422
  525. package/src/games/treasure-hunt/TreasureHuntModel.ts +0 -506
  526. package/src/games/treasure-hunt/TreasureHuntRules.ts +0 -1210
  527. package/src/games/treasure-hunt/TreasureHuntScene.ts +0 -586
  528. package/src/games/whack-a-mole/WhackAMole.tsx +0 -79
  529. package/src/games/whack-a-mole/WhackAMoleConstants.ts +0 -94
  530. package/src/games/whack-a-mole/WhackAMoleGame.ts +0 -233
  531. package/src/games/whack-a-mole/WhackAMoleScene.ts +0 -349
  532. package/src/games/word-search/WordSearch.tsx +0 -18
  533. package/src/games/word-search/WordSearchWords.ts +0 -1642
  534. package/src/helpers/GamePatternData.ts +0 -120
  535. package/src/helpers/GameSettingsModal.tsx +0 -384
  536. package/src/helpers/GameTheme.tsx +0 -37
  537. package/src/helpers/IconPaths.ts +0 -6
  538. package/src/helpers/index.ts +0 -2
  539. package/src/index.tsx +0 -60
  540. package/src/services/GameAssetLoader.ts +0 -111
  541. package/src/services/GameAssets.ts +0 -149
  542. package/src/services/GameLoaders.ts +0 -93
  543. package/src/services/GamesConstants.ts +0 -193
  544. package/src/services/GamesMetadata.ts +0 -711
  545. package/src/services/GamesService.ts +0 -116
  546. package/src/services/HapticsService.ts +0 -48
  547. package/src/services/ScoringService.ts +0 -19
  548. package/src/services/SfxSources.ts +0 -81
  549. package/src/services/SoundsService.ts +0 -582
  550. package/src/services/ThemeService.ts +0 -281
  551. package/src/services/UtilsService.ts +0 -134
  552. package/src/services/index.ts +0 -6
@@ -1 +1 @@
1
- "use strict";import{ellipsoid,extrude,loft,merge,Path,smoothCurve,tube}from"@nayan-ui/engine";import{cacheGameAsset,createGameMesh as _0x482b57}from"../shared/EngineMeshes.js";const meshes=new Map,cached=(e,t)=>{let o=meshes.get(e);return!o&&(o=cacheGameAsset("chameleon-run/ChameleonRunMeshes:"+e,t),meshes.set(e,o)),o},clamp=(e,t,o)=>Math.max(t,Math.min(o,e)),hash=(e,t,o)=>{const s=43758.5453*Math.sin(127.1*e+311.7*t+74.7*o);return s-Math.floor(s)},normalize=e=>{const t=Math.hypot(...e)||1;return[e[0]/t,e[1]/t,e[2]/t]},cross=(e,t)=>[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]],ball=(e,t,o=[1,1,1],s=20)=>({geometry:ellipsoid(t,o,s),position:e});function skin(e,t=!1){const o=e.vertices;for(let e=0;e<o.length;e+=11){const s=o[e],r=o[e+1],a=o[e+2],h=hash(Math.floor(95*s),Math.floor(95*r),Math.floor(95*a)),i=hash(Math.floor(24*s),Math.floor(24*r),Math.floor(24*a)),n=t?Math.exp(-(Math.sin(12*(s+.08)+2.5*r)**2)/.12):0,l=clamp(.94+.06*i+.025*(h-.5)-.15*n,.75,1);o[e+6]=l,o[e+7]=.985*l,o[e+8]=.94*l,o[e+9]=0,o[e+10]=0}return e}function granules(e,t=4,o=.0065,s=.0012){const r=[],a=[];for(let h=0;h<e.vertices.length;h+=11*t){const t=e.vertices,i=[t[h],t[h+1],t[h+2]],n=normalize([t[h+3],t[h+4],t[h+5]]),l=normalize(cross(n,Math.abs(n[1])>.9?[1,0,0]:[0,1,0])),d=cross(n,l),u=o*(.7+.6*hash(...i)),m=r.length/11,p=[1.025*t[h+6],1.025*t[h+7],1.025*t[h+8]];r.push(i[0]+n[0]*s,i[1]+n[1]*s,i[2]+n[2]*s,...n,...p,t[h+9],t[h+10]);for(let e=0;e<6;e++){const t=e*Math.PI/3,o=[0,1,2].map(e=>(l[e]*Math.cos(t)+d[e]*Math.sin(t))*u),s=normalize([n[0]+o[0]/u*.22,n[1]+o[1]/u*.22,n[2]+o[2]/u*.22]);r.push(i[0]+o[0],i[1]+o[1],i[2]+o[2],...s,.86*p[0],.86*p[1],.86*p[2],0,0),a.push(m,m+1+e,m+1+(e+1)%6)}}return{vertices:Float32Array.from(r),indices:Uint32Array.from(a)}}function alongBody(e){const t=loft(e,{around:36,smoothness:4});for(let e=0;e<t.vertices.length;e+=11){const o=t.vertices[e],s=t.vertices[e+3];t.vertices[e]=t.vertices[e+2],t.vertices[e+2]=-o,t.vertices[e+3]=t.vertices[e+5],t.vertices[e+5]=-s}return skin(t,!0)}function crestTooth(e,t,o){const s=Math.abs(o);return{geometry:loft([{z:-.013,bottom:0,top:.15*s,width:.46*s,square:2},{z:0,bottom:0,top:s,width:.36*s,topWidth:.001,square:2},{z:.013,bottom:0,top:.15*s,width:.46*s,square:2}],{around:10,smoothness:1,color:[.66,.68,.62]}),position:[e,t,0],rotation:o<0?[0,0,1,0]:[0,0,0,1]}}export const bodyMesh=()=>cached("body-realistic",()=>{const e=[{z:-.54,bottom:-.07,top:.08,width:.035,square:2},{z:-.43,bottom:-.17,top:.2,width:.105,square:2},{z:-.22,bottom:-.25,top:.3,width:.165,square:2},{z:.02,bottom:-.24,top:.33,width:.175,square:2},{z:.21,bottom:-.18,top:.27,width:.14,square:2},{z:.36,bottom:-.1,top:.19,width:.105,square:2},{z:.44,bottom:-.055,top:.15,width:.08,square:2}],t=alongBody(e),o=smoothCurve(e.map(e=>[e.z,e.top])),s=alongBody([{z:.29,bottom:-.02,top:.18,width:.075,square:2.2},{z:.36,bottom:-.065,top:.33,width:.125,topWidth:.035,square:2.2},{z:.44,bottom:-.075,top:.59,width:.14,topWidth:.016,square:2.4},{z:.5,bottom:-.075,top:.65,width:.135,topWidth:.014,square:2.4},{z:.56,bottom:-.07,top:.39,width:.14,topWidth:.055,square:2.2},{z:.66,bottom:-.06,top:.2,width:.125,square:2},{z:.78,bottom:-.03,top:.13,width:.08,square:2},{z:.835,bottom:.005,top:.08,width:.015,square:2}]),r=[{geometry:t},{geometry:granules(t,3)},{geometry:s},{geometry:granules(s,3,.003,8e-4)}];for(let e=0;e<17;e++){const t=.044*e-.44,s=o(t)-.014;r.push(crestTooth(t,s,.033+.022*Math.sin(e/16*Math.PI)))}return _0x482b57(merge(r),{center:!1,shine:.14})});export const detailsMesh=()=>cached("details-realistic",()=>{const e=[ball([-.01,-.225,0],[.31,.038,.12],[.58,.59,.45],28),ball([.46,-.06,0],[.15,.035,.075],[.64,.63,.49])];for(const t of[-1,1])e.push({geometry:tube([[.4,-.015,.123*t],[.54,-.016,.14*t],[.69,.002,.113*t],[.815,.026,.045*t]],{radius:.0038,sides:5,smoothness:3,color:[.18,.2,.14]})}),e.push(ball([.758,.098,.074*t],[.012,.008,.006],[.13,.16,.11],12)),e.push({geometry:tube([[-.41,-.045,.108*t],[-.22,-.058,.163*t],[.01,-.045,.177*t],[.19,-.03,.14*t],[.31,.015,.113*t]],{radius:e=>.004+.004*Math.sin(e*Math.PI),sides:5,smoothness:3,color:[.77,.76,.6]})});for(let t=0;t<6;t++)e.push(crestTooth(.35+.047*t,-.062,-.018));return _0x482b57(merge(e),{center:!1,shine:.12})});export const eyeMesh=()=>cached("eye-lid-realistic",()=>{const e=skin(ellipsoid([.086,.086,.074],void 0,32)),t=[];for(let e=0;e<=24;e++){const o=e/24*Math.PI*2;t.push([.027*Math.cos(o),.027*Math.sin(o),.071])}return _0x482b57(merge([{geometry:e},{geometry:granules(e,3,.0024,6e-4)},{geometry:tube(t,{radius:.003,sides:5,smoothness:1,color:[.62,.65,.56]})}]),{center:!1,shine:.15})});export const eyeDetailsMesh=()=>cached("eye-aperture-realistic",()=>_0x482b57(merge([ball([0,0,.074],[.025,.025,.006],[.39,.32,.15],24),ball([.002,0,.08],[.011,.011,.003],[.025,.035,.02],24),ball([.005,.005,.083],[.003,.003,.001],[1.1,1.1,1.05],12)]),{center:!1,shine:.5}));export const tailMesh=()=>cached("tail-realistic",()=>{const e=[[0,0,0],[-.16,-.015,0],[-.29,.03,0]];for(let t=0;t<=48;t++){const o=t/48,s=Math.PI/2+o*Math.PI*2.5,r=.26*(1-.83*o);e.push([Math.cos(s)*r-.42,Math.sin(s)*r-.2,0])}const t=skin(tube(e,{radius:e=>.068*(1-e)**1.15+.008,sides:12,smoothness:2,caps:!0}),!0);return _0x482b57(merge([{geometry:t},{geometry:granules(t,10,.0025,7e-4)}]),{center:!1,shine:.13})});export const LIMBS=[{x:.28,y:-.1,side:1,hind:!1},{x:.28,y:-.1,side:-1,hind:!1},{x:-.3,y:-.09,side:1,hind:!0},{x:-.3,y:-.09,side:-1,hind:!0}];export const legMesh=(e,t=!1)=>cached("leg-realistic-"+e+"-"+t,()=>{const o=[t?.12:-.1,-.16,.16*e],s=[t?-.065:.07,-.36,.14*e],r=skin(tube([[0,0,0],o,s],{radius:e=>.054-.03*e,sides:12,smoothness:5,caps:!0}),!1),a=[{geometry:r},{geometry:granules(r,5,.0025,7e-4)},ball(o,[.041,.046,.043],[.84,.85,.78]),ball([s[0],-.374,s[2]],[.052,.023,.041],[.87,.88,.8])];for(const o of[-1,1]){const r=o===e!==t?2:3;for(let e=0;e<r;e++){const t=.019*(e-(r-1)/2),h=[s[0]+.047+t,-.385,s[2]+.048*o];a.push({geometry:tube([[s[0],-.37,s[2]],[s[0]+.025+t,-.372,s[2]+.035*o],h],{radius:e=>.013-.006*e,sides:6,smoothness:2,caps:!0,color:[.85,.86,.77]})}),a.push({geometry:tube([h,[h[0]+.016,-.399,h[2]-.008*o]],{radius:e=>.006*(1-e)+.001,sides:5,smoothness:1,color:[.3,.27,.19]})})}}return _0x482b57(merge(a),{center:!1,shine:.12})});export const starMesh=()=>cached("star",()=>_0x482b57(extrude((new Path).addStar(0,0,.5,.23),{depth:.18}),{fit:1,shine:.85}));export function*warmAssets(){yield bodyMesh,yield detailsMesh,yield eyeMesh,yield eyeDetailsMesh,yield tailMesh,yield starMesh;for(const e of[-1,1])for(const t of[!1,!0])yield()=>legMesh(e,t)}
1
+ "use strict";import{ellipsoid,extrude,loft,merge,Path,smoothCurve,tube}from"@nayan-ui/engine";import{cacheGameAsset,createGameMesh as _0x138471}from"../shared/EngineMeshes.js";const meshes=new Map,cached=(e,t)=>{let o=meshes.get(e);return!o&&(o=cacheGameAsset("chameleon-run/ChameleonRunMeshes:"+e,t),meshes.set(e,o)),o},clamp=(e,t,o)=>Math.max(t,Math.min(o,e)),hash=(e,t,o)=>{const s=43758.5453*Math.sin(127.1*e+311.7*t+74.7*o);return s-Math.floor(s)},normalize=e=>{const t=Math.hypot(...e)||1;return[e[0]/t,e[1]/t,e[2]/t]},cross=(e,t)=>[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]],ball=(e,t,o=[1,1,1],s=20)=>({geometry:ellipsoid(t,o,s),position:e});function skin(e,t=!1){const o=e.vertices;for(let e=0;e<o.length;e+=11){const s=o[e],r=o[e+1],a=o[e+2],h=hash(Math.floor(95*s),Math.floor(95*r),Math.floor(95*a)),i=hash(Math.floor(24*s),Math.floor(24*r),Math.floor(24*a)),n=t?Math.exp(-(Math.sin(12*(s+.08)+2.5*r)**2)/.12):0,l=clamp(.94+.06*i+.025*(h-.5)-.15*n,.75,1);o[e+6]=l,o[e+7]=.985*l,o[e+8]=.94*l,o[e+9]=0,o[e+10]=0}return e}function granules(e,t=4,o=.0065,s=.0012){const r=[],a=[];for(let h=0;h<e.vertices.length;h+=11*t){const t=e.vertices,i=[t[h],t[h+1],t[h+2]],n=normalize([t[h+3],t[h+4],t[h+5]]),l=normalize(cross(n,Math.abs(n[1])>.9?[1,0,0]:[0,1,0])),d=cross(n,l),u=o*(.7+.6*hash(...i)),m=r.length/11,p=[1.025*t[h+6],1.025*t[h+7],1.025*t[h+8]];r.push(i[0]+n[0]*s,i[1]+n[1]*s,i[2]+n[2]*s,...n,...p,t[h+9],t[h+10]);for(let e=0;e<6;e++){const t=e*Math.PI/3,o=[0,1,2].map(e=>(l[e]*Math.cos(t)+d[e]*Math.sin(t))*u),s=normalize([n[0]+o[0]/u*.22,n[1]+o[1]/u*.22,n[2]+o[2]/u*.22]);r.push(i[0]+o[0],i[1]+o[1],i[2]+o[2],...s,.86*p[0],.86*p[1],.86*p[2],0,0),a.push(m,m+1+e,m+1+(e+1)%6)}}return{vertices:Float32Array.from(r),indices:Uint32Array.from(a)}}function alongBody(e){const t=loft(e,{around:36,smoothness:4});for(let e=0;e<t.vertices.length;e+=11){const o=t.vertices[e],s=t.vertices[e+3];t.vertices[e]=t.vertices[e+2],t.vertices[e+2]=-o,t.vertices[e+3]=t.vertices[e+5],t.vertices[e+5]=-s}return skin(t,!0)}function crestTooth(e,t,o){const s=Math.abs(o);return{geometry:loft([{z:-.013,bottom:0,top:.15*s,width:.46*s,square:2},{z:0,bottom:0,top:s,width:.36*s,topWidth:.001,square:2},{z:.013,bottom:0,top:.15*s,width:.46*s,square:2}],{around:10,smoothness:1,color:[.66,.68,.62]}),position:[e,t,0],rotation:o<0?[0,0,1,0]:[0,0,0,1]}}export const bodyMesh=()=>cached("body-realistic",()=>{const e=[{z:-.54,bottom:-.07,top:.08,width:.035,square:2},{z:-.43,bottom:-.17,top:.2,width:.105,square:2},{z:-.22,bottom:-.25,top:.3,width:.165,square:2},{z:.02,bottom:-.24,top:.33,width:.175,square:2},{z:.21,bottom:-.18,top:.27,width:.14,square:2},{z:.36,bottom:-.1,top:.19,width:.105,square:2},{z:.44,bottom:-.055,top:.15,width:.08,square:2}],t=alongBody(e),o=smoothCurve(e.map(e=>[e.z,e.top])),s=alongBody([{z:.29,bottom:-.02,top:.18,width:.075,square:2.2},{z:.36,bottom:-.065,top:.33,width:.125,topWidth:.035,square:2.2},{z:.44,bottom:-.075,top:.59,width:.14,topWidth:.016,square:2.4},{z:.5,bottom:-.075,top:.65,width:.135,topWidth:.014,square:2.4},{z:.56,bottom:-.07,top:.39,width:.14,topWidth:.055,square:2.2},{z:.66,bottom:-.06,top:.2,width:.125,square:2},{z:.78,bottom:-.03,top:.13,width:.08,square:2},{z:.835,bottom:.005,top:.08,width:.015,square:2}]),r=[{geometry:t},{geometry:granules(t,3)},{geometry:s},{geometry:granules(s,3,.003,8e-4)}];for(let e=0;e<17;e++){const t=.044*e-.44,s=o(t)-.014;r.push(crestTooth(t,s,.033+.022*Math.sin(e/16*Math.PI)))}return _0x138471(merge(r),{center:!1,shine:.14})});export const detailsMesh=()=>cached("details-realistic",()=>{const e=[ball([-.01,-.225,0],[.31,.038,.12],[.58,.59,.45],28),ball([.46,-.06,0],[.15,.035,.075],[.64,.63,.49])];for(const t of[-1,1])e.push({geometry:tube([[.4,-.015,.123*t],[.54,-.016,.14*t],[.69,.002,.113*t],[.815,.026,.045*t]],{radius:.0038,sides:5,smoothness:3,color:[.18,.2,.14]})}),e.push(ball([.758,.098,.074*t],[.012,.008,.006],[.13,.16,.11],12)),e.push({geometry:tube([[-.41,-.045,.108*t],[-.22,-.058,.163*t],[.01,-.045,.177*t],[.19,-.03,.14*t],[.31,.015,.113*t]],{radius:e=>.004+.004*Math.sin(e*Math.PI),sides:5,smoothness:3,color:[.77,.76,.6]})});for(let t=0;t<6;t++)e.push(crestTooth(.35+.047*t,-.062,-.018));return _0x138471(merge(e),{center:!1,shine:.12})});export const eyeMesh=()=>cached("eye-lid-realistic",()=>{const e=skin(ellipsoid([.086,.086,.074],void 0,32)),t=[];for(let e=0;e<=24;e++){const o=e/24*Math.PI*2;t.push([.027*Math.cos(o),.027*Math.sin(o),.071])}return _0x138471(merge([{geometry:e},{geometry:granules(e,3,.0024,6e-4)},{geometry:tube(t,{radius:.003,sides:5,smoothness:1,color:[.62,.65,.56]})}]),{center:!1,shine:.15})});export const eyeDetailsMesh=()=>cached("eye-aperture-realistic",()=>_0x138471(merge([ball([0,0,.074],[.025,.025,.006],[.39,.32,.15],24),ball([.002,0,.08],[.011,.011,.003],[.025,.035,.02],24),ball([.005,.005,.083],[.003,.003,.001],[1.1,1.1,1.05],12)]),{center:!1,shine:.5}));export const tailMesh=()=>cached("tail-realistic",()=>{const e=[[0,0,0],[-.16,-.015,0],[-.29,.03,0]];for(let t=0;t<=48;t++){const o=t/48,s=Math.PI/2+o*Math.PI*2.5,r=.26*(1-.83*o);e.push([Math.cos(s)*r-.42,Math.sin(s)*r-.2,0])}const t=skin(tube(e,{radius:e=>.068*(1-e)**1.15+.008,sides:12,smoothness:2,caps:!0}),!0);return _0x138471(merge([{geometry:t},{geometry:granules(t,10,.0025,7e-4)}]),{center:!1,shine:.13})});export const LIMBS=[{x:.28,y:-.1,side:1,hind:!1},{x:.28,y:-.1,side:-1,hind:!1},{x:-.3,y:-.09,side:1,hind:!0},{x:-.3,y:-.09,side:-1,hind:!0}];export const legMesh=(e,t=!1)=>cached("leg-realistic-"+e+"-"+t,()=>{const o=[t?.12:-.1,-.16,.16*e],s=[t?-.065:.07,-.36,.14*e],r=skin(tube([[0,0,0],o,s],{radius:e=>.054-.03*e,sides:12,smoothness:5,caps:!0}),!1),a=[{geometry:r},{geometry:granules(r,5,.0025,7e-4)},ball(o,[.041,.046,.043],[.84,.85,.78]),ball([s[0],-.374,s[2]],[.052,.023,.041],[.87,.88,.8])];for(const o of[-1,1]){const r=o===e!==t?2:3;for(let e=0;e<r;e++){const t=.019*(e-(r-1)/2),h=[s[0]+.047+t,-.385,s[2]+.048*o];a.push({geometry:tube([[s[0],-.37,s[2]],[s[0]+.025+t,-.372,s[2]+.035*o],h],{radius:e=>.013-.006*e,sides:6,smoothness:2,caps:!0,color:[.85,.86,.77]})}),a.push({geometry:tube([h,[h[0]+.016,-.399,h[2]-.008*o]],{radius:e=>.006*(1-e)+.001,sides:5,smoothness:1,color:[.3,.27,.19]})})}}return _0x138471(merge(a),{center:!1,shine:.12})});export const starMesh=()=>cached("star",()=>_0x138471(extrude((new Path).addStar(0,0,.5,.23),{depth:.18}),{fit:1,shine:.85}));export function*warmAssets(){yield bodyMesh,yield detailsMesh,yield eyeMesh,yield eyeDetailsMesh,yield tailMesh,yield starMesh;for(const e of[-1,1])for(const t of[!1,!0])yield()=>legMesh(e,t)}
@@ -1 +1 @@
1
- "use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{scoreColumn,textColumn,timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{BOARD_BORDER_WIDTH,GAME_DURATION,getLayout,LIGHT}from"./CheckersConstants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,start,tick}from"./CheckersGame.js";import{HUMAN,PIECES_PER_SIDE}from"./CheckersRules.js";import{jsx as _0x16cc56}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.CHECKERS,FEEDBACK={select:{sound:SOUNDS.SELECT,haptic:HapticType.LIGHT},move:{sound:SOUNDS.MOVE,haptic:HapticType.LIGHT},capture:{sound:SOUNDS.CAPTURE,haptic:HapticType.MEDIUM},king:{sound:SOUNDS.KING},win:{sound:SOUNDS.WIN,haptic:HapticType.SUCCESS},lose:{sound:SOUNDS.LOSE,haptic:HapticType.ERROR}};export const Checkers=engineGame(GAME_IDS.CHECKERS,e=>{const[t,s]=useLiveState(0),[r,o]=useLiveState(0),[i,a]=useLiveState(GAME_DURATION),{game:n,theme:m,status:S,screen:E,gameOver:u}=useEngineGame(e,{gameId:GAME_IDS.CHECKERS,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,s,r)=>{const o=getLayout(t,s,r);return setLayout(e,o),o.size+2*BOARD_BORDER_WIDTH},drag:drag,outcome:e=>e.winner===HUMAN?"win":"lose",sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.MEDIUM),onOver:(e,t,s)=>{s.timedOut&&e(SOUNDS.TIME_UP,HapticType.ERROR)},wire:(e,t)=>{e.onScore=s,e.onCaptured=o,e.onTime=a,e.onEvent=e=>t(FEEDBACK[e].sound,FEEDBACK[e].haptic)}}),p=n.timedOut;return _0x16cc56(EngineGameScreen,{...E,light:LIGHT,columns:[scoreColumn(t),textColumn("CAPTURED",r+"/"+PIECES_PER_SIDE),timerColumn(i,m)],subtext:"Capture the robot's pieces!",gameOver:u({title:"win"===S?"YOU WON!":p?"TIME UP!":"YOU LOST!",message:"win"===S?"You beat the robot!":p?"You ran out of time!":"The robot wins this round!",scoreLabel:"Score",score:t,buttonText:"Play Again!"})})});
1
+ "use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{scoreColumn,textColumn,timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{BOARD_BORDER_WIDTH,GAME_DURATION,getLayout,LIGHT}from"./CheckersConstants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,start,tick}from"./CheckersGame.js";import{HUMAN,PIECES_PER_SIDE}from"./CheckersRules.js";import{jsx as _0xdc3114}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.CHECKERS,FEEDBACK={select:{sound:SOUNDS.SELECT,haptic:HapticType.LIGHT},move:{sound:SOUNDS.MOVE,haptic:HapticType.LIGHT},capture:{sound:SOUNDS.CAPTURE,haptic:HapticType.MEDIUM},king:{sound:SOUNDS.KING},win:{sound:SOUNDS.WIN,haptic:HapticType.SUCCESS},lose:{sound:SOUNDS.LOSE,haptic:HapticType.ERROR}};export const Checkers=engineGame(GAME_IDS.CHECKERS,e=>{const[t,s]=useLiveState(0),[r,o]=useLiveState(0),[i,a]=useLiveState(GAME_DURATION),{game:n,theme:m,status:S,screen:E,gameOver:u}=useEngineGame(e,{gameId:GAME_IDS.CHECKERS,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,s,r)=>{const o=getLayout(t,s,r);return setLayout(e,o),o.size+2*BOARD_BORDER_WIDTH},drag:drag,outcome:e=>e.winner===HUMAN?"win":"lose",sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.MEDIUM),onOver:(e,t,s)=>{s.timedOut&&e(SOUNDS.TIME_UP,HapticType.ERROR)},wire:(e,t)=>{e.onScore=s,e.onCaptured=o,e.onTime=a,e.onEvent=e=>t(FEEDBACK[e].sound,FEEDBACK[e].haptic)}}),p=n.timedOut;return _0xdc3114(EngineGameScreen,{...E,light:LIGHT,columns:[scoreColumn(t),textColumn("CAPTURED",r+"/"+PIECES_PER_SIDE),timerColumn(i,m)],subtext:"Capture the robot's pieces!",gameOver:u({title:"win"===S?"YOU WON!":p?"TIME UP!":"YOU LOST!",message:"win"===S?"You beat the robot!":p?"You ran out of time!":"The robot wins this round!",scoreLabel:"Score",score:t,buttonText:"Play Again!"})})});
@@ -1 +1 @@
1
- "use strict";import{effects,extrude,lathe,merge,Path,quat}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{cacheGameAsset,createGameMesh as _0x1828fd}from"../shared/EngineMeshes.js";import{placeTiltedBackdrop}from"../shared/EngineTilt.js";import{toColor}from"../shared/EngineUtils.js";import{BOARD_BORDER_WIDTH,COLORS,HOP_TIME,PIECE_HEIGHT,SLIDE_TIME,squareCentre}from"./CheckersConstants.js";const meshes=new Map,cached=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("checkers/CheckersScene:"+e,o),meshes.set(e,t)),t},STAND_UP=quat.x(Math.PI/2),BACKDROP_DEPTH=30,SURFACE=.2,HINTS=4,pieceMesh=()=>cached("ck-piece",()=>{const e=PIECE_HEIGHT,o=lathe([[.001,e],[.14,e],[.155,e-.012],[.17,e],[.27,e],[.285,e-.014],[.3,e],[.36,e],[.395,e-.02],[.41,.55*e],[.4,.18*e],[.37,0],[.001,0]],{segments:36,color:({position:[o,t,s]})=>{const n=Math.hypot(o,s),r=t<e-.004?n>.38?.78:.88:1;return[r,r,r,1]}});return _0x1828fd(merge([{geometry:o,rotation:STAND_UP}]),{center:!1,shine:.55})}),crownMesh=()=>cached("ck-crown",()=>{const e=(new Path).addPolygon([[-.2,.1],[-.2,-.06],[-.12,.02],[-.06,-.12],[0,0],[.06,-.12],[.12,.02],[.2,-.06],[.2,.1]]);return _0x1828fd(extrude(e,{depth:.04}),{center:!1,shine:.8})}),ringMesh=()=>cached("ck-ring",()=>_0x1828fd(extrude((new Path).addCircle(0,0,.4).addCircle(0,0,.33),{depth:0,fillRule:"evenodd"}),{center:!1})),discMesh=()=>cached("ck-disc",()=>_0x1828fd(extrude((new Path).addCircle(0,0,.5),{depth:0}),{center:!1})),panelMesh=(e,o)=>cached("ck-flat-panel:"+e+":"+o,()=>_0x1828fd(extrude((new Path).addRoundedRect(-e/2,-e/2,e,e,o),{depth:0}))),pieceColor=e=>toColor("red"===e.player?COLORS.RED:COLORS.BLACK),at=(e,o,t=.2)=>{const[s,n]=squareCentre(e,o);return[s,n,t]};function spawnBoard(e,o){const t=[],s=o=>t.push(e.spawn({pickable:!1,...o}));for(let e=0;e<64;e++){const t=(Math.floor(e/8)+e)%2==1,[n,r]=squareCentre(o,e);s({mesh:panelMesh(1,0),position:[n,r,.2],scale:[o.cell,o.cell,1],color:toColor(t?COLORS.DARK_SQ:COLORS.LIGHT_SQ)})}const n=BOARD_BORDER_WIDTH,r=toColor(COLORS.BOARD_BORDER);for(const e of[-1,1])s({mesh:panelMesh(1,0),position:[0,e*(o.size+n)/2,.2],scale:[o.size+2*n,n,1],color:r}),s({mesh:panelMesh(1,0),position:[e*(o.size+n)/2,0,.2],scale:[n,o.size,1],color:r});return t}function spawnPiece(e,o,t,s,n){const r={root:e.spawn({mesh:pieceMesh(),position:at(o,s),scale:o.cell,color:pieceColor(n),pickable:!1}),crown:null};t.pieces.set(s,r),n.king&&crown(e,r,n,!1)}function crown(e,o,t,s){if(null!=o.crown)return;const n=e.spawn({mesh:pieceMesh(),parent:o.root,position:[0,0,.95*PIECE_HEIGHT],color:pieceColor(t),pickable:!1});e.spawn({mesh:crownMesh(),parent:n,position:[0,.02,PIECE_HEIGHT+.025],color:toColor(COLORS.GOLD),pickable:!1}),o.crown=n,s&&(e.set(n,{position:[0,0,4*PIECE_HEIGHT]}),e.animate(n,{position:[0,0,.95*PIECE_HEIGHT]},{duration:.35,delay:SLIDE_TIME,easing:"bounce"}))}export function buildScene(e,o,t,s){const n=spawnBackdrop(e,o.width,o.height,-30,t);placeTiltedBackdrop(e,n,o,30);const r=(o,t,s)=>e.spawn({mesh:o,scale:0,color:toColor(t,s),pickable:!1}),a={backdrop:n,board:spawnBoard(e,o),pieces:new Map,select:e.spawn({mesh:panelMesh(1,0),scale:0,color:toColor(COLORS.SELECT,.55),pickable:!1}),dots:Array.from({length:4},()=>r(discMesh(),COLORS.MOVE,.9)),rings:Array.from({length:4},()=>r(ringMesh(),COLORS.CAPTURE,.95)),queue:[],time:0};return s.forEach((t,s)=>t&&spawnPiece(e,o,a,s,t)),a}export function removeScene(e,o){for(const t of[o.backdrop,...o.board,...Array.from(o.pieces.values(),e=>e.root),o.select,...o.dots,...o.rings])e.despawn(t)}export function setSceneTheme(e,o,t,s){setBackdropTheme(e,t.backdrop,s);for(const o of t.board)e.despawn(o);t.board=spawnBoard(e,o)}export function resetPieces(e,o,t,s){for(const o of t.pieces.values())e.despawn(o.root);t.pieces.clear(),t.queue=[],s.forEach((s,n)=>s&&spawnPiece(e,o,t,n,s))}export function showHints(e,o,t,s,n,r){const a=e.transforms;if(s>=0){const[e,n]=squareCentre(o,s);a.position(t.select,e,n,.25),a.scale(t.select,o.cell,o.cell,1)}else a.scale(t.select,0);let i=0,l=0;for(const e of n){const s=r.includes(e),n=s?t.rings[l++]:t.dots[i++];if(null==n)continue;const[p,u]=squareCentre(o,e);a.position(n,p,u,.32),a.scale(n,s?o.cell:.32*o.cell)}for(;i<4;i++)a.scale(t.dots[i],0);for(;l<4;l++)a.scale(t.rings[l],0);a.flush()}export function lift(e,o,t,s,n){const r=t.pieces.get(s);r&&e.animate(r.root,{position:at(o,s,.2+(n?.12*o.cell:0))},{duration:.12})}export function movePiece(e,o,t,s,n,r,a,i=0){const l=t.pieces.get(s);if(!l)return;t.pieces.delete(s);const p=r.length>0,u=p?HOP_TIME:SLIDE_TIME,d=[];let h=s;n.forEach((e,t)=>{const[s,r]=squareCentre(o,h),[a,i]=squareCentre(o,e);p&&d.push({position:[(s+a)/2,(r+i)/2,.2+.55*o.cell],at:(t+.5)/n.length}),d.push({position:[a,i,.2],at:(t+1)/n.length}),h=e}),e.stopAnimation(l.root),e.animate(l.root,d,{duration:u*n.length,delay:i,path:p?"smooth":"linear",easing:"easeInOut"}),r.forEach((s,n)=>{const r=t.pieces.get(s);if(!r)return;t.pieces.delete(s);const a=i+u*(n+.55);e.animate(r.root,[{scale:1.15*o.cell,at:.3},{scale:.01}],{duration:.22,delay:a,easing:"easeIn"}),e.set(r.root,{lifetime:a+.3});const[l,p]=squareCentre(o,s);queueBurst(e,o,t,[l,p,.2+.15*o.cell],a)});const f=n[n.length-1];t.pieces.set(f,l),a&&crown(e,l,a,!0)}function queueBurst(e,o,t,s,n){t.queue.push({at:t.time+n,run:()=>effects.sparkle(e,{position:s,count:16,size:.07*o.cell,speed:2.5*o.cell,lifetime:.55,gravity:4*-o.cell,colors:[toColor("#FFFFFF"),toColor(COLORS.GOLD)]})})}export function stepScene(e,o){e.time+=o;for(let o=e.queue.length-1;o>=0;o--)if(e.queue[o].at<=e.time){const[t]=e.queue.splice(o,1);t.run()}}export function celebrate(e,o,t,s){for(const[n,r]of t.pieces){if("red"!==s[n]?.player)continue;const[t,a]=squareCentre(o,n);e.animate(r.root,[{position:[t,a,.2+.5*o.cell],at:.4},{position:[t,a,.2]}],{duration:.45,delay:.3+.04*(Math.floor(n/8)+n%8),easing:"easeOut"})}effects.confetti(e,{position:[0,0,o.cell],count:70,size:.12*o.cell,speed:1.3*o.size,lifetime:1.3,gravity:2.4*-o.size,colors:["#FFD700","#E53935","#4CAF50","#2196F3"].map(e=>toColor(e))})}
1
+ "use strict";import{effects,extrude,lathe,merge,Path,quat}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{cacheGameAsset,createGameMesh as _0x37478e}from"../shared/EngineMeshes.js";import{placeTiltedBackdrop}from"../shared/EngineTilt.js";import{toColor}from"../shared/EngineUtils.js";import{BOARD_BORDER_WIDTH,COLORS,HOP_TIME,PIECE_HEIGHT,SLIDE_TIME,squareCentre}from"./CheckersConstants.js";const meshes=new Map,cached=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("checkers/CheckersScene:"+e,o),meshes.set(e,t)),t},STAND_UP=quat.x(Math.PI/2),BACKDROP_DEPTH=30,SURFACE=.2,HINTS=4,pieceMesh=()=>cached("ck-piece",()=>{const e=PIECE_HEIGHT,o=lathe([[.001,e],[.14,e],[.155,e-.012],[.17,e],[.27,e],[.285,e-.014],[.3,e],[.36,e],[.395,e-.02],[.41,.55*e],[.4,.18*e],[.37,0],[.001,0]],{segments:36,color:({position:[o,t,s]})=>{const n=Math.hypot(o,s),r=t<e-.004?n>.38?.78:.88:1;return[r,r,r,1]}});return _0x37478e(merge([{geometry:o,rotation:STAND_UP}]),{center:!1,shine:.55})}),crownMesh=()=>cached("ck-crown",()=>{const e=(new Path).addPolygon([[-.2,.1],[-.2,-.06],[-.12,.02],[-.06,-.12],[0,0],[.06,-.12],[.12,.02],[.2,-.06],[.2,.1]]);return _0x37478e(extrude(e,{depth:.04}),{center:!1,shine:.8})}),ringMesh=()=>cached("ck-ring",()=>_0x37478e(extrude((new Path).addCircle(0,0,.4).addCircle(0,0,.33),{depth:0,fillRule:"evenodd"}),{center:!1})),discMesh=()=>cached("ck-disc",()=>_0x37478e(extrude((new Path).addCircle(0,0,.5),{depth:0}),{center:!1})),panelMesh=(e,o)=>cached("ck-flat-panel:"+e+":"+o,()=>_0x37478e(extrude((new Path).addRoundedRect(-e/2,-e/2,e,e,o),{depth:0}))),pieceColor=e=>toColor("red"===e.player?COLORS.RED:COLORS.BLACK),at=(e,o,t=.2)=>{const[s,n]=squareCentre(e,o);return[s,n,t]};function spawnBoard(e,o){const t=[],s=o=>t.push(e.spawn({pickable:!1,...o}));for(let e=0;e<64;e++){const t=(Math.floor(e/8)+e)%2==1,[n,r]=squareCentre(o,e);s({mesh:panelMesh(1,0),position:[n,r,.2],scale:[o.cell,o.cell,1],color:toColor(t?COLORS.DARK_SQ:COLORS.LIGHT_SQ)})}const n=BOARD_BORDER_WIDTH,r=toColor(COLORS.BOARD_BORDER);for(const e of[-1,1])s({mesh:panelMesh(1,0),position:[0,e*(o.size+n)/2,.2],scale:[o.size+2*n,n,1],color:r}),s({mesh:panelMesh(1,0),position:[e*(o.size+n)/2,0,.2],scale:[n,o.size,1],color:r});return t}function spawnPiece(e,o,t,s,n){const r={root:e.spawn({mesh:pieceMesh(),position:at(o,s),scale:o.cell,color:pieceColor(n),pickable:!1}),crown:null};t.pieces.set(s,r),n.king&&crown(e,r,n,!1)}function crown(e,o,t,s){if(null!=o.crown)return;const n=e.spawn({mesh:pieceMesh(),parent:o.root,position:[0,0,.95*PIECE_HEIGHT],color:pieceColor(t),pickable:!1});e.spawn({mesh:crownMesh(),parent:n,position:[0,.02,PIECE_HEIGHT+.025],color:toColor(COLORS.GOLD),pickable:!1}),o.crown=n,s&&(e.set(n,{position:[0,0,4*PIECE_HEIGHT]}),e.animate(n,{position:[0,0,.95*PIECE_HEIGHT]},{duration:.35,delay:SLIDE_TIME,easing:"bounce"}))}export function buildScene(e,o,t,s){const n=spawnBackdrop(e,o.width,o.height,-30,t);placeTiltedBackdrop(e,n,o,30);const r=(o,t,s)=>e.spawn({mesh:o,scale:0,color:toColor(t,s),pickable:!1}),a={backdrop:n,board:spawnBoard(e,o),pieces:new Map,select:e.spawn({mesh:panelMesh(1,0),scale:0,color:toColor(COLORS.SELECT,.55),pickable:!1}),dots:Array.from({length:4},()=>r(discMesh(),COLORS.MOVE,.9)),rings:Array.from({length:4},()=>r(ringMesh(),COLORS.CAPTURE,.95)),queue:[],time:0};return s.forEach((t,s)=>t&&spawnPiece(e,o,a,s,t)),a}export function removeScene(e,o){for(const t of[o.backdrop,...o.board,...Array.from(o.pieces.values(),e=>e.root),o.select,...o.dots,...o.rings])e.despawn(t)}export function setSceneTheme(e,o,t,s){setBackdropTheme(e,t.backdrop,s);for(const o of t.board)e.despawn(o);t.board=spawnBoard(e,o)}export function resetPieces(e,o,t,s){for(const o of t.pieces.values())e.despawn(o.root);t.pieces.clear(),t.queue=[],s.forEach((s,n)=>s&&spawnPiece(e,o,t,n,s))}export function showHints(e,o,t,s,n,r){const a=e.transforms;if(s>=0){const[e,n]=squareCentre(o,s);a.position(t.select,e,n,.25),a.scale(t.select,o.cell,o.cell,1)}else a.scale(t.select,0);let i=0,l=0;for(const e of n){const s=r.includes(e),n=s?t.rings[l++]:t.dots[i++];if(null==n)continue;const[p,u]=squareCentre(o,e);a.position(n,p,u,.32),a.scale(n,s?o.cell:.32*o.cell)}for(;i<4;i++)a.scale(t.dots[i],0);for(;l<4;l++)a.scale(t.rings[l],0);a.flush()}export function lift(e,o,t,s,n){const r=t.pieces.get(s);r&&e.animate(r.root,{position:at(o,s,.2+(n?.12*o.cell:0))},{duration:.12})}export function movePiece(e,o,t,s,n,r,a,i=0){const l=t.pieces.get(s);if(!l)return;t.pieces.delete(s);const p=r.length>0,u=p?HOP_TIME:SLIDE_TIME,h=[];let d=s;n.forEach((e,t)=>{const[s,r]=squareCentre(o,d),[a,i]=squareCentre(o,e);p&&h.push({position:[(s+a)/2,(r+i)/2,.2+.55*o.cell],at:(t+.5)/n.length}),h.push({position:[a,i,.2],at:(t+1)/n.length}),d=e}),e.stopAnimation(l.root),e.animate(l.root,h,{duration:u*n.length,delay:i,path:p?"smooth":"linear",easing:"easeInOut"}),r.forEach((s,n)=>{const r=t.pieces.get(s);if(!r)return;t.pieces.delete(s);const a=i+u*(n+.55);e.animate(r.root,[{scale:1.15*o.cell,at:.3},{scale:.01}],{duration:.22,delay:a,easing:"easeIn"}),e.set(r.root,{lifetime:a+.3});const[l,p]=squareCentre(o,s);queueBurst(e,o,t,[l,p,.2+.15*o.cell],a)});const f=n[n.length-1];t.pieces.set(f,l),a&&crown(e,l,a,!0)}function queueBurst(e,o,t,s,n){t.queue.push({at:t.time+n,run:()=>effects.sparkle(e,{position:s,count:16,size:.07*o.cell,speed:2.5*o.cell,lifetime:.55,gravity:4*-o.cell,colors:[toColor("#FFFFFF"),toColor(COLORS.GOLD)]})})}export function stepScene(e,o){e.time+=o;for(let o=e.queue.length-1;o>=0;o--)if(e.queue[o].at<=e.time){const[t]=e.queue.splice(o,1);t.run()}}export function celebrate(e,o,t,s){for(const[n,r]of t.pieces){if("red"!==s[n]?.player)continue;const[t,a]=squareCentre(o,n);e.animate(r.root,[{position:[t,a,.2+.5*o.cell],at:.4},{position:[t,a,.2]}],{duration:.45,delay:.3+.04*(Math.floor(n/8)+n%8),easing:"easeOut"})}effects.confetti(e,{position:[0,0,o.cell],count:70,size:.12*o.cell,speed:1.3*o.size,lifetime:1.3,gravity:2.4*-o.size,colors:["#FFD700","#E53935","#4CAF50","#2196F3"].map(e=>toColor(e))})}
@@ -1 +1 @@
1
- "use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{scoreColumn,timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,LIGHT,TIME_LIMIT}from"./ColorSwitchConstants.js";import{createGame,dispose,jump,reset,setLayout,setTheme,start,tick}from"./ColorSwitchGame.js";import{jsx as _0x5aad4c}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.COLOR_SWITCH,FEEDBACK={jump:{sound:SOUNDS.JUMP,haptic:HapticType.LIGHT},pass:{sound:SOUNDS.PASS,haptic:HapticType.MEDIUM},color:{sound:SOUNDS.COLOR_CHANGE,haptic:HapticType.SUCCESS},crash:{sound:SOUNDS.GAME_OVER,haptic:HapticType.ERROR}};export const ColorSwitch=engineGame(GAME_IDS.COLOR_SWITCH,e=>{const[t,s]=useLiveState(0),[r,o]=useLiveState(TIME_LIMIT),{theme:i,status:a,screen:n,gameOver:S}=useEngineGame(e,{gameId:GAME_IDS.COLOR_SWITCH,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,s,r)=>setLayout(e,getLayout(t,s,r)),drag:(e,t)=>{"start"===t.phase&&jump(e)},sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.SUCCESS),onStop:e=>e(null,HapticType.MEDIUM),onOver:(e,t)=>{"win"===t&&e(GAME_SOUNDS.WELL_DONE,HapticType.SUCCESS)},wire:(e,t)=>{e.onScore=s,e.onTime=o,e.onEvent=e=>t(FEEDBACK[e].sound,FEEDBACK[e].haptic)}});return _0x5aad4c(EngineGameScreen,{...n,light:LIGHT,columns:[scoreColumn(t),timerColumn(r,i,0)],subtext:"Tap to jump through!",gameOver:S({title:"win"===a?"YOU WON!":"GAME OVER",message:"win"===a?"You survived 2 minutes!":"Wrong color!",scoreLabel:"Final Score",score:t,buttonText:"Switch Again!"})})});
1
+ "use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{scoreColumn,timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,LIGHT,TIME_LIMIT}from"./ColorSwitchConstants.js";import{createGame,dispose,jump,reset,setLayout,setTheme,start,tick}from"./ColorSwitchGame.js";import{jsx as _0x5b218d}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.COLOR_SWITCH,FEEDBACK={jump:{sound:SOUNDS.JUMP,haptic:HapticType.LIGHT},pass:{sound:SOUNDS.PASS,haptic:HapticType.MEDIUM},color:{sound:SOUNDS.COLOR_CHANGE,haptic:HapticType.SUCCESS},crash:{sound:SOUNDS.GAME_OVER,haptic:HapticType.ERROR}};export const ColorSwitch=engineGame(GAME_IDS.COLOR_SWITCH,e=>{const[t,s]=useLiveState(0),[r,o]=useLiveState(TIME_LIMIT),{theme:i,status:a,screen:n,gameOver:S}=useEngineGame(e,{gameId:GAME_IDS.COLOR_SWITCH,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,s,r)=>setLayout(e,getLayout(t,s,r)),drag:(e,t)=>{"start"===t.phase&&jump(e)},sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.SUCCESS),onStop:e=>e(null,HapticType.MEDIUM),onOver:(e,t)=>{"win"===t&&e(GAME_SOUNDS.WELL_DONE,HapticType.SUCCESS)},wire:(e,t)=>{e.onScore=s,e.onTime=o,e.onEvent=e=>t(FEEDBACK[e].sound,FEEDBACK[e].haptic)}});return _0x5b218d(EngineGameScreen,{...n,light:LIGHT,columns:[scoreColumn(t),timerColumn(r,i,0)],subtext:"Tap to jump through!",gameOver:S({title:"win"===a?"YOU WON!":"GAME OVER",message:"win"===a?"You survived 2 minutes!":"Wrong color!",scoreLabel:"Final Score",score:t,buttonText:"Switch Again!"})})});
@@ -1 +1 @@
1
- "use strict";import{extrude,merge,Path,quat,tube}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{popAndBurst}from"../shared/EngineBlasts.js";import{cacheGameAsset,createGameMesh as _0x1776ec}from"../shared/EngineMeshes.js";import{toColor}from"../shared/EngineUtils.js";import{GAME_COLORS}from"./ColorSwitchConstants.js";const meshes=new Map,cached=(o,e)=>{let s=meshes.get(o);return!s&&(s=cacheGameAsset("color-switch/ColorSwitchScene:"+o,e),meshes.set(o,s)),s},BACKDROP_DEPTH=60,EYE_DISTANCE=240,arc=(o,e,s=14)=>Array.from({length:s+1},(t,a)=>{const r=o+(e-o)*a/s;return[Math.cos(r),Math.sin(r),0]}),ringMesh=o=>cached("cs-ring:"+o.toFixed(3),()=>_0x1776ec(merge(GAME_COLORS.map((e,s)=>({geometry:tube(arc(-s*Math.PI/2,-(s+1)*Math.PI/2),{radius:o/2,sides:16,smoothness:3,caps:!1}),color:toColor(e)}))),{center:!1,shine:.65})),haloMesh=()=>cached("cs-halo",()=>_0x1776ec(tube(arc(0,2*Math.PI,32),{radius:.06,sides:10,smoothness:2,caps:!1}),{center:!1})),starMesh=()=>cached("cs-star",()=>_0x1776ec(extrude((new Path).addStar(0,0,.5,.22),{depth:.3}),{shine:.6}));export const toWorld=(o,e,s,t=0)=>[e-o.width/2,-s,t];export const colorOf=o=>toColor(GAME_COLORS[o]??GAME_COLORS[0]);export function buildScene(o,e,s){return{backdrop:spawnBackdrop(o,e.width,e.height,-60,s),ball:o.spawn({mesh:"sphere",scale:2*e.ballRadius,color:colorOf(0),pickable:!1}),halo:o.spawn({mesh:haloMesh(),scale:0,color:[1,1,1,0],pickable:!1}),rings:new Map,stars:new Map}}export function removeScene(o,e){for(const s of[e.backdrop,e.ball,e.halo,...Array.from(e.rings.values()),...Array.from(e.stars.values())])o.despawn(s)}export function setSceneTheme(o,e,s){setBackdropTheme(o,e.backdrop,s)}export function frame(o,e,s,t,a){const r=-(a+e.height/2-e.top);t.eye=[0,r,240],t.target=[0,r,0],t.ortho=e.height/2,o.set(s.backdrop,{position:[-e.width/2,r+e.height/2,-60]})}export function syncField(o,e,s,t,a){if(s.syncedRings===t&&s.syncedStars===a&&s.ringCount===t.length&&s.starCount===a.length)return;s.syncedRings=t,s.syncedStars=a,s.ringCount=t.length,s.starCount=a.length;const r=new Set;for(const a of t)r.add(a.id),s.rings.has(a.id)||s.rings.set(a.id,o.spawn({mesh:ringMesh(e.ringThickness/e.ringRadius),position:toWorld(e,e.width/2,a.y),scale:e.ringRadius,pickable:!1}));for(const[e,t]of s.rings)!r.has(e)&&(o.despawn(t),s.rings.delete(e));r.clear();for(const t of a)r.add(t.id),s.stars.has(t.id)||s.stars.set(t.id,o.spawn({mesh:starMesh(),position:toWorld(e,e.width/2,t.y,4),scale:2.4*e.starRadius,color:colorOf(t.colorIndex),spin:[0,2.2,0],pickable:!1}));for(const[e,t]of s.stars)!r.has(e)&&(o.despawn(t),s.stars.delete(e))}const TURN=[0,0,0,1];export function turnRing(o,e,s,t){const a=e.rings.get(s);null!=a&&o.set(a,{rotation:quat.z(-t,TURN)})}export function placeBall(o,e,s,t){o.set(s.ball,{position:toWorld(e,e.width/2,t,6)})}export function hop(o,e,s){const t=2*e.ballRadius;o.animate(s.ball,[{scale:1.14*t,at:.3},{scale:t}],{duration:.22})}export function recolor(o,e,s,t,a,r){const n=colorOf(t),i=2*e.ballRadius;if(o.set(s.ball,{color:n}),o.animate(s.ball,[{scale:1.3*i,at:.25},{scale:i}],{duration:.3}),o.stopAnimation(s.halo),o.set(s.halo,{position:toWorld(e,e.width/2,a,5),scale:e.ballRadius,color:[n[0],n[1],n[2],.9]}),o.animate(s.halo,{scale:2.6*e.ballRadius,color:[n[0],n[1],n[2],0]},{duration:.42,easing:"easeOut"}),r){const e=s.stars.get(r);null!=e&&o.set(e,{scale:0})}}export function shatter(o,e,s,t,a){const r=colorOf(a),n=2*e.ballRadius;o.stopAnimation(s.ball),popAndBurst(o,s.ball,{scale:n,color:r,duration:.45},{position:toWorld(e,e.width/2,t,10),size:1.6*n,color:r,count:14})}export function resetBall(o,e,s,t){o.stopAnimation(s.ball),o.stopAnimation(s.halo),o.set(s.ball,{scale:2*e.ballRadius,color:colorOf(t)}),o.set(s.halo,{scale:0})}
1
+ "use strict";import{extrude,merge,Path,quat,tube}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{popAndBurst}from"../shared/EngineBlasts.js";import{cacheGameAsset,createGameMesh as _0x14600b}from"../shared/EngineMeshes.js";import{toColor}from"../shared/EngineUtils.js";import{GAME_COLORS}from"./ColorSwitchConstants.js";const meshes=new Map,cached=(o,e)=>{let s=meshes.get(o);return!s&&(s=cacheGameAsset("color-switch/ColorSwitchScene:"+o,e),meshes.set(o,s)),s},BACKDROP_DEPTH=60,EYE_DISTANCE=240,arc=(o,e,s=14)=>Array.from({length:s+1},(t,a)=>{const r=o+(e-o)*a/s;return[Math.cos(r),Math.sin(r),0]}),ringMesh=o=>cached("cs-ring:"+o.toFixed(3),()=>_0x14600b(merge(GAME_COLORS.map((e,s)=>({geometry:tube(arc(-s*Math.PI/2,-(s+1)*Math.PI/2),{radius:o/2,sides:16,smoothness:3,caps:!1}),color:toColor(e)}))),{center:!1,shine:.65})),haloMesh=()=>cached("cs-halo",()=>_0x14600b(tube(arc(0,2*Math.PI,32),{radius:.06,sides:10,smoothness:2,caps:!1}),{center:!1})),starMesh=()=>cached("cs-star",()=>_0x14600b(extrude((new Path).addStar(0,0,.5,.22),{depth:.3}),{shine:.6}));export const toWorld=(o,e,s,t=0)=>[e-o.width/2,-s,t];export const colorOf=o=>toColor(GAME_COLORS[o]??GAME_COLORS[0]);export function buildScene(o,e,s){return{backdrop:spawnBackdrop(o,e.width,e.height,-60,s),ball:o.spawn({mesh:"sphere",scale:2*e.ballRadius,color:colorOf(0),pickable:!1}),halo:o.spawn({mesh:haloMesh(),scale:0,color:[1,1,1,0],pickable:!1}),rings:new Map,stars:new Map}}export function removeScene(o,e){for(const s of[e.backdrop,e.ball,e.halo,...Array.from(e.rings.values()),...Array.from(e.stars.values())])o.despawn(s)}export function setSceneTheme(o,e,s){setBackdropTheme(o,e.backdrop,s)}export function frame(o,e,s,t,a){const r=-(a+e.height/2-e.top);t.eye=[0,r,240],t.target=[0,r,0],t.ortho=e.height/2,o.set(s.backdrop,{position:[-e.width/2,r+e.height/2,-60]})}export function syncField(o,e,s,t,a){if(s.syncedRings===t&&s.syncedStars===a&&s.ringCount===t.length&&s.starCount===a.length)return;s.syncedRings=t,s.syncedStars=a,s.ringCount=t.length,s.starCount=a.length;const r=new Set;for(const a of t)r.add(a.id),s.rings.has(a.id)||s.rings.set(a.id,o.spawn({mesh:ringMesh(e.ringThickness/e.ringRadius),position:toWorld(e,e.width/2,a.y),scale:e.ringRadius,pickable:!1}));for(const[e,t]of s.rings)!r.has(e)&&(o.despawn(t),s.rings.delete(e));r.clear();for(const t of a)r.add(t.id),s.stars.has(t.id)||s.stars.set(t.id,o.spawn({mesh:starMesh(),position:toWorld(e,e.width/2,t.y,4),scale:2.4*e.starRadius,color:colorOf(t.colorIndex),spin:[0,2.2,0],pickable:!1}));for(const[e,t]of s.stars)!r.has(e)&&(o.despawn(t),s.stars.delete(e))}const TURN=[0,0,0,1];export function turnRing(o,e,s,t){const a=e.rings.get(s);null!=a&&o.set(a,{rotation:quat.z(-t,TURN)})}export function placeBall(o,e,s,t){o.set(s.ball,{position:toWorld(e,e.width/2,t,6)})}export function hop(o,e,s){const t=2*e.ballRadius;o.animate(s.ball,[{scale:1.14*t,at:.3},{scale:t}],{duration:.22})}export function recolor(o,e,s,t,a,r){const n=colorOf(t),i=2*e.ballRadius;if(o.set(s.ball,{color:n}),o.animate(s.ball,[{scale:1.3*i,at:.25},{scale:i}],{duration:.3}),o.stopAnimation(s.halo),o.set(s.halo,{position:toWorld(e,e.width/2,a,5),scale:e.ballRadius,color:[n[0],n[1],n[2],.9]}),o.animate(s.halo,{scale:2.6*e.ballRadius,color:[n[0],n[1],n[2],0]},{duration:.42,easing:"easeOut"}),r){const e=s.stars.get(r);null!=e&&o.set(e,{scale:0})}}export function shatter(o,e,s,t,a){const r=colorOf(a),n=2*e.ballRadius;o.stopAnimation(s.ball),popAndBurst(o,s.ball,{scale:n,color:r,duration:.45},{position:toWorld(e,e.width/2,t,10),size:1.6*n,color:r,count:14})}export function resetBall(o,e,s,t){o.stopAnimation(s.ball),o.stopAnimation(s.halo),o.set(s.ball,{scale:2*e.ballRadius,color:colorOf(t)}),o.set(s.halo,{scale:0})}
@@ -1 +1 @@
1
- "use strict";import{HapticType}from"../../services/HapticsService.js";import{calculateTimeBasedScore}from"../../services/ScoringService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{formatTime,GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,LIGHT,SCORE_BASE,TIME_LIMIT}from"./ColorsSortConstants.js";import{createGame,dispose,reset,setLayout,setTheme,start,tap,tick}from"./ColorsSortGame.js";import{jsx as _0x24f22b}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.COLORS_SORT,FEEDBACK={pick:{sound:SOUNDS.PICK,haptic:HapticType.LIGHT},drop:{sound:SOUNDS.DESELECT,haptic:HapticType.LIGHT},refuse:{sound:SOUNDS.MISS,haptic:HapticType.LIGHT},move:{sound:SOUNDS.MATCH,haptic:HapticType.MEDIUM},complete:{sound:SOUNDS.COMPLETE,haptic:HapticType.SUCCESS}},timedOutFormatter=()=>formatTime(TIME_LIMIT);export const ColorsSort=engineGame(GAME_IDS.COLORS_SORT,e=>{const[t,r]=useLiveState(TIME_LIMIT),{game:o,theme:s,screen:i,gameOver:m}=useEngineGame(e,{gameId:GAME_IDS.COLORS_SORT,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,r,o)=>{const s=getLayout(t,r,o);return setLayout(e,s),s.shelves[0]?.width},tap:tap,outcome:e=>e.timedOut?"lose":"win",reportScore:(e,t)=>"win"===t?calculateTimeBasedScore(e.time,TIME_LIMIT,SCORE_BASE):0,sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.MEDIUM),onOver:(e,t)=>{"win"!==t&&e(SOUNDS.GAME_OVER,HapticType.ERROR)},wire:(e,t)=>{e.onTime=r,e.onEvent=e=>t(FEEDBACK[e].sound,FEEDBACK[e].haptic)}}),a=o.timedOut;return _0x24f22b(EngineGameScreen,{...i,light:LIGHT,columns:[timerColumn(t,s)],subtext:"Sort colors!",gameOver:m({title:a?"TIME UP!":"SORTED!",message:a?"You ran out of time!":"All colors sorted!",scoreLabel:a?"Time's Up!":"Completion Time",score:o.time,formatter:a?timedOutFormatter:formatTime,buttonText:"Sort Again!"})})});
1
+ "use strict";import{HapticType}from"../../services/HapticsService.js";import{calculateTimeBasedScore}from"../../services/ScoringService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{formatTime,GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,LIGHT,SCORE_BASE,TIME_LIMIT}from"./ColorsSortConstants.js";import{createGame,dispose,reset,setLayout,setTheme,start,tap,tick}from"./ColorsSortGame.js";import{jsx as _0x1bba33}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.COLORS_SORT,FEEDBACK={pick:{sound:SOUNDS.PICK,haptic:HapticType.LIGHT},drop:{sound:SOUNDS.DESELECT,haptic:HapticType.LIGHT},refuse:{sound:SOUNDS.MISS,haptic:HapticType.LIGHT},move:{sound:SOUNDS.MATCH,haptic:HapticType.MEDIUM},complete:{sound:SOUNDS.COMPLETE,haptic:HapticType.SUCCESS}},timedOutFormatter=()=>formatTime(TIME_LIMIT);export const ColorsSort=engineGame(GAME_IDS.COLORS_SORT,e=>{const[t,r]=useLiveState(TIME_LIMIT),{game:o,theme:s,screen:i,gameOver:m}=useEngineGame(e,{gameId:GAME_IDS.COLORS_SORT,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,r,o)=>{const s=getLayout(t,r,o);return setLayout(e,s),s.shelves[0]?.width},tap:tap,outcome:e=>e.timedOut?"lose":"win",reportScore:(e,t)=>"win"===t?calculateTimeBasedScore(e.time,TIME_LIMIT,SCORE_BASE):0,sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.MEDIUM),onOver:(e,t)=>{"win"!==t&&e(SOUNDS.GAME_OVER,HapticType.ERROR)},wire:(e,t)=>{e.onTime=r,e.onEvent=e=>t(FEEDBACK[e].sound,FEEDBACK[e].haptic)}}),a=o.timedOut;return _0x1bba33(EngineGameScreen,{...i,light:LIGHT,columns:[timerColumn(t,s)],subtext:"Sort colors!",gameOver:m({title:a?"TIME UP!":"SORTED!",message:a?"You ran out of time!":"All colors sorted!",scoreLabel:a?"Time's Up!":"Completion Time",score:o.time,formatter:a?timedOutFormatter:formatTime,buttonText:"Sort Again!"})})});
@@ -1 +1 @@
1
- "use strict";import{effects,extrude,lathe,Path}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{noise}from"../shared/EngineMeadow.js";import{cacheGameAsset,createGameMesh as _0x2f0278}from"../shared/EngineMeshes.js";import{placeTiltedBackdrop}from"../shared/EngineTilt.js";import{toColor}from"../shared/EngineUtils.js";import{COLORS,hoverY,LIFT_TIME,MOVE_TIME,SHAKE_TIME,slotY}from"./ColorsSortConstants.js";const meshes=new Map,cached=(e,t)=>{let o=meshes.get(e);return!o&&(o=cacheGameAsset("colors-sort/ColorsSortScene:"+e,t),meshes.set(e,o)),o},shade=(e,t)=>[e[0]*t,e[1]*t,e[2]*t],smooth=(e,t,o)=>{const s=Math.min(1,Math.max(0,(o-e)/(t-e)));return s*s*(3-2*s)},glassMesh=()=>cached("cs-glass",()=>_0x2f0278(lathe(GLASS_PROFILE,{segments:96}),{center:!1,shine:.9})),GLASS_PROFILE=[...Array.from({length:25},(e,t)=>{const o=t/24*(Math.PI/2);return[Math.max(.001,.5*Math.sin(o)),.09*(1-Math.cos(o))]}),[.5,1]],outlineMesh=e=>cached("cs-outline:"+e.toFixed(2),()=>{const t=GLASS_PROFILE.map(([t,o])=>[t,o*e]),o=[...t.slice().reverse().map(([e,t])=>[-e,t]),...t.slice(1)],s=[...o.map(([e,t],s)=>{const[i,a]=o[Math.max(0,s-1)],[n,r]=o[Math.min(o.length-1,s+1)],u=n-i,h=r-a,l=Math.hypot(u,h)||1;return[e+h/l*.035,t-u/l*.035]}),...o.slice().reverse()].map(([e,t])=>[e,-t]);return _0x2f0278(extrude((new Path).addPolygon(s),{depth:0}),{center:!1})}),mouthRingMesh=()=>cached("cs-mouth-ring",()=>_0x2f0278(lathe(Array.from({length:17},(e,t)=>{const o=t/16*Math.PI*2;return[.59+.03*Math.cos(o),.5+.5*Math.sin(o)]}),{segments:120}),{center:!1,shine:.3})),rimMesh=()=>cached("cs-rim",()=>_0x2f0278(lathe([[.5,0],[.56,.1],[.56,.9],[.5,1],[.5,0]],{segments:96}),{center:!1,shine:.8})),puckMesh=()=>cached("cs-puck",()=>_0x2f0278(lathe([[.001,0],[.42,0],[.5,.14],[.5,.86],[.42,1],[.001,1]],{segments:32,color:({position:e,normal:t})=>shade([1,1,1],.82+.18*smooth(.2,.95,e[1])+.12*Math.max(0,t[1]))}),{center:!1,shine:.6})),corkMesh=()=>cached("cs-cork",()=>_0x2f0278(lathe([[.001,0],[.42,0],[.46,.55],[.56,.58],[.58,.68],[.56,1],[.001,1]],{segments:28,color:({position:e})=>shade([.78,.56,.34],.82+.3*noise(30*e[0]+9*e[1],30*e[2]+40*e[1]))}),{center:!1,shine:.1})),glassColor=e=>"dark"===e.mode?[1,1,1,.05]:[1,1,1,.08],edgeColor=e=>"dark"===e.mode?[1,1,1,.55]:[.1,.14,.22,.45],rimColor=e=>{if("classic"===e.mode)return[1,1,1,.6];const t=toColor(e.BOARD.BORDER),[o,s,i,a]=t[3]>0?t:toColor(e.BOARD.CELL_EMPTY);return[o,s,i,Math.max(.45,a??0)]};export const pieceColor=e=>toColor(COLORS[e]);const BACKDROP_DEPTH=60;export function buildScene(e,t,o){const s=spawnBackdrop(e,t.width,t.height,-60,o);placeTiltedBackdrop(e,s,t,60);const i=2*t.tubeRadius;return{backdrop:s,tubes:t.tubes.map(([s,a])=>({glass:e.spawn({mesh:glassMesh(),position:[s,a,0],scale:[i,t.tubeHeight,i],color:glassColor(o),pickable:!1}),rim:e.spawn({mesh:rimMesh(),position:[s,a+t.tubeHeight-.12*t.tubeRadius,0],scale:[i,.16*t.tubeRadius,i],color:rimColor(o),pickable:!1}),streak:e.spawn({mesh:"cube",position:[s-.55*t.tubeRadius,a+.55*t.tubeHeight,.86*t.tubeRadius],scale:[.08*t.tubeRadius,.72*t.tubeHeight,.5],color:[1,1,1,.2],pickable:!1}),edges:[e.spawn({mesh:outlineMesh(t.tubeHeight/i),position:[s,a,0],scale:[i,i,1],color:edgeColor(o),pickable:!1}),e.spawn({mesh:mouthRingMesh(),position:[s,a+t.tubeHeight-.06*t.tubeRadius,0],scale:[i,.12*t.tubeRadius,i],color:edgeColor(o),pickable:!1})],cork:e.spawn({mesh:corkMesh(),position:[s,a+t.tubeHeight,0],scale:0,pickable:!1})}))}}export function removeScene(e,t){for(const o of[t.backdrop,...t.tubes.flatMap(e=>[e.glass,e.rim,e.streak,...e.edges,e.cork])])e.despawn(o)}export function setSceneTheme(e,t,o){setBackdropTheme(e,t.backdrop,o);for(const s of t.tubes){e.set(s.glass,{color:glassColor(o)}),e.set(s.rim,{color:rimColor(o)});for(const t of s.edges)e.set(t,{color:edgeColor(o)})}}const pieceScale=e=>[2*e.pieceRadius,e.pieceHeight,2*e.pieceRadius],at=(e,t,o)=>[e.tubes[t][0],o,0];export function spawnPiece(e,t,o,s,i){return e.spawn({mesh:puckMesh(),position:at(t,s,slotY(t,s,i)),scale:pieceScale(t),color:pieceColor(o),pickable:!1})}export function liftPiece(e,t,o,s){e.stopAnimation(o),e.animate(o,{position:at(t,s,hoverY(t,s))},{spring:{stiffness:260,damping:18}}),e.set(o,{bob:{amplitude:[0,.08*t.pieceHeight,0],speed:5}})}export function lowerPiece(e,t,o,s,i){e.set(o,{bob:null}),e.stopAnimation(o),e.animate(o,{position:at(t,s,slotY(t,s,i))},{duration:LIFT_TIME,easing:"easeIn"})}export function movePiece(e,t,o,s,i,a){e.set(o,{bob:null}),e.stopAnimation(o);const n=Math.max(hoverY(t,s),hoverY(t,i));e.animate(o,[{position:at(t,s,n),at:.2},{position:at(t,i,n),at:.55},{position:at(t,i,slotY(t,i,a)),at:1}],{duration:MOVE_TIME,path:"smooth",easing:"easeInOut"})}export function shakeTube(e,t,o,s){e.animate([o.glass,o.rim,o.streak,...o.edges,...s],{shake:.14*t.tubeRadius},{duration:SHAKE_TIME})}export function completeTube(e,t,o,s,i){const[a,n]=t.tubes[s],r=2*t.tubeRadius;e.animate(o.glass,[{scale:[1.06*r,1.03*t.tubeHeight,1.06*r],at:.4},{scale:[r,t.tubeHeight,r]}],{duration:.3}),effects.sparkle(e,{position:[a,n+t.tubeHeight,t.tubeRadius],count:16,size:.16*t.tubeRadius,speed:4*t.tubeRadius,direction:[0,1,0],spread:1,lifetime:.6,gravity:6*-t.tubeRadius,colors:[pieceColor(i),[1,1,1,1],[1,.85,.3,1]]}),showCork(e,t,o,s,!0,!0)}export function showCork(e,t,o,s,i,a=!1){const[n,r]=t.tubes[s],u=[1.9*t.tubeRadius,.95*t.tubeRadius,1.9*t.tubeRadius],h=[n,r+t.tubeHeight-.5*u[1],0];e.stopAnimation(o.cork),i?a?(e.set(o.cork,{position:[n,h[1]+2.5*t.tubeRadius,0],scale:u}),e.animate(o.cork,{position:h},{duration:.35,delay:.15,easing:"bounce"})):e.set(o.cork,{position:h,scale:u}):e.set(o.cork,{scale:0})}export function celebrate(e,t){effects.confetti(e,{position:[0,.4*t.tubeHeight,2*t.tubeRadius],count:60,size:.2*t.tubeRadius,speed:2.2*t.tubeHeight,lifetime:1.3,gravity:3.5*-t.tubeHeight,colors:COLORS.slice(0,4).map(e=>toColor(e))})}
1
+ "use strict";import{effects,extrude,lathe,Path}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{noise}from"../shared/EngineMeadow.js";import{cacheGameAsset,createGameMesh as _0x49bbba}from"../shared/EngineMeshes.js";import{placeTiltedBackdrop}from"../shared/EngineTilt.js";import{toColor}from"../shared/EngineUtils.js";import{COLORS,hoverY,LIFT_TIME,MOVE_TIME,SHAKE_TIME,slotY}from"./ColorsSortConstants.js";const meshes=new Map,cached=(e,t)=>{let o=meshes.get(e);return!o&&(o=cacheGameAsset("colors-sort/ColorsSortScene:"+e,t),meshes.set(e,o)),o},shade=(e,t)=>[e[0]*t,e[1]*t,e[2]*t],smooth=(e,t,o)=>{const s=Math.min(1,Math.max(0,(o-e)/(t-e)));return s*s*(3-2*s)},glassMesh=()=>cached("cs-glass",()=>_0x49bbba(lathe(GLASS_PROFILE,{segments:96}),{center:!1,shine:.9})),GLASS_PROFILE=[...Array.from({length:25},(e,t)=>{const o=t/24*(Math.PI/2);return[Math.max(.001,.5*Math.sin(o)),.09*(1-Math.cos(o))]}),[.5,1]],outlineMesh=e=>cached("cs-outline:"+e.toFixed(2),()=>{const t=GLASS_PROFILE.map(([t,o])=>[t,o*e]),o=[...t.slice().reverse().map(([e,t])=>[-e,t]),...t.slice(1)],s=[...o.map(([e,t],s)=>{const[a,i]=o[Math.max(0,s-1)],[n,r]=o[Math.min(o.length-1,s+1)],u=n-a,h=r-i,l=Math.hypot(u,h)||1;return[e+h/l*.035,t-u/l*.035]}),...o.slice().reverse()].map(([e,t])=>[e,-t]);return _0x49bbba(extrude((new Path).addPolygon(s),{depth:0}),{center:!1})}),mouthRingMesh=()=>cached("cs-mouth-ring",()=>_0x49bbba(lathe(Array.from({length:17},(e,t)=>{const o=t/16*Math.PI*2;return[.59+.03*Math.cos(o),.5+.5*Math.sin(o)]}),{segments:120}),{center:!1,shine:.3})),rimMesh=()=>cached("cs-rim",()=>_0x49bbba(lathe([[.5,0],[.56,.1],[.56,.9],[.5,1],[.5,0]],{segments:96}),{center:!1,shine:.8})),puckMesh=()=>cached("cs-puck",()=>_0x49bbba(lathe([[.001,0],[.42,0],[.5,.14],[.5,.86],[.42,1],[.001,1]],{segments:32,color:({position:e,normal:t})=>shade([1,1,1],.82+.18*smooth(.2,.95,e[1])+.12*Math.max(0,t[1]))}),{center:!1,shine:.6})),corkMesh=()=>cached("cs-cork",()=>_0x49bbba(lathe([[.001,0],[.42,0],[.46,.55],[.56,.58],[.58,.68],[.56,1],[.001,1]],{segments:28,color:({position:e})=>shade([.78,.56,.34],.82+.3*noise(30*e[0]+9*e[1],30*e[2]+40*e[1]))}),{center:!1,shine:.1})),glassColor=e=>"dark"===e.mode?[1,1,1,.05]:[1,1,1,.08],edgeColor=e=>"dark"===e.mode?[1,1,1,.55]:[.1,.14,.22,.45],rimColor=e=>{if("classic"===e.mode)return[1,1,1,.6];const t=toColor(e.BOARD.BORDER),[o,s,a,i]=t[3]>0?t:toColor(e.BOARD.CELL_EMPTY);return[o,s,a,Math.max(.45,i??0)]};export const pieceColor=e=>toColor(COLORS[e]);const BACKDROP_DEPTH=60;export function buildScene(e,t,o){const s=spawnBackdrop(e,t.width,t.height,-60,o);placeTiltedBackdrop(e,s,t,60);const a=2*t.tubeRadius;return{backdrop:s,tubes:t.tubes.map(([s,i])=>({glass:e.spawn({mesh:glassMesh(),position:[s,i,0],scale:[a,t.tubeHeight,a],color:glassColor(o),pickable:!1}),rim:e.spawn({mesh:rimMesh(),position:[s,i+t.tubeHeight-.12*t.tubeRadius,0],scale:[a,.16*t.tubeRadius,a],color:rimColor(o),pickable:!1}),streak:e.spawn({mesh:"cube",position:[s-.55*t.tubeRadius,i+.55*t.tubeHeight,.86*t.tubeRadius],scale:[.08*t.tubeRadius,.72*t.tubeHeight,.5],color:[1,1,1,.2],pickable:!1}),edges:[e.spawn({mesh:outlineMesh(t.tubeHeight/a),position:[s,i,0],scale:[a,a,1],color:edgeColor(o),pickable:!1}),e.spawn({mesh:mouthRingMesh(),position:[s,i+t.tubeHeight-.06*t.tubeRadius,0],scale:[a,.12*t.tubeRadius,a],color:edgeColor(o),pickable:!1})],cork:e.spawn({mesh:corkMesh(),position:[s,i+t.tubeHeight,0],scale:0,pickable:!1})}))}}export function removeScene(e,t){for(const o of[t.backdrop,...t.tubes.flatMap(e=>[e.glass,e.rim,e.streak,...e.edges,e.cork])])e.despawn(o)}export function setSceneTheme(e,t,o){setBackdropTheme(e,t.backdrop,o);for(const s of t.tubes){e.set(s.glass,{color:glassColor(o)}),e.set(s.rim,{color:rimColor(o)});for(const t of s.edges)e.set(t,{color:edgeColor(o)})}}const pieceScale=e=>[2*e.pieceRadius,e.pieceHeight,2*e.pieceRadius],at=(e,t,o)=>[e.tubes[t][0],o,0];export function spawnPiece(e,t,o,s,a){return e.spawn({mesh:puckMesh(),position:at(t,s,slotY(t,s,a)),scale:pieceScale(t),color:pieceColor(o),pickable:!1})}export function liftPiece(e,t,o,s){e.stopAnimation(o),e.animate(o,{position:at(t,s,hoverY(t,s))},{spring:{stiffness:260,damping:18}}),e.set(o,{bob:{amplitude:[0,.08*t.pieceHeight,0],speed:5}})}export function lowerPiece(e,t,o,s,a){e.set(o,{bob:null}),e.stopAnimation(o),e.animate(o,{position:at(t,s,slotY(t,s,a))},{duration:LIFT_TIME,easing:"easeIn"})}export function movePiece(e,t,o,s,a,i){e.set(o,{bob:null}),e.stopAnimation(o);const n=Math.max(hoverY(t,s),hoverY(t,a));e.animate(o,[{position:at(t,s,n),at:.2},{position:at(t,a,n),at:.55},{position:at(t,a,slotY(t,a,i)),at:1}],{duration:MOVE_TIME,path:"smooth",easing:"easeInOut"})}export function shakeTube(e,t,o,s){e.animate([o.glass,o.rim,o.streak,...o.edges,...s],{shake:.14*t.tubeRadius},{duration:SHAKE_TIME})}export function completeTube(e,t,o,s,a){const[i,n]=t.tubes[s],r=2*t.tubeRadius;e.animate(o.glass,[{scale:[1.06*r,1.03*t.tubeHeight,1.06*r],at:.4},{scale:[r,t.tubeHeight,r]}],{duration:.3}),effects.sparkle(e,{position:[i,n+t.tubeHeight,t.tubeRadius],count:16,size:.16*t.tubeRadius,speed:4*t.tubeRadius,direction:[0,1,0],spread:1,lifetime:.6,gravity:6*-t.tubeRadius,colors:[pieceColor(a),[1,1,1,1],[1,.85,.3,1]]}),showCork(e,t,o,s,!0,!0)}export function showCork(e,t,o,s,a,i=!1){const[n,r]=t.tubes[s],u=[1.9*t.tubeRadius,.95*t.tubeRadius,1.9*t.tubeRadius],h=[n,r+t.tubeHeight-.5*u[1],0];e.stopAnimation(o.cork),a?i?(e.set(o.cork,{position:[n,h[1]+2.5*t.tubeRadius,0],scale:u}),e.animate(o.cork,{position:h},{duration:.35,delay:.15,easing:"bounce"})):e.set(o.cork,{position:h,scale:u}):e.set(o.cork,{scale:0})}export function celebrate(e,t){effects.confetti(e,{position:[0,.4*t.tubeHeight,2*t.tubeRadius],count:60,size:.2*t.tubeRadius,speed:2.2*t.tubeHeight,lifetime:1.3,gravity:3.5*-t.tubeHeight,colors:COLORS.slice(0,4).map(e=>toColor(e))})}
@@ -1 +1 @@
1
- "use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{scoreColumn,timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,LIGHT,TIME_LIMIT}from"./ConnectEmAllConstants.js";import{createGame,dispose,reset,setLayout,setTheme,start,tick,touchEnd,touchMove,touchStart}from"./ConnectEmAllGame.js";import{jsx as _0x1180ef}from"react/jsx-runtime";const SFX=GAME_SOUNDS.CONNECT_EM_ALL,formatScore=e=>e.toLocaleString();export const ConnectEmAll=engineGame(GAME_IDS.CONNECT_EM_ALL,e=>{const[t,o]=useLiveState(0),[r,s]=useLiveState(TIME_LIMIT),{theme:n,status:i,screen:a,gameOver:m}=useEngineGame(e,{gameId:GAME_IDS.CONNECT_EM_ALL,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,o,r)=>{const s=getLayout(t,o,r);return setLayout(e,s),s.boardSize},drag:(e,{phase:t,x:o,y:r})=>{"start"===t?touchStart(e,o,r):"move"===t?touchMove(e,o,r):touchEnd(e)},sounds:SFX,onStart:e=>e(SFX.START,HapticType.MEDIUM),onOver:(e,t)=>e("win"===t?SFX.WIN:SFX.GAME_OVER,"win"===t?HapticType.SUCCESS:HapticType.HEAVY),wire:(e,t)=>{e.onScore=o,e.onTime=s,e.onConnect=()=>t(SFX.CONNECT,HapticType.LIGHT),e.onClear=()=>t(SFX.CLEAR,HapticType.MEDIUM)}});return _0x1180ef(EngineGameScreen,{...a,light:LIGHT,columns:[scoreColumn(t,"SCORE",formatScore),timerColumn(r,n)],subtext:"Connect matching dots!",gameOver:m({title:"win"===i?"WELL DONE!":"TIME UP!",message:"win"===i?"All connections made!":"You ran out of time!",scoreLabel:"win"===i?"Great Job!":"Game Over",score:t,buttonText:"win"===i?"Play Again!":"Try Again!"})})});
1
+ "use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{scoreColumn,timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,LIGHT,TIME_LIMIT}from"./ConnectEmAllConstants.js";import{createGame,dispose,reset,setLayout,setTheme,start,tick,touchEnd,touchMove,touchStart}from"./ConnectEmAllGame.js";import{jsx as _0x1737d}from"react/jsx-runtime";const SFX=GAME_SOUNDS.CONNECT_EM_ALL,formatScore=e=>e.toLocaleString();export const ConnectEmAll=engineGame(GAME_IDS.CONNECT_EM_ALL,e=>{const[t,o]=useLiveState(0),[r,s]=useLiveState(TIME_LIMIT),{theme:n,status:i,screen:a,gameOver:m}=useEngineGame(e,{gameId:GAME_IDS.CONNECT_EM_ALL,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,o,r)=>{const s=getLayout(t,o,r);return setLayout(e,s),s.boardSize},drag:(e,{phase:t,x:o,y:r})=>{"start"===t?touchStart(e,o,r):"move"===t?touchMove(e,o,r):touchEnd(e)},sounds:SFX,onStart:e=>e(SFX.START,HapticType.MEDIUM),onOver:(e,t)=>e("win"===t?SFX.WIN:SFX.GAME_OVER,"win"===t?HapticType.SUCCESS:HapticType.HEAVY),wire:(e,t)=>{e.onScore=o,e.onTime=s,e.onConnect=()=>t(SFX.CONNECT,HapticType.LIGHT),e.onClear=()=>t(SFX.CLEAR,HapticType.MEDIUM)}});return _0x1737d(EngineGameScreen,{...a,light:LIGHT,columns:[scoreColumn(t,"SCORE",formatScore),timerColumn(r,n)],subtext:"Connect matching dots!",gameOver:m({title:"win"===i?"WELL DONE!":"TIME UP!",message:"win"===i?"All connections made!":"You ran out of time!",scoreLabel:"win"===i?"Great Job!":"Game Over",score:t,buttonText:"win"===i?"Play Again!":"Try Again!"})})});
@@ -1 +1 @@
1
- "use strict";import{extrude,loadTexture,Path,quat,shapeGeometry}from"@nayan-ui/engine";import{lighten}from"../../services/GamesConstants.js";import{spawnBackdrop}from"../shared/EngineBackdrop.js";import{cacheGameAsset,createGameMesh as _0x47d81e}from"../shared/EngineMeshes.js";import{toColor}from"../shared/EngineUtils.js";import{BOARD_RADIUS,DOT_COLORS,DOT_SHINE,GLOW_ALPHA,GLOW_IN_TIME,GLOW_OUT_TIME,GLOW_SIZE,GRID_SIZE}from"./ConnectEmAllConstants.js";const Z_BOARD=0,Z_BACKDROP=-20,HIDDEN=0;export const toWorld=(e,o,t,s=0)=>[o-e.width/2,e.height/2-t,s];export const dotPoint=(e,o,t)=>[e.boardLeft+e.padding+t*e.spacing,e.boardTop+e.padding+o*e.spacing];const dotZ=e=>2*e.radius,lineZ=e=>.5*e.radius,shadowZ=e=>.4*e.radius;export const dotPosition=(e,o,t)=>{const[s,n]=dotPoint(e,o,t);return toWorld(e,s,n,dotZ(e))};const meshes=new Map,mesh=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("connect-em-all/ConnectEmAllScene:"+e,o),meshes.set(e,t)),t},dotMesh=()=>mesh("dot",()=>_0x47d81e(shapeGeometry("sphere"),{shine:DOT_SHINE})),discMesh=()=>mesh("disc",()=>_0x47d81e(extrude((new Path).addCircle(0,0,.5),{depth:0}))),panelMesh=(e,o,t=0)=>mesh("panel:"+e+":"+o+":"+t,()=>{const s=(new Path).addRoundedRect(0,0,e,e,o);return t>0&&s.addRoundedRect(t,t,e-2*t,e-2*t,o-t),_0x47d81e(extrude(s,{depth:0,fillRule:"evenodd"}))});export function buildBoard(e,o,t){loadGlowTexture();const s=toWorld(o,o.boardLeft+o.boardSize/2,o.boardTop+o.boardSize/2),n=e.spawn({mesh:panelMesh(o.boardSize,BOARD_RADIUS),position:[s[0],s[1],0],color:toColor(t.BOARD.SURFACE),pickable:!1}),a=e.spawn({mesh:panelMesh(o.boardSize,BOARD_RADIUS,1),position:[s[0],s[1],.2],color:toColor(t.BOARD.BORDER),pickable:!1});return{backdrop:spawnBackdrop(e,o.width,o.height,-20,t),panel:n,rim:a}}export function removeBoard(e,o){e.despawn(o.panel),e.despawn(o.rim),e.despawn(o.backdrop)}const DOTS=DOT_COLORS.map(e=>toColor(e)),LINES=DOT_COLORS.map(e=>toColor(lighten(e,.15)));export const dotColor=e=>DOTS[e];export const lineColor=e=>LINES[e];let glowTexture=null,glowLoading=null;export function loadGlowTexture(){glowLoading??=loadTexture(require("../../assets/textures/soft_glow.png")).then(e=>{glowTexture=e}).catch(()=>{glowLoading=null})}export function spawnDot(e,o,t,s,n){const a=dotColor(n),r=e.spawn({mesh:dotMesh(),position:dotPosition(o,t,s),scale:2*o.radius,color:a,pickable:!1});return{entity:r,glow:e.spawn({mesh:discMesh(),texture:glowTexture,parent:r,position:[0,0,-.55],scale:0,color:[a[0],a[1],a[2],GLOW_ALPHA],pickable:!1})}}export function showGlow(e,o,t){t&&glowTexture&&e.set(o,{mesh:discMesh(),texture:glowTexture}),e.stopAnimation(o),e.animate(o,{scale:t?GLOW_SIZE:0},t?{duration:GLOW_IN_TIME,easing:"back"}:{duration:GLOW_OUT_TIME,easing:"easeIn"})}export function dotBurst(e,o,t,s){const n=dotPosition(e,o,t);return{position:[n[0],n[1],n[2]+e.radius],size:2*e.radius,color:dotColor(s),glowZ:.8*e.radius}}export const dotScale=e=>2*e.radius;export function spawnSegment(e){const o=()=>e.spawn({mesh:"cube",scale:0,pickable:!1});return{shadow:o(),line:o()}}const SHADOW=[0,0,0,.3],scratch=[0,0,0,1];function placeBar(e,o,t,s,n,a,r,i){const l=n[0]-s[0],d=s[1]-n[1],p=toWorld(o,(s[0]+n[0])/2,(s[1]+n[1])/2,r),h=quat.z(Math.atan2(d,l),scratch);e.transform(t,p[0],p[1],p[2],h[0],h[1],h[2],h[3]),e.scale(t,Math.hypot(l,d),a,.5),e.color(t,i[0],i[1],i[2],i[3]??1)}export const lineWidth=e=>.45*e.radius;export function showSegment(e,o,t,s,n,a){const r=e.transforms,i=lineWidth(o);placeBar(r,o,t.shadow,[s[0]+1,s[1]+2],[n[0]+1,n[1]+2],i+2,shadowZ(o),SHADOW),placeBar(r,o,t.line,s,n,i,lineZ(o),a),r.flush()}export function hideSegment(e,o){e.set(o.shadow,{scale:0}),e.set(o.line,{scale:0})}export function spawnTrail(e){return{line:e.spawn({mesh:"cube",scale:0,pickable:!1}),cap:e.spawn({mesh:discMesh(),scale:0,pickable:!1})}}export function showTrail(e,o,t,s,n,a){const r=e.transforms,i=lineWidth(o);placeBar(r,o,t.line,s,n,i,lineZ(o),a);const l=toWorld(o,n[0],n[1],lineZ(o));r.position(t.cap,l[0],l[1],l[2]),r.scale(t.cap,i),r.color(t.cap,a[0],a[1],a[2],a[3]??1),r.flush()}export function hideTrail(e,o){e.set(o.line,{scale:0}),e.set(o.cap,{scale:0})}export const DOT_COUNT=GRID_SIZE*GRID_SIZE;
1
+ "use strict";import{extrude,loadTexture,Path,quat,shapeGeometry}from"@nayan-ui/engine";import{lighten}from"../../services/GamesConstants.js";import{spawnBackdrop}from"../shared/EngineBackdrop.js";import{cacheGameAsset,createGameMesh as _0x239463}from"../shared/EngineMeshes.js";import{toColor}from"../shared/EngineUtils.js";import{BOARD_RADIUS,DOT_COLORS,DOT_SHINE,GLOW_ALPHA,GLOW_IN_TIME,GLOW_OUT_TIME,GLOW_SIZE,GRID_SIZE}from"./ConnectEmAllConstants.js";const Z_BOARD=0,Z_BACKDROP=-20,HIDDEN=0;export const toWorld=(e,o,t,s=0)=>[o-e.width/2,e.height/2-t,s];export const dotPoint=(e,o,t)=>[e.boardLeft+e.padding+t*e.spacing,e.boardTop+e.padding+o*e.spacing];const dotZ=e=>2*e.radius,lineZ=e=>.5*e.radius,shadowZ=e=>.4*e.radius;export const dotPosition=(e,o,t)=>{const[s,n]=dotPoint(e,o,t);return toWorld(e,s,n,dotZ(e))};const meshes=new Map,mesh=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("connect-em-all/ConnectEmAllScene:"+e,o),meshes.set(e,t)),t},dotMesh=()=>mesh("dot",()=>_0x239463(shapeGeometry("sphere"),{shine:DOT_SHINE})),discMesh=()=>mesh("disc",()=>_0x239463(extrude((new Path).addCircle(0,0,.5),{depth:0}))),panelMesh=(e,o,t=0)=>mesh("panel:"+e+":"+o+":"+t,()=>{const s=(new Path).addRoundedRect(0,0,e,e,o);return t>0&&s.addRoundedRect(t,t,e-2*t,e-2*t,o-t),_0x239463(extrude(s,{depth:0,fillRule:"evenodd"}))});export function buildBoard(e,o,t){loadGlowTexture();const s=toWorld(o,o.boardLeft+o.boardSize/2,o.boardTop+o.boardSize/2),n=e.spawn({mesh:panelMesh(o.boardSize,BOARD_RADIUS),position:[s[0],s[1],0],color:toColor(t.BOARD.SURFACE),pickable:!1}),a=e.spawn({mesh:panelMesh(o.boardSize,BOARD_RADIUS,1),position:[s[0],s[1],.2],color:toColor(t.BOARD.BORDER),pickable:!1});return{backdrop:spawnBackdrop(e,o.width,o.height,-20,t),panel:n,rim:a}}export function removeBoard(e,o){e.despawn(o.panel),e.despawn(o.rim),e.despawn(o.backdrop)}const DOTS=DOT_COLORS.map(e=>toColor(e)),LINES=DOT_COLORS.map(e=>toColor(lighten(e,.15)));export const dotColor=e=>DOTS[e];export const lineColor=e=>LINES[e];let glowTexture=null,glowLoading=null;export function loadGlowTexture(){glowLoading??=loadTexture(require("../../assets/textures/soft_glow.png")).then(e=>{glowTexture=e}).catch(()=>{glowLoading=null})}export function spawnDot(e,o,t,s,n){const a=dotColor(n),r=e.spawn({mesh:dotMesh(),position:dotPosition(o,t,s),scale:2*o.radius,color:a,pickable:!1});return{entity:r,glow:e.spawn({mesh:discMesh(),texture:glowTexture,parent:r,position:[0,0,-.55],scale:0,color:[a[0],a[1],a[2],GLOW_ALPHA],pickable:!1})}}export function showGlow(e,o,t){t&&glowTexture&&e.set(o,{mesh:discMesh(),texture:glowTexture}),e.stopAnimation(o),e.animate(o,{scale:t?GLOW_SIZE:0},t?{duration:GLOW_IN_TIME,easing:"back"}:{duration:GLOW_OUT_TIME,easing:"easeIn"})}export function dotBurst(e,o,t,s){const n=dotPosition(e,o,t);return{position:[n[0],n[1],n[2]+e.radius],size:2*e.radius,color:dotColor(s),glowZ:.8*e.radius}}export const dotScale=e=>2*e.radius;export function spawnSegment(e){const o=()=>e.spawn({mesh:"cube",scale:0,pickable:!1});return{shadow:o(),line:o()}}const SHADOW=[0,0,0,.3],scratch=[0,0,0,1];function placeBar(e,o,t,s,n,a,r,i){const l=n[0]-s[0],d=s[1]-n[1],p=toWorld(o,(s[0]+n[0])/2,(s[1]+n[1])/2,r),h=quat.z(Math.atan2(d,l),scratch);e.transform(t,p[0],p[1],p[2],h[0],h[1],h[2],h[3]),e.scale(t,Math.hypot(l,d),a,.5),e.color(t,i[0],i[1],i[2],i[3]??1)}export const lineWidth=e=>.45*e.radius;export function showSegment(e,o,t,s,n,a){const r=e.transforms,i=lineWidth(o);placeBar(r,o,t.shadow,[s[0]+1,s[1]+2],[n[0]+1,n[1]+2],i+2,shadowZ(o),SHADOW),placeBar(r,o,t.line,s,n,i,lineZ(o),a),r.flush()}export function hideSegment(e,o){e.set(o.shadow,{scale:0}),e.set(o.line,{scale:0})}export function spawnTrail(e){return{line:e.spawn({mesh:"cube",scale:0,pickable:!1}),cap:e.spawn({mesh:discMesh(),scale:0,pickable:!1})}}export function showTrail(e,o,t,s,n,a){const r=e.transforms,i=lineWidth(o);placeBar(r,o,t.line,s,n,i,lineZ(o),a);const l=toWorld(o,n[0],n[1],lineZ(o));r.position(t.cap,l[0],l[1],l[2]),r.scale(t.cap,i),r.color(t.cap,a[0],a[1],a[2],a[3]??1),r.flush()}export function hideTrail(e,o){e.set(o.line,{scale:0}),e.set(o.cap,{scale:0})}export const DOT_COUNT=GRID_SIZE*GRID_SIZE;
@@ -1 +1 @@
1
- "use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{scoreColumn,textColumn,timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{DAY_LIGHT,GAME_DURATION,getLayout,LOW_TIME,NIGHT_LIGHT,SKY_DAY,SKY_NIGHT,TOTAL_ROADS}from"./CrossyRoadConstants.js";import{createGame,dispose,drag,reset,setLayout,setNight,start,tick}from"./CrossyRoadGame.js";import{jsx as _0x1abeb7}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.CROSSY_ROAD;export const CrossyRoad=engineGame(GAME_IDS.CROSSY_ROAD,e=>{const[s,t]=useLiveState(0),[r,o]=useLiveState(0),[a,i]=useLiveState(GAME_DURATION),{theme:S,status:n,screen:m,gameOver:u}=useEngineGame(e,{gameId:GAME_IDS.CROSSY_ROAD,create:e=>createGame(e.isDark),start:start,reset:reset,dispose:dispose,tick:tick,setTheme:(e,s)=>setNight(e,s.isDark),resize:(e,s,t,r)=>{const o=getLayout(s,t,r);return setLayout(e,o),o.gridW},drag:drag,sounds:SOUNDS,resultsDelay:e=>"win"===e?1050:450,onStart:e=>e(SOUNDS.START,HapticType.SUCCESS),onStop:e=>e(null,HapticType.MEDIUM),onOver:(e,s)=>{"win"===s&&e(SOUNDS.WIN,HapticType.SUCCESS)},wire:(e,s)=>{e.onScore=(e,s)=>{t(e),o(s)},e.onTime=i,e.onEvent=e=>{"hop"===e?s(SOUNDS.HOP,HapticType.LIGHT):"cross"===e?s(SOUNDS.CROSS,HapticType.SUCCESS):s("crash"===e?SOUNDS.CRASH:SOUNDS.TIME_UP,HapticType.ERROR)}}}),O=S.isDark;return _0x1abeb7(EngineGameScreen,{...m,light:O?NIGHT_LIGHT:DAY_LIGHT,background:O?SKY_NIGHT:SKY_DAY,fog:.0015,columns:[scoreColumn(s),textColumn("CROSSINGS",r+"/"+TOTAL_ROADS),timerColumn(a,S,LOW_TIME)],subtext:"Cross roads, dodge traffic!",gameOver:u({title:"win"===n?"YOU WIN!":"GAME OVER",message:"win"===n?"You crossed all "+r+" roads with time to spare!":"You crossed "+r+" "+(1===r?"road":"roads")+"!",scoreLabel:"Score",score:s,buttonText:"Play Again!"})})});
1
+ "use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{scoreColumn,textColumn,timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{DAY_LIGHT,GAME_DURATION,getLayout,LOW_TIME,NIGHT_LIGHT,SKY_DAY,SKY_NIGHT,TOTAL_ROADS}from"./CrossyRoadConstants.js";import{createGame,dispose,drag,reset,setLayout,setNight,start,tick}from"./CrossyRoadGame.js";import{jsx as _0xce9a9f}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.CROSSY_ROAD;export const CrossyRoad=engineGame(GAME_IDS.CROSSY_ROAD,e=>{const[s,t]=useLiveState(0),[r,o]=useLiveState(0),[a,i]=useLiveState(GAME_DURATION),{theme:S,status:n,screen:m,gameOver:u}=useEngineGame(e,{gameId:GAME_IDS.CROSSY_ROAD,create:e=>createGame(e.isDark),start:start,reset:reset,dispose:dispose,tick:tick,setTheme:(e,s)=>setNight(e,s.isDark),resize:(e,s,t,r)=>{const o=getLayout(s,t,r);return setLayout(e,o),o.gridW},drag:drag,sounds:SOUNDS,resultsDelay:e=>"win"===e?1050:450,onStart:e=>e(SOUNDS.START,HapticType.SUCCESS),onStop:e=>e(null,HapticType.MEDIUM),onOver:(e,s)=>{"win"===s&&e(SOUNDS.WIN,HapticType.SUCCESS)},wire:(e,s)=>{e.onScore=(e,s)=>{t(e),o(s)},e.onTime=i,e.onEvent=e=>{"hop"===e?s(SOUNDS.HOP,HapticType.LIGHT):"cross"===e?s(SOUNDS.CROSS,HapticType.SUCCESS):s("crash"===e?SOUNDS.CRASH:SOUNDS.TIME_UP,HapticType.ERROR)}}}),O=S.isDark;return _0xce9a9f(EngineGameScreen,{...m,light:O?NIGHT_LIGHT:DAY_LIGHT,background:O?SKY_NIGHT:SKY_DAY,fog:.0015,columns:[scoreColumn(s),textColumn("CROSSINGS",r+"/"+TOTAL_ROADS),timerColumn(a,S,LOW_TIME)],subtext:"Cross roads, dodge traffic!",gameOver:u({title:"win"===n?"YOU WIN!":"GAME OVER",message:"win"===n?"You crossed all "+r+" roads with time to spare!":"You crossed "+r+" "+(1===r?"road":"roads")+"!",scoreLabel:"Score",score:s,buttonText:"Play Again!"})})});
@@ -1 +1 @@
1
- "use strict";import{merge}from"@nayan-ui/engine";import{cacheGameAsset,createGameMesh as _0x3cf61a}from"../shared/EngineMeshes.js";const WHITE=[1,1,1,1],GLASS=[.18,.34,.42,1],TYRE=[.11,.13,.17,1],CHROME=[.75,.81,.82,1],CREAM=[.94,.94,.86,1];function solid(o,e){const s=[],r=[],t=[0,1,2].map(e=>o.reduce((o,s)=>o+s[e],0)/o.length);for(const n of e){const[e,h,u]=n.map(e=>o[e]),a=h.map((o,s)=>o-e[s]),i=u.map((o,s)=>o-e[s]);let p=[a[1]*i[2]-a[2]*i[1],a[2]*i[0]-a[0]*i[2],a[0]*i[1]-a[1]*i[0]];const l=[0,1,2].map(e=>n.reduce((s,r)=>s+o[r][e],0)/n.length),f=p.reduce((o,e,s)=>o+e*(l[s]-t[s]),0)<0;f&&(p=p.map(o=>-o));const m=Math.hypot(...p)||1,b=s.length/11;for(const e of n)s.push(...o[e],...p.map(o=>o/m),1,1,1,0,0);for(let o=1;o<n.length-1;o++)r.push(b,b+(f?o+1:o),b+(f?o:o+1))}return{vertices:Float32Array.from(s),indices:Uint32Array.from(r)}}const FACES=[[0,1,2,3],[4,5,6,7],[0,1,5,4],[1,2,6,5],[2,3,7,6],[3,0,4,7]],cube=solid([[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5],[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5]],FACES),box=(o,e,s=WHITE)=>({geometry:cube,position:o,scale:e,color:s}),model=o=>_0x3cf61a(merge(o),{center:!1});function cabin(o,e,s,r){return solid([[o,-.44,s],[e,-.44,s],[e,.44,s],[o,.44,s],[o+.07,-.36,r],[e-.1,-.36,r],[e-.1,.36,r],[o+.07,.36,r]],FACES)}const wheel=(()=>{const o=[];for(const e of[-1,1])for(let s=0;s<8;s++){const r=s*Math.PI/4;o.push([.13*Math.cos(r),.065*e,.13*Math.sin(r)])}return solid(o,[Array.from({length:8},(o,e)=>e),Array.from({length:8},(o,e)=>e+8),...Array.from({length:8},(o,e)=>[e,(e+1)%8,(e+1)%8+8,e+8])])})();function vehicle(o){const e="bus"===o,s="pickup"===o,r="taxi"===o,t=e?2.4:s?1.7:r?1.5:1.4,n=[box([0,0,.3],[.96,.94,.26])],h=[box([0,0,.17],[.88,.82,.07],TYRE)];if(e){h.push(box([0,0,.65],[.94,.91,.48],CREAM)),n.push(box([0,0,.91],[.96,.94,.06]));for(const o of[-1,1]){for(let e=0;e<6;e++)h.push(box([.147*e-.375,.462*o,.69],[.118,.015,.24],GLASS));h.push(box([.2,.475*o,.36],[.52,.018,.055],CREAM))}h.push(box([.478,0,.69],[.02,.78,.29],GLASS),box([-.478,0,.69],[.02,.71,.22],GLASS)),h.push(box([.483,0,.87],[.025,.48,.075],TYRE),box([.49,0,.87],[.025,.3,.024],[1,.78,.3,1])),h.push(box([-.08,0,.97],[.25,.5,.07],CHROME))}else{const o=s?-.04:-.3,e=.28;h.push({geometry:cabin(o,e,.43,.73),color:GLASS}),n.push(box([(o+e-.03)/2,0,.745],[e-o-.13,.76,.055]));for(const o of[-1,1])n.push(box([.035,.44*o,.57],[.034,.04,.29])),h.push(box([.14,.48*o,.42],[.065,.015,.022],CHROME));if(s){h.push(box([-.28,0,.438],[.35,.7,.018],TYRE));for(const o of[-1,1])n.push(box([-.28,.42*o,.49],[.38,.07,.15]));h.push(box([-.31,0,.51],[.15,.28,.14],[.66,.44,.25,1]))}if(r){h.push(box([-.04,0,.82],[.16,.38,.1],[1,.83,.23,1]));for(const o of[-1,1])for(let e=0;e<5;e++)h.push(box([.11*e-.28,.477*o,.32],[.055,.015,.055],TYRE))}}for(const o of[-.31,.3])for(const e of[-1,1])h.push({geometry:wheel,position:[o,.46*e,.13],scale:[1/t,1,1],color:TYRE}),h.push(box([o,.529*e,.13],[.11/t,.012,.11],CHROME));h.push(box([.485,0,.22],[.035,.8,.07],CHROME),box([-.485,0,.22],[.035,.8,.07],CHROME)),h.push(box([.485,0,.33],[.028,.35,.08],TYRE));const u=[];for(const o of[-1,1])u.push(box([.49,.34*o,.35],[.03,.18,.09],[1,.94,.68,1])),u.push(box([-.49,.34*o,.35],[.03,.14,.09],[1,.12,.08,1]));return{body:model(n),details:model(h),lights:model(u)}}function pyramid(o,e,s){const r=o/2;return solid([[-r,-r,e],[r,-r,e],[r,r,e],[-r,r,e],[0,0,s]],[[0,1,2,3],[0,1,4],[1,2,4],[2,3,4],[3,0,4]])}let cached=null;export function crossyMeshes(){return cacheGameAsset("crossy-road/CrossyRoadMeshes:crossyMeshes",()=>crossyMeshesUncached())}function crossyMeshesUncached(){return cached||(cached={vehicles:{compact:vehicle("compact"),taxi:vehicle("taxi"),pickup:vehicle("pickup"),bus:vehicle("bus")},tree:model([box([0,0,.3],[.14,.14,.6],[.45,.28,.16,1]),{geometry:pyramid(.9,.35,1.1),color:[.2,.48,.3,1]},{geometry:pyramid(.7,.75,1.4),color:[.26,.59,.34,1]},{geometry:pyramid(.5,1.1,1.65),color:[.34,.67,.4,1]}]),bush:model([box([-.23,0,.22],[.44,.6,.44]),box([.12,.03,.3],[.6,.65,.6]),box([.4,-.03,.18],[.3,.45,.36])]),rock:model([{geometry:cabin(-.4,.4,0,.4)}])},cached)}export function*warmAssets(){yield crossyMeshes}
1
+ "use strict";import{merge}from"@nayan-ui/engine";import{cacheGameAsset,createGameMesh as _0x58519f}from"../shared/EngineMeshes.js";const WHITE=[1,1,1,1],GLASS=[.18,.34,.42,1],TYRE=[.11,.13,.17,1],CHROME=[.75,.81,.82,1],CREAM=[.94,.94,.86,1];function solid(o,e){const s=[],r=[],t=[0,1,2].map(e=>o.reduce((o,s)=>o+s[e],0)/o.length);for(const n of e){const[e,h,u]=n.map(e=>o[e]),i=h.map((o,s)=>o-e[s]),a=u.map((o,s)=>o-e[s]);let p=[i[1]*a[2]-i[2]*a[1],i[2]*a[0]-i[0]*a[2],i[0]*a[1]-i[1]*a[0]];const l=[0,1,2].map(e=>n.reduce((s,r)=>s+o[r][e],0)/n.length),f=p.reduce((o,e,s)=>o+e*(l[s]-t[s]),0)<0;f&&(p=p.map(o=>-o));const m=Math.hypot(...p)||1,b=s.length/11;for(const e of n)s.push(...o[e],...p.map(o=>o/m),1,1,1,0,0);for(let o=1;o<n.length-1;o++)r.push(b,b+(f?o+1:o),b+(f?o:o+1))}return{vertices:Float32Array.from(s),indices:Uint32Array.from(r)}}const FACES=[[0,1,2,3],[4,5,6,7],[0,1,5,4],[1,2,6,5],[2,3,7,6],[3,0,4,7]],cube=solid([[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5],[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5]],FACES),box=(o,e,s=WHITE)=>({geometry:cube,position:o,scale:e,color:s}),model=o=>_0x58519f(merge(o),{center:!1});function cabin(o,e,s,r){return solid([[o,-.44,s],[e,-.44,s],[e,.44,s],[o,.44,s],[o+.07,-.36,r],[e-.1,-.36,r],[e-.1,.36,r],[o+.07,.36,r]],FACES)}const wheel=(()=>{const o=[];for(const e of[-1,1])for(let s=0;s<8;s++){const r=s*Math.PI/4;o.push([.13*Math.cos(r),.065*e,.13*Math.sin(r)])}return solid(o,[Array.from({length:8},(o,e)=>e),Array.from({length:8},(o,e)=>e+8),...Array.from({length:8},(o,e)=>[e,(e+1)%8,(e+1)%8+8,e+8])])})();function vehicle(o){const e="bus"===o,s="pickup"===o,r="taxi"===o,t=e?2.4:s?1.7:r?1.5:1.4,n=[box([0,0,.3],[.96,.94,.26])],h=[box([0,0,.17],[.88,.82,.07],TYRE)];if(e){h.push(box([0,0,.65],[.94,.91,.48],CREAM)),n.push(box([0,0,.91],[.96,.94,.06]));for(const o of[-1,1]){for(let e=0;e<6;e++)h.push(box([.147*e-.375,.462*o,.69],[.118,.015,.24],GLASS));h.push(box([.2,.475*o,.36],[.52,.018,.055],CREAM))}h.push(box([.478,0,.69],[.02,.78,.29],GLASS),box([-.478,0,.69],[.02,.71,.22],GLASS)),h.push(box([.483,0,.87],[.025,.48,.075],TYRE),box([.49,0,.87],[.025,.3,.024],[1,.78,.3,1])),h.push(box([-.08,0,.97],[.25,.5,.07],CHROME))}else{const o=s?-.04:-.3,e=.28;h.push({geometry:cabin(o,e,.43,.73),color:GLASS}),n.push(box([(o+e-.03)/2,0,.745],[e-o-.13,.76,.055]));for(const o of[-1,1])n.push(box([.035,.44*o,.57],[.034,.04,.29])),h.push(box([.14,.48*o,.42],[.065,.015,.022],CHROME));if(s){h.push(box([-.28,0,.438],[.35,.7,.018],TYRE));for(const o of[-1,1])n.push(box([-.28,.42*o,.49],[.38,.07,.15]));h.push(box([-.31,0,.51],[.15,.28,.14],[.66,.44,.25,1]))}if(r){h.push(box([-.04,0,.82],[.16,.38,.1],[1,.83,.23,1]));for(const o of[-1,1])for(let e=0;e<5;e++)h.push(box([.11*e-.28,.477*o,.32],[.055,.015,.055],TYRE))}}for(const o of[-.31,.3])for(const e of[-1,1])h.push({geometry:wheel,position:[o,.46*e,.13],scale:[1/t,1,1],color:TYRE}),h.push(box([o,.529*e,.13],[.11/t,.012,.11],CHROME));h.push(box([.485,0,.22],[.035,.8,.07],CHROME),box([-.485,0,.22],[.035,.8,.07],CHROME)),h.push(box([.485,0,.33],[.028,.35,.08],TYRE));const u=[];for(const o of[-1,1])u.push(box([.49,.34*o,.35],[.03,.18,.09],[1,.94,.68,1])),u.push(box([-.49,.34*o,.35],[.03,.14,.09],[1,.12,.08,1]));return{body:model(n),details:model(h),lights:model(u)}}function pyramid(o,e,s){const r=o/2;return solid([[-r,-r,e],[r,-r,e],[r,r,e],[-r,r,e],[0,0,s]],[[0,1,2,3],[0,1,4],[1,2,4],[2,3,4],[3,0,4]])}let cached=null;export function crossyMeshes(){return cacheGameAsset("crossy-road/CrossyRoadMeshes:crossyMeshes",()=>crossyMeshesUncached())}function crossyMeshesUncached(){return cached||(cached={vehicles:{compact:vehicle("compact"),taxi:vehicle("taxi"),pickup:vehicle("pickup"),bus:vehicle("bus")},tree:model([box([0,0,.3],[.14,.14,.6],[.45,.28,.16,1]),{geometry:pyramid(.9,.35,1.1),color:[.2,.48,.3,1]},{geometry:pyramid(.7,.75,1.4),color:[.26,.59,.34,1]},{geometry:pyramid(.5,1.1,1.65),color:[.34,.67,.4,1]}]),bush:model([box([-.23,0,.22],[.44,.6,.44]),box([.12,.03,.3],[.6,.65,.6]),box([.4,-.03,.18],[.3,.45,.36])]),rock:model([{geometry:cabin(-.4,.4,0,.4)}])},cached)}export function*warmAssets(){yield crossyMeshes}
@@ -1 +1 @@
1
- "use strict";import{block,ellipsoid,loft,merge,tube}from"@nayan-ui/engine";import{cacheGameAsset,createGameMesh as _0x221759}from"../shared/EngineMeshes.js";import{toColor}from"../shared/EngineUtils.js";import{PERSON_COLORS}from"./CrossyRoadConstants.js";const part=(o,e,t)=>({geometry:o,position:e,color:t}),orb=(o,e,t,r=12)=>part(ellipsoid(o,void 0,r),e,t),pipe=(o,e,t,r=8)=>({geometry:tube(o,{radius:e,sides:r,smoothness:3}),color:t}),model=o=>_0x221759(merge(o),{center:!1,shine:.08});let cached=null;export function pedestrianMeshes(){return cacheGameAsset("crossy-road/CrossyRoadPerson:pedestrianMeshes",()=>pedestrianMeshesUncached())}function pedestrianMeshesUncached(){if(cached)return cached;const o=toColor(PERSON_COLORS.SKIN),e=toColor(PERSON_COLORS.JACKET),t=toColor(PERSON_COLORS.PANTS),r=toColor(PERSON_COLORS.HAIR),s=toColor(PERSON_COLORS.SHOE),p=toColor(PERSON_COLORS.SOLE),i=toColor(PERSON_COLORS.BACKPACK),a=toColor(PERSON_COLORS.STRAP),n=[{geometry:loft([{z:.9,bottom:-.12,top:.13,width:.15,square:3},{z:1.05,bottom:-.135,top:.14,width:.165,square:3},{z:1.32,bottom:-.14,top:.15,width:.225,square:2.8},{z:1.43,bottom:-.105,top:.11,width:.2,square:2.6},{z:1.48,bottom:-.065,top:.07,width:.075,square:2.4}],{around:16,smoothness:2}),color:e},orb([.16,.135,.12],[0,0,.86],t),pipe([[0,0,1.46],[0,0,1.57]],.052,o),orb([.106,.105,.135],[0,.005,1.65],o,16),orb([.027,.033,.031],[0,.11,1.642],o),orb([.111,.108,.067],[0,-.012,1.75],r,16),orb([.103,.052,.09],[0,-.075,1.685],r),{geometry:loft([{z:1.02,bottom:-.23,top:-.115,width:.13,square:4},{z:1.08,bottom:-.27,top:-.12,width:.15,square:4},{z:1.35,bottom:-.265,top:-.115,width:.145,square:4},{z:1.41,bottom:-.2,top:-.11,width:.1,square:3}],{around:12,smoothness:2}),color:i},part(block(.21,.028,.11),[0,-.269,1.14],a),pipe([[-.09,-.278,1.28],[.09,-.278,1.28]],.008,p,6),pipe([[0,.145,1.02],[0,.155,1.33],[0,.08,1.45]],.007,a,6),pipe([[-.02,.107,1.605],[0,.113,1.6],[.02,.107,1.605]],.004,toColor("#8D5044"),6)];for(const e of[-1,1])n.push(orb([.019,.02,.035],[.108*e,-.002,1.65],o)),n.push(orb([.023,.013,.015],[.047*e,.099,1.682],p,8)),n.push(orb([.01,.009,.01],[.047*e,.111,1.681],toColor("#293341"),8)),n.push(pipe([[.026*e,.099,1.709],[.065*e,.094,1.71]],.006,r,6)),n.push(pipe([[.13*e,-.16,1.38],[.16*e,.02,1.44],[.13*e,.152,1.25],[.13*e,.14,1.03]],.019,a));const d=model([pipe([[0,0,0],[0,.01,-.15],[0,.04,-.28]],.071,e),pipe([[0,.04,-.27],[0,.07,-.38],[0,.085,-.49]],.042,o),orb([.038,.044,.062],[0,.085,-.49],o)]),h=model([pipe([[0,0,0],[0,.025,-.33],[0,-.01,-.72]],.072,t),orb([.073,.075,.08],[0,.025,-.33],t)]),l=model([orb([.068,.14,.063],[0,.075,-.06],s),part(block(.14,.275,.025),[0,.075,-.115],p),pipe([[-.04,.09,-.005],[.04,.09,-.005]],.008,p,6),pipe([[-.04,.13,-.01],[.04,.13,-.01]],.008,p,6)]);return cached={torso:model(n),arm:d,leg:h,shoe:l},cached}export function*warmAssets(){yield pedestrianMeshes}
1
+ "use strict";import{block,ellipsoid,loft,merge,tube}from"@nayan-ui/engine";import{cacheGameAsset,createGameMesh as _0x80e4cb}from"../shared/EngineMeshes.js";import{toColor}from"../shared/EngineUtils.js";import{PERSON_COLORS}from"./CrossyRoadConstants.js";const part=(o,e,t)=>({geometry:o,position:e,color:t}),orb=(o,e,t,r=12)=>part(ellipsoid(o,void 0,r),e,t),pipe=(o,e,t,r=8)=>({geometry:tube(o,{radius:e,sides:r,smoothness:3}),color:t}),model=o=>_0x80e4cb(merge(o),{center:!1,shine:.08});let cached=null;export function pedestrianMeshes(){return cacheGameAsset("crossy-road/CrossyRoadPerson:pedestrianMeshes",()=>pedestrianMeshesUncached())}function pedestrianMeshesUncached(){if(cached)return cached;const o=toColor(PERSON_COLORS.SKIN),e=toColor(PERSON_COLORS.JACKET),t=toColor(PERSON_COLORS.PANTS),r=toColor(PERSON_COLORS.HAIR),s=toColor(PERSON_COLORS.SHOE),p=toColor(PERSON_COLORS.SOLE),i=toColor(PERSON_COLORS.BACKPACK),a=toColor(PERSON_COLORS.STRAP),n=[{geometry:loft([{z:.9,bottom:-.12,top:.13,width:.15,square:3},{z:1.05,bottom:-.135,top:.14,width:.165,square:3},{z:1.32,bottom:-.14,top:.15,width:.225,square:2.8},{z:1.43,bottom:-.105,top:.11,width:.2,square:2.6},{z:1.48,bottom:-.065,top:.07,width:.075,square:2.4}],{around:16,smoothness:2}),color:e},orb([.16,.135,.12],[0,0,.86],t),pipe([[0,0,1.46],[0,0,1.57]],.052,o),orb([.106,.105,.135],[0,.005,1.65],o,16),orb([.027,.033,.031],[0,.11,1.642],o),orb([.111,.108,.067],[0,-.012,1.75],r,16),orb([.103,.052,.09],[0,-.075,1.685],r),{geometry:loft([{z:1.02,bottom:-.23,top:-.115,width:.13,square:4},{z:1.08,bottom:-.27,top:-.12,width:.15,square:4},{z:1.35,bottom:-.265,top:-.115,width:.145,square:4},{z:1.41,bottom:-.2,top:-.11,width:.1,square:3}],{around:12,smoothness:2}),color:i},part(block(.21,.028,.11),[0,-.269,1.14],a),pipe([[-.09,-.278,1.28],[.09,-.278,1.28]],.008,p,6),pipe([[0,.145,1.02],[0,.155,1.33],[0,.08,1.45]],.007,a,6),pipe([[-.02,.107,1.605],[0,.113,1.6],[.02,.107,1.605]],.004,toColor("#8D5044"),6)];for(const e of[-1,1])n.push(orb([.019,.02,.035],[.108*e,-.002,1.65],o)),n.push(orb([.023,.013,.015],[.047*e,.099,1.682],p,8)),n.push(orb([.01,.009,.01],[.047*e,.111,1.681],toColor("#293341"),8)),n.push(pipe([[.026*e,.099,1.709],[.065*e,.094,1.71]],.006,r,6)),n.push(pipe([[.13*e,-.16,1.38],[.16*e,.02,1.44],[.13*e,.152,1.25],[.13*e,.14,1.03]],.019,a));const d=model([pipe([[0,0,0],[0,.01,-.15],[0,.04,-.28]],.071,e),pipe([[0,.04,-.27],[0,.07,-.38],[0,.085,-.49]],.042,o),orb([.038,.044,.062],[0,.085,-.49],o)]),h=model([pipe([[0,0,0],[0,.025,-.33],[0,-.01,-.72]],.072,t),orb([.073,.075,.08],[0,.025,-.33],t)]),l=model([orb([.068,.14,.063],[0,.075,-.06],s),part(block(.14,.275,.025),[0,.075,-.115],p),pipe([[-.04,.09,-.005],[.04,.09,-.005]],.008,p,6),pipe([[-.04,.13,-.01],[.04,.13,-.01]],.008,p,6)]);return cached={torso:model(n),arm:d,leg:h,shoe:l},cached}export function*warmAssets(){yield pedestrianMeshes}
@@ -1 +1 @@
1
- "use strict";import{useMemo}from"react";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{livesColumn,scoreColumn,timerColumn}from"../shared/EngineHud.js";import{backgroundFor,lightFor}from"../shared/EngineMeadow.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,LIVES,TIME_LIMIT}from"./DinoJumpConstants.js";import{createGame,dispose,jump,reset,setLayout,setTheme,start,tick}from"./DinoJumpGame.js";import{jsx as _0x528447}from"react/jsx-runtime";const SFX=GAME_SOUNDS.DINO_JUMP,formatScore=e=>e.toLocaleString();export const DinoJump=engineGame(GAME_IDS.DINO_JUMP,e=>{const[t,r]=useLiveState(0),[o,s]=useLiveState(LIVES),[i,n]=useLiveState(TIME_LIMIT),{theme:a,status:m,screen:u,gameOver:S}=useEngineGame(e,{gameId:GAME_IDS.DINO_JUMP,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,r,o)=>setLayout(e,getLayout(t,r,o)),drag:(e,{phase:t})=>{"start"===t&&jump(e)},sounds:SFX,onStart:e=>e(SFX.START,HapticType.MEDIUM),onPlayAgain:e=>e(null,HapticType.LIGHT),onOver:(e,t)=>e("win"===t?SFX.WIN:SFX.GAME_OVER,"win"===t?HapticType.SUCCESS:HapticType.ERROR),wire:(e,t)=>{e.onScore=r,e.onLives=s,e.onTime=n,e.onJump=()=>t(SFX.JUMP,HapticType.LIGHT),e.onCollect=()=>t(SFX.COLLECT,HapticType.SUCCESS),e.onHit=()=>t(SFX.HIT,HapticType.HEAVY)}}),p=useMemo(()=>lightFor(a),[a]),E=useMemo(()=>backgroundFor(a),[a]);return _0x528447(EngineGameScreen,{...u,light:p,background:E,columns:[scoreColumn(t,"SCORE",formatScore),livesColumn(o,LIVES),timerColumn(i,a)],subtext:"Jump over the cacti!",gameOver:S({title:"win"===m?"YOU SURVIVED!":"GAME OVER",message:"win"===m?"Great running!":"You hit an obstacle!",scoreLabel:"Final Score",score:t,buttonText:"Run Again!"})})});
1
+ "use strict";import{useMemo}from"react";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{livesColumn,scoreColumn,timerColumn}from"../shared/EngineHud.js";import{backgroundFor,lightFor}from"../shared/EngineMeadow.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,LIVES,TIME_LIMIT}from"./DinoJumpConstants.js";import{createGame,dispose,jump,reset,setLayout,setTheme,start,tick}from"./DinoJumpGame.js";import{jsx as _0x48fa00}from"react/jsx-runtime";const SFX=GAME_SOUNDS.DINO_JUMP,formatScore=e=>e.toLocaleString();export const DinoJump=engineGame(GAME_IDS.DINO_JUMP,e=>{const[t,r]=useLiveState(0),[o,s]=useLiveState(LIVES),[i,a]=useLiveState(TIME_LIMIT),{theme:n,status:m,screen:u,gameOver:S}=useEngineGame(e,{gameId:GAME_IDS.DINO_JUMP,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,r,o)=>setLayout(e,getLayout(t,r,o)),drag:(e,{phase:t})=>{"start"===t&&jump(e)},sounds:SFX,onStart:e=>e(SFX.START,HapticType.MEDIUM),onPlayAgain:e=>e(null,HapticType.LIGHT),onOver:(e,t)=>e("win"===t?SFX.WIN:SFX.GAME_OVER,"win"===t?HapticType.SUCCESS:HapticType.ERROR),wire:(e,t)=>{e.onScore=r,e.onLives=s,e.onTime=a,e.onJump=()=>t(SFX.JUMP,HapticType.LIGHT),e.onCollect=()=>t(SFX.COLLECT,HapticType.SUCCESS),e.onHit=()=>t(SFX.HIT,HapticType.HEAVY)}}),p=useMemo(()=>lightFor(n),[n]),E=useMemo(()=>backgroundFor(n),[n]);return _0x48fa00(EngineGameScreen,{...u,light:p,background:E,columns:[scoreColumn(t,"SCORE",formatScore),livesColumn(o,LIVES),timerColumn(i,n)],subtext:"Jump over the cacti!",gameOver:S({title:"win"===m?"YOU SURVIVED!":"GAME OVER",message:"win"===m?"Great running!":"You hit an obstacle!",scoreLabel:"Final Score",score:t,buttonText:"Run Again!"})})});
@@ -1 +1 @@
1
- "use strict";import{effects,lathe,merge,quat,recolor,shapeGeometry,tube}from"@nayan-ui/engine";import{at,bushMesh,fbm,HAZE,noise,pointSize,random,rockMesh,sceneryTint,tuftMesh}from"../shared/EngineMeadow.js";import{cacheGameAsset,createGameMesh as _0x1571ec}from"../shared/EngineMeshes.js";import{toColor}from"../shared/EngineUtils.js";import{DINO_HEIGHT,DINO_WIDTH,OBSTACLE_SIZE,STRIDE_TIME,TILE}from"./DinoJumpConstants.js";const meshes=new Map,cached=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("dino-jump/DinoJumpScene:"+e,o),meshes.set(e,t)),t},rgb=e=>{const[o,t,r]=toColor(e);return[o,t,r]},mix=(e,o,t)=>[e[0]+(o[0]-e[0])*t,e[1]+(o[1]-e[1])*t,e[2]+(o[2]-e[2])*t],sphere=()=>shapeGeometry("sphere"),ribbed=(e,o)=>({displace:t=>o*Math.cos(t*Math.PI*2*e),color:({u:o})=>mix(rgb("#2f6b2c"),rgb("#5aa646"),.5+.5*Math.cos(o*Math.PI*2*e))}),smallCactusMesh=()=>cached("dj-cactus-small",()=>_0x1571ec(merge([{geometry:lathe([[.34,0],[.36,.55],[.33,.82],[.22,.96],[.001,1]],{segments:24,...ribbed(10,.025)})},{geometry:tube([[.25,.4,0],[.42,.42,0],[.45,.62,0]],{radius:.1,color:rgb("#3f8a38")})}]),{center:!1,shine:.25})),largeCactusMesh=()=>cached("dj-cactus-large",()=>_0x1571ec(merge([{geometry:lathe([[.22,0],[.24,.6],[.22,.86],[.15,.97],[.001,1]],{segments:24,...ribbed(12,.018)})},{geometry:tube([[-.18,.36,0],[-.4,.38,0],[-.42,.66,0]],{radius:.085,color:rgb("#3f8a38")})},{geometry:tube([[.18,.46,0],[.38,.48,0],[.4,.76,0]],{radius:.08,color:rgb("#3f8a38")})}]),{center:!1,shine:.25})),mushroomMesh=()=>cached("dj-mushroom",()=>{const e=[],o=random(5);for(let t=0;t<9;t++){const t=o()*Math.PI*2,r=.25+.6*o(),s=.5*Math.cos(1.2*r);e.push({geometry:sphere(),position:[Math.cos(t)*s,.5+.48*r,Math.sin(t)*s],scale:.09+.05*o(),color:[1,1,1]})}return _0x1571ec(merge([{geometry:lathe([[.15,0],[.17,.25],[.14,.52]],{segments:16,color:rgb("#f3e3c3")})},{geometry:lathe([[.001,.46],[.5,.48],[.47,.66],[.34,.86],[.16,.97],[.001,1]],{segments:24,color:rgb("#e23b33")})},...e]),{center:!1,shine:.5})}),OBSTACLE_MESH={cactus_small:smallCactusMesh,cactus_large:largeCactusMesh,mushroom:mushroomMesh};export function spawnObstacle(e,o,t,r,s,a){const n=pointSize(o),{width:i,height:h}=OBSTACLE_SIZE[r];return e.spawn({mesh:OBSTACLE_MESH[r](),position:at(o,s+i/2,t.groundY),scale:[i*n,h*n,i*n*("cactus_large"===r?.6:1)],rotation:quat.y("mushroom"===r?.5:0),color:a,pickable:!1})}export function placeObstacle(e,o,t,r,s,a,n){const i=at(o,a+OBSTACLE_SIZE[s].width/2,t.groundY);n?n.position(r,i[0],i[1],i[2]):e.set(r,{position:i})}const SKIN_TOP=rgb("#3a4527"),SKIN_SIDE=rgb("#6d7a43"),SKIN_BELLY=rgb("#cdbf8f"),SKIN_STRIPE=rgb("#262b17"),CLAW=rgb("#2a2418"),TOOTH=rgb("#efe5c8"),MOUTH=rgb("#3a1a14"),smooth=(e,o,t)=>{const r=Math.min(1,Math.max(0,(t-e)/(o-e)));return r*r*(3-2*r)},hide=(e=!1)=>({position:o,normal:t})=>{const r=.5+.5*t[1];let s=mix(SKIN_BELLY,SKIN_SIDE,smooth(.22,.5,r));s=mix(s,SKIN_TOP,smooth(.6,.95,r)),e&&r>.55&&o[0]<.14&&(s=mix(s,SKIN_STRIPE,smooth(.45,.8,Math.sin(46*o[0]))*smooth(.55,.8,r)*.75));const a=.86+.28*noise(22*o[0]+3,22*o[1]+11*o[2]);return[s[0]*a,s[1]*a,s[2]*a]},skin=e=>recolor(e,hide()),taper=e=>o=>{for(let t=0;t+1<e.length;t++){const[r,s]=e[t],[a,n]=e[t+1];if(o<=a)return s+(n-s)*smooth(r,a,o)}return e[e.length-1][1]},claw=(e,o,t=CLAW)=>lathe([[o,0],[.6*o,.5*e],[.001,e]],{segments:8,color:t}),dinoMesh=()=>cached("dj-dino-rex",()=>{const e=tube([[-.54,.41,0],[-.42,.44,0],[-.28,.5,0],[-.12,.55,0],[.03,.57,0],[.14,.63,0],[.21,.73,0],[.26,.83,0]],{radius:taper([[0,.01],[.16,.042],[.33,.095],[.5,.155],[.62,.165],[.76,.12],[.88,.078],[1,.072]]),sides:24,smoothness:10,color:hide(!0)}),o=e=>.072-.026*e,t=tube([[.29,.885,0],[.38,.877,0],[.475,.862,0]],{radius:o,sides:18,color:hide()}),r=tube([[.27,.84,0],[.36,.818,0],[.455,.8,0]],{radius:e=>.046-.016*e,sides:16,color:hide()}),s=[];for(let e=0;e<7;e++){const t=.335+.021*e,r=(t-.29)/.185,a=o(r),n=.885-.023*r-.72*a;for(const o of[1,-1])s.push({geometry:claw(.026,.008,TOOTH),position:[t,n,o*a*.62],rotation:quat.z(Math.PI),scale:1-.08*Math.abs(e-2)})}const a=e=>[e,{...e,position:[e.position[0],e.position[1],-e.position[2]]}],n=e=>({geometry:skin(tube([[.15,.57,e],[.19,.51,1.15*e],[.235,.515,1.15*e]],{radius:e=>.026-.01*e,sides:10}))}),i=e=>[.012,-.012].map(o=>({geometry:claw(.022,.006),position:[.235,.512,1.15*e+o],rotation:quat.z(-2)}));return _0x1571ec(merge([{geometry:e,scale:[1,1,.8]},{geometry:skin(sphere()),position:[.01,.5,0],scale:[.36,.3,.25]},{geometry:skin(sphere()),position:[.3,.875,0],scale:[.2,.17,.16]},{geometry:t,scale:[1,1,.82]},{geometry:r,scale:[1,1,.78]},...s,...a({geometry:tube([[.28,.842,.046],[.37,.828,.042],[.455,.818,.032]],{radius:.006,sides:6,caps:!1}),position:[0,0,0],scale:1,color:MOUTH}),...a({geometry:skin(sphere()),position:[.335,.94,.05],scale:[.1,.032,.045]}),...a({geometry:sphere(),position:[.34,.91,.064],scale:.034,color:rgb("#d79a1c")}),...a({geometry:sphere(),position:[.345,.91,.079],scale:[.009,.026,.008],color:rgb("#0b0b0b")}),...a({geometry:sphere(),position:[.35,.918,.08],scale:.007,color:[1,1,1]}),...a({geometry:sphere(),position:[.462,.88,.026],scale:[.02,.012,.012],color:rgb("#1d1f12")}),n(.085),n(-.085),...i(.085),...i(-.085)]),{center:!1,shine:.18})}),legMesh=()=>cached("dj-leg-rex",()=>{const e=[-.032,0,.032].flatMap(e=>{const o=0===e?.1:.08,t=[.03+o,-.443,1.6*e];return[{geometry:skin(tube([[.03,-.438,.6*e],[.03+.55*o,-.44,1.2*e],t],{radius:e=>.021-.009*e,sides:8}))},{geometry:claw(.03,.011),position:t,rotation:quat.z(-1.75)}]});return _0x1571ec(merge([{geometry:skin(sphere()),position:[.01,-.07,0],scale:[.25,.3,.17],rotation:quat.z(-.25)},{geometry:skin(tube([[0,-.1,0],[.065,-.2,0]],{radius:e=>.075-.03*e,sides:12}))},{geometry:skin(tube([[.065,-.2,0],[.02,-.27,0],[-.03,-.33,0]],{radius:e=>.045-.016*e,sides:12}))},{geometry:skin(tube([[-.03,-.33,0],[-.005,-.39,0],[.03,-.437,0]],{radius:e=>.028-.004*e,sides:10}))},...e]),{center:!1,shine:.15})}),HIP=[-.06,.46,0],SWING=.5;export function spawnDino(e,o,t,r,s){const a=DINO_HEIGHT*pointSize(o),n=e.spawn({mesh:"none",position:at(o,t,r),pickable:!1}),i=e.spawn({mesh:dinoMesh(),parent:n,scale:a,color:s,pickable:!1}),h=o=>e.spawn({mesh:legMesh(),parent:n,position:[HIP[0]*a,HIP[1]*a,o*a],scale:a,color:s,pickable:!1});return{root:n,body:i,near:h(.1),far:h(-.1)}}export const dinoCentre=e=>e+DINO_WIDTH/2;export function placeDino(e,o,t,r,s){e.set(t.root,{position:at(o,r,s)})}export function setGait(e,o,t,r){for(const o of[t.near,t.far])e.stopAnimation(o);const s=DINO_HEIGHT*pointSize(o);if("run"===r)return e.set(t.near,{rotation:quat.z(.5)}),e.set(t.far,{rotation:quat.z(-.5)}),e.animate(t.near,{rotation:quat.z(-.5)},{duration:STRIDE_TIME,easing:"easeInOut",repeat:"forever",yoyo:!0}),e.animate(t.far,{rotation:quat.z(.5)},{duration:STRIDE_TIME,easing:"easeInOut",repeat:"forever",yoyo:!0}),void e.set(t.root,{bob:{amplitude:[0,.025*s,0],speed:Math.PI/STRIDE_TIME}});e.set(t.root,{bob:null}),e.set(t.near,{rotation:quat.z("air"===r?.5:0)}),e.set(t.far,{rotation:quat.z("air"===r?-.25:0)})}export function hurtDino(e,o,t){e.animate(o.body,[{color:[1.8,.35,.35,1],at:.25},{color:t}],{duration:.4}),e.animate(o.root,{shake:.05},{duration:.3})}export function cheerDino(e,o,t){e.animate(o.body,[{color:[1.7,1.5,.7,1],at:.3},{color:t}],{duration:.45})}const SAND=[.86,.74,.55,.85],CACTUS_BITS=["#2f6b2c","#5aa646","#c9a063"].map(e=>toColor(e)),MUSHROOM_BITS=["#e23b33","#ffffff","#ffd54f"].map(e=>toColor(e));export function dust(e,o,t,r,s){const a=pointSize(o);effects.dust(e,{position:at(o,t,r),count:s?5:1,size:(s?22:14)*a,speed:(s?60:30)*a,direction:[-1,.5,0],spread:s?1.4:.6,lifetime:s?.5:.4,color:SAND,endSize:2.2})}export function hitBurst(e,o,t,r,s){const a=pointSize(o);effects.shatter(e,{position:at(o,t,r,o.playDepth-.3),count:12,mesh:s?"sphere":"cube",size:8*a,speed:220*a,lifetime:.55,gravity:-2200*a,colors:s?MUSHROOM_BITS:CACTUS_BITS})}const SAND_LIGHT=rgb("#ecd29a"),SAND_DARK=rgb("#cfa86a"),SAND_RED=rgb("#d89a62"),periodic=(e,o,t,r)=>{const s=(e%t+t)%t/t;return r(s*t,o)*(1-s)+r((s-1)*t,o)*s},floorMesh=e=>cached("dj-floor:"+e.toFixed(2),()=>{const o=[],t=[];for(let t=0;t<44;t++){const r=-(1.2+Math.pow(1.12,t)-1);for(let t=0;t<48;t++){const s=-TILE/2+t/47*TILE,a=periodic(s,r,TILE,(e,o)=>fbm(.07*e,.07*o)),n=periodic(s,r,TILE,(e,o)=>noise(.9*e,.35*o));let i=mix(SAND_DARK,SAND_LIGHT,a);i=mix(i,SAND_RED,.6*Math.max(0,.45-a)),i=mix(i,mix(i,[1,1,1],.12),.6*n);const h=Math.max(0,1-Math.abs(-r-e)/1.3);i=mix(i,rgb("#f2deb0"),.45*h);const m=1-Math.exp(-((-r/140)**2));i=mix(i,HAZE,.7*m),o.push(s,0,r,0,1,0,i[0],i[1],i[2],0,0)}}const r=(e,o)=>48*e+o;for(let e=0;e+1<44;e++)for(let o=0;o+1<48;o++)t.push(r(e,o),r(e,o+1),r(e+1,o+1),r(e,o),r(e+1,o+1),r(e+1,o));return _0x1571ec({vertices:new Float32Array(o),indices:new Uint32Array(t)},{center:!1})}),saguaroMesh=()=>cached("dj-saguaro",()=>_0x1571ec(merge([{geometry:lathe([[.07,0],[.075,.7],[.065,.92],[.035,.99],[.001,1]],{segments:18,...ribbed(12,.006)})},{geometry:tube([[-.06,.42,0],[-.2,.44,0],[-.22,.72,0]],{radius:.045,color:rgb("#3f8a38")})},{geometry:tube([[.06,.52,0],[.17,.54,0],[.18,.8,0]],{radius:.04,color:rgb("#3f8a38")})}]),{center:!1,shine:.2})),barrelMesh=()=>cached("dj-barrel",()=>_0x1571ec(merge([{geometry:lathe([[.001,0],[.3,.04],[.4,.22],[.36,.42],[.2,.54],[.001,.56]],{segments:22,...ribbed(14,.02)})},...[0,1,2,3,4].map(e=>({geometry:sphere(),position:[.12*Math.cos(1.26*e),.56,.12*Math.sin(1.26*e)],scale:.09,color:rgb("#ff6fa8")}))]),{center:!1,shine:.25}));export function spawnDesert(e,o,t){const r=sceneryTint(o),s=e=>[e[0]*r[0],e[1]*r[1],e[2]*r[2],e[3]??1];return{roots:[0,1,2].map(o=>{const r=e.spawn({mesh:floorMesh(t),color:s([1,1,1,1]),pickable:!1}),a=random(100+17*o),n=(o,t,n,i,h=[1,1,1,1],m=quat.y(6.3*a()))=>e.spawn({mesh:o,parent:r,position:[t,0,n],scale:i,rotation:m,color:s(h),pickable:!1}),i=()=>(a()-.5)*TILE,h=(e,o)=>{let r=-(e+a()*(o-e));return Math.abs(-r-t)<4&&(r-=5),r};for(let e=0;e<6;e++)n(saguaroMesh(),i(),h(18,70),3+3.5*a(),[1,1,1,1],quat.y(.6*a()-.3));for(let e=0;e<6;e++)n(barrelMesh(),i(),h(13,40),.5+.6*a());for(let e=0;e<8;e++){const e=.3+1.4*a();n(rockMesh(),i(),h(12,60),[1.3*e,e,e],[.95,.78,.6,1])}for(let e=0;e<8;e++){const e=.5+.7*a();n(bushMesh(),i(),h(12,50),[1.2*e,.8*e,1.2*e],[.72,.62,.36,1])}for(let e=0;e<16;e++)n(tuftMesh(),i(),-(2.6+2.9*a()),.5+.3*a(),[.82,.72,.42,1]);for(let e=0;e<14;e++){const e=.05+.07*a();n(rockMesh(),i(),-(2.6+5.5*a()),[1.4*e,e,e],[.85,.72,.58,1])}return r})}}export function placeDesert(e,o,t){o.roots.forEach((o,r)=>{const s=3*TILE,a=((r*TILE-t+1.5*TILE)%s+s)%s-1.5*TILE;e.set(o,{position:[a,0,0]})})}export function removeDesert(e,o){for(const t of o.roots)e.despawn(t)}
1
+ "use strict";import{effects,lathe,merge,quat,recolor,shapeGeometry,tube}from"@nayan-ui/engine";import{at,bushMesh,fbm,HAZE,noise,pointSize,random,rockMesh,sceneryTint,tuftMesh}from"../shared/EngineMeadow.js";import{cacheGameAsset,createGameMesh as _0x1c20f6}from"../shared/EngineMeshes.js";import{toColor}from"../shared/EngineUtils.js";import{DINO_HEIGHT,DINO_WIDTH,OBSTACLE_SIZE,STRIDE_TIME,TILE}from"./DinoJumpConstants.js";const meshes=new Map,cached=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("dino-jump/DinoJumpScene:"+e,o),meshes.set(e,t)),t},rgb=e=>{const[o,t,r]=toColor(e);return[o,t,r]},mix=(e,o,t)=>[e[0]+(o[0]-e[0])*t,e[1]+(o[1]-e[1])*t,e[2]+(o[2]-e[2])*t],sphere=()=>shapeGeometry("sphere"),ribbed=(e,o)=>({displace:t=>o*Math.cos(t*Math.PI*2*e),color:({u:o})=>mix(rgb("#2f6b2c"),rgb("#5aa646"),.5+.5*Math.cos(o*Math.PI*2*e))}),smallCactusMesh=()=>cached("dj-cactus-small",()=>_0x1c20f6(merge([{geometry:lathe([[.34,0],[.36,.55],[.33,.82],[.22,.96],[.001,1]],{segments:24,...ribbed(10,.025)})},{geometry:tube([[.25,.4,0],[.42,.42,0],[.45,.62,0]],{radius:.1,color:rgb("#3f8a38")})}]),{center:!1,shine:.25})),largeCactusMesh=()=>cached("dj-cactus-large",()=>_0x1c20f6(merge([{geometry:lathe([[.22,0],[.24,.6],[.22,.86],[.15,.97],[.001,1]],{segments:24,...ribbed(12,.018)})},{geometry:tube([[-.18,.36,0],[-.4,.38,0],[-.42,.66,0]],{radius:.085,color:rgb("#3f8a38")})},{geometry:tube([[.18,.46,0],[.38,.48,0],[.4,.76,0]],{radius:.08,color:rgb("#3f8a38")})}]),{center:!1,shine:.25})),mushroomMesh=()=>cached("dj-mushroom",()=>{const e=[],o=random(5);for(let t=0;t<9;t++){const t=o()*Math.PI*2,r=.25+.6*o(),s=.5*Math.cos(1.2*r);e.push({geometry:sphere(),position:[Math.cos(t)*s,.5+.48*r,Math.sin(t)*s],scale:.09+.05*o(),color:[1,1,1]})}return _0x1c20f6(merge([{geometry:lathe([[.15,0],[.17,.25],[.14,.52]],{segments:16,color:rgb("#f3e3c3")})},{geometry:lathe([[.001,.46],[.5,.48],[.47,.66],[.34,.86],[.16,.97],[.001,1]],{segments:24,color:rgb("#e23b33")})},...e]),{center:!1,shine:.5})}),OBSTACLE_MESH={cactus_small:smallCactusMesh,cactus_large:largeCactusMesh,mushroom:mushroomMesh};export function spawnObstacle(e,o,t,r,s,a){const n=pointSize(o),{width:i,height:h}=OBSTACLE_SIZE[r];return e.spawn({mesh:OBSTACLE_MESH[r](),position:at(o,s+i/2,t.groundY),scale:[i*n,h*n,i*n*("cactus_large"===r?.6:1)],rotation:quat.y("mushroom"===r?.5:0),color:a,pickable:!1})}export function placeObstacle(e,o,t,r,s,a,n){const i=at(o,a+OBSTACLE_SIZE[s].width/2,t.groundY);n?n.position(r,i[0],i[1],i[2]):e.set(r,{position:i})}const SKIN_TOP=rgb("#3a4527"),SKIN_SIDE=rgb("#6d7a43"),SKIN_BELLY=rgb("#cdbf8f"),SKIN_STRIPE=rgb("#262b17"),CLAW=rgb("#2a2418"),TOOTH=rgb("#efe5c8"),MOUTH=rgb("#3a1a14"),smooth=(e,o,t)=>{const r=Math.min(1,Math.max(0,(t-e)/(o-e)));return r*r*(3-2*r)},hide=(e=!1)=>({position:o,normal:t})=>{const r=.5+.5*t[1];let s=mix(SKIN_BELLY,SKIN_SIDE,smooth(.22,.5,r));s=mix(s,SKIN_TOP,smooth(.6,.95,r)),e&&r>.55&&o[0]<.14&&(s=mix(s,SKIN_STRIPE,smooth(.45,.8,Math.sin(46*o[0]))*smooth(.55,.8,r)*.75));const a=.86+.28*noise(22*o[0]+3,22*o[1]+11*o[2]);return[s[0]*a,s[1]*a,s[2]*a]},skin=e=>recolor(e,hide()),taper=e=>o=>{for(let t=0;t+1<e.length;t++){const[r,s]=e[t],[a,n]=e[t+1];if(o<=a)return s+(n-s)*smooth(r,a,o)}return e[e.length-1][1]},claw=(e,o,t=CLAW)=>lathe([[o,0],[.6*o,.5*e],[.001,e]],{segments:8,color:t}),dinoMesh=()=>cached("dj-dino-rex",()=>{const e=tube([[-.54,.41,0],[-.42,.44,0],[-.28,.5,0],[-.12,.55,0],[.03,.57,0],[.14,.63,0],[.21,.73,0],[.26,.83,0]],{radius:taper([[0,.01],[.16,.042],[.33,.095],[.5,.155],[.62,.165],[.76,.12],[.88,.078],[1,.072]]),sides:24,smoothness:10,color:hide(!0)}),o=e=>.072-.026*e,t=tube([[.29,.885,0],[.38,.877,0],[.475,.862,0]],{radius:o,sides:18,color:hide()}),r=tube([[.27,.84,0],[.36,.818,0],[.455,.8,0]],{radius:e=>.046-.016*e,sides:16,color:hide()}),s=[];for(let e=0;e<7;e++){const t=.335+.021*e,r=(t-.29)/.185,a=o(r),n=.885-.023*r-.72*a;for(const o of[1,-1])s.push({geometry:claw(.026,.008,TOOTH),position:[t,n,o*a*.62],rotation:quat.z(Math.PI),scale:1-.08*Math.abs(e-2)})}const a=e=>[e,{...e,position:[e.position[0],e.position[1],-e.position[2]]}],n=e=>({geometry:skin(tube([[.15,.57,e],[.19,.51,1.15*e],[.235,.515,1.15*e]],{radius:e=>.026-.01*e,sides:10}))}),i=e=>[.012,-.012].map(o=>({geometry:claw(.022,.006),position:[.235,.512,1.15*e+o],rotation:quat.z(-2)}));return _0x1c20f6(merge([{geometry:e,scale:[1,1,.8]},{geometry:skin(sphere()),position:[.01,.5,0],scale:[.36,.3,.25]},{geometry:skin(sphere()),position:[.3,.875,0],scale:[.2,.17,.16]},{geometry:t,scale:[1,1,.82]},{geometry:r,scale:[1,1,.78]},...s,...a({geometry:tube([[.28,.842,.046],[.37,.828,.042],[.455,.818,.032]],{radius:.006,sides:6,caps:!1}),position:[0,0,0],scale:1,color:MOUTH}),...a({geometry:skin(sphere()),position:[.335,.94,.05],scale:[.1,.032,.045]}),...a({geometry:sphere(),position:[.34,.91,.064],scale:.034,color:rgb("#d79a1c")}),...a({geometry:sphere(),position:[.345,.91,.079],scale:[.009,.026,.008],color:rgb("#0b0b0b")}),...a({geometry:sphere(),position:[.35,.918,.08],scale:.007,color:[1,1,1]}),...a({geometry:sphere(),position:[.462,.88,.026],scale:[.02,.012,.012],color:rgb("#1d1f12")}),n(.085),n(-.085),...i(.085),...i(-.085)]),{center:!1,shine:.18})}),legMesh=()=>cached("dj-leg-rex",()=>{const e=[-.032,0,.032].flatMap(e=>{const o=0===e?.1:.08,t=[.03+o,-.443,1.6*e];return[{geometry:skin(tube([[.03,-.438,.6*e],[.03+.55*o,-.44,1.2*e],t],{radius:e=>.021-.009*e,sides:8}))},{geometry:claw(.03,.011),position:t,rotation:quat.z(-1.75)}]});return _0x1c20f6(merge([{geometry:skin(sphere()),position:[.01,-.07,0],scale:[.25,.3,.17],rotation:quat.z(-.25)},{geometry:skin(tube([[0,-.1,0],[.065,-.2,0]],{radius:e=>.075-.03*e,sides:12}))},{geometry:skin(tube([[.065,-.2,0],[.02,-.27,0],[-.03,-.33,0]],{radius:e=>.045-.016*e,sides:12}))},{geometry:skin(tube([[-.03,-.33,0],[-.005,-.39,0],[.03,-.437,0]],{radius:e=>.028-.004*e,sides:10}))},...e]),{center:!1,shine:.15})}),HIP=[-.06,.46,0],SWING=.5;export function spawnDino(e,o,t,r,s){const a=DINO_HEIGHT*pointSize(o),n=e.spawn({mesh:"none",position:at(o,t,r),pickable:!1}),i=e.spawn({mesh:dinoMesh(),parent:n,scale:a,color:s,pickable:!1}),h=o=>e.spawn({mesh:legMesh(),parent:n,position:[HIP[0]*a,HIP[1]*a,o*a],scale:a,color:s,pickable:!1});return{root:n,body:i,near:h(.1),far:h(-.1)}}export const dinoCentre=e=>e+DINO_WIDTH/2;export function placeDino(e,o,t,r,s){e.set(t.root,{position:at(o,r,s)})}export function setGait(e,o,t,r){for(const o of[t.near,t.far])e.stopAnimation(o);const s=DINO_HEIGHT*pointSize(o);if("run"===r)return e.set(t.near,{rotation:quat.z(.5)}),e.set(t.far,{rotation:quat.z(-.5)}),e.animate(t.near,{rotation:quat.z(-.5)},{duration:STRIDE_TIME,easing:"easeInOut",repeat:"forever",yoyo:!0}),e.animate(t.far,{rotation:quat.z(.5)},{duration:STRIDE_TIME,easing:"easeInOut",repeat:"forever",yoyo:!0}),void e.set(t.root,{bob:{amplitude:[0,.025*s,0],speed:Math.PI/STRIDE_TIME}});e.set(t.root,{bob:null}),e.set(t.near,{rotation:quat.z("air"===r?.5:0)}),e.set(t.far,{rotation:quat.z("air"===r?-.25:0)})}export function hurtDino(e,o,t){e.animate(o.body,[{color:[1.8,.35,.35,1],at:.25},{color:t}],{duration:.4}),e.animate(o.root,{shake:.05},{duration:.3})}export function cheerDino(e,o,t){e.animate(o.body,[{color:[1.7,1.5,.7,1],at:.3},{color:t}],{duration:.45})}const SAND=[.86,.74,.55,.85],CACTUS_BITS=["#2f6b2c","#5aa646","#c9a063"].map(e=>toColor(e)),MUSHROOM_BITS=["#e23b33","#ffffff","#ffd54f"].map(e=>toColor(e));export function dust(e,o,t,r,s){const a=pointSize(o);effects.dust(e,{position:at(o,t,r),count:s?5:1,size:(s?22:14)*a,speed:(s?60:30)*a,direction:[-1,.5,0],spread:s?1.4:.6,lifetime:s?.5:.4,color:SAND,endSize:2.2})}export function hitBurst(e,o,t,r,s){const a=pointSize(o);effects.shatter(e,{position:at(o,t,r,o.playDepth-.3),count:12,mesh:s?"sphere":"cube",size:8*a,speed:220*a,lifetime:.55,gravity:-2200*a,colors:s?MUSHROOM_BITS:CACTUS_BITS})}const SAND_LIGHT=rgb("#ecd29a"),SAND_DARK=rgb("#cfa86a"),SAND_RED=rgb("#d89a62"),periodic=(e,o,t,r)=>{const s=(e%t+t)%t/t;return r(s*t,o)*(1-s)+r((s-1)*t,o)*s},floorMesh=e=>cached("dj-floor:"+e.toFixed(2),()=>{const o=[],t=[];for(let t=0;t<44;t++){const r=-(1.2+Math.pow(1.12,t)-1);for(let t=0;t<48;t++){const s=-TILE/2+t/47*TILE,a=periodic(s,r,TILE,(e,o)=>fbm(.07*e,.07*o)),n=periodic(s,r,TILE,(e,o)=>noise(.9*e,.35*o));let i=mix(SAND_DARK,SAND_LIGHT,a);i=mix(i,SAND_RED,.6*Math.max(0,.45-a)),i=mix(i,mix(i,[1,1,1],.12),.6*n);const h=Math.max(0,1-Math.abs(-r-e)/1.3);i=mix(i,rgb("#f2deb0"),.45*h);const m=1-Math.exp(-((-r/140)**2));i=mix(i,HAZE,.7*m),o.push(s,0,r,0,1,0,i[0],i[1],i[2],0,0)}}const r=(e,o)=>48*e+o;for(let e=0;e+1<44;e++)for(let o=0;o+1<48;o++)t.push(r(e,o),r(e,o+1),r(e+1,o+1),r(e,o),r(e+1,o+1),r(e+1,o));return _0x1c20f6({vertices:new Float32Array(o),indices:new Uint32Array(t)},{center:!1})}),saguaroMesh=()=>cached("dj-saguaro",()=>_0x1c20f6(merge([{geometry:lathe([[.07,0],[.075,.7],[.065,.92],[.035,.99],[.001,1]],{segments:18,...ribbed(12,.006)})},{geometry:tube([[-.06,.42,0],[-.2,.44,0],[-.22,.72,0]],{radius:.045,color:rgb("#3f8a38")})},{geometry:tube([[.06,.52,0],[.17,.54,0],[.18,.8,0]],{radius:.04,color:rgb("#3f8a38")})}]),{center:!1,shine:.2})),barrelMesh=()=>cached("dj-barrel",()=>_0x1c20f6(merge([{geometry:lathe([[.001,0],[.3,.04],[.4,.22],[.36,.42],[.2,.54],[.001,.56]],{segments:22,...ribbed(14,.02)})},...[0,1,2,3,4].map(e=>({geometry:sphere(),position:[.12*Math.cos(1.26*e),.56,.12*Math.sin(1.26*e)],scale:.09,color:rgb("#ff6fa8")}))]),{center:!1,shine:.25}));export function spawnDesert(e,o,t){const r=sceneryTint(o),s=e=>[e[0]*r[0],e[1]*r[1],e[2]*r[2],e[3]??1];return{roots:[0,1,2].map(o=>{const r=e.spawn({mesh:floorMesh(t),color:s([1,1,1,1]),pickable:!1}),a=random(100+17*o),n=(o,t,n,i,h=[1,1,1,1],m=quat.y(6.3*a()))=>e.spawn({mesh:o,parent:r,position:[t,0,n],scale:i,rotation:m,color:s(h),pickable:!1}),i=()=>(a()-.5)*TILE,h=(e,o)=>{let r=-(e+a()*(o-e));return Math.abs(-r-t)<4&&(r-=5),r};for(let e=0;e<6;e++)n(saguaroMesh(),i(),h(18,70),3+3.5*a(),[1,1,1,1],quat.y(.6*a()-.3));for(let e=0;e<6;e++)n(barrelMesh(),i(),h(13,40),.5+.6*a());for(let e=0;e<8;e++){const e=.3+1.4*a();n(rockMesh(),i(),h(12,60),[1.3*e,e,e],[.95,.78,.6,1])}for(let e=0;e<8;e++){const e=.5+.7*a();n(bushMesh(),i(),h(12,50),[1.2*e,.8*e,1.2*e],[.72,.62,.36,1])}for(let e=0;e<16;e++)n(tuftMesh(),i(),-(2.6+2.9*a()),.5+.3*a(),[.82,.72,.42,1]);for(let e=0;e<14;e++){const e=.05+.07*a();n(rockMesh(),i(),-(2.6+5.5*a()),[1.4*e,e,e],[.85,.72,.58,1])}return r})}}export function placeDesert(e,o,t){o.roots.forEach((o,r)=>{const s=3*TILE,a=((r*TILE-t+1.5*TILE)%s+s)%s-1.5*TILE;e.set(o,{position:[a,0,0]})})}export function removeDesert(e,o){for(const t of o.roots)e.despawn(t)}
@@ -1 +1 @@
1
- "use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{textColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,LIGHT,OPPONENT_COLOR,PLAYER_COLOR}from"./DotsAndBoxesConstants.js";import{createGame,dispose,reset,setLayout,setTheme,start,tap,tick}from"./DotsAndBoxesGame.js";import{jsx as _0x167321}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.DOTS_AND_BOXES,playerColumn=(e,t,r,s)=>({label:e,value:r.toLocaleString(),color:s?t:void 0,valueColor:t});export const DotsAndBoxes=engineGame(GAME_IDS.DOTS_AND_BOXES,e=>{const[t,r]=useLiveState([0,0]),[s,o]=useLiveState("player"),{status:a,screen:n,gameOver:i}=useEngineGame(e,{gameId:GAME_IDS.DOTS_AND_BOXES,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,r,s)=>{const o=getLayout(t,r,s);return setLayout(e,o),o.boardSize},tap:tap,reportScore:e=>e.playerScore,sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.MEDIUM),onOver:(e,t)=>e("draw"===t?GAME_SOUNDS.DRAW:"win"===t?SOUNDS.WIN:SOUNDS.LOSE,"win"===t?HapticType.SUCCESS:HapticType.HEAVY),wire:(e,t)=>{e.onScores=(e,t)=>r([e,t]),e.onTurn=o,e.onEvent=(e,r)=>{const s="player"===r;"box"===e?t(s?SOUNDS.BOX_CLAIMED:SOUNDS.OPPONENT_BOX,s?HapticType.MEDIUM:HapticType.WARNING):t(s?SOUNDS.PLAYER_LINE:SOUNDS.OPPONENT_LINE,HapticType.LIGHT)}}}),S="player"===s;return _0x167321(EngineGameScreen,{...n,light:LIGHT,columns:[playerColumn("YOU",PLAYER_COLOR,t[0],S),textColumn("TURN",S?"Your Turn":"AI Thinking...",S?PLAYER_COLOR:OPPONENT_COLOR),playerColumn("AI",OPPONENT_COLOR,t[1],!S)],subtext:"Complete boxes to win!",gameOver:i({title:"win"===a?"YOU WON!":"YOU LOST!",message:"Final score: "+t[0]+" - "+t[1],scoreLabel:"win"===a?"You Won!":"You Lost",score:t[0],buttonText:"win"===a?"Play Again!":"Try Again!"})})});
1
+ "use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{textColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,LIGHT,OPPONENT_COLOR,PLAYER_COLOR}from"./DotsAndBoxesConstants.js";import{createGame,dispose,reset,setLayout,setTheme,start,tap,tick}from"./DotsAndBoxesGame.js";import{jsx as _0x257e22}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.DOTS_AND_BOXES,playerColumn=(e,t,r,s)=>({label:e,value:r.toLocaleString(),color:s?t:void 0,valueColor:t});export const DotsAndBoxes=engineGame(GAME_IDS.DOTS_AND_BOXES,e=>{const[t,r]=useLiveState([0,0]),[s,o]=useLiveState("player"),{status:a,screen:n,gameOver:i}=useEngineGame(e,{gameId:GAME_IDS.DOTS_AND_BOXES,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,r,s)=>{const o=getLayout(t,r,s);return setLayout(e,o),o.boardSize},tap:tap,reportScore:e=>e.playerScore,sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.MEDIUM),onOver:(e,t)=>e("draw"===t?GAME_SOUNDS.DRAW:"win"===t?SOUNDS.WIN:SOUNDS.LOSE,"win"===t?HapticType.SUCCESS:HapticType.HEAVY),wire:(e,t)=>{e.onScores=(e,t)=>r([e,t]),e.onTurn=o,e.onEvent=(e,r)=>{const s="player"===r;"box"===e?t(s?SOUNDS.BOX_CLAIMED:SOUNDS.OPPONENT_BOX,s?HapticType.MEDIUM:HapticType.WARNING):t(s?SOUNDS.PLAYER_LINE:SOUNDS.OPPONENT_LINE,HapticType.LIGHT)}}}),S="player"===s;return _0x257e22(EngineGameScreen,{...n,light:LIGHT,columns:[playerColumn("YOU",PLAYER_COLOR,t[0],S),textColumn("TURN",S?"Your Turn":"AI Thinking...",S?PLAYER_COLOR:OPPONENT_COLOR),playerColumn("AI",OPPONENT_COLOR,t[1],!S)],subtext:"Complete boxes to win!",gameOver:i({title:"win"===a?"YOU WON!":"YOU LOST!",message:"Final score: "+t[0]+" - "+t[1],scoreLabel:"win"===a?"You Won!":"You Lost",score:t[0],buttonText:"win"===a?"Play Again!":"Try Again!"})})});
@@ -1 +1 @@
1
- "use strict";import{effects,extrude,lathe,merge,Path,quat,shapeGeometry,tube}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{cacheGameAsset,createGameMesh as _0x4fb6f2}from"../shared/EngineMeshes.js";import{placeTiltedBackdrop}from"../shared/EngineTilt.js";import{toColor}from"../shared/EngineUtils.js";import{BOX_TIME,CLASSIC_BOARD,CLASSIC_RIM,CLASSIC_SLOT,DOT_COLOR,dotPoint,GRID_SIZE,LINE_TIME,OPPONENT_COLOR,PLAYER_COLOR}from"./DotsAndBoxesConstants.js";const meshes=new Map,cached=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("dots-and-boxes/DotsAndBoxesScene:"+e,o),meshes.set(e,t)),t},STAND_UP=quat.x(Math.PI/2),ACROSS=quat.z(0),DOWN=quat.z(Math.PI/2),BOARD_DEPTH=10,BACKDROP_DEPTH=25,ownerColor=e=>toColor(1===e?PLAYER_COLOR:OPPONENT_COLOR),glow=(e,o)=>[e[0]*o,e[1]*o,e[2]*o,1],panelMesh=(e,o)=>cached("dab-panel:"+e.toFixed(1)+":"+o,()=>_0x4fb6f2(extrude((new Path).addRoundedRect(-e/2,-e/2,e,e,o),{depth:10}),{shine:.25})),rimMesh=(e,o)=>cached("dab-rim:"+e.toFixed(1)+":"+o,()=>_0x4fb6f2(extrude((new Path).addRoundedRect(-e/2,-e/2,e,e,o).addRoundedRect(-e/2+1.5,-e/2+1.5,e-3,e-3,o-1.5),{depth:0,fillRule:"evenodd"}))),slotMesh=(e,o)=>cached("dab-slot:"+e.toFixed(1)+":"+o.toFixed(1),()=>_0x4fb6f2(extrude((new Path).addRoundedRect(-e/2,-o/2,e,o,o/2),{depth:0}))),studMesh=()=>cached("dab-stud",()=>_0x4fb6f2(lathe([[.001,0],[.5,0],[.5,.22],[.46,.38],[.34,.52],[.16,.6],[.001,.62]],{segments:24}),{center:!1,shine:.85})),rodMesh=()=>cached("dab-rod",()=>_0x4fb6f2(tube([[-.5,0,0],[.5,0,0]],{radius:.5,sides:16,smoothness:1}),{shine:.7})),tileMesh=()=>cached("dab-tile",()=>_0x4fb6f2(merge([{geometry:shapeGeometry("roundedBox",{color:[.78,.78,.78]}),position:[0,0,.5]},{geometry:shapeGeometry("roundedBox"),position:[0,0,.62],scale:[.72,.72,.9]}]),{center:!1,shine:.55}));function linePlace(e,o,t,s){const[n,i]=dotPoint(e,t,s),[a,r]="h"===o?dotPoint(e,t,s+1):dotPoint(e,t+1,s);return{x:(n+a)/2,y:(i+r)/2}}export function boxCentre(e,o,t){const[s,n]=dotPoint(e,o,t);return[s+e.cell/2,n-e.cell/2]}const tileSize=e=>[.76*e.cell,.76*e.cell,.14*e.cell],slotColor=e=>toColor("classic"===e.mode?CLASSIC_SLOT:e.BOARD.CELL_HIGHLIGHT);export function buildBoard(e,o,t,s){const n="classic"===t.mode,i=n?16:8,a=spawnBackdrop(e,o.width,o.height,-25,t);placeTiltedBackdrop(e,a,o,25);const r=e.spawn({mesh:panelMesh(o.boardSize,i),position:[0,0,-5],color:toColor(n?CLASSIC_BOARD:t.BOARD.SURFACE),pickable:!1}),l=toColor(n?CLASSIC_RIM:t.BOARD.BORDER),d=l[3]>0?e.spawn({mesh:rimMesh(o.boardSize,i),position:[0,0,.2],color:l,pickable:!1}):null,p=[],h=toColor(DOT_COLOR);for(let t=0;t<=GRID_SIZE;t++)for(let s=0;s<=GRID_SIZE;s++){const[n,i]=dotPoint(o,t,s);p.push(e.spawn({mesh:studMesh(),position:[n,i,0],rotation:STAND_UP,scale:2*o.dotRadius,color:h,pickable:!1}))}const m=slotMesh(o.cell-2.4*o.dotRadius,.75*o.lineWidth),u=slotColor(t);return{backdrop:a,panel:r,rim:d,studs:p,slots:s.map(({kind:t,row:s,col:n})=>{const{x:i,y:a}=linePlace(o,t,s,n);return e.spawn({mesh:m,position:[i,a,.3],rotation:"h"===t?ACROSS:DOWN,color:u,pickable:!1})})}}export function removeBoard(e,o){for(const t of[o.backdrop,o.panel,...null!=o.rim?[o.rim]:[],...o.studs,...o.slots])e.despawn(t)}export function setBoardTheme(e,o,t,s){const n="classic"===s.mode,i=n?16:8;setBackdropTheme(e,t.backdrop,s),e.set(t.panel,{mesh:panelMesh(o.boardSize,i),color:toColor(n?CLASSIC_BOARD:s.BOARD.SURFACE)}),null!=t.rim&&e.despawn(t.rim);const a=toColor(n?CLASSIC_RIM:s.BOARD.BORDER);t.rim=a[3]>0?e.spawn({mesh:rimMesh(o.boardSize,i),position:[0,0,.2],color:a,pickable:!1}):null;const r=slotColor(s);for(const o of t.slots)e.set(o,{color:r})}export function spawnRod(e,o,t,s,n,i,a){const{x:r,y:l}=linePlace(o,t,s,n),d=o.lineWidth,p=ownerColor(i),h=[r,l,d/2],m=e.spawn({mesh:rodMesh(),position:a?[r,l,2.5*d]:h,rotation:"h"===t?ACROSS:DOWN,scale:[a?d:o.cell,d,d],color:a?glow(p,1.6):p,pickable:!1});return a&&(e.animate(m,{scale:[o.cell,d,d]},{duration:LINE_TIME,easing:"back"}),e.animate(m,{position:h},{duration:LINE_TIME,easing:"bounce"}),e.animate(m,{color:p},{duration:2*LINE_TIME})),m}export function spawnTile(e,o,t,s,n,i){const[a,r]=boxCentre(o,t,s),l=ownerColor(n),d=e.spawn({mesh:tileMesh(),position:[a,r,0],scale:i?[.01,.01,.01]:tileSize(o),color:l,pickable:!1});return i&&(e.animate(d,{scale:tileSize(o)},{duration:BOX_TIME,easing:"back"}),effects.sparkle(e,{position:[a,r,.2*o.cell],count:12,size:.08*o.cell,speed:3*o.cell,lifetime:.5,gravity:6*-o.cell,colors:[l,glow(l,1.3),[1,1,1,1]]})),d}export function celebrate(e,o){effects.confetti(e,{position:[0,0,o.cell],count:60,size:.12*o.cell,speed:1.4*o.boardSize,lifetime:1.4,gravity:2.4*-o.boardSize,colors:["#34D399","#FFD740","#448AFF","#FF5252"].map(e=>toColor(e))})}export function showSlot(e,o,t,s){e.set(o.slots[t],{scale:s?1:0})}
1
+ "use strict";import{effects,extrude,lathe,merge,Path,quat,shapeGeometry,tube}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{cacheGameAsset,createGameMesh as _0x3bf28b}from"../shared/EngineMeshes.js";import{placeTiltedBackdrop}from"../shared/EngineTilt.js";import{toColor}from"../shared/EngineUtils.js";import{BOX_TIME,CLASSIC_BOARD,CLASSIC_RIM,CLASSIC_SLOT,DOT_COLOR,dotPoint,GRID_SIZE,LINE_TIME,OPPONENT_COLOR,PLAYER_COLOR}from"./DotsAndBoxesConstants.js";const meshes=new Map,cached=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("dots-and-boxes/DotsAndBoxesScene:"+e,o),meshes.set(e,t)),t},STAND_UP=quat.x(Math.PI/2),ACROSS=quat.z(0),DOWN=quat.z(Math.PI/2),BOARD_DEPTH=10,BACKDROP_DEPTH=25,ownerColor=e=>toColor(1===e?PLAYER_COLOR:OPPONENT_COLOR),glow=(e,o)=>[e[0]*o,e[1]*o,e[2]*o,1],panelMesh=(e,o)=>cached("dab-panel:"+e.toFixed(1)+":"+o,()=>_0x3bf28b(extrude((new Path).addRoundedRect(-e/2,-e/2,e,e,o),{depth:10}),{shine:.25})),rimMesh=(e,o)=>cached("dab-rim:"+e.toFixed(1)+":"+o,()=>_0x3bf28b(extrude((new Path).addRoundedRect(-e/2,-e/2,e,e,o).addRoundedRect(-e/2+1.5,-e/2+1.5,e-3,e-3,o-1.5),{depth:0,fillRule:"evenodd"}))),slotMesh=(e,o)=>cached("dab-slot:"+e.toFixed(1)+":"+o.toFixed(1),()=>_0x3bf28b(extrude((new Path).addRoundedRect(-e/2,-o/2,e,o,o/2),{depth:0}))),studMesh=()=>cached("dab-stud",()=>_0x3bf28b(lathe([[.001,0],[.5,0],[.5,.22],[.46,.38],[.34,.52],[.16,.6],[.001,.62]],{segments:24}),{center:!1,shine:.85})),rodMesh=()=>cached("dab-rod",()=>_0x3bf28b(tube([[-.5,0,0],[.5,0,0]],{radius:.5,sides:16,smoothness:1}),{shine:.7})),tileMesh=()=>cached("dab-tile",()=>_0x3bf28b(merge([{geometry:shapeGeometry("roundedBox",{color:[.78,.78,.78]}),position:[0,0,.5]},{geometry:shapeGeometry("roundedBox"),position:[0,0,.62],scale:[.72,.72,.9]}]),{center:!1,shine:.55}));function linePlace(e,o,t,s){const[n,i]=dotPoint(e,t,s),[a,r]="h"===o?dotPoint(e,t,s+1):dotPoint(e,t+1,s);return{x:(n+a)/2,y:(i+r)/2}}export function boxCentre(e,o,t){const[s,n]=dotPoint(e,o,t);return[s+e.cell/2,n-e.cell/2]}const tileSize=e=>[.76*e.cell,.76*e.cell,.14*e.cell],slotColor=e=>toColor("classic"===e.mode?CLASSIC_SLOT:e.BOARD.CELL_HIGHLIGHT);export function buildBoard(e,o,t,s){const n="classic"===t.mode,i=n?16:8,a=spawnBackdrop(e,o.width,o.height,-25,t);placeTiltedBackdrop(e,a,o,25);const r=e.spawn({mesh:panelMesh(o.boardSize,i),position:[0,0,-5],color:toColor(n?CLASSIC_BOARD:t.BOARD.SURFACE),pickable:!1}),l=toColor(n?CLASSIC_RIM:t.BOARD.BORDER),d=l[3]>0?e.spawn({mesh:rimMesh(o.boardSize,i),position:[0,0,.2],color:l,pickable:!1}):null,p=[],h=toColor(DOT_COLOR);for(let t=0;t<=GRID_SIZE;t++)for(let s=0;s<=GRID_SIZE;s++){const[n,i]=dotPoint(o,t,s);p.push(e.spawn({mesh:studMesh(),position:[n,i,0],rotation:STAND_UP,scale:2*o.dotRadius,color:h,pickable:!1}))}const m=slotMesh(o.cell-2.4*o.dotRadius,.75*o.lineWidth),u=slotColor(t);return{backdrop:a,panel:r,rim:d,studs:p,slots:s.map(({kind:t,row:s,col:n})=>{const{x:i,y:a}=linePlace(o,t,s,n);return e.spawn({mesh:m,position:[i,a,.3],rotation:"h"===t?ACROSS:DOWN,color:u,pickable:!1})})}}export function removeBoard(e,o){for(const t of[o.backdrop,o.panel,...null!=o.rim?[o.rim]:[],...o.studs,...o.slots])e.despawn(t)}export function setBoardTheme(e,o,t,s){const n="classic"===s.mode,i=n?16:8;setBackdropTheme(e,t.backdrop,s),e.set(t.panel,{mesh:panelMesh(o.boardSize,i),color:toColor(n?CLASSIC_BOARD:s.BOARD.SURFACE)}),null!=t.rim&&e.despawn(t.rim);const a=toColor(n?CLASSIC_RIM:s.BOARD.BORDER);t.rim=a[3]>0?e.spawn({mesh:rimMesh(o.boardSize,i),position:[0,0,.2],color:a,pickable:!1}):null;const r=slotColor(s);for(const o of t.slots)e.set(o,{color:r})}export function spawnRod(e,o,t,s,n,i,a){const{x:r,y:l}=linePlace(o,t,s,n),d=o.lineWidth,p=ownerColor(i),h=[r,l,d/2],m=e.spawn({mesh:rodMesh(),position:a?[r,l,2.5*d]:h,rotation:"h"===t?ACROSS:DOWN,scale:[a?d:o.cell,d,d],color:a?glow(p,1.6):p,pickable:!1});return a&&(e.animate(m,{scale:[o.cell,d,d]},{duration:LINE_TIME,easing:"back"}),e.animate(m,{position:h},{duration:LINE_TIME,easing:"bounce"}),e.animate(m,{color:p},{duration:2*LINE_TIME})),m}export function spawnTile(e,o,t,s,n,i){const[a,r]=boxCentre(o,t,s),l=ownerColor(n),d=e.spawn({mesh:tileMesh(),position:[a,r,0],scale:i?[.01,.01,.01]:tileSize(o),color:l,pickable:!1});return i&&(e.animate(d,{scale:tileSize(o)},{duration:BOX_TIME,easing:"back"}),effects.sparkle(e,{position:[a,r,.2*o.cell],count:12,size:.08*o.cell,speed:3*o.cell,lifetime:.5,gravity:6*-o.cell,colors:[l,glow(l,1.3),[1,1,1,1]]})),d}export function celebrate(e,o){effects.confetti(e,{position:[0,0,o.cell],count:60,size:.12*o.cell,speed:1.4*o.boardSize,lifetime:1.4,gravity:2.4*-o.boardSize,colors:["#34D399","#FFD740","#448AFF","#FF5252"].map(e=>toColor(e))})}export function showSlot(e,o,t,s){e.set(o.slots[t],{scale:s?1:0})}
@@ -1 +1 @@
1
- "use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{livesColumn,scoreColumn,timerColumn}from"../shared/EngineHud.js";import{backgroundFor,lightFor}from"../shared/EngineMeadow.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,LIVES,TIME_LIMIT}from"./FallingSticksConstants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,start,tick}from"./FallingSticksGame.js";import{jsx as _0x1953b4}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.FALLING_STICKS,FEEDBACK={catch:{sound:SOUNDS.CATCH,haptic:HapticType.LIGHT},miss:{sound:SOUNDS.MISS,haptic:HapticType.WARNING},win:{sound:SOUNDS.WIN,haptic:HapticType.SUCCESS},lose:{sound:SOUNDS.GAME_OVER,haptic:HapticType.ERROR}};export const FallingSticks=engineGame(GAME_IDS.FALLING_STICKS,e=>{const[t,s]=useLiveState(0),[i,r]=useLiveState(LIVES),[a,o]=useLiveState(TIME_LIMIT),{theme:n,status:m,screen:S,gameOver:u}=useEngineGame(e,{gameId:GAME_IDS.FALLING_STICKS,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,s,i)=>setLayout(e,getLayout(t,s,i)),resultsDelay:e=>"win"===e?650:350,drag:drag,sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.MEDIUM),wire:(e,t)=>{e.onScore=s,e.onLives=r,e.onTime=o,e.onEvent=e=>t(FEEDBACK[e].sound,FEEDBACK[e].haptic)}});return _0x1953b4(EngineGameScreen,{...S,light:lightFor(n),background:backgroundFor(n),columns:[scoreColumn(t),livesColumn(i,LIVES),timerColumn(a,n,15)],subtext:"Catch the falling sticks!",gameOver:u({title:"win"===m?"YOU WIN!":"GAME OVER",message:"win"===m?"You survived the 2 minutes!":"The sticks got away!",scoreLabel:"Final Score",score:t,buttonText:"Play Again!"})})});
1
+ "use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{livesColumn,scoreColumn,timerColumn}from"../shared/EngineHud.js";import{backgroundFor,lightFor}from"../shared/EngineMeadow.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,LIVES,TIME_LIMIT}from"./FallingSticksConstants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,start,tick}from"./FallingSticksGame.js";import{jsx as _0x49d454}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.FALLING_STICKS,FEEDBACK={catch:{sound:SOUNDS.CATCH,haptic:HapticType.LIGHT},miss:{sound:SOUNDS.MISS,haptic:HapticType.WARNING},win:{sound:SOUNDS.WIN,haptic:HapticType.SUCCESS},lose:{sound:SOUNDS.GAME_OVER,haptic:HapticType.ERROR}};export const FallingSticks=engineGame(GAME_IDS.FALLING_STICKS,e=>{const[t,s]=useLiveState(0),[i,r]=useLiveState(LIVES),[a,o]=useLiveState(TIME_LIMIT),{theme:n,status:m,screen:S,gameOver:u}=useEngineGame(e,{gameId:GAME_IDS.FALLING_STICKS,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,s,i)=>setLayout(e,getLayout(t,s,i)),resultsDelay:e=>"win"===e?650:350,drag:drag,sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.MEDIUM),wire:(e,t)=>{e.onScore=s,e.onLives=r,e.onTime=o,e.onEvent=e=>t(FEEDBACK[e].sound,FEEDBACK[e].haptic)}});return _0x49d454(EngineGameScreen,{...S,light:lightFor(n),background:backgroundFor(n),columns:[scoreColumn(t),livesColumn(i,LIVES),timerColumn(a,n,15)],subtext:"Catch the falling sticks!",gameOver:u({title:"win"===m?"YOU WIN!":"GAME OVER",message:"win"===m?"You survived the 2 minutes!":"The sticks got away!",scoreLabel:"Final Score",score:t,buttonText:"Play Again!"})})});
@@ -1 +1 @@
1
- "use strict";import{effects,lathe,merge,quat}from"@nayan-ui/engine";import{stickBlast}from"../shared/EngineBlasts.js";import{at,facing,flowerMesh,makeView,pineMesh,pointSize,random,sceneryTint,spawnWorld,tuftMesh}from"../shared/EngineMeadow.js";import{createGameMesh as _0x4d84c5}from"../shared/EngineMeshes.js";import{toColor}from"../shared/EngineUtils.js";import{MAX_STICKS,STICK_COLORS}from"./FallingSticksConstants.js";const DEG=Math.PI/180,TRAIL=10,SIDEWAYS=quat.z(-Math.PI/2);let baton=null,bands=null;const batonMesh=()=>baton??=_0x4d84c5(merge([{geometry:lathe([[.08,-.5],[.31,-.49],[.44,-.465],[.47,-.43],[.47,.43],[.44,.465],[.31,.49],[.08,.5]],{segments:20}),rotation:SIDEWAYS}]),{center:!1,shine:.35}),bandMesh=()=>bands??=_0x4d84c5(merge([-1,1].map(t=>({geometry:lathe([[.475,-.038],[.51,-.026],[.51,.026],[.475,.038]],{segments:20}),rotation:SIDEWAYS,position:[.34*t,0,0],color:toColor("#FFF3D9")}))),{center:!1,shine:.25}),stickColor=t=>toColor(STICK_COLORS[t.color%STICK_COLORS.length]),depthFor=(t,e)=>t.view.playDepth-.003*e,stickScale=(t,e,o)=>{const i=pointSize(e.view,depthFor(e,o));return[t.stickLen*i,t.stickW*i,t.stickW*i]};function meadowView(t){const e=Math.min(.64,t.floorY/t.height-.18),o=makeView(t.width,t.height,{horizon:e,eyeHeight:1,playDepth:3.6});return o.eye=[o.eye[0],o.eye[1]+.025-at(o,t.width/2,t.floorY)[1],o.eye[2]],o}export function buildScene(t,e,o){const i=meadowView(e),s=spawnWorld(t,i,o,{sun:[.8,.28],clouds:[.25,.48],groundDetails:!1}),n=random(73),a=sceneryTint(o);for(let o=0;o<13;o++){const r=-(55+40*n()),l=(o/12*2-1)*(-r*i.tanHalf*(e.width/e.height))*1.15,h=3.5+2.5*n();s.push(t.spawn({mesh:pineMesh(),position:[l,0,r],scale:h,color:a,pickable:!1}))}for(let o=0;o<28;o++){const r=at(i,(o+n())/28*e.width,e.floorY+6+5*n());s.push(t.spawn({mesh:o%5==0?flowerMesh():tuftMesh(),position:[r[0],0,r[2]],rotation:quat.y(n()*Math.PI*2),scale:pointSize(i)*(32+20*n()),color:a,pickable:!1}))}const r=Array.from({length:MAX_STICKS},()=>{const e=t.spawn({mesh:batonMesh(),scale:0,pickable:!1});return t.spawn({mesh:bandMesh(),parent:e,pickable:!1}),e});return{view:i,scenery:s,sticks:r,trail:Array.from({length:10},()=>t.spawn({mesh:"roundedBox",scale:0,pickable:!1})),tumble:r.map(()=>0)}}export function removeScene(t,e){for(const o of[...e.scenery,...e.sticks,...e.trail])t.despawn(o)}const turn=(t,e,o)=>quat.multiply(facing(t,-e*DEG),quat.x(o));export function placeStick(t,e,o,i,s,n=!0,a){const r=n?o.tumble[i]+s.rot*DEG*.6:o.tumble[i];(a??t).set(o.sticks[i],{position:at(o.view,s.x,s.y,depthFor(o,i)),rotation:turn(o.view,s.rot,r)})}export function showStick(t,e,o,i,s){const n=o.sticks[i];t.stopAnimation(n),o.tumble[i]=.73*s.color,t.set(n,{scale:stickScale(e,o,i),color:stickColor(s)}),placeStick(t,e,o,i,s)}export function hideStick(t,e,o){t.stopAnimation(e.sticks[o]),t.set(e.sticks[o],{scale:0})}export function landStick(t,e,o,i,s){const n=o.sticks[i],a=Math.min(6*s.speed,24),r=depthFor(o,i),l=Math.round((o.tumble[i]+s.rot*DEG*.6)/Math.PI)*Math.PI;o.tumble[i]=l,t.animate(n,[{position:at(o.view,s.x,s.restY-a,r),at:.3},{position:at(o.view,s.x,s.restY,r),rotation:turn(o.view,s.restRot,l)}],{duration:.45,easing:"easeOut",path:"smooth"});const h=pointSize(o.view);effects.shatter(t,{position:at(o.view,s.x,e.floorY,r),count:7,mesh:"sphere",size:e.stickW*h*.3,speed:75*h,lifetime:.45,gravity:-260*h,direction:[0,1,0],spread:.9,colors:[toColor("#8DA35D"),toColor("#5F9141")],flash:!1,dust:!1})}export function popStick(t,e,o,i,s){stickBlast(t,o.sticks[i],{scale:stickScale(e,o,i),position:at(o.view,s.x,s.y,depthFor(o,i)),rotation:facing(o.view,-s.rot*DEG),color:stickColor(s)})}export function drawTrail(t,e,o,i){const s=t.transforms,n=i.length/2,a=o.view.playDepth-.2,r=pointSize(o.view,a);o.trail.forEach((e,l)=>{t.stopAnimation(e);const h=n-1-l;if(h<0)return void s.scale(e,0);const p=i[2*h],m=i[2*h+1],f=i[2*Math.max(0,h-1)],u=i[2*Math.max(0,h-1)+1],d=4*(1-l/10),w=at(o.view,(p+f)/2,(m+u)/2,a),S=facing(o.view,Math.atan2(u-m,p-f));s.transform(e,w[0],w[1],w[2],S[0],S[1],S[2],S[3]),s.scale(e,(Math.hypot(p-f,m-u)+d)*r,d*r,d*r),s.color(e,1.7,1.6,1.35,.7*(1-l/10))}),s.flush()}export function fadeTrail(t,e){t.animate(e.trail,{color:[1.7,1.6,1.35,0],scale:0},{duration:.18})}export function celebrate(t,e,o){const i=pointSize(o.view);effects.confetti(t,{position:at(o.view,e.width/2,.45*e.height),count:64,size:5*i,speed:e.right*i,lifetime:1.2,gravity:-260*i,colors:STICK_COLORS.map(t=>toColor(t))})}
1
+ "use strict";import{effects,lathe,merge,quat}from"@nayan-ui/engine";import{stickBlast}from"../shared/EngineBlasts.js";import{at,facing,flowerMesh,makeView,pineMesh,pointSize,random,sceneryTint,spawnWorld,tuftMesh}from"../shared/EngineMeadow.js";import{createGameMesh as _0x5eea5d}from"../shared/EngineMeshes.js";import{toColor}from"../shared/EngineUtils.js";import{MAX_STICKS,STICK_COLORS}from"./FallingSticksConstants.js";const DEG=Math.PI/180,TRAIL=10,SIDEWAYS=quat.z(-Math.PI/2);let baton=null,bands=null;const batonMesh=()=>baton??=_0x5eea5d(merge([{geometry:lathe([[.08,-.5],[.31,-.49],[.44,-.465],[.47,-.43],[.47,.43],[.44,.465],[.31,.49],[.08,.5]],{segments:20}),rotation:SIDEWAYS}]),{center:!1,shine:.35}),bandMesh=()=>bands??=_0x5eea5d(merge([-1,1].map(t=>({geometry:lathe([[.475,-.038],[.51,-.026],[.51,.026],[.475,.038]],{segments:20}),rotation:SIDEWAYS,position:[.34*t,0,0],color:toColor("#FFF3D9")}))),{center:!1,shine:.25}),stickColor=t=>toColor(STICK_COLORS[t.color%STICK_COLORS.length]),depthFor=(t,e)=>t.view.playDepth-.003*e,stickScale=(t,e,o)=>{const i=pointSize(e.view,depthFor(e,o));return[t.stickLen*i,t.stickW*i,t.stickW*i]};function meadowView(t){const e=Math.min(.64,t.floorY/t.height-.18),o=makeView(t.width,t.height,{horizon:e,eyeHeight:1,playDepth:3.6});return o.eye=[o.eye[0],o.eye[1]+.025-at(o,t.width/2,t.floorY)[1],o.eye[2]],o}export function buildScene(t,e,o){const i=meadowView(e),s=spawnWorld(t,i,o,{sun:[.8,.28],clouds:[.25,.48],groundDetails:!1}),n=random(73),a=sceneryTint(o);for(let o=0;o<13;o++){const r=-(55+40*n()),l=(o/12*2-1)*(-r*i.tanHalf*(e.width/e.height))*1.15,h=3.5+2.5*n();s.push(t.spawn({mesh:pineMesh(),position:[l,0,r],scale:h,color:a,pickable:!1}))}for(let o=0;o<28;o++){const r=at(i,(o+n())/28*e.width,e.floorY+6+5*n());s.push(t.spawn({mesh:o%5==0?flowerMesh():tuftMesh(),position:[r[0],0,r[2]],rotation:quat.y(n()*Math.PI*2),scale:pointSize(i)*(32+20*n()),color:a,pickable:!1}))}const r=Array.from({length:MAX_STICKS},()=>{const e=t.spawn({mesh:batonMesh(),scale:0,pickable:!1});return t.spawn({mesh:bandMesh(),parent:e,pickable:!1}),e});return{view:i,scenery:s,sticks:r,trail:Array.from({length:10},()=>t.spawn({mesh:"roundedBox",scale:0,pickable:!1})),tumble:r.map(()=>0)}}export function removeScene(t,e){for(const o of[...e.scenery,...e.sticks,...e.trail])t.despawn(o)}const turn=(t,e,o)=>quat.multiply(facing(t,-e*DEG),quat.x(o));export function placeStick(t,e,o,i,s,n=!0,a){const r=n?o.tumble[i]+s.rot*DEG*.6:o.tumble[i];(a??t).set(o.sticks[i],{position:at(o.view,s.x,s.y,depthFor(o,i)),rotation:turn(o.view,s.rot,r)})}export function showStick(t,e,o,i,s){const n=o.sticks[i];t.stopAnimation(n),o.tumble[i]=.73*s.color,t.set(n,{scale:stickScale(e,o,i),color:stickColor(s)}),placeStick(t,e,o,i,s)}export function hideStick(t,e,o){t.stopAnimation(e.sticks[o]),t.set(e.sticks[o],{scale:0})}export function landStick(t,e,o,i,s){const n=o.sticks[i],a=Math.min(6*s.speed,24),r=depthFor(o,i),l=Math.round((o.tumble[i]+s.rot*DEG*.6)/Math.PI)*Math.PI;o.tumble[i]=l,t.animate(n,[{position:at(o.view,s.x,s.restY-a,r),at:.3},{position:at(o.view,s.x,s.restY,r),rotation:turn(o.view,s.restRot,l)}],{duration:.45,easing:"easeOut",path:"smooth"});const h=pointSize(o.view);effects.shatter(t,{position:at(o.view,s.x,e.floorY,r),count:7,mesh:"sphere",size:e.stickW*h*.3,speed:75*h,lifetime:.45,gravity:-260*h,direction:[0,1,0],spread:.9,colors:[toColor("#8DA35D"),toColor("#5F9141")],flash:!1,dust:!1})}export function popStick(t,e,o,i,s){stickBlast(t,o.sticks[i],{scale:stickScale(e,o,i),position:at(o.view,s.x,s.y,depthFor(o,i)),rotation:facing(o.view,-s.rot*DEG),color:stickColor(s)})}export function drawTrail(t,e,o,i){const s=t.transforms,n=i.length/2,a=o.view.playDepth-.2,r=pointSize(o.view,a);o.trail.forEach((e,l)=>{t.stopAnimation(e);const h=n-1-l;if(h<0)return void s.scale(e,0);const p=i[2*h],m=i[2*h+1],f=i[2*Math.max(0,h-1)],u=i[2*Math.max(0,h-1)+1],d=4*(1-l/10),w=at(o.view,(p+f)/2,(m+u)/2,a),S=facing(o.view,Math.atan2(u-m,p-f));s.transform(e,w[0],w[1],w[2],S[0],S[1],S[2],S[3]),s.scale(e,(Math.hypot(p-f,m-u)+d)*r,d*r,d*r),s.color(e,1.7,1.6,1.35,.7*(1-l/10))}),s.flush()}export function fadeTrail(t,e){t.animate(e.trail,{color:[1.7,1.6,1.35,0],scale:0},{duration:.18})}export function celebrate(t,e,o){const i=pointSize(o.view);effects.confetti(t,{position:at(o.view,e.width/2,.45*e.height),count:64,size:5*i,speed:e.right*i,lifetime:1.2,gravity:-260*i,colors:STICK_COLORS.map(t=>toColor(t))})}
@@ -1 +1 @@
1
- "use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS,isTablet}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{scoreColumn,textColumn,timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{GAME_DURATION,getLayout,LIGHT}from"./FindDifferentNumberConstants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,start,tick}from"./FindDifferentNumberGame.js";import{DIFFERENT_COUNT}from"./FindDifferentNumberRules.js";import{jsx as _0x303c29}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.FIND_DIFFERENT_NUMBER,FEEDBACK={correct:{sound:SOUNDS.CORRECT,haptic:HapticType.SUCCESS},wrong:{sound:SOUNDS.WRONG,haptic:HapticType.WARNING},win:{sound:SOUNDS.WIN,haptic:HapticType.SUCCESS},lose:{sound:SOUNDS.GAME_OVER,haptic:HapticType.ERROR}};export const FindDifferentNumber=engineGame(GAME_IDS.FIND_DIFFERENT_NUMBER,e=>{const[t,r]=useLiveState(0),[s,i]=useLiveState(GAME_DURATION),[n,o]=useLiveState(DIFFERENT_COUNT),{game:a,theme:m,status:u,screen:E,gameOver:S}=useEngineGame(e,{gameId:GAME_IDS.FIND_DIFFERENT_NUMBER,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,r,s)=>{const i=getLayout(t,r,s,isTablet);return setLayout(e,i),i.size+2*i.pad},drag:drag,sounds:SOUNDS,onStart:e=>e(SOUNDS.START),wire:(e,t)=>{e.onScore=r,e.onTime=i,e.onLeft=o,e.onEvent=e=>t(FEEDBACK[e].sound,FEEDBACK[e].haptic)}});return _0x303c29(EngineGameScreen,{...E,light:LIGHT,columns:[scoreColumn(t),textColumn("LEFT",n),timerColumn(s,m)],subtext:"Find the different numbers!",gameOver:S({title:"win"===u?"GREAT JOB!":"TIME UP!",message:"win"===u?"You found all the different numbers!":"You ran out of time!",scoreLabel:"Score",score:a.score,buttonText:"win"===u?"Play Again!":"Try Again!"})})});
1
+ "use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS,isTablet}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{scoreColumn,textColumn,timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{GAME_DURATION,getLayout,LIGHT}from"./FindDifferentNumberConstants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,start,tick}from"./FindDifferentNumberGame.js";import{DIFFERENT_COUNT}from"./FindDifferentNumberRules.js";import{jsx as _0x1fafb1}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.FIND_DIFFERENT_NUMBER,FEEDBACK={correct:{sound:SOUNDS.CORRECT,haptic:HapticType.SUCCESS},wrong:{sound:SOUNDS.WRONG,haptic:HapticType.WARNING},win:{sound:SOUNDS.WIN,haptic:HapticType.SUCCESS},lose:{sound:SOUNDS.GAME_OVER,haptic:HapticType.ERROR}};export const FindDifferentNumber=engineGame(GAME_IDS.FIND_DIFFERENT_NUMBER,e=>{const[t,r]=useLiveState(0),[s,i]=useLiveState(GAME_DURATION),[n,o]=useLiveState(DIFFERENT_COUNT),{game:a,theme:m,status:u,screen:E,gameOver:S}=useEngineGame(e,{gameId:GAME_IDS.FIND_DIFFERENT_NUMBER,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,r,s)=>{const i=getLayout(t,r,s,isTablet);return setLayout(e,i),i.size+2*i.pad},drag:drag,sounds:SOUNDS,onStart:e=>e(SOUNDS.START),wire:(e,t)=>{e.onScore=r,e.onTime=i,e.onLeft=o,e.onEvent=e=>t(FEEDBACK[e].sound,FEEDBACK[e].haptic)}});return _0x1fafb1(EngineGameScreen,{...E,light:LIGHT,columns:[scoreColumn(t),textColumn("LEFT",n),timerColumn(s,m)],subtext:"Find the different numbers!",gameOver:S({title:"win"===u?"GREAT JOB!":"TIME UP!",message:"win"===u?"You found all the different numbers!":"You ran out of time!",scoreLabel:"Score",score:a.score,buttonText:"win"===u?"Play Again!":"Try Again!"})})});
@@ -1 +1 @@
1
- "use strict";import{effects,extrude,Path}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{spawnRaisedBlock}from"../shared/EngineBlocks.js";import{flatGlyphMesh,GLYPH_ADVANCE}from"../shared/EngineGlyphs.js";import{cacheGameAsset,createGameMesh as _0x57491d}from"../shared/EngineMeshes.js";import{placeTiltedBackdrop}from"../shared/EngineTilt.js";import{toColor}from"../shared/EngineUtils.js";import{cellCentre,COLORS,FOUND_SCALE,TILE_HEIGHT}from"./FindDifferentNumberConstants.js";import{CELLS,GRID}from"./FindDifferentNumberRules.js";const meshes=new Map,cached=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("find-different-number/FindDifferentNumberScene:"+e,o),meshes.set(e,t)),t},BOARD_DEPTH=10,BACKDROP_DEPTH=30,SURFACE=1,panelMesh=(e,o,t)=>cached("fdn-panel:"+e+":"+o+":"+t,()=>_0x57491d(extrude((new Path).addRoundedRect(-e/2,-e/2,e,e,o),{depth:t}),{shine:0}));function skin(e){return{tile:toColor(COLORS.TILE),text:toColor(COLORS.TEXT)}}const FOUND=toColor(COLORS.FOUND),FOUND_TEXT=toColor(COLORS.FOUND_TEXT),WRONG=toColor(COLORS.WRONG);function spawnBoard(e,o,t){const s=o.size+2*o.pad,n="classic"===t.mode,i=[e.spawn({mesh:panelMesh(s,n?14:8,10),position:[0,0,-5],color:toColor(n?COLORS.CLASSIC_BOARD:"light"===t.mode?COLORS.LIGHT_BOARD:t.BOARD.SURFACE),pickable:!1})];return i.push(e.spawn({mesh:panelMesh(s+3,n?15:9,8),position:[0,0,-6.2],color:toColor(n?COLORS.CLASSIC_RIM:"light"===t.mode?COLORS.LIGHT_RIM:t.BOARD.BORDER),pickable:!1})),i}const digitSize=e=>.34*e.tile,WEIGHT=1.2;export function buildScene(e,o,t,s,n){const i=spawnBackdrop(e,o.width,o.height,-30,t);placeTiltedBackdrop(e,i,o,30);const r=o.tile*TILE_HEIGHT,a=digitSize(o),l=a*GLYPH_ADVANCE/2,p=[];for(let t=0;t<CELLS;t++){const[s,n]=cellCentre(o,t),i=e.spawn({mesh:"none",position:[s,n,1],pickable:!1}),d=spawnRaisedBlock(e,{parent:i,position:[0,0,r/2],size:[o.tile,o.tile,r],color:[1,1,1,1],gloss:!1,shadow:!1}),f=o=>e.spawn({mesh:flatGlyphMesh("0",1.2),parent:i,position:[o,0,r+.6],scale:a,pickable:!1});p.push({root:i,block:d,digits:[f(-l),f(l)]})}const d={backdrop:i,board:spawnBoard(e,o,t),tiles:p};return showNumbers(e,d,s),paint(e,d,t,n),d}export function removeScene(e,o){for(const t of[o.backdrop,...o.board,...o.tiles.map(e=>e.root)])e.despawn(t)}export function paint(e,o,t,s){const n=skin(t),i=e.transforms;o.tiles.forEach((e,o)=>{const t=s.has(o),r=t?FOUND:n.tile,a=t?FOUND_TEXT:n.text;i.color(e.block,r[0],r[1],r[2],r[3]??1);for(const o of e.digits)i.color(o,a[0],a[1],a[2],a[3]??1)}),i.flush()}export function setSceneTheme(e,o,t,s,n){setBackdropTheme(e,t.backdrop,s);for(const o of t.board)e.despawn(o);t.board=spawnBoard(e,o,s),paint(e,t,s,n)}export function showNumbers(e,o,t){o.tiles.forEach((o,s)=>{const n=t[s],i=void 0===n?"":String(n).padStart(2,"0");o.digits.forEach((o,t)=>e.set(o,{mesh:i?flatGlyphMesh(i[t],1.2):"none"}))})}export function intro(e,o){o.tiles.forEach((o,t)=>{e.stopAnimation(o.root),e.set(o.root,{scale:.01}),e.animate(o.root,{scale:1},{duration:.22,delay:.018*(Math.floor(t/GRID)+t%GRID),easing:"back"})})}export function markFound(e,o,t){const s=o.tiles[t];if(s){e.set(s.block,{color:FOUND});for(const o of s.digits)e.set(o,{color:FOUND_TEXT});e.animate(s.root,[{scale:FOUND_SCALE,at:.4},{scale:1}],{duration:.3,easing:"easeOut"})}}export function markWrong(e,o,t,s,n,i){const r=t.tiles[n];if(!r)return;const a=skin(i).tile;e.stopAnimation(r.block),e.animate(r.block,[{color:blend(a,WRONG,.65),at:.18},{color:a}],{duration:.4,easing:"easeOut"}),e.animate(r.root,{shake:.12*o.tile},{duration:.25}),s.shake=.08*o.tile}const blend=(e,o,t)=>[e[0]+(o[0]-e[0])*t,e[1]+(o[1]-e[1])*t,e[2]+(o[2]-e[2])*t,1];export function celebrate(e,o,t){t.tiles.forEach((t,s)=>{const[n,i]=cellCentre(o,s);e.animate(t.root,[{position:[n,i,1+.4*o.tile],at:.4},{position:[n,i,1]}],{duration:.4,delay:.25+.025*(Math.floor(s/GRID)+s%GRID),easing:"easeOut"})}),effects.confetti(e,{position:[0,0,2*o.tile],count:70,size:.22*o.tile,speed:1.4*o.size,lifetime:1.3,gravity:2.4*-o.size,colors:["#FFD700","#4CAF50","#2196F3","#E74C3C"].map(e=>toColor(e))})}export function dim(e,o,t,s){const n=skin(t).tile,i=o.tiles.filter((e,o)=>!s.has(o)).map(e=>e.block);i.length&&e.animate(i,{color:[.55*n[0],.55*n[1],.6*n[2],n[3]??1]},{duration:.4})}
1
+ "use strict";import{effects,extrude,Path}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{spawnRaisedBlock}from"../shared/EngineBlocks.js";import{flatGlyphMesh,GLYPH_ADVANCE}from"../shared/EngineGlyphs.js";import{cacheGameAsset,createGameMesh as _0x4c7036}from"../shared/EngineMeshes.js";import{placeTiltedBackdrop}from"../shared/EngineTilt.js";import{toColor}from"../shared/EngineUtils.js";import{cellCentre,COLORS,FOUND_SCALE,TILE_HEIGHT}from"./FindDifferentNumberConstants.js";import{CELLS,GRID}from"./FindDifferentNumberRules.js";const meshes=new Map,cached=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("find-different-number/FindDifferentNumberScene:"+e,o),meshes.set(e,t)),t},BOARD_DEPTH=10,BACKDROP_DEPTH=30,SURFACE=1,panelMesh=(e,o,t)=>cached("fdn-panel:"+e+":"+o+":"+t,()=>_0x4c7036(extrude((new Path).addRoundedRect(-e/2,-e/2,e,e,o),{depth:t}),{shine:0}));function skin(e){return{tile:toColor(COLORS.TILE),text:toColor(COLORS.TEXT)}}const FOUND=toColor(COLORS.FOUND),FOUND_TEXT=toColor(COLORS.FOUND_TEXT),WRONG=toColor(COLORS.WRONG);function spawnBoard(e,o,t){const s=o.size+2*o.pad,n="classic"===t.mode,i=[e.spawn({mesh:panelMesh(s,n?14:8,10),position:[0,0,-5],color:toColor(n?COLORS.CLASSIC_BOARD:"light"===t.mode?COLORS.LIGHT_BOARD:t.BOARD.SURFACE),pickable:!1})];return i.push(e.spawn({mesh:panelMesh(s+3,n?15:9,8),position:[0,0,-6.2],color:toColor(n?COLORS.CLASSIC_RIM:"light"===t.mode?COLORS.LIGHT_RIM:t.BOARD.BORDER),pickable:!1})),i}const digitSize=e=>.34*e.tile,WEIGHT=1.2;export function buildScene(e,o,t,s,n){const i=spawnBackdrop(e,o.width,o.height,-30,t);placeTiltedBackdrop(e,i,o,30);const r=o.tile*TILE_HEIGHT,a=digitSize(o),l=a*GLYPH_ADVANCE/2,p=[];for(let t=0;t<CELLS;t++){const[s,n]=cellCentre(o,t),i=e.spawn({mesh:"none",position:[s,n,1],pickable:!1}),d=spawnRaisedBlock(e,{parent:i,position:[0,0,r/2],size:[o.tile,o.tile,r],color:[1,1,1,1],gloss:!1,shadow:!1}),f=o=>e.spawn({mesh:flatGlyphMesh("0",1.2),parent:i,position:[o,0,r+.6],scale:a,pickable:!1});p.push({root:i,block:d,digits:[f(-l),f(l)]})}const d={backdrop:i,board:spawnBoard(e,o,t),tiles:p};return showNumbers(e,d,s),paint(e,d,t,n),d}export function removeScene(e,o){for(const t of[o.backdrop,...o.board,...o.tiles.map(e=>e.root)])e.despawn(t)}export function paint(e,o,t,s){const n=skin(t),i=e.transforms;o.tiles.forEach((e,o)=>{const t=s.has(o),r=t?FOUND:n.tile,a=t?FOUND_TEXT:n.text;i.color(e.block,r[0],r[1],r[2],r[3]??1);for(const o of e.digits)i.color(o,a[0],a[1],a[2],a[3]??1)}),i.flush()}export function setSceneTheme(e,o,t,s,n){setBackdropTheme(e,t.backdrop,s);for(const o of t.board)e.despawn(o);t.board=spawnBoard(e,o,s),paint(e,t,s,n)}export function showNumbers(e,o,t){o.tiles.forEach((o,s)=>{const n=t[s],i=void 0===n?"":String(n).padStart(2,"0");o.digits.forEach((o,t)=>e.set(o,{mesh:i?flatGlyphMesh(i[t],1.2):"none"}))})}export function intro(e,o){o.tiles.forEach((o,t)=>{e.stopAnimation(o.root),e.set(o.root,{scale:.01}),e.animate(o.root,{scale:1},{duration:.22,delay:.018*(Math.floor(t/GRID)+t%GRID),easing:"back"})})}export function markFound(e,o,t){const s=o.tiles[t];if(s){e.set(s.block,{color:FOUND});for(const o of s.digits)e.set(o,{color:FOUND_TEXT});e.animate(s.root,[{scale:FOUND_SCALE,at:.4},{scale:1}],{duration:.3,easing:"easeOut"})}}export function markWrong(e,o,t,s,n,i){const r=t.tiles[n];if(!r)return;const a=skin(i).tile;e.stopAnimation(r.block),e.animate(r.block,[{color:blend(a,WRONG,.65),at:.18},{color:a}],{duration:.4,easing:"easeOut"}),e.animate(r.root,{shake:.12*o.tile},{duration:.25}),s.shake=.08*o.tile}const blend=(e,o,t)=>[e[0]+(o[0]-e[0])*t,e[1]+(o[1]-e[1])*t,e[2]+(o[2]-e[2])*t,1];export function celebrate(e,o,t){t.tiles.forEach((t,s)=>{const[n,i]=cellCentre(o,s);e.animate(t.root,[{position:[n,i,1+.4*o.tile],at:.4},{position:[n,i,1]}],{duration:.4,delay:.25+.025*(Math.floor(s/GRID)+s%GRID),easing:"easeOut"})}),effects.confetti(e,{position:[0,0,2*o.tile],count:70,size:.22*o.tile,speed:1.4*o.size,lifetime:1.3,gravity:2.4*-o.size,colors:["#FFD700","#4CAF50","#2196F3","#E74C3C"].map(e=>toColor(e))})}export function dim(e,o,t,s){const n=skin(t).tile,i=o.tiles.filter((e,o)=>!s.has(o)).map(e=>e.block);i.length&&e.animate(i,{color:[.55*n[0],.55*n[1],.6*n[2],n[3]??1]},{duration:.4})}
@@ -1 +1 @@
1
- "use strict";import{useMemo}from"react";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{scoreColumn,timerColumn}from"../shared/EngineHud.js";import{backgroundFor,lightFor}from"../shared/EngineMeadow.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,TIME_LIMIT}from"./FlappyBirdConstants.js";import{createGame,dispose,flap,reset,setLayout,setTheme,start,tick}from"./FlappyBirdGame.js";import{jsx as _0x24f5f8}from"react/jsx-runtime";const SFX=GAME_SOUNDS.FLAPPY_BIRD;export const FlappyBird=engineGame(GAME_IDS.FLAPPY_BIRD,e=>{const[t,r]=useLiveState(0),[s,o]=useLiveState(TIME_LIMIT),{theme:i,status:a,screen:m,gameOver:n}=useEngineGame(e,{gameId:GAME_IDS.FLAPPY_BIRD,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,r,s)=>setLayout(e,getLayout(t,r,s)),drag:(e,{phase:t})=>{"start"===t&&flap(e)},sounds:SFX,onStart:e=>e(SFX.START,HapticType.MEDIUM),wire:(e,t)=>{e.onScore=r,e.onTime=o,e.onFlap=()=>t(SFX.FLAP,HapticType.LIGHT),e.onPass=()=>t(SFX.PASS,HapticType.LIGHT),e.onCrash=()=>t(SFX.GAME_OVER,HapticType.HEAVY),e.onWin=()=>t(SFX.WIN,HapticType.SUCCESS)}}),p=useMemo(()=>lightFor(i),[i]),u=useMemo(()=>backgroundFor(i),[i]);return _0x24f5f8(EngineGameScreen,{...m,light:p,background:u,columns:[scoreColumn(t),timerColumn(s,i,10)],subtext:"Tap to flap!",gameOver:n({title:"win"===a?"YOU WON!":"GAME OVER",message:"win"===a?"You survived the flight!":"You hit a pipe!",scoreLabel:"Final Score",score:t,buttonText:"Fly Again!"})})});
1
+ "use strict";import{useMemo}from"react";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{scoreColumn,timerColumn}from"../shared/EngineHud.js";import{backgroundFor,lightFor}from"../shared/EngineMeadow.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,TIME_LIMIT}from"./FlappyBirdConstants.js";import{createGame,dispose,flap,reset,setLayout,setTheme,start,tick}from"./FlappyBirdGame.js";import{jsx as _0x3f8813}from"react/jsx-runtime";const SFX=GAME_SOUNDS.FLAPPY_BIRD;export const FlappyBird=engineGame(GAME_IDS.FLAPPY_BIRD,e=>{const[t,r]=useLiveState(0),[s,o]=useLiveState(TIME_LIMIT),{theme:i,status:a,screen:m,gameOver:n}=useEngineGame(e,{gameId:GAME_IDS.FLAPPY_BIRD,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,r,s)=>setLayout(e,getLayout(t,r,s)),drag:(e,{phase:t})=>{"start"===t&&flap(e)},sounds:SFX,onStart:e=>e(SFX.START,HapticType.MEDIUM),wire:(e,t)=>{e.onScore=r,e.onTime=o,e.onFlap=()=>t(SFX.FLAP,HapticType.LIGHT),e.onPass=()=>t(SFX.PASS,HapticType.LIGHT),e.onCrash=()=>t(SFX.GAME_OVER,HapticType.HEAVY),e.onWin=()=>t(SFX.WIN,HapticType.SUCCESS)}}),p=useMemo(()=>lightFor(i),[i]),u=useMemo(()=>backgroundFor(i),[i]);return _0x3f8813(EngineGameScreen,{...m,light:p,background:u,columns:[scoreColumn(t),timerColumn(s,i,10)],subtext:"Tap to flap!",gameOver:n({title:"win"===a?"YOU WON!":"GAME OVER",message:"win"===a?"You survived the flight!":"You hit a pipe!",scoreLabel:"Final Score",score:t,buttonText:"Fly Again!"})})});
@@ -1 +1 @@
1
- "use strict";import{effects,extrude,lathe,merge,Path,quat,recolor,shapeGeometry,tube}from"@nayan-ui/engine";import{at,facing,pointSize}from"../shared/EngineMeadow.js";import{cacheGameAsset,createGameMesh as _0x4195a4}from"../shared/EngineMeshes.js";import{toColor}from"../shared/EngineUtils.js";import{BIRD_SIZE,BRICK_HEIGHT,BRICK_WIDTH,PIPE_WIDTH}from"./FlappyBirdConstants.js";const meshes=new Map,cached=(e,t)=>{let o=meshes.get(e);return!o&&(o=cacheGameAsset("flappy-bird/FlappyBirdScene:"+e,t),meshes.set(e,o)),o},rgb=e=>{const[t,o,a]=toColor(e);return[t,o,a]},mix=(e,t,o)=>[e[0]+(t[0]-e[0])*o,e[1]+(t[1]-e[1])*o,e[2]+(t[2]-e[2])*o],sphere=()=>shapeGeometry("sphere"),beakPart=(e,t,o,a,s)=>({geometry:lathe([[t,0],[.6*t,.5*e],[.001,e]],{segments:12,color:o}),position:a,rotation:quat.multiply(quat.z(s),quat.z(-Math.PI/2))}),clamp01=e=>Math.max(0,Math.min(1,e)),smoothstep=e=>{const t=clamp01(e);return t*t*(3-2*t)},BODY_TOP=rgb("#FFE14D"),BODY_BOTTOM=rgb("#FFAA1F"),BELLY=rgb("#FFF4CC"),BLUSH=rgb("#FF8C9A"),FEATHER=rgb("#F08A12"),feather=(e,t,o)=>tube(e,{radius:e=>t*Math.max(.08,1-.85*e),shape:e=>.35+.65*Math.abs(Math.cos(e*Math.PI*2)),sides:8,smoothness:5,color:[...o,1]}),birdMesh=()=>cached("fb-bird",()=>{const e=Array.from({length:17},(e,t)=>{const o=t/16;return[Math.max(.001,.47*Math.sin(Math.PI*o)**.75*(1-.16*o)),.5-o]}),t=merge([{geometry:lathe(e,{segments:28}),rotation:quat.z(-Math.PI/2),scale:[1,.92,.86]}]),o=recolor(t,({position:[e,t,o]})=>{let a=mix(BODY_BOTTOM,BODY_TOP,clamp01(.5+1.3*t+.25*e));return a=mix(a,BELLY,smoothstep(4*(.06-t))*smoothstep(3*o+.3)*smoothstep(3*(e+.32))*.95),a=mix(a,BLUSH,.8*smoothstep(1-Math.hypot(e-.2,t+.06,o-.33)/.11)),[...a,1]});return _0x4195a4(merge([{geometry:o},{geometry:sphere(),position:[.22,.15,.26],scale:.32,color:[1,1,1]},{geometry:sphere(),position:[.3,.16,.38],scale:.15,color:rgb("#151515")},{geometry:sphere(),position:[.33,.2,.445],scale:.05,color:[1,1,1]},beakPart(.3,.1,rgb("#FF7B3A"),[.4,0,.06],.12),beakPart(.24,.08,rgb("#D9531A"),[.39,-.07,.06],-.2),{geometry:feather([[.02,.36,0],[0,.52,0],[-.1,.6,0]],.07,rgb("#FF9500"))},{geometry:feather([[.1,.36,.02],[.12,.5,.02],[.06,.6,.02]],.06,rgb("#FFB300"))},{geometry:feather([[-.06,.34,-.02],[-.14,.46,-.02],[-.24,.5,-.02]],.055,FEATHER)},...[.2,.02,-.16].map((e,t)=>({geometry:tube([[-.34,.02,0],[-.52,.04+.6*e,0],[-.68,.06+e,0]],{radius:e=>.13*(.55+.45*Math.sin(Math.PI*(.25+.6*e))),shape:e=>.45+.55*Math.abs(Math.cos(e*Math.PI*2)),sides:10,smoothness:5,color:[...mix(FEATHER,rgb("#C2600A"),.35*t),1]})})),...[.12,-.12].map(e=>({geometry:feather([[.02,-.36,e],[-.08,-.46,e],[-.2,-.48,e]],.035,rgb("#FF7B3A"))}))]),{center:!1,shine:.35})}),wingMesh=e=>cached("fb-wing:"+e,()=>{const t=[[.06,.06],[-.12,.14],[-.34,.12],[-.56,.02],[-.5,-.04],[-.55,-.09],[-.44,-.11],[-.47,-.17],[-.34,-.17],[-.12,-.12],[.06,-.05]],o=(new Path).moveTo(t[0][0],-t[0][1]);for(const[e,a]of t.slice(1))o.lineTo(e,-a);o.close();const[a,s]=e?[rgb("#B86A08"),rgb("#D9901F")]:[rgb("#F59E0B"),rgb("#FFD35C")];return _0x4195a4(recolor(extrude(o,{depth:.07}),({position:[e]})=>[...mix(a,s,clamp01(-e/.55)),1]),{center:!1,shine:.25})}),lidMesh=()=>cached("fb-lid",()=>_0x4195a4(merge([{geometry:sphere(),color:BODY_TOP}]),{shine:.35})),pipeMesh=()=>cached("fb-pipe",()=>_0x4195a4(lathe([[.5,-.5],[.5,.5]],{segments:24,color:rgb("#4CA840")}),{center:!1,shine:.55})),capMesh=()=>cached("fb-cap",()=>_0x4195a4(merge([{geometry:lathe([[.001,.5],[.5,.5],[.52,.42],[.52,-.42],[.5,-.5]],{segments:24,color:rgb("#3A8A2A")})},{geometry:sphere(),position:[0,.5,0],scale:[.78,.02,.78],color:rgb("#123d10")}]),{center:!1,shine:.6})),SHADE_PERIOD=12;function brickShade(e,t){const o=(t%12+12)%12,a=43758.5453*Math.sin(127.1*e+311.7*o),s=a-Math.floor(a),n=rgb("#9E5428");return s<.5?mix(rgb("#6E3412"),n,2*s):mix(n,rgb("#B8693A"),2*(s-.5))}function wallGeometry(e,t,o,a){const s=BRICK_WIDTH*o,n=BRICK_HEIGHT*o,r=e*o,i=t*o,l=COPING*o,p=.35*n,h=.12*n,m=[],g=(e,t,o,a,s,n,r)=>m.push({geometry:shapeGeometry("cube"),position:[(e+t)/2,(o+a)/2,(s+n)/2],scale:[t-e,a-o,n-s],color:r});g(-r/2,r/2,l,i,0,a,rgb("#3a1d0c")),g(-r/2,r/2,0,l,-.01,a+p+.025,rgb("#c8b896")),g(-r/2,r/2,.78*l,l,a+p+.005,a+p+.03,rgb("#a9987a"));const u=Math.ceil((i-l)/n);for(let e=0;e<u;e++){const t=l+e*n,o=Math.min(i,t+n);for(let n=0,i=-r/2-(e%2?s/2:0);i<r/2;n++,i+=s){const l=Math.max(i,-r/2),m=Math.min(i+s,r/2);m-l<=h||o-t<=h||g(l+h/2,m-h/2,t+h/2,o-h/2,a-.01,a+p,brickShade(e,n))}}return merge(m)}const local=(e,t,o,a=0)=>[t*e,-o*e,a],CAP_HEIGHT=26,CAP_OVER=5,COPING=12,WALL_MARGIN=160,PIPE_INTO_WALL=220,wallDepth=e=>{const t=(PIPE_WIDTH+PIPE_WIDTH/60*10)/2*pointSize(e);return{back:e.playDepth+t+.04,thickness:2*t+.08,front:e.playDepth-t-.04}};function prism(e,t,o,a){const s=[],n=[],r=e.reduce((e,t)=>e+t[0],0)/e.length,i=e.reduce((e,t)=>e+t[1],0)/e.length,l=[(t+o)/2,i,r],p=e=>{const[t,o,r]=e,i=[o[0]-t[0],o[1]-t[1],o[2]-t[2]],p=[r[0]-t[0],r[1]-t[1],r[2]-t[2]];let h=[i[1]*p[2]-i[2]*p[1],i[2]*p[0]-i[0]*p[2],i[0]*p[1]-i[1]*p[0]];const m=e.reduce((t,o)=>[t[0]+o[0]/e.length,t[1]+o[1]/e.length,t[2]+o[2]/e.length],[0,0,0]);h[0]*(m[0]-l[0])+h[1]*(m[1]-l[1])+h[2]*(m[2]-l[2])<0&&(e=[...e].reverse(),h=[-h[0],-h[1],-h[2]]);const g=Math.hypot(h[0],h[1],h[2])||1,u=s.length/11;for(const t of e)s.push(t[0],t[1],t[2],h[0]/g,h[1]/g,h[2]/g,a[0],a[1],a[2],0,0);for(let t=1;t+1<e.length;t++)n.push(u,u+t,u+t+1)};return p(e.map(([e,o])=>[t,o,e])),p(e.map(([e,t])=>[o,t,e])),e.forEach(([a,s],n)=>{const[r,i]=e[(n+1)%e.length];p([[t,s,a],[o,s,a],[o,i,r],[t,i,r]])}),{vertices:new Float32Array(s),indices:new Uint32Array(n)}}function topWallGeometry(e,t,o,a){const s=BRICK_WIDTH*o,n=BRICK_HEIGHT*o,r=e*o,i=t*o,l=COPING*o,p=.35*n,h=p+.025,m=.12*n,g=1.05*a,u=-r/2,b=r/2,d=[{geometry:prism([[-h,g*h],[-h,i],[-.25,i],[-.25,.25*g]],u,b,rgb("#3a1d0c"))},{geometry:prism([[0,0],[0,l],[-h,l],[-h,g*h]],u,b,rgb("#c8b896"))},{geometry:shapeGeometry("cube"),position:[0,.11*l,.004],scale:[r,.22*l,.008],color:rgb("#a9987a")}],I=Math.ceil((i-l)/n);for(let e=0;e<I;e++){const t=l+e*n,o=Math.min(i,t+n);for(let a=0,n=u-(e%2?s/2:0);n<b;a++,n+=s){const r=Math.max(n,u),i=Math.min(n+s,b);i-r<=m||o-t<=m||d.push({geometry:shapeGeometry("cube"),position:[(r+i)/2,(t+o)/2,p/2-h],scale:[i-r-m,o-t-m,p+.01],color:brickShade(e+7,a)})}}return merge(d)}export function spawnWalls(e,t,o){const{back:a,front:s,thickness:n}=wallDepth(t),r=pointSize(t,a),i=pointSize(t,s),l=(o.height/2-o.topWall)/(o.height/2)*t.tanHalf,p=o.width+12*BRICK_WIDTH+4*BRICK_WIDTH,h=cached("fb-top-wall:"+Math.round(o.width)+"x"+Math.round(o.topWall)+":"+i.toFixed(6)+":"+l.toFixed(5),()=>_0x4195a4(topWallGeometry(p,o.topWall+160,i,l),{center:!1,shine:.05})),m=o.height-o.bottomWallTop,g=cached("fb-wall:"+Math.round(o.width)+"x"+Math.round(m)+":"+r.toFixed(6)+":"+n.toFixed(4),()=>_0x4195a4(wallGeometry(p,m+160,r,n),{center:!1,shine:.05})),u={top:e.spawn({mesh:h,color:[1,1,1,1],pickable:!1}),bottom:e.spawn({mesh:g,color:[1,1,1,1],pickable:!1})};return placeWalls(e,t,o,u,0),u}export function placeWalls(e,t,o,a,s){const{back:n,front:r}=wallDepth(t),i=s*pointSize(t),l=(a,s,n,r)=>{const l=12*BRICK_WIDTH*pointSize(t,n),p=at(t,o.width/2+12*BRICK_WIDTH/2,s,n);e.set(a,{position:[p[0]-i%l,p[1],p[2]],rotation:facing(t,r)})};l(a.top,o.topWall,r,0),l(a.bottom,o.bottomWallTop,n,Math.PI)}export function spawnPipe(e,t,o,a,s,n){const r=pointSize(t),i=PIPE_WIDTH/60,l=26*i,p=PIPE_WIDTH+10*i,h=a+PIPE_WIDTH/2,m=e.spawn({mesh:"none",position:at(t,h,0),rotation:facing(t),pickable:!1}),g=(t,o,a,s,n=!1)=>e.spawn({mesh:t,parent:m,position:local(r,0,o),scale:[s*r,a*r,s*r],...n?{rotation:quat.z(Math.PI)}:{},color:[1,1,1,1],pickable:!1}),u=Math.max(o.topWall,Math.min(s,o.bottomWallTop)),b=Math.max(o.topWall,Math.min(n,o.bottomWallTop)),d=o.topWall-220,I=o.bottomWallTop+220;return u-o.topWall>.5&&(g(pipeMesh(),(d+u)/2,u-d,PIPE_WIDTH),g(capMesh(),u-l/2,l,p,!0)),o.bottomWallTop-b>.5&&(g(pipeMesh(),(b+I)/2,I-b,PIPE_WIDTH),g(capMesh(),b+l/2,l,p)),m}export function placePipe(e,t,o,a,s){const n=at(t,a+PIPE_WIDTH/2,0);s?s.position(o,n[0],n[1],n[2]):e.set(o,{position:n})}const EYE=[.22,.15,.27],EYE_SIZE=.34;export function spawnBird(e,t,o,a){const s=BIRD_SIZE*pointSize(t),n=e.spawn({mesh:"none",position:at(t,o,a),rotation:facing(t),pickable:!1}),r=e.spawn({mesh:wingMesh(!0),parent:n,position:[.04*-s,.04*s,.3*-s],scale:s,color:[1,1,1,1],pickable:!1}),i=e.spawn({mesh:birdMesh(),parent:n,scale:s,color:[1,1,1,1],pickable:!1}),l=e.spawn({mesh:lidMesh(),parent:n,position:[EYE[0]*s,EYE[1]*s,EYE[2]*s],scale:0,color:[1,1,1,1],pickable:!1});return{root:n,body:i,wing:e.spawn({mesh:wingMesh(!1),parent:n,position:[.02*-s,.04*-s,.38*s],scale:s,color:[1,1,1,1],pickable:!1}),farWing:r,lid:l,size:s}}const NEAR_WING_TILT=quat.x(-.25),FAR_WING_TILT=quat.x(.25),wingTurn=[0,0,0,1];export function placeBird(e,t,o,a,s,n,r,i=r){e.set(o.root,{position:at(t,a,s),rotation:facing(t,-n)}),e.set(o.wing,{rotation:quat.multiply(NEAR_WING_TILT,quat.z(-r,wingTurn),wingTurn)}),e.set(o.farWing,{rotation:quat.multiply(FAR_WING_TILT,quat.z(-i,wingTurn),wingTurn)})}export function flapPop(e,t){const o=t.size;e.stopAnimation(t.body),e.animate(t.body,[{scale:[.86*o,1.16*o,o],at:.3},{scale:[1.05*o,.96*o,o],at:.65},{scale:o}],{duration:.26,easing:"easeOut"})}export function blink(e,t){const o=.34*t.size;e.animate(t.lid,[{scale:[o,o,o],at:.4},{scale:[o,o,o],at:.6},{scale:0}],{duration:.16,easing:"linear"})}export function dazeBird(e,t){const o=.34*t.size;e.stopAnimation(t.lid),e.set(t.lid,{scale:[o,.55*o,o],position:[EYE[0]*t.size,(EYE[1]+.06)*t.size,EYE[2]*t.size]}),e.animate(t.root,{shake:.12*t.size},{duration:.35})}export function wakeBird(e,t){e.stopAnimation(t.lid),e.set(t.lid,{scale:0,position:[EYE[0]*t.size,EYE[1]*t.size,EYE[2]*t.size]})}export function hoverBird(e,t,o,a){const s=BIRD_SIZE*pointSize(a)*.12;e.set(t.root,{bob:o?{amplitude:[0,s,0],speed:3.2}:null})}const FEATHERS=["#FFD700","#FF8C00","#FFE850","#FFFFFF","#A0522D"].map(e=>toColor(e));export function crashBurst(e,t,o,a){const s=pointSize(t),n=BIRD_SIZE*s,r=at(t,o,a,t.playDepth-.6*n);effects.shatter(e,{position:r,count:16,mesh:"sphere",size:.12*n,speed:7*n,lifetime:.7,gravity:18*-n,colors:FEATHERS,dust:!1}),effects.dust(e,{position:r,count:5,size:.9*n,speed:2*n,lifetime:.5,color:[1,1,1,.75]})}
1
+ "use strict";import{effects,extrude,lathe,merge,Path,quat,recolor,shapeGeometry,tube}from"@nayan-ui/engine";import{at,facing,pointSize}from"../shared/EngineMeadow.js";import{cacheGameAsset,createGameMesh as _0xd0e9e}from"../shared/EngineMeshes.js";import{toColor}from"../shared/EngineUtils.js";import{BIRD_SIZE,BRICK_HEIGHT,BRICK_WIDTH,PIPE_WIDTH}from"./FlappyBirdConstants.js";const meshes=new Map,cached=(e,t)=>{let o=meshes.get(e);return!o&&(o=cacheGameAsset("flappy-bird/FlappyBirdScene:"+e,t),meshes.set(e,o)),o},rgb=e=>{const[t,o,a]=toColor(e);return[t,o,a]},mix=(e,t,o)=>[e[0]+(t[0]-e[0])*o,e[1]+(t[1]-e[1])*o,e[2]+(t[2]-e[2])*o],sphere=()=>shapeGeometry("sphere"),beakPart=(e,t,o,a,s)=>({geometry:lathe([[t,0],[.6*t,.5*e],[.001,e]],{segments:12,color:o}),position:a,rotation:quat.multiply(quat.z(s),quat.z(-Math.PI/2))}),clamp01=e=>Math.max(0,Math.min(1,e)),smoothstep=e=>{const t=clamp01(e);return t*t*(3-2*t)},BODY_TOP=rgb("#FFE14D"),BODY_BOTTOM=rgb("#FFAA1F"),BELLY=rgb("#FFF4CC"),BLUSH=rgb("#FF8C9A"),FEATHER=rgb("#F08A12"),feather=(e,t,o)=>tube(e,{radius:e=>t*Math.max(.08,1-.85*e),shape:e=>.35+.65*Math.abs(Math.cos(e*Math.PI*2)),sides:8,smoothness:5,color:[...o,1]}),birdMesh=()=>cached("fb-bird",()=>{const e=Array.from({length:17},(e,t)=>{const o=t/16;return[Math.max(.001,.47*Math.sin(Math.PI*o)**.75*(1-.16*o)),.5-o]}),t=merge([{geometry:lathe(e,{segments:28}),rotation:quat.z(-Math.PI/2),scale:[1,.92,.86]}]),o=recolor(t,({position:[e,t,o]})=>{let a=mix(BODY_BOTTOM,BODY_TOP,clamp01(.5+1.3*t+.25*e));return a=mix(a,BELLY,smoothstep(4*(.06-t))*smoothstep(3*o+.3)*smoothstep(3*(e+.32))*.95),a=mix(a,BLUSH,.8*smoothstep(1-Math.hypot(e-.2,t+.06,o-.33)/.11)),[...a,1]});return _0xd0e9e(merge([{geometry:o},{geometry:sphere(),position:[.22,.15,.26],scale:.32,color:[1,1,1]},{geometry:sphere(),position:[.3,.16,.38],scale:.15,color:rgb("#151515")},{geometry:sphere(),position:[.33,.2,.445],scale:.05,color:[1,1,1]},beakPart(.3,.1,rgb("#FF7B3A"),[.4,0,.06],.12),beakPart(.24,.08,rgb("#D9531A"),[.39,-.07,.06],-.2),{geometry:feather([[.02,.36,0],[0,.52,0],[-.1,.6,0]],.07,rgb("#FF9500"))},{geometry:feather([[.1,.36,.02],[.12,.5,.02],[.06,.6,.02]],.06,rgb("#FFB300"))},{geometry:feather([[-.06,.34,-.02],[-.14,.46,-.02],[-.24,.5,-.02]],.055,FEATHER)},...[.2,.02,-.16].map((e,t)=>({geometry:tube([[-.34,.02,0],[-.52,.04+.6*e,0],[-.68,.06+e,0]],{radius:e=>.13*(.55+.45*Math.sin(Math.PI*(.25+.6*e))),shape:e=>.45+.55*Math.abs(Math.cos(e*Math.PI*2)),sides:10,smoothness:5,color:[...mix(FEATHER,rgb("#C2600A"),.35*t),1]})})),...[.12,-.12].map(e=>({geometry:feather([[.02,-.36,e],[-.08,-.46,e],[-.2,-.48,e]],.035,rgb("#FF7B3A"))}))]),{center:!1,shine:.35})}),wingMesh=e=>cached("fb-wing:"+e,()=>{const t=[[.06,.06],[-.12,.14],[-.34,.12],[-.56,.02],[-.5,-.04],[-.55,-.09],[-.44,-.11],[-.47,-.17],[-.34,-.17],[-.12,-.12],[.06,-.05]],o=(new Path).moveTo(t[0][0],-t[0][1]);for(const[e,a]of t.slice(1))o.lineTo(e,-a);o.close();const[a,s]=e?[rgb("#B86A08"),rgb("#D9901F")]:[rgb("#F59E0B"),rgb("#FFD35C")];return _0xd0e9e(recolor(extrude(o,{depth:.07}),({position:[e]})=>[...mix(a,s,clamp01(-e/.55)),1]),{center:!1,shine:.25})}),lidMesh=()=>cached("fb-lid",()=>_0xd0e9e(merge([{geometry:sphere(),color:BODY_TOP}]),{shine:.35})),pipeMesh=()=>cached("fb-pipe",()=>_0xd0e9e(lathe([[.5,-.5],[.5,.5]],{segments:24,color:rgb("#4CA840")}),{center:!1,shine:.55})),capMesh=()=>cached("fb-cap",()=>_0xd0e9e(merge([{geometry:lathe([[.001,.5],[.5,.5],[.52,.42],[.52,-.42],[.5,-.5]],{segments:24,color:rgb("#3A8A2A")})},{geometry:sphere(),position:[0,.5,0],scale:[.78,.02,.78],color:rgb("#123d10")}]),{center:!1,shine:.6})),SHADE_PERIOD=12;function brickShade(e,t){const o=(t%12+12)%12,a=43758.5453*Math.sin(127.1*e+311.7*o),s=a-Math.floor(a),n=rgb("#9E5428");return s<.5?mix(rgb("#6E3412"),n,2*s):mix(n,rgb("#B8693A"),2*(s-.5))}function wallGeometry(e,t,o,a){const s=BRICK_WIDTH*o,n=BRICK_HEIGHT*o,r=e*o,i=t*o,l=COPING*o,p=.35*n,h=.12*n,m=[],g=(e,t,o,a,s,n,r)=>m.push({geometry:shapeGeometry("cube"),position:[(e+t)/2,(o+a)/2,(s+n)/2],scale:[t-e,a-o,n-s],color:r});g(-r/2,r/2,l,i,0,a,rgb("#3a1d0c")),g(-r/2,r/2,0,l,-.01,a+p+.025,rgb("#c8b896")),g(-r/2,r/2,.78*l,l,a+p+.005,a+p+.03,rgb("#a9987a"));const u=Math.ceil((i-l)/n);for(let e=0;e<u;e++){const t=l+e*n,o=Math.min(i,t+n);for(let n=0,i=-r/2-(e%2?s/2:0);i<r/2;n++,i+=s){const l=Math.max(i,-r/2),m=Math.min(i+s,r/2);m-l<=h||o-t<=h||g(l+h/2,m-h/2,t+h/2,o-h/2,a-.01,a+p,brickShade(e,n))}}return merge(m)}const local=(e,t,o,a=0)=>[t*e,-o*e,a],CAP_HEIGHT=26,CAP_OVER=5,COPING=12,WALL_MARGIN=160,PIPE_INTO_WALL=220,wallDepth=e=>{const t=(PIPE_WIDTH+PIPE_WIDTH/60*10)/2*pointSize(e);return{back:e.playDepth+t+.04,thickness:2*t+.08,front:e.playDepth-t-.04}};function prism(e,t,o,a){const s=[],n=[],r=e.reduce((e,t)=>e+t[0],0)/e.length,i=e.reduce((e,t)=>e+t[1],0)/e.length,l=[(t+o)/2,i,r],p=e=>{const[t,o,r]=e,i=[o[0]-t[0],o[1]-t[1],o[2]-t[2]],p=[r[0]-t[0],r[1]-t[1],r[2]-t[2]];let h=[i[1]*p[2]-i[2]*p[1],i[2]*p[0]-i[0]*p[2],i[0]*p[1]-i[1]*p[0]];const m=e.reduce((t,o)=>[t[0]+o[0]/e.length,t[1]+o[1]/e.length,t[2]+o[2]/e.length],[0,0,0]);h[0]*(m[0]-l[0])+h[1]*(m[1]-l[1])+h[2]*(m[2]-l[2])<0&&(e=[...e].reverse(),h=[-h[0],-h[1],-h[2]]);const g=Math.hypot(h[0],h[1],h[2])||1,u=s.length/11;for(const t of e)s.push(t[0],t[1],t[2],h[0]/g,h[1]/g,h[2]/g,a[0],a[1],a[2],0,0);for(let t=1;t+1<e.length;t++)n.push(u,u+t,u+t+1)};return p(e.map(([e,o])=>[t,o,e])),p(e.map(([e,t])=>[o,t,e])),e.forEach(([a,s],n)=>{const[r,i]=e[(n+1)%e.length];p([[t,s,a],[o,s,a],[o,i,r],[t,i,r]])}),{vertices:new Float32Array(s),indices:new Uint32Array(n)}}function topWallGeometry(e,t,o,a){const s=BRICK_WIDTH*o,n=BRICK_HEIGHT*o,r=e*o,i=t*o,l=COPING*o,p=.35*n,h=p+.025,m=.12*n,g=1.05*a,u=-r/2,b=r/2,d=[{geometry:prism([[-h,g*h],[-h,i],[-.25,i],[-.25,.25*g]],u,b,rgb("#3a1d0c"))},{geometry:prism([[0,0],[0,l],[-h,l],[-h,g*h]],u,b,rgb("#c8b896"))},{geometry:shapeGeometry("cube"),position:[0,.11*l,.004],scale:[r,.22*l,.008],color:rgb("#a9987a")}],I=Math.ceil((i-l)/n);for(let e=0;e<I;e++){const t=l+e*n,o=Math.min(i,t+n);for(let a=0,n=u-(e%2?s/2:0);n<b;a++,n+=s){const r=Math.max(n,u),i=Math.min(n+s,b);i-r<=m||o-t<=m||d.push({geometry:shapeGeometry("cube"),position:[(r+i)/2,(t+o)/2,p/2-h],scale:[i-r-m,o-t-m,p+.01],color:brickShade(e+7,a)})}}return merge(d)}export function spawnWalls(e,t,o){const{back:a,front:s,thickness:n}=wallDepth(t),r=pointSize(t,a),i=pointSize(t,s),l=(o.height/2-o.topWall)/(o.height/2)*t.tanHalf,p=o.width+12*BRICK_WIDTH+4*BRICK_WIDTH,h=cached("fb-top-wall:"+Math.round(o.width)+"x"+Math.round(o.topWall)+":"+i.toFixed(6)+":"+l.toFixed(5),()=>_0xd0e9e(topWallGeometry(p,o.topWall+160,i,l),{center:!1,shine:.05})),m=o.height-o.bottomWallTop,g=cached("fb-wall:"+Math.round(o.width)+"x"+Math.round(m)+":"+r.toFixed(6)+":"+n.toFixed(4),()=>_0xd0e9e(wallGeometry(p,m+160,r,n),{center:!1,shine:.05})),u={top:e.spawn({mesh:h,color:[1,1,1,1],pickable:!1}),bottom:e.spawn({mesh:g,color:[1,1,1,1],pickable:!1})};return placeWalls(e,t,o,u,0),u}export function placeWalls(e,t,o,a,s){const{back:n,front:r}=wallDepth(t),i=s*pointSize(t),l=(a,s,n,r)=>{const l=12*BRICK_WIDTH*pointSize(t,n),p=at(t,o.width/2+12*BRICK_WIDTH/2,s,n);e.set(a,{position:[p[0]-i%l,p[1],p[2]],rotation:facing(t,r)})};l(a.top,o.topWall,r,0),l(a.bottom,o.bottomWallTop,n,Math.PI)}export function spawnPipe(e,t,o,a,s,n){const r=pointSize(t),i=PIPE_WIDTH/60,l=26*i,p=PIPE_WIDTH+10*i,h=a+PIPE_WIDTH/2,m=e.spawn({mesh:"none",position:at(t,h,0),rotation:facing(t),pickable:!1}),g=(t,o,a,s,n=!1)=>e.spawn({mesh:t,parent:m,position:local(r,0,o),scale:[s*r,a*r,s*r],...n?{rotation:quat.z(Math.PI)}:{},color:[1,1,1,1],pickable:!1}),u=Math.max(o.topWall,Math.min(s,o.bottomWallTop)),b=Math.max(o.topWall,Math.min(n,o.bottomWallTop)),d=o.topWall-220,I=o.bottomWallTop+220;return u-o.topWall>.5&&(g(pipeMesh(),(d+u)/2,u-d,PIPE_WIDTH),g(capMesh(),u-l/2,l,p,!0)),o.bottomWallTop-b>.5&&(g(pipeMesh(),(b+I)/2,I-b,PIPE_WIDTH),g(capMesh(),b+l/2,l,p)),m}export function placePipe(e,t,o,a,s){const n=at(t,a+PIPE_WIDTH/2,0);s?s.position(o,n[0],n[1],n[2]):e.set(o,{position:n})}const EYE=[.22,.15,.27],EYE_SIZE=.34;export function spawnBird(e,t,o,a){const s=BIRD_SIZE*pointSize(t),n=e.spawn({mesh:"none",position:at(t,o,a),rotation:facing(t),pickable:!1}),r=e.spawn({mesh:wingMesh(!0),parent:n,position:[.04*-s,.04*s,.3*-s],scale:s,color:[1,1,1,1],pickable:!1}),i=e.spawn({mesh:birdMesh(),parent:n,scale:s,color:[1,1,1,1],pickable:!1}),l=e.spawn({mesh:lidMesh(),parent:n,position:[EYE[0]*s,EYE[1]*s,EYE[2]*s],scale:0,color:[1,1,1,1],pickable:!1});return{root:n,body:i,wing:e.spawn({mesh:wingMesh(!1),parent:n,position:[.02*-s,.04*-s,.38*s],scale:s,color:[1,1,1,1],pickable:!1}),farWing:r,lid:l,size:s}}const NEAR_WING_TILT=quat.x(-.25),FAR_WING_TILT=quat.x(.25),wingTurn=[0,0,0,1];export function placeBird(e,t,o,a,s,n,r,i=r){e.set(o.root,{position:at(t,a,s),rotation:facing(t,-n)}),e.set(o.wing,{rotation:quat.multiply(NEAR_WING_TILT,quat.z(-r,wingTurn),wingTurn)}),e.set(o.farWing,{rotation:quat.multiply(FAR_WING_TILT,quat.z(-i,wingTurn),wingTurn)})}export function flapPop(e,t){const o=t.size;e.stopAnimation(t.body),e.animate(t.body,[{scale:[.86*o,1.16*o,o],at:.3},{scale:[1.05*o,.96*o,o],at:.65},{scale:o}],{duration:.26,easing:"easeOut"})}export function blink(e,t){const o=.34*t.size;e.animate(t.lid,[{scale:[o,o,o],at:.4},{scale:[o,o,o],at:.6},{scale:0}],{duration:.16,easing:"linear"})}export function dazeBird(e,t){const o=.34*t.size;e.stopAnimation(t.lid),e.set(t.lid,{scale:[o,.55*o,o],position:[EYE[0]*t.size,(EYE[1]+.06)*t.size,EYE[2]*t.size]}),e.animate(t.root,{shake:.12*t.size},{duration:.35})}export function wakeBird(e,t){e.stopAnimation(t.lid),e.set(t.lid,{scale:0,position:[EYE[0]*t.size,EYE[1]*t.size,EYE[2]*t.size]})}export function hoverBird(e,t,o,a){const s=BIRD_SIZE*pointSize(a)*.12;e.set(t.root,{bob:o?{amplitude:[0,s,0],speed:3.2}:null})}const FEATHERS=["#FFD700","#FF8C00","#FFE850","#FFFFFF","#A0522D"].map(e=>toColor(e));export function crashBurst(e,t,o,a){const s=pointSize(t),n=BIRD_SIZE*s,r=at(t,o,a,t.playDepth-.6*n);effects.shatter(e,{position:r,count:16,mesh:"sphere",size:.12*n,speed:7*n,lifetime:.7,gravity:18*-n,colors:FEATHERS,dust:!1}),effects.dust(e,{position:r,count:5,size:.9*n,speed:2*n,lifetime:.5,color:[1,1,1,.75]})}
@@ -1 +1 @@
1
- "use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{scoreColumn,timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{GAME_TIME,getLayout,LIGHT}from"./FruitMergerConstants.js";import{createGame,dispose,drag,finalScore,reset,setLayout,setTheme,start,tick}from"./FruitMergerGame.js";import{jsx as _0x27bccb}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.FRUIT_MERGER,FEEDBACK={drop:{sound:SOUNDS.DROP,haptic:HapticType.LIGHT},merge:{sound:SOUNDS.MERGE,haptic:HapticType.MEDIUM},win:{sound:SOUNDS.COMPLETE,haptic:HapticType.SUCCESS}},MESSAGES={win:"You reached the Pumpkin!",time:"You ran out of time!",overflow:"Fruits overflowed!"};export const FruitMerger=engineGame(GAME_IDS.FRUIT_MERGER,e=>{const[t,r]=useLiveState(GAME_TIME),[o,s]=useLiveState(0),{game:i,theme:a,status:n,screen:m,gameOver:S}=useEngineGame(e,{gameId:GAME_IDS.FRUIT_MERGER,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,r,o)=>setLayout(e,getLayout(t,r,o)),drag:drag,outcome:e=>"win"===e.outcome?"win":"lose",reportScore:e=>finalScore(e),sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.MEDIUM),onOver:(e,t)=>{"win"!==t&&e(SOUNDS.GAME_OVER,HapticType.HEAVY)},wire:(e,t)=>{e.onTime=r,e.onScore=s,e.onEvent=e=>t(FEEDBACK[e].sound,FEEDBACK[e].haptic)}});return _0x27bccb(EngineGameScreen,{...m,light:LIGHT,columns:[scoreColumn(o),timerColumn(t,a,0)],subtext:"Merge fruits!",gameOver:S({title:"win"===n?"YOU WON!":"GAME OVER",message:MESSAGES[i.outcome??"overflow"],scoreLabel:"Score",score:finalScore(i),buttonText:"Merge Again!"})})});
1
+ "use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{scoreColumn,timerColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{GAME_TIME,getLayout,LIGHT}from"./FruitMergerConstants.js";import{createGame,dispose,drag,finalScore,reset,setLayout,setTheme,start,tick}from"./FruitMergerGame.js";import{jsx as _0x8f2e38}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.FRUIT_MERGER,FEEDBACK={drop:{sound:SOUNDS.DROP,haptic:HapticType.LIGHT},merge:{sound:SOUNDS.MERGE,haptic:HapticType.MEDIUM},win:{sound:SOUNDS.COMPLETE,haptic:HapticType.SUCCESS}},MESSAGES={win:"You reached the Pumpkin!",time:"You ran out of time!",overflow:"Fruits overflowed!"};export const FruitMerger=engineGame(GAME_IDS.FRUIT_MERGER,e=>{const[t,r]=useLiveState(GAME_TIME),[o,s]=useLiveState(0),{game:i,theme:a,status:n,screen:m,gameOver:S}=useEngineGame(e,{gameId:GAME_IDS.FRUIT_MERGER,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,r,o)=>setLayout(e,getLayout(t,r,o)),drag:drag,outcome:e=>"win"===e.outcome?"win":"lose",reportScore:e=>finalScore(e),sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.MEDIUM),onOver:(e,t)=>{"win"!==t&&e(SOUNDS.GAME_OVER,HapticType.HEAVY)},wire:(e,t)=>{e.onTime=r,e.onScore=s,e.onEvent=e=>t(FEEDBACK[e].sound,FEEDBACK[e].haptic)}});return _0x8f2e38(EngineGameScreen,{...m,light:LIGHT,columns:[scoreColumn(o),timerColumn(t,a,0)],subtext:"Merge fruits!",gameOver:S({title:"win"===n?"YOU WON!":"GAME OVER",message:MESSAGES[i.outcome??"overflow"],scoreLabel:"Score",score:finalScore(i),buttonText:"Merge Again!"})})});