pixi-rainman-game-engine 0.1.45 → 0.1.47

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.
@@ -3,6 +3,7 @@ import "./volume.css";
3
3
  import { observer } from "mobx-react-lite";
4
4
  import Slider from "rc-slider";
5
5
  import React from "react";
6
+ import { SoundManager } from "../../../application";
6
7
  import { RainMan } from "../../../Rainman";
7
8
  import { useStores } from "../../hooks";
8
9
  const onBeforeChange = () => {
@@ -13,6 +14,9 @@ const onChange = (newVolumeLevel) => {
13
14
  };
14
15
  const onAfterChange = (newVolumeLevel) => {
15
16
  RainMan.settingsStore.flipSoundsEnabled(newVolumeLevel);
17
+ if (RainMan.settingsStore.ambientMusicFlag) {
18
+ SoundManager.play("music");
19
+ }
16
20
  };
17
21
  export const VolumeSettings = observer(() => {
18
22
  const { settingStore } = useStores();
@@ -150,4 +150,5 @@ export declare class ButtonsEventManager {
150
150
  * @param {string} layerName
151
151
  */
152
152
  private handleModalInvocation;
153
+ private checkAnyLayerIsPresent;
153
154
  }
@@ -316,6 +316,8 @@ export class ButtonsEventManager {
316
316
  * @param {string} layerName
317
317
  */
318
318
  handleModalInvocation(layerName) {
319
+ if (this.checkAnyLayerIsPresent(layerName))
320
+ return;
319
321
  const layer = window.document.getElementById(layerName);
320
322
  if (layer !== null) {
321
323
  if (layer.style.display !== "flex") {
@@ -328,4 +330,12 @@ export class ButtonsEventManager {
328
330
  }
329
331
  }
330
332
  }
333
+ checkAnyLayerIsPresent(layerName) {
334
+ return Object.values(UI_ITEMS).some((item) => {
335
+ if (item === layerName)
336
+ return false;
337
+ const layer = window.document.getElementById(item);
338
+ return layer !== null && layer.style.display === "flex";
339
+ });
340
+ }
331
341
  }
@@ -93,14 +93,20 @@ export class SoundManagerInstance {
93
93
  return;
94
94
  if (soundName === "music" && sound.isPlaying && !RainMan.settingsStore.ambientMusicFlag)
95
95
  return;
96
- sound.play({ loop: soundsToLoop.includes(soundName) });
96
+ sound.play({ loop: soundsToLoop.includes(soundName), singleInstance: true });
97
97
  }
98
98
  /**
99
99
  * Function for resuming all sounds in game
100
100
  * If sound is not playing, it will be skipped
101
101
  */
102
102
  resumeAll() {
103
- this.musicCatalogue.forEach((sound) => sound.paused && sound.resume());
103
+ this.musicCatalogue.forEach((sound, soundName) => {
104
+ if (sound.paused && sound.isPlaying)
105
+ sound.resume();
106
+ if (soundName === SoundTracks.music && sound.paused) {
107
+ sound.resume();
108
+ }
109
+ });
104
110
  }
105
111
  /**
106
112
  * Function for pausing all sounds in game
@@ -129,6 +129,7 @@ export declare abstract class AbstractMainContainer extends Container {
129
129
  protected showOverlay(): void;
130
130
  protected hideOverlay(): void;
131
131
  get bigWinVisibleFor(): number;
132
+ getFreeSpinButton(): typeof this.freeSpinButton;
132
133
  get mysteryWinVisibleFor(): number;
133
134
  get bonusWinVisibleFor(): number;
134
135
  get superBonusWinVisibleFor(): number;
@@ -203,6 +203,9 @@ export class AbstractMainContainer extends Container {
203
203
  get bigWinVisibleFor() {
204
204
  return this._bigWinInvokedAt == null ? 0 : performance.now() - this._bigWinInvokedAt;
205
205
  }
206
+ getFreeSpinButton() {
207
+ return this.freeSpinButton;
208
+ }
206
209
  get mysteryWinVisibleFor() {
207
210
  return this._mysteryWinInvokedAt == null ? 0 : performance.now() - this._mysteryWinInvokedAt;
208
211
  }
@@ -1,7 +1,7 @@
1
1
  export declare const WIN_MULTIPLIER_VALUES: {
2
2
  readonly LOW_WIN: 1;
3
3
  readonly MEDIUM_WIN_MIN: 1.1;
4
- readonly MEDIUM_WIN_MAX: 2;
4
+ readonly MEDIUM_WIN_MAX: 5;
5
5
  readonly HIGH_WIN_MIN: 5.1;
6
6
  readonly HIGH_WIN_MAX: 15;
7
7
  readonly VERY_HIGH_WIN: 15.1;
@@ -1,7 +1,7 @@
1
1
  export const WIN_MULTIPLIER_VALUES = {
2
2
  LOW_WIN: 1,
3
3
  MEDIUM_WIN_MIN: 1.1,
4
- MEDIUM_WIN_MAX: 2,
4
+ MEDIUM_WIN_MAX: 5,
5
5
  HIGH_WIN_MIN: 5.1,
6
6
  HIGH_WIN_MAX: 15,
7
7
  VERY_HIGH_WIN: 15.1,
@@ -43,11 +43,12 @@ export declare abstract class AbstractController<T> {
43
43
  protected resolveMysteryWin?: () => void;
44
44
  protected resolveBonusWin?: () => void;
45
45
  protected resolveSuperBonusWin?: () => void;
46
- protected mysteryFxSymbol: SymbolId | null;
46
+ protected mysteryFxSymbol: SymbolId | SymbolId[] | null;
47
47
  protected mysteryFxSymbolMustFormWinningLine: boolean;
48
48
  protected mysteryWinSymbol: Nullable<SymbolId>;
49
49
  private componentRegistry;
50
50
  protected skipFreeSpinSummary: boolean;
51
+ protected scatterCountForFx: number;
51
52
  protected _lastWinAmount: number;
52
53
  protected constructor(buttonsEventManager: ButtonsEventManager, mainContainer: AbstractMainContainer, connection: SubscribableConnectionWrapper);
53
54
  init(): void;
@@ -60,6 +61,7 @@ export declare abstract class AbstractController<T> {
60
61
  disableBetButtons(shouldBeDisabled: boolean): void;
61
62
  private disableSpeedButton;
62
63
  private disableInformationButtons;
64
+ private disableFreeSpinButton;
63
65
  protected handleDisablingButtons(disabled?: boolean): void;
64
66
  private initButtons;
65
67
  private initBetButtons;
@@ -47,6 +47,7 @@ export class AbstractController {
47
47
  mysteryWinSymbol = null;
48
48
  componentRegistry;
49
49
  skipFreeSpinSummary = false;
50
+ scatterCountForFx = 2;
50
51
  _lastWinAmount = 0;
51
52
  constructor(buttonsEventManager, mainContainer, connection) {
52
53
  this.buttonsEventManager = buttonsEventManager;
@@ -137,10 +138,16 @@ export class AbstractController {
137
138
  ];
138
139
  buttonsToChange.forEach((button) => button.flipDisabledFlag(shouldBeDisabled));
139
140
  }
141
+ disableFreeSpinButton(shouldBeDisabled) {
142
+ const freeSpinButton = this.mainContainer.getFreeSpinButton();
143
+ if (freeSpinButton)
144
+ freeSpinButton?.setInteractivity(!shouldBeDisabled);
145
+ }
140
146
  handleDisablingButtons(disabled) {
141
147
  this.disableBetButtons(disabled ?? this.shouldBetButtonsBeDisabled);
142
148
  this.disableSpeedButton(disabled ?? this.shouldButtonsBeDisabled);
143
149
  this.disableInformationButtons(disabled ?? this.shouldButtonsBeDisabled);
150
+ this.disableFreeSpinButton(disabled ?? this.shouldButtonsBeDisabled);
144
151
  }
145
152
  initButtons() {
146
153
  this.buttonsEventManager.initVolumeButtonEvent();
@@ -284,15 +291,23 @@ export class AbstractController {
284
291
  const streak = [];
285
292
  let howManyScattersAppeared = 0;
286
293
  for (let columnIndex = 0; columnIndex < RainMan.config.numberOfColumns; columnIndex++) {
287
- if (howManyScattersAppeared >= 2) {
294
+ if (howManyScattersAppeared >= this.scatterCountForFx) {
288
295
  reelsIndexesWithScatter.push(columnIndex);
289
296
  }
290
297
  for (let rowIndex = 0; rowIndex < RainMan.config.numberOfRows; rowIndex++) {
291
298
  const symbol = onStopBlindsConfiguration[columnIndex][rowIndex];
292
- if (symbol === this.mysteryFxSymbol) {
293
- howManyScattersAppeared++;
294
- streak.push(rowIndex);
295
- break;
299
+ if (Array.isArray(this.mysteryFxSymbol)) {
300
+ if (this.mysteryFxSymbol.includes(symbol)) {
301
+ howManyScattersAppeared++;
302
+ streak.push(rowIndex);
303
+ }
304
+ }
305
+ else {
306
+ if (symbol === this.mysteryFxSymbol) {
307
+ howManyScattersAppeared++;
308
+ streak.push(rowIndex);
309
+ break;
310
+ }
296
311
  }
297
312
  }
298
313
  }
@@ -6,15 +6,13 @@ import { RainMan } from "../../Rainman";
6
6
  * If the sounds was disabled than this will be not triggered
7
7
  */
8
8
  const resumeAudioContext = () => {
9
- if (RainMan.settingsStore.isSoundEnabled()) {
10
- if (document.hidden) {
11
- SoundManager.pauseAll();
12
- return;
13
- }
14
- else {
15
- SoundManager.resumeAll();
16
- return;
17
- }
9
+ if (RainMan.settingsStore.isSoundEnabled() && document.hidden) {
10
+ SoundManager.pauseAll();
11
+ return;
12
+ }
13
+ if (!document.hidden && RainMan.settingsStore.isSoundEnabled()) {
14
+ SoundManager.resumeAll();
15
+ return;
18
16
  }
19
17
  };
20
18
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixi-rainman-game-engine",
3
- "version": "0.1.45",
3
+ "version": "0.1.47",
4
4
  "description": "This repository contains all of the mechanics that used in rainman games.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",