react-simple-game-engine 0.2.91 → 0.2.92
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/lib/classes/scene.d.ts +1 -1
- package/lib/classes/scene.js +9 -9
- package/lib/classes/sound.d.ts +2 -2
- package/lib/classes/sound.js +1 -1
- package/lib/decorators/sound-from.decor.d.ts +1 -1
- package/lib/decorators/sound-from.decor.js +3 -3
- package/lib/export-types.d.ts +1 -1
- package/package.json +1 -1
package/lib/classes/scene.d.ts
CHANGED
@@ -82,7 +82,7 @@ export declare abstract class Scene<UIP = any> {
|
|
82
82
|
})[]): Promise<import("p5").Image[]>;
|
83
83
|
createSounds(...srcables: (string | {
|
84
84
|
src: string;
|
85
|
-
|
85
|
+
volume?: number;
|
86
86
|
type?: SoundType;
|
87
87
|
})[]): Promise<Sound[]>;
|
88
88
|
mapSprites(...srcs: string[]): Promise<void>;
|
package/lib/classes/scene.js
CHANGED
@@ -290,8 +290,8 @@ var Scene = /** @class */ (function () {
|
|
290
290
|
return [4 /*yield*/, createAssetSound(decor.src, decor.type)];
|
291
291
|
case 2:
|
292
292
|
sound = _b.sent();
|
293
|
-
if (decor.
|
294
|
-
sound.
|
293
|
+
if (decor.volume) {
|
294
|
+
sound.volume = decor.volume;
|
295
295
|
}
|
296
296
|
this[decor.propertyKey] = sound;
|
297
297
|
this.sounds.push(sound);
|
@@ -331,7 +331,7 @@ var Scene = /** @class */ (function () {
|
|
331
331
|
srcables[_i] = arguments[_i];
|
332
332
|
}
|
333
333
|
return __awaiter(this, void 0, void 0, function () {
|
334
|
-
var sounds, _a, srcables_1, srcable, _b,
|
334
|
+
var sounds, _a, srcables_1, srcable, _b, volume, src, _c, type, sound;
|
335
335
|
return __generator(this, function (_d) {
|
336
336
|
switch (_d.label) {
|
337
337
|
case 0:
|
@@ -342,13 +342,13 @@ var Scene = /** @class */ (function () {
|
|
342
342
|
if (!(_a < srcables_1.length)) return [3 /*break*/, 4];
|
343
343
|
srcable = srcables_1[_a];
|
344
344
|
_b = typeof srcable === "string"
|
345
|
-
? { src: srcable,
|
346
|
-
: srcable,
|
345
|
+
? { src: srcable, volume: undefined, type: undefined }
|
346
|
+
: srcable, volume = _b.volume, src = _b.src, _c = _b.type, type = _c === void 0 ? SoundType.ONCE : _c;
|
347
347
|
return [4 /*yield*/, createAssetSound(src, type)];
|
348
348
|
case 2:
|
349
349
|
sound = _d.sent();
|
350
|
-
if (
|
351
|
-
sound.
|
350
|
+
if (volume) {
|
351
|
+
sound.volume = volume;
|
352
352
|
}
|
353
353
|
sounds.push(sound);
|
354
354
|
this.sounds.push(sound);
|
@@ -421,8 +421,8 @@ var Scene = /** @class */ (function () {
|
|
421
421
|
return [4 /*yield*/, createAssetSound(src, decor.type)];
|
422
422
|
case 2:
|
423
423
|
sound = _b.sent();
|
424
|
-
if (decor.
|
425
|
-
sound.
|
424
|
+
if (decor.volume) {
|
425
|
+
sound.volume = decor.volume;
|
426
426
|
}
|
427
427
|
this[decor.propertyKey] = sound;
|
428
428
|
this.sounds.push(sound);
|
package/lib/classes/sound.d.ts
CHANGED
@@ -5,8 +5,8 @@ export declare class Sound {
|
|
5
5
|
static Management: SoundManagement;
|
6
6
|
readonly native: HTMLAudioElement;
|
7
7
|
constructor(type?: SoundType);
|
8
|
-
get
|
9
|
-
set
|
8
|
+
get volume(): number;
|
9
|
+
set volume(vol: number);
|
10
10
|
get isStopped(): boolean;
|
11
11
|
playNow(): Promise<void>;
|
12
12
|
pause(): Promise<void>;
|
package/lib/classes/sound.js
CHANGED
@@ -43,7 +43,7 @@ var Sound = /** @class */ (function () {
|
|
43
43
|
this.type = type;
|
44
44
|
this.native = new Audio();
|
45
45
|
}
|
46
|
-
Object.defineProperty(Sound.prototype, "
|
46
|
+
Object.defineProperty(Sound.prototype, "volume", {
|
47
47
|
get: function () {
|
48
48
|
return this.native.volume;
|
49
49
|
},
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { SoundType } from "../export-enums";
|
2
2
|
export declare function SoundFrom(srcable?: string | {
|
3
3
|
src?: string;
|
4
|
-
|
4
|
+
volume?: number;
|
5
5
|
}, type?: SoundType): (target: any, propertyKey: string) => void;
|
6
6
|
//# sourceMappingURL=sound-from.decor.d.ts.map
|
@@ -4,14 +4,14 @@ export function SoundFrom(srcable, type) {
|
|
4
4
|
return function (target, propertyKey) {
|
5
5
|
var _a = srcable
|
6
6
|
? typeof srcable === "string"
|
7
|
-
? { src: srcable,
|
7
|
+
? { src: srcable, volume: undefined }
|
8
8
|
: srcable
|
9
|
-
: {
|
9
|
+
: { volume: undefined, src: undefined }, volume = _a.volume, src = _a.src;
|
10
10
|
if (!target.soundsDecor) {
|
11
11
|
target.soundsDecor = [];
|
12
12
|
}
|
13
13
|
target.soundsDecor.push({
|
14
|
-
|
14
|
+
volume: volume,
|
15
15
|
propertyKey: propertyKey,
|
16
16
|
src: src,
|
17
17
|
type: type,
|
package/lib/export-types.d.ts
CHANGED