pixi-rainman-game-engine 0.1.50 → 0.1.52

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.
@@ -14,8 +14,8 @@ const onChange = (newVolumeLevel) => {
14
14
  };
15
15
  const onAfterChange = (newVolumeLevel) => {
16
16
  RainMan.settingsStore.flipSoundsEnabled(newVolumeLevel);
17
- if (RainMan.settingsStore.ambientMusicFlag) {
18
- SoundManager.play("music");
17
+ if (RainMan.settingsStore.isSoundEnabled()) {
18
+ SoundManager.resumeAll();
19
19
  }
20
20
  };
21
21
  export const VolumeSettings = observer(() => {
@@ -1,6 +1,6 @@
1
1
  import i18n from "i18next";
2
2
  import { sample } from "lodash";
3
- import { SoundManager, SoundTracks } from "../../application";
3
+ import { SoundManager } from "../../application";
4
4
  import { AutoplayButton, Background, BUTTONS, COMPONENTS, FreeSpinButton, MessageBox, SpeedControlButton, VolumeButton, } from "../../components";
5
5
  import { RainMan } from "../../Rainman";
6
6
  import { allUiItems, hideLayerIfPresent, UI_ITEMS } from "../../utils";
@@ -193,9 +193,8 @@ export class ButtonsEventManager {
193
193
  RainMan.settingsStore.setUpdateVolumeButtonTexture(() => RainMan.componentRegistry.get(VolumeButton.registryName).changeTextureDependOnVolume());
194
194
  RainMan.componentRegistry.get(VolumeButton.registryName).setOnClick(() => {
195
195
  RainMan.settingsStore.flipSoundsEnabled();
196
- if (RainMan.settingsStore.ambientMusicFlag && RainMan.settingsStore.isSoundEnabled()) {
197
- SoundManager.resume(SoundTracks.music);
198
- }
196
+ if (RainMan.settingsStore.isSoundEnabled())
197
+ SoundManager.resumeAll();
199
198
  RainMan.componentRegistry.get(VolumeButton.registryName).changeTextureDependOnVolume();
200
199
  this.handleModalInvocation(UI_ITEMS.volume);
201
200
  });
@@ -103,7 +103,7 @@ export class SoundManagerInstance {
103
103
  this.musicCatalogue.forEach((sound, soundName) => {
104
104
  if (sound.paused && sound.isPlaying)
105
105
  sound.resume();
106
- if (soundName === SoundTracks.music && sound.paused) {
106
+ if (RainMan.settingsStore.ambientMusicFlag && soundName === SoundTracks.music && sound.paused) {
107
107
  sound.resume();
108
108
  }
109
109
  });
@@ -56,8 +56,8 @@ export class AbstractMainContainer extends Container {
56
56
  this.name = AbstractMainContainer.registryName;
57
57
  this.buttonsEventManager = new ButtonsEventManager();
58
58
  this.messageBox = new MessageBox();
59
- if (RainMan.settingsStore.ambientMusicFlag)
60
- SoundManager.setPlayStatus(SoundTracks.music, true);
59
+ if (RainMan.settingsStore.isSoundEnabled())
60
+ SoundManager.resumeAll();
61
61
  RainMan.app.renderer.on("resize", () => this.resize());
62
62
  }
63
63
  /**
@@ -193,6 +193,7 @@ export class AbstractMainContainer extends Container {
193
193
  this.overlay.drawRect(0, 0, width, height);
194
194
  this.overlay.eventMode = "static";
195
195
  this.overlay.endFill();
196
+ this.overlay.interactive = true;
196
197
  this.addChild(this.overlay);
197
198
  }
198
199
  hideOverlay() {
@@ -33,6 +33,7 @@ export declare abstract class AbstractColumnsContainer extends Container impleme
33
33
  };
34
34
  protected constructor();
35
35
  protected init(): void;
36
+ resolveMysterySpeedUp(): void;
36
37
  adaptToSpeed(speedLevel: SpeedLevel): void;
37
38
  enableQuickReelsStop(): void;
38
39
  clearQuickReelsStop(): void;
@@ -41,6 +41,13 @@ export class AbstractColumnsContainer extends Container {
41
41
  Ticker.shared.add((delta) => this.animate(delta));
42
42
  this.doResize();
43
43
  }
44
+ resolveMysterySpeedUp() {
45
+ this.allColumns.forEach((column) => {
46
+ if (column.resolveMysterySpeedUp === null)
47
+ return;
48
+ column.resolveMysterySpeedUp();
49
+ });
50
+ }
44
51
  adaptToSpeed(speedLevel) {
45
52
  this.velocityMultiplier = this.speedLevelMapper[speedLevel];
46
53
  }
@@ -48,6 +55,7 @@ export class AbstractColumnsContainer extends Container {
48
55
  RainMan.componentRegistry.setTemporarySpeedLevel(SPEED_LEVELS.fast);
49
56
  this.quickReelsStop = true;
50
57
  this.skipScatterDelay?.();
58
+ this.resolveMysterySpeedUp();
51
59
  this.skipScatterDelay = null;
52
60
  if (this.currentColumn)
53
61
  this.currentColumn.skipHidingMysteryFx = true;
@@ -83,16 +91,16 @@ export class AbstractColumnsContainer extends Container {
83
91
  break;
84
92
  }
85
93
  const configureSpinAction = configuredBlindSpinsActions.shift();
86
- indexesOfReelsToExtendSpinningTime.forEach((number) => {
87
- this.allColumns[number].changeMultiplier();
88
- });
89
94
  if (configureSpinAction !== undefined) {
90
95
  if (indexesOfReelsToExtendSpinningTime.includes(index)) {
96
+ indexesOfReelsToExtendSpinningTime.forEach((number) => {
97
+ this.allColumns[number].changeMultiplier();
98
+ });
91
99
  this.currentColumn = this.allColumns[index];
92
100
  this.currentColumn.adaptToSpeed(RainMan.settingsStore.currentSpeed);
93
101
  frame.invokeMysteryFx(this.currentColumn.x, this.currentColumn.y);
94
- await this.currentColumn.speedUpForMysterySpin(100, 1500);
95
102
  this.skipScatterDelay = configureSpinAction;
103
+ await this.currentColumn.speedUpForMysterySpin(100, 1500);
96
104
  setTimeout(() => {
97
105
  this.skipScatterDelay?.();
98
106
  this.skipScatterDelay = null;
@@ -139,11 +147,11 @@ export class AbstractColumnsContainer extends Container {
139
147
  return;
140
148
  }
141
149
  if (amount > WIN_MULTIPLIER_VALUES.MEDIUM_WIN_MIN * bet &&
142
- amount < WIN_MULTIPLIER_VALUES.MEDIUM_WIN_MAX * bet) {
150
+ amount <= WIN_MULTIPLIER_VALUES.MEDIUM_WIN_MAX * bet) {
143
151
  SoundManager.play(SoundTracks.mediumWin);
144
152
  return;
145
153
  }
146
- if (amount > WIN_MULTIPLIER_VALUES.HIGH_WIN_MIN * bet && amount < WIN_MULTIPLIER_VALUES.HIGH_WIN_MAX * bet) {
154
+ if (amount > WIN_MULTIPLIER_VALUES.HIGH_WIN_MIN * bet && amount <= WIN_MULTIPLIER_VALUES.HIGH_WIN_MAX * bet) {
147
155
  SoundManager.play(SoundTracks.highWin);
148
156
  return;
149
157
  }
@@ -37,7 +37,7 @@ export declare abstract class AbstractFrame extends ResumableContainer implement
37
37
  adaptToSpeed(speedLevel: SpeedLevel): void;
38
38
  invokeMysteryFx(x: number, y: number): void;
39
39
  protected repositionMysteryFx(_x: number, _y: number): void;
40
- hideMysteryFx(): Promise<void>;
40
+ hideMysteryFx(): void;
41
41
  private resetMysteryFxCoordinates;
42
42
  destroyMysteryFx(): void;
43
43
  protected createWinLineAnimation(_animationName: string): WinLineAnimation | null;
@@ -54,31 +54,25 @@ export class AbstractFrame extends ResumableContainer {
54
54
  this.addChild(this.mysteryFxHighlight);
55
55
  }
56
56
  repositionMysteryFx(_x, _y) { }
57
- async hideMysteryFx() {
58
- return new Promise((resolve) => {
59
- if (!this.mysteryFxConfig)
60
- return resolve();
61
- if (!this.mysteryFxConfig.endAnimationName) {
62
- this.destroyMysteryFx();
63
- return resolve();
64
- }
65
- if (this.mysteryFxHighlight) {
66
- SoundManager.stop(SoundTracks.mysteryFxLoop);
67
- SoundManager.play(SoundTracks.mysteryFxEnd);
68
- this.resetMysteryFxCoordinates();
69
- this.mysteryFxHighlight.state.setAnimation(0, this.mysteryFxConfig.endAnimationName, false);
70
- this.mysteryFxHighlight.state.addListener({
71
- complete: () => resolve(),
72
- });
73
- }
74
- });
57
+ hideMysteryFx() {
58
+ if (!this.mysteryFxConfig)
59
+ return;
60
+ if (!this.mysteryFxConfig.endAnimationName) {
61
+ return;
62
+ }
63
+ if (this.mysteryFxHighlight) {
64
+ SoundManager.play(SoundTracks.mysteryFxEnd);
65
+ this.resetMysteryFxCoordinates();
66
+ this.mysteryFxHighlight.state.setAnimation(0, this.mysteryFxConfig.endAnimationName, false);
67
+ return;
68
+ }
75
69
  }
76
70
  resetMysteryFxCoordinates() {
77
71
  this.mysteryFxCoordinates = { x: 0, y: 0 };
78
72
  }
79
73
  destroyMysteryFx() {
80
74
  if (this.mysteryFxHighlight) {
81
- SoundManager.pause(SoundTracks.mysteryFxLoop);
75
+ SoundManager.stop(SoundTracks.mysteryFxLoop);
82
76
  this.removeChild(this.mysteryFxHighlight);
83
77
  this.mysteryFxHighlight.destroy();
84
78
  this.mysteryFxHighlight = null;
@@ -1,7 +1,7 @@
1
1
  import { Container } from "pixi.js";
2
2
  import { SpeedAdapterInterface, SpeedLevel, SymbolId } from "../../application";
3
3
  import { DropTransformationDetails, SymbolReel } from "../../connectivity";
4
- import { Nullable } from "../../utils";
4
+ import { Nullable, VoidPromiseResolver } from "../../utils";
5
5
  import { AbstractColumnsContainer, AbstractFrame } from "../frame";
6
6
  import { AbstractSymbolBase } from "./AbstractSymbolBase";
7
7
  import { AnimationTimeSettings } from "./types";
@@ -30,6 +30,7 @@ export declare abstract class AbstractSymbolsColumn extends Container implements
30
30
  private lastEnding;
31
31
  private tween;
32
32
  private wiggleTween;
33
+ resolveMysterySpeedUp: Nullable<VoidPromiseResolver>;
33
34
  private resolver;
34
35
  private shouldMoveToTop;
35
36
  private droppingTweens;
@@ -32,6 +32,7 @@ export class AbstractSymbolsColumn extends Container {
32
32
  lastEnding = [];
33
33
  tween;
34
34
  wiggleTween = null;
35
+ resolveMysterySpeedUp = null;
35
36
  resolver = null;
36
37
  shouldMoveToTop = true;
37
38
  droppingTweens;
@@ -84,6 +85,7 @@ export class AbstractSymbolsColumn extends Container {
84
85
  }
85
86
  async speedUpForMysterySpin(velocity, duration) {
86
87
  await new Promise((resolve) => {
88
+ this.resolveMysterySpeedUp = resolve;
87
89
  this.tween = new TWEEN.Tween({ velocity: velocity })
88
90
  .to({ value: 70 }, duration)
89
91
  .easing(TWEEN.Easing.Linear.None)
@@ -92,6 +94,7 @@ export class AbstractSymbolsColumn extends Container {
92
94
  })
93
95
  .onComplete(() => {
94
96
  this.tween = null;
97
+ this.resolveMysterySpeedUp = null;
95
98
  resolve();
96
99
  })
97
100
  .start();
@@ -109,7 +112,7 @@ export class AbstractSymbolsColumn extends Container {
109
112
  .onComplete(async () => {
110
113
  this.tween = null;
111
114
  if (frame) {
112
- await frame.hideMysteryFx();
115
+ frame.hideMysteryFx();
113
116
  frame.destroyMysteryFx();
114
117
  }
115
118
  this.skipHidingMysteryFx = false;
@@ -118,7 +121,7 @@ export class AbstractSymbolsColumn extends Container {
118
121
  .onStop(async () => {
119
122
  this.tween = null;
120
123
  if (frame) {
121
- await frame.hideMysteryFx();
124
+ frame.hideMysteryFx();
122
125
  frame.destroyMysteryFx();
123
126
  }
124
127
  this.skipHidingMysteryFx = false;
@@ -49,7 +49,6 @@ export declare abstract class AbstractController<T> {
49
49
  private componentRegistry;
50
50
  protected skipFreeSpinSummary: boolean;
51
51
  protected scatterCountForFx: number;
52
- protected isLongPress: boolean;
53
52
  protected _lastWinAmount: number;
54
53
  protected constructor(buttonsEventManager: ButtonsEventManager, mainContainer: AbstractMainContainer, connection: SubscribableConnectionWrapper);
55
54
  init(): void;
@@ -48,7 +48,6 @@ export class AbstractController {
48
48
  componentRegistry;
49
49
  skipFreeSpinSummary = false;
50
50
  scatterCountForFx = 2;
51
- isLongPress = false;
52
51
  _lastWinAmount = 0;
53
52
  constructor(buttonsEventManager, mainContainer, connection) {
54
53
  this.buttonsEventManager = buttonsEventManager;
@@ -189,19 +188,19 @@ export class AbstractController {
189
188
  clearInterval(this.mobileSpinTimeout);
190
189
  this.mobileSpinTimeout = null;
191
190
  }
192
- this.isLongPress = false;
193
191
  };
194
192
  refreshButton.on("touchstart", () => {
195
- this.isLongPress = false;
196
193
  this.mobileSpinTimeout = setInterval(() => {
197
- this.isLongPress = true;
198
- this.throttledSpin();
194
+ if (this.invokeFreeSpinPlateAfterWin ||
195
+ this.invokeFreeSpinSummaryPlateAfterWin ||
196
+ this.resolveBigWin !== undefined) {
197
+ clearMobileSpinTimeout();
198
+ return;
199
+ }
200
+ this.handleSpinLogic();
199
201
  }, RainMan.config.durationOfActions.mobileSpinTimeout);
200
202
  });
201
203
  refreshButton.on("touchend", () => {
202
- if (this.isLongPress) {
203
- this.handleSpinLogic();
204
- }
205
204
  clearMobileSpinTimeout();
206
205
  });
207
206
  refreshButton.on("globaltouchmove", (event) => {
@@ -845,7 +844,7 @@ export class AbstractController {
845
844
  }
846
845
  }
847
846
  async handleLoopingWinActionQueue() {
848
- if (RainMan.settingsStore.isAutoplayEnabled)
847
+ if (RainMan.settingsStore.isAutoplayEnabled || this.invokeFreeSpinPlateAfterWin)
849
848
  return;
850
849
  this.isLoopingWinActionsQueue = true;
851
850
  await this.loopWinActionsQueue();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixi-rainman-game-engine",
3
- "version": "0.1.50",
3
+ "version": "0.1.52",
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",