pixi-rainman-game-engine 0.3.37 → 0.3.39
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 -3
- package/dist/Rainman/appConfig.js +0 -1
- package/dist/Rainman/types.d.ts +0 -2
- package/dist/SettingsUI/components/CloseModalButton/index.jsx +0 -5
- package/dist/SettingsUI/components/UXSettings/index.jsx +0 -3
- package/dist/SettingsUI/components/index.d.ts +0 -1
- package/dist/SettingsUI/components/index.jsx +0 -1
- package/dist/SettingsUI/index.jsx +1 -6
- package/dist/application/ButtonsEventManager/ButtonsEventManager.d.ts +3 -17
- package/dist/application/ButtonsEventManager/ButtonsEventManager.js +62 -95
- package/dist/application/SoundManager/SoundManager.d.ts +12 -0
- package/dist/application/SoundManager/SoundManager.js +69 -22
- package/dist/application/SpeedState/SpeedLevelHandler.js +0 -2
- package/dist/application/setup.js +1 -1
- package/dist/components/AbstractBuyFreeSpins/AbstractBuyFreeSpinsPlate.js +1 -0
- package/dist/components/AbstractIntroScreen/AbstractIntroScreen.js +1 -0
- package/dist/components/AbstractMainContainer/AbstractMainContainer.js +4 -2
- package/dist/components/GambleGame/GambleGame.js +0 -1
- package/dist/components/dictionary/locales/en.json +2 -1
- package/dist/controllers/AbstractController.d.ts +3 -4
- package/dist/controllers/AbstractController.js +40 -31
- package/dist/controllers/index.d.ts +0 -1
- package/dist/controllers/index.js +0 -1
- package/dist/loading/AbstractLoadingContainer.d.ts +1 -0
- package/dist/loading/AbstractLoadingContainer.js +4 -5
- package/dist/loading/SpriteLoadingContainer.d.ts +10 -2
- package/dist/loading/SpriteLoadingContainer.js +53 -10
- package/dist/localStorage/localStorage.d.ts +0 -1
- package/dist/localStorage/localStorage.js +0 -1
- package/dist/stores/SettingsStore.d.ts +5 -13
- package/dist/stores/SettingsStore.js +22 -23
- package/dist/utils/common/functions.d.ts +1 -1
- package/dist/utils/common/functions.js +2 -3
- package/dist/utils/common/sound.js +5 -8
- package/package.json +1 -1
- package/dist/SettingsUI/components/SpeedSettingsPopup/index.d.ts +0 -7
- package/dist/SettingsUI/components/SpeedSettingsPopup/index.jsx +0 -27
- package/dist/SettingsUI/components/SpeedSettingsPopup/speedSettingsPopup.css +0 -159
- package/dist/controllers/QuickStopController.d.ts +0 -54
- package/dist/controllers/QuickStopController.js +0 -86
package/dist/Rainman/Rainman.js
CHANGED
|
@@ -37,7 +37,7 @@ export class RainMan {
|
|
|
37
37
|
isSuperBonusGameEnabled: false
|
|
38
38
|
};
|
|
39
39
|
this.initLocalStorageSettings();
|
|
40
|
-
RainMan.settingsStore.
|
|
40
|
+
RainMan.settingsStore.refreshBatterySaver();
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* Method for genereting a token or getting existing token for the game session.
|
|
@@ -57,13 +57,11 @@ export class RainMan {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
initLocalStorageSettings() {
|
|
60
|
-
setIfDoesntExistInLocalStorage(LOCAL_STORAGE.hiResolution, false);
|
|
61
60
|
setIfDoesntExistInLocalStorage(LOCAL_STORAGE.batterySaver, false);
|
|
62
61
|
setIfDoesntExistInLocalStorage(LOCAL_STORAGE.volumeLevel, 100);
|
|
63
62
|
setToLocalStorage(LOCAL_STORAGE.isSoundFxEnabled, true);
|
|
64
63
|
setToLocalStorage(LOCAL_STORAGE.isSoundEnabled, true);
|
|
65
64
|
setToLocalStorage(LOCAL_STORAGE.isSoundFxEnabled, true);
|
|
66
65
|
setToLocalStorage(LOCAL_STORAGE.isAmbientMusicEnabled, true);
|
|
67
|
-
setToLocalStorage(LOCAL_STORAGE.hiResolution, false);
|
|
68
66
|
}
|
|
69
67
|
}
|
package/dist/Rainman/types.d.ts
CHANGED
|
@@ -57,7 +57,6 @@ export type OptionalAppConfig = {
|
|
|
57
57
|
bonusWinMinimumTime: number;
|
|
58
58
|
superBonusWinPhaseTimeout: number;
|
|
59
59
|
superBonusWinMinimumTime: number;
|
|
60
|
-
speedPopupVisibleTime: number;
|
|
61
60
|
minAnimationTime: number;
|
|
62
61
|
};
|
|
63
62
|
constants: {
|
|
@@ -78,7 +77,6 @@ export interface Globals {
|
|
|
78
77
|
loadingContainerReference?: AbstractLoadingContainer;
|
|
79
78
|
getWebSocketConnection?: () => WebSocket;
|
|
80
79
|
actionsAfterClosureWebSocket?: () => void;
|
|
81
|
-
disableSpeedPopup?: (value: boolean) => void;
|
|
82
80
|
handleDisablingButtons?: (value?: boolean) => void;
|
|
83
81
|
throttledSpin?: () => void;
|
|
84
82
|
handleSpinLogic?: () => void;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import "./closeModalButton.css";
|
|
2
2
|
import { observer } from "mobx-react-lite";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import { UI_ITEMS } from "../../../utils";
|
|
5
4
|
import { useStores } from "../../hooks";
|
|
6
5
|
export const CloseModalButton = observer(({ layerId, afterClose }) => {
|
|
7
6
|
const { settingStore } = useStores();
|
|
@@ -9,10 +8,6 @@ export const CloseModalButton = observer(({ layerId, afterClose }) => {
|
|
|
9
8
|
const isBetDisabled = isFreeSpinsPlayEnabled || betChangeDisabled || isFreeSpinsBought;
|
|
10
9
|
const onClose = () => {
|
|
11
10
|
settingStore.handleModalInvocation?.(layerId);
|
|
12
|
-
if (layerId === UI_ITEMS.speedSettings) {
|
|
13
|
-
settingStore.setSpeedPopupVisibility?.("none");
|
|
14
|
-
settingStore.isSpeedModalShown = false;
|
|
15
|
-
}
|
|
16
11
|
if (!isBetDisabled) {
|
|
17
12
|
settingStore.enableButtons?.();
|
|
18
13
|
}
|
|
@@ -22,9 +22,6 @@ export const UXSettings = observer(() => {
|
|
|
22
22
|
<div className="ux-settings__switch">
|
|
23
23
|
<SwitchWithHeader header="Full screen mode" description="Turn on or off game fullscreen" flag={settingStore.fullScreenFlag} setFlag={settingStore.setFullScreenFlag}/>
|
|
24
24
|
</div>
|
|
25
|
-
<div className="ux-settings__switch">
|
|
26
|
-
<SwitchWithHeader header="HI resolution" description="Enable high resolution files" flag={settingStore.HiResolutionFlag} setFlag={settingStore.setHiResolutionFlag}/>
|
|
27
|
-
</div>
|
|
28
25
|
</div>
|
|
29
26
|
</div>);
|
|
30
27
|
});
|
|
@@ -5,7 +5,6 @@ export * from "./CloseModalButton";
|
|
|
5
5
|
export * from "./GameRules";
|
|
6
6
|
export * from "./OptionButton";
|
|
7
7
|
export * from "./SlidingSwitch";
|
|
8
|
-
export * from "./SpeedSettingsPopup";
|
|
9
8
|
export * from "./SwitchWithHeader";
|
|
10
9
|
export * from "./SymbolMultiplierPopup";
|
|
11
10
|
export * from "./UXSettings";
|
|
@@ -5,7 +5,6 @@ export * from "./CloseModalButton";
|
|
|
5
5
|
export * from "./GameRules";
|
|
6
6
|
export * from "./OptionButton";
|
|
7
7
|
export * from "./SlidingSwitch";
|
|
8
|
-
export * from "./SpeedSettingsPopup";
|
|
9
8
|
export * from "./SwitchWithHeader";
|
|
10
9
|
export * from "./SymbolMultiplierPopup";
|
|
11
10
|
export * from "./UXSettings";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./index.css";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { UI_ITEMS } from "../utils";
|
|
4
|
-
import { AutoplaySettings, BetSettings, BuyFreeSpinModal, GameRules,
|
|
4
|
+
import { AutoplaySettings, BetSettings, BuyFreeSpinModal, GameRules, SymbolMultiplierPopup, VolumeSettings } from "./components";
|
|
5
5
|
import { SystemSettingsComponent } from "./SystemSettings/SystemSettingsComponent";
|
|
6
6
|
export const SettingsUI = () => {
|
|
7
7
|
return (<>
|
|
@@ -17,11 +17,6 @@ export const SettingsUI = () => {
|
|
|
17
17
|
<div id={UI_ITEMS.autoplay} className="modal modal-style">
|
|
18
18
|
<AutoplaySettings />
|
|
19
19
|
</div>
|
|
20
|
-
<div id={UI_ITEMS.speedSettings} className=" modal-overlay">
|
|
21
|
-
<div className="speed-settings-modal modal-style">
|
|
22
|
-
<SpeedSettingsPopup />
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
20
|
<div id={UI_ITEMS.symbolPayTable}>
|
|
26
21
|
<SymbolMultiplierPopup />
|
|
27
22
|
</div>
|
|
@@ -29,12 +29,6 @@ export declare class ButtonsEventManager {
|
|
|
29
29
|
* @memberof ButtonsEventManager
|
|
30
30
|
*/
|
|
31
31
|
private lastLayerInvoked;
|
|
32
|
-
/**
|
|
33
|
-
* Speed popup shown at for measuring time of showing speed popup
|
|
34
|
-
* @public
|
|
35
|
-
* @memberof ButtonsEventManager
|
|
36
|
-
*/
|
|
37
|
-
speedPopupShownAt: number;
|
|
38
32
|
/**
|
|
39
33
|
* Function for enabling/disabling buttons in game
|
|
40
34
|
* @private
|
|
@@ -57,13 +51,6 @@ export declare class ButtonsEventManager {
|
|
|
57
51
|
*/
|
|
58
52
|
disableButtons: () => void;
|
|
59
53
|
constructor();
|
|
60
|
-
/**
|
|
61
|
-
* Method for initializing events in Settings UI
|
|
62
|
-
* This method also change the incentive text based on the selected speed level
|
|
63
|
-
* @public
|
|
64
|
-
* @returns {void}
|
|
65
|
-
*/
|
|
66
|
-
initSettingsEvents(): void;
|
|
67
54
|
/**
|
|
68
55
|
* Method for setting up animated background
|
|
69
56
|
* @public
|
|
@@ -134,13 +121,12 @@ export declare class ButtonsEventManager {
|
|
|
134
121
|
*/
|
|
135
122
|
initTakeButton(onClick: () => void, disabled: boolean): void;
|
|
136
123
|
/**
|
|
137
|
-
*
|
|
138
|
-
* This
|
|
124
|
+
* Method for initializing events in Settings UI
|
|
125
|
+
* This method also change the incentive text based on the selected speed level
|
|
139
126
|
* @public
|
|
140
|
-
* @param {("flex" | "none")} displayValue - flag for displaying modal
|
|
141
127
|
* @returns {void}
|
|
142
128
|
*/
|
|
143
|
-
|
|
129
|
+
initSettingsEvents(): void;
|
|
144
130
|
/**
|
|
145
131
|
* Function for handling autostart conformation
|
|
146
132
|
* @public
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import i18n from "i18next";
|
|
2
2
|
import { sample } from "lodash";
|
|
3
|
-
import { SoundManager, SoundTracks } from "../../application";
|
|
3
|
+
import { SoundManager, SoundTracks, SPEED_LEVELS } from "../../application";
|
|
4
4
|
import { AutoplayButton, Background, BUTTONS, COMPONENTS, FreeSpinButton, MessageBox, VolumeButton } from "../../components";
|
|
5
5
|
import { RainMan } from "../../Rainman";
|
|
6
6
|
import { allUiItems, hideLayerIfPresent, UI_ITEMS, wait } from "../../utils";
|
|
7
|
-
import { SPEED_LEVELS } from "../SpeedState";
|
|
8
7
|
/** @ignore */
|
|
9
8
|
export const SPEED_PREFIX = "speed-";
|
|
10
9
|
/**
|
|
@@ -34,12 +33,6 @@ export class ButtonsEventManager {
|
|
|
34
33
|
* @memberof ButtonsEventManager
|
|
35
34
|
*/
|
|
36
35
|
lastLayerInvoked = "";
|
|
37
|
-
/**
|
|
38
|
-
* Speed popup shown at for measuring time of showing speed popup
|
|
39
|
-
* @public
|
|
40
|
-
* @memberof ButtonsEventManager
|
|
41
|
-
*/
|
|
42
|
-
speedPopupShownAt = 0;
|
|
43
36
|
/**
|
|
44
37
|
* Function for enabling/disabling buttons in game
|
|
45
38
|
* @private
|
|
@@ -67,87 +60,10 @@ export class ButtonsEventManager {
|
|
|
67
60
|
disableButtons = this.setButtonAvailability(true);
|
|
68
61
|
constructor() {
|
|
69
62
|
RainMan.settingsStore.handleModalInvocation = this.handleModalInvocation.bind(this);
|
|
70
|
-
RainMan.settingsStore.setSpeedPopupVisibility = this.setSpeedPopupVisibility.bind(this);
|
|
71
63
|
RainMan.settingsStore.enableButtons = this.enableButtons.bind(this);
|
|
72
64
|
RainMan.settingsStore.closeOtherModals = this.closeOtherModals.bind(this);
|
|
73
65
|
RainMan.settingsStore.closeCurrentlyOpenModal = this.closeCurrentlyOpenModal.bind(this);
|
|
74
66
|
}
|
|
75
|
-
/**
|
|
76
|
-
* Method for initializing events in Settings UI
|
|
77
|
-
* This method also change the incentive text based on the selected speed level
|
|
78
|
-
* @public
|
|
79
|
-
* @returns {void}
|
|
80
|
-
*/
|
|
81
|
-
initSettingsEvents() {
|
|
82
|
-
const messageBox = RainMan.componentRegistry.get(MessageBox.registryName);
|
|
83
|
-
if (this.settingsSpeedButton === null) {
|
|
84
|
-
const speedLevelButton = window.document.getElementsByClassName("speed-level-id");
|
|
85
|
-
if (speedLevelButton.length !== 0) {
|
|
86
|
-
const numberOfReactSpeedButtons = 2;
|
|
87
|
-
for (let i = 0; i < numberOfReactSpeedButtons; i++) {
|
|
88
|
-
this.settingsSpeedButton = speedLevelButton.item(i);
|
|
89
|
-
if (this.settingsSpeedButton) {
|
|
90
|
-
this.settingsSpeedButton.addEventListener("click", () => {
|
|
91
|
-
RainMan.componentRegistry.nextSpeedLevel();
|
|
92
|
-
if (RainMan.settingsStore.currentSpeed === SPEED_LEVELS.fast ||
|
|
93
|
-
RainMan.settingsStore.currentSpeed === SPEED_LEVELS.normal) {
|
|
94
|
-
RainMan.globals.disableSpeedPopup?.(true);
|
|
95
|
-
}
|
|
96
|
-
messageBox.updateIncentiveText(sample(i18n.t("idleMessages", { returnObjects: true })[RainMan.componentRegistry.getSpeedLevel()]));
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
if (this.settingsSpeedTurtle === null) {
|
|
103
|
-
this.settingsSpeedTurtle = window.document.getElementById(`${SPEED_PREFIX}${SPEED_LEVELS.slow}`);
|
|
104
|
-
if (this.settingsSpeedTurtle !== null) {
|
|
105
|
-
this.settingsSpeedTurtle.addEventListener("click", () => {
|
|
106
|
-
RainMan.componentRegistry.setSpeedLevel(SPEED_LEVELS.slow);
|
|
107
|
-
this.setSpeedPopupVisibility("none");
|
|
108
|
-
this.enableButtons();
|
|
109
|
-
RainMan.settingsStore.isSpeedModalShown = false;
|
|
110
|
-
messageBox.updateIncentiveText(i18n.t("turtleSelected"));
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
if (this.settingsSpeedRabbit === null) {
|
|
115
|
-
this.settingsSpeedRabbit = window.document.getElementById(`${SPEED_PREFIX}${SPEED_LEVELS.normal}`);
|
|
116
|
-
if (this.settingsSpeedRabbit !== null) {
|
|
117
|
-
this.settingsSpeedRabbit.addEventListener("click", () => {
|
|
118
|
-
RainMan.componentRegistry.setSpeedLevel(SPEED_LEVELS.normal);
|
|
119
|
-
this.setSpeedPopupVisibility("none");
|
|
120
|
-
RainMan.settingsStore.isSpeedModalShown = false;
|
|
121
|
-
this.enableButtons();
|
|
122
|
-
messageBox.updateIncentiveText(i18n.t("rabbitSelected"));
|
|
123
|
-
RainMan.globals.disableSpeedPopup?.(true);
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
if (this.settingsSpeedCheetah === null) {
|
|
128
|
-
this.settingsSpeedCheetah = window.document.getElementById(`${SPEED_PREFIX}${SPEED_LEVELS.fast}`);
|
|
129
|
-
if (this.settingsSpeedCheetah !== null) {
|
|
130
|
-
this.settingsSpeedCheetah.addEventListener("click", () => {
|
|
131
|
-
RainMan.componentRegistry.setSpeedLevel(SPEED_LEVELS.fast);
|
|
132
|
-
this.setSpeedPopupVisibility("none");
|
|
133
|
-
this.enableButtons();
|
|
134
|
-
RainMan.settingsStore.isSpeedModalShown = false;
|
|
135
|
-
messageBox.updateIncentiveText(i18n.t("cheetahSelected"));
|
|
136
|
-
RainMan.globals.disableSpeedPopup?.(true);
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
document.addEventListener("fullscreenchange", () => {
|
|
141
|
-
if (document.fullscreenElement) {
|
|
142
|
-
RainMan.settingsStore.setFullScreenFlag(true);
|
|
143
|
-
window.dispatchEvent(new Event("resize"));
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
RainMan.settingsStore.setFullScreenFlag(false);
|
|
147
|
-
window.dispatchEvent(new Event("resize"));
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
67
|
/**
|
|
152
68
|
* Method for setting up animated background
|
|
153
69
|
* @public
|
|
@@ -310,20 +226,71 @@ export class ButtonsEventManager {
|
|
|
310
226
|
RainMan.componentRegistry.get(BUTTONS.take).flipDisabledFlag(disabled);
|
|
311
227
|
}
|
|
312
228
|
/**
|
|
313
|
-
*
|
|
314
|
-
* This
|
|
229
|
+
* Method for initializing events in Settings UI
|
|
230
|
+
* This method also change the incentive text based on the selected speed level
|
|
315
231
|
* @public
|
|
316
|
-
* @param {("flex" | "none")} displayValue - flag for displaying modal
|
|
317
232
|
* @returns {void}
|
|
318
233
|
*/
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
234
|
+
initSettingsEvents() {
|
|
235
|
+
const messageBox = RainMan.componentRegistry.get(MessageBox.registryName);
|
|
236
|
+
if (this.settingsSpeedButton === null) {
|
|
237
|
+
const speedLevelButton = window.document.getElementsByClassName("speed-level-id");
|
|
238
|
+
if (speedLevelButton.length !== 0) {
|
|
239
|
+
const numberOfReactSpeedButtons = 2;
|
|
240
|
+
for (let i = 0; i < numberOfReactSpeedButtons; i++) {
|
|
241
|
+
this.settingsSpeedButton = speedLevelButton.item(i);
|
|
242
|
+
if (this.settingsSpeedButton) {
|
|
243
|
+
this.settingsSpeedButton.addEventListener("click", () => {
|
|
244
|
+
RainMan.componentRegistry.nextSpeedLevel();
|
|
245
|
+
messageBox.updateIncentiveText(sample(i18n.t("idleMessages", { returnObjects: true })[RainMan.componentRegistry.getSpeedLevel()]));
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if (this.settingsSpeedTurtle === null) {
|
|
252
|
+
this.settingsSpeedTurtle = window.document.getElementById(`${SPEED_PREFIX}${SPEED_LEVELS.slow}`);
|
|
253
|
+
if (this.settingsSpeedTurtle !== null) {
|
|
254
|
+
this.settingsSpeedTurtle.addEventListener("click", () => {
|
|
255
|
+
RainMan.componentRegistry.setSpeedLevel(SPEED_LEVELS.slow);
|
|
256
|
+
this.enableButtons();
|
|
257
|
+
RainMan.settingsStore.isSpeedModalShown = false;
|
|
258
|
+
messageBox.updateIncentiveText(i18n.t("turtleSelected"));
|
|
259
|
+
});
|
|
260
|
+
}
|
|
326
261
|
}
|
|
262
|
+
if (this.settingsSpeedRabbit === null) {
|
|
263
|
+
this.settingsSpeedRabbit = window.document.getElementById(`${SPEED_PREFIX}${SPEED_LEVELS.normal}`);
|
|
264
|
+
if (this.settingsSpeedRabbit !== null) {
|
|
265
|
+
this.settingsSpeedRabbit.addEventListener("click", () => {
|
|
266
|
+
RainMan.componentRegistry.setSpeedLevel(SPEED_LEVELS.normal);
|
|
267
|
+
RainMan.settingsStore.isSpeedModalShown = false;
|
|
268
|
+
this.enableButtons();
|
|
269
|
+
messageBox.updateIncentiveText(i18n.t("rabbitSelected"));
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
if (this.settingsSpeedCheetah === null) {
|
|
274
|
+
this.settingsSpeedCheetah = window.document.getElementById(`${SPEED_PREFIX}${SPEED_LEVELS.fast}`);
|
|
275
|
+
if (this.settingsSpeedCheetah !== null) {
|
|
276
|
+
this.settingsSpeedCheetah.addEventListener("click", () => {
|
|
277
|
+
RainMan.componentRegistry.setSpeedLevel(SPEED_LEVELS.fast);
|
|
278
|
+
this.enableButtons();
|
|
279
|
+
RainMan.settingsStore.isSpeedModalShown = false;
|
|
280
|
+
messageBox.updateIncentiveText(i18n.t("cheetahSelected"));
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
document.addEventListener("fullscreenchange", () => {
|
|
285
|
+
if (document.fullscreenElement) {
|
|
286
|
+
RainMan.settingsStore.setFullScreenFlag(true);
|
|
287
|
+
window.dispatchEvent(new Event("resize"));
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
RainMan.settingsStore.setFullScreenFlag(false);
|
|
291
|
+
window.dispatchEvent(new Event("resize"));
|
|
292
|
+
}
|
|
293
|
+
});
|
|
327
294
|
}
|
|
328
295
|
/**
|
|
329
296
|
* Function for handling autostart conformation
|
|
@@ -15,6 +15,7 @@ export declare class SoundManagerInstance implements SpeedAdapterInterface<Sound
|
|
|
15
15
|
private overrides;
|
|
16
16
|
readonly speedLevelMapper: SpeedLevelDirectory<SoundOverrides>;
|
|
17
17
|
private musicCatalogue;
|
|
18
|
+
private currentAmbientTrack;
|
|
18
19
|
constructor();
|
|
19
20
|
/**
|
|
20
21
|
* Function for loading sounds into pixi
|
|
@@ -36,6 +37,7 @@ export declare class SoundManagerInstance implements SpeedAdapterInterface<Sound
|
|
|
36
37
|
* @returns {void}
|
|
37
38
|
*/
|
|
38
39
|
stopPlayingFxSounds(): void;
|
|
40
|
+
stopSoundsForPageHide(): void;
|
|
39
41
|
/**
|
|
40
42
|
* Function for resuming and pausing sound in game
|
|
41
43
|
* @public
|
|
@@ -57,6 +59,10 @@ export declare class SoundManagerInstance implements SpeedAdapterInterface<Sound
|
|
|
57
59
|
* @returns {number} The volume level for the sound track.
|
|
58
60
|
*/
|
|
59
61
|
getVolumeLevel(soundName: SoundTrack): number;
|
|
62
|
+
private isAmbientTrack;
|
|
63
|
+
private getOppositeAmbientTrack;
|
|
64
|
+
private getSound;
|
|
65
|
+
stopAmbientMusic(): void;
|
|
60
66
|
/**
|
|
61
67
|
* Function for resuming all sounds in game
|
|
62
68
|
* If sound is not playing, it will be skipped
|
|
@@ -112,6 +118,12 @@ export declare class SoundManagerInstance implements SpeedAdapterInterface<Sound
|
|
|
112
118
|
* @returns {void}
|
|
113
119
|
*/
|
|
114
120
|
stop(soundName: SoundTrack): void;
|
|
121
|
+
/**
|
|
122
|
+
* Function that resumes sounds and music when game is back in focus.
|
|
123
|
+
* @public
|
|
124
|
+
* @returns {void}
|
|
125
|
+
*/
|
|
126
|
+
resumeAudioContext(): Promise<boolean>;
|
|
115
127
|
/**
|
|
116
128
|
* Function that resumes sounds and music when game is back in focus.
|
|
117
129
|
* @public
|
|
@@ -25,6 +25,7 @@ export class SoundManagerInstance {
|
|
|
25
25
|
slow: {}
|
|
26
26
|
};
|
|
27
27
|
musicCatalogue = new Map();
|
|
28
|
+
currentAmbientTrack = null;
|
|
28
29
|
constructor() {
|
|
29
30
|
this.overrides = this.speedLevelMapper.slow;
|
|
30
31
|
}
|
|
@@ -88,6 +89,20 @@ export class SoundManagerInstance {
|
|
|
88
89
|
sound.stop();
|
|
89
90
|
}
|
|
90
91
|
}
|
|
92
|
+
stopSoundsForPageHide() {
|
|
93
|
+
const music = this.getSound(SoundTracks.music);
|
|
94
|
+
const freeSpinsMusic = this.getSound(SoundTracks.freeSpinsMusic);
|
|
95
|
+
const isMusicPlaying = Boolean(music?.isPlaying && !music.paused);
|
|
96
|
+
const isFreeSpinsMusicPlaying = Boolean(freeSpinsMusic?.isPlaying && !freeSpinsMusic.paused);
|
|
97
|
+
if (isFreeSpinsMusicPlaying) {
|
|
98
|
+
this.currentAmbientTrack = SoundTracks.freeSpinsMusic;
|
|
99
|
+
}
|
|
100
|
+
else if (isMusicPlaying) {
|
|
101
|
+
this.currentAmbientTrack = SoundTracks.music;
|
|
102
|
+
}
|
|
103
|
+
this.stopAmbientMusic();
|
|
104
|
+
this.stopPlayingFxSounds();
|
|
105
|
+
}
|
|
91
106
|
/**
|
|
92
107
|
* Function for resuming and pausing sound in game
|
|
93
108
|
* @public
|
|
@@ -105,24 +120,30 @@ export class SoundManagerInstance {
|
|
|
105
120
|
* @returns {void}
|
|
106
121
|
*/
|
|
107
122
|
play(soundName) {
|
|
108
|
-
if (!RainMan.settingsStore.
|
|
109
|
-
!(soundName === SoundTracks.music || soundName === SoundTracks.freeSpinsMusic)) {
|
|
123
|
+
if (!RainMan.settingsStore.isSoundStarted) {
|
|
110
124
|
return;
|
|
111
125
|
}
|
|
112
|
-
|
|
113
|
-
const sound = overrideSoundName
|
|
114
|
-
? this.musicCatalogue.get(overrideSoundName)
|
|
115
|
-
: this.musicCatalogue.get(soundName);
|
|
116
|
-
if (!sound) {
|
|
126
|
+
if (!RainMan.settingsStore.shouldPlayFxSounds && !this.isAmbientTrack(soundName)) {
|
|
117
127
|
return;
|
|
118
128
|
}
|
|
119
|
-
|
|
129
|
+
const sound = this.getSound(soundName);
|
|
130
|
+
if (!sound) {
|
|
120
131
|
return;
|
|
121
132
|
}
|
|
122
|
-
if (soundName
|
|
123
|
-
!RainMan.settingsStore.
|
|
124
|
-
|
|
125
|
-
|
|
133
|
+
if (this.isAmbientTrack(soundName)) {
|
|
134
|
+
if (!RainMan.settingsStore.shouldPlayAmbientMusic) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const oppositeAmbientTrack = this.getOppositeAmbientTrack(soundName);
|
|
138
|
+
this.stop(oppositeAmbientTrack);
|
|
139
|
+
this.currentAmbientTrack = soundName;
|
|
140
|
+
if (sound.isPlaying && !sound.paused) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
if (sound.isPlaying && sound.paused) {
|
|
144
|
+
sound.resume();
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
126
147
|
}
|
|
127
148
|
sound.play({
|
|
128
149
|
singleInstance: true,
|
|
@@ -145,6 +166,20 @@ export class SoundManagerInstance {
|
|
|
145
166
|
return Number(RainMan.settingsStore.volumeLevel / 100);
|
|
146
167
|
}
|
|
147
168
|
}
|
|
169
|
+
isAmbientTrack(soundName) {
|
|
170
|
+
return soundName === SoundTracks.music || soundName === SoundTracks.freeSpinsMusic;
|
|
171
|
+
}
|
|
172
|
+
getOppositeAmbientTrack(soundName) {
|
|
173
|
+
return soundName === SoundTracks.freeSpinsMusic ? SoundTracks.music : SoundTracks.freeSpinsMusic;
|
|
174
|
+
}
|
|
175
|
+
getSound(soundName) {
|
|
176
|
+
const overrideSoundName = this.overrides[soundName];
|
|
177
|
+
return this.musicCatalogue.get(overrideSoundName ?? soundName);
|
|
178
|
+
}
|
|
179
|
+
stopAmbientMusic() {
|
|
180
|
+
this.stop(SoundTracks.music);
|
|
181
|
+
this.stop(SoundTracks.freeSpinsMusic);
|
|
182
|
+
}
|
|
148
183
|
/**
|
|
149
184
|
* Function for resuming all sounds in game
|
|
150
185
|
* If sound is not playing, it will be skipped
|
|
@@ -152,6 +187,9 @@ export class SoundManagerInstance {
|
|
|
152
187
|
* @returns {void}
|
|
153
188
|
*/
|
|
154
189
|
resumeAll() {
|
|
190
|
+
if (!RainMan.settingsStore.isSoundStarted) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
155
193
|
this.musicCatalogue.forEach((sound, soundName) => {
|
|
156
194
|
if (sound.paused && sound.isPlaying && sound) {
|
|
157
195
|
sound.resume();
|
|
@@ -176,17 +214,15 @@ export class SoundManagerInstance {
|
|
|
176
214
|
* @returns {void}
|
|
177
215
|
*/
|
|
178
216
|
restoreAmbientPlayback() {
|
|
179
|
-
if (!RainMan.settingsStore.
|
|
217
|
+
if (!RainMan.settingsStore.isSoundStarted) {
|
|
180
218
|
return;
|
|
181
219
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
: SoundTracks.music;
|
|
185
|
-
const ambientMusic = this.musicCatalogue.get(ambientTrack);
|
|
186
|
-
if (!ambientMusic || ambientMusic.isPlaying) {
|
|
220
|
+
if (!RainMan.settingsStore.shouldPlayAmbientMusic) {
|
|
221
|
+
this.stopAmbientMusic();
|
|
187
222
|
return;
|
|
188
223
|
}
|
|
189
|
-
|
|
224
|
+
const ambientTrack = this.currentAmbientTrack ??
|
|
225
|
+
(RainMan.settingsStore.isFreeSpinsStarted ? SoundTracks.freeSpinsMusic : SoundTracks.music);
|
|
190
226
|
this.play(ambientTrack);
|
|
191
227
|
}
|
|
192
228
|
/**
|
|
@@ -248,7 +284,7 @@ export class SoundManagerInstance {
|
|
|
248
284
|
* @public
|
|
249
285
|
* @returns {void}
|
|
250
286
|
*/
|
|
251
|
-
async
|
|
287
|
+
async resumeAudioContext() {
|
|
252
288
|
const pixiSoundContext = sound.context;
|
|
253
289
|
const audioContext = pixiSoundContext.audioContext;
|
|
254
290
|
const state = audioContext.state;
|
|
@@ -260,10 +296,21 @@ export class SoundManagerInstance {
|
|
|
260
296
|
console.error("Could not resume audio", error);
|
|
261
297
|
}
|
|
262
298
|
}
|
|
263
|
-
|
|
299
|
+
return this.isAudioContextRunning();
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Function that resumes sounds and music when game is back in focus.
|
|
303
|
+
* @public
|
|
304
|
+
* @returns {void}
|
|
305
|
+
*/
|
|
306
|
+
async resumeOnFocus() {
|
|
307
|
+
if (!RainMan.settingsStore.isSoundStarted) {
|
|
308
|
+
return false;
|
|
309
|
+
}
|
|
310
|
+
const isAudioContextRunning = await this.resumeAudioContext();
|
|
311
|
+
if (!isAudioContextRunning) {
|
|
264
312
|
return false;
|
|
265
313
|
}
|
|
266
|
-
sound.resumeAll();
|
|
267
314
|
this.restoreAmbientPlayback();
|
|
268
315
|
return true;
|
|
269
316
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { RainMan } from "../../Rainman";
|
|
2
1
|
import { DEFAULT_SPEED, SPEED_LEVELS } from "./SpeedLevel";
|
|
3
2
|
/**
|
|
4
3
|
* Class for handling speed levels
|
|
@@ -59,7 +58,6 @@ export class SpeedLevelHandler {
|
|
|
59
58
|
* @returns {void}
|
|
60
59
|
*/
|
|
61
60
|
nextSpeed() {
|
|
62
|
-
RainMan.globals.disableSpeedPopup?.(true);
|
|
63
61
|
if (this.shouldResetSpeedOptionsLoop()) {
|
|
64
62
|
this.chosenSpeedLevel = 0;
|
|
65
63
|
return;
|
|
@@ -9,7 +9,7 @@ import { changeResolution, disableMagnifyingGlassOnIOS, getDeviceOrientation, in
|
|
|
9
9
|
* @returns {ReactNode} the root element with canvas and react layer
|
|
10
10
|
*/
|
|
11
11
|
export const setup = () => {
|
|
12
|
-
changeResolution(
|
|
12
|
+
changeResolution();
|
|
13
13
|
resizeCanvas();
|
|
14
14
|
setupFullscreenForIOS();
|
|
15
15
|
loadSoundsOnTabChange();
|
|
@@ -549,8 +549,11 @@ export class AbstractMainContainer extends Container {
|
|
|
549
549
|
async invokeGambleGame() {
|
|
550
550
|
if (!this.gambleGameSpineName)
|
|
551
551
|
return;
|
|
552
|
+
const gambleWinAmount = this._controller?.freeSpinsWin && this._controller.freeSpinsWin > 0
|
|
553
|
+
? this._controller.freeSpinsWin
|
|
554
|
+
: this._controller.lastWinAmount;
|
|
552
555
|
await new Promise((resolve) => {
|
|
553
|
-
this.gambleGame = new GambleGame(this.gambleGameSpineName, resolve,
|
|
556
|
+
this.gambleGame = new GambleGame(this.gambleGameSpineName, resolve, gambleWinAmount, this._controller.balance);
|
|
554
557
|
RainMan.settingsStore.isGambleGameActive = true;
|
|
555
558
|
this.showOverlay();
|
|
556
559
|
this.addChild(this.gambleGame);
|
|
@@ -562,7 +565,6 @@ export class AbstractMainContainer extends Container {
|
|
|
562
565
|
this._controller.updateGambleValues(RainMan.settingsStore.gambleGameWin);
|
|
563
566
|
this.gambleGame = null;
|
|
564
567
|
}
|
|
565
|
-
this._controller?.updateBalance();
|
|
566
568
|
this.hideOverlay();
|
|
567
569
|
}
|
|
568
570
|
/**
|
|
@@ -174,7 +174,6 @@ export class GambleGame extends Container {
|
|
|
174
174
|
this.blackButton.flipDisabledFlag(true);
|
|
175
175
|
this.card.state.addAnimation(0, "wait", true, 0);
|
|
176
176
|
const gambleData = await window.connectionWrapper.fetchGambleData(RainMan.settingsStore.roundNumber, this.lastWinAmount, choice);
|
|
177
|
-
this.balanceValue = gambleData.balanceAfterSpin;
|
|
178
177
|
await new Promise((resolve) => {
|
|
179
178
|
this.card.state.clearTracks();
|
|
180
179
|
this.card.state.clearListeners();
|