pixi-rainman-game-engine 0.1.7 → 0.1.8
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/Money/MoneyText.js +2 -2
- package/dist/Rainman/Rainman.d.ts +2 -0
- package/dist/Rainman/Rainman.js +3 -0
- package/dist/Rainman/appConfig.js +0 -2
- package/dist/Rainman/types.d.ts +0 -2
- package/dist/application/SpinLogic/util.d.ts +3 -1
- package/dist/application/SpinLogic/util.js +16 -0
- package/dist/components/buttons/buttonGroups/LeftButtons.js +0 -6
- package/dist/components/frame/AbstractColumnsContainer.d.ts +2 -0
- package/dist/components/frame/AbstractColumnsContainer.js +7 -0
- package/dist/components/frame/AbstractFrame.d.ts +3 -1
- package/dist/components/frame/AbstractFrame.js +16 -8
- package/dist/connectivity/ConnectionWrapper.js +2 -0
- package/dist/connectivity/LocalConnectionWrapper.js +3 -0
- package/dist/connectivity/transformation.d.ts +22 -2
- package/package.json +1 -1
package/dist/Money/MoneyText.js
CHANGED
|
@@ -10,9 +10,9 @@ import { RainMan } from "../Rainman";
|
|
|
10
10
|
export class MoneyText {
|
|
11
11
|
money;
|
|
12
12
|
constructor(amount) {
|
|
13
|
-
this.money = Money.fromDecimal(amount, RainMan.
|
|
13
|
+
this.money = Money.fromDecimal(amount, RainMan.currency, Math.round);
|
|
14
14
|
}
|
|
15
15
|
toString() {
|
|
16
|
-
return `${this.money} ${RainMan.
|
|
16
|
+
return `${this.money} ${RainMan.currency.symbol_native}`;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "../components/dictionary/i18n";
|
|
2
2
|
import { Application } from "pixi.js";
|
|
3
|
+
import { Currency } from "ts-money";
|
|
3
4
|
import { SpinLogicFactory, SymbolIds, WinTypeIds } from "../application";
|
|
4
5
|
import { ComponentRegistry } from "../ComponentRegistry";
|
|
5
6
|
import { SettingsStore } from "../stores";
|
|
@@ -12,5 +13,6 @@ export declare class RainMan {
|
|
|
12
13
|
static settingsStore: SettingsStore;
|
|
13
14
|
static componentRegistry: ComponentRegistry;
|
|
14
15
|
static spinLogicFactory: SpinLogicFactory;
|
|
16
|
+
static currency: Currency;
|
|
15
17
|
constructor(app: Application, config: AppConfig, symbolIds: SymbolIds, winTypeIds: WinTypeIds, spinLogicFactory: SpinLogicFactory);
|
|
16
18
|
}
|
package/dist/Rainman/Rainman.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "../components/dictionary/i18n";
|
|
2
2
|
import { merge } from "lodash";
|
|
3
|
+
import { Currencies } from "ts-money";
|
|
3
4
|
import { ComponentRegistry } from "../ComponentRegistry";
|
|
4
5
|
import { settingStore } from "../SettingsUI/hooks";
|
|
5
6
|
import { defaultAppConfig } from "./appConfig";
|
|
@@ -11,6 +12,7 @@ export class RainMan {
|
|
|
11
12
|
static settingsStore;
|
|
12
13
|
static componentRegistry;
|
|
13
14
|
static spinLogicFactory;
|
|
15
|
+
static currency;
|
|
14
16
|
constructor(app, config, symbolIds, winTypeIds, spinLogicFactory) {
|
|
15
17
|
RainMan.app = app;
|
|
16
18
|
RainMan.config = merge(defaultAppConfig, config);
|
|
@@ -19,5 +21,6 @@ export class RainMan {
|
|
|
19
21
|
RainMan.settingsStore = settingStore;
|
|
20
22
|
RainMan.componentRegistry = new ComponentRegistry(app);
|
|
21
23
|
RainMan.spinLogicFactory = spinLogicFactory;
|
|
24
|
+
RainMan.currency = Currencies["USD"];
|
|
22
25
|
}
|
|
23
26
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Color } from "pixi.js";
|
|
2
|
-
import { Currencies } from "ts-money";
|
|
3
2
|
/**
|
|
4
3
|
* This object represents default object for pixi application
|
|
5
4
|
* Here you can specify the default font, color of text etc.
|
|
@@ -16,7 +15,6 @@ export const defaultAppConfig = {
|
|
|
16
15
|
fontColor: new Color(0xfbd400).toHex(),
|
|
17
16
|
updatableTextValueColor: new Color(0xffffff).toHex(),
|
|
18
17
|
fontFace: ["HelveticaNeueLTStd"],
|
|
19
|
-
currency: Currencies["USD"],
|
|
20
18
|
durationOfActions: {
|
|
21
19
|
eachColumnsSpinDelay: [0, 200, 700, 1200, 1800],
|
|
22
20
|
spinBaseTime: 800,
|
package/dist/Rainman/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Currency } from "ts-money";
|
|
2
1
|
import { DeepPartial } from "../utils";
|
|
3
2
|
export type RequiredAppConfig = {
|
|
4
3
|
websocketUrl: string;
|
|
@@ -12,7 +11,6 @@ export type OptionalAppConfig = {
|
|
|
12
11
|
gameWidth: number;
|
|
13
12
|
gameHeight: number;
|
|
14
13
|
idleTimeout: number;
|
|
15
|
-
currency: Currency;
|
|
16
14
|
fontSize: number;
|
|
17
15
|
updatableSpineContainerFontSize: number;
|
|
18
16
|
mobileFontSize: number;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { DropTransformationDetails, RawWin, Result, SpinDataInterface, TransformationDetails, WinWithTransformation } from "../../connectivity";
|
|
1
|
+
import { DropTransformationDetails, FreezeTransformationDetails, RawFreezeTransformationDetails, RawWin, Result, SpinAndFreezeTransformationDetails, SpinDataInterface, SymbolReels, TransformationDetails, WinWithTransformation } from "../../connectivity";
|
|
2
2
|
import { ApiConfig } from "../ApiConfig";
|
|
3
3
|
export declare const concatenateDestroyAndSetTransformations: (spinLogicResponse: SpinDataInterface, currentIndexOfRootTransformation: number, gameConfig: ApiConfig) => [DropTransformationDetails[], number];
|
|
4
4
|
export declare const mapSymbolIdsToSymbolNames: (symbols_on_reels: number[][], gameConfig: ApiConfig) => never[][];
|
|
5
|
+
export declare const getFreezeTransformationFromRawResponse: (transformations: RawFreezeTransformationDetails[]) => FreezeTransformationDetails[];
|
|
6
|
+
export declare const concatenateFreezeAndSpinTransformations: (freezeTransformations: FreezeTransformationDetails[], onStopBlindsConfiguration: SymbolReels) => SpinAndFreezeTransformationDetails;
|
|
5
7
|
export declare const isBlindsConfiguredByTransformations: (results: Result[]) => number[][] | null;
|
|
6
8
|
export declare const collectWinDetailsWithTransformation: (winIndex: string | null, winsDetails: RawWin | null, transformations: TransformationDetails[]) => WinWithTransformation;
|
|
@@ -65,6 +65,22 @@ export const concatenateDestroyAndSetTransformations = (spinLogicResponse, curre
|
|
|
65
65
|
export const mapSymbolIdsToSymbolNames = (symbols_on_reels, gameConfig) => {
|
|
66
66
|
return symbols_on_reels.map((reel) => reel.map((symbolId) => gameConfig.getSymbolId(symbolId)));
|
|
67
67
|
};
|
|
68
|
+
export const getFreezeTransformationFromRawResponse = (transformations) => {
|
|
69
|
+
return transformations.map((freezeTransformation) => {
|
|
70
|
+
return {
|
|
71
|
+
type: transformationTypes.freeze,
|
|
72
|
+
coordinates: freezeTransformation.coordinates,
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
export const concatenateFreezeAndSpinTransformations = (freezeTransformations, onStopBlindsConfiguration) => {
|
|
77
|
+
const allCoordinatesToFreeze = freezeTransformations.map((details) => details.coordinates);
|
|
78
|
+
return {
|
|
79
|
+
type: transformationTypes.spinAndFreeze,
|
|
80
|
+
coordinates: allCoordinatesToFreeze,
|
|
81
|
+
symbolsOnReels: onStopBlindsConfiguration,
|
|
82
|
+
};
|
|
83
|
+
};
|
|
68
84
|
export const isBlindsConfiguredByTransformations = (results) => {
|
|
69
85
|
// make copy of results because reverse is made in place
|
|
70
86
|
const reversedResults = [...results].reverse();
|
|
@@ -31,12 +31,6 @@ export class LeftButtons extends ResponsiveContainer {
|
|
|
31
31
|
]);
|
|
32
32
|
}
|
|
33
33
|
reposition() {
|
|
34
|
-
this.moreButton.x = 20;
|
|
35
|
-
this.moreButton.y = 0;
|
|
36
|
-
this.volumeButton.x = this.moreButton.x;
|
|
37
|
-
this.volumeButton.y = this.moreButton.y + this.moreButton.height + 5;
|
|
38
|
-
this.infoButton.x = 90;
|
|
39
|
-
this.infoButton.y = 10;
|
|
40
34
|
const margin = 15;
|
|
41
35
|
this.y = RainMan.app.screen.height - this.height;
|
|
42
36
|
this.credit.x = this.infoButton.x + this.infoButton.width + margin;
|
|
@@ -22,6 +22,7 @@ export declare abstract class AbstractColumnsContainer extends Container impleme
|
|
|
22
22
|
private currentColumn;
|
|
23
23
|
private playedSounds;
|
|
24
24
|
quickReelsStop: boolean;
|
|
25
|
+
protected playLineSoundOnEachStreak: boolean;
|
|
25
26
|
protected abstract mapSymbolToSound: Record<string, SoundTrack>;
|
|
26
27
|
protected abstract maskCoordinates: {
|
|
27
28
|
top: number;
|
|
@@ -67,5 +68,6 @@ export declare abstract class AbstractColumnsContainer extends Container impleme
|
|
|
67
68
|
setInteractivityForSymbols(flag: boolean): void;
|
|
68
69
|
handleDestroyTransformations(transformations: DropTransformationDetails[], skipAnimations?: boolean, isStandalone?: boolean): Promise<void>;
|
|
69
70
|
protected createMask(): Graphics;
|
|
71
|
+
fixSymbolsColumnsPosition(): void;
|
|
70
72
|
private prepareConfiguringReelsEnd;
|
|
71
73
|
}
|
|
@@ -24,6 +24,7 @@ export class AbstractColumnsContainer extends Container {
|
|
|
24
24
|
currentColumn = null;
|
|
25
25
|
playedSounds = [];
|
|
26
26
|
quickReelsStop = false;
|
|
27
|
+
playLineSoundOnEachStreak = false;
|
|
27
28
|
constructor() {
|
|
28
29
|
super();
|
|
29
30
|
this.x = 0;
|
|
@@ -134,7 +135,10 @@ export class AbstractColumnsContainer extends Container {
|
|
|
134
135
|
return;
|
|
135
136
|
SoundManager.play(sound);
|
|
136
137
|
this.playedSounds.push(sound);
|
|
138
|
+
return;
|
|
137
139
|
}
|
|
140
|
+
if (this.playLineSoundOnEachStreak)
|
|
141
|
+
SoundManager.play(SoundTracks.line);
|
|
138
142
|
}
|
|
139
143
|
/**
|
|
140
144
|
* Function for playing animation of streak
|
|
@@ -199,6 +203,9 @@ export class AbstractColumnsContainer extends Container {
|
|
|
199
203
|
mask.endFill();
|
|
200
204
|
return mask;
|
|
201
205
|
}
|
|
206
|
+
fixSymbolsColumnsPosition() {
|
|
207
|
+
this.allColumns.forEach((column) => column.fixStationaryPositions());
|
|
208
|
+
}
|
|
202
209
|
prepareConfiguringReelsEnd(finalSymbolReels) {
|
|
203
210
|
return this.allColumns.map((column, index) => async () => {
|
|
204
211
|
column.configBlindSpin(finalSymbolReels[index]);
|
|
@@ -28,7 +28,7 @@ export declare abstract class AbstractFrame extends ResumableContainer implement
|
|
|
28
28
|
endAnimationName?: string;
|
|
29
29
|
}>;
|
|
30
30
|
protected abstract innerFrame: AbstractInnerFrame;
|
|
31
|
-
|
|
31
|
+
protected winLineAnimations: WinLineAnimation[];
|
|
32
32
|
protected constructor(spineName: string);
|
|
33
33
|
get columnsContainer(): AbstractColumnsContainer;
|
|
34
34
|
adaptToSpeed(speedLevel: SpeedLevel): void;
|
|
@@ -37,8 +37,10 @@ export declare abstract class AbstractFrame extends ResumableContainer implement
|
|
|
37
37
|
hideMysteryFx(): Promise<void>;
|
|
38
38
|
destroyMysteryFx(): void;
|
|
39
39
|
protected abstract createWinLineAnimation(_animationName: string): WinLineAnimation;
|
|
40
|
+
playAllWinLineAnimations(animationNames: string[]): Promise<void>;
|
|
40
41
|
playWinLineAnimation(animationName: string): Promise<void>;
|
|
41
42
|
stopPlayingWinLineAnimations(): void;
|
|
43
|
+
isPlayingWinLineAnimation(): boolean;
|
|
42
44
|
protected abstract changeFrameForOrientation(): void;
|
|
43
45
|
protected setFrame(spineName: string, animationName: string): void;
|
|
44
46
|
resize(): void;
|
|
@@ -21,7 +21,7 @@ export class AbstractFrame extends ResumableContainer {
|
|
|
21
21
|
velocityMultiplier = defaultSpeedConfig.symbolsColumnsSpeed;
|
|
22
22
|
mysteryFxHighlight = null;
|
|
23
23
|
mysteryFxConfig = null;
|
|
24
|
-
|
|
24
|
+
winLineAnimations = [];
|
|
25
25
|
constructor(spineName) {
|
|
26
26
|
super();
|
|
27
27
|
this.name = AbstractFrame.registryName;
|
|
@@ -72,16 +72,24 @@ export class AbstractFrame extends ResumableContainer {
|
|
|
72
72
|
this.mysteryFxHighlight = null;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
+
async playAllWinLineAnimations(animationNames) {
|
|
76
|
+
await Promise.all(animationNames.map((animationName) => this.playWinLineAnimation(animationName)));
|
|
77
|
+
}
|
|
75
78
|
async playWinLineAnimation(animationName) {
|
|
76
|
-
|
|
77
|
-
this.winLineAnimation
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
this.winLineAnimation
|
|
79
|
+
const winLineAnimation = this.createWinLineAnimation(animationName);
|
|
80
|
+
this.winLineAnimations.push(winLineAnimation);
|
|
81
|
+
winLineAnimation.parentLayer = FrameLayer;
|
|
82
|
+
this.addChild(winLineAnimation);
|
|
83
|
+
await winLineAnimation.play();
|
|
84
|
+
this.removeChild(winLineAnimation);
|
|
85
|
+
this.stopPlayingWinLineAnimations();
|
|
82
86
|
}
|
|
83
87
|
stopPlayingWinLineAnimations() {
|
|
84
|
-
this.winLineAnimation
|
|
88
|
+
this.winLineAnimations.map((winLineAnimation) => winLineAnimation.resolvePlayingPromise());
|
|
89
|
+
this.winLineAnimations = [];
|
|
90
|
+
}
|
|
91
|
+
isPlayingWinLineAnimation() {
|
|
92
|
+
return this.winLineAnimations.length > 0;
|
|
85
93
|
}
|
|
86
94
|
setFrame(spineName, animationName) {
|
|
87
95
|
this.columnsContainer.doResize();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Currencies } from "ts-money";
|
|
1
2
|
import { ApiConfig } from "../application";
|
|
2
3
|
import { SpinData, } from "../connectivity";
|
|
3
4
|
import { RainMan } from "../Rainman";
|
|
@@ -69,6 +70,7 @@ export class ConnectionWrapper {
|
|
|
69
70
|
},
|
|
70
71
|
vendor_id: RainMan.config.gameInitVendorId,
|
|
71
72
|
}));
|
|
73
|
+
RainMan.currency = Currencies[this._initData.currency];
|
|
72
74
|
}
|
|
73
75
|
initData() {
|
|
74
76
|
return this._initData;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { Currencies } from "ts-money";
|
|
1
2
|
import { ApiConfig } from "../application";
|
|
3
|
+
import { RainMan } from "../Rainman";
|
|
2
4
|
import { apiQueue } from "./apiQueue";
|
|
3
5
|
import { SpinData } from "./spinData";
|
|
4
6
|
export class LocalConnectionWrapper {
|
|
@@ -17,6 +19,7 @@ export class LocalConnectionWrapper {
|
|
|
17
19
|
fetchInitData() {
|
|
18
20
|
this._initData = (window.testingData?.initResponse || this.initResponse);
|
|
19
21
|
this.config = new ApiConfig(this._initData);
|
|
22
|
+
RainMan.currency = Currencies[this._initData.currency];
|
|
20
23
|
return Promise.resolve();
|
|
21
24
|
}
|
|
22
25
|
initData() {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { transformationTypes } from "constants/transformation";
|
|
2
2
|
import { SymbolId } from "../application";
|
|
3
|
+
import { SymbolReels } from "./wins";
|
|
3
4
|
export type Point = {
|
|
4
5
|
x: number;
|
|
5
6
|
y: number;
|
|
@@ -20,7 +21,20 @@ export type ReplaceTransformationDetails = {
|
|
|
20
21
|
from: Point;
|
|
21
22
|
to: Point;
|
|
22
23
|
};
|
|
23
|
-
export type
|
|
24
|
+
export type SpinTransformationDetails = {
|
|
25
|
+
type: typeof transformationTypes.spin;
|
|
26
|
+
symbolsOnReels: SymbolReels;
|
|
27
|
+
};
|
|
28
|
+
export type FreezeTransformationDetails = {
|
|
29
|
+
type: typeof transformationTypes.freeze;
|
|
30
|
+
coordinates: Point;
|
|
31
|
+
};
|
|
32
|
+
export type SpinAndFreezeTransformationDetails = {
|
|
33
|
+
type: typeof transformationTypes.spinAndFreeze;
|
|
34
|
+
symbolsOnReels: SymbolReels;
|
|
35
|
+
coordinates: Point[];
|
|
36
|
+
};
|
|
37
|
+
export type TransformationDetails = DropTransformationDetails | VerticalTransformationDetails | ReplaceTransformationDetails | SpinTransformationDetails | FreezeTransformationDetails;
|
|
24
38
|
export type RawVerticalTransformationDetails = {
|
|
25
39
|
coordinates: Point;
|
|
26
40
|
};
|
|
@@ -32,4 +46,10 @@ export type RawReplaceTransformationDetails = {
|
|
|
32
46
|
from_coordinates: Point;
|
|
33
47
|
to_coordinates: Point;
|
|
34
48
|
};
|
|
35
|
-
export type
|
|
49
|
+
export type RawFreezeTransformationDetails = {
|
|
50
|
+
coordinates: Point;
|
|
51
|
+
};
|
|
52
|
+
export type RawSpinTransformationDetails = {
|
|
53
|
+
symbol_on_reels: number[][];
|
|
54
|
+
};
|
|
55
|
+
export type RawTransformationDetails = RawReplaceTransformationDetails | RawSetTransformationDetails | RawVerticalTransformationDetails | RawFreezeTransformationDetails | RawSpinTransformationDetails;
|