@rpgjs/client 5.0.0-alpha.2 → 5.0.0-alpha.20
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/dist/Game/AnimationManager.d.ts +8 -0
- package/dist/Game/Map.d.ts +7 -1
- package/dist/Gui/Gui.d.ts +128 -5
- package/dist/RpgClient.d.ts +217 -59
- package/dist/RpgClientEngine.d.ts +345 -6
- package/dist/Sound.d.ts +199 -0
- package/dist/components/animations/index.d.ts +4 -0
- package/dist/components/dynamics/parse-value.d.ts +1 -0
- package/dist/components/gui/index.d.ts +3 -3
- package/dist/components/index.d.ts +3 -1
- package/dist/components/prebuilt/index.d.ts +18 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/dist/index10.js +149 -4
- package/dist/index10.js.map +1 -1
- package/dist/index11.js +21 -7
- package/dist/index11.js.map +1 -1
- package/dist/index12.js +6 -4
- package/dist/index12.js.map +1 -1
- package/dist/index13.js +11 -14
- package/dist/index13.js.map +1 -1
- package/dist/index14.js +8 -40
- package/dist/index14.js.map +1 -1
- package/dist/index15.js +187 -180
- package/dist/index15.js.map +1 -1
- package/dist/index16.js +104 -7
- package/dist/index16.js.map +1 -1
- package/dist/index17.js +82 -372
- package/dist/index17.js.map +1 -1
- package/dist/index18.js +361 -26
- package/dist/index18.js.map +1 -1
- package/dist/index19.js +46 -20
- package/dist/index19.js.map +1 -1
- package/dist/index2.js +683 -32
- package/dist/index2.js.map +1 -1
- package/dist/index20.js +5 -2417
- package/dist/index20.js.map +1 -1
- package/dist/index21.js +383 -97
- package/dist/index21.js.map +1 -1
- package/dist/index22.js +41 -104
- package/dist/index22.js.map +1 -1
- package/dist/index23.js +21 -67
- package/dist/index23.js.map +1 -1
- package/dist/index24.js +2632 -20
- package/dist/index24.js.map +1 -1
- package/dist/index25.js +107 -34
- package/dist/index25.js.map +1 -1
- package/dist/index26.js +69 -3
- package/dist/index26.js.map +1 -1
- package/dist/index27.js +17 -318
- package/dist/index27.js.map +1 -1
- package/dist/index28.js +24 -22
- package/dist/index28.js.map +1 -1
- package/dist/index29.js +92 -8
- package/dist/index29.js.map +1 -1
- package/dist/index3.js +68 -8
- package/dist/index3.js.map +1 -1
- package/dist/index30.js +37 -7
- package/dist/index30.js.map +1 -1
- package/dist/index31.js +18 -168
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +3 -499
- package/dist/index32.js.map +1 -1
- package/dist/index33.js +332 -9
- package/dist/index33.js.map +1 -1
- package/dist/index34.js +24 -4400
- package/dist/index34.js.map +1 -1
- package/dist/index35.js +6 -311
- package/dist/index35.js.map +1 -1
- package/dist/index36.js +8 -88
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +182 -56
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +500 -16
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +10 -18
- package/dist/index39.js.map +1 -1
- package/dist/index4.js +23 -5
- package/dist/index4.js.map +1 -1
- package/dist/index40.js +7 -0
- package/dist/index40.js.map +1 -0
- package/dist/index41.js +3690 -0
- package/dist/index41.js.map +1 -0
- package/dist/index42.js +77 -0
- package/dist/index42.js.map +1 -0
- package/dist/index43.js +6 -0
- package/dist/index43.js.map +1 -0
- package/dist/index44.js +20 -0
- package/dist/index44.js.map +1 -0
- package/dist/index45.js +146 -0
- package/dist/index45.js.map +1 -0
- package/dist/index46.js +12 -0
- package/dist/index46.js.map +1 -0
- package/dist/index47.js +113 -0
- package/dist/index47.js.map +1 -0
- package/dist/index48.js +136 -0
- package/dist/index48.js.map +1 -0
- package/dist/index49.js +137 -0
- package/dist/index49.js.map +1 -0
- package/dist/index5.js +2 -1
- package/dist/index5.js.map +1 -1
- package/dist/index50.js +112 -0
- package/dist/index50.js.map +1 -0
- package/dist/index51.js +141 -0
- package/dist/index51.js.map +1 -0
- package/dist/index52.js +9 -0
- package/dist/index52.js.map +1 -0
- package/dist/index53.js +54 -0
- package/dist/index53.js.map +1 -0
- package/dist/index6.js +1 -1
- package/dist/index6.js.map +1 -1
- package/dist/index7.js +11 -3
- package/dist/index7.js.map +1 -1
- package/dist/index8.js +68 -7
- package/dist/index8.js.map +1 -1
- package/dist/index9.js +230 -15
- package/dist/index9.js.map +1 -1
- package/dist/presets/animation.d.ts +31 -0
- package/dist/presets/faceset.d.ts +30 -0
- package/dist/presets/index.d.ts +103 -0
- package/dist/presets/lpc.d.ts +89 -0
- package/dist/services/loadMap.d.ts +123 -2
- package/dist/services/mmorpg.d.ts +9 -4
- package/dist/services/standalone.d.ts +51 -2
- package/package.json +22 -18
- package/src/Game/{EffectManager.ts → AnimationManager.ts} +3 -2
- package/src/Game/Map.ts +20 -2
- package/src/Game/Object.ts +163 -9
- package/src/Gui/Gui.ts +300 -17
- package/src/RpgClient.ts +222 -58
- package/src/RpgClientEngine.ts +804 -36
- package/src/Sound.ts +253 -0
- package/src/components/{effects → animations}/animation.ce +3 -6
- package/src/components/{effects → animations}/index.ts +1 -1
- package/src/components/character.ce +165 -37
- package/src/components/dynamics/parse-value.ts +80 -0
- package/src/components/dynamics/text.ce +183 -0
- package/src/components/gui/box.ce +17 -0
- package/src/components/gui/dialogbox/index.ce +73 -35
- package/src/components/gui/dialogbox/selection.ce +16 -1
- package/src/components/gui/index.ts +3 -4
- package/src/components/index.ts +5 -1
- package/src/components/prebuilt/hp-bar.ce +255 -0
- package/src/components/prebuilt/index.ts +21 -0
- package/src/components/scenes/draw-map.ce +6 -23
- package/src/components/scenes/event-layer.ce +9 -3
- package/src/core/setup.ts +2 -0
- package/src/index.ts +5 -2
- package/src/module.ts +72 -6
- package/src/presets/animation.ts +46 -0
- package/src/presets/faceset.ts +60 -0
- package/src/presets/index.ts +7 -1
- package/src/presets/lpc.ts +108 -0
- package/src/services/loadMap.ts +132 -3
- package/src/services/mmorpg.ts +27 -5
- package/src/services/standalone.ts +68 -6
- package/tsconfig.json +1 -1
- package/vite.config.ts +1 -1
- package/dist/Game/EffectManager.d.ts +0 -5
- package/dist/components/effects/index.d.ts +0 -4
- package/src/components/scenes/element-map.ce +0 -23
- /package/src/components/{effects → animations}/hit.ce +0 -0
package/dist/index17.js
CHANGED
|
@@ -1,387 +1,97 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isSignal, isComputed, isObjectSubject, isArraySubject } from './index27.js';
|
|
1
|
+
import { Howler } from 'canvasengine';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
return Object.getPrototypeOf(value) !== Object.prototype;
|
|
19
|
-
}
|
|
20
|
-
__name(isInstanceOfClass, "isInstanceOfClass");
|
|
21
|
-
function generateShortUUID() {
|
|
22
|
-
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
23
|
-
let uuid = "";
|
|
24
|
-
for (let i = 0; i < 8; i++) {
|
|
25
|
-
const randomIndex = Math.floor(Math.random() * chars.length);
|
|
26
|
-
uuid += chars[randomIndex];
|
|
27
|
-
}
|
|
28
|
-
return uuid;
|
|
29
|
-
}
|
|
30
|
-
__name(generateShortUUID, "generateShortUUID");
|
|
31
|
-
|
|
32
|
-
// src/core.ts
|
|
33
|
-
var DELETE_TOKEN = "$delete";
|
|
34
|
-
var syncClass = /* @__PURE__ */ __name((instance, options = {}) => {
|
|
35
|
-
const cacheSync = /* @__PURE__ */ new Map();
|
|
36
|
-
const cachePersist = /* @__PURE__ */ new Map();
|
|
37
|
-
instance.$valuesChanges = {
|
|
38
|
-
set: /* @__PURE__ */ __name((path, value) => {
|
|
39
|
-
cacheSync.set(path, value);
|
|
40
|
-
options.onSync?.(cacheSync);
|
|
41
|
-
}, "set"),
|
|
42
|
-
setPersist: /* @__PURE__ */ __name((path, value) => {
|
|
43
|
-
if (path == "") path = ".";
|
|
44
|
-
cachePersist.set(path, value);
|
|
45
|
-
options.onPersist?.(cachePersist);
|
|
46
|
-
}, "setPersist"),
|
|
47
|
-
has: /* @__PURE__ */ __name((path) => {
|
|
48
|
-
return cacheSync.has(path);
|
|
49
|
-
}, "has"),
|
|
50
|
-
get: /* @__PURE__ */ __name((path) => {
|
|
51
|
-
return cacheSync.get(path);
|
|
52
|
-
}, "get")
|
|
3
|
+
const SOUND_METADATA_KEY = Symbol("rpgjs:sound");
|
|
4
|
+
function Sound(options) {
|
|
5
|
+
return function(constructor) {
|
|
6
|
+
const metadata = {
|
|
7
|
+
id: options.id,
|
|
8
|
+
sound: options.sound,
|
|
9
|
+
sounds: options.sounds,
|
|
10
|
+
loop: options.loop,
|
|
11
|
+
volume: options.volume
|
|
12
|
+
};
|
|
13
|
+
constructor[SOUND_METADATA_KEY] = metadata;
|
|
14
|
+
return constructor;
|
|
53
15
|
};
|
|
54
|
-
createSyncClass(instance);
|
|
55
|
-
}, "syncClass");
|
|
56
|
-
function createStatesSnapshot(instance) {
|
|
57
|
-
let persistObject = {};
|
|
58
|
-
if (instance?.$snapshot) {
|
|
59
|
-
for (const key of instance.$snapshot.keys()) {
|
|
60
|
-
const signal = instance.$snapshot.get(key);
|
|
61
|
-
const persist2 = signal.options.persist ?? true;
|
|
62
|
-
let value = signal();
|
|
63
|
-
if (isObject(value) || Array.isArray(value)) {
|
|
64
|
-
continue;
|
|
65
|
-
}
|
|
66
|
-
if (persist2) {
|
|
67
|
-
persistObject[key] = value;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return persistObject;
|
|
72
16
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const meta = target.constructor._propertyMetadata;
|
|
76
|
-
const propId = meta?.get(key);
|
|
77
|
-
if (propId) {
|
|
78
|
-
if (isSignal(target[propId])) {
|
|
79
|
-
target[propId].set(value);
|
|
80
|
-
} else {
|
|
81
|
-
target[propId] = value;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
17
|
+
function getSoundMetadata(soundClass) {
|
|
18
|
+
return soundClass[SOUND_METADATA_KEY];
|
|
84
19
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
if (parentClass) {
|
|
89
|
-
currentClass.$valuesChanges = parentClass.$valuesChanges;
|
|
90
|
-
}
|
|
91
|
-
if (parentKey) {
|
|
92
|
-
setMetadata(currentClass, "id", parentKey);
|
|
20
|
+
class RpgSound {
|
|
21
|
+
static {
|
|
22
|
+
this.engine = null;
|
|
93
23
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
const newPath = (path ? path + "." : "") + key;
|
|
106
|
-
if (syncToClient) {
|
|
107
|
-
currentClass.$valuesChanges.set(newPath, signalValue);
|
|
108
|
-
}
|
|
109
|
-
if (persist2) {
|
|
110
|
-
if (parentClass) currentClass.$valuesChanges.setPersist(path, signalValue);
|
|
111
|
-
}
|
|
112
|
-
if (isComputed(signal)) {
|
|
113
|
-
signal.observable.subscribe((newValue) => {
|
|
114
|
-
if (syncToClient) {
|
|
115
|
-
currentClass.$valuesChanges.set(newPath, newValue);
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}, "createSyncClass");
|
|
122
|
-
var type = /* @__PURE__ */ __name((_signal, path, options = {}, currentInstance) => {
|
|
123
|
-
const { syncToClient = true, persist: persist2 = true } = options;
|
|
124
|
-
let init = true;
|
|
125
|
-
const handleObjectSubject = /* @__PURE__ */ __name((value, propPath) => {
|
|
126
|
-
const newPath = `${propPath}${value.key ? `.${value.key}` : ""}`;
|
|
127
|
-
if ([
|
|
128
|
-
"add",
|
|
129
|
-
"reset",
|
|
130
|
-
"update"
|
|
131
|
-
].includes(value.type)) {
|
|
132
|
-
if (isInstanceOfClass(value.value)) {
|
|
133
|
-
createSyncClass(value.value, value.key, currentInstance, newPath);
|
|
134
|
-
} else if (value.type === "update" && (isObject(value.value) || Array.isArray(value.value))) {
|
|
135
|
-
createSyncClass(value.value, value.key, currentInstance, newPath);
|
|
136
|
-
} else {
|
|
137
|
-
savePath(newPath, value.value);
|
|
138
|
-
}
|
|
139
|
-
} else if (value.type === "remove") {
|
|
140
|
-
savePath(newPath, DELETE_TOKEN);
|
|
141
|
-
}
|
|
142
|
-
}, "handleObjectSubject");
|
|
143
|
-
const handleArraySubject = /* @__PURE__ */ __name((value, propPath) => {
|
|
144
|
-
if (value.type === "reset" && Array.isArray(value.items)) {
|
|
145
|
-
value.items.forEach((item, index) => {
|
|
146
|
-
const newPath2 = `${propPath}.${index}`;
|
|
147
|
-
if (isInstanceOfClass(item)) {
|
|
148
|
-
createSyncClass(item, value.key, currentInstance, newPath2);
|
|
149
|
-
} else {
|
|
150
|
-
savePath(newPath2, item);
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
const newPath = `${propPath}.${value.index}`;
|
|
156
|
-
const firstItem = value.items?.[0];
|
|
157
|
-
if ([
|
|
158
|
-
"add",
|
|
159
|
-
"update"
|
|
160
|
-
].includes(value.type) && firstItem !== void 0) {
|
|
161
|
-
if (isInstanceOfClass(firstItem)) {
|
|
162
|
-
createSyncClass(firstItem, value.key, currentInstance, newPath);
|
|
163
|
-
} else if (value.type === "update" && (isObject(firstItem) || Array.isArray(firstItem))) {
|
|
164
|
-
createSyncClass(firstItem, value.key, currentInstance, newPath);
|
|
165
|
-
} else {
|
|
166
|
-
savePath(newPath, firstItem);
|
|
167
|
-
}
|
|
168
|
-
} else if (value.type === "remove") {
|
|
169
|
-
savePath(newPath, DELETE_TOKEN);
|
|
170
|
-
}
|
|
171
|
-
}, "handleArraySubject");
|
|
172
|
-
const savePath = /* @__PURE__ */ __name((propPath, value) => {
|
|
173
|
-
if (syncToClient) {
|
|
174
|
-
currentInstance.$valuesChanges.set(propPath, value);
|
|
175
|
-
}
|
|
176
|
-
if (persist2 && currentInstance.$path !== void 0) {
|
|
177
|
-
currentInstance.$valuesChanges.setPersist(value == DELETE_TOKEN ? propPath : currentInstance.$path, value);
|
|
178
|
-
}
|
|
179
|
-
}, "savePath");
|
|
180
|
-
const setupSubscription = /* @__PURE__ */ __name((signal, signalPath) => {
|
|
181
|
-
if (!isSignal(signal)) return;
|
|
182
|
-
if (syncToClient && currentInstance.$valuesChanges) {
|
|
183
|
-
const initialValue = signal();
|
|
184
|
-
currentInstance.$valuesChanges.set(signalPath, initialValue);
|
|
185
|
-
}
|
|
186
|
-
signal.options = options;
|
|
187
|
-
signal.observable.subscribe((value) => {
|
|
188
|
-
if (init) return;
|
|
189
|
-
if (currentInstance.$path !== void 0) {
|
|
190
|
-
const fullPath = `${currentInstance.$path ? currentInstance.$path + "." : ""}${signalPath}`;
|
|
191
|
-
if (isComputed(signal)) {
|
|
192
|
-
savePath(fullPath, value);
|
|
193
|
-
} else if (isObjectSubject(signal._subject)) {
|
|
194
|
-
handleObjectSubject(value, fullPath);
|
|
195
|
-
} else if (isArraySubject(signal._subject)) {
|
|
196
|
-
handleArraySubject(value, fullPath);
|
|
197
|
-
} else {
|
|
198
|
-
savePath(fullPath, value);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
if (!currentInstance.$snapshot) {
|
|
203
|
-
currentInstance.$snapshot = /* @__PURE__ */ new Map();
|
|
204
|
-
}
|
|
205
|
-
currentInstance.$snapshot.set(path, signal);
|
|
206
|
-
}, "setupSubscription");
|
|
207
|
-
if (!isSignal(_signal)) {
|
|
208
|
-
if (_signal && typeof _signal === "object" && !Array.isArray(_signal)) {
|
|
209
|
-
for (const key in _signal) {
|
|
210
|
-
if (Object.prototype.hasOwnProperty.call(_signal, key)) {
|
|
211
|
-
const value = _signal[key];
|
|
212
|
-
const propertyPath = `${path}.${key}`;
|
|
213
|
-
if (isSignal(value)) {
|
|
214
|
-
setupSubscription(value, propertyPath);
|
|
215
|
-
} else if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
216
|
-
type(value, propertyPath, options, currentInstance);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
init = false;
|
|
221
|
-
}
|
|
222
|
-
return _signal;
|
|
223
|
-
}
|
|
224
|
-
setupSubscription(_signal, path);
|
|
225
|
-
init = false;
|
|
226
|
-
return _signal;
|
|
227
|
-
}, "type");
|
|
228
|
-
|
|
229
|
-
// src/decorators.ts
|
|
230
|
-
function sync(options) {
|
|
231
|
-
let classType;
|
|
232
|
-
let persist2 = true;
|
|
233
|
-
let syncToClient = true;
|
|
234
|
-
if (typeof options === "function") {
|
|
235
|
-
classType = options;
|
|
236
|
-
} else if (typeof options === "object") {
|
|
237
|
-
classType = options.classType;
|
|
238
|
-
if (options.hasOwnProperty("persist")) {
|
|
239
|
-
persist2 = options.persist;
|
|
240
|
-
}
|
|
241
|
-
if (options.hasOwnProperty("syncToClient")) {
|
|
242
|
-
syncToClient = options.syncToClient;
|
|
243
|
-
}
|
|
24
|
+
/**
|
|
25
|
+
* Initialize RpgSound with the engine instance
|
|
26
|
+
*
|
|
27
|
+
* This is called automatically by the engine during initialization.
|
|
28
|
+
*
|
|
29
|
+
* @param engine - The RpgClientEngine instance
|
|
30
|
+
*/
|
|
31
|
+
static init(engine) {
|
|
32
|
+
RpgSound.engine = engine;
|
|
244
33
|
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
}
|
|
271
|
-
target.constructor._propertyMetadata.set("id", propertyKey);
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
__name(id, "id");
|
|
275
|
-
function users(options) {
|
|
276
|
-
return function(target, propertyKey) {
|
|
277
|
-
if (!target.constructor._propertyMetadata) {
|
|
278
|
-
target.constructor._propertyMetadata = /* @__PURE__ */ new Map();
|
|
34
|
+
/**
|
|
35
|
+
* Get a sound by its ID
|
|
36
|
+
*
|
|
37
|
+
* Retrieves a Howler sound instance from the engine's sound cache.
|
|
38
|
+
* The sound must be registered beforehand (via @Sound decorator or manually).
|
|
39
|
+
*
|
|
40
|
+
* @param id - The sound identifier
|
|
41
|
+
* @returns The Howler sound instance, or undefined if not found
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* // Get and play a sound
|
|
46
|
+
* const sound = RpgSound.get('town-music');
|
|
47
|
+
* if (sound) {
|
|
48
|
+
* sound.play();
|
|
49
|
+
* }
|
|
50
|
+
*
|
|
51
|
+
* // Chain methods
|
|
52
|
+
* RpgSound.get('battle-theme')?.volume(0.8).play();
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
static get(id) {
|
|
56
|
+
if (!RpgSound.engine) {
|
|
57
|
+
console.warn("RpgSound not initialized. Make sure the engine has started.");
|
|
58
|
+
return void 0;
|
|
279
59
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
__name(users, "users");
|
|
285
|
-
function persist() {
|
|
286
|
-
return sync({
|
|
287
|
-
persist: true,
|
|
288
|
-
syncToClient: false
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
__name(persist, "persist");
|
|
292
|
-
function connected() {
|
|
293
|
-
return function(target, propertyKey) {
|
|
294
|
-
if (!target.constructor._propertyMetadata) {
|
|
295
|
-
target.constructor._propertyMetadata = /* @__PURE__ */ new Map();
|
|
60
|
+
const sound = RpgSound.engine.sounds.get(id);
|
|
61
|
+
if (!sound) {
|
|
62
|
+
console.warn(`Sound with id "${id}" not found`);
|
|
63
|
+
return void 0;
|
|
296
64
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
persist: false
|
|
300
|
-
})(target, propertyKey);
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
__name(connected, "connected");
|
|
304
|
-
function load(rootInstance, values, valueIsObject) {
|
|
305
|
-
if (valueIsObject) {
|
|
306
|
-
loadFromObject(rootInstance, values);
|
|
307
|
-
} else {
|
|
308
|
-
loadFromPaths(rootInstance, values);
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
__name(load, "load");
|
|
312
|
-
function loadFromPaths(rootInstance, values) {
|
|
313
|
-
for (const [path, value] of Object.entries(values)) {
|
|
314
|
-
const parts = path.split(".");
|
|
315
|
-
loadValue(rootInstance, parts, value);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
__name(loadFromPaths, "loadFromPaths");
|
|
319
|
-
function loadFromObject(rootInstance, values, currentPath = "") {
|
|
320
|
-
for (let key in values) {
|
|
321
|
-
const value = values[key];
|
|
322
|
-
const newPath = currentPath ? `${currentPath}.${key}` : key;
|
|
323
|
-
if (typeof value === "object" && !Array.isArray(value) && value !== null) {
|
|
324
|
-
loadFromObject(rootInstance, value, newPath);
|
|
325
|
-
} else {
|
|
326
|
-
const parts = newPath.split(".");
|
|
327
|
-
loadValue(rootInstance, parts, value);
|
|
65
|
+
if (sound && typeof sound.play === "function") {
|
|
66
|
+
return sound;
|
|
328
67
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
__name(loadFromObject, "loadFromObject");
|
|
332
|
-
function loadValue(rootInstance, parts, value) {
|
|
333
|
-
let current = rootInstance;
|
|
334
|
-
for (let i = 0; i < parts.length; i++) {
|
|
335
|
-
const part = parts[i];
|
|
336
|
-
if (i === parts.length - 1) {
|
|
337
|
-
if (value == DELETE_TOKEN) {
|
|
338
|
-
if (isSignal(current)) {
|
|
339
|
-
current = current();
|
|
340
|
-
}
|
|
341
|
-
Reflect.deleteProperty(current, part);
|
|
342
|
-
} else if (current[part]?._subject) {
|
|
343
|
-
current[part].set(value);
|
|
344
|
-
} else if (isSignal(current) && Array.isArray(current()) && !isNaN(Number(part))) {
|
|
345
|
-
current()[Number(part)] = value;
|
|
346
|
-
} else {
|
|
347
|
-
current[part] = value;
|
|
348
|
-
}
|
|
349
|
-
} else {
|
|
350
|
-
if (isSignal(current)) {
|
|
351
|
-
current = current();
|
|
352
|
-
}
|
|
353
|
-
const currentValue = current[part];
|
|
354
|
-
if (currentValue === void 0) {
|
|
355
|
-
const parentInstance = getByPath(rootInstance, parts.slice(0, i).join("."));
|
|
356
|
-
const classType = parentInstance?.options?.classType;
|
|
357
|
-
if (classType) {
|
|
358
|
-
current[part] = !isClass(classType) ? classType(part) : new classType();
|
|
359
|
-
setMetadata(current[part], "id", part);
|
|
360
|
-
} else {
|
|
361
|
-
current[part] = {};
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
current = current[part];
|
|
68
|
+
if (sound && sound.src) {
|
|
69
|
+
return sound;
|
|
365
70
|
}
|
|
71
|
+
return sound;
|
|
366
72
|
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Global Howler instance for managing all sounds
|
|
75
|
+
*
|
|
76
|
+
* Provides access to Howler.js global methods for controlling all sounds
|
|
77
|
+
* at once (volume, mute, etc.).
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* // Set global volume to 20%
|
|
82
|
+
* RpgSound.global.volume(0.2)
|
|
83
|
+
*
|
|
84
|
+
* // Mute all sounds
|
|
85
|
+
* RpgSound.global.mute(true)
|
|
86
|
+
*
|
|
87
|
+
* // Unmute all sounds
|
|
88
|
+
* RpgSound.global.mute(false)
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
static get global() {
|
|
92
|
+
return Howler;
|
|
381
93
|
}
|
|
382
|
-
return current;
|
|
383
94
|
}
|
|
384
|
-
__name(getByPath, "getByPath");
|
|
385
95
|
|
|
386
|
-
export {
|
|
96
|
+
export { RpgSound, Sound, getSoundMetadata };
|
|
387
97
|
//# sourceMappingURL=index17.js.map
|
package/dist/index17.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index17.js","sources":["../../../node_modules/.pnpm/@signe+sync@2.3.3/node_modules/@signe/sync/dist/index.js"],"sourcesContent":["import {\n __name\n} from \"./chunk-7QVYU63E.js\";\n\n// src/core.ts\nimport { isArraySubject, isObjectSubject, isSignal, isComputed } from \"@signe/reactive\";\n\n// src/utils.ts\nfunction isFunction(val) {\n return {}.toString.call(val) === \"[object Function]\";\n}\n__name(isFunction, \"isFunction\");\nfunction isClass(obj) {\n return typeof obj === \"function\" && obj.prototype && obj.prototype.constructor === obj;\n}\n__name(isClass, \"isClass\");\nvar isObject = /* @__PURE__ */ __name((item) => item && typeof item === \"object\" && !Array.isArray(item) && item !== null, \"isObject\");\nfunction isInstanceOfClass(value) {\n if (value === null || typeof value !== \"object\" || value === void 0 || Array.isArray(value)) {\n return false;\n }\n return Object.getPrototypeOf(value) !== Object.prototype;\n}\n__name(isInstanceOfClass, \"isInstanceOfClass\");\nfunction generateShortUUID() {\n const chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n let uuid = \"\";\n for (let i = 0; i < 8; i++) {\n const randomIndex = Math.floor(Math.random() * chars.length);\n uuid += chars[randomIndex];\n }\n return uuid;\n}\n__name(generateShortUUID, \"generateShortUUID\");\n\n// src/core.ts\nvar DELETE_TOKEN = \"$delete\";\nvar syncClass = /* @__PURE__ */ __name((instance, options = {}) => {\n const cacheSync = /* @__PURE__ */ new Map();\n const cachePersist = /* @__PURE__ */ new Map();\n instance.$valuesChanges = {\n set: /* @__PURE__ */ __name((path, value) => {\n cacheSync.set(path, value);\n options.onSync?.(cacheSync);\n }, \"set\"),\n setPersist: /* @__PURE__ */ __name((path, value) => {\n if (path == \"\") path = \".\";\n cachePersist.set(path, value);\n options.onPersist?.(cachePersist);\n }, \"setPersist\"),\n has: /* @__PURE__ */ __name((path) => {\n return cacheSync.has(path);\n }, \"has\"),\n get: /* @__PURE__ */ __name((path) => {\n return cacheSync.get(path);\n }, \"get\")\n };\n createSyncClass(instance);\n}, \"syncClass\");\nfunction createStatesSnapshot(instance) {\n let persistObject = {};\n if (instance?.$snapshot) {\n for (const key of instance.$snapshot.keys()) {\n const signal = instance.$snapshot.get(key);\n const persist2 = signal.options.persist ?? true;\n let value = signal();\n if (isObject(value) || Array.isArray(value)) {\n continue;\n }\n if (persist2) {\n persistObject[key] = value;\n }\n }\n }\n return persistObject;\n}\n__name(createStatesSnapshot, \"createStatesSnapshot\");\nfunction setMetadata(target, key, value) {\n const meta = target.constructor._propertyMetadata;\n const propId = meta?.get(key);\n if (propId) {\n if (isSignal(target[propId])) {\n target[propId].set(value);\n } else {\n target[propId] = value;\n }\n }\n}\n__name(setMetadata, \"setMetadata\");\nvar createSyncClass = /* @__PURE__ */ __name((currentClass, parentKey = null, parentClass = null, path = \"\") => {\n currentClass.$path = path;\n if (parentClass) {\n currentClass.$valuesChanges = parentClass.$valuesChanges;\n }\n if (parentKey) {\n setMetadata(currentClass, \"id\", parentKey);\n }\n if (currentClass.$snapshot) {\n for (const key of currentClass.$snapshot.keys()) {\n const signal = currentClass.$snapshot.get(key);\n const syncToClient = signal.options?.syncToClient ?? true;\n const persist2 = signal.options?.persist ?? true;\n let signalValue = signal();\n if (isObject(signalValue) || Array.isArray(signalValue)) {\n signalValue = {\n ...signalValue\n };\n }\n const newPath = (path ? path + \".\" : \"\") + key;\n if (syncToClient) {\n currentClass.$valuesChanges.set(newPath, signalValue);\n }\n if (persist2) {\n if (parentClass) currentClass.$valuesChanges.setPersist(path, signalValue);\n }\n if (isComputed(signal)) {\n signal.observable.subscribe((newValue) => {\n if (syncToClient) {\n currentClass.$valuesChanges.set(newPath, newValue);\n }\n });\n }\n }\n }\n}, \"createSyncClass\");\nvar type = /* @__PURE__ */ __name((_signal, path, options = {}, currentInstance) => {\n const { syncToClient = true, persist: persist2 = true } = options;\n let init = true;\n const handleObjectSubject = /* @__PURE__ */ __name((value, propPath) => {\n const newPath = `${propPath}${value.key ? `.${value.key}` : \"\"}`;\n if ([\n \"add\",\n \"reset\",\n \"update\"\n ].includes(value.type)) {\n if (isInstanceOfClass(value.value)) {\n createSyncClass(value.value, value.key, currentInstance, newPath);\n } else if (value.type === \"update\" && (isObject(value.value) || Array.isArray(value.value))) {\n createSyncClass(value.value, value.key, currentInstance, newPath);\n } else {\n savePath(newPath, value.value);\n }\n } else if (value.type === \"remove\") {\n savePath(newPath, DELETE_TOKEN);\n }\n }, \"handleObjectSubject\");\n const handleArraySubject = /* @__PURE__ */ __name((value, propPath) => {\n if (value.type === \"reset\" && Array.isArray(value.items)) {\n value.items.forEach((item, index) => {\n const newPath2 = `${propPath}.${index}`;\n if (isInstanceOfClass(item)) {\n createSyncClass(item, value.key, currentInstance, newPath2);\n } else {\n savePath(newPath2, item);\n }\n });\n return;\n }\n const newPath = `${propPath}.${value.index}`;\n const firstItem = value.items?.[0];\n if ([\n \"add\",\n \"update\"\n ].includes(value.type) && firstItem !== void 0) {\n if (isInstanceOfClass(firstItem)) {\n createSyncClass(firstItem, value.key, currentInstance, newPath);\n } else if (value.type === \"update\" && (isObject(firstItem) || Array.isArray(firstItem))) {\n createSyncClass(firstItem, value.key, currentInstance, newPath);\n } else {\n savePath(newPath, firstItem);\n }\n } else if (value.type === \"remove\") {\n savePath(newPath, DELETE_TOKEN);\n }\n }, \"handleArraySubject\");\n const savePath = /* @__PURE__ */ __name((propPath, value) => {\n if (syncToClient) {\n currentInstance.$valuesChanges.set(propPath, value);\n }\n if (persist2 && currentInstance.$path !== void 0) {\n currentInstance.$valuesChanges.setPersist(value == DELETE_TOKEN ? propPath : currentInstance.$path, value);\n }\n }, \"savePath\");\n const setupSubscription = /* @__PURE__ */ __name((signal, signalPath) => {\n if (!isSignal(signal)) return;\n if (syncToClient && currentInstance.$valuesChanges) {\n const initialValue = signal();\n currentInstance.$valuesChanges.set(signalPath, initialValue);\n }\n signal.options = options;\n signal.observable.subscribe((value) => {\n if (init) return;\n if (currentInstance.$path !== void 0) {\n const fullPath = `${currentInstance.$path ? currentInstance.$path + \".\" : \"\"}${signalPath}`;\n if (isComputed(signal)) {\n savePath(fullPath, value);\n } else if (isObjectSubject(signal._subject)) {\n handleObjectSubject(value, fullPath);\n } else if (isArraySubject(signal._subject)) {\n handleArraySubject(value, fullPath);\n } else {\n savePath(fullPath, value);\n }\n }\n });\n if (!currentInstance.$snapshot) {\n currentInstance.$snapshot = /* @__PURE__ */ new Map();\n }\n currentInstance.$snapshot.set(path, signal);\n }, \"setupSubscription\");\n if (!isSignal(_signal)) {\n if (_signal && typeof _signal === \"object\" && !Array.isArray(_signal)) {\n for (const key in _signal) {\n if (Object.prototype.hasOwnProperty.call(_signal, key)) {\n const value = _signal[key];\n const propertyPath = `${path}.${key}`;\n if (isSignal(value)) {\n setupSubscription(value, propertyPath);\n } else if (value && typeof value === \"object\" && !Array.isArray(value)) {\n type(value, propertyPath, options, currentInstance);\n }\n }\n }\n init = false;\n }\n return _signal;\n }\n setupSubscription(_signal, path);\n init = false;\n return _signal;\n}, \"type\");\n\n// src/decorators.ts\nfunction sync(options) {\n let classType;\n let persist2 = true;\n let syncToClient = true;\n if (typeof options === \"function\") {\n classType = options;\n } else if (typeof options === \"object\") {\n classType = options.classType;\n if (options.hasOwnProperty(\"persist\")) {\n persist2 = options.persist;\n }\n if (options.hasOwnProperty(\"syncToClient\")) {\n syncToClient = options.syncToClient;\n }\n }\n return function(target, propertyKey) {\n const privatePropertyKey = `__${propertyKey}`;\n const getter = /* @__PURE__ */ __name(function() {\n return this[privatePropertyKey];\n }, \"getter\");\n const setter = /* @__PURE__ */ __name(function(newVal) {\n this[privatePropertyKey] = type(newVal, propertyKey, {\n classType,\n persist: persist2,\n syncToClient\n }, this);\n }, \"setter\");\n Object.defineProperty(target, propertyKey, {\n get: getter,\n set: setter,\n enumerable: true,\n configurable: true\n });\n };\n}\n__name(sync, \"sync\");\nfunction id() {\n return function(target, propertyKey) {\n if (!target.constructor._propertyMetadata) {\n target.constructor._propertyMetadata = /* @__PURE__ */ new Map();\n }\n target.constructor._propertyMetadata.set(\"id\", propertyKey);\n };\n}\n__name(id, \"id\");\nfunction users(options) {\n return function(target, propertyKey) {\n if (!target.constructor._propertyMetadata) {\n target.constructor._propertyMetadata = /* @__PURE__ */ new Map();\n }\n target.constructor._propertyMetadata.set(\"users\", propertyKey);\n sync(options)(target, propertyKey);\n };\n}\n__name(users, \"users\");\nfunction persist() {\n return sync({\n persist: true,\n syncToClient: false\n });\n}\n__name(persist, \"persist\");\nfunction connected() {\n return function(target, propertyKey) {\n if (!target.constructor._propertyMetadata) {\n target.constructor._propertyMetadata = /* @__PURE__ */ new Map();\n }\n target.constructor._propertyMetadata.set(\"connected\", propertyKey);\n sync({\n persist: false\n })(target, propertyKey);\n };\n}\n__name(connected, \"connected\");\n\n// src/load.ts\nimport { isSignal as isSignal2 } from \"@signe/reactive\";\nfunction load(rootInstance, values, valueIsObject) {\n if (valueIsObject) {\n loadFromObject(rootInstance, values);\n } else {\n loadFromPaths(rootInstance, values);\n }\n}\n__name(load, \"load\");\nfunction loadFromPaths(rootInstance, values) {\n for (const [path, value] of Object.entries(values)) {\n const parts = path.split(\".\");\n loadValue(rootInstance, parts, value);\n }\n}\n__name(loadFromPaths, \"loadFromPaths\");\nfunction loadFromObject(rootInstance, values, currentPath = \"\") {\n for (let key in values) {\n const value = values[key];\n const newPath = currentPath ? `${currentPath}.${key}` : key;\n if (typeof value === \"object\" && !Array.isArray(value) && value !== null) {\n loadFromObject(rootInstance, value, newPath);\n } else {\n const parts = newPath.split(\".\");\n loadValue(rootInstance, parts, value);\n }\n }\n}\n__name(loadFromObject, \"loadFromObject\");\nfunction loadValue(rootInstance, parts, value) {\n let current = rootInstance;\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i];\n if (i === parts.length - 1) {\n if (value == DELETE_TOKEN) {\n if (isSignal2(current)) {\n current = current();\n }\n Reflect.deleteProperty(current, part);\n } else if (current[part]?._subject) {\n current[part].set(value);\n } else if (isSignal2(current) && Array.isArray(current()) && !isNaN(Number(part))) {\n current()[Number(part)] = value;\n } else {\n current[part] = value;\n }\n } else {\n if (isSignal2(current)) {\n current = current();\n }\n const currentValue = current[part];\n if (currentValue === void 0) {\n const parentInstance = getByPath(rootInstance, parts.slice(0, i).join(\".\"));\n const classType = parentInstance?.options?.classType;\n if (classType) {\n current[part] = !isClass(classType) ? classType(part) : new classType();\n setMetadata(current[part], \"id\", part);\n } else {\n current[part] = {};\n }\n }\n current = current[part];\n }\n }\n}\n__name(loadValue, \"loadValue\");\nfunction getByPath(root, path) {\n const parts = path.split(\".\");\n let current = root;\n for (const part of parts) {\n if (isSignal2(current)) {\n current = current();\n }\n if (current[part]) {\n current = current[part];\n } else {\n return void 0;\n }\n }\n return current;\n}\n__name(getByPath, \"getByPath\");\nexport {\n DELETE_TOKEN,\n connected,\n createStatesSnapshot,\n createSyncClass,\n generateShortUUID,\n getByPath,\n id,\n isClass,\n isFunction,\n isInstanceOfClass,\n isObject,\n load,\n persist,\n setMetadata,\n sync,\n syncClass,\n type,\n users\n};\n//# sourceMappingURL=index.js.map"],"names":["isSignal2"],"mappings":";;;AAOA;AACA,SAAS,UAAU,CAAC,GAAG,EAAE;AACzB,EAAE,OAAO,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,mBAAmB;AACtD;AACA,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC;AA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AW,CAAC;AAC9B,SAAS,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE;AAC/B,EAAE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;AAC/B,EAAE,IAAI,OAAO,GAAG,IAAI;AACpB,EAAE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;AAC5B,IAAI,IAAIA,QAAS,CAAC,OAAO,CAAC,EAAE;AAC5B,MAAM,OAAO,GAAG,OAAO,EAAE;AACzB;AACA,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE;AACvB,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;AAC7B,KAAK,MAAM;AACX,MAAM,OAAO,MAAM;AACnB;AACA;AACA,EAAE,OAAO,OAAO;AAChB;AACA,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC;;;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index17.js","sources":["../src/Sound.ts"],"sourcesContent":["import { Howler } from 'canvasengine';\nimport { RpgClientEngine } from './RpgClientEngine';\nimport { inject } from './core/inject';\n\n/**\n * Sound decorator options\n * \n * Defines the configuration for a sound that can be played in the game.\n * The sound can be a single file or multiple files (for different formats).\n * \n * @interface SoundOptions\n */\nexport interface SoundOptions {\n /**\n * Sound identifier. Used to retrieve the sound later with RpgSound.get()\n * \n * @type {string}\n */\n id?: string;\n\n /**\n * Single sound file path. Use require() to wrap the path.\n * \n * @type {string}\n * @example\n * sound: require('./assets/sound.ogg')\n */\n sound?: string;\n\n /**\n * Multiple sounds with different IDs. The key is the sound ID and the value is the file path.\n * Use require() to wrap each path.\n * \n * @type {{ [id: string]: string }}\n * @example\n * sounds: {\n * hero: require('./assets/hero.ogg'),\n * monster: require('./assets/monster.ogg')\n * }\n */\n sounds?: { [id: string]: string };\n\n /**\n * Whether the sound should loop when it finishes playing.\n * \n * @type {boolean}\n * @default false\n */\n loop?: boolean;\n\n /**\n * Volume level (0.0 to 1.0).\n * \n * @type {number}\n * @default 1.0\n */\n volume?: number;\n}\n\n/**\n * Metadata stored on the class decorated with @Sound\n * \n * @interface SoundMetadata\n */\ninterface SoundMetadata {\n id?: string;\n sound?: string;\n sounds?: { [id: string]: string };\n loop?: boolean;\n volume?: number;\n}\n\nconst SOUND_METADATA_KEY = Symbol('rpgjs:sound');\n\n/**\n * Sound decorator\n * \n * Decorates a class to define a sound configuration. The decorated class can be\n * added to the RpgClient module configuration, and the sound will be automatically\n * registered and available through RpgSound.get().\n * \n * ## Design\n * \n * The decorator stores metadata on the class that is later used by the module loader\n * to register sounds with the engine. The sound is created using Howler.js for\n * advanced audio features like looping, volume control, and cross-browser compatibility.\n * \n * @param options - Sound configuration options\n * \n * @example\n * ```ts\n * import { Sound } from '@rpgjs/client'\n * \n * @Sound({\n * id: 'town-music',\n * sound: require('./sound/town.ogg'),\n * loop: true,\n * volume: 0.5\n * })\n * export class TownMusic {}\n * \n * // Multiple sounds in one class\n * @Sound({\n * sounds: {\n * hero: require('./assets/hero.ogg'),\n * monster: require('./assets/monster.ogg')\n * },\n * loop: true\n * })\n * export class CharacterSounds {}\n * ```\n */\nexport function Sound(options: SoundOptions) {\n return function <T extends { new (...args: any[]): {} }>(constructor: T) {\n const metadata: SoundMetadata = {\n id: options.id,\n sound: options.sound,\n sounds: options.sounds,\n loop: options.loop,\n volume: options.volume,\n };\n\n // Store metadata on the class\n (constructor as any)[SOUND_METADATA_KEY] = metadata;\n\n return constructor;\n };\n}\n\n/**\n * Get sound metadata from a decorated class\n * \n * @param soundClass - The class decorated with @Sound\n * @returns The sound metadata or undefined\n */\nexport function getSoundMetadata(soundClass: any): SoundMetadata | undefined {\n return (soundClass as any)[SOUND_METADATA_KEY];\n}\n\n/**\n * RpgSound class\n * \n * Provides a unified API to manage sounds in the game. Uses Howler.js internally\n * for advanced audio features. Sounds can be retrieved by ID and controlled\n * using Howler.js methods.\n * \n * ## Design\n * \n * RpgSound acts as a facade over Howler.js, providing easy access to sounds\n * registered in the engine. It supports both individual sound control and\n * global sound management (volume, mute, etc.).\n * \n * @example\n * ```ts\n * import { RpgSound } from '@rpgjs/client'\n * \n * // Play a sound\n * RpgSound.get('town-music').play()\n * \n * // Control volume\n * RpgSound.get('town-music').volume(0.5)\n * \n * // Stop a sound\n * RpgSound.get('town-music').stop()\n * \n * // Global volume control\n * RpgSound.global.volume(0.2)\n * ```\n */\nexport class RpgSound {\n private static engine: RpgClientEngine | null = null;\n\n /**\n * Initialize RpgSound with the engine instance\n * \n * This is called automatically by the engine during initialization.\n * \n * @param engine - The RpgClientEngine instance\n */\n static init(engine: RpgClientEngine): void {\n RpgSound.engine = engine;\n }\n\n /**\n * Get a sound by its ID\n * \n * Retrieves a Howler sound instance from the engine's sound cache.\n * The sound must be registered beforehand (via @Sound decorator or manually).\n * \n * @param id - The sound identifier\n * @returns The Howler sound instance, or undefined if not found\n * \n * @example\n * ```ts\n * // Get and play a sound\n * const sound = RpgSound.get('town-music');\n * if (sound) {\n * sound.play();\n * }\n * \n * // Chain methods\n * RpgSound.get('battle-theme')?.volume(0.8).play();\n * ```\n */\n static get(id: string): any {\n if (!RpgSound.engine) {\n console.warn('RpgSound not initialized. Make sure the engine has started.');\n return undefined;\n }\n\n const sound = RpgSound.engine.sounds.get(id);\n if (!sound) {\n console.warn(`Sound with id \"${id}\" not found`);\n return undefined;\n }\n\n // If the sound is a Howler instance, return it directly\n if (sound && typeof sound.play === 'function') {\n return sound;\n }\n\n // If the sound has a src property, try to create a Howler instance\n if (sound && sound.src) {\n // This should have been handled during addSound, but just in case\n return sound;\n }\n\n return sound;\n }\n\n /**\n * Global Howler instance for managing all sounds\n * \n * Provides access to Howler.js global methods for controlling all sounds\n * at once (volume, mute, etc.).\n * \n * @example\n * ```ts\n * // Set global volume to 20%\n * RpgSound.global.volume(0.2)\n * \n * // Mute all sounds\n * RpgSound.global.mute(true)\n * \n * // Unmute all sounds\n * RpgSound.global.mute(false)\n * ```\n */\n static get global(): typeof Howler {\n return Howler;\n }\n}\n\n"],"names":[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