pixi-rainman-game-engine 0.3.34 → 0.3.35
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.
|
@@ -117,7 +117,7 @@ export declare class SoundManagerInstance implements SpeedAdapterInterface<Sound
|
|
|
117
117
|
* @public
|
|
118
118
|
* @returns {void}
|
|
119
119
|
*/
|
|
120
|
-
resumeOnFocus(): Promise<
|
|
120
|
+
resumeOnFocus(): Promise<boolean>;
|
|
121
121
|
/**
|
|
122
122
|
* Returns information if audio context is ready to play sounds.
|
|
123
123
|
* @public
|
|
@@ -260,10 +260,14 @@ export class SoundManagerInstance {
|
|
|
260
260
|
await sound.context.audioContext.resume();
|
|
261
261
|
}
|
|
262
262
|
catch (error) {
|
|
263
|
-
console.error("Could not resume audio");
|
|
263
|
+
console.error("Could not resume audio", error);
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
|
+
if (!this.isAudioContextRunning()) {
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
266
269
|
this.restoreAmbientPlayback();
|
|
270
|
+
return true;
|
|
267
271
|
}
|
|
268
272
|
/**
|
|
269
273
|
* Returns information if audio context is ready to play sounds.
|
|
@@ -1194,7 +1194,9 @@ export class AbstractController {
|
|
|
1194
1194
|
this.uiController.messageBox.hideCurrentWinText();
|
|
1195
1195
|
this.uiController.messageBox.hideAutoSpinText();
|
|
1196
1196
|
await this.handleFreeSpinPlateInvocation(freeSpinAward, isAdditionalFreeSpins || additionalFreeSpinsOnLastSpin);
|
|
1197
|
-
|
|
1197
|
+
if (!isAdditionalFreeSpins && !additionalFreeSpinsOnLastSpin) {
|
|
1198
|
+
this.uiController.currentBalance = RainMan.settingsStore.balanceAfterSpin;
|
|
1199
|
+
}
|
|
1198
1200
|
this.uiController.triggerUiElementsUpdate();
|
|
1199
1201
|
this.uiController.messageBox.showFreeSpinText();
|
|
1200
1202
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { sound } from "@pixi/sound";
|
|
1
2
|
import { SoundManager } from "../../application";
|
|
2
3
|
import { RainMan } from "../../Rainman";
|
|
3
4
|
let shouldResumeAudioOnInterruption = false;
|
|
@@ -33,7 +34,11 @@ const resumeAudio = async () => {
|
|
|
33
34
|
return;
|
|
34
35
|
}
|
|
35
36
|
if (RainMan.settingsStore.isSoundEnabled()) {
|
|
36
|
-
await SoundManager.resumeOnFocus();
|
|
37
|
+
const hasResumedAudioContext = await SoundManager.resumeOnFocus();
|
|
38
|
+
if (!hasResumedAudioContext) {
|
|
39
|
+
interruptedAudioResume();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
37
42
|
SoundManager.resumeAll();
|
|
38
43
|
}
|
|
39
44
|
if (SoundManager.isAudioContextRunning()) {
|
|
@@ -68,9 +73,8 @@ const handleVisibilityChange = () => {
|
|
|
68
73
|
* @returns {void}
|
|
69
74
|
*/
|
|
70
75
|
export const loadSoundsOnTabChange = () => {
|
|
76
|
+
sound.disableAutoPause = true;
|
|
71
77
|
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
72
|
-
window.addEventListener("pagehide", pauseAudio);
|
|
73
|
-
window.addEventListener("blur", pauseAudio);
|
|
78
|
+
window.addEventListener("pagehide", () => pauseAudio());
|
|
74
79
|
window.addEventListener("pageshow", () => resumeAudio());
|
|
75
|
-
window.addEventListener("focus", () => resumeAudio());
|
|
76
80
|
};
|
package/package.json
CHANGED