@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.
- package/lib/module/games/arrows/Arrows.js +1 -1
- package/lib/module/games/arrows/ArrowsScene.js +1 -1
- package/lib/module/games/balloon-blaster/BalloonBlaster.js +1 -1
- package/lib/module/games/balloon-blaster/BalloonBlasterScene.js +1 -1
- package/lib/module/games/bike-racing/BikeMeshes.js +1 -1
- package/lib/module/games/bike-racing/BikeRacing.js +1 -1
- package/lib/module/games/bike-racing/BikeRacingConstants.js +1 -1
- package/lib/module/games/bike-racing/BikeRacingScene.js +1 -1
- package/lib/module/games/block-blast/BlockBlast.js +1 -1
- package/lib/module/games/block-blast/BlockBlastScene.js +1 -1
- package/lib/module/games/block-breaker/BlockBreaker.js +1 -1
- package/lib/module/games/block-breaker/BlockBreakerScene.js +1 -1
- package/lib/module/games/bluk/Bluk.js +1 -1
- package/lib/module/games/bluk/BlukScene.js +1 -1
- package/lib/module/games/bubble-shooter/BubbleShooter.js +1 -1
- package/lib/module/games/bubble-shooter/BubbleShooterScene.js +1 -1
- package/lib/module/games/candy-crush/CandyCrush.js +1 -1
- package/lib/module/games/candy-crush/CandyCrushScene.js +1 -1
- package/lib/module/games/car-racing/CarMeshes.js +1 -1
- package/lib/module/games/car-racing/CarRacing.js +1 -1
- package/lib/module/games/car-racing/CarRacingScene.js +1 -1
- package/lib/module/games/chameleon-run/ChameleonRun.js +1 -1
- package/lib/module/games/chameleon-run/ChameleonRunBackdrop.js +1 -1
- package/lib/module/games/chameleon-run/ChameleonRunMeshes.js +1 -1
- package/lib/module/games/checkers/Checkers.js +1 -1
- package/lib/module/games/checkers/CheckersScene.js +1 -1
- package/lib/module/games/color-switch/ColorSwitch.js +1 -1
- package/lib/module/games/color-switch/ColorSwitchScene.js +1 -1
- package/lib/module/games/colors-sort/ColorsSort.js +1 -1
- package/lib/module/games/colors-sort/ColorsSortScene.js +1 -1
- package/lib/module/games/connect-em-all/ConnectEmAll.js +1 -1
- package/lib/module/games/connect-em-all/ConnectEmAllScene.js +1 -1
- package/lib/module/games/crossy-road/CrossyRoad.js +1 -1
- package/lib/module/games/crossy-road/CrossyRoadMeshes.js +1 -1
- package/lib/module/games/crossy-road/CrossyRoadPerson.js +1 -1
- package/lib/module/games/dino-jump/DinoJump.js +1 -1
- package/lib/module/games/dino-jump/DinoJumpScene.js +1 -1
- package/lib/module/games/dots-and-boxes/DotsAndBoxes.js +1 -1
- package/lib/module/games/dots-and-boxes/DotsAndBoxesScene.js +1 -1
- package/lib/module/games/falling-sticks/FallingSticks.js +1 -1
- package/lib/module/games/falling-sticks/FallingSticksScene.js +1 -1
- package/lib/module/games/find-different-number/FindDifferentNumber.js +1 -1
- package/lib/module/games/find-different-number/FindDifferentNumberScene.js +1 -1
- package/lib/module/games/flappy-bird/FlappyBird.js +1 -1
- package/lib/module/games/flappy-bird/FlappyBirdScene.js +1 -1
- package/lib/module/games/fruit-merger/FruitMerger.js +1 -1
- package/lib/module/games/fruit-merger/FruitMergerScene.js +1 -1
- package/lib/module/games/fruit-ninja/FruitNinja.js +1 -1
- package/lib/module/games/fruit-ninja/FruitNinjaScene.js +1 -1
- package/lib/module/games/fruit-ninja/FruitNinjaWorld.js +1 -1
- package/lib/module/games/game-2048/Game2048.js +1 -1
- package/lib/module/games/game-2048/Game2048Scene.js +1 -1
- package/lib/module/games/knife-hit/KnifeHit.js +1 -1
- package/lib/module/games/knife-hit/KnifeHitScene.js +1 -1
- package/lib/module/games/ludo-king/LudoKing.js +1 -1
- package/lib/module/games/ludo-king/LudoKingScene.js +1 -1
- package/lib/module/games/maze-runner/MazeRunner.js +1 -1
- package/lib/module/games/maze-runner/MazeRunnerScene.js +1 -1
- package/lib/module/games/memory-match/MemoryMatch.js +1 -1
- package/lib/module/games/memory-match/MemoryMatchScene.js +1 -1
- package/lib/module/games/mine-sweeper/MineSweeper.js +1 -1
- package/lib/module/games/mine-sweeper/MineSweeperScene.js +1 -1
- package/lib/module/games/mob-control/MobControl.js +1 -1
- package/lib/module/games/mob-control/MobControlGame.js +1 -1
- package/lib/module/games/mob-control/MobControlMeshes.js +1 -1
- package/lib/module/games/mob-control/MobControlRenderer.js +1 -1
- package/lib/module/games/mob-control/MobControlRules.js +1 -1
- package/lib/module/games/mob-control/MobControlScene.js +1 -1
- package/lib/module/games/nuts-and-bolts/NutsAndBolts.js +1 -1
- package/lib/module/games/nuts-and-bolts/NutsAndBoltsScene.js +1 -1
- package/lib/module/games/pac-man/PacMan.js +1 -1
- package/lib/module/games/pac-man/PacManGame.js +1 -1
- package/lib/module/games/pac-man/PacManScene.js +1 -1
- package/lib/module/games/paper-io/PaperIo.js +1 -1
- package/lib/module/games/paper-io/PaperIoMeshes.js +1 -1
- package/lib/module/games/paper-io/PaperIoScene.js +1 -1
- package/lib/module/games/penguin-run/PenguinMeshes.js +1 -1
- package/lib/module/games/penguin-run/PenguinRun.js +1 -1
- package/lib/module/games/penguin-run/PenguinRunScene.js +1 -1
- package/lib/module/games/perfect-circle/PerfectCircle.js +1 -1
- package/lib/module/games/perfect-circle/PerfectCircleScene.js +1 -1
- package/lib/module/games/pipe-connect/PipeConnect.js +1 -1
- package/lib/module/games/pipe-connect/PipeConnectScene.js +1 -1
- package/lib/module/games/play-with-tua/PlayWithTua.js +1 -1
- package/lib/module/games/popit-fidget/PopitFidget.js +1 -1
- package/lib/module/games/popit-fidget/PopitFidgetScene.js +1 -1
- package/lib/module/games/reversi/Reversi.js +1 -1
- package/lib/module/games/reversi/ReversiScene.js +1 -1
- package/lib/module/games/search-grid/SearchGrid.js +1 -1
- package/lib/module/games/search-grid/SearchGridScene.js +1 -1
- package/lib/module/games/shared/BackdropCard.js +1 -1
- package/lib/module/games/shared/EngineBackdrop.js +1 -1
- package/lib/module/games/shared/EngineBlasts.js +1 -1
- package/lib/module/games/shared/EngineBlocks.js +1 -1
- package/lib/module/games/shared/EngineDice.js +1 -1
- package/lib/module/games/shared/EngineFruits.js +1 -1
- package/lib/module/games/shared/EngineGameLoader.js +1 -1
- package/lib/module/games/shared/EngineGameScreen.js +1 -1
- package/lib/module/games/shared/EngineGlyphs.js +1 -1
- package/lib/module/games/shared/EngineHud.js +1 -1
- package/lib/module/games/shared/EngineMeadow.js +1 -1
- package/lib/module/games/shared/EngineTouchSurface.js +1 -1
- package/lib/module/games/shared/GameActivity.js +1 -1
- package/lib/module/games/shared/GameLoading.js +1 -1
- package/lib/module/games/shared/GameLoadingTransition.js +1 -1
- package/lib/module/games/sliding-numbers/SlidingNumbers.js +1 -1
- package/lib/module/games/sliding-numbers/SlidingNumbersScene.js +1 -1
- package/lib/module/games/snake-3d/Snake3D.js +1 -1
- package/lib/module/games/snake-3d/Snake3DScene.js +1 -1
- package/lib/module/games/snakes-and-ladders/SnakesAndLadders.js +1 -1
- package/lib/module/games/snakes-and-ladders/SnakesAndLaddersScene.js +1 -1
- package/lib/module/games/space-fighter/SpaceFighter.js +1 -1
- package/lib/module/games/space-fighter/SpaceFighterScene.js +1 -1
- package/lib/module/games/spider-solitaire/SpiderSolitaire.js +1 -1
- package/lib/module/games/spider-solitaire/SpiderSolitaireScene.js +1 -1
- package/lib/module/games/stack-tower/StackTower.js +1 -1
- package/lib/module/games/stack-tower/StackTowerScene.js +1 -1
- package/lib/module/games/sudoku/Sudoku.js +1 -1
- package/lib/module/games/sudoku/SudokuScene.js +1 -1
- package/lib/module/games/tangram/Tangram.js +1 -1
- package/lib/module/games/tangram/TangramScene.js +1 -1
- package/lib/module/games/tank-1990/Tank1990.js +1 -1
- package/lib/module/games/tank-1990/Tank1990Scene.js +1 -1
- package/lib/module/games/tic-tac-toe/TicTacToe.js +1 -1
- package/lib/module/games/tic-tac-toe/TicTacToeScene.js +1 -1
- package/lib/module/games/tile-home/TileHome.js +1 -1
- package/lib/module/games/tile-home/TileHomeScene.js +1 -1
- package/lib/module/games/treasure-hunt/TreasureHunt.js +1 -1
- package/lib/module/games/treasure-hunt/TreasureHuntConstants.js +1 -1
- package/lib/module/games/treasure-hunt/TreasureHuntModel.js +1 -1
- package/lib/module/games/treasure-hunt/TreasureHuntScene.js +1 -1
- package/lib/module/games/whack-a-mole/WhackAMole.js +1 -1
- package/lib/module/games/whack-a-mole/WhackAMoleScene.js +1 -1
- package/lib/module/helpers/GameSettingsModal.js +1 -1
- package/lib/module/helpers/GameTheme.js +1 -1
- package/package.json +1 -2
- package/src/assets/fonts/Inter-SemiBold.ttf +0 -0
- package/src/assets/models/explorer/explorer.glb +0 -0
- package/src/assets/models/explorer/params.json +0 -51
- package/src/assets/models/explorer/source.json +0 -222
- package/src/assets/models/play-with-tua/play-with-tua.glb +0 -0
- package/src/assets/models/play-with-tua/sources.json +0 -141
- package/src/assets/sfx/balloon_pop.wav +0 -0
- package/src/assets/sfx/blocked.wav +0 -0
- package/src/assets/sfx/boing.wav +0 -0
- package/src/assets/sfx/bonus.wav +0 -0
- package/src/assets/sfx/boom.wav +0 -0
- package/src/assets/sfx/bump.wav +0 -0
- package/src/assets/sfx/cannon.wav +0 -0
- package/src/assets/sfx/capture.wav +0 -0
- package/src/assets/sfx/card_flip.wav +0 -0
- package/src/assets/sfx/card_place.wav +0 -0
- package/src/assets/sfx/catch.wav +0 -0
- package/src/assets/sfx/chime.wav +0 -0
- package/src/assets/sfx/chomp.wav +0 -0
- package/src/assets/sfx/chomp_alt.wav +0 -0
- package/src/assets/sfx/clack.wav +0 -0
- package/src/assets/sfx/clang.wav +0 -0
- package/src/assets/sfx/clash.wav +0 -0
- package/src/assets/sfx/click.wav +0 -0
- package/src/assets/sfx/coin.wav +0 -0
- package/src/assets/sfx/combo.wav +0 -0
- package/src/assets/sfx/crash.wav +0 -0
- package/src/assets/sfx/crunch.wav +0 -0
- package/src/assets/sfx/dance.wav +0 -0
- package/src/assets/sfx/deselect.wav +0 -0
- package/src/assets/sfx/dice_roll.wav +0 -0
- package/src/assets/sfx/die.wav +0 -0
- package/src/assets/sfx/draw.wav +0 -0
- package/src/assets/sfx/drop.wav +0 -0
- package/src/assets/sfx/eat.wav +0 -0
- package/src/assets/sfx/engine.wav +0 -0
- package/src/assets/sfx/error.wav +0 -0
- package/src/assets/sfx/flag.wav +0 -0
- package/src/assets/sfx/flap.wav +0 -0
- package/src/assets/sfx/flip_disc.wav +0 -0
- package/src/assets/sfx/footstep_run.wav +0 -0
- package/src/assets/sfx/footstep_walk.wav +0 -0
- package/src/assets/sfx/game_over.wav +0 -0
- package/src/assets/sfx/gate.wav +0 -0
- package/src/assets/sfx/hit.wav +0 -0
- package/src/assets/sfx/hop.wav +0 -0
- package/src/assets/sfx/hurt.wav +0 -0
- package/src/assets/sfx/invalid.wav +0 -0
- package/src/assets/sfx/jump.wav +0 -0
- package/src/assets/sfx/ladder.wav +0 -0
- package/src/assets/sfx/land.wav +0 -0
- package/src/assets/sfx/laugh.wav +0 -0
- package/src/assets/sfx/lose.wav +0 -0
- package/src/assets/sfx/merge.wav +0 -0
- package/src/assets/sfx/miss.wav +0 -0
- package/src/assets/sfx/nitro.wav +0 -0
- package/src/assets/sfx/pew.wav +0 -0
- package/src/assets/sfx/place.wav +0 -0
- package/src/assets/sfx/pling.wav +0 -0
- package/src/assets/sfx/point.wav +0 -0
- package/src/assets/sfx/pop.wav +0 -0
- package/src/assets/sfx/pop_soft.wav +0 -0
- package/src/assets/sfx/power_up.wav +0 -0
- package/src/assets/sfx/reveal.wav +0 -0
- package/src/assets/sfx/robot.wav +0 -0
- package/src/assets/sfx/rotate.wav +0 -0
- package/src/assets/sfx/run_steps.wav +0 -0
- package/src/assets/sfx/select.wav +0 -0
- package/src/assets/sfx/shuffle.wav +0 -0
- package/src/assets/sfx/six.wav +0 -0
- package/src/assets/sfx/slice.wav +0 -0
- package/src/assets/sfx/slide.wav +0 -0
- package/src/assets/sfx/snake.wav +0 -0
- package/src/assets/sfx/snap.wav +0 -0
- package/src/assets/sfx/splash.wav +0 -0
- package/src/assets/sfx/star.wav +0 -0
- package/src/assets/sfx/start.wav +0 -0
- package/src/assets/sfx/swoosh.wav +0 -0
- package/src/assets/sfx/tap.wav +0 -0
- package/src/assets/sfx/thud.wav +0 -0
- package/src/assets/sfx/thunk.wav +0 -0
- package/src/assets/sfx/tick.wav +0 -0
- package/src/assets/sfx/time_up.wav +0 -0
- package/src/assets/sfx/tock.wav +0 -0
- package/src/assets/sfx/walk_steps.wav +0 -0
- package/src/assets/sfx/warning.wav +0 -0
- package/src/assets/sfx/whack.wav +0 -0
- package/src/assets/sfx/whoosh.wav +0 -0
- package/src/assets/sfx/win.wav +0 -0
- package/src/assets/sfx/zap.wav +0 -0
- package/src/assets/textures/ad_bolt.png +0 -0
- package/src/assets/textures/ad_bubbles.png +0 -0
- package/src/assets/textures/ad_chevrons.png +0 -0
- package/src/assets/textures/asphalt.png +0 -0
- package/src/assets/textures/bark.jpg +0 -0
- package/src/assets/textures/explorer-atlas.png +0 -0
- package/src/assets/textures/facade.png +0 -0
- package/src/assets/textures/grass.png +0 -0
- package/src/assets/textures/leaves.png +0 -0
- package/src/assets/textures/limestone.jpg +0 -0
- package/src/assets/textures/meadow.jpg +0 -0
- package/src/assets/textures/nature-sources.json +0 -87
- package/src/assets/textures/pine.png +0 -0
- package/src/assets/textures/river.jpg +0 -0
- package/src/assets/textures/soft_glow.png +0 -0
- package/src/games/arrows/Arrows.tsx +0 -69
- package/src/games/arrows/ArrowsConstants.ts +0 -107
- package/src/games/arrows/ArrowsGame.ts +0 -735
- package/src/games/arrows/ArrowsScene.ts +0 -395
- package/src/games/balloon-blaster/BalloonBlaster.tsx +0 -75
- package/src/games/balloon-blaster/BalloonBlasterConstants.ts +0 -79
- package/src/games/balloon-blaster/BalloonBlasterGame.ts +0 -287
- package/src/games/balloon-blaster/BalloonBlasterPhysics.ts +0 -95
- package/src/games/balloon-blaster/BalloonBlasterScene.ts +0 -225
- package/src/games/bike-racing/BikeMeshes.ts +0 -273
- package/src/games/bike-racing/BikeRacing.tsx +0 -211
- package/src/games/bike-racing/BikeRacingConstants.ts +0 -103
- package/src/games/bike-racing/BikeRacingGame.ts +0 -557
- package/src/games/bike-racing/BikeRacingScene.ts +0 -119
- package/src/games/block-blast/BlockBlast.tsx +0 -73
- package/src/games/block-blast/BlockBlastConstants.ts +0 -179
- package/src/games/block-blast/BlockBlastGame.ts +0 -471
- package/src/games/block-blast/BlockBlastScene.ts +0 -156
- package/src/games/block-breaker/BlockBreaker.tsx +0 -79
- package/src/games/block-breaker/BlockBreakerConstants.ts +0 -139
- package/src/games/block-breaker/BlockBreakerGame.ts +0 -459
- package/src/games/block-breaker/BlockBreakerScene.ts +0 -257
- package/src/games/bluk/Bluk.tsx +0 -82
- package/src/games/bluk/BlukConstants.ts +0 -121
- package/src/games/bluk/BlukGame.ts +0 -323
- package/src/games/bluk/BlukRules.ts +0 -154
- package/src/games/bluk/BlukScene.ts +0 -514
- package/src/games/bubble-shooter/BubbleShooter.tsx +0 -76
- package/src/games/bubble-shooter/BubbleShooterConstants.ts +0 -103
- package/src/games/bubble-shooter/BubbleShooterGame.ts +0 -459
- package/src/games/bubble-shooter/BubbleShooterScene.ts +0 -158
- package/src/games/candy-crush/CandyCrush.tsx +0 -77
- package/src/games/candy-crush/CandyCrushConstants.ts +0 -94
- package/src/games/candy-crush/CandyCrushGame.ts +0 -477
- package/src/games/candy-crush/CandyCrushScene.ts +0 -209
- package/src/games/car-racing/CarMeshes.ts +0 -440
- package/src/games/car-racing/CarRacing.tsx +0 -211
- package/src/games/car-racing/CarRacingConstants.ts +0 -167
- package/src/games/car-racing/CarRacingFacade.ts +0 -40
- package/src/games/car-racing/CarRacingGame.ts +0 -539
- package/src/games/car-racing/CarRacingScene.ts +0 -1026
- package/src/games/car-racing/CarRacingScenery.ts +0 -265
- package/src/games/chameleon-run/ChameleonRun.tsx +0 -96
- package/src/games/chameleon-run/ChameleonRunBackdrop.ts +0 -186
- package/src/games/chameleon-run/ChameleonRunConstants.ts +0 -47
- package/src/games/chameleon-run/ChameleonRunGame.ts +0 -309
- package/src/games/chameleon-run/ChameleonRunMeshes.ts +0 -305
- package/src/games/chameleon-run/ChameleonRunRules.ts +0 -252
- package/src/games/chameleon-run/ChameleonRunScene.ts +0 -310
- package/src/games/checkers/Checkers.tsx +0 -83
- package/src/games/checkers/CheckersAI.ts +0 -255
- package/src/games/checkers/CheckersConstants.ts +0 -68
- package/src/games/checkers/CheckersGame.ts +0 -322
- package/src/games/checkers/CheckersRules.ts +0 -167
- package/src/games/checkers/CheckersScene.ts +0 -308
- package/src/games/color-switch/ColorSwitch.tsx +0 -75
- package/src/games/color-switch/ColorSwitchConstants.ts +0 -61
- package/src/games/color-switch/ColorSwitchGame.ts +0 -329
- package/src/games/color-switch/ColorSwitchScene.ts +0 -220
- package/src/games/colors-sort/ColorsSort.tsx +0 -82
- package/src/games/colors-sort/ColorsSortConstants.ts +0 -119
- package/src/games/colors-sort/ColorsSortGame.ts +0 -246
- package/src/games/colors-sort/ColorsSortScene.ts +0 -315
- package/src/games/connect-em-all/ConnectEmAll.tsx +0 -70
- package/src/games/connect-em-all/ConnectEmAllConstants.ts +0 -77
- package/src/games/connect-em-all/ConnectEmAllGame.ts +0 -401
- package/src/games/connect-em-all/ConnectEmAllScene.ts +0 -235
- package/src/games/crossy-road/CrossyRoad.tsx +0 -74
- package/src/games/crossy-road/CrossyRoadCamera.ts +0 -59
- package/src/games/crossy-road/CrossyRoadConstants.ts +0 -132
- package/src/games/crossy-road/CrossyRoadGame.ts +0 -293
- package/src/games/crossy-road/CrossyRoadMeshes.ts +0 -195
- package/src/games/crossy-road/CrossyRoadPerson.ts +0 -198
- package/src/games/crossy-road/CrossyRoadRules.ts +0 -99
- package/src/games/crossy-road/CrossyRoadScene.ts +0 -355
- package/src/games/dino-jump/DinoJump.tsx +0 -77
- package/src/games/dino-jump/DinoJumpConstants.ts +0 -80
- package/src/games/dino-jump/DinoJumpGame.ts +0 -344
- package/src/games/dino-jump/DinoJumpScene.ts +0 -686
- package/src/games/dots-and-boxes/DotsAndBoxes.tsx +0 -83
- package/src/games/dots-and-boxes/DotsAndBoxesConstants.ts +0 -77
- package/src/games/dots-and-boxes/DotsAndBoxesGame.ts +0 -271
- package/src/games/dots-and-boxes/DotsAndBoxesScene.ts +0 -249
- package/src/games/falling-sticks/FallingSticks.tsx +0 -72
- package/src/games/falling-sticks/FallingSticksConstants.ts +0 -62
- package/src/games/falling-sticks/FallingSticksGame.ts +0 -220
- package/src/games/falling-sticks/FallingSticksRules.ts +0 -145
- package/src/games/falling-sticks/FallingSticksScene.ts +0 -245
- package/src/games/find-different-number/FindDifferentNumber.tsx +0 -74
- package/src/games/find-different-number/FindDifferentNumberConstants.ts +0 -74
- package/src/games/find-different-number/FindDifferentNumberGame.ts +0 -174
- package/src/games/find-different-number/FindDifferentNumberRules.ts +0 -43
- package/src/games/find-different-number/FindDifferentNumberScene.ts +0 -193
- package/src/games/flappy-bird/FlappyBird.tsx +0 -73
- package/src/games/flappy-bird/FlappyBirdConstants.ts +0 -95
- package/src/games/flappy-bird/FlappyBirdGame.ts +0 -375
- package/src/games/flappy-bird/FlappyBirdScene.ts +0 -630
- package/src/games/fruit-merger/FruitMerger.tsx +0 -73
- package/src/games/fruit-merger/FruitMergerConstants.ts +0 -102
- package/src/games/fruit-merger/FruitMergerGame.ts +0 -285
- package/src/games/fruit-merger/FruitMergerRules.ts +0 -286
- package/src/games/fruit-merger/FruitMergerScene.ts +0 -498
- package/src/games/fruit-ninja/FruitNinja.tsx +0 -129
- package/src/games/fruit-ninja/FruitNinjaConstants.ts +0 -107
- package/src/games/fruit-ninja/FruitNinjaGame.ts +0 -391
- package/src/games/fruit-ninja/FruitNinjaScene.ts +0 -319
- package/src/games/fruit-ninja/FruitNinjaWorld.ts +0 -17
- package/src/games/game-2048/Game2048.tsx +0 -84
- package/src/games/game-2048/Game2048Constants.ts +0 -68
- package/src/games/game-2048/Game2048Game.ts +0 -181
- package/src/games/game-2048/Game2048Rules.ts +0 -101
- package/src/games/game-2048/Game2048Scene.ts +0 -206
- package/src/games/knife-hit/KnifeHit.tsx +0 -78
- package/src/games/knife-hit/KnifeHitConstants.ts +0 -89
- package/src/games/knife-hit/KnifeHitGame.ts +0 -264
- package/src/games/knife-hit/KnifeHitScene.ts +0 -360
- package/src/games/ludo-king/LudoKing.tsx +0 -86
- package/src/games/ludo-king/LudoKingConstants.ts +0 -212
- package/src/games/ludo-king/LudoKingGame.ts +0 -326
- package/src/games/ludo-king/LudoKingRules.ts +0 -143
- package/src/games/ludo-king/LudoKingScene.ts +0 -397
- package/src/games/maze-runner/MazeRunner.tsx +0 -88
- package/src/games/maze-runner/MazeRunnerConstants.ts +0 -65
- package/src/games/maze-runner/MazeRunnerGame.ts +0 -176
- package/src/games/maze-runner/MazeRunnerRules.ts +0 -161
- package/src/games/maze-runner/MazeRunnerScene.ts +0 -245
- package/src/games/memory-match/MemoryMatch.tsx +0 -77
- package/src/games/memory-match/MemoryMatchConstants.ts +0 -105
- package/src/games/memory-match/MemoryMatchGame.ts +0 -222
- package/src/games/memory-match/MemoryMatchRules.ts +0 -38
- package/src/games/memory-match/MemoryMatchScene.ts +0 -268
- package/src/games/mine-sweeper/MineSweeper.tsx +0 -77
- package/src/games/mine-sweeper/MineSweeperConstants.ts +0 -94
- package/src/games/mine-sweeper/MineSweeperGame.ts +0 -234
- package/src/games/mine-sweeper/MineSweeperRules.ts +0 -67
- package/src/games/mine-sweeper/MineSweeperScene.ts +0 -262
- package/src/games/mob-control/MobControl.tsx +0 -73
- package/src/games/mob-control/MobControlConstants.ts +0 -106
- package/src/games/mob-control/MobControlGame.ts +0 -176
- package/src/games/mob-control/MobControlMeshes.ts +0 -85
- package/src/games/mob-control/MobControlRenderer.ts +0 -108
- package/src/games/mob-control/MobControlRules.ts +0 -522
- package/src/games/mob-control/MobControlScene.ts +0 -399
- package/src/games/number-search/NumberSearch.tsx +0 -18
- package/src/games/number-search/NumberSearchNumbers.ts +0 -623
- package/src/games/nuts-and-bolts/NutsAndBolts.tsx +0 -85
- package/src/games/nuts-and-bolts/NutsAndBoltsConstants.ts +0 -75
- package/src/games/nuts-and-bolts/NutsAndBoltsGame.ts +0 -298
- package/src/games/nuts-and-bolts/NutsAndBoltsRules.ts +0 -474
- package/src/games/nuts-and-bolts/NutsAndBoltsScene.ts +0 -498
- package/src/games/pac-man/PacMan.tsx +0 -86
- package/src/games/pac-man/PacManConstants.ts +0 -169
- package/src/games/pac-man/PacManGame.ts +0 -406
- package/src/games/pac-man/PacManRules.ts +0 -255
- package/src/games/pac-man/PacManScene.ts +0 -387
- package/src/games/paper-io/PaperIo.tsx +0 -91
- package/src/games/paper-io/PaperIoConstants.ts +0 -86
- package/src/games/paper-io/PaperIoGame.ts +0 -193
- package/src/games/paper-io/PaperIoMeshes.ts +0 -233
- package/src/games/paper-io/PaperIoRules.ts +0 -315
- package/src/games/paper-io/PaperIoScene.ts +0 -310
- package/src/games/penguin-run/PenguinMeshes.ts +0 -269
- package/src/games/penguin-run/PenguinModel.ts +0 -712
- package/src/games/penguin-run/PenguinRun.tsx +0 -77
- package/src/games/penguin-run/PenguinRunConstants.ts +0 -69
- package/src/games/penguin-run/PenguinRunGame.ts +0 -406
- package/src/games/penguin-run/PenguinRunScene.ts +0 -949
- package/src/games/perfect-circle/PerfectCircle.tsx +0 -74
- package/src/games/perfect-circle/PerfectCircleConstants.ts +0 -52
- package/src/games/perfect-circle/PerfectCircleGame.ts +0 -153
- package/src/games/perfect-circle/PerfectCircleRules.ts +0 -111
- package/src/games/perfect-circle/PerfectCircleScene.ts +0 -176
- package/src/games/pipe-connect/PipeConnect.tsx +0 -69
- package/src/games/pipe-connect/PipeConnectConstants.ts +0 -101
- package/src/games/pipe-connect/PipeConnectGame.ts +0 -179
- package/src/games/pipe-connect/PipeConnectRules.ts +0 -326
- package/src/games/pipe-connect/PipeConnectScene.ts +0 -271
- package/src/games/play-with-tua/PlayWithTua.tsx +0 -123
- package/src/games/play-with-tua/PlayWithTuaConstants.ts +0 -70
- package/src/games/play-with-tua/PlayWithTuaGame.ts +0 -167
- package/src/games/play-with-tua/PlayWithTuaModel.ts +0 -42
- package/src/games/play-with-tua/PlayWithTuaScene.ts +0 -36
- package/src/games/popit-fidget/PopitFidget.tsx +0 -72
- package/src/games/popit-fidget/PopitFidgetConstants.ts +0 -71
- package/src/games/popit-fidget/PopitFidgetGame.ts +0 -148
- package/src/games/popit-fidget/PopitFidgetScene.ts +0 -242
- package/src/games/reversi/Reversi.tsx +0 -94
- package/src/games/reversi/ReversiConstants.ts +0 -67
- package/src/games/reversi/ReversiGame.ts +0 -266
- package/src/games/reversi/ReversiRules.ts +0 -176
- package/src/games/reversi/ReversiScene.ts +0 -240
- package/src/games/search-grid/SearchGrid.tsx +0 -92
- package/src/games/search-grid/SearchGridConstants.ts +0 -178
- package/src/games/search-grid/SearchGridGame.ts +0 -209
- package/src/games/search-grid/SearchGridScene.ts +0 -301
- package/src/games/shared/BackdropCard.tsx +0 -54
- package/src/games/shared/EngineBackdrop.ts +0 -300
- package/src/games/shared/EngineBlasts.ts +0 -136
- package/src/games/shared/EngineBlocks.ts +0 -91
- package/src/games/shared/EngineControlText.ts +0 -17
- package/src/games/shared/EngineDice.ts +0 -250
- package/src/games/shared/EngineFootprint.ts +0 -35
- package/src/games/shared/EngineFruits.ts +0 -1435
- package/src/games/shared/EngineGameLoader.tsx +0 -88
- package/src/games/shared/EngineGameScreen.tsx +0 -325
- package/src/games/shared/EngineGameWidth.ts +0 -3
- package/src/games/shared/EngineGameWidth.web.ts +0 -3
- package/src/games/shared/EngineGlyphs.ts +0 -178
- package/src/games/shared/EngineHud.ts +0 -815
- package/src/games/shared/EngineLoading.ts +0 -477
- package/src/games/shared/EngineMeadow.ts +0 -725
- package/src/games/shared/EngineMeshCache.ts +0 -15
- package/src/games/shared/EngineMeshes.ts +0 -10
- package/src/games/shared/EngineRacingChase.ts +0 -21
- package/src/games/shared/EngineRacingHandling.ts +0 -48
- package/src/games/shared/EngineReadyContext.ts +0 -4
- package/src/games/shared/EngineTilt.ts +0 -44
- package/src/games/shared/EngineTouchSurface.tsx +0 -103
- package/src/games/shared/EngineUtils.ts +0 -52
- package/src/games/shared/GameActivity.ts +0 -13
- package/src/games/shared/GameLoading.tsx +0 -202
- package/src/games/shared/GameLoadingTransition.tsx +0 -61
- package/src/games/shared/ProceduralCacheVersion.ts +0 -2
- package/src/games/shared/useEngineGame.ts +0 -240
- package/src/games/shared/useGameResource.ts +0 -21
- package/src/games/shared/useLiveState.ts +0 -58
- package/src/games/sliding-numbers/SlidingNumbers.tsx +0 -71
- package/src/games/sliding-numbers/SlidingNumbersConstants.ts +0 -65
- package/src/games/sliding-numbers/SlidingNumbersGame.ts +0 -192
- package/src/games/sliding-numbers/SlidingNumbersRules.ts +0 -79
- package/src/games/sliding-numbers/SlidingNumbersScene.ts +0 -193
- package/src/games/snake-3d/Snake3D.tsx +0 -76
- package/src/games/snake-3d/Snake3DConstants.ts +0 -61
- package/src/games/snake-3d/Snake3DGame.ts +0 -192
- package/src/games/snake-3d/Snake3DMotion.ts +0 -22
- package/src/games/snake-3d/Snake3DRules.ts +0 -116
- package/src/games/snake-3d/Snake3DScene.ts +0 -322
- package/src/games/snakes-and-ladders/SnakesAndLadders.tsx +0 -87
- package/src/games/snakes-and-ladders/SnakesAndLaddersConstants.ts +0 -136
- package/src/games/snakes-and-ladders/SnakesAndLaddersGame.ts +0 -310
- package/src/games/snakes-and-ladders/SnakesAndLaddersScene.ts +0 -515
- package/src/games/space-fighter/SpaceFighter.tsx +0 -74
- package/src/games/space-fighter/SpaceFighterConstants.ts +0 -86
- package/src/games/space-fighter/SpaceFighterGame.ts +0 -292
- package/src/games/space-fighter/SpaceFighterScene.ts +0 -550
- package/src/games/spider-solitaire/SpiderSolitaire.tsx +0 -80
- package/src/games/spider-solitaire/SpiderSolitaireConstants.ts +0 -107
- package/src/games/spider-solitaire/SpiderSolitaireGame.ts +0 -387
- package/src/games/spider-solitaire/SpiderSolitaireRules.ts +0 -123
- package/src/games/spider-solitaire/SpiderSolitaireScene.ts +0 -352
- package/src/games/stack-tower/StackTower.tsx +0 -76
- package/src/games/stack-tower/StackTowerConstants.ts +0 -74
- package/src/games/stack-tower/StackTowerGame.ts +0 -236
- package/src/games/stack-tower/StackTowerScene.ts +0 -186
- package/src/games/sudoku/Sudoku.tsx +0 -73
- package/src/games/sudoku/SudokuConstants.ts +0 -127
- package/src/games/sudoku/SudokuGame.ts +0 -250
- package/src/games/sudoku/SudokuRules.ts +0 -125
- package/src/games/sudoku/SudokuScene.ts +0 -304
- package/src/games/tangram/Tangram.tsx +0 -79
- package/src/games/tangram/TangramConstants.ts +0 -64
- package/src/games/tangram/TangramGame.ts +0 -356
- package/src/games/tangram/TangramRules.ts +0 -409
- package/src/games/tangram/TangramScene.ts +0 -203
- package/src/games/tank-1990/Tank1990.tsx +0 -78
- package/src/games/tank-1990/Tank1990Constants.ts +0 -81
- package/src/games/tank-1990/Tank1990Game.ts +0 -331
- package/src/games/tank-1990/Tank1990Rules.ts +0 -390
- package/src/games/tank-1990/Tank1990Scene.ts +0 -434
- package/src/games/tic-tac-toe/TicTacToe.tsx +0 -98
- package/src/games/tic-tac-toe/TicTacToeConstants.ts +0 -69
- package/src/games/tic-tac-toe/TicTacToeGame.ts +0 -200
- package/src/games/tic-tac-toe/TicTacToeRules.ts +0 -103
- package/src/games/tic-tac-toe/TicTacToeScene.ts +0 -245
- package/src/games/tile-home/TileHome.tsx +0 -92
- package/src/games/tile-home/TileHomeConstants.ts +0 -139
- package/src/games/tile-home/TileHomeGame.ts +0 -435
- package/src/games/tile-home/TileHomeScene.ts +0 -154
- package/src/games/treasure-hunt/TreasureHunt.tsx +0 -206
- package/src/games/treasure-hunt/TreasureHuntConstants.ts +0 -266
- package/src/games/treasure-hunt/TreasureHuntControls.ts +0 -280
- package/src/games/treasure-hunt/TreasureHuntGame.ts +0 -402
- package/src/games/treasure-hunt/TreasureHuntMeshes.ts +0 -422
- package/src/games/treasure-hunt/TreasureHuntModel.ts +0 -506
- package/src/games/treasure-hunt/TreasureHuntRules.ts +0 -1210
- package/src/games/treasure-hunt/TreasureHuntScene.ts +0 -586
- package/src/games/whack-a-mole/WhackAMole.tsx +0 -79
- package/src/games/whack-a-mole/WhackAMoleConstants.ts +0 -94
- package/src/games/whack-a-mole/WhackAMoleGame.ts +0 -233
- package/src/games/whack-a-mole/WhackAMoleScene.ts +0 -349
- package/src/games/word-search/WordSearch.tsx +0 -18
- package/src/games/word-search/WordSearchWords.ts +0 -1642
- package/src/helpers/GamePatternData.ts +0 -120
- package/src/helpers/GameSettingsModal.tsx +0 -384
- package/src/helpers/GameTheme.tsx +0 -37
- package/src/helpers/IconPaths.ts +0 -6
- package/src/helpers/index.ts +0 -2
- package/src/index.tsx +0 -60
- package/src/services/GameAssetLoader.ts +0 -111
- package/src/services/GameAssets.ts +0 -149
- package/src/services/GameLoaders.ts +0 -93
- package/src/services/GamesConstants.ts +0 -193
- package/src/services/GamesMetadata.ts +0 -711
- package/src/services/GamesService.ts +0 -116
- package/src/services/HapticsService.ts +0 -48
- package/src/services/ScoringService.ts +0 -19
- package/src/services/SfxSources.ts +0 -81
- package/src/services/SoundsService.ts +0 -582
- package/src/services/ThemeService.ts +0 -281
- package/src/services/UtilsService.ts +0 -134
- package/src/services/index.ts +0 -6
|
@@ -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
|
|
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 _0x16ac72}from"../shared/EngineMeshes.js";import{placeTiltedBackdrop}from"../shared/EngineTilt.js";import{toColor}from"../shared/EngineUtils.js";import{cellCentre,COLORS,NUMBER_WORDS,PRESS_SCALE,SLIDE_TIME,TILE_COLORS,TILE_HEIGHT}from"./SlidingNumbersConstants.js";const meshes=new Map,cached=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("sliding-numbers/SlidingNumbersScene:"+e,o),meshes.set(e,t)),t},BOARD_DEPTH=12,BACKDROP_DEPTH=30,SURFACE=1,panelMesh=(e,o,t)=>cached("sn-panel:"+e+":"+o+":"+t,()=>_0x16ac72(extrude((new Path).addRoundedRect(-e/2,-e/2,e,e,o),{depth:t}),{shine:.25})),tileTop=e=>1+e.tile*TILE_HEIGHT,at=(e,o,t)=>{const[s,n]=cellCentre(e,o,t);return[s,n,1]};function spawnBoard(e,o,t){const s=[],n=o=>s.push(e.spawn({pickable:!1,...o})),i=o.size+2*o.pad,a="classic"===t.mode;n({mesh:panelMesh(i,a?16:8,12),position:[0,0,-6],color:toColor(a?COLORS.FRAME:t.BOARD.SURFACE)}),a&&n({mesh:panelMesh(o.size+8,10,1),position:[0,0,.2],color:toColor(COLORS.WELL)});for(let e=0;e<3;e++)for(let s=0;s<3;s++){const[i,r]=cellCentre(o,e,s);n({mesh:panelMesh(o.tile,Math.min(10,.12*o.tile),1),position:[i,r,.5],color:toColor(a?COLORS.SLOT:t.BOARD.CELL_EMPTY)})}return s}function spawnLabel(e,o,t,s){const n=toColor(COLORS.NUMBER),[i,a,r]=toColor(TILE_COLORS[s-1]),l=[.45*i,.45*a,.45*r,1],p=tileTop(o)-1,d=(o,s,i,a)=>{const r=Math.max(1,.05*a);e.spawn({mesh:flatGlyphMesh(o),parent:t,position:[s+r,i-r,p+.3],scale:a,color:l,pickable:!1}),e.spawn({mesh:flatGlyphMesh(o),parent:t,position:[s,i,p+.6],scale:a,color:n,pickable:!1})};d(String(s),0,.07*o.tile,.32*o.tile);const h=NUMBER_WORDS[s],m=.11*o.tile,f=m*GLYPH_ADVANCE;[...h].forEach((e,t)=>d(e,(t-(h.length-1)/2)*f,.24*-o.tile,m))}export function buildScene(e,o,t,s){const n=spawnBackdrop(e,o.width,o.height,-30,t);placeTiltedBackdrop(e,n,o,30);const i={backdrop:n,board:spawnBoard(e,o,t),tiles:new Map},a=o.tile*TILE_HEIGHT;for(const t of s){if(0===t.value)continue;const s=e.spawn({mesh:"none",position:at(o,t.row,t.col),pickable:!1}),n=spawnRaisedBlock(e,{parent:s,position:[0,0,a/2],size:[o.tile,o.tile,a],color:toColor(TILE_COLORS[t.value-1]),gloss:!1,shadow:!1});spawnLabel(e,o,s,t.value),i.tiles.set(t.id,{root:s,block:n})}return i}export function removeScene(e,o){for(const t of[o.backdrop,...o.board,...Array.from(o.tiles.values(),e=>e.root)])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,s)}export function placeTile(e,o,t,s,n=!0){const i=t.tiles.get(s.id);i&&(n?e.animate(i.root,{position:at(o,s.row,s.col)},{duration:SLIDE_TIME,easing:"easeOut"}):(e.stopAnimation(i.root),e.set(i.root,{position:at(o,s.row,s.col)})))}export function press(e,o,t,s){const n=o.tiles.get(t);if(!n)return;const i=s?PRESS_SCALE:1;e.animate(n.root,{scale:i},{duration:s?.08:.14,easing:s?"easeOut":"back"})}export function shake(e,o,t,s){const n=t.tiles.get(s);n&&e.animate(n.root,{shake:.05*o.tile},{duration:.25})}export function celebrate(e,o,t,s){for(const n of s){const s=t.tiles.get(n.id);if(!s)continue;const[i,a,r]=at(o,n.row,n.col);e.animate(s.root,[{position:[i,a,r+.35*o.tile],scale:1.04,at:.4},{position:[i,a,r],scale:1}],{duration:.45,delay:SLIDE_TIME+.07*(n.row+n.col),easing:"easeOut"})}effects.confetti(e,{position:[0,0,o.tile],count:60,size:.08*o.tile,speed:1.4*o.size,lifetime:1.3,gravity:2.4*-o.size,colors:TILE_COLORS.slice(0,4).map(e=>toColor(e))})}export function dim(e,o,t){for(const s of t){const t=o.tiles.get(s.id);if(!t)continue;const n=toColor(TILE_COLORS[s.value-1]);e.animate(t.block,{color:[.5*n[0],.5*n[1],.55*n[2],1]},{duration:.4})}}export function undim(e,o,t){for(const s of t){const t=o.tiles.get(s.id);t&&e.set(t.block,{color:toColor(TILE_COLORS[s.value-1])})}}
|
|
@@ -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"./Snake3DConstants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,start,tick}from"./Snake3DGame.js";import{jsx as
|
|
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"./Snake3DConstants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,start,tick}from"./Snake3DGame.js";import{jsx as _0x41784b}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.SNAKE_3D,FEEDBACK={eat:{sound:SOUNDS.EAT,haptic:HapticType.MEDIUM},special:{sound:SOUNDS.SPECIAL,haptic:HapticType.HEAVY},crash:{sound:SOUNDS.COLLISION,haptic:HapticType.HEAVY}},scoreText=e=>""+e;export const Snake3D=engineGame(GAME_IDS.SNAKE_3D,e=>{const[t,s]=useLiveState(0),[r,o]=useLiveState(TIME_LIMIT),{theme:a,screen:i,gameOver:n}=useEngineGame(e,{gameId:GAME_IDS.SNAKE_3D,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+o.cell},drag:drag,outcome:()=>"lose",sounds:SOUNDS,onStart:e=>e(SOUNDS.START),onStop:e=>e(null,HapticType.LIGHT),onOver:(e,t,s)=>e(s.timeLeft<=0?SOUNDS.TIME_UP:SOUNDS.GAME_OVER,HapticType.ERROR),wire:(e,t)=>{e.onScore=s,e.onTime=o,e.onEvent=e=>t(FEEDBACK[e].sound,FEEDBACK[e].haptic)}});return _0x41784b(EngineGameScreen,{...i,light:LIGHT,columns:[scoreColumn(t),timerColumn(r,a,0)],subtext:"Swipe to steer!",gameOver:n({title:"GAME OVER",message:"You hit the wall or yourself!",scoreLabel:"Final Score",score:t,formatter:scoreText,buttonText:"Play Again!"})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{effects,extrude,merge,Path,quat,shapeGeometry}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{getFruits}from"../shared/EngineFruits.js";import{cacheGameAsset,createGameMesh as
|
|
1
|
+
"use strict";import{effects,extrude,merge,Path,quat,shapeGeometry}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{getFruits}from"../shared/EngineFruits.js";import{cacheGameAsset,createGameMesh as _0x351093}from"../shared/EngineMeshes.js";import{placeTiltedBackdrop}from"../shared/EngineTilt.js";import{toColor}from"../shared/EngineUtils.js";import{COLORS,gridPoint}from"./Snake3DConstants.js";import{sampleSnakeMotion}from"./Snake3DMotion.js";import{GRID}from"./Snake3DRules.js";const meshes=new Map,cached=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("snake-3d/Snake3DScene:"+e,o),meshes.set(e,t)),t},BOARD_DEPTH=10,BACKDROP_DEPTH=30,STAND_UP=quat.x(Math.PI/2),headTurn=[0,0,0,1],HEADING={RIGHT:0,UP:Math.PI/2,LEFT:Math.PI,DOWN:-Math.PI/2},panelMesh=(e,o)=>cached("s3-panel:"+e+":"+o,()=>_0x351093(extrude((new Path).addRoundedRect(-e/2,-e/2,e,e,o),{depth:10}),{shine:.2})),checkerMesh=()=>cached("s3-checker",()=>{const e=[];for(let o=0;o<GRID;o++)for(let t=0;t<GRID;t++)(t+o)%2&&e.push({geometry:shapeGeometry("cube"),position:[t+.5-GRID/2,GRID/2-o-.5,0],scale:[1,1,.02]});return _0x351093(merge(e),{center:!1})}),rimMesh=(e,o,t,s)=>cached("s3-rim:"+e.toFixed(1)+":"+o.toFixed(1)+":"+t+":"+s.toFixed(1),()=>{const a=e+2*o;return _0x351093(extrude((new Path).addRoundedRect(-a/2,-a/2,a,a,t).addRect(-e/2,-e/2,e,e),{depth:s,fillRule:"evenodd"}),{shine:.2})}),starMesh=()=>cached("s3-star",()=>_0x351093(extrude((new Path).addStar(0,0,.5,.22),{depth:.28}),{shine:.7})),lerp=(e,o,t)=>e+(o-e)*t,mix=(e,o,t)=>[lerp(e[0],o[0],t),lerp(e[1],o[1],t),lerp(e[2],o[2],t),1],beadSize=e=>e<.6?lerp(.8,.72,e/.6):lerp(.72,.3,((e-.6)/.4)**1.3),beadColor=(e,o)=>{const t=e<.5?mix(toColor(COLORS.HEAD),toColor(COLORS.BODY),2*e):mix(toColor(COLORS.BODY),toColor(COLORS.TAIL),2*e-1),s=o%3==0?.68:1;return[t[0]*s,t[1]*s,t[2]*s,1]},FLAT=.72,HEAD_SCALE=e=>[1.25*e,.95*e,.62*e];function spawnBoard(e,o,t){const s=[],a=o=>s.push(e.spawn({pickable:!1,...o})),n="classic"===t.mode,r=.5*o.cell;a({mesh:panelMesh(o.size+2*r,n?12:8),position:[0,0,-5],color:toColor(n?COLORS.CLASSIC_BOARD:t.BOARD.SURFACE)}),a({mesh:checkerMesh(),position:[0,0,.05],scale:o.cell,color:toColor(n?COLORS.CLASSIC_DARK:t.BOARD.CELL_EMPTY)});const l=.55*o.cell,i=toColor(n?COLORS.CLASSIC_RIM:t.BOARD.BORDER);return a({mesh:rimMesh(o.size,r,n?12:8,l),position:[0,0,l/2],color:i}),s}export function buildScene(e,o,t){const s=spawnBackdrop(e,o.width,o.height,-30,t);placeTiltedBackdrop(e,s,o,30);const a=.9*o.cell,n=e.spawn({mesh:"sphere",scale:HEAD_SCALE(a),color:toColor(COLORS.HEAD),pickable:!1});for(const o of[-1,1])e.spawn({mesh:"sphere",parent:n,position:[.12,.3*o,.26],scale:[.24,.2,.22],color:toColor(COLORS.EYE),pickable:!1}),e.spawn({mesh:"sphere",parent:n,position:[.2,.33*o,.33],scale:[.05,.13,.1],color:toColor(COLORS.PUPIL),pickable:!1}),e.spawn({mesh:"sphere",parent:n,position:[.47,.09*o,.22],scale:[.05,.04,.03],color:[.05,.05,.05,1],pickable:!1});const r=e.spawn({mesh:"none",parent:n,position:[.5,0,-.05],scale:[0,1,1],pickable:!1}),l=toColor(COLORS.TONGUE);e.spawn({mesh:"cube",parent:r,position:[.18,0,0],scale:[.36,.05,.03],color:l,pickable:!1});for(const o of[-1,1])e.spawn({mesh:"cube",parent:r,position:[.42,.05*o,0],rotation:quat.z(.5*o),scale:[.16,.04,.03],color:l,pickable:!1});return{backdrop:s,board:spawnBoard(e,o,t),head:n,tongue:r,beads:[],joints:[],food:null,foodId:-1}}export function removeScene(e,o){for(const t of[o.backdrop,...o.board,o.head,...o.beads,...o.joints,o.food])null!=t&&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,s)}export function drawSnake(e,o,t,s,a,n){const r=e.transforms,l=a.length/2;for(;t.beads.length<l-1;)t.beads.push(e.spawn({mesh:"sphere",pickable:!1}));for(;t.joints.length<l-1;)t.joints.push(e.spawn({mesh:"sphere",pickable:!1}));for(let e=l-1;e<t.beads.length;e++)r.scale(t.beads[e],0);for(let e=l-1;e<t.joints.length;e++)r.scale(t.joints[e],0);let i=0,p=0,d=0;for(let e=0;e<l;e++){const[h,m,u,f]=sampleSnakeMotion(s,a,e,n),[C,S]=gridPoint(o,h+.5,m+.5),O=l>1?e/(l-1):0,b=(0===e?.45:beadSize(O)/2)*o.cell;if(0===e){if(r.position(t.head,C,S,.75*b),u||f){const e=quat.z(Math.atan2(-f,u),headTurn);r.rotation(t.head,e[0],e[1],e[2],e[3])}}else{const o=t.beads[e-1],s=beadColor(O,e);r.position(o,C,S,.72*b),r.scale(o,2*b,2*b,2*b*.72),r.color(o,s[0],s[1],s[2],s[3]??1);const a=(b+d)/2,n=t.joints[e-1],l=beadColor(O,e+1);r.position(n,(C+i)/2,(S+p)/2,.72*a*.95),r.scale(n,2*a,2*a,2*a*.72*.95),r.color(n,l[0],l[1],l[2],l[3]??1)}i=C,p=S,d=b}r.flush()}export function faceHead(e,o,t){e.set(o.head,{rotation:quat.z(HEADING[t])})}export function flick(e,o){e.animate(o.tongue,[{scale:[1,1,1],at:.35},{scale:[.85,1,1],at:.6},{scale:[0,1,1]}],{duration:.32})}export function resetSnake(e,o,t){const s=.9*o.cell;e.stopAnimation(t.head),e.set(t.head,{scale:HEAD_SCALE(s),color:toColor(COLORS.HEAD),rotation:quat.z(0)})}export function gulp(e,o,t,s){const a=.9*o.cell,[n,r,l]=HEAD_SCALE(a);e.animate(t.head,[{scale:[1.2*n,1.25*r,1.2*l],at:.3},{scale:HEAD_SCALE(a)}],{duration:.3});const[i,p]=gridPoint(o,s.x+.5,s.y+.5),d=[i,p,.5*o.cell];s.isSpecial?effects.sparkle(e,{position:d,count:26,size:.14*o.cell,speed:5*o.cell,lifetime:.6,gravity:6*-o.cell,colors:[toColor("#FFD54F"),toColor(COLORS.SPECIAL),[1,1,1,1]]}):effects.splash(e,{position:d,count:14,size:.14*o.cell,speed:5*o.cell,lifetime:.5,gravity:10*-o.cell,colors:[toColor("#E53935"),toColor("#FFCDD2")]})}export function crash(e,o,t,s){const a=toColor(COLORS.CRASH);e.animate(t.head,{color:a},{duration:.2});for(const o of[...t.beads,...t.joints])e.animate(o,{color:a},{duration:.35});e.animate(t.head,{shake:.25*o.cell},{duration:.4}),s.shake=.35*o.cell}export function placeFood(e,o,t,s){if(s&&s.id===t.foodId)return;if(null!=t.food&&e.despawn(t.food),t.food=null,t.foodId=s?s.id:-1,!s)return;const[a,n]=gridPoint(o,s.x+.5,s.y+.5),r=.8*o.cell,l=e.spawn({mesh:"none",position:[a,n,r/2],bob:{amplitude:[0,0,.12*o.cell],speed:4},spin:s.isSpecial?[0,0,2.5]:[0,0,0],pickable:!1});if(s.isSpecial)e.spawn({mesh:starMesh(),parent:l,rotation:STAND_UP,scale:1.15*r,color:toColor(COLORS.SPECIAL),pickable:!1}),e.spawn({mesh:"sphere",parent:l,scale:.55*r,color:[2,1.6,.5,.35],pickable:!1});else{const o=getFruits().apple,t=o.center;e.spawn({mesh:o.whole,parent:l,rotation:STAND_UP,position:[-t[0]*r,t[2]*r,-t[1]*r],scale:r,pickable:!1})}e.set(l,{scale:.01}),e.animate(l,{scale:1},{duration:.25,easing:"back"}),t.food=l}
|
|
@@ -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{AI_COLOR,getLayout,LIGHT,PLAYER_COLOR,RIM}from"./SnakesAndLaddersConstants.js";import{createGame,dispose,reset,setLayout,setTheme,start,tap,tick}from"./SnakesAndLaddersGame.js";import{jsx as
|
|
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{AI_COLOR,getLayout,LIGHT,PLAYER_COLOR,RIM}from"./SnakesAndLaddersConstants.js";import{createGame,dispose,reset,setLayout,setTheme,start,tap,tick}from"./SnakesAndLaddersGame.js";import{jsx as _0x241274}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.SNAKES_AND_LADDERS,FEEDBACK={tap:{sound:"TAP",haptic:HapticType.MEDIUM},roll:{sound:"ROLL"},six:{sound:"SIX",haptic:HapticType.SUCCESS},penalty:{sound:"PENALTY",haptic:HapticType.ERROR},cantMove:{sound:"CANT_MOVE",haptic:HapticType.WARNING,youOnly:!0},move:{sound:"MOVE",haptic:HapticType.LIGHT},snake:{sound:"SNAKE",haptic:HapticType.ERROR},ladder:{sound:"LADDER",haptic:HapticType.SUCCESS}};export const SnakesAndLadders=engineGame(GAME_IDS.SNAKES_AND_LADDERS,e=>{const[t,s]=useLiveState([0,0]),[n,a]=useLiveState(0),[i,o]=useLiveState(0),{status:r,screen:S,gameOver:p}=useEngineGame(e,{gameId:GAME_IDS.SNAKES_AND_LADDERS,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,s,n)=>{const a=getLayout(t,s,n);return setLayout(e,a),a.size*(1+2*RIM)},tap:tap,sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.MEDIUM),onOver:(e,t)=>e("win"===t?SOUNDS.WIN:SOUNDS.GAME_OVER,"win"===t?HapticType.SUCCESS:HapticType.HEAVY),wire:(e,t)=>{e.onPositions=(e,t)=>s([e,t]),e.onScore=o,e.onTurn=a,e.onEvent=(e,s)=>{const n=FEEDBACK[e];n.youOnly&&0!==s||t(n.sound?SOUNDS[n.sound]:null,n.haptic)}}});return _0x241274(EngineGameScreen,{...S,light:LIGHT,columns:[textColumn("YOU",String(t[0]),PLAYER_COLOR),textColumn(0===n?"YOUR TURN":"AI TURN",i.toLocaleString()),textColumn("AI",String(t[1]),AI_COLOR)],subtext:"Race to 100!",gameOver:p({title:"win"===r?"YOU WON!":"YOU LOST!",message:"win"===r?"You reached 100 first!":"AI reached 100 first!",scoreLabel:"win"===r?"You Won!":"You Lost",score:i,buttonText:"win"===r?"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{dieMesh,dieRotation as _0xe82750,rollDie as _0x18b3f7}from"../shared/EngineDice.js";import{flatGlyphMesh,GLYPH_ADVANCE,GLYPH_WIDTH}from"../shared/EngineGlyphs.js";import{noise}from"../shared/EngineMeadow.js";import{cacheGameAsset,createGameMesh as _0x2ac545}from"../shared/EngineMeshes.js";import{aimTilted,placeTiltedBackdrop}from"../shared/EngineTilt.js";import{toColor}from"../shared/EngineUtils.js";import{AI_COLOR,BOARD_SIZE,CELL_PALETTE,cellCenter,DIE_SIZE,DIE_Y,FINISH_CELL,LADDER_AT,LADDERS,NUMBER_COLOR,PLAYER_COLOR,RIM,SNAKE_AT,SNAKES,STAR_NUMBER_COLOR,START_CELL,START_X,START_Z,TILE_TOP,TILT,TOKEN_HEIGHT,WINNING_POSITION}from"./SnakesAndLaddersConstants.js";const meshes=new Map,cached=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("snakes-and-ladders/SnakesAndLaddersScene:"+e,o),meshes.set(e,t)),t},rgb=e=>{const[o,t,s]=toColor(e);return[o,t,s]},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],shade=(e,o)=>[e[0]*o,e[1]*o,e[2]*o],smooth=(e,o,t)=>{const s=Math.min(1,Math.max(0,(t-e)/(o-e)));return s*s*(3-2*s)},sphere=()=>shapeGeometry("sphere"),cube=()=>shapeGeometry("cube"),STAND_UP=quat.x(Math.PI/2),along=(e,o,t)=>[e[0]+(o[0]-e[0])*t,e[1]+(o[1]-e[1])*t],SNAKE_POINTS=30,snakeRadius=e=>.0135*(.8+.2*smooth(0,.15,e))*(1-.85*smooth(.5,1,e));export function snakePath(e,o=!1){const t=cellCenter(e.head),s=cellCenter(e.tail),n=s[0]-t[0],r=s[1]-t[1],a=Math.hypot(n,r),i=[-r/a,n/a],l=Math.max(2,Math.round(a/.15)),h=Math.min(.042,.14*a);return Array.from({length:30},(e,n)=>{const r=n/29,[a,d]=along(t,s,r),p=h*Math.sin(Math.PI*l*r)*(1-.6*r);return[a+i[0]*p,d+i[1]*p,o?.8*snakeRadius(r):TILE_TOP]})}function snakeParts(e){const o=snakePath(e,!0),t=rgb(e.color),s=rgb(e.accent),n=rgb(e.belly),r=Math.hypot(o[0][0]-o[29][0],o[0][1]-o[29][1]),a=Math.max(6,Math.round(55*r)),i=tube(o,{radius:snakeRadius,sides:12,smoothness:4,color:({v:e,normal:o,position:r})=>{const i=.5+.5*Math.cos(2*Math.PI*a*e);let l=mix(t,s,smooth(.62,.86,i));return o[2]>.55&&i<.22&&(l=mix(l,n,.55)),o[2]<-.2&&(l=n),shade(l,.9+.2*noise(160*r[0],160*r[1]))}}),[l,h]=cellCenter(e.head),d=o[2],p=[l-d[0],h-d[1]],m=Math.hypot(p[0],p[1])||1;p[0]/=m,p[1]/=m;const I=[-p[1],p[0]],_=Math.atan2(p[1],p[0]),u=quat.z(_),T=(e,o,t)=>[l+p[0]*e+I[0]*o,h+p[1]*e+I[1]*o,t],E=mix(t,s,.25),A=[{geometry:i},{geometry:sphere(),position:T(.006,0,.011),scale:[.05,.038,.022],rotation:u,color:[...E,1]},{geometry:sphere(),position:T(.022,0,.009),scale:[.03,.027,.017],rotation:u,color:[...E,1]}];for(const e of[1,-1])A.push({geometry:sphere(),position:T(.008,.012*e,.019),scale:.012,color:[1,1,.92,1]},{geometry:sphere(),position:T(.01,.0125*e,.0245),scale:[.004,.008,.004],rotation:u,color:[.05,.05,.05,1]},{geometry:sphere(),position:T(.012,.011*e,.026),scale:.0022,color:[1,1,1,1]},{geometry:sphere(),position:T(.033,.0055*e,.016),scale:.0032,color:[.08,.06,.05,1]});const g=[.85,.08,.12];A.push({geometry:tube([T(.034,0,.007),T(.05,0,.007)],{radius:.0017,sides:6,color:g})});for(const e of[1,-1])A.push({geometry:tube([T(.049,0,.007),T(.058,.0055*e,.007)],{radius:.0014,sides:6,color:g})});return A}const RAIL_GAP=.019,RAIL_Z=.005;function ladderParts(e){const o=cellCenter(e.bottom),t=cellCenter(e.top),s=Math.hypot(t[0]-o[0],t[1]-o[1]),n=[(t[0]-o[0])/s,(t[1]-o[1])/s],r=[-n[1],n[0]],a=rgb(e.color),i=rgb(e.highlight),l=({v:e,normal:o})=>{const t=.5+.5*Math.sin(e*s*260+5*noise(e*s*40,3));return shade(mix(a,i,.45*t+.3*Math.max(0,o[2])),1)},h=.014,d=[1,-1].map(e=>({geometry:tube([[o[0]-n[0]*h+.019*r[0]*e,o[1]-n[1]*h+.019*r[1]*e,.005],[t[0]+n[0]*h+.019*r[0]*e,t[1]+n[1]*h+.019*r[1]*e,.005]],{radius:.0045,sides:8,smoothness:Math.max(8,Math.round(90*s)),color:l})})),p=Math.max(3,Math.floor(s/.045));for(let e=1;e<=p;e++){const[s,n]=along(o,t,e/(p+1));d.push({geometry:tube([[s-.019*r[0],n-.019*r[1],.005+8e-4],[s+.019*r[0],n+.019*r[1],.005+8e-4]],{radius:.0032,sides:8,color:mix(a,i,.6)})})}return d}export function ladderPath(e){const[o,t]=cellCenter(e.bottom),[s,n]=cellCenter(e.top);return[[o,t,TILE_TOP],[s,n,TILE_TOP]]}const CELL=1/BOARD_SIZE;function cellColor(e){const o=e-1;let t=rgb(CELL_PALETTE[(Math.floor(o/BOARD_SIZE)+o%BOARD_SIZE)%CELL_PALETTE.length]);return 1===e?t=rgb(START_CELL):e===WINNING_POSITION&&(t=rgb(FINISH_CELL)),t}const FLAT=.05,SKIN=4e-4,DIGITS_Z=TILE_TOP+.002,ART_Z=TILE_TOP+.004;export const SHADOW_Z=TILE_TOP+.008;const PAWN_LIFT=SHADOW_Z+.001-TILE_TOP,pawnAt=(e,o)=>toWorld(e,o[0],o[1],o[2]+PAWN_LIFT),boardMesh=()=>cached("snl-board",()=>{const e=1+2*RIM,o=rgb("#5C4033"),t=(e,o)=>({position:[0,0,e],scale:o}),s=[{geometry:cube(),...t(TILE_TOP-.006,[e,e,SKIN]),color:[...o,1]},{geometry:cube(),...t(TILE_TOP-.003,[1,1,SKIN]),color:[...rgb("#CBB894"),1]}];for(let e=1;e<=WINNING_POSITION;e++){const[o,t]=cellCenter(e);s.push({geometry:cube(),position:[o,t,TILE_TOP-2e-4],scale:[CELL-.005,CELL-.005,SKIN],color:[...cellColor(e),1]})}const[n,r]=cellCenter(WINNING_POSITION);s.push({geometry:extrude((new Path).addStar(0,0,.5,.22),{depth:.12}),position:[n,r-.012,DIGITS_Z],scale:[.042,.042,.004],color:[...rgb("#FFC107"),1]}),s.push({geometry:extrude((new Path).addCircle(0,0,.08),{depth:SKIN,color:rgb("#A1887F")}),position:[START_X,DIE_Y,START_Z]});const a=merge([...LADDERS.flatMap(ladderParts),...SNAKES.flatMap(snakeParts)]);return s.push({geometry:a,position:[0,0,ART_Z],scale:[1,1,.05]}),_0x2ac545(merge(s),{center:!1,shine:0})}),DIGIT_SCALE=.027;function spawnNumbers(e,o){const t=toColor(NUMBER_COLOR),s=toColor(STAR_NUMBER_COLOR);for(let n=1;n<=WINNING_POSITION;n++){const[r,a]=cellCenter(n),i=String(n),l=i.length*GLYPH_ADVANCE-(GLYPH_ADVANCE-GLYPH_WIDTH);for(let h=0;h<i.length;h++)e.spawn({mesh:flatGlyphMesh(i[h]),parent:o,position:[r+.027*(-l/2+GLYPH_WIDTH/2+h*GLYPH_ADVANCE),a+.24*CELL,DIGITS_Z],scale:.027,color:1===n||n===WINNING_POSITION?s:t,pickable:!1})}}const pawnMesh=()=>cached("snl-pawn",()=>_0x2ac545(merge([{geometry:lathe([[.001,0],[.42,0],[.44,.04],[.42,.1],[.31,.14],[.25,.2],[.19,.42],[.15,.58],[.27,.61],[.27,.66],[.14,.69]],{segments:32})},{geometry:sphere(),position:[0,.84,0],scale:.4}]),{center:!1,shine:.65}));export const dieRotation=(e,o=0)=>_0xe82750(TILT,e,o);const discMesh=()=>cached("snl-disc",()=>_0x2ac545(extrude((new Path).addCircle(0,0,.5),{depth:0}))),ringMesh=()=>cached("snl-ring",()=>_0x2ac545(extrude((new Path).addCircle(0,0,.5).addCircle(0,0,.42),{depth:0,fillRule:"evenodd"}))),SHADOW=[0,0,0,.22],BACKDROP_DEPTH=25;export const toWorld=(e,o,t,s)=>[o*e.size,t*e.size,s*e.size];const tiltView=e=>({width:e.width,height:e.height,centerY:e.centerY,tilt:TILT});export const aimCamera=(e,o)=>aimTilted(e,tiltView(o));export function buildScene(e,o,t){const s=spawnBackdrop(e,o.width,o.height,-25,t);placeTiltedBackdrop(e,s,tiltView(o),25);const n=e.spawn({mesh:boardMesh(),scale:o.size,color:[1,1,1,1],pickable:!1});spawnNumbers(e,n);const r=t=>e.spawn({mesh:pawnMesh(),rotation:STAND_UP,scale:TOKEN_HEIGHT*o.size,color:toColor(t),pickable:!1}),a=()=>e.spawn({mesh:discMesh(),scale:.052*o.size,color:SHADOW,pickable:!1}),i=e.spawn({mesh:discMesh(),position:toWorld(o,.012,DIE_Y-.01,.001),scale:[1.25*DIE_SIZE*o.size,1.1*DIE_SIZE*o.size,1],color:SHADOW,pickable:!1}),l=e.spawn({mesh:ringMesh(),position:toWorld(o,0,DIE_Y,.002),scale:0,color:[1,.78,.15,.85],pickable:!1}),h=e.spawn({mesh:dieMesh(),position:dieRest(o),rotation:dieRotation(1),scale:DIE_SIZE*o.size,pickable:!1});return{backdrop:s,board:n,tokens:[r(PLAYER_COLOR),r(AI_COLOR)],shadows:[a(),a()],die:h,dieShadow:i,ring:l}}export function removeScene(e,o){for(const t of[o.backdrop,o.board,...o.tokens,...o.shadows,o.die,o.dieShadow,o.ring])e.despawn(t)}export function setSceneTheme(e,o,t){setBackdropTheme(e,o.backdrop,t)}export const dieRest=e=>toWorld(e,0,DIE_Y,DIE_SIZE/2);export function rollDie(e,o,t,s,n,r){_0x18b3f7(e,{die:t.die,shadow:t.dieShadow,rest:dieRest(o),shadowAt:toWorld(o,.012,DIE_Y-.01,.001),shadowScale:[1.25*DIE_SIZE*o.size,1.1*DIE_SIZE*o.size,1],size:DIE_SIZE*o.size,tilt:TILT,value:s,duration:n,disposed:r})}export function showRollHint(e,o,t,s){if(e.stopAnimation(t.ring),!s)return void e.set(t.ring,{scale:0});const n=1.55*DIE_SIZE*o.size;e.set(t.ring,{scale:n}),e.animate(t.ring,{scale:1.15*n},{duration:.6,easing:"easeInOut",repeat:"forever",yoyo:!0})}export function placeToken(e,o,t,s,n){e.stopAnimation(t.tokens[s]),e.stopAnimation(t.shadows[s]),e.set(t.tokens[s],{position:pawnAt(o,n)}),e.set(t.shadows[s],{position:toWorld(o,n[0]+.006,n[1]-.006,SHADOW_Z)})}export function moveToken(e,o,t,s,n,r,a=0){const i=t.tokens[s],l=t.shadows[s],h=n[n.length-1],d=a?[{position:pawnAt(o,[(n[0][0]+h[0])/2,(n[0][1]+h[1])/2,Math.max(n[0][2],h[2])+a]),at:.5},{position:pawnAt(o,h),at:1}]:n.slice(1).map((e,t)=>({position:pawnAt(o,e),at:(t+1)/(n.length-1)}));e.stopAnimation(i),e.stopAnimation(l),e.animate(i,d,{duration:r,path:"smooth",easing:a?"linear":"easeInOut"}),e.animate(l,{position:toWorld(o,h[0]+.006,h[1]-.006,SHADOW_Z)},{duration:r,easing:a?"linear":"easeInOut"})}export function bobToken(e,o,t,s){t.tokens.forEach((t,n)=>e.set(t,{bob:n===s?{amplitude:[0,0,.008*o.size],speed:6}:null}))}export function snakeBite(e,o,t,s,n){e.animate(t.tokens[n],{shake:.01*o.size},{duration:.3}),s.shake=.008*o.size}export function sparkle(e,o,t){effects.sparkle(e,{position:toWorld(o,t[0],t[1],t[2]+.03),count:16,size:.009*o.size,speed:.25*o.size,lifetime:.6,colors:[toColor("#FFD54F"),toColor("#FFF59D"),toColor("#FFFFFF")]})}export function confetti(e,o,t){effects.confetti(e,{position:toWorld(o,t[0],t[1],t[2]+.06),count:48,size:.012*o.size,speed:.7*o.size,lifetime:1.3,gravity:-1.2*o.size,colors:["#FF5252","#FFD740","#69F0AE","#448AFF"].map(e=>toColor(e))})}const slidePaths=new Map;export function slidePath(e){if(slidePaths.has(e))return slidePaths.get(e);const o=SNAKE_AT.get(e),t=LADDER_AT.get(e),s=o?snakePath(o).filter((e,o)=>o%3==0||29===o):t?ladderPath(t):null;return(o||t)&&slidePaths.set(e,s),s}
|
|
1
|
+
"use strict";import{effects,extrude,lathe,merge,Path,quat,shapeGeometry,tube}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{dieMesh,dieRotation as _0x592c44,rollDie as _0x46e808}from"../shared/EngineDice.js";import{flatGlyphMesh,GLYPH_ADVANCE,GLYPH_WIDTH}from"../shared/EngineGlyphs.js";import{noise}from"../shared/EngineMeadow.js";import{cacheGameAsset,createGameMesh as _0x5cb824}from"../shared/EngineMeshes.js";import{aimTilted,placeTiltedBackdrop}from"../shared/EngineTilt.js";import{toColor}from"../shared/EngineUtils.js";import{AI_COLOR,BOARD_SIZE,CELL_PALETTE,cellCenter,DIE_SIZE,DIE_Y,FINISH_CELL,LADDER_AT,LADDERS,NUMBER_COLOR,PLAYER_COLOR,RIM,SNAKE_AT,SNAKES,STAR_NUMBER_COLOR,START_CELL,START_X,START_Z,TILE_TOP,TILT,TOKEN_HEIGHT,WINNING_POSITION}from"./SnakesAndLaddersConstants.js";const meshes=new Map,cached=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("snakes-and-ladders/SnakesAndLaddersScene:"+e,o),meshes.set(e,t)),t},rgb=e=>{const[o,t,s]=toColor(e);return[o,t,s]},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],shade=(e,o)=>[e[0]*o,e[1]*o,e[2]*o],smooth=(e,o,t)=>{const s=Math.min(1,Math.max(0,(t-e)/(o-e)));return s*s*(3-2*s)},sphere=()=>shapeGeometry("sphere"),cube=()=>shapeGeometry("cube"),STAND_UP=quat.x(Math.PI/2),along=(e,o,t)=>[e[0]+(o[0]-e[0])*t,e[1]+(o[1]-e[1])*t],SNAKE_POINTS=30,snakeRadius=e=>.0135*(.8+.2*smooth(0,.15,e))*(1-.85*smooth(.5,1,e));export function snakePath(e,o=!1){const t=cellCenter(e.head),s=cellCenter(e.tail),n=s[0]-t[0],r=s[1]-t[1],a=Math.hypot(n,r),i=[-r/a,n/a],l=Math.max(2,Math.round(a/.15)),h=Math.min(.042,.14*a);return Array.from({length:30},(e,n)=>{const r=n/29,[a,d]=along(t,s,r),p=h*Math.sin(Math.PI*l*r)*(1-.6*r);return[a+i[0]*p,d+i[1]*p,o?.8*snakeRadius(r):TILE_TOP]})}function snakeParts(e){const o=snakePath(e,!0),t=rgb(e.color),s=rgb(e.accent),n=rgb(e.belly),r=Math.hypot(o[0][0]-o[29][0],o[0][1]-o[29][1]),a=Math.max(6,Math.round(55*r)),i=tube(o,{radius:snakeRadius,sides:12,smoothness:4,color:({v:e,normal:o,position:r})=>{const i=.5+.5*Math.cos(2*Math.PI*a*e);let l=mix(t,s,smooth(.62,.86,i));return o[2]>.55&&i<.22&&(l=mix(l,n,.55)),o[2]<-.2&&(l=n),shade(l,.9+.2*noise(160*r[0],160*r[1]))}}),[l,h]=cellCenter(e.head),d=o[2],p=[l-d[0],h-d[1]],m=Math.hypot(p[0],p[1])||1;p[0]/=m,p[1]/=m;const I=[-p[1],p[0]],_=Math.atan2(p[1],p[0]),u=quat.z(_),T=(e,o,t)=>[l+p[0]*e+I[0]*o,h+p[1]*e+I[1]*o,t],E=mix(t,s,.25),A=[{geometry:i},{geometry:sphere(),position:T(.006,0,.011),scale:[.05,.038,.022],rotation:u,color:[...E,1]},{geometry:sphere(),position:T(.022,0,.009),scale:[.03,.027,.017],rotation:u,color:[...E,1]}];for(const e of[1,-1])A.push({geometry:sphere(),position:T(.008,.012*e,.019),scale:.012,color:[1,1,.92,1]},{geometry:sphere(),position:T(.01,.0125*e,.0245),scale:[.004,.008,.004],rotation:u,color:[.05,.05,.05,1]},{geometry:sphere(),position:T(.012,.011*e,.026),scale:.0022,color:[1,1,1,1]},{geometry:sphere(),position:T(.033,.0055*e,.016),scale:.0032,color:[.08,.06,.05,1]});const g=[.85,.08,.12];A.push({geometry:tube([T(.034,0,.007),T(.05,0,.007)],{radius:.0017,sides:6,color:g})});for(const e of[1,-1])A.push({geometry:tube([T(.049,0,.007),T(.058,.0055*e,.007)],{radius:.0014,sides:6,color:g})});return A}const RAIL_GAP=.019,RAIL_Z=.005;function ladderParts(e){const o=cellCenter(e.bottom),t=cellCenter(e.top),s=Math.hypot(t[0]-o[0],t[1]-o[1]),n=[(t[0]-o[0])/s,(t[1]-o[1])/s],r=[-n[1],n[0]],a=rgb(e.color),i=rgb(e.highlight),l=({v:e,normal:o})=>{const t=.5+.5*Math.sin(e*s*260+5*noise(e*s*40,3));return shade(mix(a,i,.45*t+.3*Math.max(0,o[2])),1)},h=.014,d=[1,-1].map(e=>({geometry:tube([[o[0]-n[0]*h+.019*r[0]*e,o[1]-n[1]*h+.019*r[1]*e,.005],[t[0]+n[0]*h+.019*r[0]*e,t[1]+n[1]*h+.019*r[1]*e,.005]],{radius:.0045,sides:8,smoothness:Math.max(8,Math.round(90*s)),color:l})})),p=Math.max(3,Math.floor(s/.045));for(let e=1;e<=p;e++){const[s,n]=along(o,t,e/(p+1));d.push({geometry:tube([[s-.019*r[0],n-.019*r[1],.005+8e-4],[s+.019*r[0],n+.019*r[1],.005+8e-4]],{radius:.0032,sides:8,color:mix(a,i,.6)})})}return d}export function ladderPath(e){const[o,t]=cellCenter(e.bottom),[s,n]=cellCenter(e.top);return[[o,t,TILE_TOP],[s,n,TILE_TOP]]}const CELL=1/BOARD_SIZE;function cellColor(e){const o=e-1;let t=rgb(CELL_PALETTE[(Math.floor(o/BOARD_SIZE)+o%BOARD_SIZE)%CELL_PALETTE.length]);return 1===e?t=rgb(START_CELL):e===WINNING_POSITION&&(t=rgb(FINISH_CELL)),t}const FLAT=.05,SKIN=4e-4,DIGITS_Z=TILE_TOP+.002,ART_Z=TILE_TOP+.004;export const SHADOW_Z=TILE_TOP+.008;const PAWN_LIFT=SHADOW_Z+.001-TILE_TOP,pawnAt=(e,o)=>toWorld(e,o[0],o[1],o[2]+PAWN_LIFT),boardMesh=()=>cached("snl-board",()=>{const e=1+2*RIM,o=rgb("#5C4033"),t=(e,o)=>({position:[0,0,e],scale:o}),s=[{geometry:cube(),...t(TILE_TOP-.006,[e,e,SKIN]),color:[...o,1]},{geometry:cube(),...t(TILE_TOP-.003,[1,1,SKIN]),color:[...rgb("#CBB894"),1]}];for(let e=1;e<=WINNING_POSITION;e++){const[o,t]=cellCenter(e);s.push({geometry:cube(),position:[o,t,TILE_TOP-2e-4],scale:[CELL-.005,CELL-.005,SKIN],color:[...cellColor(e),1]})}const[n,r]=cellCenter(WINNING_POSITION);s.push({geometry:extrude((new Path).addStar(0,0,.5,.22),{depth:.12}),position:[n,r-.012,DIGITS_Z],scale:[.042,.042,.004],color:[...rgb("#FFC107"),1]}),s.push({geometry:extrude((new Path).addCircle(0,0,.08),{depth:SKIN,color:rgb("#A1887F")}),position:[START_X,DIE_Y,START_Z]});const a=merge([...LADDERS.flatMap(ladderParts),...SNAKES.flatMap(snakeParts)]);return s.push({geometry:a,position:[0,0,ART_Z],scale:[1,1,.05]}),_0x5cb824(merge(s),{center:!1,shine:0})}),DIGIT_SCALE=.027;function spawnNumbers(e,o){const t=toColor(NUMBER_COLOR),s=toColor(STAR_NUMBER_COLOR);for(let n=1;n<=WINNING_POSITION;n++){const[r,a]=cellCenter(n),i=String(n),l=i.length*GLYPH_ADVANCE-(GLYPH_ADVANCE-GLYPH_WIDTH);for(let h=0;h<i.length;h++)e.spawn({mesh:flatGlyphMesh(i[h]),parent:o,position:[r+.027*(-l/2+GLYPH_WIDTH/2+h*GLYPH_ADVANCE),a+.24*CELL,DIGITS_Z],scale:.027,color:1===n||n===WINNING_POSITION?s:t,pickable:!1})}}const pawnMesh=()=>cached("snl-pawn",()=>_0x5cb824(merge([{geometry:lathe([[.001,0],[.42,0],[.44,.04],[.42,.1],[.31,.14],[.25,.2],[.19,.42],[.15,.58],[.27,.61],[.27,.66],[.14,.69]],{segments:32})},{geometry:sphere(),position:[0,.84,0],scale:.4}]),{center:!1,shine:.65}));export const dieRotation=(e,o=0)=>_0x592c44(TILT,e,o);const discMesh=()=>cached("snl-disc",()=>_0x5cb824(extrude((new Path).addCircle(0,0,.5),{depth:0}))),ringMesh=()=>cached("snl-ring",()=>_0x5cb824(extrude((new Path).addCircle(0,0,.5).addCircle(0,0,.42),{depth:0,fillRule:"evenodd"}))),SHADOW=[0,0,0,.22],BACKDROP_DEPTH=25;export const toWorld=(e,o,t,s)=>[o*e.size,t*e.size,s*e.size];const tiltView=e=>({width:e.width,height:e.height,centerY:e.centerY,tilt:TILT});export const aimCamera=(e,o)=>aimTilted(e,tiltView(o));export function buildScene(e,o,t){const s=spawnBackdrop(e,o.width,o.height,-25,t);placeTiltedBackdrop(e,s,tiltView(o),25);const n=e.spawn({mesh:boardMesh(),scale:o.size,color:[1,1,1,1],pickable:!1});spawnNumbers(e,n);const r=t=>e.spawn({mesh:pawnMesh(),rotation:STAND_UP,scale:TOKEN_HEIGHT*o.size,color:toColor(t),pickable:!1}),a=()=>e.spawn({mesh:discMesh(),scale:.052*o.size,color:SHADOW,pickable:!1}),i=e.spawn({mesh:discMesh(),position:toWorld(o,.012,DIE_Y-.01,.001),scale:[1.25*DIE_SIZE*o.size,1.1*DIE_SIZE*o.size,1],color:SHADOW,pickable:!1}),l=e.spawn({mesh:ringMesh(),position:toWorld(o,0,DIE_Y,.002),scale:0,color:[1,.78,.15,.85],pickable:!1}),h=e.spawn({mesh:dieMesh(),position:dieRest(o),rotation:dieRotation(1),scale:DIE_SIZE*o.size,pickable:!1});return{backdrop:s,board:n,tokens:[r(PLAYER_COLOR),r(AI_COLOR)],shadows:[a(),a()],die:h,dieShadow:i,ring:l}}export function removeScene(e,o){for(const t of[o.backdrop,o.board,...o.tokens,...o.shadows,o.die,o.dieShadow,o.ring])e.despawn(t)}export function setSceneTheme(e,o,t){setBackdropTheme(e,o.backdrop,t)}export const dieRest=e=>toWorld(e,0,DIE_Y,DIE_SIZE/2);export function rollDie(e,o,t,s,n,r){_0x46e808(e,{die:t.die,shadow:t.dieShadow,rest:dieRest(o),shadowAt:toWorld(o,.012,DIE_Y-.01,.001),shadowScale:[1.25*DIE_SIZE*o.size,1.1*DIE_SIZE*o.size,1],size:DIE_SIZE*o.size,tilt:TILT,value:s,duration:n,disposed:r})}export function showRollHint(e,o,t,s){if(e.stopAnimation(t.ring),!s)return void e.set(t.ring,{scale:0});const n=1.55*DIE_SIZE*o.size;e.set(t.ring,{scale:n}),e.animate(t.ring,{scale:1.15*n},{duration:.6,easing:"easeInOut",repeat:"forever",yoyo:!0})}export function placeToken(e,o,t,s,n){e.stopAnimation(t.tokens[s]),e.stopAnimation(t.shadows[s]),e.set(t.tokens[s],{position:pawnAt(o,n)}),e.set(t.shadows[s],{position:toWorld(o,n[0]+.006,n[1]-.006,SHADOW_Z)})}export function moveToken(e,o,t,s,n,r,a=0){const i=t.tokens[s],l=t.shadows[s],h=n[n.length-1],d=a?[{position:pawnAt(o,[(n[0][0]+h[0])/2,(n[0][1]+h[1])/2,Math.max(n[0][2],h[2])+a]),at:.5},{position:pawnAt(o,h),at:1}]:n.slice(1).map((e,t)=>({position:pawnAt(o,e),at:(t+1)/(n.length-1)}));e.stopAnimation(i),e.stopAnimation(l),e.animate(i,d,{duration:r,path:"smooth",easing:a?"linear":"easeInOut"}),e.animate(l,{position:toWorld(o,h[0]+.006,h[1]-.006,SHADOW_Z)},{duration:r,easing:a?"linear":"easeInOut"})}export function bobToken(e,o,t,s){t.tokens.forEach((t,n)=>e.set(t,{bob:n===s?{amplitude:[0,0,.008*o.size],speed:6}:null}))}export function snakeBite(e,o,t,s,n){e.animate(t.tokens[n],{shake:.01*o.size},{duration:.3}),s.shake=.008*o.size}export function sparkle(e,o,t){effects.sparkle(e,{position:toWorld(o,t[0],t[1],t[2]+.03),count:16,size:.009*o.size,speed:.25*o.size,lifetime:.6,colors:[toColor("#FFD54F"),toColor("#FFF59D"),toColor("#FFFFFF")]})}export function confetti(e,o,t){effects.confetti(e,{position:toWorld(o,t[0],t[1],t[2]+.06),count:48,size:.012*o.size,speed:.7*o.size,lifetime:1.3,gravity:-1.2*o.size,colors:["#FF5252","#FFD740","#69F0AE","#448AFF"].map(e=>toColor(e))})}const slidePaths=new Map;export function slidePath(e){if(slidePaths.has(e))return slidePaths.get(e);const o=SNAKE_AT.get(e),t=LADDER_AT.get(e),s=o?snakePath(o).filter((e,o)=>o%3==0||29===o):t?ladderPath(t):null;return(o||t)&&slidePaths.set(e,s),s}
|
|
@@ -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{toRgb}from"../shared/EngineUtils.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{BACKGROUND,DAY_BACKGROUND,getLayout,LIGHT,LIVES,TIME_LIMIT}from"./SpaceFighterConstants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,start,tick}from"./SpaceFighterGame.js";import{jsx as
|
|
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{toRgb}from"../shared/EngineUtils.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{BACKGROUND,DAY_BACKGROUND,getLayout,LIGHT,LIVES,TIME_LIMIT}from"./SpaceFighterConstants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,start,tick}from"./SpaceFighterGame.js";import{jsx as _0x213ffd}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.SPACE_FIGHTER,NIGHT_RGB=toRgb(BACKGROUND),DAY_RGB=toRgb(DAY_BACKGROUND),FEEDBACK={grab:{sound:SOUNDS.GRAB,haptic:HapticType.MEDIUM},release:{sound:SOUNDS.RELEASE,haptic:HapticType.LIGHT},dodge:{sound:SOUNDS.DODGE,haptic:HapticType.LIGHT},hit:{sound:SOUNDS.COLLISION,haptic:HapticType.HEAVY}};export const SpaceFighter=engineGame(GAME_IDS.SPACE_FIGHTER,e=>{const[t,s]=useLiveState(0),[r,i]=useLiveState(LIVES),[a,o]=useLiveState(TIME_LIMIT),{theme:n,status:S,screen:m,gameOver:E}=useEngineGame(e,{gameId:GAME_IDS.SPACE_FIGHTER,create:createGame,setTheme:setTheme,start:start,reset:reset,dispose:dispose,tick:tick,resize:(e,t,s,r)=>setLayout(e,getLayout(t,s,r)),drag:drag,sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.SUCCESS),onOver:(e,t)=>e("win"===t?SOUNDS.WIN:SOUNDS.GAME_OVER,"win"===t?HapticType.SUCCESS:HapticType.ERROR),wire:(e,t)=>{e.onScore=s,e.onLives=i,e.onTime=o,e.onEvent=e=>t(FEEDBACK[e].sound,FEEDBACK[e].haptic)}});return _0x213ffd(EngineGameScreen,{...m,light:LIGHT,background:"dark"===n.mode?NIGHT_RGB:DAY_RGB,columns:[scoreColumn(t),livesColumn(r,LIVES),timerColumn(a,n,0)],subtext:"Navigate through space!",gameOver:E({title:"GAME OVER",message:"win"===S?"You survived the asteroid field!":"Your ship was destroyed!",scoreLabel:"Final Score",score:t,buttonText:"Fly Again!"})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{effects,ellipsoid,extrude,lathe,loft,merge,Path,quat,tube}from"@nayan-ui/engine";import{noise,random}from"../shared/EngineMeadow.js";import{cacheGameAsset,createGameMesh as
|
|
1
|
+
"use strict";import{effects,ellipsoid,extrude,lathe,loft,merge,Path,quat,tube}from"@nayan-ui/engine";import{noise,random}from"../shared/EngineMeadow.js";import{cacheGameAsset,createGameMesh as _0x26d5eb}from"../shared/EngineMeshes.js";import{toColor}from"../shared/EngineUtils.js";import{FOV,HIT_COOLDOWN,PLAY_DEPTH}from"./SpaceFighterConstants.js";const meshes=new Map,cached=(o,t)=>{let e=meshes.get(o);return!e&&(e=cacheGameAsset("space-fighter/SpaceFighterScene:"+o,t),meshes.set(o,e)),e},rgb=o=>{const[t,e,s]=toColor(o);return[t,e,s]},mix=(o,t,e)=>[o[0]+(t[0]-o[0])*e,o[1]+(t[1]-o[1])*e,o[2]+(t[2]-o[2])*e],shade=(o,t)=>[o[0]*t,o[1]*t,o[2]*t],smooth=(o,t,e)=>{const s=Math.min(1,Math.max(0,(e-o)/(t-o)));return s*s*(3-2*s)},TAN_HALF=Math.tan(FOV/2);export const toWorld=(o,t,e,s=PLAY_DEPTH)=>{const n=o.k*s/PLAY_DEPTH;return[(t-o.width/2)*n,(o.height/2-e)*n,-s]};const shipMesh=()=>cached("sf-ship",()=>{const o=rgb("#E3EAF3"),t=rgb("#8A97A8"),e=rgb("#00C8FF"),s=rgb("#55606F"),n=rgb("#0B3A5A"),a=loft([{z:-.62,bottom:-.1,top:.12,width:.15,square:3},{z:-.42,bottom:-.14,top:.2,width:.22,square:3.2},{z:-.05,bottom:-.15,top:.24,width:.24,square:3},{z:.22,bottom:-.12,top:.25,width:.19,square:2.6},{z:.46,bottom:-.08,top:.15,width:.11,square:2.4},{z:.64,bottom:-.03,top:.05,width:.04,square:2.2},{z:.73,bottom:-.004,top:.004,width:.004,square:2}],{around:36,smoothness:4,color:([,s,n],a)=>{let i=mix(t,o,smooth(-.5,.4,a[1]));return i=mix(i,e,smooth(.03,0,Math.abs(n-.02)-.035)*smooth(.3,.7,a[1])),n>.6&&(i=mix(i,e,.5)),[...shade(i,.9+.1*smooth(-.1,.15,s)),1]}}),i=ellipsoid([.1,.09,.2],[.07,.16,.32,1],24),r=ellipsoid([.025,.012,.06],[.8,.92,1,1],12),p=t=>{return{geometry:loft((e=t,[{z:.15*e,bottom:-.06,top:.06,width:.32,square:2.4},{z:.55*e,bottom:-.04,top:.04,width:.21,square:2.4},{z:.95*e,bottom:-.025,top:.025,width:.11,square:2.2}].sort((o,t)=>o.z-t.z)),{around:20,smoothness:3,color:[...o,1]}),rotation:quat.y(Math.PI/2),position:[0,0,-.08]};var e},h=o=>tube([[.17*o,.015,.2],[.95*o,.01,-.02]],{radius:.022,sides:8,color:[...n,1]}),l=o=>tube([[.95*o,0,-.18],[.95*o,0,.24]],{radius:o=>.035-.012*o,sides:10,color:[...s,1]}),m=o=>tube([[.3*o,-.02,.08],[.3*o,-.02,-.56]],{radius:o=>.09+.025*o,sides:18,color:[...s,1]}),u=o=>({geometry:lathe([[.08,.02],[.125,-.02],[.13,-.07],[.095,-.07]],{segments:18,color:[...shade(s,.7),1]}),position:[.3*o,-.02,-.56],rotation:quat.x(Math.PI/2)}),d=o=>({geometry:extrude((new Path).moveTo(0,0).lineTo(.2,0).lineTo(.05,-.18).lineTo(-.04,-.18).close(),{depth:.025}),position:[.12*o,.17,-.5],rotation:quat.multiply(quat.z(.35*o),quat.y(Math.PI/2)),color:[...n,1]}),f=merge([{geometry:a},{geometry:i,position:[0,.21,.2]},{geometry:r,position:[-.035,.29,.26]},p(1),p(-1),{geometry:h(1)},{geometry:h(-1)},{geometry:l(1)},{geometry:l(-1)},{geometry:m(1)},{geometry:m(-1)},u(1),u(-1),d(1),d(-1)]);return _0x26d5eb(merge([{geometry:f,rotation:quat.multiply(quat.y(Math.PI),quat.x(-Math.PI/2))}]),{center:!1,shine:.65})}),LIGHT_RED=[2.2,.35,.3,1],LIGHT_GREEN=[.35,2.2,.6,1],FLAME_IDLE=[2.2,1.25,.45,.9],FLAME_BOOST=[1.9,2.2,2.6,.95],LEAN=quat.x(-.32),shipTurn=[0,0,0,1];export const shipRotation=(o,t)=>quat.multiply(LEAN,quat.y(o,t),t);export function spawnShip(o,t,e){const s=t.shipSize*t.k,n=o.spawn({mesh:"none",position:toWorld(t,e,t.shipY),rotation:shipRotation(0),pickable:!1}),a=o.spawn({mesh:shipMesh(),parent:n,scale:s,color:[1,1,1,1],bob:{amplitude:[.02*s,.04*s,0],speed:2.2},pickable:!1}),i=[[.3,.28],[-.3,.28],[0,.16]].map(([t,e])=>o.spawn({mesh:"puff",parent:a,position:[t,-.66,.02],scale:e,color:FLAME_IDLE,pickable:!1}));return[1,-1].forEach((t,e)=>{const s=0===e?LIGHT_GREEN:LIGHT_RED,n=o.spawn({mesh:"sphere",parent:a,position:[.95*t,.24,0],scale:.07,color:s,pickable:!1});o.animate(n,[{color:s,at:.15},{color:[.25*s[0],.25*s[1],.25*s[2],1],at:.3},{color:[.25*s[0],.25*s[1],.25*s[2],1]}],{duration:1.2,delay:.6*e,repeat:"forever",easing:"linear"})}),flicker(o,t,{root:n,body:a,flames:i},!1),{root:n,body:a,flames:i}}export function flicker(o,t,e,s){e.flames.forEach((t,e)=>{const n=(2===e?.16:.28)*(s?1.55:1);o.stopAnimation(t),o.set(t,{scale:n,color:s?FLAME_BOOST:FLAME_IDLE}),o.animate(t,{scale:1.35*n},{duration:.06+.015*e,repeat:"forever",yoyo:!0,easing:"easeInOut"})})}export function launchShip(o,t,e){const s=t.shipSize*t.k;o.set(e.body,{position:[0,4*-s,0]}),o.animate(e.body,{position:[0,0,0]},{spring:{stiffness:140,damping:14}})}export function placeShip(o,t,e,s,n){o.set(e.root,{position:toWorld(t,s,t.shipY),rotation:shipRotation(n,shipTurn)})}export function blinkShip(o,t){const e=Math.round(HIT_COOLDOWN/.1),s=Array.from({length:e},(o,t)=>({color:t%2?[1,1,1,1]:[1,1,1,.3],at:(t+1)/e}));o.stopAnimation(t.body),o.set(t.body,{position:[0,0,0]}),o.animate(t.body,s,{duration:HIT_COOLDOWN,easing:"linear"}),o.animate(t.body,{turn:[0,2*Math.PI,0]},{duration:.55,easing:"easeOut"})}export function steadyShip(o,t){o.stopAnimation(t.body),o.set(t.body,{color:[1,1,1,1],position:[0,0,0],rotation:[0,0,0,1]})}const ROCK_VARIANTS=4,ROCK_KINDS=[["#7A5230","#2A1508"],["#6E6A66","#25221F"],["#3E3B40","#121014"],["#9FB3C4","#3A4A5A"]],rockMesh=o=>cached("sf-rock-"+o,()=>{const t=7.3*o+1,[e,s]=ROCK_KINDS[o%ROCK_KINDS.length],n=rgb(e),a=rgb(s),i=random(40+o),r=Array.from({length:6},()=>({u:i(),v:.2+.6*i(),r:.06+.08*i()})),p=(o,t)=>{let e=0;for(const s of r){const n=Math.min(Math.abs(o-s.u),1-Math.abs(o-s.u))*Math.sin(t*Math.PI)*2,a=Math.hypot(n,t-s.v)/s.r;a<1?e-=.07*(1-a*a):a<1.35&&(e+=.025*(1-(a-1)/.35))}return e},h=Array.from({length:19},(o,t)=>{const e=-Math.PI/2+t/18*Math.PI;return[Math.max(.001,.5*Math.cos(e)),.5*Math.sin(e)]});return _0x26d5eb(lathe(h,{segments:32,displace:(o,e)=>{const[s,n]=(a=o,[Math.cos(a*Math.PI*2),Math.sin(a*Math.PI*2)]);var a;return(.22*noise(1.4*s+t,1.4*n+2.6*e+t)+.08*noise(3.5*s+t,3.5*n+6*e)+.025*noise(9*s,9*n+14*e+t)-.14+p(o,e))*Math.sin(e*Math.PI)},color:({u:o,v:e,position:s})=>{const i=smooth(0,-.06,p(o,e)),r=smooth(.005,.02,p(o,e)),h=smooth(.55,.75,noise(6*s[0]+t,6*s[1]+4*s[2])),l=.8+.32*noise(24*s[0]+9*s[2],24*s[1]+t),m=mix(mix(n,a,Math.max(.85*i,.45*h)),shade(n,1.25),.6*r);return[...shade(m,l),1]}}),{shine:.1})});export function spawnBelts(o,t,e,s,n){const a=o.spawn({mesh:"none",position:toWorld(t,t.width/2,e),pickable:!1}),i=random(n),r=t.beltHeight,p=t.k,h=(s,n,h)=>o.spawn({mesh:rockMesh(Math.floor(4*i())),parent:a,position:[(s-t.width/2)*p,-(n-e)*p,(i()-.5)*r*.35*p],scale:[h*p*(.9+.25*i()),h*p*(.85+.2*i()),h*p*(.9+.2*i())],rotation:quat.multiply(quat.z(6.3*i()),quat.x(6.3*i())),spin:[1.6*(i()-.5),1.6*(i()-.5),1.2*(i()-.5)],pickable:!1}),l=1.08*r,m=(o,t,s)=>{if(t-o<2)return;const n=1===s?t:o,a=t-o+l;for(let o=l/2;o<a;){const t=l*(.7+.5*i());h(n-s*o,e+r/2+(i()-.5)*r*.12,t),o+=.66*t}h(n-s*l*.22,e+.18*r,.42*l),h(n-s*l*.22,e+.82*r,.42*l)};return m(-l/2,s,1),m(s+t.gap,t.width+l/2,-1),{root:a}}export function placeBelts(o,t,e,s){o.set(e.root,{position:toWorld(t,t.width/2,s)})}export function explode(o,t,e,s){const n=toWorld(t,e,s),a=t.shipSize*t.k;effects.explosion(o,{position:n,count:24,size:.9*a,speed:3*a,lifetime:.6,colors:[[2.4,1.6,.5,.95],[2.2,.8,.3,.9],[1.4,.4,.2,.8]],smoke:[.3,.25,.3,.5],debris:[toColor("#C9D3DE"),toColor("#00C8FF")]})}const halfAt=(o,t)=>[t*TAN_HALF*(o.width/o.height),t*TAN_HALF],moonMesh=()=>cached("sf-moon",()=>_0x26d5eb(merge([{geometry:lathe(Array.from({length:17},(o,t)=>{const e=-Math.PI/2+t/16*Math.PI;return[Math.max(.001,.5*Math.cos(e)),.5*Math.sin(e)]}),{segments:40,color:({position:o})=>{const t=smooth(.55,.7,noise(3*o[0]+4,3*o[1]+2*o[2])),e=smooth(.7,.8,noise(9*o[0]+1,9*o[1]-4*o[2]));return shade(mix(rgb("#E8E4D8"),rgb("#8A8070"),.7*t+.5*e),.9+.15*noise(30*o[0],30*o[1]))}})}]),{shine:.05}));export const STAR_DRIFT=5;function spawnSky(o,t,e){const s=[],[n,a]=halfAt(t,170),i=[.55*-n,.38*a,-170];if(e){const t=.26*a;return s.push(o.spawn({mesh:"puff",position:[i[0],i[1],i[2]-2],scale:4.2*t,color:[1.8,1.25,.6,.16],pickable:!1})),s.push(o.spawn({mesh:"puff",position:[i[0],i[1],i[2]-1],scale:2.2*t,color:[2,1.6,.8,.35],pickable:!1})),s.push(o.spawn({mesh:"sphere",position:i,scale:t,color:[2.4,2.05,1.1,1],pickable:!1})),s}const[r,p]=halfAt(t,400);return s.push(o.spawn({mesh:"puff",position:[.9*-r,.75*p,-400],scale:.7*p,color:[1.6,1.2,.9,.18],pickable:!1})),s.push(o.spawn({mesh:moonMesh(),position:i,scale:.32*a,spin:[0,.05,0],pickable:!1})),s}export function setSpaceTheme(o,t,e,s){for(const t of e.sky)o.despawn(t);e.all=e.all.filter(o=>!e.sky.includes(o)),e.sky=spawnSky(o,t,s),e.all.push(...e.sky)}export function spawnSpace(o,t,e,s){const n=[],a=random(3),i=[[.55,.25,.95,.1],[.25,.4,1,.08],[.85,.3,.75,.07]];for(let e=0;e<16;e++){const s=430+50*a(),[r,p]=halfAt(t,s);n.push(o.spawn({mesh:"puff",position:[(2*a()-1)*r*1.1,(2*a()-1)*p,-s],scale:p*(.5+.6*a()),color:i[e%3],pickable:!1}))}for(let e=0;e<36;e++){const s=470,[i,r]=halfAt(t,s),p=e/35;n.push(o.spawn({mesh:"puff",position:[(2.2*p-1.1)*i,(.75-1.3*p+.15*(a()-.5))*r,-s],scale:r*(.12+.14*a()),color:[.85,.8,1.2,.06],pickable:!1}))}const r=spawnSky(o,t,s);n.push(...r);const p=[],h=[[2.2,2.2,2.4,1],[2.3,2.1,1.8,1],[1.9,2.1,2.6,1]];for(let s=0;s<260;s++){const i=30+300*Math.pow(a(),.7),[r,l]=halfAt(t,i),m=(2*a()-1)*r*1.05,u=(2*a()-1)*(l+1),d=o.spawn({mesh:"sphere",position:[m,u,-i],scale:.0028*i*(.6+1.1*a()),color:h[s%3],velocity:[0,-5,0],pickable:!1});n.push(d),p.push({e:d,x:m,y:u,z:i,since:e})}return{all:n,sky:r,stars:p}}export function wrapStars(o,t,e){for(const s of t.stars){const t=s.z*TAN_HALF+1;s.y-5*(e-s.since)<-t&&(s.y=t,s.since=e,o.set(s.e,{position:[s.x,t,-s.z]}))}}export function removeAll(o,t){for(const e of t)o.despawn(e)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{formatTime,GAME_IDS,isTablet}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}from"./SpiderSolitaireConstants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,start,tick}from"./SpiderSolitaireGame.js";import{dealsLeft,RUNS_TO_WIN}from"./SpiderSolitaireRules.js";import{jsx as
|
|
1
|
+
"use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{formatTime,GAME_IDS,isTablet}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}from"./SpiderSolitaireConstants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,start,tick}from"./SpiderSolitaireGame.js";import{dealsLeft,RUNS_TO_WIN}from"./SpiderSolitaireRules.js";import{jsx as _0x5dfe2a}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.SPIDER_SOLITAIRE,FEEDBACK={select:{sound:SOUNDS.SELECT,haptic:HapticType.LIGHT},deselect:{sound:SOUNDS.DESELECT,haptic:HapticType.LIGHT},invalid:{sound:SOUNDS.INVALID,haptic:HapticType.LIGHT},place:{sound:SOUNDS.PLACE,haptic:HapticType.MEDIUM},deal:{sound:SOUNDS.DRAW,haptic:HapticType.MEDIUM},complete:{sound:SOUNDS.COMPLETE,haptic:HapticType.SUCCESS},win:{sound:SOUNDS.WIN,haptic:HapticType.SUCCESS}},tryAgain=()=>"Try again!";export const SpiderSolitaire=engineGame(GAME_IDS.SPIDER_SOLITAIRE,e=>{const[t,i]=useLiveState(null),[s,a]=useLiveState(0),{game:r,status:o,screen:S,gameOver:n}=useEngineGame(e,{gameId:GAME_IDS.SPIDER_SOLITAIRE,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,i,s)=>{const a=getLayout(t,i,s,isTablet);return setLayout(e,a),9*a.pitch+a.card},drag:drag,reportScore:(e,t)=>"win"===t?e.score:0,sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.MEDIUM),wire:(e,t)=>{e.onDeals=i,e.onCompleted=a,e.onEvent=e=>t(FEEDBACK[e].sound,FEEDBACK[e].haptic)}});return _0x5dfe2a(EngineGameScreen,{...S,light:LIGHT,columns:[textColumn("DEALS",t??dealsLeft(r.board)),textColumn("COMPLETED",s+"/"+RUNS_TO_WIN)],subtext:"Deal the cards!",gameOver:n({title:"win"===o?"YOU WON!":"NO MOVES LEFT",message:"win"===o?"All suits completed!":"No more valid moves!",scoreLabel:"win"===o?"Completion Time":"No Moves Left!",score:r.time,formatter:"win"===o?formatTime:tryAgain,buttonText:"Play Again!"})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{effects,extrude,merge,Path,quat}from"@nayan-ui/engine";import{COLORS as
|
|
1
|
+
"use strict";import{effects,extrude,merge,Path,quat}from"@nayan-ui/engine";import{COLORS as _0x185f1e}from"../../services/GamesConstants.js";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{GLYPH_WIDTH,glyphMesh}from"../shared/EngineGlyphs.js";import{cacheGameAsset,createGameMesh as _0x2df14f}from"../shared/EngineMeshes.js";import{placeTiltedBackdrop}from"../shared/EngineTilt.js";import{toColor}from"../shared/EngineUtils.js";import{CARD_RATIO,COLORS,FACE_DOWN_STEP,FACE_UP_STEP,MOVE_TIME,SMALL,SUIT_COLORS,THICKNESS}from"./SpiderSolitaireConstants.js";import{PILES}from"./SpiderSolitaireRules.js";const meshes=new Map,cached=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("spider-solitaire/SpiderSolitaireScene:"+e,o),meshes.set(e,t)),t},BACKDROP_DEPTH=30,HALF_H=CARD_RATIO/2,RADIUS=.07,FACE_UP=[0,0,0,1],FACE_DOWN=quat.y(Math.PI),EDGE_ON=quat.y(Math.PI/2),LIFT=7,HELD=40,rrect=(e,o=new Path)=>o.addRoundedRect(-.5+e,-HALF_H+e,1-2*e,CARD_RATIO-2*e,Math.max(.01,.07-e)),cardMesh=()=>cached("ss-card",()=>{const e=THICKNESS,o=(o,t,s)=>({geometry:extrude(o,{depth:0,fillRule:"evenodd"}),rotation:FACE_DOWN,position:[0,0,-e/2-.002*s],color:toColor(t)}),t=new Path;for(let e=0;e<7;e++)for(let o=0;o<4;o++){const s=.18*o-.27+(e%2?.09:0),a=.166*e-.5;s>.3||t.addPolygon([[s,a-.07],[s+.06,a],[s,a+.07],[s-.06,a]])}return _0x2df14f(merge([{geometry:extrude(rrect(0),{depth:e}),color:toColor(COLORS.FACE)},o(rrect(.035),COLORS.BACK,1),o(rrect(.075,rrect(.095)),COLORS.BACK_FRAME,2),o(t,COLORS.BACK_LIGHT,2)]),{center:!1,shine:.35})}),SUIT_PATHS={hearts:"M0.5,0.95 C0.2,0.72 0,0.52 0,0.3 C0,0.12 0.13,0 0.28,0 C0.38,0 0.46,0.06 0.5,0.15 C0.54,0.06 0.62,0 0.72,0 C0.87,0 1,0.12 1,0.3 C1,0.52 0.8,0.72 0.5,0.95 Z",diamonds:"M0.5,0 L0.86,0.5 L0.5,1 L0.14,0.5 Z",clubs:"M0.5,0 C0.64,0 0.75,0.11 0.75,0.25 C0.75,0.33 0.71,0.4 0.66,0.44 C0.7,0.42 0.74,0.41 0.78,0.41 C0.92,0.41 1,0.52 1,0.65 C1,0.79 0.9,0.89 0.77,0.89 C0.67,0.89 0.58,0.83 0.54,0.75 C0.56,0.86 0.6,0.94 0.68,1 L0.32,1 C0.4,0.94 0.44,0.86 0.46,0.75 C0.42,0.83 0.33,0.89 0.23,0.89 C0.1,0.89 0,0.79 0,0.65 C0,0.52 0.08,0.41 0.22,0.41 C0.26,0.41 0.3,0.42 0.34,0.44 C0.29,0.4 0.25,0.33 0.25,0.25 C0.25,0.11 0.36,0 0.5,0 Z",spades:"M0.5,0 C0.8,0.25 1,0.42 1,0.6 C1,0.75 0.88,0.84 0.75,0.84 C0.65,0.84 0.57,0.79 0.53,0.72 C0.55,0.84 0.6,0.93 0.68,1 L0.32,1 C0.4,0.93 0.45,0.84 0.47,0.72 C0.43,0.79 0.35,0.84 0.25,0.84 C0.12,0.84 0,0.75 0,0.6 C0,0.42 0.2,0.25 0.5,0 Z"},suitMesh=e=>cached("ss-suit:"+e,()=>_0x2df14f(extrude(Path.fromSVG(SUIT_PATHS[e]),{depth:.08}),{fit:1,shine:.5})),slotRingMesh=()=>cached("ss-slot-ring",()=>_0x2df14f(extrude(rrect(0,rrect(.035)),{depth:0,fillRule:"evenodd"}),{center:!1})),slotFillMesh=()=>cached("ss-slot-fill",()=>_0x2df14f(extrude(rrect(.035),{depth:0}),{center:!1})),slotColor=e=>toColor("classic"===e.mode?COLORS.CLASSIC_SLOT:e.BOARD.BORDER),slotFill=e=>toColor("classic"===e.mode?_0x185f1e.BG_35:e.BOARD.CELL_EMPTY);function spawnSlot(e,o,t,s,a,r,n){const l=o.card*(a?SMALL:1);return{ring:e.spawn({mesh:slotRingMesh(),position:[t,s,.1],scale:l,color:slotColor(n),pickable:!1}),fill:r?e.spawn({mesh:slotFillMesh(),position:[t,s,.05],scale:l,color:slotFill(n),pickable:!1}):null}}function spawnFace(e,o,t){const s=toColor(SUIT_COLORS[t.suit]),a=THICKNESS/2,r=t.value.split(""),n=r.length>1?.27:.32,l=n*GLYPH_WIDTH*1.05;r.forEach((t,i)=>{const p=(i-(r.length-1)/2)*l-.33+(r.length>1?.04:0);e.spawn({mesh:glyphMesh(t),parent:o,position:[p,HALF_H-.24,a],scale:n,color:s,pickable:!1})});const i=suitMesh(t.suit);e.spawn({mesh:i,parent:o,position:[.29,HALF_H-.24,a+.02],scale:.26,color:s,pickable:!1}),e.spawn({mesh:i,parent:o,position:[0,-.16,a+.02],scale:.56,color:s,pickable:!1})}export function buildScene(e,o,t,s){const a=spawnBackdrop(e,o.width,o.height,-30,t);placeTiltedBackdrop(e,a,o,30);const r=o.pileTop-o.cardH/2,n=o.card*SMALL,l={backdrop:a,piles:o.columns.map(s=>spawnSlot(e,o,s,r,!1,!1,t)),stock:spawnSlot(e,o,o.stockRight-n/2,o.rowY,!0,!0,t),foundation:spawnSlot(e,o,o.foundationX,o.rowY,!0,!0,t),cards:new Map};for(const t of s){const s=e.spawn({mesh:cardMesh(),scale:o.card*SMALL,rotation:FACE_DOWN,position:[o.stockRight-n/2,o.rowY,1],pickable:!1});spawnFace(e,s,t),l.cards.set(t.id,{body:s,spot:{x:o.stockRight-n/2,y:o.rowY,z:1,faceUp:!1,small:!0,selected:!1}})}return l}export function removeScene(e,o){const t=[...o.piles,o.stock,o.foundation];for(const s of[o.backdrop,...t.flatMap(e=>[e.ring,e.fill]),...Array.from(o.cards.values(),e=>e.body)])null!=s&&e.despawn(s)}export function setSceneTheme(e,o,t){setBackdropTheme(e,o.backdrop,t);for(const s of[...o.piles,o.stock,o.foundation])e.set(s.ring,{color:slotColor(t)}),null!=s.fill&&e.set(s.fill,{color:slotFill(t)})}export function pileOffsets(e,o){const t=o.map(o=>(o.faceUp?FACE_UP_STEP:FACE_DOWN_STEP)*e.cardH);let s=0;for(let e=0;e<o.length-1;e++)s+=t[e];const a=e.pileTop-e.pileBottom-e.cardH,r=s>a&&s>0?Math.max(0,a)/s:1,n=[];let l=0;for(let e=0;e<o.length;e++)n.push(l),l+=t[e]*r;return n}export function pileSpot(e,o,t,s){return[e.columns[o],e.pileTop-t-e.cardH/2,e.dz*(s+1)]}export function layoutCards(e,o,t,s=!1){const a=new Map;if(s&&t?.drag){const s=o.tableau[t.pile],r=pileOffsets(e,s);for(let o=t.index;o<s.length;o++){const n=s[o];a.set(n.id,{x:t.drag.x,y:t.drag.y-(r[o]-r[t.index]),z:40+e.dz*(o-t.index),faceUp:n.faceUp,small:!1,selected:!0})}return a}o.tableau.forEach((o,s)=>{const r=pileOffsets(e,o);o.forEach((o,n)=>{const l=null!==t&&t.pile===s&&n>=t.index;let[i,p,d]=pileSpot(e,s,r[n],n);if(l&&t.drag){const o=r[n]-r[t.index];i=t.drag.x,p=t.drag.y-o,d=40+e.dz*(n-t.index)}else l&&(p+=2,d+=7);a.set(o.id,{x:i,y:p,z:d,faceUp:o.faceUp,small:!1,selected:l})})});const r=e.card*SMALL,n=Math.ceil(o.stock.length/PILES),l=r*THICKNESS+.15;return o.stock.forEach((o,t)=>{const s=Math.floor(t/PILES);a.set(o.id,{x:e.stockRight-r/2-(n-1-s)*r*.22,y:e.rowY,z:1+(s*PILES+t%PILES)*l*.3,faceUp:!1,small:!0,selected:!1})}),o.completed.forEach((o,t)=>{o.forEach((o,s)=>{a.set(o.id,{x:e.foundationX+t*r*.5,y:e.rowY,z:1+3*t+.2*(12-s),faceUp:!0,small:!0,selected:!1})})}),a}const scaleOf=(e,o)=>e.card*(o.small?SMALL:1),same=(e,o)=>e.x===o.x&&e.y===o.y&&e.z===o.z&&e.faceUp===o.faceUp&&e.small===o.small&&e.selected===o.selected;export function placeCards(e,o,t,s,a=()=>0,r=!1){for(const[n,l]of s){const s=t.cards.get(n);if(!s)continue;const i=s.spot;if(i&&same(i,l))continue;s.spot=l;const p=[l.x,l.y,l.z],d=l.faceUp?FACE_UP:FACE_DOWN,f=scaleOf(o,l),h=toColor(l.selected?COLORS.SELECTED:COLORS.FACE);if(r||!i){e.stopAnimation(s.body),e.set(s.body,{position:p,rotation:d,scale:f,color:h});continue}i.selected!==l.selected&&e.set(s.body,{color:h});const C=Math.hypot(i.x-l.x,i.y-l.y),m=i.faceUp!==l.faceUp;if(C<1&&!m){e.animate(s.body,{position:p,scale:f},{duration:.14,delay:a(n)});continue}const u=Math.max(i.z,l.z)+(C>1?18+.05*C:10),S=[(i.x+l.x)/2,(i.y+l.y)/2,u];e.animate(s.body,[{position:S,...m?{rotation:EDGE_ON}:{},scale:(f+scaleOf(o,i))/2,at:.5},{position:p,rotation:d,scale:f}],{duration:MOVE_TIME+Math.min(.16,6e-4*C),delay:a(n),path:"smooth",easing:"easeInOut"})}}export function shakeCards(e,o,t){for(const s of t){const t=o.cards.get(s);t&&e.animate(t.body,{shake:3},{duration:.25})}}export function sparkle(e,o,t,s){effects.sparkle(e,{position:[t,s,30],count:26,size:.1*o.card,speed:3*o.card,lifetime:.7,gravity:3*-o.card,colors:["#FFD700","#FFF59D","#FF8A80","#FFFFFF"].map(e=>toColor(e))})}export function celebrate(e,o){effects.confetti(e,{position:[0,(o.pileTop+o.pileBottom)/2,60],count:80,size:.14*o.card,speed:1.2*o.width,lifetime:1.4,gravity:2*-o.width,colors:["#FFD700","#4CAF50","#2196F3","#E74C3C"].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"./StackTowerConstants.js";import{createGame,dispose,reset,setLayout,setTheme,start,tap,tick}from"./StackTowerGame.js";import{jsx as
|
|
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"./StackTowerConstants.js";import{createGame,dispose,reset,setLayout,setTheme,start,tap,tick}from"./StackTowerGame.js";import{jsx as _0x34cad2}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.STACK_TOWER,FEEDBACK={place:{sound:SOUNDS.PLACE,haptic:HapticType.MEDIUM},perfect:{sound:SOUNDS.PERFECT,haptic:HapticType.SUCCESS},miss:{sound:SOUNDS.MISS,haptic:HapticType.ERROR}};export const StackTower=engineGame(GAME_IDS.STACK_TOWER,e=>{const[t,s]=useLiveState(0),[r,a]=useLiveState(TIME_LIMIT),{theme:i,status:o,screen:n,gameOver:S}=useEngineGame(e,{gameId:GAME_IDS.STACK_TOWER,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,s)=>{const r=getLayout(t,s);return setLayout(e,r),r.gameWidth},drag:(e,t)=>{"start"===t.phase&&tap(e)},sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.SUCCESS),onStop:e=>e(null,HapticType.MEDIUM),onOver:(e,t)=>e("win"===t?SOUNDS.WIN:SOUNDS.GAME_OVER,"win"===t?HapticType.SUCCESS:HapticType.ERROR),wire:(e,t)=>{e.onScore=s,e.onTime=a,e.onEvent=e=>t(FEEDBACK[e].sound,FEEDBACK[e].haptic)}});return _0x34cad2(EngineGameScreen,{...n,light:LIGHT,columns:[scoreColumn(t),timerColumn(r,i)],subtext:"Stack blocks with care!",gameOver:S({title:"win"===o?"AMAZING!":"GAME OVER",message:"win"===o?"Perfect tower!":"Great stacking!",scoreLabel:"Final Score",score:t,buttonText:"Stack Again!"})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{effects,extrude,merge,Path,recolor,shapeGeometry}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{cacheGameAsset,createGameMesh as
|
|
1
|
+
"use strict";import{effects,extrude,merge,Path,recolor,shapeGeometry}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{cacheGameAsset,createGameMesh as _0x5c08f8}from"../shared/EngineMeshes.js";import{aimTilted,placeTiltedBackdrop}from"../shared/EngineTilt.js";import{toColor}from"../shared/EngineUtils.js";import{BLOCK_COLORS,MISS_TIME,SPAWN_FADE}from"./StackTowerConstants.js";const meshes=new Map,cached=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("stack-tower/StackTowerScene:"+e,o),meshes.set(e,t)),t},shadeFaces=e=>recolor(e,({normal:[e,o,t]})=>{const i=o>.6?1:o<-.6?.45:Math.abs(e)>.6?.68:t>.6?.88:.7;return[i,i,i,1]}),blockMesh=(e,o,t)=>cached("st-block-v2:"+e+":"+o+":"+t.toFixed(1),()=>{const i=Math.min(4,o/4),n=Math.min(2.5,.12*o);return _0x5c08f8(merge([{geometry:shadeFaces(extrude((new Path).addRoundedRect(-e/2,-o/2,e,o-n,i),{depth:t}))},{geometry:shapeGeometry("cube"),position:[0,o/2-n/2,0],scale:[e-2*n,n,t-2*n],color:[1,1,1,1]}]),{shine:.45})}),BACKDROP_DEPTH=60,EYE_DISTANCE=250,PLINTH=toColor("#4A4F66");export const viewFor=(e,o)=>({width:e.width,height:e.height,centerY:e.height/2+o,tilt:e.tilt});export function blockAt(e,o,t){return[o+e.blockWidth/2-e.width/2,(e.height/2-(t+e.blockHeight/2))/Math.cos(e.tilt),0]}export const blockColor=e=>toColor(BLOCK_COLORS[e%BLOCK_COLORS.length]);export function buildScene(e,o,t){const i=spawnBackdrop(e,o.width,o.height,-60,t),[n,r]=blockAt(o,o.left+(o.gameWidth-o.blockWidth)/2,o.baseY),s=o.height;return{backdrop:i,plinth:e.spawn({mesh:"roundedBox",position:[n,r-o.blockHeight/2-s/2,0],scale:[1.35*o.blockWidth,s,1.3*o.blockDepth],color:PLINTH,pickable:!1}),blocks:[],moving:null}}export function removeScene(e,o){for(const t of[o.backdrop,o.plinth,...o.blocks,...null!=o.moving?[o.moving]:[]])e.despawn(t)}export function setSceneTheme(e,o,t){setBackdropTheme(e,o.backdrop,t)}export function frame(e,o,t,i,n){if(t.frameOffset===n)return;t.frameOffset=n;const r=viewFor(o,n);aimTilted(i,r);const[s,a,l]=i.eye,[h,d,p]=i.target,k=Math.hypot(s-h,a-d,l-p),m=[(s-h)/k,(a-d)/k,(l-p)/k],b=-p/m[2],u=[h+m[0]*b,d+m[1]*b,0];i.target=[u[0],u[1],u[2]],i.eye=[u[0]+250*m[0],u[1]+250*m[1],u[2]+250*m[2]],placeTiltedBackdrop(e,t.backdrop,r,60)}export function spawnBlock(e,o,t,i,n,r=!1){const s=blockColor(n),a=e.spawn({mesh:blockMesh(o.blockWidth,Math.round(o.blockHeight/Math.cos(o.tilt)*10)/10,o.blockDepth),position:blockAt(o,t,i),color:r?[s[0],s[1],s[2],0]:s,pickable:!1});return r&&e.animate(a,{color:s},{duration:SPAWN_FADE,easing:"easeOut"}),a}export function slideBlock(e,o,t,i,n){e.set(t,{position:blockAt(o,i,n)})}export function land(e,o,t,i,n,r,s){const a=blockColor(r),l=s?1.7:1.35;e.animate(t,[{color:[a[0]*l,a[1]*l,a[2]*l,1],at:.2},{color:a}],{duration:.35}),e.animate(t,[{scale:[1.04,.92,1.04],at:.3},{scale:1}],{duration:.2});const[h,d]=blockAt(o,i,n),p=d-o.blockHeight/2;for(const t of[-1,1])effects.dust(e,{position:[h+t*o.blockWidth/2,p,.3*o.blockDepth],count:4,size:.7*o.blockHeight,speed:2*o.blockHeight,direction:[t,.3,0],spread:.8,lifetime:.4,color:[1,1,1,.55]});s&&effects.sparkle(e,{position:[h,d,.55*o.blockDepth],count:20,size:.3*o.blockHeight,speed:1.4*o.blockWidth,lifetime:.5,colors:[toColor("#FFD700"),toColor("#FFF59D"),[1,1,1,1]]})}export function tumble(e,o,t,i,n,r,s){const[a,l]=blockAt(o,i,n),[h,d,p]=blockColor(s),k=r>=0?1:-1;e.animate(t,{position:[a+k*o.blockWidth*.5,l-8*o.blockHeight,.3*o.blockDepth]},{duration:MISS_TIME,easing:"easeIn"}),e.animate(t,{turn:[.6,0,1.4*-k]},{duration:MISS_TIME,easing:"easeIn"}),e.animate(t,{color:[h,d,p,0]},{duration:MISS_TIME,easing:"easeIn"})}
|
|
@@ -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,LOW_TIME,TIME_LIMIT}from"./SudokuConstants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,start,tick}from"./SudokuGame.js";import{jsx as
|
|
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,LOW_TIME,TIME_LIMIT}from"./SudokuConstants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,start,tick}from"./SudokuGame.js";import{jsx as _0x329de3}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.SUDOKU,FEEDBACK={place:{sound:SOUNDS.PLACE,haptic:HapticType.LIGHT},wrong:{sound:SOUNDS.ERROR,haptic:HapticType.ERROR},win:{sound:SOUNDS.WIN,haptic:HapticType.SUCCESS},lose:{sound:SOUNDS.GAME_OVER,haptic:HapticType.ERROR}};export const Sudoku=engineGame(GAME_IDS.SUDOKU,e=>{const[t,s]=useLiveState(0),[r,o]=useLiveState(TIME_LIMIT),{theme:i,status:a,screen:n,gameOver:m}=useEngineGame(e,{gameId:GAME_IDS.SUDOKU,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.board},drag:drag,sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.SUCCESS),onStop:e=>e(null,HapticType.MEDIUM),wire:(e,t)=>{e.onScore=s,e.onTime=o,e.onEvent=e=>t(FEEDBACK[e].sound,FEEDBACK[e].haptic)}});return _0x329de3(EngineGameScreen,{...n,light:LIGHT,columns:[scoreColumn(t),timerColumn(r,i,LOW_TIME)],subtext:"Complete the number grid!",gameOver:m({title:"win"===a?"SOLVED!":"GAME OVER",message:"win"===a?"Puzzle completed!":"Time ran out!",scoreLabel:"Final Score",score:t,buttonText:"Solve 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}from"../shared/EngineGlyphs.js";import{cacheGameAsset,createGameMesh as
|
|
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}from"../shared/EngineGlyphs.js";import{cacheGameAsset,createGameMesh as _0x4d5891}from"../shared/EngineMeshes.js";import{placeTiltedBackdrop}from"../shared/EngineTilt.js";import{toColor}from"../shared/EngineUtils.js";import{CELL_HEIGHT,cellCentre,COLORS,FLASH_STEP,KEY_HEIGHT,keyCentre}from"./SudokuConstants.js";const meshes=new Map,cached=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("sudoku/SudokuScene:"+e,o),meshes.set(e,t)),t},BOARD_DEPTH=10,BACKDROP_DEPTH=30,SURFACE=1,panelMesh=(e,o,t,s)=>cached("sd-panel:"+e+":"+o+":"+t+":"+s,()=>_0x4d5891(extrude((new Path).addRoundedRect(-e/2,-o/2,e,o,t),{depth:s}),{shine:0})),cellColor=(e,o)=>toColor("selected"===o?COLORS.SELECTED:e.error?COLORS.ERROR:"same"===o?COLORS.SAME_NUMBER:"peer"===o?COLORS.PEER:e.given?COLORS.GIVEN:COLORS.CELL),digitColor=e=>toColor(e.error?COLORS.TEXT_ERROR:e.given?COLORS.TEXT_GIVEN:COLORS.TEXT_PLACED),keyDigit=e=>Math.min(.5*e.key,.4*e.keyH),DIGIT=.5,cellHeight=(e,o)=>e.cell*CELL_HEIGHT*(o?1.8:1),cellTop=e=>1+e.cell*CELL_HEIGHT,keyTop=e=>1+e.key*KEY_HEIGHT;function spawnBoard(e,o,t){const s="classic"===t.mode,l=[e.spawn({mesh:panelMesh(o.board,o.board,s?14:8,10),position:[0,o.boardY,-5],color:toColor(s?COLORS.FRAME:t.BOARD.SURFACE),pickable:!1}),e.spawn({mesh:panelMesh(o.grid,o.grid,4,1),position:[0,o.boardY,.5],color:toColor(s?COLORS.LINES:t.BOARD.GRID_LINE),pickable:!1})];return s&&l.push(e.spawn({mesh:panelMesh(o.grid+6,o.grid+6,8,1),position:[0,o.boardY,.2],color:toColor(COLORS.WELL),pickable:!1})),l}export function buildScene(e,o,t){const s=spawnBackdrop(e,o.width,o.height,-30,t);placeTiltedBackdrop(e,s,o,30);const l=o.cell*CELL_HEIGHT,n=[];for(let t=0;t<9;t++)for(let s=0;s<9;s++){const[i,a]=cellCentre(o,t,s);n.push(spawnRaisedBlock(e,{position:[i,a,1+l/2],size:[o.cell,o.cell,l],color:toColor(COLORS.CELL),gloss:!1,shadow:!1}))}const i=[],a=o.key*KEY_HEIGHT;for(let t=1;t<=9;t++){const[s,l]=keyCentre(o,t),n=e.spawn({mesh:"none",position:[s,l,1],pickable:!1}),r=spawnRaisedBlock(e,{parent:n,position:[0,0,a/2],size:[o.key,o.keyH,a],color:toColor(COLORS.KEY),gloss:!1,shadow:!1}),p=keyDigit(o),d=e.spawn({mesh:flatGlyphMesh(String(t)),parent:n,position:[0,.1*o.keyH,a+.6],scale:p,color:toColor(COLORS.KEY_TEXT),pickable:!1}),h=.42*p,C=e.spawn({mesh:flatGlyphMesh("9"),parent:n,position:[0,.32*-o.keyH,a+.6],scale:h,color:toColor(COLORS.KEY_REMAINING),pickable:!1});i.push({root:n,block:r,digit:d,count:C})}return{backdrop:s,board:spawnBoard(e,o,t),cells:n,digits:Array(81).fill(null),shown:Array(81).fill(""),selected:-1,keys:i,keyCounts:Array(9).fill(-1)}}export function removeScene(e,o){for(const t of[o.backdrop,...o.board,...o.cells,...o.digits,...o.keys.map(e=>e.root)])null!=t&&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,s)}export function drawGrid(e,o,t,s,l,n=-1){const i=.5*o.cell;t.selected=-1;for(let a=0;a<9;a++)for(let r=0;r<9;r++){const p=9*a+r,d=s[a][r],h=l(a,r),[C,E]=cellCentre(o,a,r),k=cellHeight(o,"selected"===h),u=1+k+.6;"selected"===h&&(t.selected=p),e.stopAnimation(t.cells[p]),e.set(t.cells[p],{color:cellColor(d,h),position:[C,E,1+k/2],scale:[o.cell,o.cell,k]});const f=d.value?d.value+":"+d.given+":"+d.error:"";if(f!==t.shown[p]){const s=t.digits[p];if(null!=s&&e.despawn(s),t.digits[p]=null,d.value){const s=e.spawn({mesh:flatGlyphMesh(String(d.value)),position:[C,E,u],scale:i,color:digitColor(d),pickable:!1});p===n&&(e.set(s,{scale:.2*i,position:[C,E,u+.5*o.cell]}),e.animate(s,{scale:i,position:[C,E,u]},{duration:.22,easing:"back"})),t.digits[p]=s}t.shown[p]=f}else null!=t.digits[p]&&(e.stopAnimation(t.digits[p]),e.set(t.digits[p],{position:[C,E,u],scale:i}))}}export function drawKeys(e,o,t,s){const l=.42*keyDigit(o);t.keys.forEach((o,n)=>{const i=s[n+1];t.keyCounts[n]!==i&&(t.keyCounts[n]=i,e.set(o.block,{color:toColor(i>0?COLORS.KEY:COLORS.KEY_DISABLED)}),e.set(o.digit,{color:toColor(i>0?COLORS.KEY_TEXT:COLORS.KEY_DISABLED_TEXT)}),e.set(o.count,{mesh:flatGlyphMesh(String(i)),scale:i>0?l:.001}))})}export function pressKey(e,o,t,s,l){const n=t.keys[s-1];if(!n)return;const[i,a]=keyCentre(o,s);e.animate(n.root,{position:[i,a,1-(l?o.key*KEY_HEIGHT*.55:0)]},{duration:l?.06:.12,easing:l?"easeOut":"back"})}export function shakeCell(e,o,t,s){e.animate(t.cells[s],{shake:.12*o.cell},{duration:.28});const l=t.digits[s];null!=l&&e.animate(l,{shake:.12*o.cell},{duration:.28})}export function flash(e,o,t,s,l){const n=Math.floor(l/9),i=l%9;for(const l of s){const s=cellHeight(o,l===t.selected),a=Math.floor(l/9),r=l%9,[p,d]=cellCentre(o,a,r),h=Math.max(Math.abs(a-n),Math.abs(r-i))*FLASH_STEP;e.animate(t.cells[l],[{position:[p,d,1+s/2+.3*o.cell],at:.35},{position:[p,d,1+s/2]}],{duration:.4,delay:h,easing:"easeOut"});const C=t.digits[l];if(null!=C){const t=.5*o.cell,l=1+s+.6;e.animate(C,[{position:[p,d,l+.3*o.cell],scale:1.2*t,at:.35},{position:[p,d,l],scale:t}],{duration:.4,delay:h,easing:"easeOut"})}}}export function celebrate(e,o){effects.confetti(e,{position:[0,o.boardY,2*o.cell],count:70,size:.2*o.cell,speed:1.3*o.board,lifetime:1.4,gravity:2.2*-o.board,colors:["#FFD700","#4CAF50","#2196F3","#E74C3C"].map(e=>toColor(e))})}export{keyTop,cellTop};
|
|
@@ -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{GAME_DURATION,getLayout,LIGHT}from"./TangramConstants.js";import{createGame,dispose,drag,playAgain,setLayout,setTheme,start,stop,tick}from"./TangramGame.js";import{TOTAL_PIECES}from"./TangramRules.js";import{jsx as
|
|
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{GAME_DURATION,getLayout,LIGHT}from"./TangramConstants.js";import{createGame,dispose,drag,playAgain,setLayout,setTheme,start,stop,tick}from"./TangramGame.js";import{TOTAL_PIECES}from"./TangramRules.js";import{jsx as _0x6df8e5}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.TANGRAM,FEEDBACK={rotate:{sound:SOUNDS.ROTATE,haptic:HapticType.LIGHT},place:{sound:SOUNDS.PLACE,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 Tangram=engineGame(GAME_IDS.TANGRAM,e=>{const[t,s]=useLiveState(0),[a,r]=useLiveState(0),[o,i]=useLiveState(GAME_DURATION),{game:n,theme:m,status:S,screen:p,gameOver:u}=useEngineGame(e,{gameId:GAME_IDS.TANGRAM,create:createGame,start:start,reset:stop,replay:playAgain,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,s,a)=>{const r=getLayout(t,s,a);return setLayout(e,r),r.boardW},drag:drag,sounds:SOUNDS,onStart:e=>e(SOUNDS.START),wire:(e,t)=>{e.onScore=s,e.onPlaced=r,e.onTime=i,e.onEvent=e=>t(FEEDBACK[e].sound,FEEDBACK[e].haptic)}});return _0x6df8e5(EngineGameScreen,{...p,light:LIGHT,columns:[scoreColumn(t),textColumn("PIECES",a+"/"+TOTAL_PIECES),timerColumn(o,m)],subtext:"Fit all seven pieces!",gameOver:u({title:"win"===S?"PUZZLE SOLVED!":"TIME UP!",message:"win"===S?"You reassembled the shape!":"You ran out of time!",scoreLabel:"Score",score:n.score,buttonText:"win"===S?"Next Puzzle!":"Try Again!"})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{effects,extrude,Path,quat,tube}from"@nayan-ui/engine";import{darken}from"../../services/GamesConstants.js";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{cacheGameAsset,createGameMesh as
|
|
1
|
+
"use strict";import{effects,extrude,Path,quat,tube}from"@nayan-ui/engine";import{darken}from"../../services/GamesConstants.js";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{cacheGameAsset,createGameMesh as _0x1f6f8b}from"../shared/EngineMeshes.js";import{placeTiltedBackdrop}from"../shared/EngineTilt.js";import{toColor}from"../shared/EngineUtils.js";import{COLORS,PIECE_DEPTH,RIM_RADIUS,toWorld}from"./TangramConstants.js";import{canonicalShapes}from"./TangramRules.js";const meshes=new Map,cached=(o,t)=>{let e=meshes.get(o);return!e&&(e=cacheGameAsset("tangram/TangramScene:"+o,t),meshes.set(o,e)),e},BACKDROP_DEPTH=30,SLOT_Z=.3,polygon=o=>(new Path).addPolygon(o.map(o=>[o.x,o.y])),loop=(o,t)=>[...o,o[0]].map(o=>[o.x,-o.y,t]),slabMesh=(o,t)=>cached("tg-slab:"+o+":"+t,()=>_0x1f6f8b(extrude(polygon(canonicalShapes(t)[o]),{depth:PIECE_DEPTH}),{center:!1,shine:.45})),rimMesh=(o,t)=>cached("tg-rim:"+o+":"+t,()=>_0x1f6f8b(tube(loop(canonicalShapes(t)[o],0),{radius:RIM_RADIUS,sides:8,smoothness:1,caps:!1}),{center:!1,shine:.3})),slotMesh=(o,t)=>cached("tg-slot:"+o+":"+t,()=>_0x1f6f8b(extrude(polygon(canonicalShapes(t)[o]),{depth:0}),{center:!1}));export const turn=o=>quat.z(-o*Math.PI/180);const slotFill=o=>toColor("classic"===o.mode?COLORS.CLASSIC_SLOT:o.BOARD.CELL_EMPTY),slotEdge=o=>toColor("classic"===o.mode?COLORS.CLASSIC_SLOT_EDGE:o.BOARD.BORDER),rootPosition=(o,t)=>{const[e,n]=toWorld(o,t.x,t.y);return[e,n,.3+t.lift*o.unit]};function spawnSlots(o,t,e,n){const s=[];for(const a of e.pieces){const[r,i]=toWorld(t,a.targetCx,a.targetCy),l=turn(a.targetRot);s.push(o.spawn({mesh:slotMesh(a.type,e.mirror),position:[r,i,.3],rotation:l,scale:t.unit,color:slotFill(n),pickable:!1})),s.push(o.spawn({mesh:rimMesh(a.type,e.mirror),position:[r,i,.3],rotation:l,scale:[t.unit,t.unit,.2*t.unit],color:slotEdge(n),pickable:!1}))}return s}export function buildScene(o,t,e,n,s){const a=spawnBackdrop(o,t.width,t.height,-30,e);placeTiltedBackdrop(o,a,t,30);const r={backdrop:a,slots:spawnSlots(o,t,n,e),tans:[]};return n.pieces.forEach((e,a)=>{const i=s[a],l=o.spawn({mesh:"none",position:rootPosition(t,i),rotation:turn(i.rot),scale:t.unit*i.scale,pickable:!1}),p=o.spawn({mesh:slabMesh(e.type,n.mirror),parent:l,position:[0,0,PIECE_DEPTH/2],color:toColor(e.color),pickable:!1}),u=o.spawn({mesh:rimMesh(e.type,n.mirror),parent:l,position:[0,0,PIECE_DEPTH],color:toColor(darken(e.color,.28)),pickable:!1});r.tans.push({root:l,slab:p,rim:u})}),r}export function removeScene(o,t){for(const e of[t.backdrop,...t.slots,...t.tans.map(o=>o.root)])o.despawn(e)}export function setSceneTheme(o,t,e){setBackdropTheme(o,t.backdrop,e),t.slots.forEach((t,n)=>o.set(t,{color:n%2?slotEdge(e):slotFill(e)}))}export function setPose(o,t,e,n,s){const a=e.tans[n];a&&(o.stopAnimation(a.root),o.set(a.root,{position:rootPosition(t,s),rotation:turn(s.rot),scale:t.unit*s.scale}))}export function moveTo(o,t,e,n,s,a,r="easeOut"){const i=e.tans[n];i&&o.animate(i.root,{position:rootPosition(t,s),rotation:turn(s.rot),scale:t.unit*s.scale},{duration:a,easing:r})}export function enter(o,t,e,n,s){n.forEach((n,a)=>{const r=e.tans[a];r&&(o.stopAnimation(r.root),o.set(r.root,{position:rootPosition(t,n),rotation:turn(n.rot),scale:t.unit*n.scale*.4}),o.animate(r.root,{scale:t.unit*n.scale},{duration:.26,delay:a*s,easing:"back"}))})}export function pop(o,t,e,n,s){const a=e.tans[n];a&&o.animate(a.root,[{scale:1.08*t.unit,at:.3},{scale:t.unit}],{duration:.29,delay:s,easing:"easeOut"})}export function wiggle(o,t,e,n){const s=t.tans[e];s&&o.animate(s.root,[{rotation:turn(n+7)},{rotation:turn(n-7)},{rotation:turn(n+4)},{rotation:turn(n)}],{duration:.26})}export function celebrate(o,t,e,n,s,a){e.tans.forEach((e,n)=>{o.animate(e.root,[{scale:1.1*t.unit,at:.5},{scale:t.unit}],{duration:.27,delay:s+n*a,easing:"easeInOut"})});const r=n.silhouetteRect,[i,l]=toWorld(t,r.x+r.w/2,r.y+r.h/2);effects.confetti(o,{position:[i,l,t.unit],count:60,size:.1*t.unit,speed:1.4*r.w,lifetime:1.3,gravity:2.4*-r.w,colors:n.pieces.slice(0,4).map(o=>toColor(o.color))})}export function dim(o,t,e,n){for(const s of e){const e=t.tans[s];if(!e)continue;const a=toColor(n[s]);o.animate(e.slab,{color:[.45*a[0],.45*a[1],.5*a[2],1]},{duration:.4})}}
|
|
@@ -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,textColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{ENEMIES_PER_LEVEL,FRAME,getLayout,LIGHT,LIVES}from"./Tank1990Constants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,start,tick}from"./Tank1990Game.js";import{jsx as
|
|
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,textColumn}from"../shared/EngineHud.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{ENEMIES_PER_LEVEL,FRAME,getLayout,LIGHT,LIVES}from"./Tank1990Constants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,start,tick}from"./Tank1990Game.js";import{jsx as _0x496f96}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.TANK_1990,ENEMIES_CLASSIC_COLOR="#FFFFFF",scoreFormatter=e=>e.toLocaleString();export const Tank1990=engineGame(GAME_IDS.TANK_1990,e=>{const[t,s]=useLiveState(0),[r,i]=useLiveState(LIVES),[o,a]=useLiveState(ENEMIES_PER_LEVEL),{theme:n,status:S,screen:m,gameOver:E}=useEngineGame(e,{gameId:GAME_IDS.TANK_1990,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,s,r)=>{const i=getLayout(t,s,r);return setLayout(e,i),i.boardWidth+2*Math.min(FRAME,.5*i.cell)},drag:drag,sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.MEDIUM),onOver:(e,t)=>e("win"===t?SOUNDS.WIN:SOUNDS.GAME_OVER,"win"===t?HapticType.SUCCESS:HapticType.HEAVY),wire:(e,t)=>{e.onScore=s,e.onLives=i,e.onEnemies=a,e.onEvent=e=>{"fire"===e?t(SOUNDS.FIRE):"kill"===e?t(SOUNDS.DESTROY,HapticType.SUCCESS):t(SOUNDS.DAMAGE,HapticType.ERROR)}}});return _0x496f96(EngineGameScreen,{...m,light:LIGHT,columns:[scoreColumn(t,"SCORE"),livesColumn(r,LIVES),textColumn("ENEMIES",o,"classic"===n.mode?"#FFFFFF":void 0)],subtext:"Defend your base!",gameOver:E({title:"win"===S?"LEVEL COMPLETE!":"GAME OVER",message:"win"===S?"All enemies destroyed!":"Your base was destroyed!",scoreLabel:"win"===S?"Level Complete!":"Final Score",score:t,formatter:scoreFormatter,buttonText:"win"===S?"Next Level!":"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
|
|
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 _0x2e6058}from"../shared/EngineMeshes.js";import{placeTiltedBackdrop}from"../shared/EngineTilt.js";import{toColor}from"../shared/EngineUtils.js";import{CLASSIC_FIELD,EXPLOSION_TIME,FRAME,GRID_HEIGHT,GRID_LINE,GRID_WIDTH,TANK_RATIO,TURN_TIME}from"./Tank1990Constants.js";const meshes=new Map,cached=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("tank-1990/Tank1990Scene:"+e,o),meshes.set(e,t)),t},rgb=e=>{const[o,t,s]=toColor(e);return[o,t,s]},c4=e=>toColor(e),cube=()=>shapeGeometry("cube"),sphere=()=>shapeGeometry("sphere"),STAND_UP=quat.x(Math.PI/2),HEADING={up:0,left:Math.PI/2,down:Math.PI,right:-Math.PI/2};export const heading=e=>quat.z(HEADING[e]);const FIELD_DEPTH=8,BACKDROP_DEPTH=25;export const toWorld=(e,o,t,s=0)=>[o-e.boardWidth/2,e.boardHeight/2-t,s];const brickMesh=e=>cached("t90-brick-"+(e?1:2),()=>{const o=e?.34:.56,t=rgb(e?"#7A3F1E":"#A0522D"),s=rgb(e?"#9A6040":"#C0764A"),r=[{geometry:cube(),position:[0,0,o/2],scale:[.96,.96,o],color:[...rgb("#2E1A0C"),1]},{geometry:cube(),position:[0,0,(o-.04)/2],scale:[.98,.98,o-.04],color:[...t,1]}];for(let t=0;t<4;t++){const l=(t+.5)/4-.5,i=t%2?-.25:0;for(let a=0;a<3;a++){const n=Math.max(-.48,-.5+i+.5*a+.02),d=Math.min(.48,-.5+i+.5*(a+1)-.02);if(d-n<.06)continue;if(e&&(t+a)%3==0)continue;const p=.9+(7*t+3*a)%5*.04;r.push({geometry:cube(),position:[(n+d)/2,l,o+.025],scale:[d-n,.2,.05],color:[s[0]*p,s[1]*p,s[2]*p,1]})}}return _0x2e6058(merge(r),{center:!1,shine:.1})}),STEEL={edge:"#252B33",body:"#5F6B7A",plate:"#9AA6B4",rivet:"#E6EBF1"},steelMesh=()=>cached("t90-steel-v2",()=>{const e=[{geometry:cube(),position:[0,0,.29],scale:[.98,.98,.58],color:[...rgb(STEEL.edge),1]},{geometry:cube(),position:[0,0,.3],scale:[.9,.9,.6],color:[...rgb(STEEL.body),1]},{geometry:cube(),position:[0,0,.62],scale:[.62,.62,.04],color:[...rgb(STEEL.plate),1]},{geometry:cube(),position:[0,0,.645],scale:[.5,.5,.01],color:[...rgb(STEEL.body),1]}];for(const[o,t]of[[-.36,-.36],[.36,-.36],[-.36,.36],[.36,.36]])e.push({geometry:sphere(),position:[o,t,.6],scale:[.12,.12,.08],color:[...rgb(STEEL.rivet),1]});return _0x2e6058(merge(e),{center:!1,shine:.85})}),baseMesh=()=>cached("t90-base",()=>_0x2e6058(merge([{geometry:shapeGeometry("roundedBox"),position:[0,0,.14],scale:[.92,.92,.28],color:[...rgb("#FFC107"),1]},{geometry:cube(),position:[0,0,.29],scale:[.7,.7,.03],color:[...rgb("#FF8F00"),1]},{geometry:extrude((new Path).addStar(0,0,.32,.14),{depth:.12}),position:[0,0,.36],color:[...rgb("#FFE082"),1]}]),{center:!1,shine:.7})),PLAYER_PAINT={hull:"#FFD700",top:"#FFE44D",track:"#8B7209",turret:"#FFF176",barrel:"#B8860B"},ENEMY_PAINT={hull:"#6B7D94",top:"#8A9AAE",track:"#2E3C4E",turret:"#7A8EA4",barrel:"#4A5E74"},tankMesh=e=>cached("t90-tank-"+(e?"player":"enemy"),()=>{const o=e?PLAYER_PAINT:ENEMY_PAINT,t=[];for(const e of[1,-1]){t.push({geometry:shapeGeometry("roundedBox"),position:[.37*e,0,.13],scale:[.24,1,.26],color:c4(o.track)});for(let o=0;o<6;o++)t.push({geometry:cube(),position:[.37*e,.168*o-.42,.265],scale:[.25,.06,.02],color:[.12,.12,.12,1]})}return t.push({geometry:shapeGeometry("roundedBox"),position:[0,0,.22],scale:[.56,.84,.24],color:c4(o.hull)},{geometry:cube(),position:[0,-.08,.345],scale:[.46,.5,.02],color:c4(o.top)},{geometry:lathe([[.001,.2],[.12,.19],[.2,.14],[.23,.06],[.23,0]],{segments:24}),position:[0,-.04,.34],rotation:STAND_UP,color:c4(o.turret)},{geometry:tube([[0,.12,.43],[0,.66,.43]],{radius:.055,sides:12}),color:c4(o.barrel)},{geometry:tube([[0,.6,.43],[0,.68,.43]],{radius:.075,sides:12}),color:c4(o.barrel)}),_0x2e6058(merge(t),{center:!1,shine:e?.55:.4})}),fieldMesh=(e,o)=>cached("t90-field:"+e.boardWidth+"x"+e.boardHeight+":"+o,()=>_0x2e6058(extrude((new Path).addRoundedRect(-e.boardWidth/2,-e.boardHeight/2,e.boardWidth,e.boardHeight,o),{depth:8}),{shine:.1})),gridMesh=e=>cached("t90-grid:"+e.cell,()=>{const o=[];for(let t=1;t<GRID_WIDTH;t++)o.push({geometry:cube(),position:[t*e.cell-e.boardWidth/2,0,0],scale:[1,e.boardHeight,.2]});for(let t=1;t<GRID_HEIGHT;t++)o.push({geometry:cube(),position:[0,e.boardHeight/2-t*e.cell,0],scale:[e.boardWidth,1,.2]});return _0x2e6058(merge(o),{center:!1})}),frameWidth=e=>Math.min(FRAME,.5*e.cell),frameMesh=e=>cached("t90-frame:"+e.boardWidth+"x"+e.boardHeight,()=>{const o=frameWidth(e),t=.6*e.cell,s=e.boardWidth,r=e.boardHeight,l=(e,t,l,i)=>({geometry:extrude((new Path).addRoundedRect(-s/2-o+e,-r/2-o+e,s+2*(o-e),r+2*(o-e),Math.max(1,.5*o-e)).addRect(-s/2-.2*e,-r/2-.2*e,s+.4*e,r+.4*e),{depth:t,fillRule:"evenodd"}),position:[0,0,i],color:[...rgb(l),1]}),i=[l(0,t,STEEL.body,t/2),l(.22*o,.06*t,STEEL.plate,t+.03*t)],a=(e,s)=>i.push({geometry:sphere(),position:[e,s,t+.06*t],scale:[.3*o,.3*o,.2*o],color:[...rgb(STEEL.rivet),1]}),n=o/2;for(let o=0;o<=GRID_WIDTH;o++){const t=-s/2+o*e.cell;a(t,r/2+n),a(t,-r/2-n)}for(let o=1;o<GRID_HEIGHT;o++){const t=-r/2+o*e.cell;a(-s/2-n,t),a(s/2+n,t)}return _0x2e6058(merge(i),{center:!1,shine:.85})}),fieldColor=e=>toColor("classic"===e.mode?CLASSIC_FIELD:e.BOARD.SURFACE),wallMesh=e=>"brick"===e.type?brickMesh(e.health<2):"steel"===e.type?steelMesh():"base"===e.type?baseMesh():null;export function buildScene(e,o,t,s){const r=spawnBackdrop(e,o.width,o.height,-25,t);return placeTiltedBackdrop(e,r,o,25),{backdrop:r,field:e.spawn({mesh:fieldMesh(o,"classic"===t.mode?10:6),position:[0,0,-4],color:fieldColor(t),pickable:!1}),frame:e.spawn({mesh:frameMesh(o),position:[0,0,0],pickable:!1}),grid:e.spawn({mesh:gridMesh(o),position:[0,0,.15],color:toColor(GRID_LINE),pickable:!1}),walls:s.map((t,s)=>t.map((t,r)=>spawnWall(e,o,t,r,s))),tanks:new Map,bullets:new Map}}function spawnWall(e,o,t,s,r){const l=wallMesh(t);return l?e.spawn({mesh:l,position:toWorld(o,(s+.5)*o.cell,(r+.5)*o.cell),scale:o.cell,pickable:!1}):null}export function removeScene(e,o){const t=[...Array.from(o.tanks.values(),e=>e.body),...Array.from(o.bullets.values())];for(const s of[o.backdrop,o.field,o.frame,o.grid,...t,...o.walls.flat()])null!=s&&e.despawn(s)}export function setSceneTheme(e,o,t,s){setBackdropTheme(e,t.backdrop,s),e.set(t.field,{mesh:fieldMesh(o,"classic"===s.mode?10:6),color:fieldColor(s)})}export function updateWall(e,o,t,s,r,l,i){const a=t.walls[r][s],n=wallMesh(l);null!=a&&n?e.set(a,{mesh:n}):null!=a&&(e.despawn(a),t.walls[r][s]=null),effects.shatter(e,{position:toWorld(o,(s+.5)*o.cell,(r+.5)*o.cell,.5*o.cell),count:n?6:12,size:.14*o.cell,speed:3*o.cell,direction:[0,0,1],spread:1.2,lifetime:.5,gravity:9*-o.cell,colors:"base"===i?[c4("#FFC107"),c4("#FF8F00"),c4("#5A5A5A")]:[c4("#A0522D"),c4("#6B3410"),c4("#C0764A")],flash:!1})}export function rebuildWalls(e,o,t,s){for(const o of t.walls.flat())null!=o&&e.despawn(o);t.walls=s.map((t,s)=>t.map((t,r)=>spawnWall(e,o,t,r,s)))}const SHIELD=[.12,.55,1,.28],SHELL=[2.4,1.5,.45,1],SHELL_GLOW=[2.2,1.1,.3,.45];export function syncUnits(e,o,t,s,r,l){const i=o.cell*TANK_RATIO,a=new Set;for(const r of s){if(!r.isAlive)continue;a.add(r.id);let s=t.tanks.get(r.id);const n=toWorld(o,r.x,r.y);if(!s){const o=e.spawn({mesh:tankMesh(r.isPlayer),position:n,rotation:heading(r.direction),scale:i,pickable:!1});s={body:o,shield:e.spawn({mesh:"sphere",parent:o,position:[0,0,.3],scale:0,color:SHIELD,pickable:!1}),direction:r.direction,shielded:!1,x:r.x,y:r.y},t.tanks.set(r.id,s),e.set(o,{scale:.3*i}),e.animate(o,{scale:i},{duration:.25,easing:"back"})}(s.x!==r.x||s.y!==r.y)&&(e.set(s.body,{position:n}),s.x=r.x,s.y=r.y),s.direction!==r.direction&&(s.direction=r.direction,e.animate(s.body,{rotation:heading(r.direction)},{duration:TURN_TIME,easing:"easeOut"}));const d=l<r.spawnProtectionEndTime;d!==s.shielded&&(s.shielded=d,e.stopAnimation(s.shield),e.set(s.shield,{scale:d?1.45:0}),d&&e.animate(s.shield,{scale:1.6},{duration:.35,repeat:"forever",yoyo:!0,easing:"easeInOut"}))}for(const[o,s]of t.tanks)!a.has(o)&&(e.despawn(s.body),t.tanks.delete(o));const n=new Set,d=e.transforms;for(const s of r){n.add(s.id);const r=toWorld(o,s.x,s.y,.34*o.cell),l=t.bullets.get(s.id);if(null==l){const l=e.spawn({mesh:"sphere",position:r,scale:.24*o.cell,color:SHELL,pickable:!1});e.spawn({mesh:"puff",parent:l,scale:2.4,color:SHELL_GLOW,pickable:!1}),t.bullets.set(s.id,l)}else d.position(l,r[0],r[1],r[2])}d.flush();for(const[o,s]of t.bullets)!n.has(o)&&(e.despawn(s),t.bullets.delete(o))}export function muzzleFlash(e,o,t){const s=o.cell*TANK_RATIO,r=s/2+.5*s,[l,i]="up"===t.direction?[0,-1]:"down"===t.direction?[0,1]:"left"===t.direction?[-1,0]:[1,0];effects.dust(e,{position:toWorld(o,t.x+l*r,t.y+i*r,.43*s),count:3,size:.35*s,speed:1.5*s,direction:[l,-i,.3],spread:.5,lifetime:.1,color:[[2.6,2.6,2.2,.95],[2.4,2,.8,.8]],endSize:1.8})}export function explode(e,o,t,s,r){const l=o.cell*(r?.9:.5);effects.explosion(e,{position:toWorld(o,t,s,.4*o.cell),count:r?22:10,size:l,speed:l*(r?3:2),lifetime:EXPLOSION_TIME,direction:[0,0,1],spread:1.3,gravity:10*-o.cell,debris:r?[c4("#3E4A58"),c4("#FFB74D"),c4("#5A5A5A")]:void 0})}
|
|
@@ -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,isTablet}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{textColumn,timerColumn}from"../shared/EngineHud.js";import{toRgb}from"../shared/EngineUtils.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{COLORS,getLayout,LIGHT,TIME_LIMIT}from"./TicTacToeConstants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,shownScore,start,tick}from"./TicTacToeGame.js";import{jsx as
|
|
1
|
+
"use strict";import{useMemo}from"react";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{textColumn,timerColumn}from"../shared/EngineHud.js";import{toRgb}from"../shared/EngineUtils.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{COLORS,getLayout,LIGHT,TIME_LIMIT}from"./TicTacToeConstants.js";import{createGame,dispose,drag,reset,setLayout,setTheme,shownScore,start,tick}from"./TicTacToeGame.js";import{jsx as _0x20ba27}from"react/jsx-runtime";const SOUNDS=GAME_SOUNDS.TIC_TAC_TOE,LOW_TIME=30,FEEDBACK={place:{sound:SOUNDS.PLACE,haptic:HapticType.LIGHT},robot:{sound:SOUNDS.ROBOT,haptic:HapticType.LIGHT},win:{sound:SOUNDS.WIN,haptic:HapticType.SUCCESS},lose:{sound:SOUNDS.LOSE,haptic:HapticType.ERROR},draw:{sound:SOUNDS.DRAW,haptic:HapticType.MEDIUM}},TITLES={win:["YOU WON!","You beat the robot!"],lose:["YOU LOST!","The robot wins!"],draw:["DRAW!","Nobody wins this round!"],timeout:["TIME UP!","You ran out of time!"]};export const TicTacToe=engineGame(GAME_IDS.TIC_TAC_TOE,e=>{const[t,o]=useLiveState("O"),[s,r]=useLiveState(TIME_LIMIT),{game:i,theme:a,screen:n,gameOver:m}=useEngineGame(e,{gameId:GAME_IDS.TIC_TAC_TOE,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,o,s)=>{const r=getLayout(t,o,s,isTablet);return setLayout(e,r),r.size+2*r.pad},drag:drag,outcome:e=>"win"===e.result?"win":"draw"===e.result?"draw":"lose",reportScore:(e,t)=>"win"===t?e.finalScore:0,sounds:SOUNDS,onStart:e=>e(SOUNDS.START,HapticType.MEDIUM),onOver:(e,t,o)=>{"timeout"===o.result&&e(SOUNDS.TIME_UP,HapticType.ERROR)},wire:(e,t)=>{e.onTurn=o,e.onTime=r,e.onEvent=e=>t(FEEDBACK[e].sound,FEEDBACK[e].haptic)}}),T=useMemo(()=>toRgb(a.BACKGROUND),[a.BACKGROUND]),[S,u]=TITLES[i.result??"timeout"];return _0x20ba27(EngineGameScreen,{...n,light:LIGHT,background:T,columns:[textColumn("YOU","O",COLORS.O_BADGE),timerColumn(s,a,30,"O"===t?"YOUR TURN":"AI THINKING..."),textColumn("AI","X",COLORS.X_BADGE)],subtext:"Play vs Robot!",gameOver:m({title:S,message:u,scoreLabel:"Final Score",score:shownScore(i),buttonText:"Play Again!"})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{effects,extrude,merge,Path,quat,tube}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{popBurst}from"../shared/EngineBlasts.js";import{cacheGameAsset,createGameMesh as
|
|
1
|
+
"use strict";import{effects,extrude,merge,Path,quat,tube}from"@nayan-ui/engine";import{setBackdropTheme,spawnBackdrop}from"../shared/EngineBackdrop.js";import{popBurst}from"../shared/EngineBlasts.js";import{cacheGameAsset,createGameMesh as _0x3e2fc4}from"../shared/EngineMeshes.js";import{placeTiltedBackdrop}from"../shared/EngineTilt.js";import{toColor}from"../shared/EngineUtils.js";import{cellCentre,COLORS}from"./TicTacToeConstants.js";const meshes=new Map,cached=(e,o)=>{let t=meshes.get(e);return!t&&(t=cacheGameAsset("tic-tac-toe/TicTacToeScene:"+e,o),meshes.set(e,t)),t},BOARD_DEPTH=12,BACKDROP_DEPTH=30,STROKE=.075,SPAN=.23,BAR=.1,WIN_GOLD=toColor(COLORS.WIN),xMesh=()=>cached("ttt-x-v2",()=>{const e=(e,o)=>({geometry:tube([e,o],{radius:.075,sides:16,smoothness:2,caps:!0})});return _0x3e2fc4(merge([e([-.23,-.23,.075],[.23,.23,.075]),e([.23,-.23,.0765],[-.23,.23,.0765])]),{center:!1,shine:.75})}),oMesh=()=>cached("ttt-o-v2",()=>{const e=Array.from({length:41},(e,o)=>{const t=o/40*Math.PI*2;return[.23*Math.cos(t),.23*Math.sin(t),.075]});return _0x3e2fc4(tube(e,{radius:.075,sides:16,smoothness:2,caps:!1}),{center:!1,shine:.75})}),panelMesh=(e,o,t,s=0)=>cached("ttt-panel:"+e+":"+o+":"+t+":"+s,()=>_0x3e2fc4(extrude((new Path).addRoundedRect(-e/2,-e/2,e,e,o),{depth:t}),{shine:s})),pieceColor=e=>toColor("X"===e?COLORS.X:COLORS.O);function spawnBoard(e,o,t){const s=[],l=o=>s.push(e.spawn({pickable:!1,...o})),a=o.size+2*o.pad,n="classic"===t.mode,r=Math.max(6,.075*o.cell),i=.1*o.cell;if(n){l({mesh:panelMesh(a,14,12),position:[0,0,-6],color:toColor(COLORS.FRAME)}),l({mesh:panelMesh(o.size+4,10,1),position:[0,0,.4],color:toColor(COLORS.WELL)}),l({mesh:panelMesh(o.size,6,1),position:[0,0,.8],color:toColor(COLORS.SURFACE)});for(let e=0;e<9;e++)if((Math.floor(e/3)+e)%2==1){const[t,s]=cellCentre(o,e);l({mesh:"cube",position:[t,s,1.3],scale:[o.cell,o.cell,.02],color:toColor(COLORS.SURFACE_ALT)})}}else{l({mesh:panelMesh(a,8,12),position:[0,0,-6],color:toColor(t.BOARD.SURFACE)});for(let e=0;e<9;e++){const[s,a]=cellCentre(o,e);l({mesh:panelMesh(Math.round(o.cell-2*r),10,3),position:[s,a,1.5],scale:1,color:toColor(t.BOARD.CELL_EMPTY)})}}const p=toColor(n?COLORS.GRID:t.BOARD.GRID_LINE),h=[0,0,0,.18],u=o.size-.16*o.cell,d=quat.z(Math.PI/2);for(const e of[-.5,.5])l({mesh:"capsule",position:[e*o.cell+.25*r,.25*-r,1.05],scale:[1.5*r,u,.6],color:h}),l({mesh:"capsule",position:[.25*r,e*o.cell-.25*r,1.05],rotation:d,scale:[1.5*r,u,.6],color:h}),l({mesh:"capsule",position:[e*o.cell,0,1+i/2],scale:[r,u,i],color:p}),l({mesh:"capsule",position:[0,e*o.cell,1+i/2],rotation:d,scale:[r,u,i],color:p});return s}export function buildScene(e,o,t,s){const l=spawnBackdrop(e,o.width,o.height,-30,t);placeTiltedBackdrop(e,l,o,30);const a=e.spawn({mesh:oMesh(),scale:0,color:toColor(COLORS.O,.35),pickable:!1}),n={backdrop:l,board:spawnBoard(e,o,t),pieces:Array(9).fill(null),ghost:a,line:null};return s.forEach((t,s)=>{t&&place(e,o,n,s,t,!1)}),n}export function removeScene(e,o){for(const t of[o.backdrop,...o.board,...o.pieces,o.ghost,o.line])null!=t&&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,s)}const BOARD_TOP=1;export function place(e,o,t,s,l,a=!0){const[n,r]=cellCentre(o,s),i=e.spawn({mesh:"X"===l?xMesh():oMesh(),position:[n,r,BOARD_TOP],rotation:quat.z(a?"X"===l?-.6:.6:0),scale:a?0:o.cell,color:pieceColor(l),pickable:!1});e.spawn({mesh:"sphere",parent:i,position:[.04,-.04,.01],scale:[.23*2.5,.23*2.5,.01],color:[0,0,0,.2],pickable:!1}),a&&(e.animate(i,[{scale:1.18*o.cell,at:.6},{scale:.94*o.cell,at:.82},{scale:o.cell}],{duration:.36,easing:"easeOut"}),e.animate(i,{rotation:[0,0,0,1]},{duration:.3,easing:"easeOut"}),e.after(.2,()=>popBurst(e,{position:[n,r,BOARD_TOP+.15*o.cell],size:.7*o.cell,color:pieceColor(l),count:7}))),t.pieces[s]=i,hideGhost(e,t)}export function showGhost(e,o,t,s){const[l,a]=cellCentre(o,s);e.set(t.ghost,{position:[l,a,BOARD_TOP+.5],scale:.92*o.cell}),e.animate(t.ghost,{scale:.98*o.cell},{duration:.5,repeat:"forever",yoyo:!0,easing:"easeInOut"})}export function hideGhost(e,o){e.stopAnimation(o.ghost),e.set(o.ghost,{scale:0})}export function markWin(e,o,t,s){s.forEach((s,l)=>{const a=t.pieces[s];if(null==a)return;const[n,r]=cellCentre(o,s);e.animate(a,{color:WIN_GOLD},{duration:.25,delay:.08*l}),e.animate(a,[{position:[n,r,BOARD_TOP+.35*o.cell],at:.4},{position:[n,r,BOARD_TOP]}],{duration:.45,delay:.08*l,easing:"easeOut"})});const[l,a]=cellCentre(o,s[0]),[n,r]=cellCentre(o,s[2]),i=Math.hypot(n-l,r-a)+.5*o.cell,p=Math.atan2(r-a,n-l),h=.07*o.cell,u=BOARD_TOP+.075*o.cell*2+h,d=quat.z(p-Math.PI/2);t.line=e.spawn({mesh:"capsule",position:[(l+n)/2,(a+r)/2,u],rotation:d,scale:[2*h,.01,2*h],color:[1.6,1.25,.3,1],pickable:!1}),e.animate(t.line,{scale:[2*h,i,2*h]},{duration:.32,delay:.15,easing:"easeOut"}),e.animate(t.line,{color:[1.2,.95,.25,1]},{duration:.6,delay:.5,easing:"easeInOut",repeat:"forever",yoyo:!0}),effects.sparkle(e,{position:[(l+n)/2,(a+r)/2,u+4],count:30,size:.06*o.cell,speed:2.5*o.cell,lifetime:.7,gravity:2*-o.cell,colors:["#FFD54F","#FFC107","#FFFFFF"].map(e=>toColor(e))})}export function shrug(e,o,t){for(const s of t.pieces)null!=s&&e.animate(s,{shake:.04*o.cell},{duration:.4})}export function clearPieces(e,o){for(const t of o.pieces)null!=t&&(e.stopAnimation(t),e.set(t,{lifetime:.25}));o.pieces=Array(9).fill(null),null!=o.line&&e.despawn(o.line),o.line=null,hideGhost(e,o)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{formatTime,GAME_IDS}from"../../services/UtilsService.js";import{getFruit,isFruitBuilt}from"../shared/EngineFruits.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,LIGHT,POINTS_PER_SET,TILE_TYPES,TIME_LIMIT,TOTAL_SETS}from"./TileHomeConstants.js";import{addFruit,createGame,dispose,reset,setLayout,setTheme,start,tap,tick}from"./TileHomeGame.js";import{jsx as
|
|
1
|
+
"use strict";import{HapticType}from"../../services/HapticsService.js";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{formatTime,GAME_IDS}from"../../services/UtilsService.js";import{getFruit,isFruitBuilt}from"../shared/EngineFruits.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{getLayout,LIGHT,POINTS_PER_SET,TILE_TYPES,TIME_LIMIT,TOTAL_SETS}from"./TileHomeConstants.js";import{addFruit,createGame,dispose,reset,setLayout,setTheme,start,tap,tick}from"./TileHomeGame.js";import{jsx as _0xf5e5ab}from"react/jsx-runtime";const SFX=GAME_SOUNDS.TILE_HOME,formatScore=e=>e.toLocaleString(),FRUIT_DETAIL=.25;export const TileHome=engineGame(GAME_IDS.TILE_HOME,e=>{const[t,r]=useLiveState(0),[i,a]=useLiveState(TIME_LIMIT),{status:s,screen:o,gameOver:n}=useEngineGame(e,{gameId:GAME_IDS.TILE_HOME,create:createGame,start:start,reset:reset,dispose:dispose,tick:tick,setTheme:setTheme,resize:(e,t,r,i)=>{const a=getLayout(t,r,i);return setLayout(e,a),a.boardWidth},tap:tap,onStart:e=>e(SFX.START,HapticType.MEDIUM),wire:(e,t)=>{e.onScore=r,e.onTime=a,e.onPick=()=>t(SFX.PICK,HapticType.LIGHT),e.onMatch=()=>t(SFX.MATCH,HapticType.MEDIUM),e.onWin=()=>t(SFX.WIN,HapticType.SUCCESS),e.onLose=()=>t(SFX.GAME_OVER,HapticType.HEAVY);const i=[...new Set(TILE_TYPES.map(e=>e.fruit))];for(const t of i)isFruitBuilt(t,.25)&&addFruit(e,t,getFruit(t,.25));const s=i.filter(e=>!isFruitBuilt(e,.25));let o=0;const n=()=>{const t=s.shift();t&&!e.world.isDisposed&&(addFruit(e,t,getFruit(t,.25)),s.length&&(o=requestAnimationFrame(n)))};return s.length&&(o=requestAnimationFrame(n)),()=>{o&&cancelAnimationFrame(o)}}}),m=Math.max(0,TOTAL_SETS-Math.floor(t/POINTS_PER_SET));return _0xf5e5ab(EngineGameScreen,{...o,light:LIGHT,columns:[{label:"SCORE",value:formatScore(t)},{label:"SETS",value:String(m)},{label:"TIME",value:formatTime(Math.max(0,Math.ceil(i)))}],subtext:"Match tiles!",gameOver:n({title:"win"===s?"YOU WON!":"TIME UP!",message:"win"===s?"All tiles sorted home!":"You ran out of time!",scoreLabel:"win"===s?"You Won!":"Game Over",score:t,formatter:formatScore,buttonText:"win"===s?"Play Again!":"Try Again!"})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{extrude,Path}from"@nayan-ui/engine";import{spawnBackdrop}from"../shared/EngineBackdrop.js";import{spawnRaisedBlock}from"../shared/EngineBlocks.js";import{cacheGameAsset,createGameMesh as
|
|
1
|
+
"use strict";import{extrude,Path}from"@nayan-ui/engine";import{spawnBackdrop}from"../shared/EngineBackdrop.js";import{spawnRaisedBlock}from"../shared/EngineBlocks.js";import{cacheGameAsset,createGameMesh as _0x2d5681}from"../shared/EngineMeshes.js";import{toColor}from"../shared/EngineUtils.js";import{CLASSIC_BOARD,CLASSIC_SLOT,CLASSIC_SLOT_BORDER,CLASSIC_TRAY,CLASSIC_TRAY_BORDER,SLOT_CAPACITY,slotOrigin,TILE_FACE,TILE_THICKNESS}from"./TileHomeConstants.js";export const Z_BACKDROP=1;const Z_PANELS=4,Z_LAYER=120,Z_TILE_BASE=20;export const Z_FLYING=420;const FRUIT_LIFT=32,SHADE_LIFT=70;export const layerZ=e=>20+120*e;export const trayZ=20;export const toWorld=(e,t,o,s=0)=>[t-e.width/2,e.height/2-o,s];const meshes=new Map,cached=(e,t)=>{let o=meshes.get(e);return!o&&(o=cacheGameAsset("tile-home/TileHomeScene:"+e,t),meshes.set(e,o)),o};function flatLayer(e,t,o){const s=extrude(e,{depth:0,fillRule:"evenodd"}),r=s.vertices;for(let e=0;e<r.length;e+=11){const[s,a,n]=o(r[e],-r[e+1]);r[e+2]=t,r[e+6]=s,r[e+7]=a,r[e+8]=n}return s}const shadeMesh=e=>cached("shade:"+e,()=>_0x2d5681(flatLayer((new Path).addRoundedRect(0,0,e,e,8),0,()=>[1,1,1]),{center:!1})),panelMesh=(e,t,o,s=0)=>cached("panel:"+e+":"+t+":"+o+":"+s,()=>{const r=(new Path).addRoundedRect(0,0,e,t,o);return s>0&&r.addRoundedRect(s,s,e-2*s,t-2*s,o-s),_0x2d5681(flatLayer(r,0,()=>[1,1,1]),{center:!1})});export function buildScenery(e,t,o){const s="classic"===o.mode,r=[spawnBackdrop(e,t.width,t.height,1,o)],a=(o,s,a,n,i,d,l=0,h=4)=>r.push(e.spawn({mesh:panelMesh(a,n,i,l),position:toWorld(t,o,s,h),color:toColor(d),pickable:!1})),n=s?16:8;a(t.boardLeft,t.boardTop,t.boardWidth,t.boardHeight,n,s?CLASSIC_BOARD:o.BOARD.SURFACE),s||a(t.boardLeft,t.boardTop,t.boardWidth,t.boardHeight,n,o.BOARD.BORDER,1,4.2);const i=s?12:8;a(t.trayLeft,t.trayTop,t.trayWidth,t.trayHeight,i,s?CLASSIC_TRAY:o.BOARD.SURFACE),a(t.trayLeft,t.trayTop,t.trayWidth,t.trayHeight,i,s?CLASSIC_TRAY_BORDER:o.BOARD.BORDER,1,4.2);for(let e=0;e<SLOT_CAPACITY;e++){const[r,n]=slotOrigin(t,e);a(r,n,t.slot,t.slot,8,s?CLASSIC_SLOT:o.BOARD.CELL_EMPTY,0,4.4),a(r,n,t.slot,t.slot,8,s?CLASSIC_SLOT_BORDER:o.BOARD.BORDER,1.5,4.6)}return r}export function spawnTile(e,t,o,s,r,a,n){const i=t.tile,d=[-i/2,i/2,0],l=i*TILE_THICKNESS,h=e.spawn({mesh:"none",position:toWorld(t,s,r,a),scale:n,pickable:!1}),p=spawnRaisedBlock(e,{parent:h,position:[0,0,-l/2],size:[i,i,l],color:toColor(TILE_FACE),gloss:!1,shadow:!1}),R=e.spawn({mesh:shadeMesh(i),parent:h,position:[d[0],d[1],70],color:[0,0,0,0],pickable:!1}),A=o?addTileFruit(e,t,h,o,!1):null;return{root:h,shade:R,fruit:A,parts:null==A?[p]:[p,A]}}export function addTileFruit(e,t,o,s,r){const a=t.fruit/Math.max(s.whole.size[0],s.whole.size[1]),n=e.spawn({mesh:s.whole,parent:o,position:[-s.center[0]*a,1-s.center[1]*a,32-s.center[2]*a],scale:r?0:a,color:[1,1,1,1],pickable:!1});return r&&e.animate(n,{scale:a},{duration:.22,easing:"back"}),n}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{c as
|
|
1
|
+
"use strict";import{c as _0x467c33}from"react/compiler-runtime";import{memo,useCallback,useEffect,useMemo,useState}from"react";import{StyleSheet,View}from"react-native";import{haptics}from"@nayan-ui/engine";import{GAME_SOUNDS}from"../../services/SoundsService.js";import{GAME_IDS}from"../../services/UtilsService.js";import{engineGame,EngineGameScreen}from"../shared/EngineGameScreen.js";import{getSceneInputInsets,livesColumn,scoreColumn,textColumn}from"../shared/EngineHud.js";import{EngineTouchSurface}from"../shared/EngineTouchSurface.js";import{GameLoading}from"../shared/GameLoading.js";import{GameLoadingTransition}from"../shared/GameLoadingTransition.js";import{useEngineGame}from"../shared/useEngineGame.js";import{useLiveState}from"../shared/useLiveState.js";import{ENEMY_COUNT,GEM_GOAL,getCachedAssets,loadAssets,MAX_HEALTH,MINIMAP_SIZE,NATURE_LIGHT,NIGHT_LIGHT,NIGHT_SKY,SKY}from"./TreasureHuntConstants.js";import{endSwipe,moveSwipe,resetSwipe,startSwipe}from"./TreasureHuntControls.js";import{clearInput,createGame,dispose,punch,reset,start,update}from"./TreasureHuntGame.js";import{drawMiniMap}from"./TreasureHuntScene.js";import{jsx as _0x2b7b69,jsxs as _0x4851c5}from"react/jsx-runtime";const Run=memo(function(e){const{settings:t}=e,[s,n]=useLiveState(null,0),[a,r]=useState(null),{game:o,theme:i,phase:m,status:u,screen:p,gameOver:d}=useEngineGame(e,{gameId:GAME_IDS.TREASURE_HUNT,create:()=>createGame(e.assets),start:start,reset:reset,dispose:dispose,tick:update,hud:(e,t)=>drawMiniMap(t,e.state),resultsDelay:e=>"win"===e?1500:1200,reportData:e=>({gems:e.state.gems,defeated:e.state.defeated,seconds:Math.floor(e.state.time)}),sounds:GAME_SOUNDS.TREASURE_HUNT,onStart:e=>e(GAME_SOUNDS.TREASURE_HUNT.START),onOver:(e,t)=>{"win"!==t&&e(GAME_SOUNDS.TREASURE_HUNT.LOSE)},wire:e=>{e.onChange=()=>n({...snapshot(e.state),preparing:e.preparing}),e.onChange()}});useEffect(()=>{haptics.enabled=t.enableHaptics},[t.enableHaptics]),useEffect(()=>()=>{haptics.enabled=!0},[]);const l=useCallback(e=>{e||(clearInput(o),o.footsteps.stop(),o.movementReference.active=!1)},[o]),S=useCallback(()=>punch(o),[o]),E=useCallback(e=>r(e.message),[]),g=useMemo(()=>getSceneInputInsets(t.offset),[t.offset]),f="dark"===i.mode,T=o.preparing,h=T&&!!o.nextRun,_="playing"===m&&!T;return _0x4851c5(EngineGameScreen,{...p,onStart:()=>{o.preparing||p.onStart()},hudCapacity:MINIMAP_SIZE*MINIMAP_SIZE+1024,light:f?NIGHT_LIGHT:NATURE_LIGHT,background:f?NIGHT_SKY:SKY,fog:.006,errorMessage:a??void 0,onAudioChange:l,onError:E,columns:[scoreColumn(s?.score??0),livesColumn(s?.health??MAX_HEALTH,MAX_HEALTH,"HEALTH"),textColumn("GEMS",(s?.gems??0)+"/"+GEM_GOAL),textColumn("ROBOTS",(s?.defeated??0)+"/"+ENEMY_COUNT)],subtext:"Swipe to explore \xb7 Tap to punch",gameOver:d({title:"win"===u?"FOREST EXPLORED!":"EXPEDITION OVER",message:(s?.gems??0)+" diamonds found and "+(s?.defeated??0)+" robots defeated.",scoreLabel:"Adventure score",score:s?.score??0,buttonText:"Explore Again!"}),children:[_0x2b7b69(SwipeNavigation,{input:o.swipe,enabled:_&&!t.isVisible&&!a,onTap:S,insets:g}),_0x2b7b69(View,{pointerEvents:h?"auto":"none",style:StyleSheet.absoluteFill,children:_0x2b7b69(GameLoadingTransition,{ready:!h,loader:_0x2b7b69(GameLoading,{gameId:GAME_IDS.TREASURE_HUNT,theme:t.theme,offset:t.offset,visible:!t.isVisible}),children:null})})]})});export const TreasureHunt=engineGame(GAME_IDS.TREASURE_HUNT,e=>{const[t,s]=useState(getCachedAssets),[n,a]=useState(null);return useEffect(()=>{if(t)return;let e=!0;return loadAssets().then(t=>{e&&s(t)}).catch(t=>{e&&a(t instanceof Error?t.message:String(t))}),()=>{e=!1}},[t]),_0x2b7b69(GameLoadingTransition,{ready:!!t,loader:_0x2b7b69(GameLoading,{gameId:GAME_IDS.TREASURE_HUNT,theme:e.settings.theme,offset:e.settings.offset,error:!!n,message:n??void 0}),children:t&&_0x2b7b69(Run,{...e,assets:t})})});function snapshot(e){return{health:e.health,gems:e.gems,defeated:e.defeated,score:e.score}}const SwipeNavigation=memo(function(e){const t=_0x467c33(17),{input:s,enabled:n,onTap:a,insets:r}=e;let o;t[0]!==s?(o=e=>{startSwipe(s,e,e.timeStamp)},t[0]=s,t[1]=o):o=t[1];const i=o;let m;t[2]!==s?(m=e=>{moveSwipe(s,e)},t[2]=s,t[3]=m):m=t[3];const u=m;let p;t[4]!==n||t[5]!==s||t[6]!==a?(p=e=>{endSwipe(s,e,e.timeStamp)&&n&&a()},t[4]=n,t[5]=s,t[6]=a,t[7]=p):p=t[7];const d=p;let l;t[8]!==s?(l=()=>resetSwipe(s),t[8]=s,t[9]=l):l=t[9];const S=l;let E;return t[10]!==n||t[11]!==r||t[12]!==S||t[13]!==d||t[14]!==u||t[15]!==i?(E=_0x2b7b69(EngineTouchSurface,{enabled:n,insets:r,onStart:i,onMove:u,onEnd:d,onCancel:S}),t[10]=n,t[11]=r,t[12]=S,t[13]=d,t[14]=u,t[15]=i,t[16]=E):E=t[16],E});
|