pixi-rainman-game-engine 0.3.32 → 0.3.33
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/components/frame/AbstractColumnsContainer.js +4 -2
- package/dist/controllers/AbstractController.js +2 -0
- package/dist/loading/AbstractLoadingContainer.d.ts +20 -2
- package/dist/loading/AbstractLoadingContainer.js +78 -4
- package/dist/loading/SpriteLoadingContainer.d.ts +20 -9
- package/dist/loading/SpriteLoadingContainer.js +138 -45
- package/dist/stores/SettingsStore.d.ts +1 -0
- package/dist/stores/SettingsStore.js +1 -0
- package/package.json +1 -1
|
@@ -258,7 +258,8 @@ export class AbstractColumnsContainer extends Container {
|
|
|
258
258
|
columnsToPlay.forEach((column, index) => {
|
|
259
259
|
column.forEach((symbolIndex) => promises.push(this.getColumnAtPosition(index).playSymbolAtPosition(symbolIndex, true)));
|
|
260
260
|
});
|
|
261
|
-
|
|
261
|
+
if (!RainMan.settingsStore.isLoopingWinActionQueue)
|
|
262
|
+
this.playSoundDependingOnAmount(amount, allSymbols);
|
|
262
263
|
await Promise.allSettled(promises);
|
|
263
264
|
}
|
|
264
265
|
/**
|
|
@@ -343,7 +344,8 @@ export class AbstractColumnsContainer extends Container {
|
|
|
343
344
|
}
|
|
344
345
|
reelIndex++;
|
|
345
346
|
}
|
|
346
|
-
|
|
347
|
+
if (!RainMan.settingsStore.isLoopingWinActionQueue)
|
|
348
|
+
this.playStreakSound(streakSymbols);
|
|
347
349
|
await Promise.allSettled(promises);
|
|
348
350
|
}
|
|
349
351
|
/**
|
|
@@ -1639,8 +1639,10 @@ export class AbstractController {
|
|
|
1639
1639
|
return;
|
|
1640
1640
|
}
|
|
1641
1641
|
this.isLoopingWinActionsQueue = true;
|
|
1642
|
+
RainMan.settingsStore.isLoopingWinActionQueue = true;
|
|
1642
1643
|
await this.loopWinActionsQueue();
|
|
1643
1644
|
this.isLoopingWinActionsQueue = false;
|
|
1645
|
+
RainMan.settingsStore.isLoopingWinActionQueue = false;
|
|
1644
1646
|
}
|
|
1645
1647
|
/**
|
|
1646
1648
|
* Function for looping win actions queue, after initial play
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Container } from "pixi.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Spine } from "pixi-spine";
|
|
3
|
+
import { Logo, LogoStatic } from "../components";
|
|
3
4
|
import { SpriteLoadingContainer } from "./SpriteLoadingContainer";
|
|
4
5
|
/**
|
|
5
6
|
* Class represents the container with loading logic inside
|
|
@@ -9,9 +10,15 @@ import { SpriteLoadingContainer } from "./SpriteLoadingContainer";
|
|
|
9
10
|
* @augments {Container}
|
|
10
11
|
*/
|
|
11
12
|
export declare abstract class AbstractLoadingContainer extends Container {
|
|
12
|
-
protected abstract background: Background;
|
|
13
13
|
protected logo: Logo | LogoStatic | null;
|
|
14
14
|
loaderContainer: SpriteLoadingContainer;
|
|
15
|
+
protected initAnimation: Spine | null;
|
|
16
|
+
protected initLogo: Spine | null;
|
|
17
|
+
private canUpdateProgress;
|
|
18
|
+
private pendingProgress;
|
|
19
|
+
private introAnimationFinished;
|
|
20
|
+
private readonly presentationFinishedPromise;
|
|
21
|
+
private resolvePresentationFinished;
|
|
15
22
|
protected constructor();
|
|
16
23
|
/**
|
|
17
24
|
* Function for resizing loading container elements
|
|
@@ -32,4 +39,15 @@ export declare abstract class AbstractLoadingContainer extends Container {
|
|
|
32
39
|
* @returns {void}
|
|
33
40
|
*/
|
|
34
41
|
onUpdate(progress: number): void;
|
|
42
|
+
/**
|
|
43
|
+
* Runs the standardized loading intro sequence.
|
|
44
|
+
* The intro spine plays "start" once, while the logo spine starts with "start"
|
|
45
|
+
* and switches to looping "idle" after the intro completes.
|
|
46
|
+
* @protected
|
|
47
|
+
* @returns {void}
|
|
48
|
+
*/
|
|
49
|
+
protected setupInitAnimations(): void;
|
|
50
|
+
waitForPresentationToFinish(): Promise<void>;
|
|
51
|
+
scaleInitSpineToScreenWidth(): void;
|
|
52
|
+
private tryResolvePresentationFinished;
|
|
35
53
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Container } from "pixi.js";
|
|
2
2
|
import { RainMan } from "../Rainman";
|
|
3
|
+
import { getDeviceOrientation, globalMinRatio } from "../utils";
|
|
3
4
|
import { SpriteLoadingContainer } from "./SpriteLoadingContainer";
|
|
4
5
|
/**
|
|
5
6
|
* Class represents the container with loading logic inside
|
|
@@ -11,17 +12,27 @@ import { SpriteLoadingContainer } from "./SpriteLoadingContainer";
|
|
|
11
12
|
export class AbstractLoadingContainer extends Container {
|
|
12
13
|
logo = null;
|
|
13
14
|
loaderContainer;
|
|
15
|
+
initAnimation = null;
|
|
16
|
+
initLogo = null;
|
|
17
|
+
canUpdateProgress = true;
|
|
18
|
+
pendingProgress = 0;
|
|
19
|
+
introAnimationFinished = false;
|
|
20
|
+
presentationFinishedPromise;
|
|
21
|
+
resolvePresentationFinished = null;
|
|
14
22
|
constructor() {
|
|
15
23
|
super();
|
|
16
24
|
this.name = "loadingContainer";
|
|
17
25
|
this.x = 0;
|
|
18
26
|
this.y = 0;
|
|
19
27
|
this.loaderContainer = new SpriteLoadingContainer("./assets/images/materials/texture.png", {
|
|
20
|
-
fill: ["#FCD784", "#AE6119", "#FEE391"],
|
|
28
|
+
fill: ["#FCD784", "#AE6119", "#FEE391"],
|
|
21
29
|
stroke: "#4a1850",
|
|
22
30
|
dropShadowColor: "#000000"
|
|
23
31
|
});
|
|
24
|
-
|
|
32
|
+
this.presentationFinishedPromise = new Promise((resolve) => {
|
|
33
|
+
this.resolvePresentationFinished = resolve;
|
|
34
|
+
});
|
|
35
|
+
RainMan.app.renderer.on("resize", () => this.resize());
|
|
25
36
|
}
|
|
26
37
|
/**
|
|
27
38
|
* Function for resizing loading container elements
|
|
@@ -29,9 +40,17 @@ export class AbstractLoadingContainer extends Container {
|
|
|
29
40
|
* @returns {void}
|
|
30
41
|
*/
|
|
31
42
|
resize() {
|
|
32
|
-
this.background.resize();
|
|
33
43
|
this.logo?.resize();
|
|
34
44
|
this.loaderContainer.resize();
|
|
45
|
+
const mobilePortraitModifier = getDeviceOrientation() === "mobile-portrait" ? 0.06 : 0.13;
|
|
46
|
+
if (this.initAnimation && this.initLogo) {
|
|
47
|
+
this.scaleInitSpineToScreenWidth();
|
|
48
|
+
this.initAnimation.x = RainMan.app.screen.width / 2;
|
|
49
|
+
this.initAnimation.y =
|
|
50
|
+
this.loaderContainer.progressBorder.y - RainMan.app.screen.height * mobilePortraitModifier;
|
|
51
|
+
this.initLogo.x = this.initAnimation.x;
|
|
52
|
+
this.initLogo.y = this.initAnimation.y;
|
|
53
|
+
}
|
|
35
54
|
}
|
|
36
55
|
/**
|
|
37
56
|
* Function for removing loading container elements
|
|
@@ -39,6 +58,7 @@ export class AbstractLoadingContainer extends Container {
|
|
|
39
58
|
* @returns {void}
|
|
40
59
|
*/
|
|
41
60
|
remove() {
|
|
61
|
+
this.loaderContainer.remove();
|
|
42
62
|
RainMan.app.renderer.removeAllListeners("resize");
|
|
43
63
|
}
|
|
44
64
|
/**
|
|
@@ -48,6 +68,60 @@ export class AbstractLoadingContainer extends Container {
|
|
|
48
68
|
* @returns {void}
|
|
49
69
|
*/
|
|
50
70
|
onUpdate(progress) {
|
|
51
|
-
this.
|
|
71
|
+
this.pendingProgress = progress;
|
|
72
|
+
if (this.canUpdateProgress) {
|
|
73
|
+
this.loaderContainer.updateProgress(progress);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Runs the standardized loading intro sequence.
|
|
78
|
+
* The intro spine plays "start" once, while the logo spine starts with "start"
|
|
79
|
+
* and switches to looping "idle" after the intro completes.
|
|
80
|
+
* @protected
|
|
81
|
+
* @returns {void}
|
|
82
|
+
*/
|
|
83
|
+
setupInitAnimations() {
|
|
84
|
+
if (!this.initAnimation || !this.initLogo) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
this.canUpdateProgress = false;
|
|
88
|
+
this.initAnimation.state.setAnimation(0, "start", false);
|
|
89
|
+
this.initLogo.state.setAnimation(0, "start", false);
|
|
90
|
+
this.initLogo.state.addAnimation(0, "idle", true, 0);
|
|
91
|
+
const initAnimationListener = {
|
|
92
|
+
complete: () => {
|
|
93
|
+
this.canUpdateProgress = true;
|
|
94
|
+
this.introAnimationFinished = true;
|
|
95
|
+
this.loaderContainer.updateProgress(this.pendingProgress);
|
|
96
|
+
this.tryResolvePresentationFinished();
|
|
97
|
+
this.initAnimation?.state.removeListener(initAnimationListener);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
this.initAnimation.state.addListener(initAnimationListener);
|
|
101
|
+
}
|
|
102
|
+
waitForPresentationToFinish() {
|
|
103
|
+
return this.presentationFinishedPromise;
|
|
104
|
+
}
|
|
105
|
+
scaleInitSpineToScreenWidth() {
|
|
106
|
+
if (getDeviceOrientation() === "mobile-portrait") {
|
|
107
|
+
this.initAnimation?.scale.set(0.5 * globalMinRatio());
|
|
108
|
+
this.initLogo?.scale.set(0.5 * globalMinRatio());
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
this.initAnimation?.scale.set(0.8 * globalMinRatio());
|
|
112
|
+
this.initLogo?.scale.set(0.8 * globalMinRatio());
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
tryResolvePresentationFinished() {
|
|
116
|
+
if (!this.introAnimationFinished || !this.resolvePresentationFinished) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
void this.loaderContainer.waitForCompletion().then(() => {
|
|
120
|
+
if (!this.resolvePresentationFinished) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
this.resolvePresentationFinished();
|
|
124
|
+
this.resolvePresentationFinished = null;
|
|
125
|
+
});
|
|
52
126
|
}
|
|
53
127
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Container, ITextStyle } from "pixi.js";
|
|
1
|
+
import { Container, ITextStyle, Sprite } from "pixi.js";
|
|
2
2
|
import { ProgressiveLoader } from "./ProgressiveLoader";
|
|
3
3
|
/**
|
|
4
4
|
* This class contains the loading process to pixi application
|
|
@@ -8,16 +8,19 @@ import { ProgressiveLoader } from "./ProgressiveLoader";
|
|
|
8
8
|
* @implements {ProgressiveLoader}
|
|
9
9
|
*/
|
|
10
10
|
export declare class SpriteLoadingContainer extends Container implements ProgressiveLoader {
|
|
11
|
-
private
|
|
11
|
+
private progressBar;
|
|
12
|
+
private progressBarMask;
|
|
13
|
+
private progressBorderMask;
|
|
14
|
+
private progressBorderShadow;
|
|
12
15
|
private text;
|
|
13
|
-
|
|
14
|
-
private
|
|
16
|
+
progressBorder: Sprite;
|
|
17
|
+
private progress;
|
|
18
|
+
private targetProgress;
|
|
19
|
+
private completionPromiseResolver;
|
|
20
|
+
private completionPromise;
|
|
15
21
|
private readonly loadingStatusContainerHeight;
|
|
16
|
-
private readonly
|
|
17
|
-
private readonly
|
|
18
|
-
private readonly errorBackgroundPaddingHeight;
|
|
19
|
-
private readonly loadingStatusWidth;
|
|
20
|
-
private readonly loadingStatusHeight;
|
|
22
|
+
private readonly progressBorderWidth;
|
|
23
|
+
private readonly minimumFullProgressDuration;
|
|
21
24
|
/**
|
|
22
25
|
* Constructor for SpriteLoadingContainer
|
|
23
26
|
* @public
|
|
@@ -26,6 +29,7 @@ export declare class SpriteLoadingContainer extends Container implements Progres
|
|
|
26
29
|
* @returns {void}
|
|
27
30
|
*/
|
|
28
31
|
constructor(texture: string, textOptions: Partial<ITextStyle>);
|
|
32
|
+
waitForCompletion(): Promise<void>;
|
|
29
33
|
/**
|
|
30
34
|
* Function for updating loading progress
|
|
31
35
|
* @public
|
|
@@ -41,11 +45,13 @@ export declare class SpriteLoadingContainer extends Container implements Progres
|
|
|
41
45
|
*/
|
|
42
46
|
setError(errorMessage: string): void;
|
|
43
47
|
removeProgressBar(): void;
|
|
48
|
+
remove(): void;
|
|
44
49
|
/**
|
|
45
50
|
* Function for resizing loading container elements
|
|
46
51
|
* @public
|
|
47
52
|
* @returns {void}
|
|
48
53
|
*/
|
|
54
|
+
protected recreateProgressBar(): void;
|
|
49
55
|
resize(): void;
|
|
50
56
|
/**
|
|
51
57
|
* Function for repositioning loading container elements
|
|
@@ -53,4 +59,9 @@ export declare class SpriteLoadingContainer extends Container implements Progres
|
|
|
53
59
|
* @returns {void}
|
|
54
60
|
*/
|
|
55
61
|
reposition(): void;
|
|
62
|
+
private getLoadingStatusContainerWidth;
|
|
63
|
+
private updateProgressMask;
|
|
64
|
+
private animateProgress;
|
|
65
|
+
private isComplete;
|
|
66
|
+
private resolveCompletionIfReady;
|
|
56
67
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Container, Graphics, Sprite, Text, TextStyle, Texture } from "pixi.js";
|
|
2
2
|
import { RainMan } from "../Rainman";
|
|
3
|
+
import { getDeviceOrientation } from "../utils/common/deviceOrientation";
|
|
3
4
|
/**
|
|
4
5
|
* This class contains the loading process to pixi application
|
|
5
6
|
* @class SpriteLoadingContainer
|
|
@@ -8,16 +9,19 @@ import { RainMan } from "../Rainman";
|
|
|
8
9
|
* @implements {ProgressiveLoader}
|
|
9
10
|
*/
|
|
10
11
|
export class SpriteLoadingContainer extends Container {
|
|
11
|
-
|
|
12
|
+
progressBar;
|
|
13
|
+
progressBarMask;
|
|
14
|
+
progressBorderMask;
|
|
15
|
+
progressBorderShadow;
|
|
12
16
|
text;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
progressBorder;
|
|
18
|
+
progress = 0;
|
|
19
|
+
targetProgress = 0;
|
|
20
|
+
completionPromiseResolver = null;
|
|
21
|
+
completionPromise = null;
|
|
22
|
+
loadingStatusContainerHeight = 10;
|
|
23
|
+
progressBorderWidth = 2;
|
|
24
|
+
minimumFullProgressDuration = 250;
|
|
21
25
|
/**
|
|
22
26
|
* Constructor for SpriteLoadingContainer
|
|
23
27
|
* @public
|
|
@@ -27,17 +31,23 @@ export class SpriteLoadingContainer extends Container {
|
|
|
27
31
|
*/
|
|
28
32
|
constructor(texture, textOptions) {
|
|
29
33
|
super();
|
|
30
|
-
this.
|
|
31
|
-
this.
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
35
|
-
this.
|
|
36
|
-
this.
|
|
37
|
-
this.
|
|
38
|
-
this.
|
|
39
|
-
this.
|
|
40
|
-
this.
|
|
34
|
+
this.progressBarMask = new Graphics();
|
|
35
|
+
this.progressBorderMask = new Graphics();
|
|
36
|
+
this.progressBar = Sprite.from(Texture.from(texture));
|
|
37
|
+
this.progressBorder = Sprite.from(this.progressBar.texture);
|
|
38
|
+
this.progressBorderShadow = Sprite.from(this.progressBorder.texture);
|
|
39
|
+
this.progressBorderShadow.tint = 0x000000;
|
|
40
|
+
this.progressBorderShadow.alpha = 0.1;
|
|
41
|
+
this.progressBorder.mask = this.progressBorderMask;
|
|
42
|
+
this.progressBorderMask.renderable = false;
|
|
43
|
+
this.recreateProgressBar();
|
|
44
|
+
this.progressBorderShadow.width = this.getLoadingStatusContainerWidth();
|
|
45
|
+
this.progressBorderShadow.height = this.loadingStatusContainerHeight;
|
|
46
|
+
this.progressBorder.width = this.getLoadingStatusContainerWidth();
|
|
47
|
+
this.progressBorder.height = this.loadingStatusContainerHeight;
|
|
48
|
+
this.progressBar.width = this.getLoadingStatusContainerWidth();
|
|
49
|
+
this.progressBar.height = this.loadingStatusContainerHeight;
|
|
50
|
+
this.progressBar.mask = this.progressBarMask;
|
|
41
51
|
const loaderTextStyle = new TextStyle({
|
|
42
52
|
fontFamily: RainMan.config.fontFace,
|
|
43
53
|
fontSize: 24,
|
|
@@ -49,11 +59,27 @@ export class SpriteLoadingContainer extends Container {
|
|
|
49
59
|
align: "center",
|
|
50
60
|
...textOptions
|
|
51
61
|
});
|
|
52
|
-
this.text = new Text(
|
|
53
|
-
this.text.anchor.set(0, 0.5);
|
|
54
|
-
this.
|
|
55
|
-
this.addChild(this.
|
|
62
|
+
this.text = new Text("", loaderTextStyle);
|
|
63
|
+
this.text.anchor.set(0.5, 0.5);
|
|
64
|
+
this.addChild(this.progressBorderShadow);
|
|
65
|
+
this.addChild(this.progressBorderMask);
|
|
66
|
+
this.addChild(this.progressBorder);
|
|
67
|
+
this.addChild(this.progressBarMask);
|
|
68
|
+
this.addChild(this.progressBar);
|
|
56
69
|
this.addChild(this.text);
|
|
70
|
+
this.reposition();
|
|
71
|
+
RainMan.app.ticker.add(this.animateProgress, this);
|
|
72
|
+
}
|
|
73
|
+
waitForCompletion() {
|
|
74
|
+
if (this.isComplete()) {
|
|
75
|
+
return Promise.resolve();
|
|
76
|
+
}
|
|
77
|
+
if (!this.completionPromise) {
|
|
78
|
+
this.completionPromise = new Promise((resolve) => {
|
|
79
|
+
this.completionPromiseResolver = resolve;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return this.completionPromise;
|
|
57
83
|
}
|
|
58
84
|
/**
|
|
59
85
|
* Function for updating loading progress
|
|
@@ -62,8 +88,12 @@ export class SpriteLoadingContainer extends Container {
|
|
|
62
88
|
* @returns {void}
|
|
63
89
|
*/
|
|
64
90
|
updateProgress(progress) {
|
|
65
|
-
|
|
66
|
-
|
|
91
|
+
const normalizedProgress = Math.max(0, Math.min(progress, 1));
|
|
92
|
+
if (normalizedProgress < this.progress) {
|
|
93
|
+
this.progress = normalizedProgress;
|
|
94
|
+
}
|
|
95
|
+
this.targetProgress = normalizedProgress;
|
|
96
|
+
this.updateProgressMask();
|
|
67
97
|
}
|
|
68
98
|
/**
|
|
69
99
|
* Function for setting error text
|
|
@@ -72,27 +102,42 @@ export class SpriteLoadingContainer extends Container {
|
|
|
72
102
|
* @returns {void}
|
|
73
103
|
*/
|
|
74
104
|
setError(errorMessage) {
|
|
75
|
-
this.errorBackground = new Graphics();
|
|
76
105
|
this.removeProgressBar();
|
|
77
106
|
this.text.text = errorMessage[0].toUpperCase() + errorMessage.substring(1);
|
|
78
107
|
this.text.style.fill = "0xffffff";
|
|
79
|
-
this.errorBackground.beginFill(0x000000, 0.8);
|
|
80
|
-
this.errorBackground.drawRoundedRect(0, 0, this.text.width + this.errorBackgroundPaddingWidth, this.text.height + this.errorBackgroundPaddingHeight, 8);
|
|
81
|
-
this.errorBackground.endFill();
|
|
82
|
-
this.addChild(this.errorBackground);
|
|
83
108
|
this.addChild(this.text);
|
|
84
109
|
this.reposition();
|
|
85
110
|
}
|
|
86
111
|
removeProgressBar() {
|
|
87
|
-
this.removeChild(this.
|
|
88
|
-
this.removeChild(this.
|
|
112
|
+
this.removeChild(this.progressBorderShadow);
|
|
113
|
+
this.removeChild(this.progressBorderMask);
|
|
114
|
+
this.removeChild(this.progressBorder);
|
|
115
|
+
this.removeChild(this.progressBarMask);
|
|
116
|
+
this.removeChild(this.progressBar);
|
|
89
117
|
this.removeChild(this.text);
|
|
90
118
|
}
|
|
119
|
+
remove() {
|
|
120
|
+
RainMan.app.ticker.remove(this.animateProgress, this);
|
|
121
|
+
}
|
|
91
122
|
/**
|
|
92
123
|
* Function for resizing loading container elements
|
|
93
124
|
* @public
|
|
94
125
|
* @returns {void}
|
|
95
126
|
*/
|
|
127
|
+
recreateProgressBar() {
|
|
128
|
+
const loadingStatusContainerWidth = this.getLoadingStatusContainerWidth() + 1;
|
|
129
|
+
this.progressBorderShadow.width = loadingStatusContainerWidth;
|
|
130
|
+
this.progressBorderShadow.height = this.loadingStatusContainerHeight;
|
|
131
|
+
this.progressBorder.width = loadingStatusContainerWidth;
|
|
132
|
+
this.progressBorder.height = this.loadingStatusContainerHeight;
|
|
133
|
+
this.progressBorderMask.clear();
|
|
134
|
+
this.progressBorderMask.beginFill(0xffffff);
|
|
135
|
+
this.progressBorderMask.drawRoundedRect(0, 0, loadingStatusContainerWidth, this.loadingStatusContainerHeight, 8);
|
|
136
|
+
this.progressBorderMask.beginHole();
|
|
137
|
+
this.progressBorderMask.drawRoundedRect(this.progressBorderWidth / 2, this.progressBorderWidth / 2, loadingStatusContainerWidth - this.progressBorderWidth, this.loadingStatusContainerHeight - this.progressBorderWidth, 7);
|
|
138
|
+
this.progressBorderMask.endHole();
|
|
139
|
+
this.progressBorderMask.endFill();
|
|
140
|
+
}
|
|
96
141
|
resize() {
|
|
97
142
|
this.reposition();
|
|
98
143
|
}
|
|
@@ -102,20 +147,68 @@ export class SpriteLoadingContainer extends Container {
|
|
|
102
147
|
* @returns {void}
|
|
103
148
|
*/
|
|
104
149
|
reposition() {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
150
|
+
const startY = getDeviceOrientation().includes("mobile")
|
|
151
|
+
? RainMan.app.screen.height / 2 + this.progressBar.height * 3
|
|
152
|
+
: RainMan.app.screen.height / 2 + 100;
|
|
153
|
+
const loadingStatusContainerWidth = this.getLoadingStatusContainerWidth();
|
|
154
|
+
this.recreateProgressBar();
|
|
155
|
+
this.progressBorderShadow.width = loadingStatusContainerWidth + 2;
|
|
156
|
+
this.progressBorderShadow.height = this.loadingStatusContainerHeight;
|
|
157
|
+
this.progressBorder.width = loadingStatusContainerWidth + 2;
|
|
158
|
+
this.progressBorder.height = this.loadingStatusContainerHeight;
|
|
159
|
+
this.progressBar.width = loadingStatusContainerWidth;
|
|
160
|
+
this.progressBar.height = this.loadingStatusContainerHeight;
|
|
161
|
+
this.progressBorderShadow.x = RainMan.app.screen.width / 2 - loadingStatusContainerWidth / 2;
|
|
162
|
+
this.progressBorderShadow.y = startY + 1;
|
|
163
|
+
this.progressBorder.x = RainMan.app.screen.width / 2 - loadingStatusContainerWidth / 2;
|
|
164
|
+
this.progressBorder.y = startY;
|
|
165
|
+
this.progressBorderMask.x = this.progressBorder.x;
|
|
166
|
+
this.progressBorderMask.y = this.progressBorder.y;
|
|
167
|
+
if (this.text.text !== "") {
|
|
168
|
+
this.text.x = RainMan.app.screen.width / 2;
|
|
169
|
+
this.text.y = RainMan.app.screen.height / 2;
|
|
113
170
|
}
|
|
114
171
|
else {
|
|
115
|
-
this.
|
|
116
|
-
this.
|
|
117
|
-
this.
|
|
118
|
-
this.
|
|
172
|
+
this.progressBar.y = this.progressBorder.y;
|
|
173
|
+
this.progressBar.x = this.progressBorder.x;
|
|
174
|
+
this.progressBarMask.y = this.progressBar.y;
|
|
175
|
+
this.progressBarMask.x = this.progressBar.x;
|
|
176
|
+
this.text.x = RainMan.app.screen.width / 2;
|
|
177
|
+
this.text.y = startY + this.text.height;
|
|
178
|
+
this.updateProgressMask();
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
getLoadingStatusContainerWidth() {
|
|
182
|
+
return getDeviceOrientation() === "mobile-portrait"
|
|
183
|
+
? RainMan.app.screen.width * 0.5
|
|
184
|
+
: RainMan.app.screen.width * 0.35;
|
|
185
|
+
}
|
|
186
|
+
updateProgressMask() {
|
|
187
|
+
const loadingStatusContainerWidth = this.getLoadingStatusContainerWidth();
|
|
188
|
+
this.progressBarMask.clear();
|
|
189
|
+
this.progressBarMask.beginFill(0xffffff);
|
|
190
|
+
this.progressBarMask.drawRoundedRect(0, 0, loadingStatusContainerWidth * this.progress, this.loadingStatusContainerHeight, 8);
|
|
191
|
+
this.progressBarMask.endFill();
|
|
192
|
+
}
|
|
193
|
+
animateProgress() {
|
|
194
|
+
if (this.progress >= this.targetProgress) {
|
|
195
|
+
this.resolveCompletionIfReady();
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
const maxStep = RainMan.app.ticker.deltaMS / this.minimumFullProgressDuration;
|
|
199
|
+
this.progress = Math.min(this.progress + maxStep, this.targetProgress);
|
|
200
|
+
this.updateProgressMask();
|
|
201
|
+
this.resolveCompletionIfReady();
|
|
202
|
+
}
|
|
203
|
+
isComplete() {
|
|
204
|
+
return this.targetProgress === 1 && this.progress >= this.targetProgress;
|
|
205
|
+
}
|
|
206
|
+
resolveCompletionIfReady() {
|
|
207
|
+
if (!this.isComplete() || !this.completionPromiseResolver) {
|
|
208
|
+
return;
|
|
119
209
|
}
|
|
210
|
+
this.completionPromiseResolver();
|
|
211
|
+
this.completionPromiseResolver = null;
|
|
212
|
+
this.completionPromise = null;
|
|
120
213
|
}
|
|
121
214
|
}
|
package/package.json
CHANGED