dopaminejs 1.0.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 +84 -0
- package/dist/dopamine.mjs +627 -0
- package/dist/dopamine.umd.js +45 -0
- package/dist/style.css +1 -0
- package/package.json +50 -0
- package/src/audio/SoundManager.js +89 -0
- package/src/core/DataService.js +51 -0
- package/src/core/RewardSystem.js +362 -0
- package/src/effects/ParticleSystem.js +259 -0
- package/src/index.js +25 -0
- package/src/ui/GameUI.js +258 -0
- package/src/ui/dopamine.css +374 -0
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dopamine UI Styles
|
|
3
|
+
*
|
|
4
|
+
* Styles for XP bars, achievements, level-ups, and other reward UI elements
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/* ==================== TOP BAR (XP, Level, Streak) ==================== */
|
|
8
|
+
|
|
9
|
+
#game-ui-overlay {
|
|
10
|
+
position: fixed;
|
|
11
|
+
top: 0;
|
|
12
|
+
left: 0;
|
|
13
|
+
width: 100%;
|
|
14
|
+
pointer-events: none;
|
|
15
|
+
z-index: 1000;
|
|
16
|
+
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.game-ui-top-bar {
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
gap: 12px;
|
|
23
|
+
padding: 12px 16px;
|
|
24
|
+
background: rgba(0, 0, 0, 0.3);
|
|
25
|
+
backdrop-filter: blur(10px);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* Level Badge */
|
|
29
|
+
.level-badge {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
align-items: center;
|
|
33
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
34
|
+
padding: 8px 12px;
|
|
35
|
+
border-radius: 12px;
|
|
36
|
+
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
|
|
37
|
+
min-width: 60px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.level-label {
|
|
41
|
+
font-size: 10px;
|
|
42
|
+
font-weight: 600;
|
|
43
|
+
color: rgba(255, 255, 255, 0.8);
|
|
44
|
+
letter-spacing: 0.5px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.level-number {
|
|
48
|
+
font-size: 24px;
|
|
49
|
+
font-weight: 800;
|
|
50
|
+
color: white;
|
|
51
|
+
line-height: 1;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* XP Bar */
|
|
55
|
+
.xp-container {
|
|
56
|
+
flex: 1;
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
gap: 4px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.xp-bar-bg {
|
|
63
|
+
height: 12px;
|
|
64
|
+
background: rgba(255, 255, 255, 0.2);
|
|
65
|
+
border-radius: 6px;
|
|
66
|
+
overflow: hidden;
|
|
67
|
+
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.xp-bar-fill {
|
|
71
|
+
height: 100%;
|
|
72
|
+
background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
|
|
73
|
+
border-radius: 6px;
|
|
74
|
+
transition: width 0.5s ease-out;
|
|
75
|
+
box-shadow: 0 0 10px rgba(79, 172, 254, 0.6);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.xp-text {
|
|
79
|
+
font-size: 11px;
|
|
80
|
+
color: white;
|
|
81
|
+
font-weight: 600;
|
|
82
|
+
text-align: center;
|
|
83
|
+
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* Streak Badge */
|
|
87
|
+
.streak-badge {
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
gap: 6px;
|
|
91
|
+
background: linear-gradient(135deg, #ff8800 0%, #ff4400 100%);
|
|
92
|
+
padding: 8px 12px;
|
|
93
|
+
border-radius: 12px;
|
|
94
|
+
box-shadow: 0 4px 12px rgba(255, 136, 0, 0.4);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.streak-icon {
|
|
98
|
+
font-size: 20px;
|
|
99
|
+
animation: flicker 2s infinite;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.streak-number {
|
|
103
|
+
font-size: 18px;
|
|
104
|
+
font-weight: 800;
|
|
105
|
+
color: white;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* ==================== ACHIEVEMENT POPUP ==================== */
|
|
109
|
+
|
|
110
|
+
.achievement-popup {
|
|
111
|
+
position: fixed;
|
|
112
|
+
top: 80px;
|
|
113
|
+
right: 20px;
|
|
114
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
115
|
+
border-radius: 16px;
|
|
116
|
+
padding: 16px;
|
|
117
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
|
|
118
|
+
animation: slideIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
|
|
119
|
+
z-index: 10000;
|
|
120
|
+
max-width: 320px;
|
|
121
|
+
overflow: hidden;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.achievement-shine {
|
|
125
|
+
position: absolute;
|
|
126
|
+
top: 0;
|
|
127
|
+
left: -100%;
|
|
128
|
+
width: 100%;
|
|
129
|
+
height: 100%;
|
|
130
|
+
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
|
|
131
|
+
animation: shine 2s infinite;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.achievement-content {
|
|
135
|
+
position: relative;
|
|
136
|
+
display: flex;
|
|
137
|
+
gap: 12px;
|
|
138
|
+
align-items: center;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.achievement-icon {
|
|
142
|
+
font-size: 48px;
|
|
143
|
+
animation: bounce 0.6s ease-out;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.achievement-info {
|
|
147
|
+
flex: 1;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.achievement-title {
|
|
151
|
+
font-size: 12px;
|
|
152
|
+
font-weight: 600;
|
|
153
|
+
color: rgba(255, 255, 255, 0.9);
|
|
154
|
+
text-transform: uppercase;
|
|
155
|
+
letter-spacing: 0.5px;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.achievement-name {
|
|
159
|
+
font-size: 18px;
|
|
160
|
+
font-weight: 800;
|
|
161
|
+
color: white;
|
|
162
|
+
margin: 2px 0;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.achievement-desc {
|
|
166
|
+
font-size: 13px;
|
|
167
|
+
color: rgba(255, 255, 255, 0.8);
|
|
168
|
+
margin-bottom: 4px;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.achievement-xp {
|
|
172
|
+
display: inline-block;
|
|
173
|
+
background: rgba(255, 255, 255, 0.2);
|
|
174
|
+
padding: 4px 8px;
|
|
175
|
+
border-radius: 8px;
|
|
176
|
+
font-size: 12px;
|
|
177
|
+
font-weight: 700;
|
|
178
|
+
color: #ffd700;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/* ==================== LEVEL UP OVERLAY ==================== */
|
|
182
|
+
|
|
183
|
+
.level-up-overlay {
|
|
184
|
+
position: fixed;
|
|
185
|
+
top: 0;
|
|
186
|
+
left: 0;
|
|
187
|
+
width: 100%;
|
|
188
|
+
height: 100%;
|
|
189
|
+
background: rgba(0, 0, 0, 0.85);
|
|
190
|
+
display: flex;
|
|
191
|
+
align-items: center;
|
|
192
|
+
justify-content: center;
|
|
193
|
+
z-index: 10001;
|
|
194
|
+
animation: fadeIn 0.3s ease-out;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.level-up-content {
|
|
198
|
+
text-align: center;
|
|
199
|
+
animation: scaleIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.level-up-title {
|
|
203
|
+
font-size: 32px;
|
|
204
|
+
font-weight: 800;
|
|
205
|
+
background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
|
|
206
|
+
-webkit-background-clip: text;
|
|
207
|
+
-webkit-text-fill-color: transparent;
|
|
208
|
+
background-clip: text;
|
|
209
|
+
text-transform: uppercase;
|
|
210
|
+
letter-spacing: 4px;
|
|
211
|
+
margin-bottom: 16px;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.level-up-number {
|
|
215
|
+
font-size: 120px;
|
|
216
|
+
font-weight: 900;
|
|
217
|
+
color: white;
|
|
218
|
+
text-shadow:
|
|
219
|
+
0 0 20px rgba(255, 215, 0, 0.8),
|
|
220
|
+
0 0 40px rgba(255, 215, 0, 0.6),
|
|
221
|
+
0 0 60px rgba(255, 215, 0, 0.4);
|
|
222
|
+
animation: glow 1s ease-in-out infinite alternate;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.level-up-subtitle {
|
|
226
|
+
font-size: 24px;
|
|
227
|
+
color: rgba(255, 255, 255, 0.8);
|
|
228
|
+
font-weight: 600;
|
|
229
|
+
margin-top: 16px;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/* ==================== FLOATING TEXT ==================== */
|
|
233
|
+
|
|
234
|
+
.floating-text {
|
|
235
|
+
position: fixed;
|
|
236
|
+
font-weight: 800;
|
|
237
|
+
text-shadow:
|
|
238
|
+
2px 2px 0 #000,
|
|
239
|
+
-1px -1px 0 #000,
|
|
240
|
+
1px -1px 0 #000,
|
|
241
|
+
-1px 1px 0 #000;
|
|
242
|
+
pointer-events: none;
|
|
243
|
+
z-index: 9998;
|
|
244
|
+
animation: floatUp 2s ease-out forwards;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/* ==================== ANIMATIONS ==================== */
|
|
248
|
+
|
|
249
|
+
@keyframes slideIn {
|
|
250
|
+
from {
|
|
251
|
+
transform: translateX(400px);
|
|
252
|
+
opacity: 0;
|
|
253
|
+
}
|
|
254
|
+
to {
|
|
255
|
+
transform: translateX(0);
|
|
256
|
+
opacity: 1;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
@keyframes slideOut {
|
|
261
|
+
from {
|
|
262
|
+
transform: translateX(0);
|
|
263
|
+
opacity: 1;
|
|
264
|
+
}
|
|
265
|
+
to {
|
|
266
|
+
transform: translateX(400px);
|
|
267
|
+
opacity: 0;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
@keyframes fadeIn {
|
|
272
|
+
from { opacity: 0; }
|
|
273
|
+
to { opacity: 1; }
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
@keyframes scaleIn {
|
|
277
|
+
from {
|
|
278
|
+
transform: scale(0.5);
|
|
279
|
+
opacity: 0;
|
|
280
|
+
}
|
|
281
|
+
to {
|
|
282
|
+
transform: scale(1);
|
|
283
|
+
opacity: 1;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
@keyframes bounce {
|
|
288
|
+
0%, 100% { transform: translateY(0); }
|
|
289
|
+
50% { transform: translateY(-10px); }
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
@keyframes glow {
|
|
293
|
+
from {
|
|
294
|
+
text-shadow:
|
|
295
|
+
0 0 20px rgba(255, 215, 0, 0.8),
|
|
296
|
+
0 0 40px rgba(255, 215, 0, 0.6),
|
|
297
|
+
0 0 60px rgba(255, 215, 0, 0.4);
|
|
298
|
+
}
|
|
299
|
+
to {
|
|
300
|
+
text-shadow:
|
|
301
|
+
0 0 30px rgba(255, 215, 0, 1),
|
|
302
|
+
0 0 60px rgba(255, 215, 0, 0.8),
|
|
303
|
+
0 0 90px rgba(255, 215, 0, 0.6);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
@keyframes shine {
|
|
308
|
+
0% { left: -100%; }
|
|
309
|
+
30% { left: 100%; }
|
|
310
|
+
100% { left: 100%; }
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
@keyframes flicker {
|
|
314
|
+
0%, 100% { opacity: 1; }
|
|
315
|
+
50% { opacity: 0.8; }
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
@keyframes floatUp {
|
|
319
|
+
from {
|
|
320
|
+
transform: translateY(0);
|
|
321
|
+
opacity: 1;
|
|
322
|
+
}
|
|
323
|
+
to {
|
|
324
|
+
transform: translateY(-100px);
|
|
325
|
+
opacity: 0;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
@keyframes xp-pulse {
|
|
330
|
+
0% { transform: scaleY(1); }
|
|
331
|
+
50% { transform: scaleY(1.2); }
|
|
332
|
+
100% { transform: scaleY(1); }
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
@keyframes level-pulse {
|
|
336
|
+
0% { transform: scale(1); }
|
|
337
|
+
50% { transform: scale(1.1); }
|
|
338
|
+
100% { transform: scale(1); }
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/* ==================== RESPONSIVE ==================== */
|
|
342
|
+
|
|
343
|
+
@media (max-width: 480px) {
|
|
344
|
+
.game-ui-top-bar {
|
|
345
|
+
gap: 8px;
|
|
346
|
+
padding: 10px 12px;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.level-badge {
|
|
350
|
+
padding: 6px 10px;
|
|
351
|
+
min-width: 50px;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.level-number {
|
|
355
|
+
font-size: 20px;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.xp-bar-bg {
|
|
359
|
+
height: 10px;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.xp-text {
|
|
363
|
+
font-size: 10px;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.achievement-popup {
|
|
367
|
+
right: 12px;
|
|
368
|
+
max-width: calc(100% - 24px);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.level-up-number {
|
|
372
|
+
font-size: 80px;
|
|
373
|
+
}
|
|
374
|
+
}
|