react-native-games 1.1.0 → 1.2.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/README.md +58 -7
- package/lib/module/games/balloon-blaster/BalloonBlaster.js +1 -167
- package/lib/module/games/balloon-blaster/BalloonBlaster.js.map +1 -1
- package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js +1 -182
- package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js.map +1 -1
- package/lib/module/games/balloon-blaster/BalloonBlasterService.js +1 -318
- package/lib/module/games/balloon-blaster/BalloonBlasterStore.js +1 -183
- package/lib/module/games/balloon-blaster/components/BalloonComponent.js +1 -237
- package/lib/module/games/balloon-blaster/components/GameArea.js +1 -156
- package/lib/module/games/balloon-blaster/components/GameBackground.js +1 -476
- package/lib/module/games/balloon-blaster/components/ScoreBoard.js +1 -112
- package/lib/module/games/balloon-blaster/components/ScoreBoard.js.map +1 -1
- package/lib/module/games/balloon-blaster/components/index.js +1 -7
- package/lib/module/games/candy-crush/CandyCrush.js +1 -131
- package/lib/module/games/candy-crush/CandyCrush.js.map +1 -1
- package/lib/module/games/candy-crush/CandyCrushConstants.js +1 -125
- package/lib/module/games/candy-crush/CandyCrushConstants.js.map +1 -1
- package/lib/module/games/candy-crush/CandyCrushService.js +1 -370
- package/lib/module/games/candy-crush/CandyCrushStore.js +1 -303
- package/lib/module/games/candy-crush/components/CandyItem.js +1 -191
- package/lib/module/games/candy-crush/components/GameBackground.js +1 -85
- package/lib/module/games/candy-crush/components/GameGrid.js +1 -314
- package/lib/module/games/candy-crush/components/ScoreBoard.js +1 -79
- package/lib/module/games/candy-crush/components/index.js +1 -7
- package/lib/module/games/candy-crush/index.js +1 -6
- package/lib/module/games/colors-sort/ColorsSort.js +1 -143
- package/lib/module/games/colors-sort/ColorsSort.js.map +1 -1
- package/lib/module/games/colors-sort/ColorsSortConstants.js +1 -72
- package/lib/module/games/colors-sort/ColorsSortConstants.js.map +1 -1
- package/lib/module/games/colors-sort/ColorsSortService.js +1 -255
- package/lib/module/games/colors-sort/ColorsSortStore.js +1 -257
- package/lib/module/games/colors-sort/ColorsSortStore.js.map +1 -1
- package/lib/module/games/colors-sort/components/ColorContainer.js +1 -140
- package/lib/module/games/colors-sort/components/GameBackground.js +1 -135
- package/lib/module/games/colors-sort/components/ScoreBoard.js +1 -70
- package/lib/module/games/colors-sort/components/index.js +1 -6
- package/lib/module/games/dino-jump/DinoJump.js +1 -209
- package/lib/module/games/dino-jump/DinoJump.js.map +1 -1
- package/lib/module/games/dino-jump/DinoJumpConstants.js +1 -189
- package/lib/module/games/dino-jump/DinoJumpConstants.js.map +1 -1
- package/lib/module/games/dino-jump/DinoJumpService.js +1 -270
- package/lib/module/games/dino-jump/DinoJumpStore.js +1 -381
- package/lib/module/games/dino-jump/components/DinoSprite.js +1 -418
- package/lib/module/games/dino-jump/components/DinoSprite.js.map +1 -1
- package/lib/module/games/dino-jump/components/GameArea.js +1 -68
- package/lib/module/games/dino-jump/components/GameBackground.js +1 -444
- package/lib/module/games/dino-jump/components/ObstacleSprite.js +1 -306
- package/lib/module/games/dino-jump/components/ScoreBoard.js +1 -105
- package/lib/module/games/dino-jump/components/ScoreBoard.js.map +1 -1
- package/lib/module/games/dino-jump/components/StarSprite.js +1 -45
- package/lib/module/games/dino-jump/components/index.js +1 -9
- package/lib/module/games/flappy-bird/FlappyBird.js +1 -126
- package/lib/module/games/flappy-bird/FlappyBird.js.map +1 -1
- package/lib/module/games/flappy-bird/FlappyBirdConstants.js +1 -90
- package/lib/module/games/flappy-bird/FlappyBirdConstants.js.map +1 -1
- package/lib/module/games/flappy-bird/FlappyBirdStore.js +1 -300
- package/lib/module/games/flappy-bird/components/Bird.js +1 -87
- package/lib/module/games/flappy-bird/components/GameArea.js +1 -87
- package/lib/module/games/flappy-bird/components/GameBackground.js +1 -79
- package/lib/module/games/flappy-bird/components/Pipes.js +1 -172
- package/lib/module/games/flappy-bird/components/ScoreBoard.js +1 -73
- package/lib/module/games/flappy-bird/components/index.js +1 -8
- package/lib/module/games/fruit-merger/FruitMerger.js +1 -120
- package/lib/module/games/fruit-merger/FruitMerger.js.map +1 -1
- package/lib/module/games/fruit-merger/FruitMergerConstants.js +1 -119
- package/lib/module/games/fruit-merger/FruitMergerConstants.js.map +1 -1
- package/lib/module/games/fruit-merger/FruitMergerService.js +1 -13
- package/lib/module/games/fruit-merger/FruitMergerStore.js +1 -315
- package/lib/module/games/fruit-merger/components/FruitItem.js +1 -102
- package/lib/module/games/fruit-merger/components/GameArea.js +1 -103
- package/lib/module/games/fruit-merger/components/GameBackground.js +1 -498
- package/lib/module/games/fruit-merger/components/ScoreBoard.js +1 -58
- package/lib/module/games/fruit-merger/components/index.js +1 -7
- package/lib/module/games/fruit-ninja/FruitNinja.js +1 -134
- package/lib/module/games/fruit-ninja/FruitNinja.js.map +1 -1
- package/lib/module/games/fruit-ninja/FruitNinjaConstants.js +1 -148
- package/lib/module/games/fruit-ninja/FruitNinjaConstants.js.map +1 -1
- package/lib/module/games/fruit-ninja/FruitNinjaService.js +1 -311
- package/lib/module/games/fruit-ninja/FruitNinjaStore.js +1 -191
- package/lib/module/games/fruit-ninja/FruitNinjaStore.js.map +1 -1
- package/lib/module/games/fruit-ninja/components/FruitComponent.js +1 -99
- package/lib/module/games/fruit-ninja/components/GameArea.js +1 -215
- package/lib/module/games/fruit-ninja/components/GameBackground.js +1 -1267
- package/lib/module/games/fruit-ninja/components/ScoreBoard.js +1 -92
- package/lib/module/games/fruit-ninja/components/ScoreBoard.js.map +1 -1
- package/lib/module/games/fruit-ninja/components/index.js +1 -7
- package/lib/module/games/game-2048/Game2048.js +1 -149
- package/lib/module/games/game-2048/Game2048.js.map +1 -1
- package/lib/module/games/game-2048/Game2048Constants.js +1 -263
- package/lib/module/games/game-2048/Game2048Constants.js.map +1 -1
- package/lib/module/games/game-2048/Game2048Service.js +1 -457
- package/lib/module/games/game-2048/Game2048Store.js +1 -236
- package/lib/module/games/game-2048/components/GameBackground.js +1 -247
- package/lib/module/games/game-2048/components/GameGrid.js +1 -139
- package/lib/module/games/game-2048/components/GameTile.js +1 -72
- package/lib/module/games/game-2048/components/ScoreBoard.js +1 -52
- package/lib/module/games/game-2048/components/index.js +1 -7
- package/lib/module/games/maze-runner/MazeRunner.js +1 -267
- package/lib/module/games/maze-runner/MazeRunner.js.map +1 -1
- package/lib/module/games/maze-runner/MazeRunnerConstants.js +1 -100
- package/lib/module/games/maze-runner/MazeRunnerConstants.js.map +1 -1
- package/lib/module/games/maze-runner/MazeRunnerService.js +1 -586
- package/lib/module/games/maze-runner/components/EnhancedBallComponent.js +1 -150
- package/lib/module/games/maze-runner/components/EnhancedGameArea.js +1 -370
- package/lib/module/games/maze-runner/components/GameBackground.js +1 -175
- package/lib/module/games/maze-runner/components/ScoreBoard.js +1 -61
- package/lib/module/games/maze-runner/components/SkiaPipeComponent.js +1 -209
- package/lib/module/games/maze-runner/components/StaticGameBackground.js +1 -169
- package/lib/module/games/maze-runner/components/WallComponent.js +1 -91
- package/lib/module/games/maze-runner/components/index.js +1 -8
- package/lib/module/games/popit-fidget/PopitFidget.js +1 -285
- package/lib/module/games/popit-fidget/PopitFidget.js.map +1 -1
- package/lib/module/games/popit-fidget/PopitFidgetConstants.js +1 -113
- package/lib/module/games/popit-fidget/PopitFidgetConstants.js.map +1 -1
- package/lib/module/games/popit-fidget/PopitFidgetService.js +1 -132
- package/lib/module/games/popit-fidget/PopitFidgetStore.js +1 -125
- package/lib/module/games/popit-fidget/components/BubbleComponent.js +1 -198
- package/lib/module/games/popit-fidget/components/FidgetGrid.js +1 -165
- package/lib/module/games/popit-fidget/components/GameBackground.js +1 -177
- package/lib/module/games/popit-fidget/components/ScoreBoard.js +1 -61
- package/lib/module/games/popit-fidget/components/index.js +1 -7
- package/lib/module/games/sliding-numbers/SlidingNumbers.js +1 -159
- package/lib/module/games/sliding-numbers/SlidingNumbers.js.map +1 -1
- package/lib/module/games/sliding-numbers/SlidingNumbersConstants.js +1 -207
- package/lib/module/games/sliding-numbers/SlidingNumbersConstants.js.map +1 -1
- package/lib/module/games/sliding-numbers/SlidingNumbersService.js +1 -248
- package/lib/module/games/sliding-numbers/SlidingNumbersStore.js +1 -274
- package/lib/module/games/sliding-numbers/components/GameBackground.js +1 -259
- package/lib/module/games/sliding-numbers/components/NumbersGrid.js +1 -174
- package/lib/module/games/sliding-numbers/components/NumbersTile.js +1 -116
- package/lib/module/games/sliding-numbers/components/ScoreBoard.js +1 -64
- package/lib/module/games/sliding-numbers/components/index.js +1 -7
- package/lib/module/games/snake/Snake.js +1 -189
- package/lib/module/games/snake/Snake.js.map +1 -1
- package/lib/module/games/snake/SnakeConstants.js +1 -138
- package/lib/module/games/snake/SnakeConstants.js.map +1 -1
- package/lib/module/games/snake/SnakeService.js +1 -148
- package/lib/module/games/snake/SnakeStore.js +1 -182
- package/lib/module/games/snake/components/GameBackground.js +1 -221
- package/lib/module/games/snake/components/GameGrid.js +1 -153
- package/lib/module/games/snake/components/ScoreBoard.js +1 -51
- package/lib/module/games/snake/components/index.js +1 -6
- package/lib/module/games/snake/index.js +1 -6
- package/lib/module/games/space-fighter/SpaceFighter.js +1 -165
- package/lib/module/games/space-fighter/SpaceFighter.js.map +1 -1
- package/lib/module/games/space-fighter/SpaceFighterConstants.js +1 -108
- package/lib/module/games/space-fighter/SpaceFighterConstants.js.map +1 -1
- package/lib/module/games/space-fighter/SpaceFighterService.js +1 -326
- package/lib/module/games/space-fighter/SpaceFighterStore.js +1 -209
- package/lib/module/games/space-fighter/components/AsteroidComponent.js +1 -113
- package/lib/module/games/space-fighter/components/GameArea.js +1 -289
- package/lib/module/games/space-fighter/components/GameBackground.js +1 -239
- package/lib/module/games/space-fighter/components/ScoreBoard.js +1 -136
- package/lib/module/games/space-fighter/components/Spacecraft3D.js +1 -202
- package/lib/module/games/space-fighter/components/SpacecraftPath.js +1 -52
- package/lib/module/games/space-fighter/components/index.js +1 -9
- package/lib/module/games/whack-a-mole/WhackAMole.js +1 -270
- package/lib/module/games/whack-a-mole/WhackAMole.js.map +1 -1
- package/lib/module/games/whack-a-mole/WhackAMoleConstants.js +1 -115
- package/lib/module/games/whack-a-mole/WhackAMoleConstants.js.map +1 -1
- package/lib/module/games/whack-a-mole/WhackAMoleService.js +1 -120
- package/lib/module/games/whack-a-mole/WhackAMoleStore.js +1 -172
- package/lib/module/games/whack-a-mole/components/GameBackground.js +1 -477
- package/lib/module/games/whack-a-mole/components/GameGrid.js +1 -97
- package/lib/module/games/whack-a-mole/components/GameHole.js +1 -196
- package/lib/module/games/whack-a-mole/components/MoleCharacter.js +1 -241
- package/lib/module/games/whack-a-mole/components/ScoreBoard.js +1 -67
- package/lib/module/games/whack-a-mole/components/ScoreBoard.js.map +1 -1
- package/lib/module/games/whack-a-mole/components/index.js +1 -8
- package/lib/module/helpers/AnimationFrame.js +1 -120
- package/lib/module/helpers/AnimationTracker.js +1 -89
- package/lib/module/helpers/ErrorHandler.js +1 -269
- package/lib/module/helpers/GameControlButton.js +1 -219
- package/lib/module/helpers/GameOverModal.js +1 -144
- package/lib/module/helpers/GameOverModal.js.map +1 -1
- package/lib/module/helpers/GameSettingsModal.js +1 -287
- package/lib/module/helpers/ParticleBlast.js +1 -134
- package/lib/module/helpers/ScoreBoardContainer.js +1 -34
- package/lib/module/helpers/index.js +1 -12
- package/lib/module/index.js +1 -22
- package/lib/module/services/GamesConstants.js +1 -178
- package/lib/module/services/GamesService.js +1 -112
- package/lib/module/services/GamesService.js.map +1 -1
- package/lib/module/services/HapticsService.js +1 -77
- package/lib/module/services/SoundsService.js +1 -302
- package/lib/module/services/UtilsService.js +1 -32
- package/lib/typescript/src/games/balloon-blaster/BalloonBlaster.d.ts.map +1 -1
- package/lib/typescript/src/games/balloon-blaster/BalloonBlasterConstants.d.ts +1 -1
- package/lib/typescript/src/games/balloon-blaster/components/ScoreBoard.d.ts.map +1 -1
- package/lib/typescript/src/games/candy-crush/CandyCrushConstants.d.ts +7 -7
- package/lib/typescript/src/games/colors-sort/ColorsSort.d.ts.map +1 -1
- package/lib/typescript/src/games/colors-sort/ColorsSortStore.d.ts.map +1 -1
- package/lib/typescript/src/games/dino-jump/DinoJump.d.ts.map +1 -1
- package/lib/typescript/src/games/dino-jump/components/DinoSprite.d.ts.map +1 -1
- package/lib/typescript/src/games/flappy-bird/FlappyBird.d.ts.map +1 -1
- package/lib/typescript/src/games/flappy-bird/FlappyBirdConstants.d.ts.map +1 -1
- package/lib/typescript/src/games/fruit-merger/FruitMerger.d.ts.map +1 -1
- package/lib/typescript/src/games/fruit-merger/FruitMergerConstants.d.ts.map +1 -1
- package/lib/typescript/src/games/fruit-ninja/FruitNinja.d.ts.map +1 -1
- package/lib/typescript/src/games/fruit-ninja/components/ScoreBoard.d.ts.map +1 -1
- package/lib/typescript/src/games/game-2048/Game2048.d.ts.map +1 -1
- package/lib/typescript/src/games/maze-runner/MazeRunner.d.ts.map +1 -1
- package/lib/typescript/src/games/popit-fidget/PopitFidget.d.ts.map +1 -1
- package/lib/typescript/src/games/sliding-numbers/SlidingNumbers.d.ts.map +1 -1
- package/lib/typescript/src/games/space-fighter/SpaceFighter.d.ts.map +1 -1
- package/lib/typescript/src/games/whack-a-mole/WhackAMole.d.ts.map +1 -1
- package/lib/typescript/src/games/whack-a-mole/WhackAMoleConstants.d.ts +1 -1
- package/lib/typescript/src/games/whack-a-mole/components/ScoreBoard.d.ts.map +1 -1
- package/lib/typescript/src/helpers/GameOverModal.d.ts +3 -0
- package/lib/typescript/src/helpers/GameOverModal.d.ts.map +1 -1
- package/lib/typescript/src/services/GamesConstants.d.ts +7 -7
- package/package.json +2 -2
|
@@ -1,79 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { View, Dimensions } from 'react-native';
|
|
5
|
-
import { Canvas, LinearGradient, Rect, Circle, vec, Group } from '@shopify/react-native-skia';
|
|
6
|
-
import { FLAPPY_BIRD_COLORS } from "../FlappyBirdConstants.js";
|
|
7
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
-
const {
|
|
9
|
-
width,
|
|
10
|
-
height
|
|
11
|
-
} = Dimensions.get('window');
|
|
12
|
-
// Create static cloud positions
|
|
13
|
-
const cloudPositions = [{
|
|
14
|
-
x: width * 0.15,
|
|
15
|
-
y: height * 0.15,
|
|
16
|
-
scale: 1
|
|
17
|
-
}, {
|
|
18
|
-
x: width * 0.45,
|
|
19
|
-
y: height * 0.25,
|
|
20
|
-
scale: 0.8
|
|
21
|
-
}, {
|
|
22
|
-
x: width * 0.75,
|
|
23
|
-
y: height * 0.18,
|
|
24
|
-
scale: 1.2
|
|
25
|
-
}, {
|
|
26
|
-
x: width * 0.3,
|
|
27
|
-
y: height * 0.35,
|
|
28
|
-
scale: 0.9
|
|
29
|
-
}];
|
|
30
|
-
export const GameBackground = /*#__PURE__*/React.memo(({
|
|
31
|
-
children,
|
|
32
|
-
offset = 0
|
|
33
|
-
}) => {
|
|
34
|
-
const bottomWallHeight = offset > 0 ? 150 : 250; // Dynamic bottom wall height
|
|
35
|
-
const skyEndY = height - bottomWallHeight; // Sky extends to where bottom wall starts
|
|
36
|
-
|
|
37
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
38
|
-
style: {
|
|
39
|
-
flex: 1
|
|
40
|
-
},
|
|
41
|
-
children: [/*#__PURE__*/_jsxs(Canvas, {
|
|
42
|
-
style: {
|
|
43
|
-
position: 'absolute',
|
|
44
|
-
width,
|
|
45
|
-
height
|
|
46
|
-
},
|
|
47
|
-
children: [/*#__PURE__*/_jsx(Rect, {
|
|
48
|
-
x: 0,
|
|
49
|
-
y: 0,
|
|
50
|
-
width: width,
|
|
51
|
-
height: skyEndY,
|
|
52
|
-
children: /*#__PURE__*/_jsx(LinearGradient, {
|
|
53
|
-
start: vec(0, 0),
|
|
54
|
-
end: vec(0, skyEndY),
|
|
55
|
-
colors: [FLAPPY_BIRD_COLORS.SKY_START, FLAPPY_BIRD_COLORS.SKY_END]
|
|
56
|
-
})
|
|
57
|
-
}), cloudPositions.map((cloud, index) => /*#__PURE__*/_jsxs(Group, {
|
|
58
|
-
children: [/*#__PURE__*/_jsx(Circle, {
|
|
59
|
-
cx: cloud.x - 20 * cloud.scale,
|
|
60
|
-
cy: cloud.y,
|
|
61
|
-
r: 15 * cloud.scale,
|
|
62
|
-
color: "rgba(255, 255, 255, 0.7)"
|
|
63
|
-
}), /*#__PURE__*/_jsx(Circle, {
|
|
64
|
-
cx: cloud.x,
|
|
65
|
-
cy: cloud.y - 5 * cloud.scale,
|
|
66
|
-
r: 20 * cloud.scale,
|
|
67
|
-
color: "rgba(255, 255, 255, 0.8)"
|
|
68
|
-
}), /*#__PURE__*/_jsx(Circle, {
|
|
69
|
-
cx: cloud.x + 20 * cloud.scale,
|
|
70
|
-
cy: cloud.y,
|
|
71
|
-
r: 15 * cloud.scale,
|
|
72
|
-
color: "rgba(255, 255, 255, 0.7)"
|
|
73
|
-
})]
|
|
74
|
-
}, `cloud-${index}`))]
|
|
75
|
-
}), children]
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
GameBackground.displayName = 'GameBackground';
|
|
79
|
-
//# sourceMappingURL=GameBackground.js.map
|
|
1
|
+
"use strict";import React from 'react';import{View,Dimensions}from 'react-native';import{Canvas,LinearGradient,Rect,Circle,vec,Group}from '@shopify/react-native-skia';import{FLAPPY_BIRD_COLORS}from "../FlappyBirdConstants.js";import{jsx as _jsx,jsxs as _jsxs}from "react/jsx-runtime";const{width,height}= Dimensions.get('window');const cloudPositions = [{x:width * 0.15,y:height * 0.15,scale:1},{x:width * 0.45,y:height * 0.25,scale:0.8},{x:width * 0.75,y:height * 0.18,scale:1.2},{x:width * 0.3,y:height * 0.35,scale:0.9}];export const GameBackground = React.memo(({children,offset = 0})=>{const bottomWallHeight = offset > 0 ? 150:250;const skyEndY = height - bottomWallHeight;return _jsxs(View,{style:{flex:1},children:[_jsxs(Canvas,{style:{position:'absolute',width,height},children:[_jsx(Rect,{x:0,y:0,width:width,height:skyEndY,children:_jsx(LinearGradient,{start:vec(0,0),end:vec(0,skyEndY),colors:[FLAPPY_BIRD_COLORS.SKY_START,FLAPPY_BIRD_COLORS.SKY_END]})}),cloudPositions.map((cloud,index)=> _jsxs(Group,{children:[_jsx(Circle,{cx:cloud.x - 20 * cloud.scale,cy:cloud.y,r:15 * cloud.scale,color:"rgba(255,255,255,0.7)"}),_jsx(Circle,{cx:cloud.x,cy:cloud.y - 5 * cloud.scale,r:20 * cloud.scale,color:"rgba(255,255,255,0.8)"}),_jsx(Circle,{cx:cloud.x + 20 * cloud.scale,cy:cloud.y,r:15 * cloud.scale,color:"rgba(255,255,255,0.7)"})]},`cloud-${index}`))]}),children]});});GameBackground.displayName = 'GameBackground';
|
|
@@ -1,172 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { View, StyleSheet, Dimensions } from 'react-native';
|
|
5
|
-
import { Canvas, Rect, RoundedRect, LinearGradient, vec, Shadow } from '@shopify/react-native-skia';
|
|
6
|
-
import { FLAPPY_BIRD_GAME_CONFIG, FLAPPY_BIRD_COLORS } from "../FlappyBirdConstants.js";
|
|
7
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
8
|
-
const {
|
|
9
|
-
width
|
|
10
|
-
} = Dimensions.get('window');
|
|
11
|
-
// Constants for brick wall
|
|
12
|
-
const brickWallHeight = 150;
|
|
13
|
-
const brickWidth = 40;
|
|
14
|
-
const brickHeight = 20;
|
|
15
|
-
const actualScreenHeight = FLAPPY_BIRD_GAME_CONFIG.GAME_HEIGHT; // Full screen height
|
|
16
|
-
|
|
17
|
-
export const Pipes = /*#__PURE__*/React.memo(({
|
|
18
|
-
pipes,
|
|
19
|
-
offset = 0
|
|
20
|
-
}) => {
|
|
21
|
-
const {
|
|
22
|
-
PIPE_WIDTH
|
|
23
|
-
} = FLAPPY_BIRD_GAME_CONFIG;
|
|
24
|
-
|
|
25
|
-
// Increase top wall height by offset
|
|
26
|
-
const adjustedTopWallHeight = brickWallHeight + offset;
|
|
27
|
-
// Dynamic bottom wall height based on offset
|
|
28
|
-
const bottomWallHeight = offset > 0 ? 150 : 250;
|
|
29
|
-
return /*#__PURE__*/_jsx(View, {
|
|
30
|
-
style: StyleSheet.absoluteFill,
|
|
31
|
-
pointerEvents: "none",
|
|
32
|
-
children: /*#__PURE__*/_jsxs(Canvas, {
|
|
33
|
-
style: {
|
|
34
|
-
flex: 1
|
|
35
|
-
},
|
|
36
|
-
children: [/*#__PURE__*/_jsx(Rect, {
|
|
37
|
-
x: 0,
|
|
38
|
-
y: 0,
|
|
39
|
-
width: width,
|
|
40
|
-
height: adjustedTopWallHeight,
|
|
41
|
-
children: /*#__PURE__*/_jsx(LinearGradient, {
|
|
42
|
-
start: vec(0, 0),
|
|
43
|
-
end: vec(0, adjustedTopWallHeight),
|
|
44
|
-
colors: ['#8B4513', '#A0522D', '#8B4513']
|
|
45
|
-
})
|
|
46
|
-
}), Array.from({
|
|
47
|
-
length: Math.ceil(width / brickWidth) + 1
|
|
48
|
-
}).map((_, col) => Array.from({
|
|
49
|
-
length: Math.ceil(adjustedTopWallHeight / brickHeight)
|
|
50
|
-
}).map((_, row) => {
|
|
51
|
-
const xOffset = row % 2 === 0 ? 0 : brickWidth / 2;
|
|
52
|
-
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
53
|
-
children: [/*#__PURE__*/_jsx(Rect, {
|
|
54
|
-
x: col * brickWidth - xOffset,
|
|
55
|
-
y: row * brickHeight,
|
|
56
|
-
width: brickWidth - 2,
|
|
57
|
-
height: 2,
|
|
58
|
-
color: "rgba(0,0,0,0.3)"
|
|
59
|
-
}), /*#__PURE__*/_jsx(Rect, {
|
|
60
|
-
x: col * brickWidth - xOffset,
|
|
61
|
-
y: row * brickHeight,
|
|
62
|
-
width: 2,
|
|
63
|
-
height: brickHeight - 2,
|
|
64
|
-
color: "rgba(0,0,0,0.3)"
|
|
65
|
-
})]
|
|
66
|
-
}, `top-brick-${col}-${row}`);
|
|
67
|
-
})), /*#__PURE__*/_jsx(Rect, {
|
|
68
|
-
x: 0,
|
|
69
|
-
y: actualScreenHeight - bottomWallHeight,
|
|
70
|
-
width: width,
|
|
71
|
-
height: bottomWallHeight,
|
|
72
|
-
children: /*#__PURE__*/_jsx(LinearGradient, {
|
|
73
|
-
start: vec(0, actualScreenHeight - bottomWallHeight),
|
|
74
|
-
end: vec(0, actualScreenHeight),
|
|
75
|
-
colors: ['#8B4513', '#A0522D', '#8B4513']
|
|
76
|
-
})
|
|
77
|
-
}), Array.from({
|
|
78
|
-
length: Math.ceil(width / brickWidth) + 1
|
|
79
|
-
}).map((_, col) => Array.from({
|
|
80
|
-
length: Math.ceil(bottomWallHeight / brickHeight)
|
|
81
|
-
}).map((_, row) => {
|
|
82
|
-
const xOffset = row % 2 === 0 ? 0 : brickWidth / 2;
|
|
83
|
-
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
84
|
-
children: [/*#__PURE__*/_jsx(Rect, {
|
|
85
|
-
x: col * brickWidth - xOffset,
|
|
86
|
-
y: actualScreenHeight - bottomWallHeight + row * brickHeight,
|
|
87
|
-
width: brickWidth - 2,
|
|
88
|
-
height: 2,
|
|
89
|
-
color: "rgba(0,0,0,0.3)"
|
|
90
|
-
}), /*#__PURE__*/_jsx(Rect, {
|
|
91
|
-
x: col * brickWidth - xOffset,
|
|
92
|
-
y: actualScreenHeight - bottomWallHeight + row * brickHeight,
|
|
93
|
-
width: 2,
|
|
94
|
-
height: brickHeight - 2,
|
|
95
|
-
color: "rgba(0,0,0,0.3)"
|
|
96
|
-
})]
|
|
97
|
-
}, `bottom-brick-${col}-${row}`);
|
|
98
|
-
})), pipes.map(pipe => {
|
|
99
|
-
// Ensure pipes stay within the playable area (between walls)
|
|
100
|
-
// Pipes are already generated with offset, so don't add it again
|
|
101
|
-
const topPipeStart = adjustedTopWallHeight;
|
|
102
|
-
const bottomWallTop = actualScreenHeight - bottomWallHeight; // Dynamic bottom wall
|
|
103
|
-
const topPipeEnd = Math.max(topPipeStart, Math.min(pipe.topHeight, bottomWallTop));
|
|
104
|
-
const bottomPipeStart = Math.max(topPipeStart, Math.min(pipe.bottomY, bottomWallTop));
|
|
105
|
-
const bottomPipeEnd = bottomWallTop;
|
|
106
|
-
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
107
|
-
children: [topPipeEnd > topPipeStart && /*#__PURE__*/_jsxs(_Fragment, {
|
|
108
|
-
children: [/*#__PURE__*/_jsx(RoundedRect, {
|
|
109
|
-
x: pipe.x,
|
|
110
|
-
y: topPipeStart,
|
|
111
|
-
width: PIPE_WIDTH,
|
|
112
|
-
height: topPipeEnd - topPipeStart,
|
|
113
|
-
r: 4,
|
|
114
|
-
children: /*#__PURE__*/_jsx(LinearGradient, {
|
|
115
|
-
start: vec(pipe.x, 0),
|
|
116
|
-
end: vec(pipe.x + PIPE_WIDTH, 0),
|
|
117
|
-
colors: [FLAPPY_BIRD_COLORS.PIPE_GREEN, FLAPPY_BIRD_COLORS.PIPE_DARK]
|
|
118
|
-
})
|
|
119
|
-
}), /*#__PURE__*/_jsxs(RoundedRect, {
|
|
120
|
-
x: pipe.x - 5,
|
|
121
|
-
y: topPipeEnd - 20,
|
|
122
|
-
width: PIPE_WIDTH + 10,
|
|
123
|
-
height: 25,
|
|
124
|
-
r: 4,
|
|
125
|
-
children: [/*#__PURE__*/_jsx(LinearGradient, {
|
|
126
|
-
start: vec(pipe.x - 5, 0),
|
|
127
|
-
end: vec(pipe.x + PIPE_WIDTH + 5, 0),
|
|
128
|
-
colors: [FLAPPY_BIRD_COLORS.PIPE_DARK, FLAPPY_BIRD_COLORS.PIPE_GREEN]
|
|
129
|
-
}), /*#__PURE__*/_jsx(Shadow, {
|
|
130
|
-
dx: 0,
|
|
131
|
-
dy: 4,
|
|
132
|
-
blur: 8,
|
|
133
|
-
color: "rgba(0,0,0,0.4)"
|
|
134
|
-
})]
|
|
135
|
-
})]
|
|
136
|
-
}), bottomPipeStart < bottomPipeEnd && /*#__PURE__*/_jsxs(_Fragment, {
|
|
137
|
-
children: [/*#__PURE__*/_jsx(RoundedRect, {
|
|
138
|
-
x: pipe.x,
|
|
139
|
-
y: bottomPipeStart,
|
|
140
|
-
width: PIPE_WIDTH,
|
|
141
|
-
height: bottomPipeEnd - bottomPipeStart,
|
|
142
|
-
r: 4,
|
|
143
|
-
children: /*#__PURE__*/_jsx(LinearGradient, {
|
|
144
|
-
start: vec(pipe.x, 0),
|
|
145
|
-
end: vec(pipe.x + PIPE_WIDTH, 0),
|
|
146
|
-
colors: [FLAPPY_BIRD_COLORS.PIPE_GREEN, FLAPPY_BIRD_COLORS.PIPE_DARK]
|
|
147
|
-
})
|
|
148
|
-
}), /*#__PURE__*/_jsxs(RoundedRect, {
|
|
149
|
-
x: pipe.x - 5,
|
|
150
|
-
y: bottomPipeStart,
|
|
151
|
-
width: PIPE_WIDTH + 10,
|
|
152
|
-
height: 25,
|
|
153
|
-
r: 4,
|
|
154
|
-
children: [/*#__PURE__*/_jsx(LinearGradient, {
|
|
155
|
-
start: vec(pipe.x - 5, 0),
|
|
156
|
-
end: vec(pipe.x + PIPE_WIDTH + 5, 0),
|
|
157
|
-
colors: [FLAPPY_BIRD_COLORS.PIPE_DARK, FLAPPY_BIRD_COLORS.PIPE_GREEN]
|
|
158
|
-
}), /*#__PURE__*/_jsx(Shadow, {
|
|
159
|
-
dx: 0,
|
|
160
|
-
dy: -4,
|
|
161
|
-
blur: 8,
|
|
162
|
-
color: "rgba(0,0,0,0.4)"
|
|
163
|
-
})]
|
|
164
|
-
})]
|
|
165
|
-
})]
|
|
166
|
-
}, pipe.id);
|
|
167
|
-
})]
|
|
168
|
-
})
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
Pipes.displayName = 'Pipes';
|
|
172
|
-
//# sourceMappingURL=Pipes.js.map
|
|
1
|
+
"use strict";import React from 'react';import{View,StyleSheet,Dimensions}from 'react-native';import{Canvas,Rect,RoundedRect,LinearGradient,vec,Shadow}from '@shopify/react-native-skia';import{FLAPPY_BIRD_GAME_CONFIG,FLAPPY_BIRD_COLORS}from "../FlappyBirdConstants.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from "react/jsx-runtime";const{width}= Dimensions.get('window');const brickWallHeight = 150;const brickWidth = 40;const brickHeight = 20;const actualScreenHeight = FLAPPY_BIRD_GAME_CONFIG.GAME_HEIGHT;export const Pipes = React.memo(({pipes,offset = 0})=>{const{PIPE_WIDTH}= FLAPPY_BIRD_GAME_CONFIG;const adjustedTopWallHeight = brickWallHeight + offset;const bottomWallHeight = offset > 0 ? 150:250;return _jsx(View,{style:StyleSheet.absoluteFill,pointerEvents:"none",children:_jsxs(Canvas,{style:{flex:1},children:[_jsx(Rect,{x:0,y:0,width:width,height:adjustedTopWallHeight,children:_jsx(LinearGradient,{start:vec(0,0),end:vec(0,adjustedTopWallHeight),colors:['#8B4513','#A0522D','#8B4513']})}),Array.from({length:Math.ceil(width / brickWidth)+ 1}).map((_,col)=> Array.from({length:Math.ceil(adjustedTopWallHeight / brickHeight)}).map((_,row)=>{const xOffset = row % 2 === 0 ? 0:brickWidth / 2;return _jsxs(React.Fragment,{children:[_jsx(Rect,{x:col * brickWidth - xOffset,y:row * brickHeight,width:brickWidth - 2,height:2,color:"rgba(0,0,0,0.3)"}),_jsx(Rect,{x:col * brickWidth - xOffset,y:row * brickHeight,width:2,height:brickHeight - 2,color:"rgba(0,0,0,0.3)"})]},`top-brick-${col}-${row}`);})),_jsx(Rect,{x:0,y:actualScreenHeight - bottomWallHeight,width:width,height:bottomWallHeight,children:_jsx(LinearGradient,{start:vec(0,actualScreenHeight - bottomWallHeight),end:vec(0,actualScreenHeight),colors:['#8B4513','#A0522D','#8B4513']})}),Array.from({length:Math.ceil(width / brickWidth)+ 1}).map((_,col)=> Array.from({length:Math.ceil(bottomWallHeight / brickHeight)}).map((_,row)=>{const xOffset = row % 2 === 0 ? 0:brickWidth / 2;return _jsxs(React.Fragment,{children:[_jsx(Rect,{x:col * brickWidth - xOffset,y:actualScreenHeight - bottomWallHeight + row * brickHeight,width:brickWidth - 2,height:2,color:"rgba(0,0,0,0.3)"}),_jsx(Rect,{x:col * brickWidth - xOffset,y:actualScreenHeight - bottomWallHeight + row * brickHeight,width:2,height:brickHeight - 2,color:"rgba(0,0,0,0.3)"})]},`bottom-brick-${col}-${row}`);})),pipes.map(pipe =>{const topPipeStart = adjustedTopWallHeight;const bottomWallTop = actualScreenHeight - bottomWallHeight;const topPipeEnd = Math.max(topPipeStart,Math.min(pipe.topHeight,bottomWallTop));const bottomPipeStart = Math.max(topPipeStart,Math.min(pipe.bottomY,bottomWallTop));const bottomPipeEnd = bottomWallTop;return _jsxs(React.Fragment,{children:[topPipeEnd > topPipeStart && _jsxs(_Fragment,{children:[_jsx(RoundedRect,{x:pipe.x,y:topPipeStart,width:PIPE_WIDTH,height:topPipeEnd - topPipeStart,r:4,children:_jsx(LinearGradient,{start:vec(pipe.x,0),end:vec(pipe.x + PIPE_WIDTH,0),colors:[FLAPPY_BIRD_COLORS.PIPE_GREEN,FLAPPY_BIRD_COLORS.PIPE_DARK]})}),_jsxs(RoundedRect,{x:pipe.x - 5,y:topPipeEnd - 20,width:PIPE_WIDTH + 10,height:25,r:4,children:[_jsx(LinearGradient,{start:vec(pipe.x - 5,0),end:vec(pipe.x + PIPE_WIDTH + 5,0),colors:[FLAPPY_BIRD_COLORS.PIPE_DARK,FLAPPY_BIRD_COLORS.PIPE_GREEN]}),_jsx(Shadow,{dx:0,dy:4,blur:8,color:"rgba(0,0,0,0.4)"})]})]}),bottomPipeStart < bottomPipeEnd && _jsxs(_Fragment,{children:[_jsx(RoundedRect,{x:pipe.x,y:bottomPipeStart,width:PIPE_WIDTH,height:bottomPipeEnd - bottomPipeStart,r:4,children:_jsx(LinearGradient,{start:vec(pipe.x,0),end:vec(pipe.x + PIPE_WIDTH,0),colors:[FLAPPY_BIRD_COLORS.PIPE_GREEN,FLAPPY_BIRD_COLORS.PIPE_DARK]})}),_jsxs(RoundedRect,{x:pipe.x - 5,y:bottomPipeStart,width:PIPE_WIDTH + 10,height:25,r:4,children:[_jsx(LinearGradient,{start:vec(pipe.x - 5,0),end:vec(pipe.x + PIPE_WIDTH + 5,0),colors:[FLAPPY_BIRD_COLORS.PIPE_DARK,FLAPPY_BIRD_COLORS.PIPE_GREEN]}),_jsx(Shadow,{dx:0,dy:-4,blur:8,color:"rgba(0,0,0,0.4)"})]})]})]},pipe.id);})]})});});Pipes.displayName = 'Pipes';
|
|
@@ -1,73 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React, { useMemo } from 'react';
|
|
4
|
-
import { View, Text, StyleSheet } from 'react-native';
|
|
5
|
-
import { useSurvivalTime } from "../FlappyBirdStore.js";
|
|
6
|
-
import { ScoreBoardContainer } from "../../../helpers/index.js";
|
|
7
|
-
import { FLAPPY_BIRD_COLORS } from "../FlappyBirdConstants.js";
|
|
8
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
-
const formatTime = seconds => {
|
|
10
|
-
const mins = Math.floor(seconds / 60);
|
|
11
|
-
const secs = seconds % 60;
|
|
12
|
-
return `${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;
|
|
13
|
-
};
|
|
14
|
-
export const ScoreBoard = /*#__PURE__*/React.memo(({
|
|
15
|
-
offset = 0
|
|
16
|
-
}) => {
|
|
17
|
-
const survivalTime = useSurvivalTime();
|
|
18
|
-
const formattedTime = useMemo(() => formatTime(survivalTime), [survivalTime]);
|
|
19
|
-
return /*#__PURE__*/_jsx(ScoreBoardContainer, {
|
|
20
|
-
offset: offset,
|
|
21
|
-
backgroundColor: FLAPPY_BIRD_COLORS.SCORE_BACKGROUND,
|
|
22
|
-
borderColor: FLAPPY_BIRD_COLORS.SCORE_BORDER,
|
|
23
|
-
children: /*#__PURE__*/_jsx(View, {
|
|
24
|
-
style: styles.scoreBoard,
|
|
25
|
-
children: /*#__PURE__*/_jsxs(View, {
|
|
26
|
-
style: styles.scoreSection,
|
|
27
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
28
|
-
style: styles.scoreLabel,
|
|
29
|
-
children: "Time"
|
|
30
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
31
|
-
style: styles.scoreValue,
|
|
32
|
-
children: formattedTime
|
|
33
|
-
})]
|
|
34
|
-
})
|
|
35
|
-
})
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
const styles = StyleSheet.create({
|
|
39
|
-
scoreBoard: {
|
|
40
|
-
flexDirection: 'row',
|
|
41
|
-
justifyContent: 'center',
|
|
42
|
-
alignItems: 'center'
|
|
43
|
-
},
|
|
44
|
-
scoreSection: {
|
|
45
|
-
alignItems: 'center',
|
|
46
|
-
flex: 1
|
|
47
|
-
},
|
|
48
|
-
scoreLabel: {
|
|
49
|
-
fontSize: 18,
|
|
50
|
-
fontWeight: 'bold',
|
|
51
|
-
color: FLAPPY_BIRD_COLORS.SCORE_TEXT,
|
|
52
|
-
marginBottom: 4,
|
|
53
|
-
textShadowColor: 'rgba(0, 0, 0, 0.5)',
|
|
54
|
-
textShadowOffset: {
|
|
55
|
-
width: 1,
|
|
56
|
-
height: 1
|
|
57
|
-
},
|
|
58
|
-
textShadowRadius: 2
|
|
59
|
-
},
|
|
60
|
-
scoreValue: {
|
|
61
|
-
fontSize: 30,
|
|
62
|
-
fontWeight: 'bold',
|
|
63
|
-
color: FLAPPY_BIRD_COLORS.SCORE_TEXT,
|
|
64
|
-
textShadowColor: 'rgba(0, 0, 0, 0.8)',
|
|
65
|
-
textShadowOffset: {
|
|
66
|
-
width: 2,
|
|
67
|
-
height: 2
|
|
68
|
-
},
|
|
69
|
-
textShadowRadius: 4
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
ScoreBoard.displayName = 'ScoreBoard';
|
|
73
|
-
//# sourceMappingURL=ScoreBoard.js.map
|
|
1
|
+
"use strict";import React,{useMemo}from 'react';import{View,Text,StyleSheet}from 'react-native';import{useSurvivalTime}from "../FlappyBirdStore.js";import{ScoreBoardContainer}from "../../../helpers/index.js";import{FLAPPY_BIRD_COLORS}from "../FlappyBirdConstants.js";import{jsx as _jsx,jsxs as _jsxs}from "react/jsx-runtime";const formatTime = seconds =>{const mins = Math.floor(seconds / 60);const secs = seconds % 60;return `${mins.toString().padStart(2,'0')}:${secs.toString().padStart(2,'0')}`;};export const ScoreBoard = React.memo(({offset = 0})=>{const survivalTime = useSurvivalTime();const formattedTime = useMemo(()=> formatTime(survivalTime),[survivalTime]);return _jsx(ScoreBoardContainer,{offset:offset,backgroundColor:FLAPPY_BIRD_COLORS.SCORE_BACKGROUND,borderColor:FLAPPY_BIRD_COLORS.SCORE_BORDER,children:_jsx(View,{style:styles.scoreBoard,children:_jsxs(View,{style:styles.scoreSection,children:[_jsx(Text,{style:styles.scoreLabel,children:"Time"}),_jsx(Text,{style:styles.scoreValue,children:formattedTime})]})})});});const styles = StyleSheet.create({scoreBoard:{flexDirection:'row',justifyContent:'center',alignItems:'center'},scoreSection:{alignItems:'center',flex:1},scoreLabel:{fontSize:16,fontWeight:'bold',color:FLAPPY_BIRD_COLORS.SCORE_TEXT,marginBottom:4,textShadowColor:'rgba(0,0,0,0.5)',textShadowOffset:{width:1,height:1},textShadowRadius:2},scoreValue:{fontSize:25,fontWeight:'bold',color:FLAPPY_BIRD_COLORS.SCORE_TEXT,textShadowColor:'rgba(0,0,0,0.8)',textShadowOffset:{width:2,height:2},textShadowRadius:4}});ScoreBoard.displayName = 'ScoreBoard';
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
export { ScoreBoard } from "./ScoreBoard.js";
|
|
4
|
-
export { Bird } from "./Bird.js";
|
|
5
|
-
export { Pipes } from "./Pipes.js";
|
|
6
|
-
export { GameArea } from "./GameArea.js";
|
|
7
|
-
export { GameBackground } from "./GameBackground.js";
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
"use strict";export{ScoreBoard}from "./ScoreBoard.js";export{Bird}from "./Bird.js";export{Pipes}from "./Pipes.js";export{GameArea}from "./GameArea.js";export{GameBackground}from "./GameBackground.js";
|
|
@@ -1,120 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React, { useEffect, useCallback, useMemo, useRef } from 'react';
|
|
4
|
-
import { View, StyleSheet } from 'react-native';
|
|
5
|
-
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
6
|
-
import { useFruitMergerStore, useIsPlaying, useIsGameOver, useTime } from "./FruitMergerStore.js";
|
|
7
|
-
import { ScoreBoard, GameArea, GameBackground } from "./components/index.js";
|
|
8
|
-
import { GameControlButton, GameOverModal } from "../../helpers/index.js";
|
|
9
|
-
import { GameSettingsModal } from "../../helpers/index.js";
|
|
10
|
-
import { FRUIT_MERGER_COLORS } from "./FruitMergerConstants.js";
|
|
11
|
-
import { GAME_IDS, DEFAULT_GAME_SETTINGS } from "../../services/UtilsService.js";
|
|
12
|
-
import { playSound, GAME_SOUNDS } from "../../services/SoundsService.js";
|
|
13
|
-
import { playHaptic, HapticType } from "../../services/HapticsService.js";
|
|
14
|
-
import { formatTime } from "./FruitMergerService.js";
|
|
15
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
-
export const FruitMerger = /*#__PURE__*/React.memo(({
|
|
17
|
-
settings = DEFAULT_GAME_SETTINGS,
|
|
18
|
-
onSettingsChange
|
|
19
|
-
}) => {
|
|
20
|
-
const isPlaying = useIsPlaying();
|
|
21
|
-
const isGameOver = useIsGameOver();
|
|
22
|
-
const time = useTime();
|
|
23
|
-
const initializeGame = useFruitMergerStore(state => state.initializeGame);
|
|
24
|
-
const startGame = useFruitMergerStore(state => state.startGame);
|
|
25
|
-
const stopGame = useFruitMergerStore(state => state.stopGame);
|
|
26
|
-
const resetGame = useFruitMergerStore(state => state.resetGame);
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
initializeGame();
|
|
29
|
-
}, [initializeGame]);
|
|
30
|
-
const prevGameOverRef = useRef(false);
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
if (isGameOver && !prevGameOverRef.current) {
|
|
33
|
-
playSound(GAME_SOUNDS.FRUIT_MERGER.GAME_OVER, settings.enableSounds);
|
|
34
|
-
playHaptic(HapticType.HEAVY, settings.enableHaptics);
|
|
35
|
-
}
|
|
36
|
-
prevGameOverRef.current = isGameOver;
|
|
37
|
-
}, [isGameOver, settings.enableSounds, settings.enableHaptics]);
|
|
38
|
-
const handleStartGame = useCallback(() => {
|
|
39
|
-
initializeGame();
|
|
40
|
-
startGame();
|
|
41
|
-
playSound(GAME_SOUNDS.FRUIT_MERGER.START, settings.enableSounds);
|
|
42
|
-
playHaptic(HapticType.MEDIUM, settings.enableHaptics);
|
|
43
|
-
}, [initializeGame, startGame, settings.enableSounds, settings.enableHaptics]);
|
|
44
|
-
const handleStopGame = useCallback(() => {
|
|
45
|
-
stopGame();
|
|
46
|
-
}, [stopGame]);
|
|
47
|
-
const handleResetGame = useCallback(() => {
|
|
48
|
-
resetGame();
|
|
49
|
-
initializeGame();
|
|
50
|
-
}, [resetGame, initializeGame]);
|
|
51
|
-
|
|
52
|
-
// Memoize modal props to prevent unnecessary re-renders
|
|
53
|
-
const gameOverModalProps = useMemo(() => ({
|
|
54
|
-
isVisible: isGameOver,
|
|
55
|
-
score: time,
|
|
56
|
-
onPlayAgain: handleResetGame,
|
|
57
|
-
buttonText: "Merge Again!",
|
|
58
|
-
primaryColor: FRUIT_MERGER_COLORS.GAME_OVER_BG,
|
|
59
|
-
borderColor: FRUIT_MERGER_COLORS.BUTTON_PRIMARY,
|
|
60
|
-
buttonColor: FRUIT_MERGER_COLORS.BUTTON_PRIMARY,
|
|
61
|
-
buttonBorderColor: FRUIT_MERGER_COLORS.BUTTON_SECONDARY,
|
|
62
|
-
scoreLabel: "Time Survived",
|
|
63
|
-
scoreFormatter: formatTime
|
|
64
|
-
}), [isGameOver, time, handleResetGame]);
|
|
65
|
-
const gameSettingsModalProps = useMemo(() => ({
|
|
66
|
-
gameId: GAME_IDS.FRUIT_MERGER,
|
|
67
|
-
settings,
|
|
68
|
-
onSettingsChange
|
|
69
|
-
}), [settings, onSettingsChange]);
|
|
70
|
-
|
|
71
|
-
// Get offset from settings
|
|
72
|
-
const offset = settings?.offset ?? 0;
|
|
73
|
-
|
|
74
|
-
// Memoize GameControlButton props to prevent re-renders (CRITICAL)
|
|
75
|
-
const gameControlButtonProps = useMemo(() => ({
|
|
76
|
-
isPlaying,
|
|
77
|
-
gameOver: isGameOver,
|
|
78
|
-
onStartGame: handleStartGame,
|
|
79
|
-
onStopGame: handleStopGame,
|
|
80
|
-
startButtonText: "START MERGING",
|
|
81
|
-
stopButtonText: "STOP GAME",
|
|
82
|
-
startButtonSubtext: "Merge fruits!",
|
|
83
|
-
startButtonColor: FRUIT_MERGER_COLORS.BUTTON_PRIMARY,
|
|
84
|
-
startButtonBorderColor: FRUIT_MERGER_COLORS.BUTTON_SECONDARY
|
|
85
|
-
}), [isPlaying, isGameOver, handleStartGame, handleStopGame]);
|
|
86
|
-
return /*#__PURE__*/_jsx(View, {
|
|
87
|
-
style: styles.root,
|
|
88
|
-
children: /*#__PURE__*/_jsx(GestureHandlerRootView, {
|
|
89
|
-
children: /*#__PURE__*/_jsx(GameBackground, {
|
|
90
|
-
offset: offset,
|
|
91
|
-
children: /*#__PURE__*/_jsxs(View, {
|
|
92
|
-
style: [styles.container, {
|
|
93
|
-
paddingTop: offset
|
|
94
|
-
}],
|
|
95
|
-
children: [/*#__PURE__*/_jsx(ScoreBoard, {
|
|
96
|
-
offset: offset
|
|
97
|
-
}), /*#__PURE__*/_jsx(GameArea, {
|
|
98
|
-
settings: settings
|
|
99
|
-
}), /*#__PURE__*/_jsx(GameControlButton, {
|
|
100
|
-
...gameControlButtonProps
|
|
101
|
-
}), /*#__PURE__*/_jsx(GameOverModal, {
|
|
102
|
-
...gameOverModalProps
|
|
103
|
-
}), /*#__PURE__*/_jsx(GameSettingsModal, {
|
|
104
|
-
...gameSettingsModalProps
|
|
105
|
-
})]
|
|
106
|
-
})
|
|
107
|
-
})
|
|
108
|
-
})
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
const styles = StyleSheet.create({
|
|
112
|
-
root: {
|
|
113
|
-
flex: 1
|
|
114
|
-
},
|
|
115
|
-
container: {
|
|
116
|
-
flex: 1
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
FruitMerger.displayName = 'FruitMerger';
|
|
120
|
-
//# sourceMappingURL=FruitMerger.js.map
|
|
1
|
+
"use strict";import React,{useEffect,useCallback,useMemo,useRef}from 'react';import{View,StyleSheet}from 'react-native';import{GestureHandlerRootView}from 'react-native-gesture-handler';import{useFruitMergerStore,useIsPlaying,useIsGameOver,useTime}from "./FruitMergerStore.js";import{ScoreBoard,GameArea,GameBackground}from "./components/index.js";import{GameControlButton,GameOverModal}from "../../helpers/index.js";import{GameSettingsModal}from "../../helpers/index.js";import{FRUIT_MERGER_COLORS}from "./FruitMergerConstants.js";import{GAME_IDS,DEFAULT_GAME_SETTINGS}from "../../services/UtilsService.js";import{playSound,GAME_SOUNDS}from "../../services/SoundsService.js";import{playHaptic,HapticType}from "../../services/HapticsService.js";import{formatTime}from "./FruitMergerService.js";import{jsx as _jsx,jsxs as _jsxs}from "react/jsx-runtime";export const FruitMerger = React.memo(({settings = DEFAULT_GAME_SETTINGS,onSettingsChange})=>{const isPlaying = useIsPlaying();const isGameOver = useIsGameOver();const time = useTime();const initializeGame = useFruitMergerStore(state => state.initializeGame);const startGame = useFruitMergerStore(state => state.startGame);const stopGame = useFruitMergerStore(state => state.stopGame);const resetGame = useFruitMergerStore(state => state.resetGame);useEffect(()=>{initializeGame();},[initializeGame]);const prevGameOverRef = useRef(false);useEffect(()=>{if(isGameOver && !prevGameOverRef.current){playSound(GAME_SOUNDS.FRUIT_MERGER.GAME_OVER,settings.enableSounds);playHaptic(HapticType.HEAVY,settings.enableHaptics);}prevGameOverRef.current = isGameOver;},[isGameOver,settings.enableSounds,settings.enableHaptics]);const handleStartGame = useCallback(()=>{initializeGame();startGame();playSound(GAME_SOUNDS.FRUIT_MERGER.START,settings.enableSounds);playHaptic(HapticType.MEDIUM,settings.enableHaptics);},[initializeGame,startGame,settings.enableSounds,settings.enableHaptics]);const handleStopGame = useCallback(()=>{stopGame();},[stopGame]);const handleResetGame = useCallback(()=>{resetGame();initializeGame();},[resetGame,initializeGame]);const gameOverModalProps = useMemo(()=>({isVisible:isGameOver,score:time,onPlayAgain:handleResetGame,buttonText:"Merge Again!",primaryColor:"rgba(76,175,80,0.5)",borderColor:"rgba(76,175,80,0.5)",buttonColor:"#ffffff",buttonBorderColor:"#ffffff",buttonTextColor:"#4CAF50",scoreLabel:"Time Survived",scoreFormatter:formatTime}),[isGameOver,time,handleResetGame]);const gameSettingsModalProps = useMemo(()=>({gameId:GAME_IDS.FRUIT_MERGER,settings,onSettingsChange}),[settings,onSettingsChange]);const offset = settings?.offset ?? 0;const gameControlButtonProps = useMemo(()=>({isPlaying,gameOver:isGameOver,onStartGame:handleStartGame,onStopGame:handleStopGame,startButtonText:"START MERGING",stopButtonText:"STOP GAME",startButtonSubtext:"Merge fruits!",startButtonColor:FRUIT_MERGER_COLORS.BUTTON_PRIMARY,startButtonBorderColor:FRUIT_MERGER_COLORS.BUTTON_SECONDARY}),[isPlaying,isGameOver,handleStartGame,handleStopGame]);return _jsx(View,{style:styles.root,children:_jsx(GestureHandlerRootView,{children:_jsx(GameBackground,{offset:offset,children:_jsxs(View,{style:[styles.container,{paddingTop:offset}],children:[_jsx(ScoreBoard,{offset:offset}),_jsx(GameArea,{settings:settings}),_jsx(GameControlButton,{...gameControlButtonProps}),_jsx(GameOverModal,{...gameOverModalProps}),_jsx(GameSettingsModal,{...gameSettingsModalProps})]})})})});});const styles = StyleSheet.create({root:{flex:1},container:{flex:1}});FruitMerger.displayName = 'FruitMerger';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useCallback","useMemo","useRef","View","StyleSheet","GestureHandlerRootView","useFruitMergerStore","useIsPlaying","useIsGameOver","useTime","ScoreBoard","GameArea","GameBackground","GameControlButton","GameOverModal","GameSettingsModal","FRUIT_MERGER_COLORS","GAME_IDS","DEFAULT_GAME_SETTINGS","playSound","GAME_SOUNDS","playHaptic","HapticType","formatTime","jsx","_jsx","jsxs","_jsxs","FruitMerger","memo","settings","onSettingsChange","isPlaying","isGameOver","time","initializeGame","state","startGame","stopGame","resetGame","prevGameOverRef","current","FRUIT_MERGER","GAME_OVER","enableSounds","HEAVY","enableHaptics","handleStartGame","START","MEDIUM","handleStopGame","handleResetGame","gameOverModalProps","isVisible","score","onPlayAgain","buttonText","primaryColor","
|
|
1
|
+
{"version":3,"names":["React","useEffect","useCallback","useMemo","useRef","View","StyleSheet","GestureHandlerRootView","useFruitMergerStore","useIsPlaying","useIsGameOver","useTime","ScoreBoard","GameArea","GameBackground","GameControlButton","GameOverModal","GameSettingsModal","FRUIT_MERGER_COLORS","GAME_IDS","DEFAULT_GAME_SETTINGS","playSound","GAME_SOUNDS","playHaptic","HapticType","formatTime","jsx","_jsx","jsxs","_jsxs","FruitMerger","memo","settings","onSettingsChange","isPlaying","isGameOver","time","initializeGame","state","startGame","stopGame","resetGame","prevGameOverRef","current","FRUIT_MERGER","GAME_OVER","enableSounds","HEAVY","enableHaptics","handleStartGame","START","MEDIUM","handleStopGame","handleResetGame","gameOverModalProps","isVisible","score","onPlayAgain","buttonText","primaryColor","borderColor","buttonColor","buttonBorderColor","buttonTextColor","scoreLabel","scoreFormatter","gameSettingsModalProps","gameId","offset","gameControlButtonProps","gameOver","onStartGame","onStopGame","startButtonText","stopButtonText","startButtonSubtext","startButtonColor","BUTTON_PRIMARY","startButtonBorderColor","BUTTON_SECONDARY","style","styles","root","children","container","paddingTop","create","flex","displayName"],"sourceRoot":"../../../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A,CAACpB,sBAAsB;MAAA4E,QAAA,eACvBxD,IAAA,CAACb,cAAc;QAACsD,MAAM,EAAEA,MAAO;QAAAe,QAAA,eAC7BtD,KAAA,CAACxB,IAAI;UAAC2E,KAAK,EAAE,CAACC,MAAM,CAACG,SAAS,EAAE;YAAEC,UAAU,EAAEjB;UAAO,CAAC,CAAE;UAAAe,QAAA,gBACtDxD,IAAA,CAACf,UAAU;YAACwD,MAAM,EAAEA;UAAO,CAAE,CAAC,eAE9BzC,IAAA,CAACd,QAAQ;YAACmB,QAAQ,EAAEA;UAAS,CAAE,CAAC,eAElCL,IAAA,CAACZ,iBAAiB;YAAA,GAAKsD;UAAsB,CAAG,CAAC,eAEjD1C,IAAA,CAACX,aAAa;YAAA,GAAKsC;UAAkB,CAAG,CAAC,eAEvC3B,IAAA,CAACV,iBAAiB;YAAA,GAAKiD;UAAsB,CAAG,CAAC;QAAA,CAC7C;MAAC,CACO;IAAC,CACO;EAAC,CACrB,CAAC;AAEX,CAAC,CAAC;AAEF,MAAMe,MAAM,GAAG3E,UAAU,CAACgF,MAAM,CAAC;EAC/BJ,IAAI,EAAE;IACJK,IAAI,EAAE;EACR,CAAC;EACDH,SAAS,EAAE;IACTG,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAEFzD,WAAW,CAAC0D,WAAW,GAAG,aAAa","ignoreList":[]}
|
|
@@ -1,119 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
export const FRUIT_MERGER_COLORS = {
|
|
4
|
-
BACKGROUND: '#FFF8E7',
|
|
5
|
-
SCORE_BACKGROUND: 'rgba(76, 175, 80, 0.4)',
|
|
6
|
-
SCORE_BORDER: '#4CAF50',
|
|
7
|
-
SCORE_TEXT: '#FFFFFF',
|
|
8
|
-
BUTTON_PRIMARY: '#4CAF50',
|
|
9
|
-
BUTTON_SECONDARY: '#66BB6A',
|
|
10
|
-
GAME_OVER_BG: 'rgba(76, 175, 80, 0.95)'
|
|
11
|
-
};
|
|
12
|
-
export const FRUIT_TYPES = [{
|
|
13
|
-
id: 0,
|
|
14
|
-
name: 'Cherry',
|
|
15
|
-
emoji: '🍒',
|
|
16
|
-
size: 30,
|
|
17
|
-
color: '#FFB3BA',
|
|
18
|
-
score: 1
|
|
19
|
-
}, {
|
|
20
|
-
id: 1,
|
|
21
|
-
name: 'Strawberry',
|
|
22
|
-
emoji: '🍓',
|
|
23
|
-
size: 40,
|
|
24
|
-
color: '#FFCDD2',
|
|
25
|
-
score: 2
|
|
26
|
-
}, {
|
|
27
|
-
id: 2,
|
|
28
|
-
name: 'Grape',
|
|
29
|
-
emoji: '🍇',
|
|
30
|
-
size: 50,
|
|
31
|
-
color: '#E1BEE7',
|
|
32
|
-
score: 4
|
|
33
|
-
}, {
|
|
34
|
-
id: 3,
|
|
35
|
-
name: 'Mango',
|
|
36
|
-
emoji: '🥭',
|
|
37
|
-
size: 60,
|
|
38
|
-
color: '#FFF9C4',
|
|
39
|
-
score: 8
|
|
40
|
-
}, {
|
|
41
|
-
id: 4,
|
|
42
|
-
name: 'Orange',
|
|
43
|
-
emoji: '🍊',
|
|
44
|
-
size: 70,
|
|
45
|
-
color: '#FFE0B2',
|
|
46
|
-
score: 16
|
|
47
|
-
}, {
|
|
48
|
-
id: 5,
|
|
49
|
-
name: 'Apple',
|
|
50
|
-
emoji: '🍎',
|
|
51
|
-
size: 80,
|
|
52
|
-
color: '#FFCDD2',
|
|
53
|
-
score: 32
|
|
54
|
-
}, {
|
|
55
|
-
id: 6,
|
|
56
|
-
name: 'Peach',
|
|
57
|
-
emoji: '🍑',
|
|
58
|
-
size: 90,
|
|
59
|
-
color: '#FFE4E1',
|
|
60
|
-
score: 64
|
|
61
|
-
}, {
|
|
62
|
-
id: 7,
|
|
63
|
-
name: 'Pineapple',
|
|
64
|
-
emoji: '🍍',
|
|
65
|
-
size: 100,
|
|
66
|
-
color: '#FFF59D',
|
|
67
|
-
score: 128
|
|
68
|
-
}, {
|
|
69
|
-
id: 8,
|
|
70
|
-
name: 'Watermelon',
|
|
71
|
-
emoji: '🍈',
|
|
72
|
-
size: 110,
|
|
73
|
-
color: '#C8E6C9',
|
|
74
|
-
score: 256
|
|
75
|
-
}, {
|
|
76
|
-
id: 9,
|
|
77
|
-
name: 'Pumpkin',
|
|
78
|
-
emoji: '🎃',
|
|
79
|
-
size: 120,
|
|
80
|
-
color: '#FFCC80',
|
|
81
|
-
score: 512
|
|
82
|
-
}];
|
|
83
|
-
export const FRUIT_MERGER_GAME_CONFIG = {
|
|
84
|
-
CONTAINER_WIDTH: 350,
|
|
85
|
-
CONTAINER_HEIGHT: 480,
|
|
86
|
-
PLAY_AREA_WIDTH: 337,
|
|
87
|
-
// Reduced to leave padding on right side
|
|
88
|
-
PLAY_AREA_HEIGHT: 467,
|
|
89
|
-
// Reduced to leave padding at bottom
|
|
90
|
-
GRAVITY: 0.5,
|
|
91
|
-
BOUNCE: 0.3,
|
|
92
|
-
FRICTION: 0.99,
|
|
93
|
-
SPAWN_Y: -50,
|
|
94
|
-
MERGE_DISTANCE: 10,
|
|
95
|
-
FALL_SPEED: 2,
|
|
96
|
-
MAX_FRUIT_TYPE: 4,
|
|
97
|
-
SPAWN_DELAY: 1500
|
|
98
|
-
};
|
|
99
|
-
export const FRUIT_MERGER_THEME = {
|
|
100
|
-
backgroundColor: '#FFFEF7',
|
|
101
|
-
headerBackgroundColor: '#4CAF50',
|
|
102
|
-
headerTextColor: '#FFFFFF',
|
|
103
|
-
sectionBackgroundColor: '#E8F5E9',
|
|
104
|
-
sectionTitleColor: '#1B5E20',
|
|
105
|
-
buttonSelectedColor: '#4CAF50',
|
|
106
|
-
buttonUnselectedColor: '#A5D6A7',
|
|
107
|
-
buttonSelectedTextColor: '#FFFFFF',
|
|
108
|
-
buttonUnselectedTextColor: '#1B5E20',
|
|
109
|
-
switchTrackColorFalse: '#BDBDBD',
|
|
110
|
-
switchTrackColorTrue: '#66BB6A',
|
|
111
|
-
switchThumbColor: '#FFFFFF',
|
|
112
|
-
infoTextColor: '#424242'
|
|
113
|
-
};
|
|
114
|
-
export const FRUIT_MERGER_DIFFICULTY_DESCRIPTIONS = {
|
|
115
|
-
easy: 'Relaxed merging with slower fruit drops',
|
|
116
|
-
medium: 'Balanced challenge with moderate speed',
|
|
117
|
-
hard: 'Fast-paced merging with quick drops'
|
|
118
|
-
};
|
|
119
|
-
//# sourceMappingURL=FruitMergerConstants.js.map
|
|
1
|
+
"use strict";export const FRUIT_MERGER_COLORS ={BACKGROUND:'#FFF8E7',SCORE_BACKGROUND:'rgba(76,175,80,0.4)',SCORE_BORDER:'#4CAF50',SCORE_TEXT:'#FFFFFF',BUTTON_PRIMARY:'#4CAF50',BUTTON_SECONDARY:'#66BB6A',GAME_OVER_BG:'rgba(76,175,80,0.95)'};export const FRUIT_TYPES = [{id:0,name:'Cherry',emoji:'🍒',size:30,color:'#FFB3BA',score:1},{id:1,name:'Strawberry',emoji:'🍓',size:40,color:'#FFCDD2',score:2},{id:2,name:'Grape',emoji:'🍇',size:50,color:'#E1BEE7',score:4},{id:3,name:'Mango',emoji:'🥭',size:60,color:'#FFF9C4',score:8},{id:4,name:'Orange',emoji:'🍊',size:70,color:'#FFE0B2',score:16},{id:5,name:'Apple',emoji:'🍎',size:80,color:'#FFCDD2',score:32},{id:6,name:'Peach',emoji:'🍑',size:90,color:'#FFE4E1',score:64},{id:7,name:'Pineapple',emoji:'🍍',size:100,color:'#FFF59D',score:128},{id:8,name:'Watermelon',emoji:'🍈',size:110,color:'#C8E6C9',score:256},{id:9,name:'Pumpkin',emoji:'🎃',size:120,color:'#FFCC80',score:512}];export const FRUIT_MERGER_GAME_CONFIG ={CONTAINER_WIDTH:350,CONTAINER_HEIGHT:480,PLAY_AREA_WIDTH:337,PLAY_AREA_HEIGHT:467,GRAVITY:0.5,BOUNCE:0.3,FRICTION:0.99,SPAWN_Y:-50,MERGE_DISTANCE:10,FALL_SPEED:2,MAX_FRUIT_TYPE:4,SPAWN_DELAY:1500};export const FRUIT_MERGER_THEME ={backgroundColor:'rgba(0,0,0,0.7)',headerBackgroundColor:'#4CAF50',headerTextColor:'#ffffff',sectionBackgroundColor:'rgba(76,175,80,0.15)',sectionTitleColor:'#4CAF50',buttonSelectedColor:'#4CAF50',buttonUnselectedColor:'rgba(255,255,255,0.2)',buttonSelectedTextColor:'#ffffff',buttonUnselectedTextColor:'rgba(255,255,255,0.7)',switchTrackColorFalse:'rgba(76,175,80,0.3)',switchTrackColorTrue:'#4CAF50',switchThumbColor:'#ffffff',infoTextColor:'rgba(255,255,255,0.9)'};export const FRUIT_MERGER_DIFFICULTY_DESCRIPTIONS ={easy:'Relaxed merging with slower fruit drops',medium:'Balanced challenge with moderate speed',hard:'Fast-paced merging with quick drops'};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["FRUIT_MERGER_COLORS","BACKGROUND","SCORE_BACKGROUND","SCORE_BORDER","SCORE_TEXT","BUTTON_PRIMARY","BUTTON_SECONDARY","GAME_OVER_BG","FRUIT_TYPES","id","name","emoji","size","color","score","FRUIT_MERGER_GAME_CONFIG","CONTAINER_WIDTH","CONTAINER_HEIGHT","PLAY_AREA_WIDTH","PLAY_AREA_HEIGHT","GRAVITY","BOUNCE","FRICTION","SPAWN_Y","MERGE_DISTANCE","FALL_SPEED","MAX_FRUIT_TYPE","SPAWN_DELAY","FRUIT_MERGER_THEME","backgroundColor","headerBackgroundColor","headerTextColor","sectionBackgroundColor","sectionTitleColor","buttonSelectedColor","buttonUnselectedColor","buttonSelectedTextColor","buttonUnselectedTextColor","switchTrackColorFalse","switchTrackColorTrue","switchThumbColor","infoTextColor","FRUIT_MERGER_DIFFICULTY_DESCRIPTIONS","easy","medium","hard"],"sourceRoot":"../../../../src","sources":["games/fruit-merger/FruitMergerConstants.ts"],"mappings":";;AAAA,OAAO,MAAMA,mBAAmB,GAAG;EACjCC,UAAU,EAAE,SAAS;EACrBC,gBAAgB,EAAE,wBAAwB;EAC1CC,YAAY,EAAE,SAAS;EACvBC,UAAU,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KAAK,EAAE,SAAS;EAAEC,KAAK,EAAE;AAAG,CAAC,EAC5E;EAAEL,EAAE,EAAE,CAAC;EAAEC,IAAI,EAAE,WAAW;EAAEC,KAAK,EAAE,IAAI;EAAEC,IAAI,EAAE,GAAG;EAAEC,KAAK,EAAE,SAAS;EAAEC,KAAK,EAAE;AAAI,CAAC,EAClF;EAAEL,EAAE,EAAE,CAAC;EAAEC,IAAI,EAAE,YAAY;EAAEC,KAAK,EAAE,IAAI;EAAEC,IAAI,EAAE,GAAG;EAAEC,KAAK,EAAE,SAAS;EAAEC,KAAK,EAAE;AAAI,CAAC,EACnF;EAAEL,EAAE,EAAE,CAAC;EAAEC,IAAI,EAAE,SAAS;EAAEC,KAAK,EAAE,IAAI;EAAEC,IAAI,EAAE,GAAG;EAAEC,KAAK,EAAE,SAAS;EAAEC,KAAK,EAAE;AAAI,CAAC,CACxE;AAEV,OAAO,MAAMC,wBAAwB,GAAG;EACtCC,eAAe,EAAE,GAAG;EACpBC,gBAAgB,EAAE,GAAG;EACrBC,eAAe,EAAE,GAAG;EAAE;EACtBC,gBAAgB,EAAE,GAAG;EAAE;EACvBC,OAAO,EAAE,GAAG;EACZC,MAAM,EAAE,GAAG;EACXC,QAAQ,EAAE,IAAI;EACdC,OAAO,EAAE,CAAC,EAAE;EACZC,cAAc,EAAE,EAAE;EAClBC,UAAU,EAAE,CAAC;EACbC,cAAc,EAAE,CAAC;EACjBC,WAAW,EAAE;AACf,CAAC;
|
|
1
|
+
{"version":3,"names":["FRUIT_MERGER_COLORS","BACKGROUND","SCORE_BACKGROUND","SCORE_BORDER","SCORE_TEXT","BUTTON_PRIMARY","BUTTON_SECONDARY","GAME_OVER_BG","FRUIT_TYPES","id","name","emoji","size","color","score","FRUIT_MERGER_GAME_CONFIG","CONTAINER_WIDTH","CONTAINER_HEIGHT","PLAY_AREA_WIDTH","PLAY_AREA_HEIGHT","GRAVITY","BOUNCE","FRICTION","SPAWN_Y","MERGE_DISTANCE","FALL_SPEED","MAX_FRUIT_TYPE","SPAWN_DELAY","FRUIT_MERGER_THEME","backgroundColor","headerBackgroundColor","headerTextColor","sectionBackgroundColor","sectionTitleColor","buttonSelectedColor","buttonUnselectedColor","buttonSelectedTextColor","buttonUnselectedTextColor","switchTrackColorFalse","switchTrackColorTrue","switchThumbColor","infoTextColor","FRUIT_MERGER_DIFFICULTY_DESCRIPTIONS","easy","medium","hard"],"sourceRoot":"../../../../src","sources":["games/fruit-merger/FruitMergerConstants.ts"],"mappings":";;AAAA,OAAO,MAAMA,mBAAmB,GAAG;EACjCC,UAAU,EAAE,SAAS;EACrBC,gBAAgB,EAAE,wBAAwB;EAC1CC,YAAY,EAAE,SAAS;EACvBC,UAAU,EAAE,SAAS;EACrBC,cAAc,EAAE,SAAS;EACzBC,gBAAgB,EAAE,SAAS;EAC3BC,YAAY,EAAE;AAChB,CAAC;AAED,OAAO,MAAMC,WAAW,GAAG,CACzB;EAAEC,EAAE,EAAE,CAAC;EAAEC,IAAI,EAAE,QAAQ;EAAEC,KAAK,EAAE,IAAI;EAAEC,IAAI,EAAE,EAAE;EAAEC,KAAK,EAAE,SAAS;EAAEC,KAAK,EAAE;AAAE,CAAC,EAC5E;EAAEL,EAAE,EAAE,CAAC;EAAEC,IAAI,EAAE,YAAY;EAAEC,KAAK,EAAE,IAAI;EAAEC,IAAI,EAAE,EAAE;EAAEC,KAAK,EAAE,SAAS;EAAEC,KAAK,EAAE;AAAE,CAAC,EAChF;EAAEL,EAAE,EAAE,CAAC;EAAEC,IAAI,EAAE,OAAO;EAAEC,KAAK,EAAE,IAAI;EAAEC,IAAI,EAAE,EAAE;EAAEC,KAAK,EAAE,SAAS;EAAEC,KAAK,EAAE;AAAE,CAAC,EAC3E;EAAEL,EAAE,EAAE,CAAC;EAAEC,IAAI,EAAE,OAAO;EAAEC,KAAK,EAAE,IAAI;EAAEC,IAAI,EAAE,EAAE;EAAEC,KAAK,EAAE,SAAS;EAAEC,KAAK,EAAE;AAAE,CAAC,EAC3E;E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