pixi-rainman-game-engine 0.3.22 → 0.3.24
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/Rainman/Rainman.js +1 -1
- package/dist/SettingsUI/components/VolumeSettings/index.jsx +2 -4
- package/dist/application/ButtonsEventManager/ButtonsEventManager.js +5 -0
- package/dist/application/SoundManager/SoundManager.d.ts +6 -0
- package/dist/application/SoundManager/SoundManager.js +24 -0
- package/dist/controllers/AbstractController.js +2 -0
- package/dist/stores/SettingsStore.d.ts +1 -0
- package/dist/stores/SettingsStore.js +2 -1
- package/dist/utils/common/functions.js +3 -0
- package/package.json +2 -2
package/dist/Rainman/Rainman.js
CHANGED
|
@@ -56,7 +56,7 @@ export class RainMan {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
initLocalStorageSettings() {
|
|
59
|
-
setIfDoesntExistInLocalStorage(LOCAL_STORAGE.hiResolution,
|
|
59
|
+
setIfDoesntExistInLocalStorage(LOCAL_STORAGE.hiResolution, false);
|
|
60
60
|
setIfDoesntExistInLocalStorage(LOCAL_STORAGE.batterySaver, false);
|
|
61
61
|
setIfDoesntExistInLocalStorage(LOCAL_STORAGE.volumeLevel, 100);
|
|
62
62
|
setToLocalStorage(LOCAL_STORAGE.isSoundFxEnabled, true);
|
|
@@ -6,9 +6,6 @@ import React from "react";
|
|
|
6
6
|
import { SoundManager } from "../../../application";
|
|
7
7
|
import { RainMan } from "../../../Rainman";
|
|
8
8
|
import { useStores } from "../../hooks";
|
|
9
|
-
const onBeforeChange = () => {
|
|
10
|
-
RainMan.settingsStore.flipSoundsEnabled();
|
|
11
|
-
};
|
|
12
9
|
const onChange = (newVolumeLevel) => {
|
|
13
10
|
RainMan.settingsStore.setVolumeLevel(newVolumeLevel);
|
|
14
11
|
};
|
|
@@ -18,6 +15,7 @@ const onAfterChange = (newVolumeLevel) => {
|
|
|
18
15
|
SoundManager.pauseAll();
|
|
19
16
|
}
|
|
20
17
|
else {
|
|
18
|
+
RainMan.settingsStore.wasVolumeChanged = true;
|
|
21
19
|
SoundManager.resumeAll();
|
|
22
20
|
}
|
|
23
21
|
};
|
|
@@ -39,7 +37,7 @@ export const VolumeSettings = observer(() => {
|
|
|
39
37
|
backgroundColor: COLOR,
|
|
40
38
|
height: "5px",
|
|
41
39
|
borderRadius: "1px"
|
|
42
|
-
}}
|
|
40
|
+
}} onChange={onChange} onAfterChange={onAfterChange}/>
|
|
43
41
|
<p className="volume-control__text" style={{
|
|
44
42
|
color: COLOR
|
|
45
43
|
}}>
|
|
@@ -221,6 +221,11 @@ export class ButtonsEventManager {
|
|
|
221
221
|
initVolumeButtonEvent() {
|
|
222
222
|
RainMan.settingsStore.setUpdateVolumeButtonTexture(() => RainMan.componentRegistry.get(VolumeButton.registryName).changeTextureDependOnVolume());
|
|
223
223
|
RainMan.componentRegistry.get(VolumeButton.registryName).setOnClick(() => {
|
|
224
|
+
if (RainMan.settingsStore.wasVolumeChanged === true) {
|
|
225
|
+
this.handleModalInvocation(UI_ITEMS.volume);
|
|
226
|
+
RainMan.settingsStore.wasVolumeChanged = false;
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
224
229
|
RainMan.settingsStore.flipSoundsEnabled();
|
|
225
230
|
if (RainMan.settingsStore.isSoundEnabled()) {
|
|
226
231
|
if (RainMan.settingsStore.shouldPlayAmbientMusic) {
|
|
@@ -106,5 +106,11 @@ export declare class SoundManagerInstance implements SpeedAdapterInterface<Sound
|
|
|
106
106
|
* @returns {void}
|
|
107
107
|
*/
|
|
108
108
|
stop(soundName: SoundTrack): void;
|
|
109
|
+
/**
|
|
110
|
+
* Function that resumes sounds and music when game is back in focus.
|
|
111
|
+
* @public
|
|
112
|
+
* @returns {void}
|
|
113
|
+
*/
|
|
114
|
+
resumeOnFocus(): Promise<void>;
|
|
109
115
|
}
|
|
110
116
|
export declare const SoundManager: SoundManagerInstance;
|
|
@@ -224,5 +224,29 @@ export class SoundManagerInstance {
|
|
|
224
224
|
stop(soundName) {
|
|
225
225
|
this.musicCatalogue.get(soundName)?.stop();
|
|
226
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* Function that resumes sounds and music when game is back in focus.
|
|
229
|
+
* @public
|
|
230
|
+
* @returns {void}
|
|
231
|
+
*/
|
|
232
|
+
async resumeOnFocus() {
|
|
233
|
+
const pixiSoundContext = sound.context;
|
|
234
|
+
const audioContext = pixiSoundContext.audioContext;
|
|
235
|
+
const state = audioContext.state;
|
|
236
|
+
if (state === "suspended" || state === "interrupted") {
|
|
237
|
+
try {
|
|
238
|
+
await sound.context.audioContext.resume();
|
|
239
|
+
}
|
|
240
|
+
catch (error) {
|
|
241
|
+
console.error("Could not resume audio");
|
|
242
|
+
}
|
|
243
|
+
const ambientMusic = this.musicCatalogue.get(RainMan.settingsStore.isFreeSpinsPlayEnabled ? "freeSpinsMusic" : "music");
|
|
244
|
+
if (ambientMusic !== undefined &&
|
|
245
|
+
ambientMusic.isPlaying !== true &&
|
|
246
|
+
RainMan.settingsStore.shouldPlayAmbientMusic) {
|
|
247
|
+
ambientMusic.resume();
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
227
251
|
}
|
|
228
252
|
export const SoundManager = SoundManagerInstance.getInstance();
|
|
@@ -112,6 +112,7 @@ export class AbstractController {
|
|
|
112
112
|
this.buttonsEventManager.initFreeSpinModal();
|
|
113
113
|
this.buttonsEventManager.setUpUIElementsInteractivity();
|
|
114
114
|
this.buttonsEventManager.setConfirmAutoplayButton(() => {
|
|
115
|
+
this.quickStopController.speedPopupDisabled = true;
|
|
115
116
|
if (RainMan.settingsStore.isAutoplayEnabled) {
|
|
116
117
|
return;
|
|
117
118
|
}
|
|
@@ -846,6 +847,7 @@ export class AbstractController {
|
|
|
846
847
|
* @returns {void}
|
|
847
848
|
*/
|
|
848
849
|
disableAutoplay() {
|
|
850
|
+
this.quickStopController.speedPopupDisabled = false;
|
|
849
851
|
this.autoSpinBalance = 0;
|
|
850
852
|
RainMan.componentRegistry.get(MessageBox.registryName).hideAutoSpinText();
|
|
851
853
|
RainMan.componentRegistry.get(AutoplayButton.registryName).activate(false);
|
|
@@ -44,6 +44,7 @@ export declare class SettingsStore {
|
|
|
44
44
|
howManyAutoSpinsLeft: number;
|
|
45
45
|
freeSpinBuyTable: Record<number, number>;
|
|
46
46
|
volumeLevel: number;
|
|
47
|
+
wasVolumeChanged: boolean;
|
|
47
48
|
popupPaytablePosition?: Point;
|
|
48
49
|
popupPaytableData?: PaytableData[];
|
|
49
50
|
currentSpeed: SpeedLevel;
|
|
@@ -32,7 +32,7 @@ export class SettingsStore {
|
|
|
32
32
|
infinitySpinsEnabled = false;
|
|
33
33
|
roundNumber = 0;
|
|
34
34
|
reelSetId = 0;
|
|
35
|
-
HiResolutionFlag = getFromLocalStorage(LOCAL_STORAGE.hiResolution,
|
|
35
|
+
HiResolutionFlag = getFromLocalStorage(LOCAL_STORAGE.hiResolution, false);
|
|
36
36
|
batterySaverFlag = getFromLocalStorage(LOCAL_STORAGE.batterySaver, false);
|
|
37
37
|
isGambleGameAvailable = true;
|
|
38
38
|
isGambleGameActive = false;
|
|
@@ -48,6 +48,7 @@ export class SettingsStore {
|
|
|
48
48
|
howManyAutoSpinsLeft = INITIAL_AUTO_SPIN_COUNT;
|
|
49
49
|
freeSpinBuyTable = {};
|
|
50
50
|
volumeLevel = Number(getFromLocalStorage(LOCAL_STORAGE.volumeLevel, 100));
|
|
51
|
+
wasVolumeChanged = false;
|
|
51
52
|
popupPaytablePosition;
|
|
52
53
|
popupPaytableData;
|
|
53
54
|
currentSpeed = "slow";
|
|
@@ -68,6 +68,9 @@ export const hideLayerIfPresent = (elementsToSkip = []) => {
|
|
|
68
68
|
if (element.style.display !== "none") {
|
|
69
69
|
anyHidden = true;
|
|
70
70
|
}
|
|
71
|
+
if (RainMan.settingsStore.wasVolumeChanged === true) {
|
|
72
|
+
RainMan.settingsStore.wasVolumeChanged = false;
|
|
73
|
+
}
|
|
71
74
|
element.style.display = "none";
|
|
72
75
|
});
|
|
73
76
|
return anyHidden;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pixi-rainman-game-engine",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.24",
|
|
4
4
|
"description": "This repository contains all of the mechanics that used in rainman games.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@pixi/filter-glow": "^5.2.1",
|
|
24
24
|
"@pixi/layers": "^2.1.0",
|
|
25
25
|
"@pixi/particle-emitter": "^5.0.8",
|
|
26
|
-
"@pixi/sound": "
|
|
26
|
+
"@pixi/sound": "5.2.3",
|
|
27
27
|
"@tweenjs/tween.js": "18.6.4",
|
|
28
28
|
"adaptive-scale": "^1.0.0",
|
|
29
29
|
"i18next": "^23.10.1",
|