react-native-games 1.0.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.
Files changed (212) hide show
  1. package/README.md +80 -368
  2. package/lib/module/games/balloon-blaster/BalloonBlaster.js +1 -167
  3. package/lib/module/games/balloon-blaster/BalloonBlaster.js.map +1 -1
  4. package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js +1 -182
  5. package/lib/module/games/balloon-blaster/BalloonBlasterConstants.js.map +1 -1
  6. package/lib/module/games/balloon-blaster/BalloonBlasterService.js +1 -318
  7. package/lib/module/games/balloon-blaster/BalloonBlasterStore.js +1 -183
  8. package/lib/module/games/balloon-blaster/components/BalloonComponent.js +1 -237
  9. package/lib/module/games/balloon-blaster/components/GameArea.js +1 -156
  10. package/lib/module/games/balloon-blaster/components/GameBackground.js +1 -476
  11. package/lib/module/games/balloon-blaster/components/ScoreBoard.js +1 -112
  12. package/lib/module/games/balloon-blaster/components/ScoreBoard.js.map +1 -1
  13. package/lib/module/games/balloon-blaster/components/index.js +1 -7
  14. package/lib/module/games/candy-crush/CandyCrush.js +1 -131
  15. package/lib/module/games/candy-crush/CandyCrush.js.map +1 -1
  16. package/lib/module/games/candy-crush/CandyCrushConstants.js +1 -125
  17. package/lib/module/games/candy-crush/CandyCrushConstants.js.map +1 -1
  18. package/lib/module/games/candy-crush/CandyCrushService.js +1 -370
  19. package/lib/module/games/candy-crush/CandyCrushStore.js +1 -303
  20. package/lib/module/games/candy-crush/components/CandyItem.js +1 -191
  21. package/lib/module/games/candy-crush/components/GameBackground.js +1 -85
  22. package/lib/module/games/candy-crush/components/GameGrid.js +1 -314
  23. package/lib/module/games/candy-crush/components/ScoreBoard.js +1 -79
  24. package/lib/module/games/candy-crush/components/index.js +1 -7
  25. package/lib/module/games/candy-crush/index.js +1 -6
  26. package/lib/module/games/colors-sort/ColorsSort.js +1 -143
  27. package/lib/module/games/colors-sort/ColorsSort.js.map +1 -1
  28. package/lib/module/games/colors-sort/ColorsSortConstants.js +1 -72
  29. package/lib/module/games/colors-sort/ColorsSortConstants.js.map +1 -1
  30. package/lib/module/games/colors-sort/ColorsSortService.js +1 -255
  31. package/lib/module/games/colors-sort/ColorsSortStore.js +1 -257
  32. package/lib/module/games/colors-sort/ColorsSortStore.js.map +1 -1
  33. package/lib/module/games/colors-sort/components/ColorContainer.js +1 -140
  34. package/lib/module/games/colors-sort/components/GameBackground.js +1 -135
  35. package/lib/module/games/colors-sort/components/ScoreBoard.js +1 -70
  36. package/lib/module/games/colors-sort/components/index.js +1 -6
  37. package/lib/module/games/dino-jump/DinoJump.js +1 -209
  38. package/lib/module/games/dino-jump/DinoJump.js.map +1 -1
  39. package/lib/module/games/dino-jump/DinoJumpConstants.js +1 -189
  40. package/lib/module/games/dino-jump/DinoJumpConstants.js.map +1 -1
  41. package/lib/module/games/dino-jump/DinoJumpService.js +1 -270
  42. package/lib/module/games/dino-jump/DinoJumpStore.js +1 -381
  43. package/lib/module/games/dino-jump/components/DinoSprite.js +1 -418
  44. package/lib/module/games/dino-jump/components/DinoSprite.js.map +1 -1
  45. package/lib/module/games/dino-jump/components/GameArea.js +1 -68
  46. package/lib/module/games/dino-jump/components/GameBackground.js +1 -444
  47. package/lib/module/games/dino-jump/components/ObstacleSprite.js +1 -306
  48. package/lib/module/games/dino-jump/components/ScoreBoard.js +1 -105
  49. package/lib/module/games/dino-jump/components/ScoreBoard.js.map +1 -1
  50. package/lib/module/games/dino-jump/components/StarSprite.js +1 -45
  51. package/lib/module/games/dino-jump/components/index.js +1 -9
  52. package/lib/module/games/flappy-bird/FlappyBird.js +1 -126
  53. package/lib/module/games/flappy-bird/FlappyBird.js.map +1 -1
  54. package/lib/module/games/flappy-bird/FlappyBirdConstants.js +1 -90
  55. package/lib/module/games/flappy-bird/FlappyBirdConstants.js.map +1 -1
  56. package/lib/module/games/flappy-bird/FlappyBirdStore.js +1 -300
  57. package/lib/module/games/flappy-bird/components/Bird.js +1 -87
  58. package/lib/module/games/flappy-bird/components/GameArea.js +1 -87
  59. package/lib/module/games/flappy-bird/components/GameBackground.js +1 -79
  60. package/lib/module/games/flappy-bird/components/Pipes.js +1 -172
  61. package/lib/module/games/flappy-bird/components/ScoreBoard.js +1 -73
  62. package/lib/module/games/flappy-bird/components/index.js +1 -8
  63. package/lib/module/games/fruit-merger/FruitMerger.js +1 -120
  64. package/lib/module/games/fruit-merger/FruitMerger.js.map +1 -1
  65. package/lib/module/games/fruit-merger/FruitMergerConstants.js +1 -119
  66. package/lib/module/games/fruit-merger/FruitMergerConstants.js.map +1 -1
  67. package/lib/module/games/fruit-merger/FruitMergerService.js +1 -13
  68. package/lib/module/games/fruit-merger/FruitMergerStore.js +1 -315
  69. package/lib/module/games/fruit-merger/components/FruitItem.js +1 -102
  70. package/lib/module/games/fruit-merger/components/GameArea.js +1 -103
  71. package/lib/module/games/fruit-merger/components/GameBackground.js +1 -498
  72. package/lib/module/games/fruit-merger/components/ScoreBoard.js +1 -58
  73. package/lib/module/games/fruit-merger/components/index.js +1 -7
  74. package/lib/module/games/fruit-ninja/FruitNinja.js +1 -134
  75. package/lib/module/games/fruit-ninja/FruitNinja.js.map +1 -1
  76. package/lib/module/games/fruit-ninja/FruitNinjaConstants.js +1 -148
  77. package/lib/module/games/fruit-ninja/FruitNinjaConstants.js.map +1 -1
  78. package/lib/module/games/fruit-ninja/FruitNinjaService.js +1 -311
  79. package/lib/module/games/fruit-ninja/FruitNinjaStore.js +1 -191
  80. package/lib/module/games/fruit-ninja/FruitNinjaStore.js.map +1 -1
  81. package/lib/module/games/fruit-ninja/components/FruitComponent.js +1 -99
  82. package/lib/module/games/fruit-ninja/components/GameArea.js +1 -215
  83. package/lib/module/games/fruit-ninja/components/GameBackground.js +1 -1267
  84. package/lib/module/games/fruit-ninja/components/ScoreBoard.js +1 -92
  85. package/lib/module/games/fruit-ninja/components/ScoreBoard.js.map +1 -1
  86. package/lib/module/games/fruit-ninja/components/index.js +1 -7
  87. package/lib/module/games/game-2048/Game2048.js +1 -149
  88. package/lib/module/games/game-2048/Game2048.js.map +1 -1
  89. package/lib/module/games/game-2048/Game2048Constants.js +1 -263
  90. package/lib/module/games/game-2048/Game2048Constants.js.map +1 -1
  91. package/lib/module/games/game-2048/Game2048Service.js +1 -457
  92. package/lib/module/games/game-2048/Game2048Store.js +1 -236
  93. package/lib/module/games/game-2048/components/GameBackground.js +1 -247
  94. package/lib/module/games/game-2048/components/GameGrid.js +1 -139
  95. package/lib/module/games/game-2048/components/GameTile.js +1 -72
  96. package/lib/module/games/game-2048/components/ScoreBoard.js +1 -52
  97. package/lib/module/games/game-2048/components/index.js +1 -7
  98. package/lib/module/games/maze-runner/MazeRunner.js +1 -267
  99. package/lib/module/games/maze-runner/MazeRunner.js.map +1 -1
  100. package/lib/module/games/maze-runner/MazeRunnerConstants.js +1 -100
  101. package/lib/module/games/maze-runner/MazeRunnerConstants.js.map +1 -1
  102. package/lib/module/games/maze-runner/MazeRunnerService.js +1 -586
  103. package/lib/module/games/maze-runner/components/EnhancedBallComponent.js +1 -150
  104. package/lib/module/games/maze-runner/components/EnhancedGameArea.js +1 -370
  105. package/lib/module/games/maze-runner/components/GameBackground.js +1 -175
  106. package/lib/module/games/maze-runner/components/ScoreBoard.js +1 -61
  107. package/lib/module/games/maze-runner/components/SkiaPipeComponent.js +1 -209
  108. package/lib/module/games/maze-runner/components/StaticGameBackground.js +1 -169
  109. package/lib/module/games/maze-runner/components/WallComponent.js +1 -91
  110. package/lib/module/games/maze-runner/components/index.js +1 -8
  111. package/lib/module/games/popit-fidget/PopitFidget.js +1 -285
  112. package/lib/module/games/popit-fidget/PopitFidget.js.map +1 -1
  113. package/lib/module/games/popit-fidget/PopitFidgetConstants.js +1 -113
  114. package/lib/module/games/popit-fidget/PopitFidgetConstants.js.map +1 -1
  115. package/lib/module/games/popit-fidget/PopitFidgetService.js +1 -132
  116. package/lib/module/games/popit-fidget/PopitFidgetStore.js +1 -125
  117. package/lib/module/games/popit-fidget/components/BubbleComponent.js +1 -198
  118. package/lib/module/games/popit-fidget/components/FidgetGrid.js +1 -165
  119. package/lib/module/games/popit-fidget/components/GameBackground.js +1 -177
  120. package/lib/module/games/popit-fidget/components/ScoreBoard.js +1 -61
  121. package/lib/module/games/popit-fidget/components/index.js +1 -7
  122. package/lib/module/games/sliding-numbers/SlidingNumbers.js +1 -159
  123. package/lib/module/games/sliding-numbers/SlidingNumbers.js.map +1 -1
  124. package/lib/module/games/sliding-numbers/SlidingNumbersConstants.js +1 -207
  125. package/lib/module/games/sliding-numbers/SlidingNumbersConstants.js.map +1 -1
  126. package/lib/module/games/sliding-numbers/SlidingNumbersService.js +1 -248
  127. package/lib/module/games/sliding-numbers/SlidingNumbersStore.js +1 -274
  128. package/lib/module/games/sliding-numbers/components/GameBackground.js +1 -259
  129. package/lib/module/games/sliding-numbers/components/NumbersGrid.js +1 -174
  130. package/lib/module/games/sliding-numbers/components/NumbersTile.js +1 -116
  131. package/lib/module/games/sliding-numbers/components/ScoreBoard.js +1 -64
  132. package/lib/module/games/sliding-numbers/components/index.js +1 -7
  133. package/lib/module/games/snake/Snake.js +1 -189
  134. package/lib/module/games/snake/Snake.js.map +1 -1
  135. package/lib/module/games/snake/SnakeConstants.js +1 -138
  136. package/lib/module/games/snake/SnakeConstants.js.map +1 -1
  137. package/lib/module/games/snake/SnakeService.js +1 -148
  138. package/lib/module/games/snake/SnakeStore.js +1 -182
  139. package/lib/module/games/snake/components/GameBackground.js +1 -221
  140. package/lib/module/games/snake/components/GameGrid.js +1 -153
  141. package/lib/module/games/snake/components/ScoreBoard.js +1 -51
  142. package/lib/module/games/snake/components/index.js +1 -6
  143. package/lib/module/games/snake/index.js +1 -6
  144. package/lib/module/games/space-fighter/SpaceFighter.js +1 -165
  145. package/lib/module/games/space-fighter/SpaceFighter.js.map +1 -1
  146. package/lib/module/games/space-fighter/SpaceFighterConstants.js +1 -108
  147. package/lib/module/games/space-fighter/SpaceFighterConstants.js.map +1 -1
  148. package/lib/module/games/space-fighter/SpaceFighterService.js +1 -326
  149. package/lib/module/games/space-fighter/SpaceFighterStore.js +1 -209
  150. package/lib/module/games/space-fighter/components/AsteroidComponent.js +1 -113
  151. package/lib/module/games/space-fighter/components/GameArea.js +1 -289
  152. package/lib/module/games/space-fighter/components/GameBackground.js +1 -239
  153. package/lib/module/games/space-fighter/components/ScoreBoard.js +1 -136
  154. package/lib/module/games/space-fighter/components/Spacecraft3D.js +1 -202
  155. package/lib/module/games/space-fighter/components/SpacecraftPath.js +1 -52
  156. package/lib/module/games/space-fighter/components/index.js +1 -9
  157. package/lib/module/games/whack-a-mole/WhackAMole.js +1 -270
  158. package/lib/module/games/whack-a-mole/WhackAMole.js.map +1 -1
  159. package/lib/module/games/whack-a-mole/WhackAMoleConstants.js +1 -115
  160. package/lib/module/games/whack-a-mole/WhackAMoleConstants.js.map +1 -1
  161. package/lib/module/games/whack-a-mole/WhackAMoleService.js +1 -120
  162. package/lib/module/games/whack-a-mole/WhackAMoleStore.js +1 -172
  163. package/lib/module/games/whack-a-mole/components/GameBackground.js +1 -477
  164. package/lib/module/games/whack-a-mole/components/GameGrid.js +1 -97
  165. package/lib/module/games/whack-a-mole/components/GameHole.js +1 -196
  166. package/lib/module/games/whack-a-mole/components/MoleCharacter.js +1 -241
  167. package/lib/module/games/whack-a-mole/components/ScoreBoard.js +1 -67
  168. package/lib/module/games/whack-a-mole/components/ScoreBoard.js.map +1 -1
  169. package/lib/module/games/whack-a-mole/components/index.js +1 -8
  170. package/lib/module/helpers/AnimationFrame.js +1 -120
  171. package/lib/module/helpers/AnimationTracker.js +1 -89
  172. package/lib/module/helpers/ErrorHandler.js +1 -269
  173. package/lib/module/helpers/GameControlButton.js +1 -219
  174. package/lib/module/helpers/GameOverModal.js +1 -144
  175. package/lib/module/helpers/GameOverModal.js.map +1 -1
  176. package/lib/module/helpers/GameSettingsModal.js +1 -287
  177. package/lib/module/helpers/ParticleBlast.js +1 -134
  178. package/lib/module/helpers/ScoreBoardContainer.js +1 -34
  179. package/lib/module/helpers/index.js +1 -12
  180. package/lib/module/index.js +1 -22
  181. package/lib/module/services/GamesConstants.js +1 -178
  182. package/lib/module/services/GamesService.js +1 -112
  183. package/lib/module/services/GamesService.js.map +1 -1
  184. package/lib/module/services/HapticsService.js +1 -77
  185. package/lib/module/services/SoundsService.js +1 -302
  186. package/lib/module/services/UtilsService.js +1 -32
  187. package/lib/typescript/src/games/balloon-blaster/BalloonBlaster.d.ts.map +1 -1
  188. package/lib/typescript/src/games/balloon-blaster/BalloonBlasterConstants.d.ts +1 -1
  189. package/lib/typescript/src/games/balloon-blaster/components/ScoreBoard.d.ts.map +1 -1
  190. package/lib/typescript/src/games/candy-crush/CandyCrushConstants.d.ts +7 -7
  191. package/lib/typescript/src/games/colors-sort/ColorsSort.d.ts.map +1 -1
  192. package/lib/typescript/src/games/colors-sort/ColorsSortStore.d.ts.map +1 -1
  193. package/lib/typescript/src/games/dino-jump/DinoJump.d.ts.map +1 -1
  194. package/lib/typescript/src/games/dino-jump/components/DinoSprite.d.ts.map +1 -1
  195. package/lib/typescript/src/games/flappy-bird/FlappyBird.d.ts.map +1 -1
  196. package/lib/typescript/src/games/flappy-bird/FlappyBirdConstants.d.ts.map +1 -1
  197. package/lib/typescript/src/games/fruit-merger/FruitMerger.d.ts.map +1 -1
  198. package/lib/typescript/src/games/fruit-merger/FruitMergerConstants.d.ts.map +1 -1
  199. package/lib/typescript/src/games/fruit-ninja/FruitNinja.d.ts.map +1 -1
  200. package/lib/typescript/src/games/fruit-ninja/components/ScoreBoard.d.ts.map +1 -1
  201. package/lib/typescript/src/games/game-2048/Game2048.d.ts.map +1 -1
  202. package/lib/typescript/src/games/maze-runner/MazeRunner.d.ts.map +1 -1
  203. package/lib/typescript/src/games/popit-fidget/PopitFidget.d.ts.map +1 -1
  204. package/lib/typescript/src/games/sliding-numbers/SlidingNumbers.d.ts.map +1 -1
  205. package/lib/typescript/src/games/space-fighter/SpaceFighter.d.ts.map +1 -1
  206. package/lib/typescript/src/games/whack-a-mole/WhackAMole.d.ts.map +1 -1
  207. package/lib/typescript/src/games/whack-a-mole/WhackAMoleConstants.d.ts +1 -1
  208. package/lib/typescript/src/games/whack-a-mole/components/ScoreBoard.d.ts.map +1 -1
  209. package/lib/typescript/src/helpers/GameOverModal.d.ts +3 -0
  210. package/lib/typescript/src/helpers/GameOverModal.d.ts.map +1 -1
  211. package/lib/typescript/src/services/GamesConstants.d.ts +7 -7
  212. package/package.json +2 -2
@@ -1,498 +1 @@
1
- "use strict";
2
-
3
- import React from 'react';
4
- import { View, Dimensions } from 'react-native';
5
- import { Canvas, LinearGradient, Rect, Circle, Path, Skia, vec, Group, Shadow } from '@shopify/react-native-skia';
6
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
- const {
8
- width,
9
- height
10
- } = Dimensions.get('window');
11
- // Pre-compute all static values
12
- const buttonAreaHeight = 250;
13
- const grassStartY = height - buttonAreaHeight;
14
-
15
- // Create static grass path
16
- const createStaticGrassPath = () => {
17
- const path = Skia.Path.Make();
18
- const segmentWidth = width / 8;
19
- path.moveTo(0, grassStartY);
20
- for (let i = 0; i < 8; i++) {
21
- const x = i * segmentWidth;
22
- const y = grassStartY + Math.sin(i * 0.5) * 8;
23
- const controlX = x + segmentWidth / 2;
24
- const controlY = y + Math.cos(i * 0.3) * 6;
25
- path.quadTo(controlX, controlY, x + segmentWidth, y);
26
- }
27
- path.lineTo(width, height);
28
- path.lineTo(0, height);
29
- path.close();
30
- return path;
31
- };
32
-
33
- // Pre-compute static sun rays
34
- const createStaticSunRays = () => {
35
- return Array.from({
36
- length: 16
37
- }, (_, index) => {
38
- const angle = 360 / 16 * index;
39
- const radian = angle * Math.PI / 180;
40
- const isLongRay = index % 2 === 0;
41
- const rayLength = isLongRay ? 25 : 15;
42
- const rayWidth = isLongRay ? 4 : 2;
43
- const startDistance = 45;
44
- const startX = width * 0.8 + Math.cos(radian) * startDistance;
45
- const startY = height * 0.15 + Math.sin(radian) * startDistance;
46
- const endX = width * 0.8 + Math.cos(radian) * (startDistance + rayLength);
47
- const endY = height * 0.15 + Math.sin(radian) * (startDistance + rayLength);
48
- const rayPath = Skia.Path.Make();
49
- rayPath.moveTo(startX, startY);
50
- rayPath.lineTo(endX, endY);
51
- return {
52
- path: rayPath,
53
- width: rayWidth
54
- };
55
- });
56
- };
57
-
58
- // Create static flower positions
59
- const createStaticFlowerPositions = () => {
60
- return Array.from({
61
- length: 12
62
- }, (_, i) => ({
63
- x: width / 12 * i + i % 3 * 15 + 20,
64
- y: grassStartY - 10 - i % 4 * 8
65
- }));
66
- };
67
-
68
- // Static computed values
69
- const staticGrassPath = createStaticGrassPath();
70
- const staticSunRays = createStaticSunRays();
71
- const flowerPositions = createStaticFlowerPositions();
72
- export const GameBackground = ({
73
- children,
74
- offset = 0
75
- }) => {
76
- // Adjust sun and cloud positions based on offset
77
- const sunY = height * 0.15 + offset * 0.5; // Move sun down slightly with offset
78
- const cloud1Y = height * 0.24 + offset * 0.5; // Move clouds down
79
- const cloud2Y = height * 0.27 + offset * 0.2;
80
- return /*#__PURE__*/_jsxs(View, {
81
- style: {
82
- flex: 1
83
- },
84
- children: [/*#__PURE__*/_jsxs(Canvas, {
85
- style: {
86
- position: 'absolute',
87
- top: 0,
88
- left: 0,
89
- right: 0,
90
- bottom: 0,
91
- width,
92
- height
93
- },
94
- children: [/*#__PURE__*/_jsx(Rect, {
95
- x: 0,
96
- y: 0,
97
- width: width,
98
- height: grassStartY,
99
- children: /*#__PURE__*/_jsx(LinearGradient, {
100
- start: vec(0, 0),
101
- end: vec(0, grassStartY),
102
- colors: ['#87CEEB', '#98D8E8', '#B0E0E6']
103
- })
104
- }), /*#__PURE__*/_jsx(Rect, {
105
- x: 0,
106
- y: grassStartY,
107
- width: width,
108
- height: buttonAreaHeight,
109
- children: /*#__PURE__*/_jsx(LinearGradient, {
110
- start: vec(0, grassStartY),
111
- end: vec(0, height),
112
- colors: ['#8B4513', '#A0522D', '#654321']
113
- })
114
- }), /*#__PURE__*/_jsxs(Group, {
115
- children: [/*#__PURE__*/_jsxs(Circle, {
116
- cx: width * 0.8,
117
- cy: sunY,
118
- r: 40,
119
- children: [/*#__PURE__*/_jsx(LinearGradient, {
120
- start: vec(-40, -40),
121
- end: vec(40, 40),
122
- colors: ['#FFFF99', '#FFD700', '#FFA500', '#FF8C00']
123
- }), /*#__PURE__*/_jsx(Shadow, {
124
- dx: 0,
125
- dy: 0,
126
- blur: 32,
127
- color: "#FFD700"
128
- })]
129
- }), /*#__PURE__*/_jsx(Circle, {
130
- cx: width * 0.8 - 8,
131
- cy: sunY - 8,
132
- r: 15,
133
- children: /*#__PURE__*/_jsx(LinearGradient, {
134
- start: vec(-15, -15),
135
- end: vec(15, 15),
136
- colors: ['#FFFFFF', '#FFFF99']
137
- })
138
- }), staticSunRays.map((_, index) => {
139
- // Recalculate ray positions based on offset
140
- const angle = 360 / 16 * index;
141
- const radian = angle * Math.PI / 180;
142
- const isLongRay = index % 2 === 0;
143
- const rayLength = isLongRay ? 25 : 15;
144
- const rayWidth = isLongRay ? 4 : 2;
145
- const startDistance = 45;
146
- const startX = width * 0.8 + Math.cos(radian) * startDistance;
147
- const startY = sunY + Math.sin(radian) * startDistance;
148
- const endX = width * 0.8 + Math.cos(radian) * (startDistance + rayLength);
149
- const endY = sunY + Math.sin(radian) * (startDistance + rayLength);
150
- const rayPath = Skia.Path.Make();
151
- rayPath.moveTo(startX, startY);
152
- rayPath.lineTo(endX, endY);
153
- return /*#__PURE__*/_jsx(Path, {
154
- path: rayPath,
155
- style: "stroke",
156
- strokeWidth: rayWidth,
157
- color: "#FFD700",
158
- opacity: 0.75
159
- }, index);
160
- }), /*#__PURE__*/_jsx(Circle, {
161
- cx: width * 0.8,
162
- cy: sunY,
163
- r: 60,
164
- opacity: 0.1,
165
- children: /*#__PURE__*/_jsx(LinearGradient, {
166
- start: vec(-60, -60),
167
- end: vec(60, 60),
168
- colors: ['#FFD700', 'transparent']
169
- })
170
- })]
171
- }), /*#__PURE__*/_jsxs(Group, {
172
- children: [/*#__PURE__*/_jsxs(Group, {
173
- children: [/*#__PURE__*/_jsx(Circle, {
174
- cx: width * 0.12,
175
- cy: cloud1Y,
176
- r: 16,
177
- color: "#F0F8FF",
178
- opacity: 0.35,
179
- children: /*#__PURE__*/_jsx(Shadow, {
180
- dx: 1,
181
- dy: 2,
182
- blur: 12,
183
- color: "rgba(0,0,0,0.05)"
184
- })
185
- }), /*#__PURE__*/_jsx(Circle, {
186
- cx: width * 0.18,
187
- cy: cloud1Y - (height * 0.24 - height * 0.21),
188
- r: 22,
189
- color: "#FFFFFF",
190
- opacity: 0.45,
191
- children: /*#__PURE__*/_jsx(Shadow, {
192
- dx: 1,
193
- dy: 2,
194
- blur: 12,
195
- color: "rgba(0,0,0,0.05)"
196
- })
197
- }), /*#__PURE__*/_jsx(Circle, {
198
- cx: width * 0.25,
199
- cy: cloud1Y - (height * 0.24 - height * 0.19),
200
- r: 26,
201
- color: "#F8F8FF",
202
- opacity: 0.55,
203
- children: /*#__PURE__*/_jsx(Shadow, {
204
- dx: 2,
205
- dy: 3,
206
- blur: 12,
207
- color: "rgba(0,0,0,0.06)"
208
- })
209
- }), /*#__PURE__*/_jsx(Circle, {
210
- cx: width * 0.32,
211
- cy: cloud1Y - (height * 0.24 - height * 0.21),
212
- r: 20,
213
- color: "#FFFFFF",
214
- opacity: 0.50,
215
- children: /*#__PURE__*/_jsx(Shadow, {
216
- dx: 1,
217
- dy: 2,
218
- blur: 12,
219
- color: "rgba(0,0,0,0.05)"
220
- })
221
- }), /*#__PURE__*/_jsx(Circle, {
222
- cx: width * 0.37,
223
- cy: cloud1Y,
224
- r: 14,
225
- color: "#F0F8FF",
226
- opacity: 0.40,
227
- children: /*#__PURE__*/_jsx(Shadow, {
228
- dx: 1,
229
- dy: 2,
230
- blur: 12,
231
- color: "rgba(0,0,0,0.04)"
232
- })
233
- })]
234
- }), /*#__PURE__*/_jsxs(Group, {
235
- children: [/*#__PURE__*/_jsx(Circle, {
236
- cx: width * 0.62,
237
- cy: cloud2Y,
238
- r: 15,
239
- color: "#F0F8FF",
240
- opacity: 0.40,
241
- children: /*#__PURE__*/_jsx(Shadow, {
242
- dx: 1,
243
- dy: 2,
244
- blur: 10,
245
- color: "rgba(0,0,0,0.04)"
246
- })
247
- }), /*#__PURE__*/_jsx(Circle, {
248
- cx: width * 0.69,
249
- cy: cloud2Y - (height * 0.27 - height * 0.24),
250
- r: 19,
251
- color: "#FFFFFF",
252
- opacity: 0.50,
253
- children: /*#__PURE__*/_jsx(Shadow, {
254
- dx: 1,
255
- dy: 2,
256
- blur: 10,
257
- color: "rgba(0,0,0,0.05)"
258
- })
259
- }), /*#__PURE__*/_jsx(Circle, {
260
- cx: width * 0.76,
261
- cy: cloud2Y - (height * 0.27 - height * 0.26),
262
- r: 13,
263
- color: "#F8F8FF",
264
- opacity: 0.45,
265
- children: /*#__PURE__*/_jsx(Shadow, {
266
- dx: 1,
267
- dy: 2,
268
- blur: 10,
269
- color: "rgba(0,0,0,0.04)"
270
- })
271
- })]
272
- })]
273
- }), /*#__PURE__*/_jsxs(Path, {
274
- path: staticGrassPath,
275
- children: [/*#__PURE__*/_jsx(LinearGradient, {
276
- start: vec(0, grassStartY - 20),
277
- end: vec(0, grassStartY + 20),
278
- colors: ['#32CD32', '#228B22', '#006400']
279
- }), /*#__PURE__*/_jsx(Shadow, {
280
- dx: 0,
281
- dy: -2,
282
- blur: 4,
283
- color: "rgba(0,0,0,0.2)"
284
- })]
285
- }), Array.from({
286
- length: 25
287
- }, (_, i) => {
288
- const x = width / 25 * i + i % 3 * 5;
289
- const grassHeight = 15 + i % 4 * 5;
290
- const grassType = i % 3;
291
- const bladePath = Skia.Path.Make();
292
- bladePath.moveTo(x, grassStartY);
293
- if (grassType === 0) {
294
- bladePath.quadTo(x + 1, grassStartY - grassHeight * 0.6, x + 1, grassStartY - grassHeight);
295
- return /*#__PURE__*/_jsx(Path, {
296
- path: bladePath,
297
- style: "stroke",
298
- strokeWidth: 1.5,
299
- color: "#16a34a",
300
- opacity: 0.8
301
- }, `grass-${i}`);
302
- } else if (grassType === 1) {
303
- bladePath.quadTo(x + 2, grassStartY - grassHeight * 0.4, x + 3, grassStartY - grassHeight);
304
- return /*#__PURE__*/_jsx(Path, {
305
- path: bladePath,
306
- style: "stroke",
307
- strokeWidth: 2,
308
- color: "#15803d",
309
- opacity: 0.7
310
- }, `grass-${i}`);
311
- } else {
312
- const midHeight = grassHeight * 0.5;
313
- bladePath.quadTo(x + 1, grassStartY - midHeight, x + 2, grassStartY - grassHeight);
314
- return /*#__PURE__*/_jsx(Path, {
315
- path: bladePath,
316
- style: "stroke",
317
- strokeWidth: 2.5,
318
- color: "#166534",
319
- opacity: 0.6
320
- }, `grass-${i}`);
321
- }
322
- }), /*#__PURE__*/_jsxs(Group, {
323
- children: [/*#__PURE__*/_jsxs(Group, {
324
- children: [/*#__PURE__*/_jsxs(Rect, {
325
- x: width * 0.05,
326
- y: grassStartY - 150,
327
- width: 20,
328
- height: 150,
329
- children: [/*#__PURE__*/_jsx(LinearGradient, {
330
- start: vec(0, 0),
331
- end: vec(20, 0),
332
- colors: ['#654321', '#8B4513', '#A0522D', '#8B4513']
333
- }), /*#__PURE__*/_jsx(Shadow, {
334
- dx: 3,
335
- dy: 0,
336
- blur: 6,
337
- color: "rgba(0,0,0,0.4)"
338
- })]
339
- }), /*#__PURE__*/_jsx(Circle, {
340
- cx: width * 0.05 + 10,
341
- cy: grassStartY - 150,
342
- r: 38,
343
- color: "#1B5E20",
344
- opacity: 0.9,
345
- children: /*#__PURE__*/_jsx(Shadow, {
346
- dx: 4,
347
- dy: 4,
348
- blur: 10,
349
- color: "rgba(0,0,0,0.3)"
350
- })
351
- }), /*#__PURE__*/_jsx(Circle, {
352
- cx: width * 0.05 + 18,
353
- cy: grassStartY - 180,
354
- r: 32,
355
- color: "#2E7D32",
356
- opacity: 0.8
357
- }), /*#__PURE__*/_jsx(Circle, {
358
- cx: width * 0.05 + 25,
359
- cy: grassStartY - 140,
360
- r: 28,
361
- color: "#388E3C",
362
- opacity: 0.7
363
- }), /*#__PURE__*/_jsx(Circle, {
364
- cx: width * 0.05 + 2,
365
- cy: grassStartY - 120,
366
- r: 30,
367
- color: "#2E7D32",
368
- opacity: 0.75
369
- })]
370
- }), /*#__PURE__*/_jsxs(Group, {
371
- children: [/*#__PURE__*/_jsxs(Rect, {
372
- x: width * 0.88,
373
- y: grassStartY - 200,
374
- width: 18,
375
- height: 200,
376
- children: [/*#__PURE__*/_jsx(LinearGradient, {
377
- start: vec(0, 0),
378
- end: vec(18, 0),
379
- colors: ['#4A2C2A', '#654321', '#8B4513', '#654321']
380
- }), /*#__PURE__*/_jsx(Shadow, {
381
- dx: -3,
382
- dy: 0,
383
- blur: 6,
384
- color: "rgba(0,0,0,0.4)"
385
- })]
386
- }), /*#__PURE__*/_jsx(Circle, {
387
- cx: width * 0.88 + 9,
388
- cy: grassStartY - 120,
389
- r: 35,
390
- color: "#0D4F0C",
391
- opacity: 0.95,
392
- children: /*#__PURE__*/_jsx(Shadow, {
393
- dx: -4,
394
- dy: 4,
395
- blur: 10,
396
- color: "rgba(0,0,0,0.3)"
397
- })
398
- }), /*#__PURE__*/_jsx(Circle, {
399
- cx: width * 0.88 + 9,
400
- cy: grassStartY - 180,
401
- r: 32,
402
- color: "#1B5E20",
403
- opacity: 0.9
404
- }), /*#__PURE__*/_jsx(Circle, {
405
- cx: width * 0.88 + 9,
406
- cy: grassStartY - 240,
407
- r: 28,
408
- color: "#2E7D32",
409
- opacity: 0.9
410
- })]
411
- })]
412
- }), /*#__PURE__*/_jsxs(Group, {
413
- children: [/*#__PURE__*/_jsxs(Group, {
414
- children: [/*#__PURE__*/_jsx(Circle, {
415
- cx: width * 0.15,
416
- cy: grassStartY - 60,
417
- r: 26,
418
- color: "#1B5E20",
419
- opacity: 0.95,
420
- children: /*#__PURE__*/_jsx(Shadow, {
421
- dx: 3,
422
- dy: 3,
423
- blur: 8,
424
- color: "rgba(0,0,0,0.3)"
425
- })
426
- }), /*#__PURE__*/_jsx(Circle, {
427
- cx: width * 0.18,
428
- cy: grassStartY - 90,
429
- r: 22,
430
- color: "#2E7D32",
431
- opacity: 0.9
432
- }), /*#__PURE__*/_jsx(Circle, {
433
- cx: width * 0.21,
434
- cy: grassStartY - 70,
435
- r: 18,
436
- color: "#388E3C",
437
- opacity: 0.8
438
- })]
439
- }), /*#__PURE__*/_jsxs(Group, {
440
- children: [/*#__PURE__*/_jsx(Circle, {
441
- cx: width * 0.72,
442
- cy: grassStartY - 35,
443
- r: 28,
444
- color: "#0D4F0C",
445
- opacity: 0.95,
446
- children: /*#__PURE__*/_jsx(Shadow, {
447
- dx: -2,
448
- dy: 3,
449
- blur: 8,
450
- color: "rgba(0,0,0,0.3)"
451
- })
452
- }), /*#__PURE__*/_jsx(Circle, {
453
- cx: width * 0.75,
454
- cy: grassStartY - 70,
455
- r: 24,
456
- color: "#1B5E20",
457
- opacity: 0.9
458
- }), /*#__PURE__*/_jsx(Circle, {
459
- cx: width * 0.69,
460
- cy: grassStartY - 25,
461
- r: 22,
462
- color: "#2E7D32",
463
- opacity: 0.85
464
- })]
465
- })]
466
- }), /*#__PURE__*/_jsx(Group, {
467
- children: flowerPositions.map((pos, i) => {
468
- const colors = ['#FF6B6B', '#FF69B4', '#9370DB', '#4169E1', '#FF8C00', '#32CD32'];
469
- const color = colors[i % colors.length];
470
- const size = 3 + i % 3;
471
- return /*#__PURE__*/_jsxs(Group, {
472
- children: [/*#__PURE__*/_jsx(Circle, {
473
- cx: pos.x,
474
- cy: pos.y,
475
- r: size,
476
- color: color,
477
- opacity: 0.8,
478
- children: /*#__PURE__*/_jsx(Shadow, {
479
- dx: 0,
480
- dy: 1,
481
- blur: 1,
482
- color: "rgba(0,0,0,0.2)"
483
- })
484
- }), /*#__PURE__*/_jsx(Circle, {
485
- cx: pos.x,
486
- cy: pos.y,
487
- r: size * 0.4,
488
- color: "#FFD700",
489
- opacity: 0.9
490
- })]
491
- }, `flower-${i}`);
492
- })
493
- })]
494
- }), children]
495
- });
496
- };
497
- GameBackground.displayName = 'GameBackground';
498
- //# sourceMappingURL=GameBackground.js.map
1
+ "use strict";import React from 'react';import{View,Dimensions}from 'react-native';import{Canvas,LinearGradient,Rect,Circle,Path,Skia,vec,Group,Shadow}from '@shopify/react-native-skia';import{jsx as _jsx,jsxs as _jsxs}from "react/jsx-runtime";const{width,height}= Dimensions.get('window');const buttonAreaHeight = 250;const grassStartY = height - buttonAreaHeight;const createStaticGrassPath =()=>{const path = Skia.Path.Make();const segmentWidth = width / 8;path.moveTo(0,grassStartY);for(let i = 0;i < 8;i++){const x = i * segmentWidth;const y = grassStartY + Math.sin(i * 0.5)* 8;const controlX = x + segmentWidth / 2;const controlY = y + Math.cos(i * 0.3)* 6;path.quadTo(controlX,controlY,x + segmentWidth,y);}path.lineTo(width,height);path.lineTo(0,height);path.close();return path;};const createStaticSunRays =()=>{return Array.from({length:16},(_,index)=>{const angle = 360 / 16 * index;const radian = angle * Math.PI / 180;const isLongRay = index % 2 === 0;const rayLength = isLongRay ? 25:15;const rayWidth = isLongRay ? 4:2;const startDistance = 45;const startX = width * 0.8 + Math.cos(radian)* startDistance;const startY = height * 0.15 + Math.sin(radian)* startDistance;const endX = width * 0.8 + Math.cos(radian)*(startDistance + rayLength);const endY = height * 0.15 + Math.sin(radian)*(startDistance + rayLength);const rayPath = Skia.Path.Make();rayPath.moveTo(startX,startY);rayPath.lineTo(endX,endY);return{path:rayPath,width:rayWidth};});};const createStaticFlowerPositions =()=>{return Array.from({length:12},(_,i)=>({x:width / 12 * i + i % 3 * 15 + 20,y:grassStartY - 10 - i % 4 * 8}));};const staticGrassPath = createStaticGrassPath();const staticSunRays = createStaticSunRays();const flowerPositions = createStaticFlowerPositions();export const GameBackground =({children,offset = 0})=>{const sunY = height * 0.15 + offset * 0.5;const cloud1Y = height * 0.24 + offset * 0.5;const cloud2Y = height * 0.27 + offset * 0.2;return _jsxs(View,{style:{flex:1},children:[_jsxs(Canvas,{style:{position:'absolute',top:0,left:0,right:0,bottom:0,width,height},children:[_jsx(Rect,{x:0,y:0,width:width,height:grassStartY,children:_jsx(LinearGradient,{start:vec(0,0),end:vec(0,grassStartY),colors:['#87CEEB','#98D8E8','#B0E0E6']})}),_jsx(Rect,{x:0,y:grassStartY,width:width,height:buttonAreaHeight,children:_jsx(LinearGradient,{start:vec(0,grassStartY),end:vec(0,height),colors:['#8B4513','#A0522D','#654321']})}),_jsxs(Group,{children:[_jsxs(Circle,{cx:width * 0.8,cy:sunY,r:40,children:[_jsx(LinearGradient,{start:vec(-40,-40),end:vec(40,40),colors:['#FFFF99','#FFD700','#FFA500','#FF8C00']}),_jsx(Shadow,{dx:0,dy:0,blur:32,color:"#FFD700"})]}),_jsx(Circle,{cx:width * 0.8 - 8,cy:sunY - 8,r:15,children:_jsx(LinearGradient,{start:vec(-15,-15),end:vec(15,15),colors:['#FFFFFF','#FFFF99']})}),staticSunRays.map((_,index)=>{const angle = 360 / 16 * index;const radian = angle * Math.PI / 180;const isLongRay = index % 2 === 0;const rayLength = isLongRay ? 25:15;const rayWidth = isLongRay ? 4:2;const startDistance = 45;const startX = width * 0.8 + Math.cos(radian)* startDistance;const startY = sunY + Math.sin(radian)* startDistance;const endX = width * 0.8 + Math.cos(radian)*(startDistance + rayLength);const endY = sunY + Math.sin(radian)*(startDistance + rayLength);const rayPath = Skia.Path.Make();rayPath.moveTo(startX,startY);rayPath.lineTo(endX,endY);return _jsx(Path,{path:rayPath,style:"stroke",strokeWidth:rayWidth,color:"#FFD700",opacity:0.75},index);}),_jsx(Circle,{cx:width * 0.8,cy:sunY,r:60,opacity:0.1,children:_jsx(LinearGradient,{start:vec(-60,-60),end:vec(60,60),colors:['#FFD700','transparent']})})]}),_jsxs(Group,{children:[_jsxs(Group,{children:[_jsx(Circle,{cx:width * 0.12,cy:cloud1Y,r:16,color:"#F0F8FF",opacity:0.35,children:_jsx(Shadow,{dx:1,dy:2,blur:12,color:"rgba(0,0,0,0.05)"})}),_jsx(Circle,{cx:width * 0.18,cy:cloud1Y -(height * 0.24 - height * 0.21),r:22,color:"#FFFFFF",opacity:0.45,children:_jsx(Shadow,{dx:1,dy:2,blur:12,color:"rgba(0,0,0,0.05)"})}),_jsx(Circle,{cx:width * 0.25,cy:cloud1Y -(height * 0.24 - height * 0.19),r:26,color:"#F8F8FF",opacity:0.55,children:_jsx(Shadow,{dx:2,dy:3,blur:12,color:"rgba(0,0,0,0.06)"})}),_jsx(Circle,{cx:width * 0.32,cy:cloud1Y -(height * 0.24 - height * 0.21),r:20,color:"#FFFFFF",opacity:0.50,children:_jsx(Shadow,{dx:1,dy:2,blur:12,color:"rgba(0,0,0,0.05)"})}),_jsx(Circle,{cx:width * 0.37,cy:cloud1Y,r:14,color:"#F0F8FF",opacity:0.40,children:_jsx(Shadow,{dx:1,dy:2,blur:12,color:"rgba(0,0,0,0.04)"})})]}),_jsxs(Group,{children:[_jsx(Circle,{cx:width * 0.62,cy:cloud2Y,r:15,color:"#F0F8FF",opacity:0.40,children:_jsx(Shadow,{dx:1,dy:2,blur:10,color:"rgba(0,0,0,0.04)"})}),_jsx(Circle,{cx:width * 0.69,cy:cloud2Y -(height * 0.27 - height * 0.24),r:19,color:"#FFFFFF",opacity:0.50,children:_jsx(Shadow,{dx:1,dy:2,blur:10,color:"rgba(0,0,0,0.05)"})}),_jsx(Circle,{cx:width * 0.76,cy:cloud2Y -(height * 0.27 - height * 0.26),r:13,color:"#F8F8FF",opacity:0.45,children:_jsx(Shadow,{dx:1,dy:2,blur:10,color:"rgba(0,0,0,0.04)"})})]})]}),_jsxs(Path,{path:staticGrassPath,children:[_jsx(LinearGradient,{start:vec(0,grassStartY - 20),end:vec(0,grassStartY + 20),colors:['#32CD32','#228B22','#006400']}),_jsx(Shadow,{dx:0,dy:-2,blur:4,color:"rgba(0,0,0,0.2)"})]}),Array.from({length:25},(_,i)=>{const x = width / 25 * i + i % 3 * 5;const grassHeight = 15 + i % 4 * 5;const grassType = i % 3;const bladePath = Skia.Path.Make();bladePath.moveTo(x,grassStartY);if(grassType === 0){bladePath.quadTo(x + 1,grassStartY - grassHeight * 0.6,x + 1,grassStartY - grassHeight);return _jsx(Path,{path:bladePath,style:"stroke",strokeWidth:1.5,color:"#16a34a",opacity:0.8},`grass-${i}`);}else if(grassType === 1){bladePath.quadTo(x + 2,grassStartY - grassHeight * 0.4,x + 3,grassStartY - grassHeight);return _jsx(Path,{path:bladePath,style:"stroke",strokeWidth:2,color:"#15803d",opacity:0.7},`grass-${i}`);}else{const midHeight = grassHeight * 0.5;bladePath.quadTo(x + 1,grassStartY - midHeight,x + 2,grassStartY - grassHeight);return _jsx(Path,{path:bladePath,style:"stroke",strokeWidth:2.5,color:"#166534",opacity:0.6},`grass-${i}`);}}),_jsxs(Group,{children:[_jsxs(Group,{children:[_jsxs(Rect,{x:width * 0.05,y:grassStartY - 150,width:20,height:150,children:[_jsx(LinearGradient,{start:vec(0,0),end:vec(20,0),colors:['#654321','#8B4513','#A0522D','#8B4513']}),_jsx(Shadow,{dx:3,dy:0,blur:6,color:"rgba(0,0,0,0.4)"})]}),_jsx(Circle,{cx:width * 0.05 + 10,cy:grassStartY - 150,r:38,color:"#1B5E20",opacity:0.9,children:_jsx(Shadow,{dx:4,dy:4,blur:10,color:"rgba(0,0,0,0.3)"})}),_jsx(Circle,{cx:width * 0.05 + 18,cy:grassStartY - 180,r:32,color:"#2E7D32",opacity:0.8}),_jsx(Circle,{cx:width * 0.05 + 25,cy:grassStartY - 140,r:28,color:"#388E3C",opacity:0.7}),_jsx(Circle,{cx:width * 0.05 + 2,cy:grassStartY - 120,r:30,color:"#2E7D32",opacity:0.75})]}),_jsxs(Group,{children:[_jsxs(Rect,{x:width * 0.88,y:grassStartY - 200,width:18,height:200,children:[_jsx(LinearGradient,{start:vec(0,0),end:vec(18,0),colors:['#4A2C2A','#654321','#8B4513','#654321']}),_jsx(Shadow,{dx:-3,dy:0,blur:6,color:"rgba(0,0,0,0.4)"})]}),_jsx(Circle,{cx:width * 0.88 + 9,cy:grassStartY - 120,r:35,color:"#0D4F0C",opacity:0.95,children:_jsx(Shadow,{dx:-4,dy:4,blur:10,color:"rgba(0,0,0,0.3)"})}),_jsx(Circle,{cx:width * 0.88 + 9,cy:grassStartY - 180,r:32,color:"#1B5E20",opacity:0.9}),_jsx(Circle,{cx:width * 0.88 + 9,cy:grassStartY - 240,r:28,color:"#2E7D32",opacity:0.9})]})]}),_jsxs(Group,{children:[_jsxs(Group,{children:[_jsx(Circle,{cx:width * 0.15,cy:grassStartY - 60,r:26,color:"#1B5E20",opacity:0.95,children:_jsx(Shadow,{dx:3,dy:3,blur:8,color:"rgba(0,0,0,0.3)"})}),_jsx(Circle,{cx:width * 0.18,cy:grassStartY - 90,r:22,color:"#2E7D32",opacity:0.9}),_jsx(Circle,{cx:width * 0.21,cy:grassStartY - 70,r:18,color:"#388E3C",opacity:0.8})]}),_jsxs(Group,{children:[_jsx(Circle,{cx:width * 0.72,cy:grassStartY - 35,r:28,color:"#0D4F0C",opacity:0.95,children:_jsx(Shadow,{dx:-2,dy:3,blur:8,color:"rgba(0,0,0,0.3)"})}),_jsx(Circle,{cx:width * 0.75,cy:grassStartY - 70,r:24,color:"#1B5E20",opacity:0.9}),_jsx(Circle,{cx:width * 0.69,cy:grassStartY - 25,r:22,color:"#2E7D32",opacity:0.85})]})]}),_jsx(Group,{children:flowerPositions.map((pos,i)=>{const colors = ['#FF6B6B','#FF69B4','#9370DB','#4169E1','#FF8C00','#32CD32'];const color = colors[i % colors.length];const size = 3 + i % 3;return _jsxs(Group,{children:[_jsx(Circle,{cx:pos.x,cy:pos.y,r:size,color:color,opacity:0.8,children:_jsx(Shadow,{dx:0,dy:1,blur:1,color:"rgba(0,0,0,0.2)"})}),_jsx(Circle,{cx:pos.x,cy:pos.y,r:size * 0.4,color:"#FFD700",opacity:0.9})]},`flower-${i}`);})})]}),children]});};GameBackground.displayName = 'GameBackground';
@@ -1,58 +1 @@
1
- "use strict";
2
-
3
- import React, { useMemo } from 'react';
4
- import { View, Text, StyleSheet } from 'react-native';
5
- import { useTime } from "../FruitMergerStore.js";
6
- import { FRUIT_MERGER_COLORS } from "../FruitMergerConstants.js";
7
- import { formatTime } from "../FruitMergerService.js";
8
- import { ScoreBoardContainer } from "../../../helpers/index.js";
9
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
- export const ScoreBoard = /*#__PURE__*/React.memo(({
11
- offset = 0
12
- }) => {
13
- const time = useTime();
14
- const formattedTime = useMemo(() => formatTime(time), [time]);
15
- return /*#__PURE__*/_jsx(ScoreBoardContainer, {
16
- offset: offset,
17
- backgroundColor: FRUIT_MERGER_COLORS.SCORE_BACKGROUND,
18
- borderColor: FRUIT_MERGER_COLORS.SCORE_BORDER,
19
- children: /*#__PURE__*/_jsx(View, {
20
- style: styles.scoreBoard,
21
- children: /*#__PURE__*/_jsxs(View, {
22
- style: styles.scoreItem,
23
- children: [/*#__PURE__*/_jsx(Text, {
24
- style: styles.scoreLabel,
25
- children: "TIME"
26
- }), /*#__PURE__*/_jsx(Text, {
27
- style: styles.scoreValue,
28
- children: formattedTime
29
- })]
30
- })
31
- })
32
- });
33
- });
34
- const styles = StyleSheet.create({
35
- scoreBoard: {
36
- flexDirection: 'row',
37
- justifyContent: 'space-around',
38
- alignItems: 'center'
39
- },
40
- scoreItem: {
41
- alignItems: 'center',
42
- flex: 1
43
- },
44
- scoreLabel: {
45
- fontSize: 12,
46
- fontWeight: '700',
47
- color: FRUIT_MERGER_COLORS.SCORE_TEXT,
48
- marginBottom: 4,
49
- letterSpacing: 1
50
- },
51
- scoreValue: {
52
- fontSize: 24,
53
- fontWeight: '900',
54
- color: FRUIT_MERGER_COLORS.SCORE_TEXT
55
- }
56
- });
57
- ScoreBoard.displayName = 'ScoreBoard';
58
- //# sourceMappingURL=ScoreBoard.js.map
1
+ "use strict";import React,{useMemo}from 'react';import{View,Text,StyleSheet}from 'react-native';import{useTime}from "../FruitMergerStore.js";import{FRUIT_MERGER_COLORS}from "../FruitMergerConstants.js";import{formatTime}from "../FruitMergerService.js";import{ScoreBoardContainer}from "../../../helpers/index.js";import{jsx as _jsx,jsxs as _jsxs}from "react/jsx-runtime";export const ScoreBoard = React.memo(({offset = 0})=>{const time = useTime();const formattedTime = useMemo(()=> formatTime(time),[time]);return _jsx(ScoreBoardContainer,{offset:offset,backgroundColor:FRUIT_MERGER_COLORS.SCORE_BACKGROUND,borderColor:FRUIT_MERGER_COLORS.SCORE_BORDER,children:_jsx(View,{style:styles.scoreBoard,children:_jsxs(View,{style:styles.scoreItem,children:[_jsx(Text,{style:styles.scoreLabel,children:"TIME"}),_jsx(Text,{style:styles.scoreValue,children:formattedTime})]})})});});const styles = StyleSheet.create({scoreBoard:{flexDirection:'row',justifyContent:'space-around',alignItems:'center'},scoreItem:{alignItems:'center',flex:1},scoreLabel:{fontSize:16,fontWeight:'700',color:FRUIT_MERGER_COLORS.SCORE_TEXT,marginBottom:4,letterSpacing:1},scoreValue:{fontSize:25,fontWeight:'900',color:FRUIT_MERGER_COLORS.SCORE_TEXT}});ScoreBoard.displayName = 'ScoreBoard';
@@ -1,7 +1 @@
1
- "use strict";
2
-
3
- export { ScoreBoard } from "./ScoreBoard.js";
4
- export { FruitItem } from "./FruitItem.js";
5
- export { GameArea } from "./GameArea.js";
6
- export { GameBackground } from "./GameBackground.js";
7
- //# sourceMappingURL=index.js.map
1
+ "use strict";export{ScoreBoard}from "./ScoreBoard.js";export{FruitItem}from "./FruitItem.js";export{GameArea}from "./GameArea.js";export{GameBackground}from "./GameBackground.js";