pixi-rainman-game-engine 0.1.29 → 0.1.31
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/README.md +45 -1
- package/dist/ComponentRegistry/ComponentRegistry.d.ts +6 -0
- package/dist/ComponentRegistry/ComponentRegistry.js +6 -0
- package/dist/ComponentRegistry/types.d.ts +6 -0
- package/dist/DescribedPlayableAction/DescribedPlayableAction.d.ts +3 -0
- package/dist/DescribedPlayableAction/DescribedPlayableAction.js +3 -0
- package/dist/application/ApiConfig/SymbolId.d.ts +1 -0
- package/dist/application/ApiConfig/TransformationTypesId.d.ts +1 -0
- package/dist/application/ApiConfig/WinTypeId.d.ts +1 -0
- package/dist/application/ButtonsEventManager/ButtonsEventManager.d.ts +26 -0
- package/dist/application/ButtonsEventManager/ButtonsEventManager.js +26 -0
- package/dist/application/SoundManager/SoundManager.d.ts +7 -2
- package/dist/application/SoundManager/SoundManager.js +11 -12
- package/dist/application/SoundManager/types.d.ts +31 -1
- package/dist/application/SoundManager/types.js +25 -0
- package/dist/application/SpeedState/SpeedLevelHandler.d.ts +30 -1
- package/dist/application/SpeedState/SpeedLevelHandler.js +31 -2
- package/dist/application/SpinLogic/SpinLogicDTO.d.ts +25 -0
- package/dist/application/SpinLogic/SpinLogicDTO.js +27 -7
- package/dist/application/SpinLogic/WinScenarios.d.ts +5 -0
- package/dist/application/SpinLogic/WinScenarios.js +5 -0
- package/dist/application/SpinLogic/util.d.ts +36 -0
- package/dist/application/SpinLogic/util.js +51 -0
- package/dist/components/AbstractFreeSpinContainer/AbstractFreeSpinContainer.d.ts +3 -0
- package/dist/components/AbstractMainContainer/AbstractMainContainer.d.ts +25 -0
- package/dist/components/AbstractMainContainer/AbstractMainContainer.js +25 -0
- package/dist/components/buttons/buttonGroups/LeftButtons.d.ts +10 -0
- package/dist/components/buttons/buttonGroups/LeftButtons.js +10 -0
- package/dist/components/common/AnimatedBackground.d.ts +1 -1
- package/dist/components/common/AnimatedBackground.js +1 -1
- package/dist/components/frame/WinLineAnimation.d.ts +0 -1
- package/dist/components/frame/WinLineAnimation.js +0 -1
- package/dist/components/messageBox/MessageBox.d.ts +6 -0
- package/dist/components/messageBox/MessageBox.js +6 -0
- package/dist/components/updatable/UpdatableTextComponent.d.ts +8 -0
- package/dist/components/updatable/UpdatableTextComponent.js +8 -0
- package/dist/components/updatable/UpdatableValueComponent.d.ts +11 -0
- package/dist/components/updatable/UpdatableValueComponent.js +11 -0
- package/dist/components/winLineIndicator/WinLineIndicator.d.ts +10 -0
- package/dist/components/winLineIndicator/WinLineIndicator.js +10 -0
- package/dist/connectivity/ConnectionWrapper.d.ts +27 -0
- package/dist/connectivity/ConnectionWrapper.js +27 -0
- package/dist/connectivity/LocalConnectionWrapper.d.ts +5 -0
- package/dist/connectivity/LocalConnectionWrapper.js +5 -0
- package/dist/connectivity/apiQueue.d.ts +7 -0
- package/dist/connectivity/apiQueue.js +7 -0
- package/dist/connectivity/serverData.d.ts +1 -1
- package/dist/connectivity/wins.d.ts +7 -1
- package/dist/constants/wins.d.ts +2 -0
- package/dist/constants/wins.js +2 -0
- package/dist/controllers/AbstractController.d.ts +76 -0
- package/dist/controllers/AbstractController.js +77 -0
- package/dist/controllers/QuickStopController.d.ts +6 -0
- package/dist/controllers/QuickStopController.js +6 -0
- package/dist/controllers/UiController.d.ts +8 -0
- package/dist/controllers/UiController.js +8 -0
- package/dist/errors/LanguageNotDefinedError.js +1 -1
- package/dist/errors/SpineDataNotFound.js +1 -1
- package/dist/errors/TextureNotFound.js +1 -1
- package/dist/utils/common/deviceOrientation.d.ts +5 -0
- package/dist/utils/common/deviceOrientation.js +5 -0
- package/dist/utils/common/logger.js +1 -1
- package/dist/utils/common/stats.d.ts +3 -0
- package/dist/utils/common/stats.js +6 -0
- package/dist/winComponents/winFactory.d.ts +12 -0
- package/dist/winComponents/winFactory.js +12 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,50 @@
|
|
|
2
2
|
|
|
3
3
|
This repository contains all the mechanics that used in RainMan games. This library uses pixi and pixi-spine as dependencies.
|
|
4
4
|
|
|
5
|
+
### Development scripts
|
|
6
|
+
|
|
7
|
+
In this repository you have directory `scripts`, contains scripts for deployment to digital ocean and preparing tags and releases for games. As you can use linux or MacOS environment, you should add permissions for executing the script. To do this you should perform a command:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
chmod +x ./scripts
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
After adding permissions for scripts, to operate the scripts you should installed following programs:
|
|
14
|
+
|
|
15
|
+
- [gh](https://formulae.brew.sh/formula/gh)
|
|
16
|
+
- [jq](https://formulae.brew.sh/formula/jq)
|
|
17
|
+
- [git](https://formulae.brew.sh/formula/git)
|
|
18
|
+
|
|
19
|
+
In the `scripts` directory, you have three scripts:
|
|
20
|
+
|
|
21
|
+
1. `apply_diff.sh` \
|
|
22
|
+
This script applying should apply diff file for all of the games. This should automate adding the same changes to the all games that uses engine.
|
|
23
|
+
|
|
24
|
+
Example:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
./scripts/apply_diff.sh "CD-XXX" "XXX" ./newChanges.diff
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
2. `auto_merge.sh` \
|
|
31
|
+
This scripts is used for merging pull requests with given issue. This scripts uses gh, which is responsible for communicating with github. This scripts, have option to create git tag and release for deployment. To enable this option you should add true second parameter.
|
|
32
|
+
|
|
33
|
+
Example:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
./scripts/auto_merge.sh "CD-XXX"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
3. `prepare_for_deployment.sh` \
|
|
40
|
+
This scripts is used to preparing for deployment on DigitalOcean. The script automates changing the version and adding date to version in `package.json` for each game. Default behavior is to increase the patch version of the game.
|
|
41
|
+
This script uses environment variable `PR_REVIEWER`, to add reviewer/s to each pr.
|
|
42
|
+
|
|
43
|
+
Example:
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
./scripts/prepare_for_deployment.sh "CD-XXX" "Commit message"
|
|
47
|
+
```
|
|
48
|
+
|
|
5
49
|
### Scripts
|
|
6
50
|
|
|
7
51
|
1. To build library
|
|
@@ -11,7 +55,7 @@ This repository contains all the mechanics that used in RainMan games. This libr
|
|
|
11
55
|
2. To build library during development
|
|
12
56
|
|
|
13
57
|
```sh
|
|
14
|
-
|
|
58
|
+
yarn dev:build
|
|
15
59
|
```
|
|
16
60
|
|
|
17
61
|
Modifying css files does not automatically reload server, after each change manual restart is needed.
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { Application, Container } from "pixi.js";
|
|
2
2
|
import { SpeedLevel } from "../application";
|
|
3
3
|
import { RegistryMap } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* Class for managing components in game
|
|
6
|
+
*
|
|
7
|
+
* @exports
|
|
8
|
+
* @class ComponentRegistry
|
|
9
|
+
*/
|
|
4
10
|
export declare class ComponentRegistry {
|
|
5
11
|
private registry;
|
|
6
12
|
private speedAdaptableComponents;
|
|
@@ -2,6 +2,12 @@ import { isIncentiveComponentInterface, isSpeedAdapterInterface, SPEED_LEVELS, S
|
|
|
2
2
|
import { SpeedControlButton } from "../components";
|
|
3
3
|
import { RainMan } from "../Rainman";
|
|
4
4
|
import { openFullscreen } from "../utils";
|
|
5
|
+
/**
|
|
6
|
+
* Class for managing components in game
|
|
7
|
+
*
|
|
8
|
+
* @exports
|
|
9
|
+
* @class ComponentRegistry
|
|
10
|
+
*/
|
|
5
11
|
export class ComponentRegistry {
|
|
6
12
|
registry = new Map();
|
|
7
13
|
speedAdaptableComponents = new Set();
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { AbstractColumnsContainer, AbstractFrame, AbstractInnerFrame, AutoplayButton, Background, BaseButton, BUTTONS, COMPONENTS, FreeSpinButton, InfoButton, MessageBox, MoreButton, NegButton, PlusButton, RefreshButton, SpeedControlButton, StylefulUpdatableText, UpdatableTextComponent, UpdatableValueComponent, VolumeButton } from "../components";
|
|
2
|
+
/**
|
|
3
|
+
* RegistryMap is a map of all components that are registered in the ComponentRegistry.
|
|
4
|
+
* It is used to type-check the components that are registered in the ComponentRegistry.
|
|
5
|
+
*
|
|
6
|
+
* @exports
|
|
7
|
+
*/
|
|
2
8
|
export interface RegistryMap {
|
|
3
9
|
[MessageBox.autoSpinTextRegistryName]: UpdatableValueComponent;
|
|
4
10
|
[MessageBox.currentWinTextRegistryName]: UpdatableTextComponent;
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import { Nullable } from "../../utils";
|
|
2
2
|
export declare const SPEED_PREFIX = "speed-";
|
|
3
|
+
/**
|
|
4
|
+
* Class for managing buttons in games
|
|
5
|
+
*
|
|
6
|
+
* This class includes methods for enabling/disabling buttons in game.
|
|
7
|
+
*
|
|
8
|
+
* The buttons that include each game:
|
|
9
|
+
* - Plus button
|
|
10
|
+
* - Minus button
|
|
11
|
+
* - Speed button (React and Pixi Buttons)
|
|
12
|
+
* - Info Button
|
|
13
|
+
* - More Button
|
|
14
|
+
* - Autoplay Button
|
|
15
|
+
* - Volume Button
|
|
16
|
+
*
|
|
17
|
+
* @exports
|
|
18
|
+
*/
|
|
3
19
|
export declare class ButtonsEventManager {
|
|
4
20
|
private settingsPlusButton;
|
|
5
21
|
private settingsMinusButton;
|
|
@@ -7,7 +23,17 @@ export declare class ButtonsEventManager {
|
|
|
7
23
|
private settingsSpeedTurtle;
|
|
8
24
|
private settingsSpeedRabbit;
|
|
9
25
|
private settingsSpeedCheetah;
|
|
26
|
+
/**
|
|
27
|
+
* Last layer invoked
|
|
28
|
+
*
|
|
29
|
+
* @memberof ButtonsEventManager
|
|
30
|
+
*/
|
|
10
31
|
private lastLayerInvoked;
|
|
32
|
+
/**
|
|
33
|
+
* Speed popup shown at for measuring time of showing speed popup
|
|
34
|
+
*
|
|
35
|
+
* @memberof ButtonsEventManager
|
|
36
|
+
*/
|
|
11
37
|
speedPopupShownAt: number;
|
|
12
38
|
/**
|
|
13
39
|
* Function for enabling/disabling buttons in game
|
|
@@ -5,6 +5,22 @@ import { RainMan } from "../../Rainman";
|
|
|
5
5
|
import { allUiItems, hideLayerIfPresent, UI_ITEMS } from "../../utils";
|
|
6
6
|
import { SPEED_LEVELS } from "../SpeedState";
|
|
7
7
|
export const SPEED_PREFIX = "speed-";
|
|
8
|
+
/**
|
|
9
|
+
* Class for managing buttons in games
|
|
10
|
+
*
|
|
11
|
+
* This class includes methods for enabling/disabling buttons in game.
|
|
12
|
+
*
|
|
13
|
+
* The buttons that include each game:
|
|
14
|
+
* - Plus button
|
|
15
|
+
* - Minus button
|
|
16
|
+
* - Speed button (React and Pixi Buttons)
|
|
17
|
+
* - Info Button
|
|
18
|
+
* - More Button
|
|
19
|
+
* - Autoplay Button
|
|
20
|
+
* - Volume Button
|
|
21
|
+
*
|
|
22
|
+
* @exports
|
|
23
|
+
*/
|
|
8
24
|
export class ButtonsEventManager {
|
|
9
25
|
settingsPlusButton = null;
|
|
10
26
|
settingsMinusButton = null;
|
|
@@ -12,7 +28,17 @@ export class ButtonsEventManager {
|
|
|
12
28
|
settingsSpeedTurtle = null;
|
|
13
29
|
settingsSpeedRabbit = null;
|
|
14
30
|
settingsSpeedCheetah = null;
|
|
31
|
+
/**
|
|
32
|
+
* Last layer invoked
|
|
33
|
+
*
|
|
34
|
+
* @memberof ButtonsEventManager
|
|
35
|
+
*/
|
|
15
36
|
lastLayerInvoked = "";
|
|
37
|
+
/**
|
|
38
|
+
* Speed popup shown at for measuring time of showing speed popup
|
|
39
|
+
*
|
|
40
|
+
* @memberof ButtonsEventManager
|
|
41
|
+
*/
|
|
16
42
|
speedPopupShownAt = 0;
|
|
17
43
|
/**
|
|
18
44
|
* Function for enabling/disabling buttons in game
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { SpeedAdapterInterface, SpeedLevel, SpeedLevelDirectory } from "../SpeedState";
|
|
2
2
|
import { SoundOverrides, SoundTrack } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Class for managing sound in game, uses the pixi sound library
|
|
5
|
+
* The class uses SoundTrack enum to access specified sounds
|
|
6
|
+
*
|
|
7
|
+
* @exports
|
|
8
|
+
*/
|
|
3
9
|
export declare class SoundManagerInstance implements SpeedAdapterInterface<SoundOverrides> {
|
|
4
10
|
private static instance;
|
|
5
11
|
static getInstance(): SoundManagerInstance;
|
|
@@ -12,11 +18,10 @@ export declare class SoundManagerInstance implements SpeedAdapterInterface<Sound
|
|
|
12
18
|
*
|
|
13
19
|
* @async
|
|
14
20
|
* @param {Record<string, string>} assets
|
|
15
|
-
* @returns {Promise<void>}
|
|
16
21
|
*/
|
|
17
22
|
loadSounds(assets: Record<string, string>): Promise<void>;
|
|
18
23
|
/**
|
|
19
|
-
*
|
|
24
|
+
* Function for setting volume level for each sound in game
|
|
20
25
|
*
|
|
21
26
|
* @param {number} volumeLevel
|
|
22
27
|
*/
|
|
@@ -2,6 +2,12 @@ import { Sound } from "@pixi/sound";
|
|
|
2
2
|
import { RainMan } from "../../Rainman";
|
|
3
3
|
import { SoundTracks } from "./types";
|
|
4
4
|
const soundsToLoop = [SoundTracks.mysteryFxLoop, SoundTracks.music];
|
|
5
|
+
/**
|
|
6
|
+
* Class for managing sound in game, uses the pixi sound library
|
|
7
|
+
* The class uses SoundTrack enum to access specified sounds
|
|
8
|
+
*
|
|
9
|
+
* @exports
|
|
10
|
+
*/
|
|
5
11
|
export class SoundManagerInstance {
|
|
6
12
|
static instance;
|
|
7
13
|
static getInstance() {
|
|
@@ -25,7 +31,6 @@ export class SoundManagerInstance {
|
|
|
25
31
|
*
|
|
26
32
|
* @async
|
|
27
33
|
* @param {Record<string, string>} assets
|
|
28
|
-
* @returns {Promise<void>}
|
|
29
34
|
*/
|
|
30
35
|
async loadSounds(assets) {
|
|
31
36
|
const loadingSoundsPromises = [];
|
|
@@ -46,7 +51,7 @@ export class SoundManagerInstance {
|
|
|
46
51
|
await Promise.all(loadingSoundsPromises);
|
|
47
52
|
}
|
|
48
53
|
/**
|
|
49
|
-
*
|
|
54
|
+
* Function for setting volume level for each sound in game
|
|
50
55
|
*
|
|
51
56
|
* @param {number} volumeLevel
|
|
52
57
|
*/
|
|
@@ -78,23 +83,17 @@ export class SoundManagerInstance {
|
|
|
78
83
|
* @param {SoundTrack} soundName
|
|
79
84
|
*/
|
|
80
85
|
play(soundName) {
|
|
81
|
-
if (
|
|
82
|
-
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
if (!RainMan.settingsStore.soundFxFlag)
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
86
|
+
if (!RainMan.settingsStore.soundFxFlag)
|
|
87
|
+
return;
|
|
89
88
|
const overrideSoundName = this.overrides[soundName];
|
|
90
89
|
const sound = overrideSoundName
|
|
91
90
|
? this.musicCatalogue.get(overrideSoundName)
|
|
92
91
|
: this.musicCatalogue.get(soundName);
|
|
93
92
|
if (!sound)
|
|
94
93
|
return;
|
|
95
|
-
if (soundName === "music" && sound.isPlaying)
|
|
94
|
+
if (soundName === "music" && sound.isPlaying && !RainMan.settingsStore.ambientMusicFlag)
|
|
96
95
|
return;
|
|
97
|
-
sound.play();
|
|
96
|
+
sound.play({ loop: soundsToLoop.includes(soundName) });
|
|
98
97
|
}
|
|
99
98
|
/**
|
|
100
99
|
* Function for pausing sound with given name
|
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Object for mapping SoundTracks to appropriate asset.
|
|
3
|
+
* All properties must be set, if no sound should be played set empty string
|
|
4
|
+
* @property {string} button - default click button sound
|
|
5
|
+
* @property {string} deactivationAutostart - click on autostart button
|
|
6
|
+
* @property {string} increaseRate - click on plus button
|
|
7
|
+
* @property {string} music - ambient music in loop
|
|
8
|
+
* @property {string} reductionRate - click on neg button
|
|
9
|
+
* @property {string} allRollStops - skipping rolling reels, on end
|
|
10
|
+
* @property {string} bigWin - on show big win popup
|
|
11
|
+
* @property {string} boom - symbol destroy
|
|
12
|
+
* @property {string} standaloneBoom - symbol destroy for standalone
|
|
13
|
+
* @property {string} symbolsFalling - dropping symbols after destroy
|
|
14
|
+
* @property {string} mysteryFxEnd - on mystery fx hides
|
|
15
|
+
* @property {string} mysteryFxLoop - when mystery fx in visible in loop
|
|
16
|
+
* @property {string} line - default win line sound, for both single and multiple lines
|
|
17
|
+
* @property {string} freeLine - win line sound for free spins
|
|
18
|
+
* @property {string} mysteryDrawLoop - on show mystery popup, play during randomizing win
|
|
19
|
+
* @property {string} rollStop - single reel stopping
|
|
20
|
+
* @property {string} specialSymbolOnReel - single reel stopping with special symbol like bonus or mystery
|
|
21
|
+
* @property {string} start - on start spinning
|
|
22
|
+
* @property {string} symbol - on symbol click and show payTable popup
|
|
23
|
+
*
|
|
24
|
+
* @exports SoundTracks
|
|
25
|
+
*/
|
|
1
26
|
export declare const SoundTracks: SoundTracks;
|
|
2
27
|
export interface SoundTracks {
|
|
3
28
|
button: "button";
|
|
@@ -42,7 +67,12 @@ export type SoundTrack = SoundTracks[keyof SoundTracks];
|
|
|
42
67
|
* @property {string} rollStop - single reel stopping
|
|
43
68
|
* @property {string} specialSymbolOnReel - single reel stopping with special symbol like bonus or mystery
|
|
44
69
|
* @property {string} start - on start spinning
|
|
45
|
-
* @property {string} symbol - on symbol click and show
|
|
70
|
+
* @property {string} symbol - on symbol click and show payTable popup
|
|
46
71
|
*/
|
|
47
72
|
export type GameSoundAssets = Record<SoundTrack, string>;
|
|
73
|
+
/**
|
|
74
|
+
* Type for overriding sound tracks in game
|
|
75
|
+
*
|
|
76
|
+
* @exports SoundOverrides
|
|
77
|
+
*/
|
|
48
78
|
export type SoundOverrides = Partial<Record<SoundTrack, SoundTrack>>;
|
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Object for mapping SoundTracks to appropriate asset.
|
|
3
|
+
* All properties must be set, if no sound should be played set empty string
|
|
4
|
+
* @property {string} button - default click button sound
|
|
5
|
+
* @property {string} deactivationAutostart - click on autostart button
|
|
6
|
+
* @property {string} increaseRate - click on plus button
|
|
7
|
+
* @property {string} music - ambient music in loop
|
|
8
|
+
* @property {string} reductionRate - click on neg button
|
|
9
|
+
* @property {string} allRollStops - skipping rolling reels, on end
|
|
10
|
+
* @property {string} bigWin - on show big win popup
|
|
11
|
+
* @property {string} boom - symbol destroy
|
|
12
|
+
* @property {string} standaloneBoom - symbol destroy for standalone
|
|
13
|
+
* @property {string} symbolsFalling - dropping symbols after destroy
|
|
14
|
+
* @property {string} mysteryFxEnd - on mystery fx hides
|
|
15
|
+
* @property {string} mysteryFxLoop - when mystery fx in visible in loop
|
|
16
|
+
* @property {string} line - default win line sound, for both single and multiple lines
|
|
17
|
+
* @property {string} freeLine - win line sound for free spins
|
|
18
|
+
* @property {string} mysteryDrawLoop - on show mystery popup, play during randomizing win
|
|
19
|
+
* @property {string} rollStop - single reel stopping
|
|
20
|
+
* @property {string} specialSymbolOnReel - single reel stopping with special symbol like bonus or mystery
|
|
21
|
+
* @property {string} start - on start spinning
|
|
22
|
+
* @property {string} symbol - on symbol click and show payTable popup
|
|
23
|
+
*
|
|
24
|
+
* @exports SoundTracks
|
|
25
|
+
*/
|
|
1
26
|
export const SoundTracks = {
|
|
2
27
|
button: "button",
|
|
3
28
|
deactivationAutostart: "deactivationAutostart",
|
|
@@ -1,12 +1,41 @@
|
|
|
1
1
|
import { SpeedLevel } from "./SpeedLevel";
|
|
2
|
+
/**
|
|
3
|
+
* Class for handling speed levels
|
|
4
|
+
*
|
|
5
|
+
* @export SpeedLevelHandler
|
|
6
|
+
*/
|
|
2
7
|
export declare class SpeedLevelHandler {
|
|
3
8
|
private chosenSpeedLevel;
|
|
4
9
|
private speedLevels;
|
|
5
10
|
static defaultSpeedLevel: SpeedLevel;
|
|
11
|
+
/**
|
|
12
|
+
* Function for initializing SpeedLevelHandler with default speed levels
|
|
13
|
+
*
|
|
14
|
+
* @returns {SpeedLevelHandler} instance of SpeedLevelHandler with default speed levels
|
|
15
|
+
*/
|
|
6
16
|
static initWithDefaultSpeedLevels(): SpeedLevelHandler;
|
|
7
17
|
constructor(chosenSpeedLevel: number, speedLevels: SpeedLevel[]);
|
|
18
|
+
/**
|
|
19
|
+
* Getter for current speed level
|
|
20
|
+
*
|
|
21
|
+
* @returns {SpeedLevel} current speed level
|
|
22
|
+
*/
|
|
8
23
|
get currentSpeed(): SpeedLevel;
|
|
9
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Setter for speed level
|
|
26
|
+
*
|
|
27
|
+
* @param newSpeedLevel
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
setSpeed(newSpeedLevel: SpeedLevel): void;
|
|
31
|
+
/**
|
|
32
|
+
* Function for setting next speed level
|
|
33
|
+
*/
|
|
10
34
|
nextSpeed(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Helper function for checking if speed options loop should be reset
|
|
37
|
+
*
|
|
38
|
+
* @returns {boolean}
|
|
39
|
+
*/
|
|
11
40
|
private shouldResetSpeedOptionsLoop;
|
|
12
41
|
}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { DEFAULT_SPEED, SPEED_LEVELS } from "./SpeedLevel";
|
|
2
|
+
/**
|
|
3
|
+
* Class for handling speed levels
|
|
4
|
+
*
|
|
5
|
+
* @export SpeedLevelHandler
|
|
6
|
+
*/
|
|
2
7
|
export class SpeedLevelHandler {
|
|
3
8
|
chosenSpeedLevel;
|
|
4
9
|
speedLevels;
|
|
5
10
|
static defaultSpeedLevel = DEFAULT_SPEED;
|
|
11
|
+
/**
|
|
12
|
+
* Function for initializing SpeedLevelHandler with default speed levels
|
|
13
|
+
*
|
|
14
|
+
* @returns {SpeedLevelHandler} instance of SpeedLevelHandler with default speed levels
|
|
15
|
+
*/
|
|
6
16
|
static initWithDefaultSpeedLevels() {
|
|
7
17
|
const defaultSpeedIndex = 0;
|
|
8
18
|
const speedLevels = Object.values(SPEED_LEVELS);
|
|
@@ -12,11 +22,22 @@ export class SpeedLevelHandler {
|
|
|
12
22
|
this.chosenSpeedLevel = chosenSpeedLevel;
|
|
13
23
|
this.speedLevels = speedLevels;
|
|
14
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Getter for current speed level
|
|
27
|
+
*
|
|
28
|
+
* @returns {SpeedLevel} current speed level
|
|
29
|
+
*/
|
|
15
30
|
get currentSpeed() {
|
|
16
31
|
return this.speedLevels[this.chosenSpeedLevel];
|
|
17
32
|
}
|
|
18
|
-
|
|
19
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Setter for speed level
|
|
35
|
+
*
|
|
36
|
+
* @param newSpeedLevel
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
39
|
+
setSpeed(newSpeedLevel) {
|
|
40
|
+
switch (newSpeedLevel) {
|
|
20
41
|
case SPEED_LEVELS.slow:
|
|
21
42
|
this.chosenSpeedLevel = 0;
|
|
22
43
|
return;
|
|
@@ -30,6 +51,9 @@ export class SpeedLevelHandler {
|
|
|
30
51
|
throw new Error("No matched speed level");
|
|
31
52
|
}
|
|
32
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Function for setting next speed level
|
|
56
|
+
*/
|
|
33
57
|
nextSpeed() {
|
|
34
58
|
if (this.shouldResetSpeedOptionsLoop()) {
|
|
35
59
|
this.chosenSpeedLevel = 0;
|
|
@@ -37,6 +61,11 @@ export class SpeedLevelHandler {
|
|
|
37
61
|
}
|
|
38
62
|
this.chosenSpeedLevel += 1;
|
|
39
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Helper function for checking if speed options loop should be reset
|
|
66
|
+
*
|
|
67
|
+
* @returns {boolean}
|
|
68
|
+
*/
|
|
40
69
|
shouldResetSpeedOptionsLoop() {
|
|
41
70
|
return this.chosenSpeedLevel === this.speedLevels.length - 1;
|
|
42
71
|
}
|
|
@@ -2,6 +2,11 @@ import { SymbolReels, TransformationDetails } from "../../connectivity";
|
|
|
2
2
|
import { ApiConfig } from "../ApiConfig";
|
|
3
3
|
import { AdaptedSpinResponse } from "./types";
|
|
4
4
|
import { WinScenarios } from "./WinScenarios";
|
|
5
|
+
/**
|
|
6
|
+
* This class represents mapped data from backend
|
|
7
|
+
*
|
|
8
|
+
* @export {SpinLogicDTO}
|
|
9
|
+
*/
|
|
5
10
|
export declare class SpinLogicDTO {
|
|
6
11
|
private rawData;
|
|
7
12
|
private gameConfig;
|
|
@@ -15,7 +20,27 @@ export declare class SpinLogicDTO {
|
|
|
15
20
|
get winScenarios(): WinScenarios[];
|
|
16
21
|
get standaloneTransformations(): TransformationDetails[][];
|
|
17
22
|
get hasMysteryWin(): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Function for mapping the single win from raw backend data
|
|
25
|
+
*
|
|
26
|
+
* @param singleWin single win from raw backend data
|
|
27
|
+
* @param availableFreeSpins number of available free spins (if game have free spins)
|
|
28
|
+
* @returns {Win} mapped win
|
|
29
|
+
*/
|
|
18
30
|
private getSingleWin;
|
|
31
|
+
/**
|
|
32
|
+
* Function for mapping wins from raw backend data
|
|
33
|
+
*
|
|
34
|
+
* @param rawData raw data from backend
|
|
35
|
+
* @param availableFreeSpins number of available free spins (if game have free spins)
|
|
36
|
+
* @returns {Win[]} mapped array of wins
|
|
37
|
+
*/
|
|
19
38
|
private getWinsFromRawData;
|
|
39
|
+
/**
|
|
40
|
+
* Function for converting backend symbol id to frontend symbol id
|
|
41
|
+
*
|
|
42
|
+
* @param {string} symbol backend symbol id
|
|
43
|
+
* @returns {SymbolId} frontend symbol id
|
|
44
|
+
*/
|
|
20
45
|
private stringToSymbolId;
|
|
21
46
|
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { PossibleWins } from "../../constants";
|
|
2
2
|
import { RainMan } from "../../Rainman";
|
|
3
3
|
import { WinScenarios } from "./WinScenarios";
|
|
4
|
+
/**
|
|
5
|
+
* This class represents mapped data from backend
|
|
6
|
+
*
|
|
7
|
+
* @export {SpinLogicDTO}
|
|
8
|
+
*/
|
|
4
9
|
export class SpinLogicDTO {
|
|
5
10
|
rawData;
|
|
6
11
|
gameConfig;
|
|
@@ -45,10 +50,7 @@ export class SpinLogicDTO {
|
|
|
45
50
|
const { results, availableFreeSpins } = this.rawData;
|
|
46
51
|
if (results === undefined)
|
|
47
52
|
return [];
|
|
48
|
-
return results.map((result) =>
|
|
49
|
-
const win = this.getWinsFromRawData(result, availableFreeSpins);
|
|
50
|
-
return new WinScenarios(win, result.transformations);
|
|
51
|
-
});
|
|
53
|
+
return results.map((result) => new WinScenarios(this.getWinsFromRawData(result, availableFreeSpins), result.transformations));
|
|
52
54
|
}
|
|
53
55
|
get standaloneTransformations() {
|
|
54
56
|
const { standaloneTransformations } = this.rawData;
|
|
@@ -57,10 +59,15 @@ export class SpinLogicDTO {
|
|
|
57
59
|
return standaloneTransformations;
|
|
58
60
|
}
|
|
59
61
|
get hasMysteryWin() {
|
|
60
|
-
return this.winScenarios.some((winScenario) =>
|
|
61
|
-
return winScenario.wins.some((win) => win.type === PossibleWins.mystery);
|
|
62
|
-
});
|
|
62
|
+
return this.winScenarios.some((winScenario) => winScenario.wins.some((win) => win.type === PossibleWins.mystery));
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Function for mapping the single win from raw backend data
|
|
66
|
+
*
|
|
67
|
+
* @param singleWin single win from raw backend data
|
|
68
|
+
* @param availableFreeSpins number of available free spins (if game have free spins)
|
|
69
|
+
* @returns {Win} mapped win
|
|
70
|
+
*/
|
|
64
71
|
getSingleWin(singleWin, availableFreeSpins) {
|
|
65
72
|
const rawWin = {
|
|
66
73
|
type: this.gameConfig.getWinId(singleWin.typeId),
|
|
@@ -78,9 +85,22 @@ export class SpinLogicDTO {
|
|
|
78
85
|
}
|
|
79
86
|
return rawWin;
|
|
80
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Function for mapping wins from raw backend data
|
|
90
|
+
*
|
|
91
|
+
* @param rawData raw data from backend
|
|
92
|
+
* @param availableFreeSpins number of available free spins (if game have free spins)
|
|
93
|
+
* @returns {Win[]} mapped array of wins
|
|
94
|
+
*/
|
|
81
95
|
getWinsFromRawData(rawData, availableFreeSpins) {
|
|
82
96
|
return rawData.wins.map((win) => this.getSingleWin(win, availableFreeSpins));
|
|
83
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Function for converting backend symbol id to frontend symbol id
|
|
100
|
+
*
|
|
101
|
+
* @param {string} symbol backend symbol id
|
|
102
|
+
* @returns {SymbolId} frontend symbol id
|
|
103
|
+
*/
|
|
84
104
|
stringToSymbolId(symbol) {
|
|
85
105
|
return symbol;
|
|
86
106
|
}
|
|
@@ -1,7 +1,43 @@
|
|
|
1
1
|
import { DropTransformationDetails, FreezeTransformationDetails, RawFreezeTransformationDetails, RawWin, Result, SpinAndFreezeTransformationDetails, SpinDataInterface, SymbolReels, TransformationDetails, WinWithTransformation } from "../../connectivity";
|
|
2
2
|
import { ApiConfig } from "../ApiConfig";
|
|
3
|
+
/**
|
|
4
|
+
* Function to concatenate destroy and set transformations
|
|
5
|
+
*
|
|
6
|
+
* @param {SpinDataInterface} spinLogicResponse - parsed response from backend
|
|
7
|
+
* @param {number} currentIndexOfRootTransformation - index of root transformation
|
|
8
|
+
* @param {ApiConfig} gameConfig - api configuration
|
|
9
|
+
* @returns {[DropTransformationDetails[], number]}
|
|
10
|
+
*/
|
|
3
11
|
export declare const concatenateDestroyAndSetTransformations: (spinLogicResponse: SpinDataInterface, currentIndexOfRootTransformation: number, gameConfig: ApiConfig) => [DropTransformationDetails[], number];
|
|
12
|
+
/**
|
|
13
|
+
* Function to get freeze transformations from raw response
|
|
14
|
+
*
|
|
15
|
+
* @param {RawFreezeTransformationDetails[]} transformations
|
|
16
|
+
* @returns {FreezeTransformationDetails[]}
|
|
17
|
+
*/
|
|
4
18
|
export declare const getFreezeTransformationFromRawResponse: (transformations: RawFreezeTransformationDetails[]) => FreezeTransformationDetails[];
|
|
19
|
+
/**
|
|
20
|
+
* Function to concatenate freeze and spin transformations
|
|
21
|
+
*
|
|
22
|
+
* @param {FreezeTransformationDetails[]} freezeTransformations
|
|
23
|
+
* @param {SymbolReels} onStopBlindsConfiguration
|
|
24
|
+
* @returns {SpinAndFreezeTransformationDetails}
|
|
25
|
+
*/
|
|
5
26
|
export declare const concatenateFreezeAndSpinTransformations: (freezeTransformations: FreezeTransformationDetails[], onStopBlindsConfiguration: SymbolReels) => SpinAndFreezeTransformationDetails;
|
|
27
|
+
/**
|
|
28
|
+
* Function to get vertical transformations from raw response
|
|
29
|
+
*
|
|
30
|
+
* @param {Result[]} results
|
|
31
|
+
* @param {number} transformationTypeId
|
|
32
|
+
* @returns {number[][] | null}
|
|
33
|
+
*/
|
|
6
34
|
export declare const isBlindsConfiguredByTransformations: (results: Result[], transformationTypeId?: number) => number[][] | null;
|
|
35
|
+
/**
|
|
36
|
+
* Function for collecting win details with transformation
|
|
37
|
+
*
|
|
38
|
+
* @param {RawWin | null} winsDetails
|
|
39
|
+
* @param {TransformationDetails[]} transformations
|
|
40
|
+
* @param {string | null} winIndex
|
|
41
|
+
* @returns {WinWithTransformation}
|
|
42
|
+
*/
|
|
7
43
|
export declare const collectWinDetailsWithTransformation: (winsDetails: RawWin | null, transformations: TransformationDetails[], winIndex?: string | null) => WinWithTransformation;
|