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,144 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { View, TouchableOpacity, Text, StyleSheet, Modal } from 'react-native';
|
|
5
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
-
export const GameOverModal = /*#__PURE__*/React.memo(({
|
|
7
|
-
isVisible,
|
|
8
|
-
score,
|
|
9
|
-
onPlayAgain,
|
|
10
|
-
buttonText = "Play Again",
|
|
11
|
-
primaryColor = "rgba(59, 130, 246, 0.8)",
|
|
12
|
-
// Default blue
|
|
13
|
-
borderColor = "rgba(59, 130, 246, 0.9)",
|
|
14
|
-
buttonColor = "#10b981",
|
|
15
|
-
// Default green
|
|
16
|
-
buttonBorderColor = "#34d399",
|
|
17
|
-
scoreLabel = "Final Score",
|
|
18
|
-
scoreFormatter
|
|
19
|
-
}) => {
|
|
20
|
-
const displayScore = scoreFormatter ? scoreFormatter(score) : score.toString();
|
|
21
|
-
return /*#__PURE__*/_jsx(Modal, {
|
|
22
|
-
visible: isVisible,
|
|
23
|
-
animationType: "fade",
|
|
24
|
-
transparent: true,
|
|
25
|
-
onRequestClose: onPlayAgain,
|
|
26
|
-
children: /*#__PURE__*/_jsx(View, {
|
|
27
|
-
style: styles.gameOverOverlay,
|
|
28
|
-
children: /*#__PURE__*/_jsx(View, {
|
|
29
|
-
style: [styles.gameOverModal, {
|
|
30
|
-
backgroundColor: primaryColor,
|
|
31
|
-
borderColor: borderColor
|
|
32
|
-
}],
|
|
33
|
-
children: /*#__PURE__*/_jsxs(View, {
|
|
34
|
-
style: styles.modalContent,
|
|
35
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
36
|
-
style: styles.gameOverTitle,
|
|
37
|
-
children: "Game Over!"
|
|
38
|
-
}), /*#__PURE__*/_jsxs(View, {
|
|
39
|
-
style: [styles.finalScoreContainer, {
|
|
40
|
-
backgroundColor: borderColor // Use border color for inner panel
|
|
41
|
-
}],
|
|
42
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
43
|
-
style: styles.finalScoreLabel,
|
|
44
|
-
children: scoreLabel
|
|
45
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
46
|
-
style: styles.finalScoreValue,
|
|
47
|
-
children: displayScore
|
|
48
|
-
})]
|
|
49
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
50
|
-
style: styles.playAgainContainer,
|
|
51
|
-
children: /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
52
|
-
style: [styles.playAgainButton, {
|
|
53
|
-
backgroundColor: buttonColor,
|
|
54
|
-
borderColor: buttonBorderColor
|
|
55
|
-
}],
|
|
56
|
-
onPress: onPlayAgain,
|
|
57
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
58
|
-
style: styles.buttonText,
|
|
59
|
-
children: buttonText
|
|
60
|
-
})
|
|
61
|
-
})
|
|
62
|
-
})]
|
|
63
|
-
})
|
|
64
|
-
})
|
|
65
|
-
})
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
const styles = StyleSheet.create({
|
|
69
|
-
gameOverOverlay: {
|
|
70
|
-
flex: 1,
|
|
71
|
-
justifyContent: 'center',
|
|
72
|
-
alignItems: 'center',
|
|
73
|
-
backgroundColor: 'rgba(0, 0, 0, 0.5)' // Semi-transparent overlay
|
|
74
|
-
},
|
|
75
|
-
gameOverModal: {
|
|
76
|
-
borderRadius: 24,
|
|
77
|
-
minWidth: '80%',
|
|
78
|
-
shadowColor: '#000',
|
|
79
|
-
shadowOffset: {
|
|
80
|
-
width: 0,
|
|
81
|
-
height: 8
|
|
82
|
-
},
|
|
83
|
-
shadowOpacity: 0.4,
|
|
84
|
-
shadowRadius: 12,
|
|
85
|
-
elevation: 12,
|
|
86
|
-
borderWidth: 3
|
|
87
|
-
},
|
|
88
|
-
modalContent: {
|
|
89
|
-
padding: 40,
|
|
90
|
-
alignItems: 'center'
|
|
91
|
-
},
|
|
92
|
-
gameOverTitle: {
|
|
93
|
-
fontSize: 30,
|
|
94
|
-
fontWeight: 'bold',
|
|
95
|
-
color: '#ffffff',
|
|
96
|
-
marginBottom: 32,
|
|
97
|
-
textAlign: 'center'
|
|
98
|
-
},
|
|
99
|
-
finalScoreContainer: {
|
|
100
|
-
alignItems: 'center',
|
|
101
|
-
marginBottom: 32,
|
|
102
|
-
borderRadius: 16,
|
|
103
|
-
padding: 20,
|
|
104
|
-
minWidth: 150
|
|
105
|
-
},
|
|
106
|
-
finalScoreLabel: {
|
|
107
|
-
fontSize: 18,
|
|
108
|
-
color: '#ffffff',
|
|
109
|
-
fontWeight: 'bold',
|
|
110
|
-
marginBottom: 8
|
|
111
|
-
},
|
|
112
|
-
finalScoreValue: {
|
|
113
|
-
fontSize: 48,
|
|
114
|
-
color: '#facc15',
|
|
115
|
-
// Golden yellow for score
|
|
116
|
-
fontWeight: 'bold',
|
|
117
|
-
textAlign: 'center'
|
|
118
|
-
},
|
|
119
|
-
playAgainContainer: {
|
|
120
|
-
alignItems: 'center'
|
|
121
|
-
},
|
|
122
|
-
playAgainButton: {
|
|
123
|
-
paddingHorizontal: 40,
|
|
124
|
-
paddingVertical: 20,
|
|
125
|
-
borderRadius: 24,
|
|
126
|
-
shadowColor: '#000',
|
|
127
|
-
shadowOffset: {
|
|
128
|
-
width: 0,
|
|
129
|
-
height: 2
|
|
130
|
-
},
|
|
131
|
-
shadowOpacity: 0.25,
|
|
132
|
-
shadowRadius: 3.84,
|
|
133
|
-
elevation: 5,
|
|
134
|
-
borderWidth: 2
|
|
135
|
-
},
|
|
136
|
-
buttonText: {
|
|
137
|
-
fontSize: 18,
|
|
138
|
-
fontWeight: 'bold',
|
|
139
|
-
color: '#ffffff',
|
|
140
|
-
textAlign: 'center',
|
|
141
|
-
lineHeight: 24
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
//# sourceMappingURL=GameOverModal.js.map
|
|
1
|
+
"use strict";import React from 'react';import{View,TouchableOpacity,Text,StyleSheet,Modal}from 'react-native';import{jsx as _jsx,jsxs as _jsxs}from "react/jsx-runtime";export const GameOverModal = React.memo(({isVisible,score,onPlayAgain,buttonText = "Play Again",primaryColor = "rgba(59,130,246,0.8)",borderColor = "rgba(59,130,246,0.9)",buttonColor = "#10b981",buttonBorderColor = "#34d399",buttonTextColor = "#ffffff",scoreLabel = "Final Score",scoreFormatter})=>{const displayScore = scoreFormatter ? scoreFormatter(score):score.toString();return _jsx(Modal,{visible:isVisible,animationType:"fade",transparent:true,onRequestClose:onPlayAgain,children:_jsx(View,{style:styles.gameOverOverlay,children:_jsx(View,{style:[styles.gameOverModal,{backgroundColor:primaryColor,borderColor:borderColor}],children:_jsxs(View,{style:styles.modalContent,children:[_jsx(Text,{style:styles.gameOverTitle,children:"Game Over!"}),_jsxs(View,{style:[styles.finalScoreContainer,{backgroundColor:'rgba(255,255,255,0.2)'}],children:[_jsx(Text,{style:styles.finalScoreLabel,children:scoreLabel}),_jsx(Text,{style:styles.finalScoreValue,children:displayScore})]}),_jsx(View,{style:styles.playAgainContainer,children:_jsx(TouchableOpacity,{style:[styles.playAgainButton,{backgroundColor:buttonColor,borderColor:buttonBorderColor}],onPress:onPlayAgain,activeOpacity:0.8,children:_jsx(Text,{style:[styles.buttonText,{color:buttonTextColor}],children:buttonText})})})]})})})});});const styles = StyleSheet.create({gameOverOverlay:{flex:1,justifyContent:'center',alignItems:'center',backgroundColor:'rgba(0,0,0,0.5)'},gameOverModal:{borderRadius:24,minWidth:'80%',shadowColor:'#000',shadowOffset:{width:0,height:8},shadowOpacity:0.4,shadowRadius:12,elevation:12},modalContent:{padding:40,alignItems:'center'},gameOverTitle:{fontSize:30,fontWeight:'bold',color:'#ffffff',marginBottom:32,textAlign:'center'},finalScoreContainer:{alignItems:'center',marginBottom:32,borderRadius:16,padding:20,minWidth:150},finalScoreLabel:{fontSize:18,color:'#ffffff',fontWeight:'bold',marginBottom:8},finalScoreValue:{fontSize:48,color:'#facc15',fontWeight:'bold',textAlign:'center'},playAgainContainer:{alignItems:'center'},playAgainButton:{paddingHorizontal:40,paddingVertical:20,borderRadius:24,shadowColor:'#000',shadowOffset:{width:0,height:2},shadowOpacity:0.25,shadowRadius:3.84,elevation:5,borderWidth:2},buttonText:{fontSize:18,fontWeight:'bold',color:'#ffffff',textAlign:'center',lineHeight:24}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","TouchableOpacity","Text","StyleSheet","Modal","jsx","_jsx","jsxs","_jsxs","GameOverModal","memo","isVisible","score","onPlayAgain","buttonText","primaryColor","borderColor","buttonColor","buttonBorderColor","scoreLabel","scoreFormatter","displayScore","toString","visible","animationType","transparent","onRequestClose","children","style","styles","gameOverOverlay","gameOverModal","backgroundColor","modalContent","gameOverTitle","finalScoreContainer","finalScoreLabel","finalScoreValue","playAgainContainer","playAgainButton","onPress","create","flex","justifyContent","alignItems","borderRadius","minWidth","shadowColor","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation","
|
|
1
|
+
{"version":3,"names":["React","View","TouchableOpacity","Text","StyleSheet","Modal","jsx","_jsx","jsxs","_jsxs","GameOverModal","memo","isVisible","score","onPlayAgain","buttonText","primaryColor","borderColor","buttonColor","buttonBorderColor","buttonTextColor","scoreLabel","scoreFormatter","displayScore","toString","visible","animationType","transparent","onRequestClose","children","style","styles","gameOverOverlay","gameOverModal","backgroundColor","modalContent","gameOverTitle","finalScoreContainer","finalScoreLabel","finalScoreValue","playAgainContainer","playAgainButton","onPress","activeOpacity","color","create","flex","justifyContent","alignItems","borderRadius","minWidth","shadowColor","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation","padding","fontSize","fontWeight","marginBottom","textAlign","paddingHorizontal","paddingVertical","borderWidth","lineHeight"],"sourceRoot":"../../../src","sources":["helpers/GameOverModal.tsx"],"mappings":"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","ignoreList":[]}
|
|
@@ -1,287 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { View, Text, ScrollView, TouchableOpacity, Switch, StyleSheet, Modal } from 'react-native';
|
|
5
|
-
import { getGameTheme, getGameDifficultyDescriptions, getGameTitle } from "../services/GamesConstants.js";
|
|
6
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
export const GameSettingsModal = ({
|
|
8
|
-
gameId,
|
|
9
|
-
settings,
|
|
10
|
-
onSettingsChange = () => undefined
|
|
11
|
-
}) => {
|
|
12
|
-
const theme = getGameTheme(gameId);
|
|
13
|
-
const difficultyDescriptions = getGameDifficultyDescriptions(gameId);
|
|
14
|
-
const title = `${getGameTitle(gameId)} Settings`;
|
|
15
|
-
const {
|
|
16
|
-
isVisible,
|
|
17
|
-
difficulty,
|
|
18
|
-
enableSounds,
|
|
19
|
-
enableHaptics
|
|
20
|
-
} = settings;
|
|
21
|
-
const handleDifficultyChange = newDifficulty => {
|
|
22
|
-
onSettingsChange({
|
|
23
|
-
...settings,
|
|
24
|
-
difficulty: newDifficulty
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
const handleSoundToggle = enabled => {
|
|
28
|
-
onSettingsChange({
|
|
29
|
-
...settings,
|
|
30
|
-
enableSounds: enabled
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
const handleHapticToggle = enabled => {
|
|
34
|
-
onSettingsChange({
|
|
35
|
-
...settings,
|
|
36
|
-
enableHaptics: enabled
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
const handleOnClose = () => {
|
|
40
|
-
onSettingsChange({
|
|
41
|
-
...settings,
|
|
42
|
-
isVisible: false
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
return /*#__PURE__*/_jsx(Modal, {
|
|
46
|
-
visible: isVisible,
|
|
47
|
-
animationType: "fade",
|
|
48
|
-
transparent: true,
|
|
49
|
-
onRequestClose: handleOnClose,
|
|
50
|
-
children: /*#__PURE__*/_jsx(View, {
|
|
51
|
-
style: styles.overlay,
|
|
52
|
-
children: /*#__PURE__*/_jsxs(View, {
|
|
53
|
-
style: [styles.container, {
|
|
54
|
-
backgroundColor: theme.backgroundColor
|
|
55
|
-
}],
|
|
56
|
-
children: [/*#__PURE__*/_jsxs(View, {
|
|
57
|
-
style: [styles.header, {
|
|
58
|
-
backgroundColor: theme.headerBackgroundColor
|
|
59
|
-
}],
|
|
60
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
61
|
-
style: [styles.headerTitle, {
|
|
62
|
-
color: theme.headerTextColor
|
|
63
|
-
}],
|
|
64
|
-
children: title
|
|
65
|
-
}), /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
66
|
-
onPress: handleOnClose,
|
|
67
|
-
style: styles.closeButton,
|
|
68
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
69
|
-
style: [styles.closeButtonText, {
|
|
70
|
-
color: theme.headerTextColor
|
|
71
|
-
}],
|
|
72
|
-
children: "\u2715"
|
|
73
|
-
})
|
|
74
|
-
})]
|
|
75
|
-
}), /*#__PURE__*/_jsxs(ScrollView, {
|
|
76
|
-
style: styles.scrollView,
|
|
77
|
-
contentContainerStyle: styles.scrollContent,
|
|
78
|
-
children: [/*#__PURE__*/_jsxs(View, {
|
|
79
|
-
style: [styles.section, {
|
|
80
|
-
backgroundColor: theme.sectionBackgroundColor
|
|
81
|
-
}],
|
|
82
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
83
|
-
style: [styles.sectionTitle, {
|
|
84
|
-
color: theme.sectionTitleColor
|
|
85
|
-
}],
|
|
86
|
-
children: "Difficulty Level"
|
|
87
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
88
|
-
style: styles.difficultyRow,
|
|
89
|
-
children: ['easy', 'medium', 'hard'].map(level => /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
90
|
-
onPress: () => handleDifficultyChange(level),
|
|
91
|
-
style: [styles.difficultyButton, {
|
|
92
|
-
backgroundColor: difficulty === level ? theme.buttonSelectedColor : theme.buttonUnselectedColor
|
|
93
|
-
}],
|
|
94
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
95
|
-
style: [styles.buttonText, styles.capitalize, {
|
|
96
|
-
color: difficulty === level ? theme.buttonSelectedTextColor : theme.buttonUnselectedTextColor
|
|
97
|
-
}],
|
|
98
|
-
children: level
|
|
99
|
-
})
|
|
100
|
-
}, level))
|
|
101
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
102
|
-
style: styles.infoBox,
|
|
103
|
-
children: /*#__PURE__*/_jsxs(Text, {
|
|
104
|
-
style: [styles.infoText, {
|
|
105
|
-
color: theme.infoTextColor
|
|
106
|
-
}],
|
|
107
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
108
|
-
style: styles.boldText,
|
|
109
|
-
children: "Easy:"
|
|
110
|
-
}), " ", typeof difficultyDescriptions.easy === 'string' ? difficultyDescriptions.easy : difficultyDescriptions.easy.description, '\n', /*#__PURE__*/_jsx(Text, {
|
|
111
|
-
style: styles.boldText,
|
|
112
|
-
children: "Medium:"
|
|
113
|
-
}), " ", typeof difficultyDescriptions.medium === 'string' ? difficultyDescriptions.medium : difficultyDescriptions.medium.description, '\n', /*#__PURE__*/_jsx(Text, {
|
|
114
|
-
style: styles.boldText,
|
|
115
|
-
children: "Hard:"
|
|
116
|
-
}), " ", typeof difficultyDescriptions.hard === 'string' ? difficultyDescriptions.hard : difficultyDescriptions.hard.description]
|
|
117
|
-
})
|
|
118
|
-
})]
|
|
119
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
120
|
-
style: [styles.section, {
|
|
121
|
-
backgroundColor: theme.sectionBackgroundColor
|
|
122
|
-
}],
|
|
123
|
-
children: /*#__PURE__*/_jsxs(View, {
|
|
124
|
-
style: styles.toggleContainer,
|
|
125
|
-
children: [/*#__PURE__*/_jsxs(View, {
|
|
126
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
127
|
-
style: [styles.toggleTitle, {
|
|
128
|
-
color: theme.sectionTitleColor
|
|
129
|
-
}],
|
|
130
|
-
children: "Sound Effects"
|
|
131
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
132
|
-
style: [styles.toggleSubtitle, {
|
|
133
|
-
color: theme.infoTextColor
|
|
134
|
-
}],
|
|
135
|
-
children: "Play sounds during gameplay"
|
|
136
|
-
})]
|
|
137
|
-
}), /*#__PURE__*/_jsx(Switch, {
|
|
138
|
-
value: enableSounds,
|
|
139
|
-
onValueChange: handleSoundToggle,
|
|
140
|
-
trackColor: {
|
|
141
|
-
false: theme.switchTrackColorFalse,
|
|
142
|
-
true: theme.switchTrackColorTrue
|
|
143
|
-
},
|
|
144
|
-
thumbColor: theme.switchThumbColor
|
|
145
|
-
})]
|
|
146
|
-
})
|
|
147
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
148
|
-
style: [styles.section, {
|
|
149
|
-
backgroundColor: theme.sectionBackgroundColor
|
|
150
|
-
}],
|
|
151
|
-
children: /*#__PURE__*/_jsxs(View, {
|
|
152
|
-
style: styles.toggleContainer,
|
|
153
|
-
children: [/*#__PURE__*/_jsxs(View, {
|
|
154
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
155
|
-
style: [styles.toggleTitle, {
|
|
156
|
-
color: theme.sectionTitleColor
|
|
157
|
-
}],
|
|
158
|
-
children: "Haptic Feedback"
|
|
159
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
160
|
-
style: [styles.toggleSubtitle, {
|
|
161
|
-
color: theme.infoTextColor
|
|
162
|
-
}],
|
|
163
|
-
children: "Vibration feedback for interactions"
|
|
164
|
-
})]
|
|
165
|
-
}), /*#__PURE__*/_jsx(Switch, {
|
|
166
|
-
value: enableHaptics,
|
|
167
|
-
onValueChange: handleHapticToggle,
|
|
168
|
-
trackColor: {
|
|
169
|
-
false: theme.switchTrackColorFalse,
|
|
170
|
-
true: theme.switchTrackColorTrue
|
|
171
|
-
},
|
|
172
|
-
thumbColor: theme.switchThumbColor
|
|
173
|
-
})]
|
|
174
|
-
})
|
|
175
|
-
})]
|
|
176
|
-
})]
|
|
177
|
-
})
|
|
178
|
-
})
|
|
179
|
-
});
|
|
180
|
-
};
|
|
181
|
-
const styles = StyleSheet.create({
|
|
182
|
-
overlay: {
|
|
183
|
-
flex: 1,
|
|
184
|
-
backgroundColor: 'rgba(0, 0, 0, 0.7)',
|
|
185
|
-
justifyContent: 'center',
|
|
186
|
-
alignItems: 'center',
|
|
187
|
-
padding: 20
|
|
188
|
-
},
|
|
189
|
-
container: {
|
|
190
|
-
width: '95%',
|
|
191
|
-
maxWidth: 600,
|
|
192
|
-
maxHeight: '95%',
|
|
193
|
-
minHeight: '60%',
|
|
194
|
-
borderRadius: 10,
|
|
195
|
-
shadowColor: '#000',
|
|
196
|
-
shadowOffset: {
|
|
197
|
-
width: 0,
|
|
198
|
-
height: 10
|
|
199
|
-
},
|
|
200
|
-
shadowOpacity: 0.25,
|
|
201
|
-
shadowRadius: 20,
|
|
202
|
-
elevation: 10,
|
|
203
|
-
overflow: 'hidden'
|
|
204
|
-
},
|
|
205
|
-
header: {
|
|
206
|
-
flexDirection: 'row',
|
|
207
|
-
justifyContent: 'space-between',
|
|
208
|
-
alignItems: 'center',
|
|
209
|
-
padding: 10,
|
|
210
|
-
paddingHorizontal: 16
|
|
211
|
-
},
|
|
212
|
-
headerTitle: {
|
|
213
|
-
fontSize: 20,
|
|
214
|
-
fontWeight: 'semibold'
|
|
215
|
-
},
|
|
216
|
-
closeButton: {
|
|
217
|
-
padding: 8
|
|
218
|
-
},
|
|
219
|
-
closeButtonText: {
|
|
220
|
-
fontSize: 18,
|
|
221
|
-
fontWeight: 'semibold'
|
|
222
|
-
},
|
|
223
|
-
scrollView: {
|
|
224
|
-
flex: 1,
|
|
225
|
-
padding: 10
|
|
226
|
-
},
|
|
227
|
-
scrollContent: {
|
|
228
|
-
flexGrow: 1,
|
|
229
|
-
paddingBottom: 20
|
|
230
|
-
},
|
|
231
|
-
section: {
|
|
232
|
-
borderRadius: 12,
|
|
233
|
-
padding: 16,
|
|
234
|
-
marginBottom: 16
|
|
235
|
-
},
|
|
236
|
-
sectionTitle: {
|
|
237
|
-
fontSize: 16,
|
|
238
|
-
fontWeight: 'semibold',
|
|
239
|
-
marginBottom: 10
|
|
240
|
-
},
|
|
241
|
-
difficultyRow: {
|
|
242
|
-
flexDirection: 'row',
|
|
243
|
-
justifyContent: 'space-between',
|
|
244
|
-
marginBottom: 12
|
|
245
|
-
},
|
|
246
|
-
difficultyButton: {
|
|
247
|
-
flex: 1,
|
|
248
|
-
paddingVertical: 12,
|
|
249
|
-
paddingHorizontal: 8,
|
|
250
|
-
borderRadius: 8,
|
|
251
|
-
marginHorizontal: 4,
|
|
252
|
-
alignItems: 'center'
|
|
253
|
-
},
|
|
254
|
-
buttonText: {
|
|
255
|
-
fontSize: 16,
|
|
256
|
-
fontWeight: '600'
|
|
257
|
-
},
|
|
258
|
-
capitalize: {
|
|
259
|
-
textTransform: 'capitalize'
|
|
260
|
-
},
|
|
261
|
-
infoBox: {
|
|
262
|
-
backgroundColor: 'rgba(255, 255, 255, 0.1)',
|
|
263
|
-
borderRadius: 8,
|
|
264
|
-
padding: 12
|
|
265
|
-
},
|
|
266
|
-
infoText: {
|
|
267
|
-
fontSize: 14,
|
|
268
|
-
lineHeight: 20
|
|
269
|
-
},
|
|
270
|
-
boldText: {
|
|
271
|
-
fontWeight: 'semibold'
|
|
272
|
-
},
|
|
273
|
-
toggleContainer: {
|
|
274
|
-
flexDirection: 'row',
|
|
275
|
-
justifyContent: 'space-between',
|
|
276
|
-
alignItems: 'center'
|
|
277
|
-
},
|
|
278
|
-
toggleTitle: {
|
|
279
|
-
fontSize: 16,
|
|
280
|
-
fontWeight: 'semibold'
|
|
281
|
-
},
|
|
282
|
-
toggleSubtitle: {
|
|
283
|
-
fontSize: 14,
|
|
284
|
-
marginTop: 2
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
//# sourceMappingURL=GameSettingsModal.js.map
|
|
1
|
+
"use strict";import React from 'react';import{View,Text,ScrollView,TouchableOpacity,Switch,StyleSheet,Modal}from 'react-native';import{getGameTheme,getGameDifficultyDescriptions,getGameTitle}from "../services/GamesConstants.js";import{jsx as _jsx,jsxs as _jsxs}from "react/jsx-runtime";export const GameSettingsModal =({gameId,settings,onSettingsChange =()=> undefined})=>{const theme = getGameTheme(gameId);const difficultyDescriptions = getGameDifficultyDescriptions(gameId);const title = `${getGameTitle(gameId)}Settings`;const{isVisible,difficulty,enableSounds,enableHaptics}= settings;const handleDifficultyChange = newDifficulty =>{onSettingsChange({...settings,difficulty:newDifficulty});};const handleSoundToggle = enabled =>{onSettingsChange({...settings,enableSounds:enabled});};const handleHapticToggle = enabled =>{onSettingsChange({...settings,enableHaptics:enabled});};const handleOnClose =()=>{onSettingsChange({...settings,isVisible:false});};return _jsx(Modal,{visible:isVisible,animationType:"fade",transparent:true,onRequestClose:handleOnClose,children:_jsx(View,{style:styles.overlay,children:_jsxs(View,{style:[styles.container,{backgroundColor:theme.backgroundColor}],children:[_jsxs(View,{style:[styles.header,{backgroundColor:theme.headerBackgroundColor}],children:[_jsx(Text,{style:[styles.headerTitle,{color:theme.headerTextColor}],children:title}),_jsx(TouchableOpacity,{onPress:handleOnClose,style:styles.closeButton,children:_jsx(Text,{style:[styles.closeButtonText,{color:theme.headerTextColor}],children:"\u2715"})})]}),_jsxs(ScrollView,{style:styles.scrollView,contentContainerStyle:styles.scrollContent,children:[_jsxs(View,{style:[styles.section,{backgroundColor:theme.sectionBackgroundColor}],children:[_jsx(Text,{style:[styles.sectionTitle,{color:theme.sectionTitleColor}],children:"Difficulty Level"}),_jsx(View,{style:styles.difficultyRow,children:['easy','medium','hard'].map(level => _jsx(TouchableOpacity,{onPress:()=> handleDifficultyChange(level),style:[styles.difficultyButton,{backgroundColor:difficulty === level ? theme.buttonSelectedColor:theme.buttonUnselectedColor}],children:_jsx(Text,{style:[styles.buttonText,styles.capitalize,{color:difficulty === level ? theme.buttonSelectedTextColor:theme.buttonUnselectedTextColor}],children:level})},level))}),_jsx(View,{style:styles.infoBox,children:_jsxs(Text,{style:[styles.infoText,{color:theme.infoTextColor}],children:[_jsx(Text,{style:styles.boldText,children:"Easy:"})," ",typeof difficultyDescriptions.easy === 'string' ? difficultyDescriptions.easy:difficultyDescriptions.easy.description,'\n',_jsx(Text,{style:styles.boldText,children:"Medium:"})," ",typeof difficultyDescriptions.medium === 'string' ? difficultyDescriptions.medium:difficultyDescriptions.medium.description,'\n',_jsx(Text,{style:styles.boldText,children:"Hard:"})," ",typeof difficultyDescriptions.hard === 'string' ? difficultyDescriptions.hard:difficultyDescriptions.hard.description]})})]}),_jsx(View,{style:[styles.section,{backgroundColor:theme.sectionBackgroundColor}],children:_jsxs(View,{style:styles.toggleContainer,children:[_jsxs(View,{children:[_jsx(Text,{style:[styles.toggleTitle,{color:theme.sectionTitleColor}],children:"Sound Effects"}),_jsx(Text,{style:[styles.toggleSubtitle,{color:theme.infoTextColor}],children:"Play sounds during gameplay"})]}),_jsx(Switch,{value:enableSounds,onValueChange:handleSoundToggle,trackColor:{false:theme.switchTrackColorFalse,true:theme.switchTrackColorTrue},thumbColor:theme.switchThumbColor})]})}),_jsx(View,{style:[styles.section,{backgroundColor:theme.sectionBackgroundColor}],children:_jsxs(View,{style:styles.toggleContainer,children:[_jsxs(View,{children:[_jsx(Text,{style:[styles.toggleTitle,{color:theme.sectionTitleColor}],children:"Haptic Feedback"}),_jsx(Text,{style:[styles.toggleSubtitle,{color:theme.infoTextColor}],children:"Vibration feedback for interactions"})]}),_jsx(Switch,{value:enableHaptics,onValueChange:handleHapticToggle,trackColor:{false:theme.switchTrackColorFalse,true:theme.switchTrackColorTrue},thumbColor:theme.switchThumbColor})]})})]})]})})});};const styles = StyleSheet.create({overlay:{flex:1,backgroundColor:'rgba(0,0,0,0.7)',justifyContent:'center',alignItems:'center',padding:20},container:{width:'95%',maxWidth:600,maxHeight:'95%',minHeight:'60%',borderRadius:10,shadowColor:'#000',shadowOffset:{width:0,height:10},shadowOpacity:0.25,shadowRadius:20,elevation:10,overflow:'hidden'},header:{flexDirection:'row',justifyContent:'space-between',alignItems:'center',padding:10,paddingHorizontal:16},headerTitle:{fontSize:20,fontWeight:'semibold'},closeButton:{padding:8},closeButtonText:{fontSize:18,fontWeight:'semibold'},scrollView:{flex:1,padding:10},scrollContent:{flexGrow:1,paddingBottom:20},section:{borderRadius:12,padding:16,marginBottom:16},sectionTitle:{fontSize:16,fontWeight:'semibold',marginBottom:10},difficultyRow:{flexDirection:'row',justifyContent:'space-between',marginBottom:12},difficultyButton:{flex:1,paddingVertical:12,paddingHorizontal:8,borderRadius:8,marginHorizontal:4,alignItems:'center'},buttonText:{fontSize:16,fontWeight:'600'},capitalize:{textTransform:'capitalize'},infoBox:{backgroundColor:'rgba(255,255,255,0.1)',borderRadius:8,padding:12},infoText:{fontSize:14,lineHeight:20},boldText:{fontWeight:'semibold'},toggleContainer:{flexDirection:'row',justifyContent:'space-between',alignItems:'center'},toggleTitle:{fontSize:16,fontWeight:'semibold'},toggleSubtitle:{fontSize:14,marginTop:2}});
|
|
@@ -1,134 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React, { useEffect, useState } from 'react';
|
|
4
|
-
import { View, Dimensions, StyleSheet } from 'react-native';
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
const {
|
|
7
|
-
width,
|
|
8
|
-
height
|
|
9
|
-
} = Dimensions.get('window');
|
|
10
|
-
export const ParticleBlast = /*#__PURE__*/React.memo(({
|
|
11
|
-
x,
|
|
12
|
-
y,
|
|
13
|
-
particleCount = 8,
|
|
14
|
-
colors = ['#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#FFEAA7', '#DDA0DD', '#FF9F43', '#A55EEA'],
|
|
15
|
-
duration = 1000,
|
|
16
|
-
onComplete
|
|
17
|
-
}) => {
|
|
18
|
-
const [particles, setParticles] = useState([]);
|
|
19
|
-
const [isComplete, setIsComplete] = useState(false);
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
// Create initial particles with blast pattern - only once per component mount
|
|
22
|
-
const initialParticles = [];
|
|
23
|
-
for (let i = 0; i < particleCount; i++) {
|
|
24
|
-
const angle = i / particleCount * Math.PI * 2;
|
|
25
|
-
const speed = 4 + Math.random() * 3; // Random speed between 4-7
|
|
26
|
-
|
|
27
|
-
initialParticles.push({
|
|
28
|
-
id: `particle_${i}_${Date.now()}`,
|
|
29
|
-
x: x,
|
|
30
|
-
y: y,
|
|
31
|
-
vx: Math.cos(angle) * speed,
|
|
32
|
-
vy: Math.sin(angle) * speed - 2,
|
|
33
|
-
// Slight upward bias
|
|
34
|
-
color: colors[i % colors.length] || '#FF6B6B',
|
|
35
|
-
size: 6 + Math.random() * 8,
|
|
36
|
-
// More varied sizes between 6-14 for diversity
|
|
37
|
-
alpha: 1,
|
|
38
|
-
lifetime: 0,
|
|
39
|
-
maxLifetime: duration
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
setParticles(initialParticles);
|
|
43
|
-
|
|
44
|
-
// Animation loop
|
|
45
|
-
const animationInterval = setInterval(() => {
|
|
46
|
-
setParticles(prevParticles => {
|
|
47
|
-
const updatedParticles = prevParticles.map(particle => {
|
|
48
|
-
const newLifetime = particle.lifetime + 16; // Assume 60fps
|
|
49
|
-
|
|
50
|
-
if (newLifetime >= particle.maxLifetime) {
|
|
51
|
-
return null; // Mark for removal
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Update position with velocity
|
|
55
|
-
const newX = particle.x + particle.vx;
|
|
56
|
-
const newY = particle.y + particle.vy;
|
|
57
|
-
|
|
58
|
-
// Apply gravity to velocity
|
|
59
|
-
const newVy = particle.vy + 0.1;
|
|
60
|
-
|
|
61
|
-
// Calculate alpha based on lifetime - keep higher minimum for visibility
|
|
62
|
-
const alpha = Math.max(0.3, 1 - newLifetime / particle.maxLifetime);
|
|
63
|
-
return {
|
|
64
|
-
...particle,
|
|
65
|
-
x: newX,
|
|
66
|
-
y: newY,
|
|
67
|
-
vy: newVy,
|
|
68
|
-
alpha,
|
|
69
|
-
lifetime: newLifetime
|
|
70
|
-
};
|
|
71
|
-
}).filter(Boolean);
|
|
72
|
-
|
|
73
|
-
// If no particles left, mark as complete
|
|
74
|
-
if (updatedParticles.length === 0) {
|
|
75
|
-
setIsComplete(true);
|
|
76
|
-
}
|
|
77
|
-
return updatedParticles;
|
|
78
|
-
});
|
|
79
|
-
}, 16); // 60fps
|
|
80
|
-
|
|
81
|
-
// Cleanup interval after duration
|
|
82
|
-
const cleanup = setTimeout(() => {
|
|
83
|
-
clearInterval(animationInterval);
|
|
84
|
-
setParticles([]);
|
|
85
|
-
setIsComplete(true);
|
|
86
|
-
}, duration + 100);
|
|
87
|
-
return () => {
|
|
88
|
-
clearInterval(animationInterval);
|
|
89
|
-
clearTimeout(cleanup);
|
|
90
|
-
};
|
|
91
|
-
}, []); // Empty dependency array - only run once on mount
|
|
92
|
-
|
|
93
|
-
// Handle completion callback in a separate useEffect to avoid state updates during render
|
|
94
|
-
useEffect(() => {
|
|
95
|
-
if (isComplete && onComplete) {
|
|
96
|
-
onComplete();
|
|
97
|
-
}
|
|
98
|
-
}, [isComplete, onComplete]);
|
|
99
|
-
if (particles.length === 0) return null;
|
|
100
|
-
return /*#__PURE__*/_jsx(View, {
|
|
101
|
-
style: [styles.container, {
|
|
102
|
-
width,
|
|
103
|
-
height
|
|
104
|
-
}],
|
|
105
|
-
children: particles.map(particle => {
|
|
106
|
-
const particleSize = Math.max(4, particle.size); // Allow smaller particles for more size diversity
|
|
107
|
-
|
|
108
|
-
return /*#__PURE__*/_jsx(View, {
|
|
109
|
-
style: [styles.particle, {
|
|
110
|
-
left: particle.x - particleSize / 2,
|
|
111
|
-
top: particle.y - particleSize / 2,
|
|
112
|
-
width: particleSize,
|
|
113
|
-
height: particleSize,
|
|
114
|
-
backgroundColor: particle.color,
|
|
115
|
-
opacity: particle.alpha,
|
|
116
|
-
borderRadius: particleSize / 2
|
|
117
|
-
}]
|
|
118
|
-
}, particle.id);
|
|
119
|
-
})
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
ParticleBlast.displayName = 'ParticleBlast';
|
|
123
|
-
const styles = StyleSheet.create({
|
|
124
|
-
container: {
|
|
125
|
-
position: 'absolute',
|
|
126
|
-
top: 0,
|
|
127
|
-
left: 0,
|
|
128
|
-
pointerEvents: 'none'
|
|
129
|
-
},
|
|
130
|
-
particle: {
|
|
131
|
-
position: 'absolute'
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
//# sourceMappingURL=ParticleBlast.js.map
|
|
1
|
+
"use strict";import React,{useEffect,useState}from 'react';import{View,Dimensions,StyleSheet}from 'react-native';import{jsx as _jsx}from "react/jsx-runtime";const{width,height}= Dimensions.get('window');export const ParticleBlast = React.memo(({x,y,particleCount = 8,colors = ['#FF6B6B','#4ECDC4','#45B7D1','#96CEB4','#FFEAA7','#DDA0DD','#FF9F43','#A55EEA'],duration = 1000,onComplete})=>{const [particles,setParticles] = useState([]);const [isComplete,setIsComplete] = useState(false);useEffect(()=>{const initialParticles = [];for(let i = 0;i < particleCount;i++){const angle = i / particleCount * Math.PI * 2;const speed = 4 + Math.random()* 3;initialParticles.push({id:`particle_${i}_${Date.now()}`,x:x,y:y,vx:Math.cos(angle)* speed,vy:Math.sin(angle)* speed - 2,color:colors[i % colors.length] || '#FF6B6B',size:6 + Math.random()* 8,alpha:1,lifetime:0,maxLifetime:duration});}setParticles(initialParticles);const animationInterval = setInterval(()=>{setParticles(prevParticles =>{const updatedParticles = prevParticles.map(particle =>{const newLifetime = particle.lifetime + 16;if(newLifetime >= particle.maxLifetime){return null;}const newX = particle.x + particle.vx;const newY = particle.y + particle.vy;const newVy = particle.vy + 0.1;const alpha = Math.max(0.3,1 - newLifetime / particle.maxLifetime);return{...particle,x:newX,y:newY,vy:newVy,alpha,lifetime:newLifetime};}).filter(Boolean);if(updatedParticles.length === 0){setIsComplete(true);}return updatedParticles;});},16);const cleanup = setTimeout(()=>{clearInterval(animationInterval);setParticles([]);setIsComplete(true);},duration + 100);return()=>{clearInterval(animationInterval);clearTimeout(cleanup);};},[]);useEffect(()=>{if(isComplete && onComplete){onComplete();}},[isComplete,onComplete]);if(particles.length === 0)return null;return _jsx(View,{style:[styles.container,{width,height}],children:particles.map(particle =>{const particleSize = Math.max(4,particle.size);return _jsx(View,{style:[styles.particle,{left:particle.x - particleSize / 2,top:particle.y - particleSize / 2,width:particleSize,height:particleSize,backgroundColor:particle.color,opacity:particle.alpha,borderRadius:particleSize / 2}]},particle.id);})});});ParticleBlast.displayName = 'ParticleBlast';const styles = StyleSheet.create({container:{position:'absolute',top:0,left:0,pointerEvents:'none'},particle:{position:'absolute'}});
|
|
@@ -1,34 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { View } from 'react-native';
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
export const ScoreBoardContainer = /*#__PURE__*/React.memo(({
|
|
7
|
-
children,
|
|
8
|
-
offset = 0,
|
|
9
|
-
backgroundColor = 'rgba(0, 0, 0, 0.7)',
|
|
10
|
-
borderColor = 'rgba(255, 255, 255, 0.3)'
|
|
11
|
-
}) => {
|
|
12
|
-
// Memoize the dynamic container style based on offset
|
|
13
|
-
const containerStyle = React.useMemo(() => ({
|
|
14
|
-
maxWidth: 600,
|
|
15
|
-
marginTop: offset > 0 ? offset + 15 : 15,
|
|
16
|
-
alignSelf: 'center',
|
|
17
|
-
backgroundColor,
|
|
18
|
-
borderColor,
|
|
19
|
-
borderWidth: 2,
|
|
20
|
-
position: 'absolute',
|
|
21
|
-
top: 0,
|
|
22
|
-
left: 15,
|
|
23
|
-
right: 15,
|
|
24
|
-
zIndex: 10,
|
|
25
|
-
padding: 15,
|
|
26
|
-
borderRadius: 15
|
|
27
|
-
}), [offset, backgroundColor, borderColor]);
|
|
28
|
-
return /*#__PURE__*/_jsx(View, {
|
|
29
|
-
style: containerStyle,
|
|
30
|
-
children: children
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
ScoreBoardContainer.displayName = 'ScoreBoardContainer';
|
|
34
|
-
//# sourceMappingURL=ScoreBoardContainer.js.map
|
|
1
|
+
"use strict";import React from 'react';import{View}from 'react-native';import{jsx as _jsx}from "react/jsx-runtime";export const ScoreBoardContainer = React.memo(({children,offset = 0,backgroundColor = 'rgba(0,0,0,0.7)',borderColor = 'rgba(255,255,255,0.3)'})=>{const containerStyle = React.useMemo(()=>({maxWidth:600,marginTop:offset > 0 ? offset + 15:15,alignSelf:'center',backgroundColor,borderColor,borderWidth:2,position:'absolute',top:0,left:15,right:15,zIndex:10,padding:15,borderRadius:15}),[offset,backgroundColor,borderColor]);return _jsx(View,{style:containerStyle,children:children});});ScoreBoardContainer.displayName = 'ScoreBoardContainer';
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
export { GameControlButton } from "./GameControlButton.js";
|
|
4
|
-
export { ScoreBoardContainer } from "./ScoreBoardContainer.js";
|
|
5
|
-
export { ParticleBlast } from "./ParticleBlast.js";
|
|
6
|
-
export { GameOverModal } from "./GameOverModal.js";
|
|
7
|
-
export { GameSettingsModal } from "./GameSettingsModal.js";
|
|
8
|
-
export { AnimationTracker, useAnimationTracker, useAnimationTrackers, DEFAULT_ANIMATION_STATE } from "./AnimationTracker.js";
|
|
9
|
-
export { AnimationFrameManager, useAnimationFrame, useAnimationFrameManager } from "./AnimationFrame.js";
|
|
10
|
-
export { GameErrorHandler, useGameErrorHandler, withErrorHandling, ErrorUtils, globalErrorHandler, DEFAULT_ERROR_CONFIG } from "./ErrorHandler.js";
|
|
11
|
-
export { GameErrorType } from "./ErrorHandler.js";
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
"use strict";export{GameControlButton}from "./GameControlButton.js";export{ScoreBoardContainer}from "./ScoreBoardContainer.js";export{ParticleBlast}from "./ParticleBlast.js";export{GameOverModal}from "./GameOverModal.js";export{GameSettingsModal}from "./GameSettingsModal.js";export{AnimationTracker,useAnimationTracker,useAnimationTrackers,DEFAULT_ANIMATION_STATE}from "./AnimationTracker.js";export{AnimationFrameManager,useAnimationFrame,useAnimationFrameManager}from "./AnimationFrame.js";export{GameErrorHandler,useGameErrorHandler,withErrorHandling,ErrorUtils,globalErrorHandler,DEFAULT_ERROR_CONFIG}from "./ErrorHandler.js";export{GameErrorType}from "./ErrorHandler.js";
|