react-native-games 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/module/games/balloon-blaster/BalloonBlaster.js +1 -1
- package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js +1 -1
- package/lib/module/games/balloon-blaster/BalloonBlasterService.js +1 -1
- package/lib/module/games/balloon-blaster/BalloonBlasterStore.js +1 -1
- package/lib/module/games/balloon-blaster/components/BalloonComponent.js +1 -1
- package/lib/module/games/balloon-blaster/components/GameArea.js +1 -1
- package/lib/module/games/balloon-blaster/components/GameBackground.js +1 -1
- package/lib/module/games/balloon-blaster/components/ScoreBoard.js +1 -1
- package/lib/module/games/balloon-blaster/components/index.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/BikeRacingService.js +1 -1
- package/lib/module/games/bike-racing/BikeRacingStore.js +1 -1
- package/lib/module/games/bike-racing/components/BikeComponent.js +1 -1
- package/lib/module/games/bike-racing/components/GameBackground.js +1 -1
- package/lib/module/games/bike-racing/components/ScoreBoard.js +1 -1
- package/lib/module/games/bike-racing/components/index.js +1 -1
- package/lib/module/games/bike-racing/index.js +1 -1
- package/lib/module/games/block-blast/BlockBlast.js +1 -1
- package/lib/module/games/block-blast/BlockBlastConstants.js +1 -1
- package/lib/module/games/block-blast/BlockBlastService.js +1 -1
- package/lib/module/games/block-blast/BlockBlastStore.js +1 -1
- package/lib/module/games/block-blast/components/BlockPieceComponent.js +1 -1
- package/lib/module/games/block-blast/components/GameArea.js +1 -1
- package/lib/module/games/block-blast/components/GameBackground.js +1 -1
- package/lib/module/games/block-blast/components/GridComponent.js +1 -1
- package/lib/module/games/block-blast/components/ScoreBoard.js +1 -1
- package/lib/module/games/block-blast/components/index.js +1 -1
- package/lib/module/games/block-blast/index.js +1 -1
- package/lib/module/games/bubble-shooter/BubbleShooter.js +1 -1
- package/lib/module/games/bubble-shooter/BubbleShooterConstants.js +1 -1
- package/lib/module/games/bubble-shooter/BubbleShooterService.js +1 -1
- package/lib/module/games/bubble-shooter/BubbleShooterStore.js +1 -1
- package/lib/module/games/bubble-shooter/components/GameArea.js +1 -1
- package/lib/module/games/bubble-shooter/components/GameBackground.js +1 -1
- package/lib/module/games/bubble-shooter/components/ScoreBoard.js +1 -1
- package/lib/module/games/bubble-shooter/components/index.js +1 -1
- package/lib/module/games/bubble-shooter/index.js +1 -1
- package/lib/module/games/candy-crush/CandyCrush.js +1 -1
- package/lib/module/games/candy-crush/CandyCrushConstants.js +1 -1
- package/lib/module/games/candy-crush/CandyCrushService.js +1 -1
- package/lib/module/games/candy-crush/CandyCrushStore.js +1 -1
- package/lib/module/games/candy-crush/components/CandyItem.js +1 -1
- package/lib/module/games/candy-crush/components/GameBackground.js +1 -1
- package/lib/module/games/candy-crush/components/GameGrid.js +1 -1
- package/lib/module/games/candy-crush/components/ScoreBoard.js +1 -1
- package/lib/module/games/candy-crush/components/index.js +1 -1
- package/lib/module/games/candy-crush/index.js +1 -1
- package/lib/module/games/car-racing/CarRacing.js +1 -1
- package/lib/module/games/car-racing/CarRacingConstants.js +1 -1
- package/lib/module/games/car-racing/CarRacingService.js +1 -1
- package/lib/module/games/car-racing/CarRacingStore.js +1 -1
- package/lib/module/games/car-racing/components/CarComponent.js +1 -1
- package/lib/module/games/car-racing/components/GameBackground.js +1 -1
- package/lib/module/games/car-racing/components/ScoreBoard.js +1 -1
- package/lib/module/games/car-racing/components/index.js +1 -1
- package/lib/module/games/colors-sort/ColorsSort.js +1 -1
- package/lib/module/games/colors-sort/ColorsSortConstants.js +1 -1
- package/lib/module/games/colors-sort/ColorsSortService.js +1 -1
- package/lib/module/games/colors-sort/ColorsSortStore.js +1 -1
- package/lib/module/games/colors-sort/components/ColorContainer.js +1 -1
- package/lib/module/games/colors-sort/components/GameBackground.js +1 -1
- package/lib/module/games/colors-sort/components/ScoreBoard.js +1 -1
- package/lib/module/games/colors-sort/components/index.js +1 -1
- package/lib/module/games/dino-jump/DinoJump.js +1 -1
- package/lib/module/games/dino-jump/DinoJumpConstants.js +1 -1
- package/lib/module/games/dino-jump/DinoJumpService.js +1 -1
- package/lib/module/games/dino-jump/DinoJumpStore.js +1 -1
- package/lib/module/games/dino-jump/components/DinoSprite.js +1 -1
- package/lib/module/games/dino-jump/components/GameArea.js +1 -1
- package/lib/module/games/dino-jump/components/GameBackground.js +1 -1
- package/lib/module/games/dino-jump/components/ObstacleSprite.js +1 -1
- package/lib/module/games/dino-jump/components/ScoreBoard.js +1 -1
- package/lib/module/games/dino-jump/components/StarSprite.js +1 -1
- package/lib/module/games/dino-jump/components/index.js +1 -1
- package/lib/module/games/flappy-bird/FlappyBird.js +1 -1
- package/lib/module/games/flappy-bird/FlappyBirdConstants.js +1 -1
- package/lib/module/games/flappy-bird/FlappyBirdStore.js +1 -1
- package/lib/module/games/flappy-bird/components/Bird.js +1 -1
- package/lib/module/games/flappy-bird/components/GameArea.js +1 -1
- package/lib/module/games/flappy-bird/components/GameBackground.js +1 -1
- package/lib/module/games/flappy-bird/components/Pipes.js +1 -1
- package/lib/module/games/flappy-bird/components/ScoreBoard.js +1 -1
- package/lib/module/games/flappy-bird/components/index.js +1 -1
- package/lib/module/games/fruit-merger/FruitMerger.js +1 -1
- package/lib/module/games/fruit-merger/FruitMergerConstants.js +1 -1
- package/lib/module/games/fruit-merger/FruitMergerService.js +1 -1
- package/lib/module/games/fruit-merger/FruitMergerStore.js +1 -1
- package/lib/module/games/fruit-merger/components/FruitItem.js +1 -1
- package/lib/module/games/fruit-merger/components/GameArea.js +1 -1
- package/lib/module/games/fruit-merger/components/GameBackground.js +1 -1
- package/lib/module/games/fruit-merger/components/ScoreBoard.js +1 -1
- package/lib/module/games/fruit-merger/components/index.js +1 -1
- package/lib/module/games/fruit-ninja/FruitNinja.js +1 -1
- package/lib/module/games/fruit-ninja/FruitNinjaConstants.js +1 -1
- package/lib/module/games/fruit-ninja/FruitNinjaService.js +1 -1
- package/lib/module/games/fruit-ninja/FruitNinjaStore.js +1 -1
- package/lib/module/games/fruit-ninja/components/FruitComponent.js +1 -1
- package/lib/module/games/fruit-ninja/components/GameArea.js +1 -1
- package/lib/module/games/fruit-ninja/components/GameBackground.js +1 -1
- package/lib/module/games/fruit-ninja/components/ScoreBoard.js +1 -1
- package/lib/module/games/fruit-ninja/components/index.js +1 -1
- package/lib/module/games/game-2048/Game2048.js +1 -1
- package/lib/module/games/game-2048/Game2048Constants.js +1 -1
- package/lib/module/games/game-2048/Game2048Service.js +1 -1
- package/lib/module/games/game-2048/Game2048Store.js +1 -1
- package/lib/module/games/game-2048/components/GameBackground.js +1 -1
- package/lib/module/games/game-2048/components/GameGrid.js +1 -1
- package/lib/module/games/game-2048/components/GameTile.js +1 -1
- package/lib/module/games/game-2048/components/ScoreBoard.js +1 -1
- package/lib/module/games/game-2048/components/index.js +1 -1
- package/lib/module/games/maze-runner/MazeRunner.js +1 -1
- package/lib/module/games/maze-runner/MazeRunnerConstants.js +1 -1
- package/lib/module/games/maze-runner/MazeRunnerService.js +1 -1
- package/lib/module/games/maze-runner/components/EnhancedBallComponent.js +1 -1
- package/lib/module/games/maze-runner/components/EnhancedGameArea.js +1 -1
- package/lib/module/games/maze-runner/components/GameBackground.js +1 -1
- package/lib/module/games/maze-runner/components/ScoreBoard.js +1 -1
- package/lib/module/games/maze-runner/components/SkiaPipeComponent.js +1 -1
- package/lib/module/games/maze-runner/components/StaticGameBackground.js +1 -1
- package/lib/module/games/maze-runner/components/WallComponent.js +1 -1
- package/lib/module/games/maze-runner/components/index.js +1 -1
- package/lib/module/games/perfect-circle/PerfectCircle.js +1 -1
- package/lib/module/games/perfect-circle/PerfectCircleConstants.js +1 -1
- package/lib/module/games/perfect-circle/PerfectCircleService.js +1 -1
- package/lib/module/games/perfect-circle/PerfectCircleStore.js +1 -1
- package/lib/module/games/perfect-circle/components/DrawingCanvas.js +1 -1
- package/lib/module/games/perfect-circle/components/GameBackground.js +1 -1
- package/lib/module/games/perfect-circle/components/ScoreBoard.js +1 -1
- package/lib/module/games/perfect-circle/index.js +1 -1
- package/lib/module/games/popit-fidget/PopitFidget.js +1 -1
- package/lib/module/games/popit-fidget/PopitFidgetConstants.js +1 -1
- package/lib/module/games/popit-fidget/PopitFidgetService.js +1 -1
- package/lib/module/games/popit-fidget/PopitFidgetStore.js +1 -1
- package/lib/module/games/popit-fidget/components/BubbleComponent.js +1 -1
- package/lib/module/games/popit-fidget/components/FidgetGrid.js +1 -1
- package/lib/module/games/popit-fidget/components/GameBackground.js +1 -1
- package/lib/module/games/popit-fidget/components/ScoreBoard.js +1 -1
- package/lib/module/games/popit-fidget/components/index.js +1 -1
- package/lib/module/games/sliding-numbers/SlidingNumbers.js +1 -1
- package/lib/module/games/sliding-numbers/SlidingNumbersConstants.js +1 -1
- package/lib/module/games/sliding-numbers/SlidingNumbersService.js +1 -1
- package/lib/module/games/sliding-numbers/SlidingNumbersStore.js +1 -1
- package/lib/module/games/sliding-numbers/components/GameBackground.js +1 -1
- package/lib/module/games/sliding-numbers/components/NumbersGrid.js +1 -1
- package/lib/module/games/sliding-numbers/components/NumbersTile.js +1 -1
- package/lib/module/games/sliding-numbers/components/ScoreBoard.js +1 -1
- package/lib/module/games/sliding-numbers/components/index.js +1 -1
- package/lib/module/games/snake/Snake.js +1 -1
- package/lib/module/games/snake/SnakeConstants.js +1 -1
- package/lib/module/games/snake/SnakeService.js +1 -1
- package/lib/module/games/snake/SnakeStore.js +1 -1
- package/lib/module/games/snake/components/GameBackground.js +1 -1
- package/lib/module/games/snake/components/GameGrid.js +1 -1
- package/lib/module/games/snake/components/ScoreBoard.js +1 -1
- package/lib/module/games/snake/components/index.js +1 -1
- package/lib/module/games/snake/index.js +1 -1
- package/lib/module/games/space-fighter/SpaceFighter.js +1 -1
- package/lib/module/games/space-fighter/SpaceFighterConstants.js +1 -1
- package/lib/module/games/space-fighter/SpaceFighterService.js +1 -1
- package/lib/module/games/space-fighter/SpaceFighterStore.js +1 -1
- package/lib/module/games/space-fighter/components/AsteroidComponent.js +1 -1
- package/lib/module/games/space-fighter/components/GameArea.js +1 -1
- package/lib/module/games/space-fighter/components/GameBackground.js +1 -1
- package/lib/module/games/space-fighter/components/ScoreBoard.js +1 -1
- package/lib/module/games/space-fighter/components/Spacecraft3D.js +1 -1
- package/lib/module/games/space-fighter/components/SpacecraftPath.js +1 -1
- package/lib/module/games/space-fighter/components/index.js +1 -1
- package/lib/module/games/whack-a-mole/WhackAMole.js +1 -1
- package/lib/module/games/whack-a-mole/WhackAMoleConstants.js +1 -1
- package/lib/module/games/whack-a-mole/WhackAMoleService.js +1 -1
- package/lib/module/games/whack-a-mole/WhackAMoleStore.js +1 -1
- package/lib/module/games/whack-a-mole/components/GameBackground.js +1 -1
- package/lib/module/games/whack-a-mole/components/GameGrid.js +1 -1
- package/lib/module/games/whack-a-mole/components/GameHole.js +1 -1
- package/lib/module/games/whack-a-mole/components/MoleCharacter.js +1 -1
- package/lib/module/games/whack-a-mole/components/ScoreBoard.js +1 -1
- package/lib/module/games/whack-a-mole/components/index.js +1 -1
- package/lib/module/helpers/AnimationFrame.js +1 -1
- package/lib/module/helpers/AnimationTracker.js +1 -1
- package/lib/module/helpers/ErrorHandler.js +1 -1
- package/lib/module/helpers/GameControlButton.js +1 -1
- package/lib/module/helpers/GameOverModal.js +1 -1
- package/lib/module/helpers/GameSettingsModal.js +1 -1
- package/lib/module/helpers/ParticleBlast.js +1 -1
- package/lib/module/helpers/ScoreBoardContainer.js +1 -1
- package/lib/module/helpers/index.js +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/services/GamesConstants.js +1 -1
- package/lib/module/services/GamesService.js +1 -1
- package/lib/module/services/HapticsService.js +1 -1
- package/lib/module/services/ScoringService.js +1 -1
- package/lib/module/services/SoundsService.js +1 -1
- package/lib/module/services/UtilsService.js +1 -1
- package/package.json +5 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export const CANDY_CRUSH_GAME_CONFIG
|
|
1
|
+
"use strict";export const CANDY_CRUSH_GAME_CONFIG={GRID_SIZE:8,CANDY_TYPES:6,MIN_MATCH:3,ANIMATION_DURATION:300,FALL_DURATION:400,SWAP_DURATION:200,POINTS_PER_CANDY:10,COMBO_MULTIPLIER:1.5,SPECIAL_CANDY_THRESHOLD:4};export const CANDY_COLORS=["#FF3B30","#34C759","#007AFF","#FFCC00","#9D4EDD","#FF6B9D"];export const CANDY_TYPES={NORMAL:"normal",STRIPED_HORIZONTAL:"striped_h",STRIPED_VERTICAL:"striped_v",WRAPPED:"wrapped",COLOR_BOMB:"color_bomb"};export const CANDY_CRUSH_COLORS={BACKGROUND:"#2C3E50",GRID_BACKGROUND:"rgba(255, 149, 0, 0.1)",GRID_BORDER:"rgba(255, 149, 0, 0.3)",SELECTED:"rgba(255, 149, 0, 0.5)",BUTTON_PRIMARY:"#FF9500",BUTTON_SECONDARY:"#E68600",SCORE_BACKGROUND:"rgba(255, 149, 0, 0.4)",SCORE_TEXT:"#FFFFFF",TIME_GOOD:"#FF9500",TIME_WARNING:"#FF9500",TIME_CRITICAL:"#FF9500",COMBO_TEXT:"#FF9500",MODAL_PRIMARY:"rgba(255, 149, 0, 0.95)",MODAL_BORDER:"rgba(230, 134, 0, 0.9)",MODAL_BUTTON:"#FF9500",MODAL_BUTTON_BORDER:"#E68600"};export const DIFFICULTY_CONFIG={easy:{gameDuration:60,candyTypes:4},medium:{gameDuration:180,candyTypes:5},hard:{gameDuration:300,candyTypes:6}};export const CANDY_CRUSH_SOUNDS={MATCH:{text:"Pop!",pitch:1.2,rate:1.5},SWAP:{text:"Swap",pitch:1,rate:1.8},SPECIAL:{text:"Boom!",pitch:1.5,rate:2},COMBO:{text:"Combo!",pitch:1.8,rate:2.2},WIN:{text:"Victory!",pitch:1.6,rate:1.8},LOSE:{text:"Game Over",pitch:.8,rate:1.2}};export const CANDY_CRUSH_THEME={backgroundColor:"rgba(0, 0, 0, 0.7)",headerBackgroundColor:"#FF9500",headerTextColor:"#ffffff",sectionBackgroundColor:"rgba(255, 149, 0, 0.15)",sectionTitleColor:"#FF9500",buttonSelectedColor:"#FF9500",buttonUnselectedColor:"rgba(255, 255, 255, 0.2)",buttonSelectedTextColor:"#ffffff",buttonUnselectedTextColor:"rgba(255, 255, 255, 0.7)",switchTrackColorFalse:"rgba(255, 149, 0, 0.3)",switchTrackColorTrue:"#FF9500",switchThumbColor:"#ffffff",infoTextColor:"rgba(255, 255, 255, 0.9)"};export const CANDY_CRUSH_DIFFICULTY_DESCRIPTIONS={easy:"1 minute \u2022 4 candy types",medium:"3 minutes \u2022 5 candy types",hard:"5 minutes \u2022 6 candy types"};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{Animated}from
|
|
1
|
+
"use strict";import{Animated as t}from"react-native";import{CANDY_CRUSH_GAME_CONFIG as e,CANDY_COLORS as n,CANDY_TYPES as o}from"./CandyCrushConstants.js";export class CandyCrushService{nextCandyId=1;createGrid(){return Array(e.GRID_SIZE).fill(null).map(()=>Array(e.GRID_SIZE).fill(null))}initializeGrid(n){const r=this.createGrid(),s=e.GRID_SIZE;for(let e=0;s>e;e++)for(let l=0;s>l;l++){let s,i=0;do{s=Math.floor(Math.random()*n),i++}while(10>i&&this.wouldCreateMatch(r,e,l,s));const c={id:this.nextCandyId++,row:e,col:l,type:s,specialType:o.NORMAL,animatedValue:new t.Value(1),scaleValue:new t.Value(1),isMatched:!1,isFalling:!1},a=r[e];a&&(a[l]=c)}return r}wouldCreateMatch(t,n,o,r){let s=1;for(let e=o-1;e>=0;e--){const o=t[n],l=o?o[e]:null;if(!l||l.type!==r)break;s++}for(let l=o+1;l<e.GRID_SIZE;l++){const e=t[n],o=e?e[l]:null;if(!o||o.type!==r)break;s++}if(s>=e.MIN_MATCH)return!0;let l=1;for(let e=n-1;e>=0;e--){const n=t[e],s=n?n[o]:null;if(!s||s.type!==r)break;l++}for(let s=n+1;s<e.GRID_SIZE;s++){const e=t[s],n=e?e[o]:null;if(!n||n.type!==r)break;l++}return l>=e.MIN_MATCH}canSwap(t,e){const n=Math.abs(t.row-e.row),o=Math.abs(t.col-e.col);return 1===n&&0===o||0===n&&1===o}swapCandies(t,e,n){const o=e.row,r=e.col,s=n.row,l=n.col,i=t[o],c=t[s];if(i&&c){const t=i[r],e=c[l];i[r]=e||null,c[l]=t||null,t&&(t.row=s,t.col=l),e&&(e.row=o,e.col=r)}}findMatches(t){const n=[],o=new Set,r=e.GRID_SIZE;for(let e=0;r>e;e++)for(let s=0;r-2>s;s++){const l=t[e];if(!l)continue;const i=l[s],c=l[s+1],a=l[s+2];if(i&&c&&a&&i.type===c.type&&c.type===a.type){let t=3;const e=[i,c,a];for(let n=s+3;r>n;n++){const o=l[n];if(!o||o.type!==i.type)break;t++,e.push(o)}e.forEach(t=>{o.has(t.id)||(o.add(t.id),n.push(t))}),s+=t-1}}for(let e=0;r>e;e++)for(let s=0;r-2>s;s++){const l=t[s],i=t[s+1],c=t[s+2];if(!l||!i||!c)continue;const a=l[e],f=i[e],u=c[e];if(a&&f&&u&&a.type===f.type&&f.type===u.type){let l=3;const i=[a,f,u];for(let n=s+3;r>n;n++){const o=t[n],r=o?o[e]:null;if(!r||r.type!==a.type)break;l++,i.push(r)}i.forEach(t=>{o.has(t.id)||(o.add(t.id),n.push(t))}),s+=l-1}}const s=n.length*e.POINTS_PER_CANDY;return{matches:n,score:s,hasMatches:n.length>0}}removeMatches(t,e){e.forEach(e=>{const n=t[e.row];n&&(n[e.col]=null)})}applyGravity(t){let n=!1;const o=e.GRID_SIZE;for(let e=0;o>e;e++)for(let r=o-1;r>=0;r--){const s=t[r];if(!s)continue;const l=s[e];if(l){let i=r;for(let n=r+1;o>n;n++){const o=t[n];if(!o||o[e])break;i=n}if(i!==r){const o=t[i];o&&(o[e]=l,s[e]=null,l.row=i,l.isFalling=!0,n=!0)}}}return n}fillEmptySpaces(n,r){const s=[],l=e.GRID_SIZE;for(let e=0;l>e;e++){let i=0;for(let t=0;l>t;t++){const o=n[t];o&&!o[e]&&i++}for(let l=0;i>l;l++){const i=l,c={id:this.nextCandyId++,row:i,col:e,type:Math.floor(Math.random()*r),specialType:o.NORMAL,animatedValue:new t.Value(0),scaleValue:new t.Value(1),isMatched:!1,isFalling:!0},a=n[i];a&&(a[e]=c,s.push(c))}}return s}hasPossibleMoves(t){const n=e.GRID_SIZE;for(let e=0;n>e;e++)for(let o=0;n>o;o++){const r=t[e];if(!r)continue;const s=r[o];if(s){if(n-1>o){const e=r[o+1];if(e){this.swapCandies(t,s,e);const n=this.findMatches(t);if(this.swapCandies(t,s,e),n.hasMatches)return!0}}if(n-1>e){const n=t[e+1],r=n?n[o]:null;if(r){this.swapCandies(t,s,r);const e=this.findMatches(t);if(this.swapCandies(t,s,r),e.hasMatches)return!0}}}}return!1}getCandyColor(t){return n[t%n.length]||n[0]}resetIdCounter(){this.nextCandyId=1}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{create}from
|
|
1
|
+
"use strict";import{create as e}from"zustand";import{subscribeWithSelector as s}from"zustand/middleware";import{CandyCrushService as t}from"./CandyCrushService.js";import{CANDY_CRUSH_GAME_CONFIG as n,DIFFICULTY_CONFIG as o,CANDY_CRUSH_SOUNDS as r}from"./CandyCrushConstants.js";import{immerMiddleware as a}from"../../services/UtilsService.js";import{playSound as i}from"../../services/SoundsService.js";import{playHaptic as u,HapticType as c}from"../../services/HapticsService.js";const l=new t;export const useCandyCrushStore=e()(s(a((e,s)=>({grid:l.createGrid(),score:0,timeRemaining:180,gameDuration:180,isPlaying:!1,isGameOver:!1,selectedCandy:null,isProcessing:!1,difficulty:"easy",candyTypes:4,enableSounds:!0,enableHaptics:!0,comboCount:0,gameTimer:null,matchedCandyIds:new Set,fallingCandyIds:new Set,startGame:()=>{const t=s();t.gameTimer&&clearInterval(t.gameTimer),i(r.SWAP,t.enableSounds),u(c.MEDIUM,t.enableHaptics);const n=setInterval(()=>{const t=s();t.timeRemaining>0&&t.isPlaying&&e(e=>{e.timeRemaining--,30===e.timeRemaining&&(i(r.SPECIAL,e.enableSounds),u(c.MEDIUM,e.enableHaptics)),10===e.timeRemaining&&(i(r.SPECIAL,e.enableSounds),u(c.HEAVY,e.enableHaptics)),e.timeRemaining>0||(e.isGameOver=!0,e.isPlaying=!1,e.gameTimer&&(clearInterval(e.gameTimer),e.gameTimer=null),i(r.LOSE,e.enableSounds),u(c.HEAVY,e.enableHaptics))})},1e3);e(e=>{e.isPlaying=!0,e.gameTimer=n})},stopGame:()=>{const e=s();e.gameTimer&&clearInterval(e.gameTimer),i(r.LOSE,e.enableSounds),u(c.MEDIUM,e.enableHaptics),e.initializeGame(e.difficulty)},resetGame:()=>{const e=s();e.initializeGame(e.difficulty),e.startGame()},initializeGame:(t="easy")=>{const n=s();n.gameTimer&&clearInterval(n.gameTimer),e(e=>{const s=o[t];l.resetIdCounter(),e.grid=l.initializeGrid(s.candyTypes),e.score=0,e.timeRemaining=s.gameDuration,e.gameDuration=s.gameDuration,e.isPlaying=!1,e.isGameOver=!1,e.selectedCandy=null,e.isProcessing=!1,e.difficulty=t,e.candyTypes=s.candyTypes,e.comboCount=0,e.gameTimer=null,e.matchedCandyIds=new Set,e.fallingCandyIds=new Set})},selectCandy:t=>{const o=s();o.isProcessing||!o.isPlaying||o.isGameOver||e(e=>{if(e.selectedCandy)if(e.selectedCandy.id===t.id)e.selectedCandy=null;else if(l.canSwap(e.selectedCandy,t)){const o=e.selectedCandy,a=t;l.swapCandies(e.grid,o,a),new Set([o.row,a.row]).forEach(s=>{e.grid[s]&&(e.grid[s]=[...e.grid[s]])}),l.findMatches(e.grid).hasMatches?(e.selectedCandy=null,e.isProcessing=!0,i(r.SWAP,e.enableSounds),u(c.MEDIUM,e.enableHaptics),setTimeout(()=>{s().processMatches()},n.SWAP_DURATION)):(l.swapCandies(e.grid,o,a),e.selectedCandy=null,new Set([o.row,a.row]).forEach(s=>{e.grid[s]&&(e.grid[s]=[...e.grid[s]])}),i(r.SWAP,e.enableSounds),u(c.LIGHT,e.enableHaptics))}else e.selectedCandy=t,i(r.SWAP,e.enableSounds),u(c.LIGHT,e.enableHaptics);else e.selectedCandy=t,i(r.SWAP,e.enableSounds),u(c.LIGHT,e.enableHaptics)})},processMatches:async()=>{let t=!0,o=0;for(;t;){const a=s(),d=l.findMatches(a.grid);if(!d.hasMatches){t=!1;break}o++;const m=d.score,C=o>1?Math.pow(n.COMBO_MULTIPLIER,o-1):1,S=Math.floor(m*C);e(e=>{e.score+=S,e.comboCount=o}),o>1?(i(r.COMBO,a.enableSounds),u(c.HEAVY,a.enableHaptics)):(i(r.MATCH,a.enableSounds),u(c.MEDIUM,a.enableHaptics)),e(e=>{e.matchedCandyIds=new Set(d.matches.map(e=>e.id))}),await new Promise(e=>setTimeout(e,n.ANIMATION_DURATION)),e(e=>{e.matchedCandyIds=new Set;const s=new Set;d.matches.forEach(e=>s.add(e.row));const t=e.grid.map(e=>e.map(e=>e?.id).join(","));l.removeMatches(e.grid,d.matches),l.applyGravity(e.grid),l.fillEmptySpaces(e.grid,a.candyTypes);const n=new Set;e.grid.forEach(e=>{e.forEach(e=>{e&&e.isFalling&&n.add(e.id)})}),e.fallingCandyIds=n,e.grid.forEach((s,n)=>{const o=s.map(e=>e?.id).join(",");t[n]!==o&&(e.grid[n]=[...s])})}),await new Promise(e=>setTimeout(e,n.FALL_DURATION))}e(e=>{e.isProcessing=!1,e.comboCount=0,e.matchedCandyIds=new Set,e.fallingCandyIds=new Set})},updateSettings:(s,t)=>{e(e=>{e.enableSounds=s,e.enableHaptics=t})}}))));export const useGrid=()=>useCandyCrushStore(e=>e.grid);export const useScore=()=>useCandyCrushStore(e=>e.score);export const useTimeRemaining=()=>useCandyCrushStore(e=>e.timeRemaining);export const useGameDuration=()=>useCandyCrushStore(e=>e.gameDuration);export const useIsPlaying=()=>useCandyCrushStore(e=>e.isPlaying);export const useIsGameOver=()=>useCandyCrushStore(e=>e.isGameOver);export const useSelectedCandy=()=>useCandyCrushStore(e=>e.selectedCandy);export const useComboCount=()=>useCandyCrushStore(e=>e.comboCount);export const useMatchedCandyIds=()=>useCandyCrushStore(e=>e.matchedCandyIds);export const useFallingCandyIds=()=>useCandyCrushStore(e=>e.fallingCandyIds);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import
|
|
1
|
+
"use strict";import t,{useEffect as e,useRef as r}from"react";import{StyleSheet as i}from"react-native";import{Gesture as n,GestureDetector as o}from"react-native-gesture-handler";import a,{useSharedValue as s,useAnimatedStyle as c,withSpring as h,withTiming as d,runOnJS as l}from"react-native-reanimated";import{Canvas as m,RoundedRect as y,Group as g,Shadow as p}from"@shopify/react-native-skia";import{CandyCrushService as f}from"../CandyCrushService.js";import{jsx as u,jsxs as x}from"react/jsx-runtime";const w=new f,C=({candy:t,size:i,isSelected:f,isMatched:C,isFalling:v,onSwipe:I})=>{const b=s(0),k=s(0),M=s(1),S=s(1),z=s(0),F=r(C),W=r(v),X=r(t.row);e(()=>{C&&!F.current?(M.value=d(0,{duration:300}),S.value=d(0,{duration:300})):!C&&F.current&&(M.value=1,S.value=1),F.current=C},[C]),e(()=>{const e=t.row!==X.current;(v&&!W.current||e&&v)&&(M.value=h(1,{damping:8,stiffness:40})),W.current=v,X.current=t.row},[v,t.row]);const Y=n.Pan().onStart(()=>{z.value=1e3,M.value=h(1.1)}).onUpdate(t=>{b.value=t.translationX,k.value=t.translationY}).onEnd(t=>{const e=.3*i,r=Math.abs(t.translationX),n=Math.abs(t.translationY);(r>e||n>e)&&(r>n?t.translationX>0?l(I)("right"):l(I)("left"):t.translationY>0?l(I)("down"):l(I)("up")),b.value=h(0),k.value=h(0),M.value=h(1),z.value=d(0,{duration:300})}),q=w.getCandyColor(t.type),A=c(()=>({transform:[{translateX:b.value},{translateY:k.value},{scale:M.value}],opacity:S.value,zIndex:z.value}));return u(o,{gesture:Y,children:u(a.View,{style:[j.container,{width:i,height:i},A],children:u(m,{style:{width:i,height:i},children:x(g,{children:[u(y,{x:2,y:2,width:i-4,height:i-4,r:8,color:q}),u(y,{x:.15*i,y:.15*i,width:.35*i,height:.35*i,r:6,color:"rgba(255, 255, 255, 0.5)"}),u(y,{x:6,y:6,width:i-12,height:i-12,r:6,color:"rgba(255, 255, 255, 0.2)"}),f&&u(y,{x:1,y:1,width:i-2,height:i-2,r:9,color:"transparent",style:"stroke",strokeWidth:3,children:u(p,{dx:0,dy:0,blur:6,color:"rgba(255, 255, 255, 1)"})})]})})})})};export const CandyItem=t.memo(C,(t,e)=>t.candy.id===e.candy.id&&t.candy.type===e.candy.type&&t.candy.row===e.candy.row&&t.candy.col===e.candy.col&&t.isMatched===e.isMatched&&t.isFalling===e.isFalling&&t.isSelected===e.isSelected&&t.size===e.size);CandyItem.displayName="CandyItem";const j=i.create({container:{justifyContent:"center",alignItems:"center"}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import
|
|
1
|
+
"use strict";import r from"react";import{Canvas as o,Rect as t,LinearGradient as a,vec as c,Circle as e,Path as i,Skia as s}from"@shopify/react-native-skia";import{Dimensions as n}from"react-native";import{jsx as h,jsxs as m,Fragment as d}from"react/jsx-runtime";const{width:g,height:l}=n.get("window"),p=()=>[...Array(15)].map((r,o)=>{const t=g*(7*o+3)%g,a=l*(11*o+5)%l,c=3+o%3,e=s.Path.Make();return e.moveTo(t,a-c),e.lineTo(t+.3*c,a+.3*c),e.lineTo(t+c,a+.3*c),e.lineTo(t+.5*c,a+.8*c),e.lineTo(t+.7*c,a+1.5*c),e.lineTo(t,a+c),e.lineTo(t-.7*c,a+1.5*c),e.lineTo(t-.5*c,a+.8*c),e.lineTo(t-c,a+.3*c),e.lineTo(t-.3*c,a+.3*c),e.close(),{path:e,opacity:.1+o%3*.05}}),x=p();export const GameBackground=r.memo(({children:r})=>m(d,{children:[m(o,{style:{position:"absolute",width:g,height:l},children:[h(t,{x:0,y:0,width:g,height:l,children:h(a,{start:c(0,0),end:c(0,l),colors:["#667eea","#764ba2","#f093fb"]})}),h(e,{cx:.1*g,cy:.15*l,r:60,color:"rgba(255, 255, 255, 0.05)"}),h(e,{cx:.85*g,cy:.25*l,r:80,color:"rgba(255, 255, 255, 0.05)"}),h(e,{cx:.2*g,cy:.7*l,r:50,color:"rgba(255, 255, 255, 0.05)"}),h(e,{cx:.9*g,cy:.8*l,r:70,color:"rgba(255, 255, 255, 0.05)"}),x.map((r,o)=>h(i,{path:r.path,color:`rgba(255, 255, 255, ${r.opacity})`},o))]}),r]}));GameBackground.displayName="GameBackground";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import
|
|
1
|
+
"use strict";import r,{useMemo as t,useRef as e,useEffect as i}from"react";import{View as n,StyleSheet as a,Dimensions as o}from"react-native";import{Canvas as d,RoundedRect as s,LinearGradient as c,vec as h,Shadow as l,Circle as g,Group as y}from"@shopify/react-native-skia";import{useGrid as f,useSelectedCandy as u,useCandyCrushStore as m,useMatchedCandyIds as p,useFallingCandyIds as w}from"../CandyCrushStore.js";import{CandyItem as b}from"./CandyItem.js";import{CANDY_CRUSH_GAME_CONFIG as x,CANDY_CRUSH_COLORS as C}from"../CandyCrushConstants.js";import{jsx as I,jsxs as S}from"react/jsx-runtime";const{width:j}=o.get("window"),M=r.memo(({row:r,rowIndex:t,candySize:e,gap:i,selectedCandyId:a,matchedCandyIds:o,fallingCandyIds:d,onSwipe:s})=>I(n,{style:[z.row,{gap:i}],children:r.map((r,i)=>{if(!r)return I(n,{style:[z.cell,{width:e,height:e}]},`empty-${t}-${i}`);const c=a===r.id,h=o.has(r.id),l=d.has(r.id);return I(n,{style:[z.cell,{width:e,height:e}],children:I(b,{candy:r,size:e,isSelected:c,isMatched:h,isFalling:l,onSwipe:t=>{s(r,t)}})},r.id)})},"row-"+t),(r,t)=>{if(r.row===t.row)return!0;if(r.row.length!==t.row.length)return!1;if(r.candySize!==t.candySize)return!1;if(r.gap!==t.gap)return!1;const e=r.row.some(t=>t?.id===r.selectedCandyId);if(e!==t.row.some(r=>r?.id===t.selectedCandyId)||e&&r.selectedCandyId!==t.selectedCandyId)return!1;for(let e=0;e<r.row.length;e++){const i=r.row[e];if(i){const e=r.matchedCandyIds.has(i.id),n=t.matchedCandyIds.has(i.id),a=r.fallingCandyIds.has(i.id),o=t.fallingCandyIds.has(i.id);if(e!==n||a!==o)return!1}}for(let e=0;e<r.row.length;e++){const i=r.row[e],n=t.row[e];if(i?.id!==n?.id)return!1;if(i?.type!==n?.type)return!1;if(i?.row!==n?.row)return!1;if(i?.col!==n?.col)return!1}return!0});export const GameGrid=r.memo(()=>{const a=f(),o=u(),b=p(),C=w(),G=m(r=>r.selectCandy),k=o?.id||null,v=e(a);i(()=>{v.current=a},[a]);const W=r.useCallback((r,t)=>{const e=v.current;let i=r.row,n=r.col;switch(t){case"up":i=r.row-1;break;case"down":i=r.row+1;break;case"left":n=r.col-1;break;case"right":n=r.col+1}if(i>=0&&i<e.length&&n>=0&&e[0]&&n<e[0].length){const t=e[i];if(t){const e=t[n];e&&(G(r),setTimeout(()=>G(e),50))}}},[G]),$=t(()=>{const r=j-40,t=x.GRID_SIZE,e=2*(t-1),i=(r-e)/t,n=Math.floor(i)*t+e+20,a=Math.floor(i)*t+e+20;return{candySize:Math.floor(i),gap:2,gridSize:t,gridWidth:n,gridHeight:a}},[]),{candySize:H,gap:D,gridWidth:F,gridHeight:R}=$,T=t(()=>{const r=[];for(let t=0;25>t;t++)r.push({x:Math.random()*F,y:Math.random()*R,radius:15*Math.random()+5,opacity:.15*Math.random()+.05});return r},[F,R]);return S(n,{style:z.container,children:[I(n,{style:[z.jellyContainer,{width:F,height:R}],children:S(d,{style:{width:F,height:R},children:[S(s,{x:0,y:0,width:F,height:R,r:15,children:[I(c,{start:h(0,0),end:h(F,R),colors:["rgba(255, 149, 0, 0.35)","rgba(255, 120, 0, 0.25)","rgba(255, 149, 0, 0.3)"]}),I(l,{dx:0,dy:6,blur:12,color:"rgba(255, 100, 0, 0.4)",inner:!0})]}),I(y,{children:T.map((r,t)=>I(g,{cx:r.x,cy:r.y,r:r.radius,color:`rgba(255, 255, 255, ${r.opacity})`},t))}),I(s,{x:5,y:5,width:F-10,height:R-10,r:12,children:I(c,{start:h(0,0),end:h(0,R),colors:["rgba(255, 200, 100, 0.3)","rgba(255, 149, 0, 0)","rgba(255, 180, 80, 0.2)"]})}),I(s,{x:15,y:15,width:F-30,height:.25*R,r:8,children:I(c,{start:h(0,0),end:h(0,.25*R),colors:["rgba(255, 255, 255, 0.5)","rgba(255, 255, 255, 0)"]})}),I(s,{x:15,y:.75*R,width:F-30,height:.2*R,r:8,children:I(c,{start:h(0,0),end:h(0,.2*R),colors:["rgba(0, 0, 0, 0)","rgba(255, 100, 0, 0.2)"]})})]})}),I(n,{style:[z.grid,{gap:D}],children:a.map((r,t)=>I(M,{row:r,rowIndex:t,candySize:H,gap:D,selectedCandyId:k,matchedCandyIds:b,fallingCandyIds:C,onSwipe:W},t))})]})});GameGrid.displayName="GameGrid";const z=a.create({container:{flex:1,justifyContent:"center",alignItems:"center",position:"relative"},jellyContainer:{position:"absolute",borderRadius:15,borderWidth:3,borderColor:C.GRID_BORDER,overflow:"hidden"},grid:{padding:13,zIndex:1},row:{flexDirection:"row"},cell:{justifyContent:"center",alignItems:"center"}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import
|
|
1
|
+
"use strict";import r from"react";import{View as o,Text as e,StyleSheet as t}from"react-native";import{useScore as s,useTimeRemaining as n}from"../CandyCrushStore.js";import{CANDY_CRUSH_COLORS as c}from"../CandyCrushConstants.js";import{ScoreBoardContainer as l}from"../../../helpers/index.js";import{jsx as i,jsxs as a}from"react/jsx-runtime";export const ScoreBoard=r.memo(({offset:t=0})=>{const m=s(),f=n(),h=r.useMemo(()=>`${Math.floor(f/60)}:${(""+f%60).padStart(2,"0")}`,[f]),y=r.useMemo(()=>f>30?f>60?c.TIME_GOOD:c.TIME_WARNING:c.TIME_CRITICAL,[f]);return i(l,{offset:t,backgroundColor:c.SCORE_BACKGROUND,borderColor:c.GRID_BORDER,children:a(o,{style:d.scoreRow,children:[a(o,{style:d.scoreItem,children:[i(e,{style:d.label,children:"Score"}),i(e,{style:d.value,children:m})]}),a(o,{style:d.scoreItem,children:[i(e,{style:d.label,children:"Time"}),i(e,{style:[d.value,{color:y}],children:h})]})]})})});ScoreBoard.displayName="ScoreBoard";const d=t.create({scoreRow:{flex:1,flexDirection:"row",justifyContent:"space-around"},scoreItem:{alignItems:"center"},label:{fontSize:16,color:"rgba(255, 255, 255, 0.7)",marginBottom:4},value:{fontSize:25,color:c.SCORE_TEXT,fontWeight:"bold"}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export{GameBackground}from
|
|
1
|
+
"use strict";export{GameBackground}from"./GameBackground.js";export{GameGrid}from"./GameGrid.js";export{ScoreBoard}from"./ScoreBoard.js";export{CandyItem}from"./CandyItem.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export{CandyCrush}from
|
|
1
|
+
"use strict";export{CandyCrush}from"./CandyCrush.js";export{useCandyCrushStore}from"./CandyCrushStore.js";export*from"./CandyCrushConstants.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import
|
|
1
|
+
"use strict";import t from"react";import{View as r,StyleSheet as o,Dimensions as e}from"react-native";import{GestureDetector as n,Gesture as s,GestureHandlerRootView as i}from"react-native-gesture-handler";import{useCarRacingStore as a,useScore as f,useIsPlaying as c,useGameOver as l,useObstacles as m,usePlayerCar as g,useRoadOffset as u,useParticleEffects as d,useLives as h}from"./CarRacingStore.js";import{CarRacingService as p}from"./CarRacingService.js";import{GameBackground as C,CarComponent as x,ScoreBoard as S}from"./components/index.js";import{GameControlButton as b,GameOverModal as v,GameSettingsModal as y,ParticleBlast as j}from"../../helpers/index.js";import{GAME_IDS as B,DEFAULT_GAME_SETTINGS as w}from"../../services/UtilsService.js";import{getDifficultySettings as R,CAR_RACING_COLORS as T,CAR_RACING_GAME_CONFIG as A}from"./CarRacingConstants.js";import{playSound as G,GAME_SOUNDS as P}from"../../services/SoundsService.js";import{playHaptic as I,HapticType as M}from"../../services/HapticsService.js";import{jsx as O,jsxs as E}from"react/jsx-runtime";const{width:k,height:D}=e.get("window");export const CarRacing=({settings:e=w,onSettingsChange:N,onEndGame:U})=>{const V=e?.difficulty||"medium",q=e?.enableSounds??!0,z=e?.enableHaptics??!0,F=e?.offset??0,J=f(),K=c(),L=l(),Q=h(),W=m(),X=g(),Y=u(),Z=d(),$=t.useRef(!1),_=t.useCallback(t=>{U&&!$.current&&(U({status:t,score:J.toString()}),$.current=!0)},[U,J]),tt=t.useCallback((t,r)=>a.getState().startGame(t,r),[]),rt=t.useCallback(()=>a.getState().stopGame(),[]),ot=t.useCallback(()=>a.getState().resetGame(),[]),et=t.useCallback(t=>{a.getState().removeParticleEffect(t)},[]),nt=t.useMemo(()=>R(V),[V]),st=t.useMemo(()=>new p(nt.roadSpeed,nt.obstacleSpawnInterval),[nt.roadSpeed,nt.obstacleSpawnInterval]);t.useEffect(()=>{a.getState().setOffset(F)},[F]),t.useEffect(()=>{st.setCallbacks(()=>{G(P.CAR_RACING.CRASH,q),I(M.ERROR,z)},()=>{G(P.CAR_RACING.PASS,q),I(M.LIGHT,z)})},[st,q,z]),t.useEffect(()=>{if(!K)return;const t=setInterval(()=>{a.getState().decrementTime()},1e3);return()=>clearInterval(t)},[K]),t.useEffect(()=>{L&&!$.current&&_(Q>0?"win":"lose"),L||($.current=!1)},[L,Q,_]),t.useEffect(()=>()=>{st.cleanup(),rt()},[st]);const it=t.useCallback(()=>{$.current=!1,tt(nt.gameDuration,F),st.startGame(),G(P.CAR_RACING.START,q),I(M.SUCCESS,z)},[tt,st,nt.gameDuration,F,q,z]),at=t.useCallback(()=>{_("cancel"),rt(),st.stopGame()},[rt,st,_]),ft=t.useCallback(()=>{ot(),st.cleanup()},[ot,st]),ct=t.useCallback(()=>{ft()},[ft]),lt=t.useRef(1),mt=s.Pan().onUpdate(t=>{if(!K)return;const r=A.LANE_WIDTH*A.ROAD_LANES,o=(k-r)/2,e=t.absoluteX-o,n=Math.floor(e/A.LANE_WIDTH),s=Math.max(0,Math.min(A.ROAD_LANES-1,n));s!==lt.current&&(lt.current=s,G(P.CAR_RACING.LANE_SWITCH,q),I(M.SELECTION,z)),st.movePlayerToLane(s)}).runOnJS(!0),gt=t.useMemo(()=>({isPlaying:K,gameOver:L,onStartGame:it,onStopGame:at,startButtonColor:T.UI,stopButtonColor:T.UI,startButtonBorderColor:T.UI,stopButtonBorderColor:T.UI,startButtonText:"START RACING",stopButtonText:"STOP GAME",startButtonSubtext:"Dodge traffic to score!"}),[K,L,it,at]),ut=t.useMemo(()=>({isVisible:L,score:J,onPlayAgain:ct,buttonText:"Race Again!",primaryColor:"rgba(255, 68, 68, 0.5)",borderColor:"rgba(255, 68, 68, 0.5)",buttonColor:"#ffffff",buttonBorderColor:"#ffffff",buttonTextColor:T.UI}),[L,J,ct]);return O(i,{style:H.container,children:E(r,{style:H.container,children:[O(r,{style:o.absoluteFillObject,children:O(C,{width:k,height:D,roadOffset:Y})}),O(S,{offset:F}),O(n,{gesture:mt,children:E(r,{style:H.gameArea,children:[W.map(t=>O(x,{x:t.x,y:t.y,width:t.width,height:t.height,color:t.color,isPlayer:!1},t.id)),O(x,{x:X.x,y:X.y,width:X.width,height:X.height,color:T.PLAYER_CAR,isPlayer:!0})]})}),Z.map(t=>O(j,{x:t.x,y:t.y,particleCount:12,colors:["#ff4444","#ff6b6b","#ff8888","#ffaa00","#ffcc00","#ffffff"],duration:800,onComplete:()=>et(t.id)},t.id)),O(b,{...gt}),O(v,{...ut}),O(y,{gameId:B.CAR_RACING,settings:e||w,onSettingsChange:N})]})})};const H=o.create({container:{flex:1,backgroundColor:"#000"},gameArea:{flex:1}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export const CAR_RACING_DIFFICULTY_CONFIG
|
|
1
|
+
"use strict";export const CAR_RACING_DIFFICULTY_CONFIG={easy:{gameDuration:60,obstacleSpawnInterval:2500,roadSpeed:4},medium:{gameDuration:120,obstacleSpawnInterval:2e3,roadSpeed:6},hard:{gameDuration:180,obstacleSpawnInterval:1500,roadSpeed:8}};export const getDifficultySettings=e=>CAR_RACING_DIFFICULTY_CONFIG[e];export const DEFAULT_CAR_RACING_SETTINGS={difficulty:"medium",soundEnabled:!0,hapticEnabled:!0,gameDuration:CAR_RACING_DIFFICULTY_CONFIG.medium.gameDuration,obstacleSpawnInterval:CAR_RACING_DIFFICULTY_CONFIG.medium.obstacleSpawnInterval,roadSpeed:CAR_RACING_DIFFICULTY_CONFIG.medium.roadSpeed};export const CAR_RACING_GAME_CONFIG={GAME_DURATION:120,CAR_WIDTH:50,CAR_HEIGHT:80,OBSTACLE_WIDTH:50,OBSTACLE_HEIGHT:80,ROAD_LANES:3,LANE_WIDTH:100,ROAD_SPEED:6,OBSTACLE_SPAWN_INTERVAL:2e3,COLLISION_TOLERANCE:5,POINTS_PER_OBSTACLE_PASSED:10,LANE_SWITCH_DURATION:200};export const CAR_RACING_COLORS={ROAD_DARK:"#2a2a2a",ROAD_LIGHT:"#3a3a3a",ROAD_LINE:"#ffffff",GRASS_GREEN:"#2d5016",GRASS_DARK:"#1a3009",SKY_BLUE:"#87ceeb",PLAYER_CAR:"#ff4444",OBSTACLE_CAR_1:"#4444ff",OBSTACLE_CAR_2:"#44ff44",OBSTACLE_CAR_3:"#ffff44",SCORE:"#ffd700",UI:"#ff4444"};export const CAR_RACING_THEME={backgroundColor:"rgba(0, 0, 0, 0.7)",headerBackgroundColor:"#ff4444",headerTextColor:"#ffffff",sectionBackgroundColor:"rgba(255, 68, 68, 0.15)",sectionTitleColor:"#ff4444",buttonSelectedColor:"#ff4444",buttonUnselectedColor:"rgba(255, 255, 255, 0.2)",buttonSelectedTextColor:"#ffffff",buttonUnselectedTextColor:"rgba(255, 255, 255, 0.7)",switchTrackColorFalse:"rgba(255, 68, 68, 0.3)",switchTrackColorTrue:"#ff4444",switchThumbColor:"#ffffff",infoTextColor:"rgba(255, 255, 255, 0.9)"};export const CAR_RACING_DIFFICULTY_DESCRIPTIONS={easy:"1 min, slower traffic, relaxed driving",medium:"2 mins, normal traffic speed, balanced challenge",hard:"3 mins, fast traffic, quick reflexes needed!"};export const getLanePosition=(e,o)=>(o-300)/2+100*e+50-25;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{Dimensions}from
|
|
1
|
+
"use strict";import{Dimensions as t}from"react-native";import{useCarRacingStore as s}from"./CarRacingStore.js";import{CAR_RACING_GAME_CONFIG as i,CAR_RACING_COLORS as e,getLanePosition as a}from"./CarRacingConstants.js";const{width:n,height:o}=t.get("window");export class CarRacingService{obstacleSpawnTimer=null;gameLoopTimer=null;obstacleIdCounter=0;roadSpeed=i.ROAD_SPEED;obstacleSpawnInterval=i.OBSTACLE_SPAWN_INTERVAL;collisionCooldown=new Map;constructor(t,s){t&&(this.roadSpeed=t),s&&(this.obstacleSpawnInterval=s)}setCallbacks(t,s){this.onCollision=t,this.onPass=s}startGame(){this.cleanup(),this.obstacleIdCounter=0,this.collisionCooldown.clear(),this.startObstacleSpawning(),this.gameLoopTimer=setInterval(()=>{this.updateGameState()},16)}stopGame(){this.cleanup()}updateGameState(){const t=s.getState(),{obstacles:i,playerCar:e,isPlaying:a}=t;if(!a)return;const n=(t.roadOffset+this.roadSpeed)%100;t.updateRoadOffset(n);for(let s=0;s<i.length;s++){const a=i[s];if(!a)continue;const n=a.y+this.roadSpeed;n>o+50?t.removeObstacle(a.id):(!a.passed&&n>e.y+e.height&&(t.markObstaclePassed(a.id),this.onPass&&this.onPass()),t.updateObstacle(a.id,{y:n}),this.checkCollision(a,e))}}checkCollision(t,e){const a=s.getState(),n=this.collisionCooldown.get(t.id);if(n&&1e3>Date.now()-n)return;const o=i.COLLISION_TOLERANCE;if(e.x<t.x+t.width-o&&e.x+e.width>t.x+o&&e.y<t.y+t.height-o&&e.y+e.height>t.y+o){this.collisionCooldown.set(t.id,Date.now());const s=(e.x+e.width/2+t.x+t.width/2)/2,i=(e.y+e.height/2+t.y+t.height/2)/2;a.addParticleEffect(s,i),a.loseLife(),a.removeObstacle(t.id),this.onCollision&&this.onCollision()}}startObstacleSpawning(){this.obstacleSpawnTimer=setInterval(()=>{this.spawnObstacle()},this.obstacleSpawnInterval),this.spawnObstacle()}spawnObstacle(){const t=s.getState();if(!t.isPlaying)return;const o=this.fastRandom(0,i.ROAD_LANES),h=a(o,n),r=[e.OBSTACLE_CAR_1,e.OBSTACLE_CAR_2,e.OBSTACLE_CAR_3],l=r[this.fastRandom(0,r.length)]||e.OBSTACLE_CAR_1,c={id:"obstacle-"+this.obstacleIdCounter++,x:h,y:-i.OBSTACLE_HEIGHT,lane:o,width:i.OBSTACLE_WIDTH,height:i.OBSTACLE_HEIGHT,color:l,passed:!1};t.addObstacle(c)}fastRandom(t,s){return Math.floor(Math.random()*(s-t))+t}movePlayerToLane(t){const i=s.getState();i.isPlaying&&i.movePlayerCar(t)}cleanup(){this.obstacleSpawnTimer&&(clearInterval(this.obstacleSpawnTimer),this.obstacleSpawnTimer=null),this.gameLoopTimer&&(clearInterval(this.gameLoopTimer),this.gameLoopTimer=null),this.collisionCooldown.clear()}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{create}from
|
|
1
|
+
"use strict";import{create as e}from"zustand";import{subscribeWithSelector as t}from"zustand/middleware";import{Dimensions as s}from"react-native";import{immerMiddleware as a}from"../../services/UtilsService.js";import{CAR_RACING_GAME_CONFIG as r,getLanePosition as o}from"./CarRacingConstants.js";const{width:c,height:i}=s.get("window");export const useCarRacingStore=e()(t(a((e,t)=>({score:0,timeLeft:r.GAME_DURATION,isPlaying:!1,gameOver:!1,lives:3,obstacles:[],playerCar:{x:o(1,c),y:.65*i,lane:1,width:r.CAR_WIDTH,height:r.CAR_HEIGHT},roadOffset:0,particleEffects:[],offset:0,gameDuration:r.GAME_DURATION,setOffset:t=>{e(e=>{e.offset=t;const s=t>0?.75*i:.62*i;e.playerCar.y=s})},startGame:(t,s)=>{const a=t||r.GAME_DURATION;e(e=>{e.score=0,e.timeLeft=a,e.gameDuration=a,e.isPlaying=!0,e.gameOver=!1,e.lives=3,e.obstacles=[],e.roadOffset=0,void 0!==s&&(e.offset=s);const t=(void 0!==s?s:e.offset)>0?.75*i:.62*i;e.playerCar={x:o(1,c),y:t,lane:1,width:r.CAR_WIDTH,height:r.CAR_HEIGHT}})},stopGame:()=>{e(e=>{e.score=0,e.timeLeft=e.gameDuration,e.isPlaying=!1,e.gameOver=!1,e.lives=3,e.obstacles=[],e.roadOffset=0;const t=e.offset>0?.75*i:.62*i;e.playerCar={x:o(1,c),y:t,lane:1,width:r.CAR_WIDTH,height:r.CAR_HEIGHT}})},resetGame:()=>{e(e=>{e.score=0,e.timeLeft=e.gameDuration,e.isPlaying=!1,e.gameOver=!1,e.lives=3,e.obstacles=[],e.roadOffset=0;const t=e.offset>0?.75*i:.62*i;e.playerCar={x:o(1,c),y:t,lane:1,width:r.CAR_WIDTH,height:r.CAR_HEIGHT}})},updateScore:t=>{e(e=>{e.score=e.score+t})},decrementTime:()=>{e(e=>{const t=e.timeLeft-1;t>0?e.timeLeft=t:(e.timeLeft=0,e.isPlaying=!1,e.gameOver=!0)})},addObstacle:t=>{e(e=>{e.obstacles.push(t)})},removeObstacle:t=>{e(e=>{e.obstacles=e.obstacles.filter(e=>e.id!==t)})},updateObstacle:(t,s)=>{e(e=>{for(let a=0;a<e.obstacles.length;a++)if(e.obstacles[a].id===t){Object.assign(e.obstacles[a],s);break}})},movePlayerCar:t=>{e(e=>{const s=Math.max(0,Math.min(r.ROAD_LANES-1,t));e.playerCar.lane=s,e.playerCar.x=o(s,c)})},updateRoadOffset:t=>{e(e=>{e.roadOffset=t})},markObstaclePassed:t=>{e(e=>{for(let s=0;s<e.obstacles.length;s++)if(e.obstacles[s].id===t&&!e.obstacles[s].passed){e.obstacles[s].passed=!0,e.score=e.score+r.POINTS_PER_OBSTACLE_PASSED;break}})},loseLife:()=>{e(e=>{const t=e.lives-1;t>0?e.lives=t:(e.lives=0,e.isPlaying=!1,e.gameOver=!0)})},clearObstacles:()=>{e(e=>{e.obstacles=[]})},addParticleEffect:(t,s)=>{e(e=>{e.particleEffects.push({id:`particle-${Date.now()}-${Math.random()}`,x:t,y:s})})},removeParticleEffect:t=>{e(e=>{e.particleEffects=e.particleEffects.filter(e=>e.id!==t)})}}))));export const useScore=()=>useCarRacingStore(e=>e.score);export const useTimeLeft=()=>useCarRacingStore(e=>e.timeLeft);export const useLives=()=>useCarRacingStore(e=>e.lives);export const useIsPlaying=()=>useCarRacingStore(e=>e.isPlaying);export const useGameOver=()=>useCarRacingStore(e=>e.gameOver);export const useObstacles=()=>useCarRacingStore(e=>e.obstacles);export const usePlayerCar=()=>useCarRacingStore(e=>e.playerCar);export const useRoadOffset=()=>useCarRacingStore(e=>e.roadOffset);export const useParticleEffects=()=>useCarRacingStore(e=>e.particleEffects);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import
|
|
1
|
+
"use strict";import t from"react";import{Canvas as r,RoundedRect as h,Rect as o,Circle as i,LinearGradient as e,vec as a}from"@shopify/react-native-skia";import c,{useAnimatedStyle as f,withSpring as d}from"react-native-reanimated";import{jsx as n,jsxs as l}from"react/jsx-runtime";export const CarComponent=t.memo(({x:t,y:s,width:x,height:y,color:w,isPlayer:m=!1})=>{const p=f(()=>m?{transform:[{translateX:d(t,{damping:25,stiffness:150,mass:.8})},{translateY:s}]}:{transform:[{translateX:t},{translateY:s}]},[t,s,m]);return n(c.View,{style:[{position:"absolute",width:x,height:y},p],children:l(r,{style:{width:x,height:y},children:[n(h,{x:.05*x,y:0,width:.9*x,height:.12*y,r:4,children:n(e,{start:a(0,0),end:a(x,0),colors:[g(w,-30),g(w,-40)]})}),n(h,{x:0,y:.1*y,width:x,height:.25*y,r:6,children:n(e,{start:a(0,0),end:a(x,0),colors:[w,g(w,-15),w]})}),n(h,{x:.12*x,y:.32*y,width:.76*x,height:.12*y,r:4,children:n(e,{start:a(0,0),end:a(0,.12*y),colors:["rgba(100, 150, 200, 0.7)","rgba(50, 100, 150, 0.8)"]})}),n(h,{x:.08*x,y:.42*y,width:.84*x,height:.22*y,r:5,children:n(e,{start:a(0,0),end:a(x,0),colors:[g(w,10),w,g(w,10)]})}),n(o,{x:.12*x,y:.45*y,width:.25*x,height:.16*y,color:"rgba(50, 100, 150, 0.75)"}),n(o,{x:.63*x,y:.45*y,width:.25*x,height:.16*y,color:"rgba(50, 100, 150, 0.75)"}),n(h,{x:.12*x,y:.62*y,width:.76*x,height:.1*y,r:4,children:n(e,{start:a(0,0),end:a(0,.1*y),colors:["rgba(50, 100, 150, 0.8)","rgba(100, 150, 200, 0.7)"]})}),n(h,{x:0,y:.7*y,width:x,height:.2*y,r:6,children:n(e,{start:a(0,0),end:a(x,0),colors:[w,g(w,-15),w]})}),n(h,{x:.05*x,y:.88*y,width:.9*x,height:.12*y,r:4,children:n(e,{start:a(0,0),end:a(x,0),colors:[g(w,-30),g(w,-40)]})}),n(h,{x:.09*-x,y:.17*y,width:.2*x,height:.22*y,r:3,color:"#ffffff"}),n(h,{x:.08*-x,y:.18*y,width:.18*x,height:.2*y,r:3,color:"#000000"}),n(h,{x:.06*-x,y:.2*y,width:.14*x,height:.16*y,r:2,children:n(e,{start:a(0,0),end:a(.14*x,0),colors:["#8a8a8a","#c0c0c0","#8a8a8a"]})}),n(h,{x:.04*-x,y:.24*y,width:.08*x,height:.08*y,r:1,color:"#4a4a4a"}),n(h,{x:.89*x,y:.17*y,width:.2*x,height:.22*y,r:3,color:"#ffffff"}),n(h,{x:.9*x,y:.18*y,width:.18*x,height:.2*y,r:3,color:"#000000"}),n(h,{x:.92*x,y:.2*y,width:.14*x,height:.16*y,r:2,children:n(e,{start:a(0,0),end:a(.14*x,0),colors:["#8a8a8a","#c0c0c0","#8a8a8a"]})}),n(h,{x:.96*x,y:.24*y,width:.08*x,height:.08*y,r:1,color:"#4a4a4a"}),n(h,{x:.09*-x,y:.61*y,width:.2*x,height:.22*y,r:3,color:"#ffffff"}),n(h,{x:.08*-x,y:.62*y,width:.18*x,height:.2*y,r:3,color:"#000000"}),n(h,{x:.06*-x,y:.64*y,width:.14*x,height:.16*y,r:2,children:n(e,{start:a(0,0),end:a(.14*x,0),colors:["#8a8a8a","#c0c0c0","#8a8a8a"]})}),n(h,{x:.04*-x,y:.68*y,width:.08*x,height:.08*y,r:1,color:"#4a4a4a"}),n(h,{x:.89*x,y:.61*y,width:.2*x,height:.22*y,r:3,color:"#ffffff"}),n(h,{x:.9*x,y:.62*y,width:.18*x,height:.2*y,r:3,color:"#000000"}),n(h,{x:.92*x,y:.64*y,width:.14*x,height:.16*y,r:2,children:n(e,{start:a(0,0),end:a(.14*x,0),colors:["#8a8a8a","#c0c0c0","#8a8a8a"]})}),n(h,{x:.96*x,y:.68*y,width:.08*x,height:.08*y,r:1,color:"#4a4a4a"}),n(h,{x:.05*-x,y:.4*y,width:.12*x,height:.08*y,r:2,children:n(e,{start:a(0,0),end:a(.12*x,0),colors:[g(w,-20),w]})}),n(h,{x:.93*x,y:.4*y,width:.12*x,height:.08*y,r:2,children:n(e,{start:a(0,0),end:a(.12*x,0),colors:[w,g(w,-20)]})}),n(i,{cx:.2*x,cy:.06*y,r:.1*x,color:m?"#ffff99":"#ffffcc"}),n(i,{cx:.8*x,cy:.06*y,r:.1*x,color:m?"#ffff99":"#ffffcc"}),n(i,{cx:.2*x,cy:.06*y,r:.06*x,color:m?"#ffffff":"#ffffe0"}),n(i,{cx:.8*x,cy:.06*y,r:.06*x,color:m?"#ffffff":"#ffffe0"}),n(h,{x:.12*x,y:.94*y,width:.15*x,height:.05*y,r:2,color:"#ff3333"}),n(h,{x:.73*x,y:.94*y,width:.15*x,height:.05*y,r:2,color:"#ff3333"}),n(o,{x:.45*x,y:.12*y,width:.1*x,height:.22*y,color:"rgba(255, 255, 255, 0.15)"}),n(h,{x:.2*x,y:.46*y,width:.6*x,height:.06*y,r:3,color:"rgba(255, 255, 255, 0.25)"}),n(o,{x:.38*x,y:.42*y,width:.02*x,height:.22*y,color:"rgba(0, 0, 0, 0.3)"}),n(o,{x:.6*x,y:.42*y,width:.02*x,height:.22*y,color:"rgba(0, 0, 0, 0.3)"})]})})});CarComponent.displayName="CarComponent";const s=(t,r)=>t.x===r.x&&t.y===r.y&&t.width===r.width&&t.height===r.height&&t.color===r.color&&t.isPlayer===r.isPlayer;export const MemoizedCarComponent=t.memo(CarComponent,s);function g(t,r){const h=t.replace("#",""),o=Math.max(0,Math.min(255,parseInt(h.substring(0,2),16)+r)),i=Math.max(0,Math.min(255,parseInt(h.substring(2,4),16)+r)),e=Math.max(0,Math.min(255,parseInt(h.substring(4,6),16)+r));return`#${o.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}${e.toString(16).padStart(2,"0")}`}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import
|
|
1
|
+
"use strict";import t from"react";import{Canvas as r,Rect as e,LinearGradient as o,vec as h,Line as i}from"@shopify/react-native-skia";import{CAR_RACING_COLORS as s,CAR_RACING_GAME_CONFIG as n}from"../CarRacingConstants.js";import{jsx as a,jsxs as c}from"react/jsx-runtime";const d=({width:d,height:l,roadOffset:m})=>{const p=n.LANE_WIDTH*n.ROAD_LANES,g=(d-p)/2,u=g,x=m%40;return c(r,{style:{width:d,height:l},children:[a(e,{x:0,y:0,width:d,height:l,children:a(o,{start:h(d/2,0),end:h(d/2,l),colors:[s.SKY_BLUE,"#b0e0e6"]})}),a(e,{x:0,y:0,width:u,height:l,children:a(o,{start:h(0,0),end:h(u,0),colors:[s.GRASS_DARK,s.GRASS_GREEN]})}),a(e,{x:g+p,y:0,width:u,height:l,children:a(o,{start:h(0,0),end:h(u,0),colors:[s.GRASS_GREEN,s.GRASS_DARK]})}),a(e,{x:g,y:0,width:p,height:l,color:s.ROAD_DARK}),[1,2].map(r=>{const e=g+r*n.LANE_WIDTH,o=Math.ceil(l/40)+1;return a(t.Fragment,{children:Array.from({length:o}).map((t,o)=>{const n=40*o-x;return a(i,{p1:h(e,n),p2:h(e,n+30),color:s.ROAD_LINE,strokeWidth:3},`line-${r}-${o}`)})},"lane-"+r)}),a(i,{p1:h(g,0),p2:h(g,l),color:s.ROAD_LINE,strokeWidth:4}),a(i,{p1:h(g+p,0),p2:h(g+p,l),color:s.ROAD_LINE,strokeWidth:4})]})},l=(t,r)=>t.width===r.width&&t.height===r.height&&Math.floor(t.roadOffset/5)===Math.floor(r.roadOffset/5);export const GameBackground=t.memo(d,l);GameBackground.displayName="GameBackground";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import
|
|
1
|
+
"use strict";import e from"react";import{View as r,Text as t,StyleSheet as o}from"react-native";import{ScoreBoardContainer as n}from"../../../helpers/index.js";import{CAR_RACING_COLORS as i}from"../CarRacingConstants.js";import{useScore as l,useTimeLeft as c,useLives as s}from"../CarRacingStore.js";import{jsx as a,jsxs as f}from"react/jsx-runtime";export const ScoreBoard=e.memo(({offset:o=0})=>{const i=l(),m=c(),h=s(),g=e.useMemo(()=>{const e=m%60;return`${Math.floor(m/60).toString().padStart(2,"0")}:${e.toString().padStart(2,"0")}`},[m]);return a(n,{offset:o,backgroundColor:"rgba(255, 68, 68, 0.4)",borderColor:"rgba(255, 68, 68, 0.4)",children:f(r,{style:d.rowContainer,children:[f(r,{style:d.scoreSection,children:[a(t,{style:d.label,children:"SCORE"}),a(t,{style:d.value,children:i})]}),f(r,{style:d.timeSection,children:[a(t,{style:d.label,children:"TIME"}),a(t,{style:[d.value,10>=m&&d.timeWarning],children:g})]}),f(r,{style:d.livesSection,children:[a(t,{style:d.label,children:"LIVES"}),a(r,{style:d.heartsContainer,children:Array.from({length:3}).map((e,r)=>a(t,{style:d.heartIcon,children:h>r?"\u2764\ufe0f":"\ud83d\udda4"},r))})]})]})})});ScoreBoard.displayName="ScoreBoard";const d=o.create({rowContainer:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%"},scoreSection:{flex:1,alignItems:"center"},timeSection:{flex:1,alignItems:"center"},livesSection:{flex:1,alignItems:"center"},label:{fontSize:16,fontWeight:"bold",color:"#ffffff",marginBottom:4,letterSpacing:.5},value:{fontSize:25,fontWeight:"bold",color:"#ffffff"},timeWarning:{color:i.UI},heartsContainer:{flexDirection:"row",gap:4},heartIcon:{fontSize:22}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export{GameBackground}from
|
|
1
|
+
"use strict";export{GameBackground}from"./GameBackground.js";export{CarComponent}from"./CarComponent.js";export{ScoreBoard}from"./ScoreBoard.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import
|
|
1
|
+
"use strict";import o,{useEffect as t,useCallback as r,useMemo as e}from"react";import{View as s,StyleSheet as n}from"react-native";import{useColorsSortStore as i,useIsPlaying as a,useIsGameOver as m,useTime as c,useContainers as l,useSelectedContainerId as f}from"./ColorsSortStore.js";import{ColorContainer as p,ScoreBoard as d,GameBackground as S}from"./components/index.js";import{GameControlButton as g,GameOverModal as u}from"../../helpers/index.js";import{GameSettingsModal as C}from"../../helpers/index.js";import{COLORS_SORT_COLORS as x}from"./ColorsSortConstants.js";import{GAME_IDS as j,DEFAULT_GAME_SETTINGS as v}from"../../services/UtilsService.js";import{playSound as T,GAME_SOUNDS as b}from"../../services/SoundsService.js";import{playHaptic as y,HapticType as h}from"../../services/HapticsService.js";import{formatTime as B,getGridLayout as A}from"./ColorsSortService.js";import{calculateTimeBasedScore as G}from"../../services/ScoringService.js";import{jsx as w,jsxs as I}from"react/jsx-runtime";export const ColorsSort=o.memo(({settings:n=v,onSettingsChange:F,onEndGame:O})=>{const E=a(),H=m(),R=c(),z=l(),D=f(),L=o.useRef(!1),M=o.useCallback(o=>{if(O&&!L.current){const t={easy:60,medium:120,hard:180}[n.difficulty],r="win"===o?G(R,t):0;O({status:o,score:r.toString()}),L.current=!0}},[O,R,n.difficulty]),N=i(o=>o.initializeGame),U=i(o=>o.startGame),V=i(o=>o.stopGame),W=i(o=>o.resetGame),k=i(o=>o.selectContainer),q=n.difficulty,J=e(()=>A(q),[q]);t(()=>{N(q)},[q,N]),t(()=>{H&&!L.current&&M("win"),H||(L.current=!1)},[H,M]);const K=r(()=>{L.current=!1,N(q),U(),T(b.COLORS_SORT.START,n.enableSounds),y(h.MEDIUM,n.enableHaptics)},[q,N,U,n.enableSounds,n.enableHaptics]),Q=r(()=>{M("cancel"),V()},[V,M]),X=r(()=>{W(),N(q)},[W,N,q]),Y=r(o=>{E&&!H&&k(o,n)},[E,H,k,n]),Z=e(()=>({isPlaying:E,gameOver:H,onStartGame:K,onStopGame:Q,startButtonText:"START SORTING",stopButtonText:"STOP GAME",startButtonSubtext:"Sort colors!",startButtonColor:x.BUTTON_PRIMARY,startButtonBorderColor:x.BUTTON_SECONDARY}),[E,H,K,Q]),$=e(()=>({isVisible:H,score:R,onPlayAgain:X,buttonText:"Sort Again!",primaryColor:"rgba(255, 107, 53, 0.5)",borderColor:"rgba(255, 107, 53, 0.5)",buttonColor:"#ffffff",buttonBorderColor:"#ffffff",buttonTextColor:"#FF6B35",scoreLabel:"Completion Time",scoreFormatter:B}),[H,R,X]),_=e(()=>({gameId:j.COLORS_SORT,settings:n,onSettingsChange:F}),[n,F]),oo=n?.offset??0,to=e(()=>({gameArea:{...P.gameArea,paddingTop:100+oo}}),[oo]);return w(S,{children:I(s,{style:P.container,children:[w(d,{offset:oo}),w(s,{style:to.gameArea,children:w(s,{style:[P.containersGrid,J],children:z.map(o=>w(p,{container:o,isSelected:D===o.id,onPress:()=>Y(o.id),difficulty:q},o.id))})}),w(g,{...Z}),w(u,{...$}),w(C,{..._})]})})});const P=n.create({container:{flex:1},gameArea:{flex:1,justifyContent:"center",alignItems:"center",paddingTop:100,paddingBottom:120},containersGrid:{flexDirection:"row",flexWrap:"wrap",justifyContent:"center",alignItems:"flex-end",gap:15,paddingHorizontal:10}});ColorsSort.displayName="ColorsSort";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{Dimensions}from
|
|
1
|
+
"use strict";import{Dimensions as o}from"react-native";const{width:e,height:E}=o.get("window");export const COLORS_SORT_COLORS={BACKGROUND:"#FFF5E6",PIECE_ORANGE:"#FF6B35",PIECE_PINK:"#FF1493",PIECE_GREEN:"#32CD32",PIECE_RED:"#FF4444",PIECE_YELLOW:"#FFD700",PIECE_BLUE:"#4169E1",PIECE_PURPLE:"#9370DB",BASE_SILVER:"#C0C0C0",BASE_DARK:"#A8A8A8",SCREW_WHITE:"#F5F5F5",BUTTON_PRIMARY:"#FF6B35",BUTTON_SECONDARY:"#FF8C42",SCORE_TEXT:"#FFFFFF",SCORE_BACKGROUND:"rgba(255, 107, 53, 0.4)",SCORE_BORDER:"rgba(255, 107, 53, 0.8)",SELECTED_GLOW:"#FFD700"};export const COLORS_SORT_GAME_CONFIG={SCREEN_WIDTH:e,SCREEN_HEIGHT:E,PIECE_SIZE:50,CONTAINER_SIZE:60,CONTAINER_SPACING:20,PIECE_SPACING:5};export const COLORS_SORT_CONSTANTS={baseScore:10,moveScore:10,perfectBonus:100};export const PIECE_COLORS=["#FF4444","#32CD32","#4169E1","#FFD700","#9370DB","#FF6B35","#FF1493"];export const COLORS_SORT_THEME={backgroundColor:"rgba(0, 0, 0, 0.7)",headerBackgroundColor:"#FF6B35",headerTextColor:"#ffffff",sectionBackgroundColor:"rgba(255, 107, 53, 0.15)",sectionTitleColor:"#FF6B35",buttonSelectedColor:"#FF6B35",buttonUnselectedColor:"rgba(255, 255, 255, 0.2)",buttonSelectedTextColor:"#ffffff",buttonUnselectedTextColor:"rgba(255, 255, 255, 0.7)",switchTrackColorFalse:"rgba(255, 107, 53, 0.3)",switchTrackColorTrue:"#FF6B35",switchThumbColor:"#ffffff",infoTextColor:"rgba(255, 255, 255, 0.9)"};export const COLORS_SORT_DIFFICULTY_DESCRIPTIONS={easy:"4 containers, 3 colors, 3 pieces each - Perfect for beginners",medium:"5 containers, 4 colors, 3 pieces each - Standard challenge",hard:"6 containers, 5 colors, 4 pieces each - Expert level!"};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{Dimensions}from
|
|
1
|
+
"use strict";import{Dimensions as e}from"react-native";const{width:t,height:r}=e.get("window");export const SORT_COLORS=["#FF6B35","#FF4444","#FF8C42","#FFD700","#32CD32","#4169E1","#FF1493","#9370DB","#00BCD4","#FFA366","#CDDC39","#E91E63"];export const formatTime=e=>{const t=e%60;return`${Math.floor(e/60).toString().padStart(2,"0")}:${t.toString().padStart(2,"0")}`};export const getGridLayout=e=>{switch(e){case"easy":default:return{maxWidth:400};case"medium":case"hard":return{maxWidth:300}}};export const getPieceHeight=(e,t)=>{switch(e){case"easy":return t-8;case"medium":default:return t-10;case"hard":return t-18}};export const generateFloatingBlocks=()=>{const e=[];for(let o=0;25>o;o++){const c=r/25*o,a=t/25*o+50*Math.sin(.5*o)+100*Math.random(),s=c+60*Math.cos(.7*o)+120*Math.random(),i=20+20*Math.random(),n=o%12,l=.3+.15*Math.sin(o),F=Math.max(i/2,Math.min(t-i,a)),y=Math.max(i/2,Math.min(r-i,s)),h=`${SORT_COLORS[n]}${Math.floor(255*l).toString(16).padStart(2,"0")}`;let x;x=o%4==0?"square":o%4==1?"rect":o%4==2?"wide":"circle",e.push({key:`${x}-${o}`,type:x,x:F,y:y,size:i,color:h})}return e};export const getDecorativeBlocks=()=>[{key:"top-left",x:.08*t,y:.12*r,size:50,r:8,color:"#FF6B3550"},{key:"bottom-right",x:.85*t,y:.82*r,size:45,r:7,color:"#FFD70050"},{key:"top-right",x:.82*t,y:.18*r,size:40,r:6,color:"#32CD3250"},{key:"bottom-left",x:.12*t,y:.75*r,size:55,r:9,color:"#4169E150"},{key:"top-center",x:.47*t,y:.08*r,size:35,r:5,color:"#9370DB50"},{key:"middle-left",x:.15*t,y:.47*r,size:42,r:6,color:"#FF149350"},{key:"middle-right",x:.75*t,y:.57*r,size:38,r:6,color:"#00BCD450"},{key:"bottom-center",x:.57*t,y:.87*r,size:32,r:5,color:"#FF444450"}];export const getDecorativeCircles=()=>[{key:"circle-1",cx:.25*t,cy:.25*r,r:18,color:"#CDDC3945"},{key:"circle-2",cx:.65*t,cy:.35*r,r:22,color:"#E91E6345"},{key:"circle-3",cx:.35*t,cy:.65*r,r:16,color:"#FFA36645"}];export const getGradientColors=()=>({main:["#FF6B3530","#FFD70025","#32CD3230","#4169E125","#9370DB30"],overlay:["#FF444420","transparent","#FF149320","transparent","#00BCD420","transparent"],diagonal:["#FF8C4215","transparent","#CDDC3915","transparent","#FFA36615","transparent"]});export class ColorSortService{cleanup(){}}
|