pixi-rainman-game-engine 0.2.16-b → 0.2.17
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.
|
@@ -5,7 +5,8 @@ export declare const pixiSoundContext: typeof sound.context;
|
|
|
5
5
|
/**
|
|
6
6
|
* Class for managing sound in game, uses the pixi sound library
|
|
7
7
|
* The class uses SoundTrack enum to access specified sounds
|
|
8
|
-
*
|
|
8
|
+
* @implements {SpeedAdapterInterface<SoundOverrides>}
|
|
9
|
+
* @class
|
|
9
10
|
*/
|
|
10
11
|
export declare class SoundManagerInstance implements SpeedAdapterInterface<SoundOverrides> {
|
|
11
12
|
private static instance;
|
|
@@ -49,6 +50,11 @@ export declare class SoundManagerInstance implements SpeedAdapterInterface<Sound
|
|
|
49
50
|
* If sound is not playing, it will be skipped
|
|
50
51
|
*/
|
|
51
52
|
pauseAll(): void;
|
|
53
|
+
/**
|
|
54
|
+
* Function for stopping all sounds in game
|
|
55
|
+
* If sound is not playing, it will be skipped
|
|
56
|
+
*/
|
|
57
|
+
stopAll(): void;
|
|
52
58
|
/**
|
|
53
59
|
* Function for pausing sound with given name
|
|
54
60
|
* @param {SoundTrack} soundName - name of the sound
|
|
@@ -6,7 +6,8 @@ export const pixiSoundContext = sound.context;
|
|
|
6
6
|
/**
|
|
7
7
|
* Class for managing sound in game, uses the pixi sound library
|
|
8
8
|
* The class uses SoundTrack enum to access specified sounds
|
|
9
|
-
*
|
|
9
|
+
* @implements {SpeedAdapterInterface<SoundOverrides>}
|
|
10
|
+
* @class
|
|
10
11
|
*/
|
|
11
12
|
export class SoundManagerInstance {
|
|
12
13
|
static instance;
|
|
@@ -69,7 +70,7 @@ export class SoundManagerInstance {
|
|
|
69
70
|
for (const [soundName, sound] of this.musicCatalogue.entries()) {
|
|
70
71
|
if (soundName === SoundTracks.music)
|
|
71
72
|
continue;
|
|
72
|
-
sound.
|
|
73
|
+
sound.stop();
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
76
|
/**
|
|
@@ -121,6 +122,13 @@ export class SoundManagerInstance {
|
|
|
121
122
|
pauseAll() {
|
|
122
123
|
this.musicCatalogue.forEach((sound) => sound.pause());
|
|
123
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* Function for stopping all sounds in game
|
|
127
|
+
* If sound is not playing, it will be skipped
|
|
128
|
+
*/
|
|
129
|
+
stopAll() {
|
|
130
|
+
this.musicCatalogue.forEach((sound) => sound.stop());
|
|
131
|
+
}
|
|
124
132
|
/**
|
|
125
133
|
* Function for pausing sound with given name
|
|
126
134
|
* @param {SoundTrack} soundName - name of the sound
|
|
@@ -42,8 +42,10 @@ export class AbstractFrame extends ResumableContainer {
|
|
|
42
42
|
invokeMysteryFx(x, y) {
|
|
43
43
|
if (!this.mysteryFxConfig)
|
|
44
44
|
return;
|
|
45
|
-
if (this.mysteryFxHighlight)
|
|
45
|
+
if (this.mysteryFxHighlight) {
|
|
46
|
+
SoundManager.pause(SoundTracks.mysteryFxLoop);
|
|
46
47
|
this.removeChild(this.mysteryFxHighlight);
|
|
48
|
+
}
|
|
47
49
|
this.mysteryFxCoordinates = { x, y };
|
|
48
50
|
const spineName = this.mysteryFxConfig.mobileSpineName && getDeviceOrientation() === "mobile-portrait"
|
|
49
51
|
? this.mysteryFxConfig.mobileSpineName
|
|
@@ -62,9 +64,11 @@ export class AbstractFrame extends ResumableContainer {
|
|
|
62
64
|
if (!this.mysteryFxConfig)
|
|
63
65
|
return;
|
|
64
66
|
if (!this.mysteryFxConfig.endAnimationName) {
|
|
67
|
+
SoundManager.stop(SoundTracks.mysteryFxLoop);
|
|
65
68
|
return;
|
|
66
69
|
}
|
|
67
70
|
if (this.mysteryFxHighlight) {
|
|
71
|
+
SoundManager.stop(SoundTracks.mysteryFxLoop);
|
|
68
72
|
SoundManager.play(SoundTracks.mysteryFxEnd);
|
|
69
73
|
this.resetMysteryFxCoordinates();
|
|
70
74
|
this.mysteryFxHighlight.state.setAnimation(0, this.mysteryFxConfig.endAnimationName, false);
|
|
@@ -125,8 +129,10 @@ export class AbstractFrame extends ResumableContainer {
|
|
|
125
129
|
this.addChild(this.innerFrame);
|
|
126
130
|
}
|
|
127
131
|
resize() {
|
|
128
|
-
if (this.mysteryFxHighlight)
|
|
132
|
+
if (this.mysteryFxHighlight) {
|
|
133
|
+
SoundManager.pause(SoundTracks.mysteryFxLoop);
|
|
129
134
|
this.removeChild(this.mysteryFxHighlight);
|
|
135
|
+
}
|
|
130
136
|
this.changeFrameForOrientation();
|
|
131
137
|
const expectedScreenDimensions = {
|
|
132
138
|
width: this.transformedWidth(),
|
|
@@ -138,8 +144,10 @@ export class AbstractFrame extends ResumableContainer {
|
|
|
138
144
|
this.width = dimensions.width;
|
|
139
145
|
this.addChild(this.innerFrame);
|
|
140
146
|
this.repositionMysteryFx(this.mysteryFxCoordinates.x, this.mysteryFxCoordinates.y);
|
|
141
|
-
if (this.mysteryFxHighlight)
|
|
147
|
+
if (this.mysteryFxHighlight) {
|
|
148
|
+
SoundManager.resume(SoundTracks.mysteryFxLoop);
|
|
142
149
|
this.addChild(this.mysteryFxHighlight);
|
|
150
|
+
}
|
|
143
151
|
this.winLineAnimations.forEach((winLineAnimation) => this.addChild(winLineAnimation));
|
|
144
152
|
this.reposition();
|
|
145
153
|
}
|
|
@@ -7,7 +7,7 @@ import { RainMan } from "../../Rainman";
|
|
|
7
7
|
*/
|
|
8
8
|
const resumeAudioContext = () => {
|
|
9
9
|
if (RainMan.settingsStore.isSoundEnabled() && document.hidden) {
|
|
10
|
-
SoundManager.
|
|
10
|
+
SoundManager.stopAll();
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
if (RainMan.settingsStore.isSoundEnabled() && !document.hidden) {
|
package/package.json
CHANGED