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
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { first, last, range } from "lodash";
|
|
2
2
|
import { action, computed, makeAutoObservable, observable } from "mobx";
|
|
3
|
-
import {
|
|
3
|
+
import { Ticker } from "pixi.js";
|
|
4
|
+
import { SoundManager } from "../application";
|
|
4
5
|
import { BUTTONS } from "../components";
|
|
5
6
|
import { PaytableTypes } from "../constants";
|
|
6
7
|
import { getFromLocalStorage, LOCAL_STORAGE, removeFromLocalStorage, setToLocalStorage } from "../localStorage";
|
|
7
8
|
import { RainMan } from "../Rainman";
|
|
8
|
-
import {
|
|
9
|
+
import { logError } from "../utils";
|
|
9
10
|
const INITIAL_AUTO_SPIN_COUNT = 50;
|
|
11
|
+
const BATTERY_SAVER_MAX_FPS = 30;
|
|
10
12
|
/**
|
|
11
13
|
* This class represents global state of pixi and react application
|
|
12
14
|
* @class SettingsStore
|
|
@@ -19,6 +21,7 @@ export class SettingsStore {
|
|
|
19
21
|
isQuickSpinsActive = false;
|
|
20
22
|
bet = 0;
|
|
21
23
|
betText = "";
|
|
24
|
+
isSoundStarted = false;
|
|
22
25
|
shouldPlayAmbientMusic = true;
|
|
23
26
|
shouldPlayFxSounds = true;
|
|
24
27
|
fullScreenFlag = false;
|
|
@@ -34,7 +37,6 @@ export class SettingsStore {
|
|
|
34
37
|
infinitySpinsEnabled = false;
|
|
35
38
|
roundNumber = 0;
|
|
36
39
|
reelSetId = 0;
|
|
37
|
-
HiResolutionFlag = getFromLocalStorage(LOCAL_STORAGE.hiResolution, false);
|
|
38
40
|
batterySaverFlag = getFromLocalStorage(LOCAL_STORAGE.batterySaver, false);
|
|
39
41
|
isGambleGameAvailable = true;
|
|
40
42
|
isGambleGameActive = false;
|
|
@@ -48,7 +50,6 @@ export class SettingsStore {
|
|
|
48
50
|
howManyFreeSpinsLeft = 0;
|
|
49
51
|
balanceAfterSpin = 0;
|
|
50
52
|
howManyAutoSpinsLeft = INITIAL_AUTO_SPIN_COUNT;
|
|
51
|
-
// public freeSpinBuyTable: Record<number, number> = {};
|
|
52
53
|
freeSpinsBuyOptions = [];
|
|
53
54
|
jokerBuyOptions = [];
|
|
54
55
|
gameBuyTypes = [];
|
|
@@ -62,8 +63,8 @@ export class SettingsStore {
|
|
|
62
63
|
disableBigWin = false;
|
|
63
64
|
isAfterFreeSpinsSummary = true;
|
|
64
65
|
isSpeedModalShown = false;
|
|
66
|
+
isFreeSpinsStarted = false;
|
|
65
67
|
reinitData;
|
|
66
|
-
setSpeedPopupVisibility;
|
|
67
68
|
popupPaytableRepositionCallback;
|
|
68
69
|
updateVolumeButtonTexture;
|
|
69
70
|
handleModalInvocation;
|
|
@@ -95,10 +96,10 @@ export class SettingsStore {
|
|
|
95
96
|
makeAutoObservable(this, {
|
|
96
97
|
setBatteryFlag: action.bound,
|
|
97
98
|
setBalanceAfterSpin: action.bound,
|
|
99
|
+
startSound: action.bound,
|
|
98
100
|
setShouldPlayAmbientMusic: action.bound,
|
|
99
101
|
setShouldPlayFxSounds: action.bound,
|
|
100
102
|
setFullScreenFlag: action.bound,
|
|
101
|
-
setHiResolutionFlag: action.bound,
|
|
102
103
|
setSpeedLevel: action.bound,
|
|
103
104
|
setVolumeLevel: action.bound,
|
|
104
105
|
setOnAnyWin: action.bound,
|
|
@@ -218,8 +219,7 @@ export class SettingsStore {
|
|
|
218
219
|
/**
|
|
219
220
|
* Sets the free spins price table.
|
|
220
221
|
* @public
|
|
221
|
-
* @param freeSpinsBuyOptions
|
|
222
|
-
* @param {Record<number, number>} freeSpinsPriceTable table with free spins prices
|
|
222
|
+
* @param {FreeSpinsBuyOption[]} freeSpinsBuyOptions array with free spins buy options
|
|
223
223
|
* @returns {void}
|
|
224
224
|
*/
|
|
225
225
|
setFreeSpinsBuyOptions(freeSpinsBuyOptions) {
|
|
@@ -237,8 +237,7 @@ export class SettingsStore {
|
|
|
237
237
|
/**
|
|
238
238
|
* Sets the free spins price table.
|
|
239
239
|
* @public
|
|
240
|
-
* @param buyTypes
|
|
241
|
-
* @param {Record<number, number>} jokerBuyOption table with free spins prices
|
|
240
|
+
* @param {BuyType[]} buyTypes array with available buy types
|
|
242
241
|
* @returns {void}
|
|
243
242
|
*/
|
|
244
243
|
setGameBuyTypes(buyTypes) {
|
|
@@ -279,6 +278,9 @@ export class SettingsStore {
|
|
|
279
278
|
* @returns {void}
|
|
280
279
|
*/
|
|
281
280
|
refreshBatterySaver() {
|
|
281
|
+
const maxFPS = this.batterySaverFlag ? BATTERY_SAVER_MAX_FPS : 0;
|
|
282
|
+
RainMan.app.ticker.maxFPS = maxFPS;
|
|
283
|
+
Ticker.shared.maxFPS = maxFPS;
|
|
282
284
|
this.containersWithSpines.forEach((spine) => spine.setAnimationTimescale(!this.batterySaverFlag));
|
|
283
285
|
}
|
|
284
286
|
/**
|
|
@@ -290,13 +292,22 @@ export class SettingsStore {
|
|
|
290
292
|
*/
|
|
291
293
|
setShouldPlayAmbientMusic(flag, saveToLocalStorage = true) {
|
|
292
294
|
this.shouldPlayAmbientMusic = flag;
|
|
293
|
-
|
|
295
|
+
if (!flag) {
|
|
296
|
+
SoundManager.stopAmbientMusic();
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
SoundManager.restoreAmbientPlayback();
|
|
300
|
+
}
|
|
294
301
|
this.updateVolumeButtonTexture?.();
|
|
295
302
|
if (saveToLocalStorage) {
|
|
296
303
|
setToLocalStorage(LOCAL_STORAGE.isAmbientMusicEnabled, flag);
|
|
297
304
|
removeFromLocalStorage(LOCAL_STORAGE.isSoundEnabled);
|
|
298
305
|
}
|
|
299
306
|
}
|
|
307
|
+
startSound() {
|
|
308
|
+
this.isSoundStarted = true;
|
|
309
|
+
void SoundManager.resumeAudioContext();
|
|
310
|
+
}
|
|
300
311
|
/**
|
|
301
312
|
* Sets flag for effect sounds
|
|
302
313
|
* @public
|
|
@@ -365,18 +376,6 @@ export class SettingsStore {
|
|
|
365
376
|
window.document.exitFullscreen();
|
|
366
377
|
}
|
|
367
378
|
}
|
|
368
|
-
/**
|
|
369
|
-
* Sets the high resolution flag.
|
|
370
|
-
* @public
|
|
371
|
-
* @param {boolean} flag - New value for high resolution flag.
|
|
372
|
-
* @returns {void}
|
|
373
|
-
*/
|
|
374
|
-
setHiResolutionFlag(flag) {
|
|
375
|
-
this.HiResolutionFlag = flag;
|
|
376
|
-
setToLocalStorage(LOCAL_STORAGE.hiResolution, flag);
|
|
377
|
-
changeResolution(flag);
|
|
378
|
-
window.dispatchEvent(new Event("resize"));
|
|
379
|
-
}
|
|
380
379
|
/**
|
|
381
380
|
* Sets the temporary speed flag.
|
|
382
381
|
* @public
|
|
@@ -77,7 +77,7 @@ export declare const setTimeScale: (spine: Spine, flag: boolean) => void;
|
|
|
77
77
|
* @param {boolean} high should be true for high resolution, false for low resolution
|
|
78
78
|
* @returns {void}
|
|
79
79
|
*/
|
|
80
|
-
export declare const changeResolution: (
|
|
80
|
+
export declare const changeResolution: () => void;
|
|
81
81
|
/**
|
|
82
82
|
* Helper function for checking if the value is not null or undefined
|
|
83
83
|
* @template T
|
|
@@ -145,9 +145,8 @@ export const setTimeScale = (spine, flag) => {
|
|
|
145
145
|
* @param {boolean} high should be true for high resolution, false for low resolution
|
|
146
146
|
* @returns {void}
|
|
147
147
|
*/
|
|
148
|
-
export const changeResolution = (
|
|
149
|
-
const
|
|
150
|
-
const resolution = high ? window.devicePixelRatio : lowRes;
|
|
148
|
+
export const changeResolution = () => {
|
|
149
|
+
const resolution = window.devicePixelRatio;
|
|
151
150
|
RainMan.app.renderer.resolution = resolution;
|
|
152
151
|
RainMan.app.renderer.resize(RainMan.app.screen.width, RainMan.app.screen.height);
|
|
153
152
|
};
|
|
@@ -24,7 +24,7 @@ const pauseAudio = () => {
|
|
|
24
24
|
shouldResumeAudioOnInterruption = false;
|
|
25
25
|
removeInterruptedAudioResumeListeners();
|
|
26
26
|
if (RainMan.settingsStore.isSoundEnabled()) {
|
|
27
|
-
SoundManager.
|
|
27
|
+
SoundManager.stopSoundsForPageHide();
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
@@ -40,13 +40,10 @@ const resumeAudio = async () => {
|
|
|
40
40
|
}
|
|
41
41
|
isResumingAudio = true;
|
|
42
42
|
try {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
SoundManager.resumeAll();
|
|
43
|
+
const hasResumedAudioContext = await SoundManager.resumeOnFocus();
|
|
44
|
+
if (!hasResumedAudioContext) {
|
|
45
|
+
interruptedAudioResume();
|
|
46
|
+
return;
|
|
50
47
|
}
|
|
51
48
|
if (SoundManager.isAudioContextRunning()) {
|
|
52
49
|
shouldResumeAudioOnInterruption = false;
|
package/package.json
CHANGED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import "react-custom-scroll/dist/customScroll.css";
|
|
2
|
-
import "./speedSettingsPopup.css";
|
|
3
|
-
import i18next from "i18next";
|
|
4
|
-
import { observer } from "mobx-react-lite";
|
|
5
|
-
import React from "react";
|
|
6
|
-
import { SPEED_LEVELS } from "../../../application";
|
|
7
|
-
import { UI_ITEMS } from "../../../utils";
|
|
8
|
-
import { useStores } from "../../hooks";
|
|
9
|
-
import { CloseModalButton } from "../CloseModalButton";
|
|
10
|
-
export const SPEED_PREFIX = "speed-";
|
|
11
|
-
export const SpeedSettingsPopup = observer(() => {
|
|
12
|
-
const speedLevelMapper = {
|
|
13
|
-
slow: SPEED_LEVELS.slow,
|
|
14
|
-
normal: SPEED_LEVELS.normal,
|
|
15
|
-
fast: SPEED_LEVELS.fast,
|
|
16
|
-
};
|
|
17
|
-
const { settingStore } = useStores();
|
|
18
|
-
return (<div className="speed-settings-popup">
|
|
19
|
-
<CloseModalButton layerId={UI_ITEMS.speedSettings}/>
|
|
20
|
-
<div className="speed-settings-popup__title">{i18next.t("howDoYouWantToPlay")}</div>
|
|
21
|
-
<div className="speed-settings-popup__speed-options">
|
|
22
|
-
{Object.keys(speedLevelMapper).map((speedLevelKey) => (<div id={`${SPEED_PREFIX}${speedLevelKey}`} key={`${SPEED_PREFIX}${speedLevelKey}`} className={`speed-settings-popup__option ${speedLevelKey === settingStore.currentSpeed ? "speed-settings-popup_option--active" : ""}`}>
|
|
23
|
-
<img className={`speed-settings-popup__icon ${speedLevelMapper[speedLevelKey]}`} src={`../../../assets/settings/speedPopup/speed-${speedLevelMapper[speedLevelKey]}.png`}/>
|
|
24
|
-
</div>))}
|
|
25
|
-
</div>
|
|
26
|
-
</div>);
|
|
27
|
-
});
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
.speed-settings-modal {
|
|
2
|
-
width: 50vw;
|
|
3
|
-
height: 30vh;
|
|
4
|
-
top: 40vh;
|
|
5
|
-
left: 25vw;
|
|
6
|
-
align-items: center;
|
|
7
|
-
justify-content: center;
|
|
8
|
-
z-index: 0;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.modal-overlay {
|
|
12
|
-
position: fixed;
|
|
13
|
-
inset: 0;
|
|
14
|
-
background: rgba(0, 0, 0, 0.6);
|
|
15
|
-
backdrop-filter: blur(2px);
|
|
16
|
-
display: flex;
|
|
17
|
-
align-items: center;
|
|
18
|
-
justify-content: center;
|
|
19
|
-
z-index: 0;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.speed-settings-popup {
|
|
23
|
-
display: flex;
|
|
24
|
-
flex-direction: column;
|
|
25
|
-
gap: 20px;
|
|
26
|
-
align-items: center;
|
|
27
|
-
justify-content: space-between;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.speed-settings-popup__title {
|
|
31
|
-
font-size: 25px;
|
|
32
|
-
color: white;
|
|
33
|
-
text-transform: uppercase;
|
|
34
|
-
margin-top: 10px;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.speed-settings-popup__speed-options {
|
|
38
|
-
display: flex;
|
|
39
|
-
flex-direction: row;
|
|
40
|
-
justify-content: space-between;
|
|
41
|
-
gap: 25px;
|
|
42
|
-
width: 100%;
|
|
43
|
-
height: 120px;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.speed-settings-popup__option {
|
|
47
|
-
display: flex;
|
|
48
|
-
justify-content: center;
|
|
49
|
-
align-items: center;
|
|
50
|
-
background-image: url("/assets/settings/speedPopup/speed-frame.png");
|
|
51
|
-
width: 145px;
|
|
52
|
-
height: 78px;
|
|
53
|
-
background-repeat: no-repeat no-repeat;
|
|
54
|
-
background-size: contain;
|
|
55
|
-
cursor: pointer;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.speed-settings-popup__option:hover {
|
|
59
|
-
background-image: url("/assets/settings/speedPopup/speed-frame-active.png");
|
|
60
|
-
width: 145px;
|
|
61
|
-
height: 78px;
|
|
62
|
-
background-repeat: no-repeat no-repeat;
|
|
63
|
-
background-size: contain;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.speed-settings-popup_option--active {
|
|
67
|
-
background-image: url("/assets/settings/speedPopup/speed-frame-active.png");
|
|
68
|
-
width: 145px;
|
|
69
|
-
height: 78px;
|
|
70
|
-
background-repeat: no-repeat no-repeat;
|
|
71
|
-
background-size: contain;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.speed-settings-popup__icon.slow {
|
|
75
|
-
width: 70px;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.speed-settings-popup__icon.normal {
|
|
79
|
-
width: 35px;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.speed-settings-popup__icon.fast {
|
|
83
|
-
width: 90px;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
@media only screen and (max-width: 450px) {
|
|
87
|
-
.speed-settings-modal {
|
|
88
|
-
width: 80vw;
|
|
89
|
-
height: 50vh;
|
|
90
|
-
left: 10vw;
|
|
91
|
-
top: 10vh;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.speed-settings-popup__title {
|
|
95
|
-
margin-top: 10px;
|
|
96
|
-
font-size: 14px;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.speed-settings-popup__speed-options {
|
|
100
|
-
display: flex;
|
|
101
|
-
flex-direction: column;
|
|
102
|
-
justify-content: space-between;
|
|
103
|
-
align-items: center;
|
|
104
|
-
height: 75%;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.speed-settings-popup__option {
|
|
108
|
-
width: 120px;
|
|
109
|
-
height: 66px;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.speed-settings-popup__icon.slow {
|
|
113
|
-
width: 60px;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.speed-settings-popup__icon.normal {
|
|
117
|
-
width: 30px;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.speed-settings-popup__icon.fast {
|
|
121
|
-
width: 70px;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
@media screen and (max-width: 450px) and (pointer: coarse) {
|
|
126
|
-
.speed-settings-popup__option {
|
|
127
|
-
width: 120px;
|
|
128
|
-
height: 66px;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.speed-settings-popup__option:hover {
|
|
132
|
-
background-image: url("/assets/settings/speedPopup/speed-frame-active.png");
|
|
133
|
-
background-repeat: no-repeat no-repeat;
|
|
134
|
-
background-size: contain;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.speed-settings-popup__option:focus {
|
|
138
|
-
background-image: url("/assets/settings/speedPopup/speed-frame-active.png");
|
|
139
|
-
background-repeat: no-repeat no-repeat;
|
|
140
|
-
background-size: contain;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
@media only screen and (max-height: 450px) {
|
|
145
|
-
.speed-settings-modal {
|
|
146
|
-
width: 80vw;
|
|
147
|
-
height: 50vh;
|
|
148
|
-
left: 10vw;
|
|
149
|
-
top: 10vh;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
.speed-settings-popup__title {
|
|
153
|
-
font-size: 20px;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.speed-settings-popup__speed-options {
|
|
157
|
-
height: 60%;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { ButtonsEventManager } from "../application";
|
|
2
|
-
/**
|
|
3
|
-
* This controller is used to show the speed popup and handle quick stops
|
|
4
|
-
* After 4 quick stops, the speed popup will be shown.
|
|
5
|
-
* Number of quick spin can be adjusted in {@link MAX_QUICK_STOPS}
|
|
6
|
-
* @class QuickStopController
|
|
7
|
-
*/
|
|
8
|
-
export declare class QuickStopController {
|
|
9
|
-
private buttonsEventManager;
|
|
10
|
-
quickStopCounterLock: boolean;
|
|
11
|
-
shouldInvokeSpeedPopup: boolean;
|
|
12
|
-
speedPopupDisabled: boolean;
|
|
13
|
-
private quickStopsCounter;
|
|
14
|
-
constructor(buttonsEventManager: ButtonsEventManager);
|
|
15
|
-
/**
|
|
16
|
-
* Function for handling invoking speed popup
|
|
17
|
-
* This function will increment the quick stops counter and lock the counter if it reaches the maximum
|
|
18
|
-
* If the maximum is reached, it will set the flag to show the speed popup
|
|
19
|
-
* @public
|
|
20
|
-
* @returns {void}
|
|
21
|
-
*/
|
|
22
|
-
handleInvokingSpeedPopup(): void;
|
|
23
|
-
/**
|
|
24
|
-
* Function for handling speed popup invocation
|
|
25
|
-
* This function will set the visibility of the speed popup and reset the quick stop counter lock
|
|
26
|
-
* It will also disable the speed popup to prevent it from being shown again until the next
|
|
27
|
-
* quick stop counter reset
|
|
28
|
-
* @public
|
|
29
|
-
* @returns {void}
|
|
30
|
-
*/
|
|
31
|
-
handleSpeedPopupInvocation(): void;
|
|
32
|
-
/**
|
|
33
|
-
* Function for setting speed popup disabled state
|
|
34
|
-
* @public
|
|
35
|
-
* @param {boolean} value - whether the speed popup should be disabled
|
|
36
|
-
* @returns {void}
|
|
37
|
-
*/
|
|
38
|
-
setSpeedPopupDisabled(value: boolean): void;
|
|
39
|
-
/**
|
|
40
|
-
* Function for resetting the quick stops counter
|
|
41
|
-
* This function will reset the quick stops counter to 0 if the shouldReset parameter is true
|
|
42
|
-
* @public
|
|
43
|
-
* @param {boolean} shouldReset - whether the quick stops counter should be reset
|
|
44
|
-
* @returns {void}
|
|
45
|
-
*/
|
|
46
|
-
handleResetCounter(shouldReset: boolean): void;
|
|
47
|
-
/**
|
|
48
|
-
* Function for setting quick stop counter lock state
|
|
49
|
-
* @public
|
|
50
|
-
* @param {boolean} value - whether the quick stop counter should be locked
|
|
51
|
-
* @returns {void}
|
|
52
|
-
*/
|
|
53
|
-
setQuickStopCounterLock(value: boolean): void;
|
|
54
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { SPEED_LEVELS } from "../application";
|
|
2
|
-
import { RainMan } from "../Rainman";
|
|
3
|
-
const MAX_QUICK_STOPS = 4;
|
|
4
|
-
/**
|
|
5
|
-
* This controller is used to show the speed popup and handle quick stops
|
|
6
|
-
* After 4 quick stops, the speed popup will be shown.
|
|
7
|
-
* Number of quick spin can be adjusted in {@link MAX_QUICK_STOPS}
|
|
8
|
-
* @class QuickStopController
|
|
9
|
-
*/
|
|
10
|
-
export class QuickStopController {
|
|
11
|
-
buttonsEventManager;
|
|
12
|
-
quickStopCounterLock = false;
|
|
13
|
-
shouldInvokeSpeedPopup = false;
|
|
14
|
-
speedPopupDisabled = false;
|
|
15
|
-
quickStopsCounter = 0;
|
|
16
|
-
constructor(buttonsEventManager) {
|
|
17
|
-
this.buttonsEventManager = buttonsEventManager;
|
|
18
|
-
RainMan.globals.disableSpeedPopup = this.setSpeedPopupDisabled.bind(this);
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Function for handling invoking speed popup
|
|
22
|
-
* This function will increment the quick stops counter and lock the counter if it reaches the maximum
|
|
23
|
-
* If the maximum is reached, it will set the flag to show the speed popup
|
|
24
|
-
* @public
|
|
25
|
-
* @returns {void}
|
|
26
|
-
*/
|
|
27
|
-
handleInvokingSpeedPopup() {
|
|
28
|
-
if (!this.quickStopCounterLock &&
|
|
29
|
-
this.quickStopsCounter < MAX_QUICK_STOPS &&
|
|
30
|
-
RainMan.settingsStore.currentSpeed !== SPEED_LEVELS.fast) {
|
|
31
|
-
this.quickStopCounterLock = true;
|
|
32
|
-
this.quickStopsCounter++;
|
|
33
|
-
if (this.quickStopsCounter === MAX_QUICK_STOPS) {
|
|
34
|
-
this.shouldInvokeSpeedPopup = true;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Function for handling speed popup invocation
|
|
40
|
-
* This function will set the visibility of the speed popup and reset the quick stop counter lock
|
|
41
|
-
* It will also disable the speed popup to prevent it from being shown again until the next
|
|
42
|
-
* quick stop counter reset
|
|
43
|
-
* @public
|
|
44
|
-
* @returns {void}
|
|
45
|
-
*/
|
|
46
|
-
handleSpeedPopupInvocation() {
|
|
47
|
-
if (this.shouldInvokeSpeedPopup && !this.speedPopupDisabled && !RainMan.settingsStore.isFreeSpinsPlayEnabled) {
|
|
48
|
-
this.buttonsEventManager?.setSpeedPopupVisibility("flex");
|
|
49
|
-
RainMan.settingsStore.isSpeedModalShown = true;
|
|
50
|
-
this.buttonsEventManager.disableButtons();
|
|
51
|
-
this.shouldInvokeSpeedPopup = false;
|
|
52
|
-
this.speedPopupDisabled = true;
|
|
53
|
-
}
|
|
54
|
-
this.quickStopCounterLock = false;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Function for setting speed popup disabled state
|
|
58
|
-
* @public
|
|
59
|
-
* @param {boolean} value - whether the speed popup should be disabled
|
|
60
|
-
* @returns {void}
|
|
61
|
-
*/
|
|
62
|
-
setSpeedPopupDisabled(value) {
|
|
63
|
-
this.speedPopupDisabled = value;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Function for resetting the quick stops counter
|
|
67
|
-
* This function will reset the quick stops counter to 0 if the shouldReset parameter is true
|
|
68
|
-
* @public
|
|
69
|
-
* @param {boolean} shouldReset - whether the quick stops counter should be reset
|
|
70
|
-
* @returns {void}
|
|
71
|
-
*/
|
|
72
|
-
handleResetCounter(shouldReset) {
|
|
73
|
-
if (shouldReset) {
|
|
74
|
-
this.quickStopsCounter = 0;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Function for setting quick stop counter lock state
|
|
79
|
-
* @public
|
|
80
|
-
* @param {boolean} value - whether the quick stop counter should be locked
|
|
81
|
-
* @returns {void}
|
|
82
|
-
*/
|
|
83
|
-
setQuickStopCounterLock(value) {
|
|
84
|
-
this.quickStopCounterLock = value;
|
|
85
|
-
}
|
|
86
|
-
}
|