pixi-rainman-game-engine 0.3.36 → 0.3.38
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/application/ButtonsEventManager/ButtonsEventManager.js +1 -5
- package/dist/application/SoundManager/SoundManager.d.ts +6 -0
- package/dist/application/SoundManager/SoundManager.js +21 -3
- package/dist/components/AbstractBuyFreeSpins/AbstractBuyFreeSpinsPlate.d.ts +8 -8
- package/dist/components/AbstractIntroScreen/AbstractIntroScreen.js +1 -0
- package/dist/components/AbstractMainContainer/AbstractMainContainer.js +3 -1
- package/dist/components/GambleGame/GambleGame.js +0 -1
- package/dist/components/dictionary/locales/en.json +2 -1
- package/dist/connectivity/spinData.d.ts +3 -1
- package/dist/connectivity/spinData.js +2 -0
- package/dist/controllers/AbstractController.js +21 -4
- 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/stores/SettingsStore.d.ts +2 -0
- package/dist/stores/SettingsStore.js +6 -0
- package/package.json +1 -1
|
@@ -157,11 +157,7 @@ export class ButtonsEventManager {
|
|
|
157
157
|
const animatedBackground = RainMan.componentRegistry.get(Background.registryName);
|
|
158
158
|
animatedBackground.eventMode = "static";
|
|
159
159
|
animatedBackground.addListener("pointerdown", () => {
|
|
160
|
-
|
|
161
|
-
!RainMan.settingsStore.isAutoplayEnabled &&
|
|
162
|
-
!RainMan.settingsStore.isFreeSpinsPlayEnabled) {
|
|
163
|
-
this.enableButtons();
|
|
164
|
-
}
|
|
160
|
+
hideLayerIfPresent();
|
|
165
161
|
});
|
|
166
162
|
}
|
|
167
163
|
/**
|
|
@@ -112,6 +112,12 @@ export declare class SoundManagerInstance implements SpeedAdapterInterface<Sound
|
|
|
112
112
|
* @returns {void}
|
|
113
113
|
*/
|
|
114
114
|
stop(soundName: SoundTrack): void;
|
|
115
|
+
/**
|
|
116
|
+
* Function that resumes sounds and music when game is back in focus.
|
|
117
|
+
* @public
|
|
118
|
+
* @returns {void}
|
|
119
|
+
*/
|
|
120
|
+
resumeAudioContext(): Promise<boolean>;
|
|
115
121
|
/**
|
|
116
122
|
* Function that resumes sounds and music when game is back in focus.
|
|
117
123
|
* @public
|
|
@@ -105,6 +105,9 @@ export class SoundManagerInstance {
|
|
|
105
105
|
* @returns {void}
|
|
106
106
|
*/
|
|
107
107
|
play(soundName) {
|
|
108
|
+
if (!RainMan.settingsStore.isSoundStarted) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
108
111
|
if (!RainMan.settingsStore.shouldPlayFxSounds &&
|
|
109
112
|
!(soundName === SoundTracks.music || soundName === SoundTracks.freeSpinsMusic)) {
|
|
110
113
|
return;
|
|
@@ -152,6 +155,9 @@ export class SoundManagerInstance {
|
|
|
152
155
|
* @returns {void}
|
|
153
156
|
*/
|
|
154
157
|
resumeAll() {
|
|
158
|
+
if (!RainMan.settingsStore.isSoundStarted) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
155
161
|
this.musicCatalogue.forEach((sound, soundName) => {
|
|
156
162
|
if (sound.paused && sound.isPlaying && sound) {
|
|
157
163
|
sound.resume();
|
|
@@ -176,7 +182,7 @@ export class SoundManagerInstance {
|
|
|
176
182
|
* @returns {void}
|
|
177
183
|
*/
|
|
178
184
|
restoreAmbientPlayback() {
|
|
179
|
-
if (!RainMan.settingsStore.shouldPlayAmbientMusic) {
|
|
185
|
+
if (!RainMan.settingsStore.isSoundStarted || !RainMan.settingsStore.shouldPlayAmbientMusic) {
|
|
180
186
|
return;
|
|
181
187
|
}
|
|
182
188
|
const ambientTrack = RainMan.settingsStore.isFreeSpinsPlayEnabled
|
|
@@ -248,7 +254,7 @@ export class SoundManagerInstance {
|
|
|
248
254
|
* @public
|
|
249
255
|
* @returns {void}
|
|
250
256
|
*/
|
|
251
|
-
async
|
|
257
|
+
async resumeAudioContext() {
|
|
252
258
|
const pixiSoundContext = sound.context;
|
|
253
259
|
const audioContext = pixiSoundContext.audioContext;
|
|
254
260
|
const state = audioContext.state;
|
|
@@ -260,7 +266,19 @@ export class SoundManagerInstance {
|
|
|
260
266
|
console.error("Could not resume audio", error);
|
|
261
267
|
}
|
|
262
268
|
}
|
|
263
|
-
|
|
269
|
+
return this.isAudioContextRunning();
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Function that resumes sounds and music when game is back in focus.
|
|
273
|
+
* @public
|
|
274
|
+
* @returns {void}
|
|
275
|
+
*/
|
|
276
|
+
async resumeOnFocus() {
|
|
277
|
+
if (!RainMan.settingsStore.isSoundStarted) {
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
const isAudioContextRunning = await this.resumeAudioContext();
|
|
281
|
+
if (!isAudioContextRunning) {
|
|
264
282
|
return false;
|
|
265
283
|
}
|
|
266
284
|
sound.resumeAll();
|
|
@@ -7,8 +7,8 @@ export type BuyFreeSpinConfig = {
|
|
|
7
7
|
};
|
|
8
8
|
export type BuyFreeSpinState = "selection" | "confirmation";
|
|
9
9
|
export declare abstract class AbstractBuyFreeSpinsPlate extends Container {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
protected buyType: BuyType;
|
|
11
|
+
protected state: BuyFreeSpinState;
|
|
12
12
|
protected selectedOption?: BuyFreeSpinOption;
|
|
13
13
|
protected readonly config: BuyFreeSpinConfig;
|
|
14
14
|
protected selectionPlate?: Sprite;
|
|
@@ -18,9 +18,9 @@ export declare abstract class AbstractBuyFreeSpinsPlate extends Container {
|
|
|
18
18
|
protected declineButton?: AcceptDeclineButton;
|
|
19
19
|
protected selectionPlateTexture: string;
|
|
20
20
|
protected confirmationPlateTexture: string;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
protected readonly onContinueCallback: () => void;
|
|
22
|
+
protected readonly resizeHandler: () => void;
|
|
23
|
+
protected handleClose: () => void;
|
|
24
24
|
protected constructor(onContinue: () => void, config: BuyFreeSpinConfig, buyType: BuyType);
|
|
25
25
|
init(): void;
|
|
26
26
|
private createElements;
|
|
@@ -39,8 +39,8 @@ export declare abstract class AbstractBuyFreeSpinsPlate extends Container {
|
|
|
39
39
|
protected abstract positionConfirmationScreen(): void;
|
|
40
40
|
protected onCleanup(): void;
|
|
41
41
|
protected onBuyButtonClick(option: BuyFreeSpinOption): void;
|
|
42
|
-
|
|
42
|
+
protected onAcceptClick(option: BuyFreeSpinOption): Promise<void>;
|
|
43
43
|
private renderState;
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
protected onDeclineClick(): void;
|
|
45
|
+
protected cleanup(): void;
|
|
46
46
|
}
|
|
@@ -557,11 +557,11 @@ export class AbstractMainContainer extends Container {
|
|
|
557
557
|
});
|
|
558
558
|
if (this.gambleGame) {
|
|
559
559
|
this.removeChild(this.gambleGame);
|
|
560
|
+
this.messageBox.visible = true;
|
|
560
561
|
RainMan.settingsStore.isGambleGameActive = false;
|
|
561
562
|
this._controller.updateGambleValues(RainMan.settingsStore.gambleGameWin);
|
|
562
563
|
this.gambleGame = null;
|
|
563
564
|
}
|
|
564
|
-
this._controller?.updateBalance();
|
|
565
565
|
this.hideOverlay();
|
|
566
566
|
}
|
|
567
567
|
/**
|
|
@@ -913,6 +913,8 @@ export class AbstractMainContainer extends Container {
|
|
|
913
913
|
this._buyFreeSpinsPlate.resize();
|
|
914
914
|
}
|
|
915
915
|
if (this.gambleGame) {
|
|
916
|
+
this.gambleGame.parentLayer = UXLayer;
|
|
917
|
+
this.messageBox.visible = false;
|
|
916
918
|
this.gambleGame.resize();
|
|
917
919
|
this.addChild(this.gambleGame);
|
|
918
920
|
}
|
|
@@ -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();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { Nullable } from "utils";
|
|
1
2
|
import { ApiConfig } from "../application";
|
|
2
|
-
import { SpinDataInterface } from "./serverData";
|
|
3
|
+
import { ExtraData, SpinDataInterface } from "./serverData";
|
|
3
4
|
/**
|
|
4
5
|
* Class representing the spin data.
|
|
5
6
|
* @class SpinData
|
|
@@ -9,6 +10,7 @@ export declare class SpinData {
|
|
|
9
10
|
private readonly rawData;
|
|
10
11
|
private readonly config;
|
|
11
12
|
balanceAfterSpin: number;
|
|
13
|
+
extraData: Nullable<ExtraData>;
|
|
12
14
|
constructor(config: ApiConfig, data: SpinDataInterface);
|
|
13
15
|
/**
|
|
14
16
|
* Get the raw spin data from the backend server
|
|
@@ -7,10 +7,12 @@ export class SpinData {
|
|
|
7
7
|
rawData;
|
|
8
8
|
config;
|
|
9
9
|
balanceAfterSpin;
|
|
10
|
+
extraData;
|
|
10
11
|
constructor(config, data) {
|
|
11
12
|
this.rawData = data;
|
|
12
13
|
this.config = config;
|
|
13
14
|
this.balance = data.balance;
|
|
15
|
+
this.extraData = data.extra_data;
|
|
14
16
|
this.balanceAfterSpin = data.future_balance_prediction;
|
|
15
17
|
if (data.action !== "spin" && data.action !== "buy" && data.action !== "mini-game") {
|
|
16
18
|
throw new Error(`Invalid type "${data.action}" provided, "spin" or "buy" expected`);
|
|
@@ -132,6 +132,9 @@ export class AbstractController {
|
|
|
132
132
|
});
|
|
133
133
|
SoundManager.setPlayStatus(SoundTracks.music, RainMan.settingsStore.shouldPlayAmbientMusic);
|
|
134
134
|
this.changeGamePhase(gamePhases.IDLE);
|
|
135
|
+
if (!RainMan.settingsStore.isFreeSpinsPlayEnabled) {
|
|
136
|
+
RainMan.componentRegistry.getIfExists(FreeSpinButton.registryName)?.setInteractivity(true);
|
|
137
|
+
}
|
|
135
138
|
}
|
|
136
139
|
/**
|
|
137
140
|
* Function for initializing function after timeout
|
|
@@ -312,7 +315,13 @@ export class AbstractController {
|
|
|
312
315
|
this.buttonsEventManager.initGambleButton(() => {
|
|
313
316
|
RainMan.settingsStore.isGambleGameAvailable = false;
|
|
314
317
|
this.mainContainer.invokeGambleGame();
|
|
315
|
-
}, this.lastWinAmount === 0 ||
|
|
318
|
+
}, this.lastWinAmount === 0 ||
|
|
319
|
+
!RainMan.settingsStore.isGambleGameAvailable ||
|
|
320
|
+
RainMan.settingsStore.isPlayingAnyAction ||
|
|
321
|
+
this.gamePhase === gamePhases.HANDLING_ACTIONS ||
|
|
322
|
+
this.gamePhase === gamePhases.STOPPING_HANDLING_ACTIONS ||
|
|
323
|
+
this.gamePhase === gamePhases.SPINNING ||
|
|
324
|
+
this.gamePhase === gamePhases.GAME_SUMMARY);
|
|
316
325
|
}
|
|
317
326
|
if (RainMan.componentRegistry.has(BUTTONS.take)) {
|
|
318
327
|
this.buttonsEventManager.initTakeButton(() => {
|
|
@@ -326,7 +335,13 @@ export class AbstractController {
|
|
|
326
335
|
RainMan.componentRegistry
|
|
327
336
|
.get(BUTTONS.take)
|
|
328
337
|
.flipDisabledFlag(!RainMan.settingsStore.isTakeActionAvailable);
|
|
329
|
-
},
|
|
338
|
+
}, this.lastWinAmount === 0 ||
|
|
339
|
+
!RainMan.settingsStore.isGambleGameAvailable ||
|
|
340
|
+
RainMan.settingsStore.isPlayingAnyAction ||
|
|
341
|
+
this.gamePhase === gamePhases.HANDLING_ACTIONS ||
|
|
342
|
+
this.gamePhase === gamePhases.STOPPING_HANDLING_ACTIONS ||
|
|
343
|
+
this.gamePhase === gamePhases.SPINNING ||
|
|
344
|
+
this.gamePhase === gamePhases.GAME_SUMMARY);
|
|
330
345
|
}
|
|
331
346
|
RainMan.componentRegistry.get(SpeedControlButton.registryName).setOnClick(() => {
|
|
332
347
|
this.quickStopController.speedPopupDisabled = true;
|
|
@@ -1181,7 +1196,6 @@ export class AbstractController {
|
|
|
1181
1196
|
RainMan.settingsStore.reinitData = undefined;
|
|
1182
1197
|
logGroupEnd();
|
|
1183
1198
|
await this.onSpinningEnd(spinLogic);
|
|
1184
|
-
this.gambleGameEnabler(this.lastWinAmount);
|
|
1185
1199
|
this.winActionsQueue = [];
|
|
1186
1200
|
this.spinning = false;
|
|
1187
1201
|
this.isSpinThrottled = false;
|
|
@@ -1205,7 +1219,9 @@ export class AbstractController {
|
|
|
1205
1219
|
this.uiController.messageBox.hideCurrentWinText();
|
|
1206
1220
|
this.uiController.messageBox.hideAutoSpinText();
|
|
1207
1221
|
await this.handleFreeSpinPlateInvocation(freeSpinAward, isAdditionalFreeSpins || additionalFreeSpinsOnLastSpin);
|
|
1208
|
-
if (!
|
|
1222
|
+
if (!RainMan.settingsStore.isFreeSpinsPlayEnabled &&
|
|
1223
|
+
!isAdditionalFreeSpins &&
|
|
1224
|
+
!additionalFreeSpinsOnLastSpin) {
|
|
1209
1225
|
this.uiController.currentBalance = RainMan.settingsStore.balanceAfterSpin;
|
|
1210
1226
|
}
|
|
1211
1227
|
this.uiController.triggerUiElementsUpdate();
|
|
@@ -1219,6 +1235,7 @@ export class AbstractController {
|
|
|
1219
1235
|
await this.handleFreeSpinSummaryPlateInvocation();
|
|
1220
1236
|
}
|
|
1221
1237
|
await this.performActionsAfterSpin();
|
|
1238
|
+
this.gambleGameEnabler(this.lastWinAmount);
|
|
1222
1239
|
if (RainMan.settingsStore.isAutoplayEnabled ||
|
|
1223
1240
|
(RainMan.settingsStore.howManyFreeSpinsLeft !== 0 && this.shouldAutoplayFreeSpins)) {
|
|
1224
1241
|
this.handleAutoplayLogic();
|
|
@@ -48,6 +48,7 @@ export declare abstract class AbstractLoadingContainer extends Container {
|
|
|
48
48
|
*/
|
|
49
49
|
protected setupInitAnimations(): void;
|
|
50
50
|
waitForPresentationToFinish(): Promise<void>;
|
|
51
|
+
showContinueAfterLoading(label?: string): void;
|
|
51
52
|
scaleInitSpineToScreenWidth(): void;
|
|
52
53
|
private tryResolvePresentationFinished;
|
|
53
54
|
}
|
|
@@ -24,11 +24,7 @@ export class AbstractLoadingContainer extends Container {
|
|
|
24
24
|
this.name = "loadingContainer";
|
|
25
25
|
this.x = 0;
|
|
26
26
|
this.y = 0;
|
|
27
|
-
this.loaderContainer = new SpriteLoadingContainer("./assets/images/materials/texture.png"
|
|
28
|
-
fill: ["#FCD784", "#AE6119", "#FEE391"],
|
|
29
|
-
stroke: "#4a1850",
|
|
30
|
-
dropShadowColor: "#000000"
|
|
31
|
-
});
|
|
27
|
+
this.loaderContainer = new SpriteLoadingContainer("./assets/images/materials/texture.png");
|
|
32
28
|
this.presentationFinishedPromise = new Promise((resolve) => {
|
|
33
29
|
this.resolvePresentationFinished = resolve;
|
|
34
30
|
});
|
|
@@ -102,6 +98,9 @@ export class AbstractLoadingContainer extends Container {
|
|
|
102
98
|
waitForPresentationToFinish() {
|
|
103
99
|
return this.presentationFinishedPromise;
|
|
104
100
|
}
|
|
101
|
+
showContinueAfterLoading(label) {
|
|
102
|
+
this.loaderContainer.showContinue(label);
|
|
103
|
+
}
|
|
105
104
|
scaleInitSpineToScreenWidth() {
|
|
106
105
|
if (getDeviceOrientation() === "mobile-portrait") {
|
|
107
106
|
this.initAnimation?.scale.set(0.5 * globalMinRatio());
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Container,
|
|
1
|
+
import { Container, Sprite } from "pixi.js";
|
|
2
2
|
import { ProgressiveLoader } from "./ProgressiveLoader";
|
|
3
3
|
/**
|
|
4
4
|
* This class contains the loading process to pixi application
|
|
@@ -16,6 +16,10 @@ export declare class SpriteLoadingContainer extends Container implements Progres
|
|
|
16
16
|
progressBorder: Sprite;
|
|
17
17
|
private progress;
|
|
18
18
|
private targetProgress;
|
|
19
|
+
private continueText;
|
|
20
|
+
private shouldShowContinue;
|
|
21
|
+
private wasContinueClicked;
|
|
22
|
+
private isContinueVisible;
|
|
19
23
|
private completionPromiseResolver;
|
|
20
24
|
private completionPromise;
|
|
21
25
|
private readonly loadingStatusContainerHeight;
|
|
@@ -28,7 +32,7 @@ export declare class SpriteLoadingContainer extends Container implements Progres
|
|
|
28
32
|
* @param {Partial<ITextStyle>} textOptions contains the options for text color blur
|
|
29
33
|
* @returns {void}
|
|
30
34
|
*/
|
|
31
|
-
constructor(texture: string
|
|
35
|
+
constructor(texture: string);
|
|
32
36
|
waitForCompletion(): Promise<void>;
|
|
33
37
|
/**
|
|
34
38
|
* Function for updating loading progress
|
|
@@ -37,6 +41,7 @@ export declare class SpriteLoadingContainer extends Container implements Progres
|
|
|
37
41
|
* @returns {void}
|
|
38
42
|
*/
|
|
39
43
|
updateProgress(progress: number): void;
|
|
44
|
+
showContinue(label?: string): void;
|
|
40
45
|
/**
|
|
41
46
|
* Function for setting error text
|
|
42
47
|
* @public
|
|
@@ -63,5 +68,8 @@ export declare class SpriteLoadingContainer extends Container implements Progres
|
|
|
63
68
|
private updateProgressMask;
|
|
64
69
|
private animateProgress;
|
|
65
70
|
private isComplete;
|
|
71
|
+
private canResolveCompletion;
|
|
72
|
+
private showContinueIfReady;
|
|
73
|
+
private handleContinueClick;
|
|
66
74
|
private resolveCompletionIfReady;
|
|
67
75
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import i18next from "i18next";
|
|
2
|
+
import { Container, Graphics, Rectangle, Sprite, Text, TextStyle, Texture } from "pixi.js";
|
|
2
3
|
import { RainMan } from "../Rainman";
|
|
3
4
|
import { getDeviceOrientation } from "../utils/common/deviceOrientation";
|
|
4
5
|
/**
|
|
@@ -17,6 +18,10 @@ export class SpriteLoadingContainer extends Container {
|
|
|
17
18
|
progressBorder;
|
|
18
19
|
progress = 0;
|
|
19
20
|
targetProgress = 0;
|
|
21
|
+
continueText = i18next.t("clickAnywhereToContinue");
|
|
22
|
+
shouldShowContinue = false;
|
|
23
|
+
wasContinueClicked = false;
|
|
24
|
+
isContinueVisible = false;
|
|
20
25
|
completionPromiseResolver = null;
|
|
21
26
|
completionPromise = null;
|
|
22
27
|
loadingStatusContainerHeight = 10;
|
|
@@ -29,7 +34,7 @@ export class SpriteLoadingContainer extends Container {
|
|
|
29
34
|
* @param {Partial<ITextStyle>} textOptions contains the options for text color blur
|
|
30
35
|
* @returns {void}
|
|
31
36
|
*/
|
|
32
|
-
constructor(texture
|
|
37
|
+
constructor(texture) {
|
|
33
38
|
super();
|
|
34
39
|
this.progressBarMask = new Graphics();
|
|
35
40
|
this.progressBorderMask = new Graphics();
|
|
@@ -52,12 +57,8 @@ export class SpriteLoadingContainer extends Container {
|
|
|
52
57
|
fontFamily: RainMan.config.fontFace,
|
|
53
58
|
fontSize: 24,
|
|
54
59
|
strokeThickness: 3,
|
|
55
|
-
dropShadow: true,
|
|
56
|
-
dropShadowBlur: 4,
|
|
57
|
-
dropShadowAngle: Math.PI / 6,
|
|
58
|
-
dropShadowDistance: 6,
|
|
59
60
|
align: "center",
|
|
60
|
-
|
|
61
|
+
fill: "#ffffff"
|
|
61
62
|
});
|
|
62
63
|
this.text = new Text("", loaderTextStyle);
|
|
63
64
|
this.text.anchor.set(0.5, 0.5);
|
|
@@ -71,7 +72,7 @@ export class SpriteLoadingContainer extends Container {
|
|
|
71
72
|
RainMan.app.ticker.add(this.animateProgress, this);
|
|
72
73
|
}
|
|
73
74
|
waitForCompletion() {
|
|
74
|
-
if (this.
|
|
75
|
+
if (this.canResolveCompletion()) {
|
|
75
76
|
return Promise.resolve();
|
|
76
77
|
}
|
|
77
78
|
if (!this.completionPromise) {
|
|
@@ -94,6 +95,13 @@ export class SpriteLoadingContainer extends Container {
|
|
|
94
95
|
}
|
|
95
96
|
this.targetProgress = normalizedProgress;
|
|
96
97
|
this.updateProgressMask();
|
|
98
|
+
this.showContinueIfReady();
|
|
99
|
+
}
|
|
100
|
+
showContinue(label = i18next.t("clickAnywhereToContinue")) {
|
|
101
|
+
this.shouldShowContinue = true;
|
|
102
|
+
this.continueText = label;
|
|
103
|
+
this.text.visible = false;
|
|
104
|
+
this.showContinueIfReady();
|
|
97
105
|
}
|
|
98
106
|
/**
|
|
99
107
|
* Function for setting error text
|
|
@@ -164,7 +172,12 @@ export class SpriteLoadingContainer extends Container {
|
|
|
164
172
|
this.progressBorder.y = startY;
|
|
165
173
|
this.progressBorderMask.x = this.progressBorder.x;
|
|
166
174
|
this.progressBorderMask.y = this.progressBorder.y;
|
|
167
|
-
if (this.
|
|
175
|
+
if (this.isContinueVisible) {
|
|
176
|
+
this.hitArea = new Rectangle(0, 0, RainMan.app.screen.width, RainMan.app.screen.height);
|
|
177
|
+
this.text.x = RainMan.app.screen.width / 2;
|
|
178
|
+
this.text.y = startY + this.loadingStatusContainerHeight / 2;
|
|
179
|
+
}
|
|
180
|
+
else if (this.text.text !== "") {
|
|
168
181
|
this.text.x = RainMan.app.screen.width / 2;
|
|
169
182
|
this.text.y = RainMan.app.screen.height / 2;
|
|
170
183
|
}
|
|
@@ -198,13 +211,43 @@ export class SpriteLoadingContainer extends Container {
|
|
|
198
211
|
const maxStep = RainMan.app.ticker.deltaMS / this.minimumFullProgressDuration;
|
|
199
212
|
this.progress = Math.min(this.progress + maxStep, this.targetProgress);
|
|
200
213
|
this.updateProgressMask();
|
|
214
|
+
this.showContinueIfReady();
|
|
201
215
|
this.resolveCompletionIfReady();
|
|
202
216
|
}
|
|
203
217
|
isComplete() {
|
|
204
218
|
return this.targetProgress === 1 && this.progress >= this.targetProgress;
|
|
205
219
|
}
|
|
220
|
+
canResolveCompletion() {
|
|
221
|
+
return this.isComplete() && (!this.shouldShowContinue || this.wasContinueClicked);
|
|
222
|
+
}
|
|
223
|
+
showContinueIfReady() {
|
|
224
|
+
if (!this.shouldShowContinue || !this.isComplete() || this.isContinueVisible) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
this.isContinueVisible = true;
|
|
228
|
+
this.removeChild(this.progressBorderShadow);
|
|
229
|
+
this.removeChild(this.progressBorderMask);
|
|
230
|
+
this.removeChild(this.progressBorder);
|
|
231
|
+
this.removeChild(this.progressBarMask);
|
|
232
|
+
this.removeChild(this.progressBar);
|
|
233
|
+
this.text.text = this.continueText;
|
|
234
|
+
this.text.visible = true;
|
|
235
|
+
this.eventMode = "static";
|
|
236
|
+
this.cursor = "pointer";
|
|
237
|
+
this.on("pointertap", this.handleContinueClick, this);
|
|
238
|
+
this.reposition();
|
|
239
|
+
}
|
|
240
|
+
handleContinueClick() {
|
|
241
|
+
RainMan.settingsStore.startSound();
|
|
242
|
+
this.wasContinueClicked = true;
|
|
243
|
+
this.eventMode = "passive";
|
|
244
|
+
this.cursor = "default";
|
|
245
|
+
this.hitArea = null;
|
|
246
|
+
this.off("pointertap", this.handleContinueClick, this);
|
|
247
|
+
this.resolveCompletionIfReady();
|
|
248
|
+
}
|
|
206
249
|
resolveCompletionIfReady() {
|
|
207
|
-
if (!this.
|
|
250
|
+
if (!this.canResolveCompletion() || !this.completionPromiseResolver) {
|
|
208
251
|
return;
|
|
209
252
|
}
|
|
210
253
|
this.completionPromiseResolver();
|
|
@@ -15,6 +15,7 @@ export declare class SettingsStore {
|
|
|
15
15
|
isQuickSpinsActive: boolean;
|
|
16
16
|
bet: number;
|
|
17
17
|
betText: string;
|
|
18
|
+
isSoundStarted: boolean;
|
|
18
19
|
shouldPlayAmbientMusic: boolean;
|
|
19
20
|
shouldPlayFxSounds: boolean;
|
|
20
21
|
fullScreenFlag: boolean;
|
|
@@ -191,6 +192,7 @@ export declare class SettingsStore {
|
|
|
191
192
|
* @returns {void}
|
|
192
193
|
*/
|
|
193
194
|
setShouldPlayAmbientMusic(flag: boolean, saveToLocalStorage?: boolean): void;
|
|
195
|
+
startSound(): void;
|
|
194
196
|
/**
|
|
195
197
|
* Sets flag for effect sounds
|
|
196
198
|
* @public
|
|
@@ -19,6 +19,7 @@ export class SettingsStore {
|
|
|
19
19
|
isQuickSpinsActive = false;
|
|
20
20
|
bet = 0;
|
|
21
21
|
betText = "";
|
|
22
|
+
isSoundStarted = false;
|
|
22
23
|
shouldPlayAmbientMusic = true;
|
|
23
24
|
shouldPlayFxSounds = true;
|
|
24
25
|
fullScreenFlag = false;
|
|
@@ -95,6 +96,7 @@ 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,
|
|
@@ -297,6 +299,10 @@ export class SettingsStore {
|
|
|
297
299
|
removeFromLocalStorage(LOCAL_STORAGE.isSoundEnabled);
|
|
298
300
|
}
|
|
299
301
|
}
|
|
302
|
+
startSound() {
|
|
303
|
+
this.isSoundStarted = true;
|
|
304
|
+
void SoundManager.resumeAudioContext();
|
|
305
|
+
}
|
|
300
306
|
/**
|
|
301
307
|
* Sets flag for effect sounds
|
|
302
308
|
* @public
|
package/package.json
CHANGED