pixi-rainman-game-engine 0.1.53 β†’ 0.2.0

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.
@@ -65,6 +65,7 @@ export type AppConfig = RequiredAppConfig & DeepPartial<OptionalAppConfig>;
65
65
  */
66
66
  export interface Globals {
67
67
  currency: Currency;
68
+ actionsAfterClosureWebSocket?: () => void;
68
69
  disableSpeedPopup?: (value: boolean) => void;
69
70
  handleDisablingButtons?: (value?: boolean) => void;
70
71
  throttledSpin?: () => void;
@@ -62,7 +62,7 @@ export class AbstractSymbolBase extends Container {
62
62
  return new Promise((resolve) => {
63
63
  this.spine = new Spine(getSpineData(specialResourceName));
64
64
  this.endOfSwapAnimationPromise = resolve;
65
- this.spine.state.timeScale = (this.animationSpeedMultiplier = 1) ? 1.5 : this.animationSpeedMultiplier;
65
+ this.spine.state.timeScale = this.animationSpeedMultiplier === 1 ? 1.5 : this.animationSpeedMultiplier;
66
66
  this.spine.state.setAnimation(0, animationName, false);
67
67
  this.spine.scale.set(spineScale);
68
68
  this.addChild(this.spine);
@@ -64,6 +64,7 @@ export class ConnectionWrapper {
64
64
  this.subscribers.forEach((subscriberFn) => {
65
65
  subscriberFn();
66
66
  });
67
+ RainMan.globals.actionsAfterClosureWebSocket?.();
67
68
  });
68
69
  this.webSocketConnection.addEventListener("message", (event) => this.handleMessage(JSON.parse(event.data)));
69
70
  logInfo("connection established, listener set");
@@ -61,7 +61,6 @@ export declare abstract class AbstractController<T> {
61
61
  disableBetButtons(shouldBeDisabled: boolean): void;
62
62
  private disableSpeedButton;
63
63
  private disableInformationButtons;
64
- private disableFreeSpinButton;
65
64
  protected handleDisablingButtons(disabled?: boolean): void;
66
65
  private initButtons;
67
66
  private initBetButtons;
@@ -96,7 +95,6 @@ export declare abstract class AbstractController<T> {
96
95
  * Function is responsible for initializing the spin process
97
96
  * This also is handler for refresh button and space functionalities
98
97
  * After the spin, this function removes free spin plate/summary, big win, mystery containers
99
- *
100
98
  */
101
99
  protected handleSpinLogic(): void;
102
100
  /**
@@ -113,11 +113,15 @@ export class AbstractController {
113
113
  window.addEventListener("keydown", (keyboardEvent) => {
114
114
  if (keyboardEvent.code === "Space" || keyboardEvent.code === "Enter") {
115
115
  keyboardEvent.preventDefault();
116
+ this.handleDisablingButtons(true);
116
117
  this.handleSpinLogic();
117
118
  }
118
119
  });
119
120
  }
120
121
  disableBetButtons(shouldBeDisabled) {
122
+ const freeSpinButton = this.mainContainer.getFreeSpinButton();
123
+ if (freeSpinButton)
124
+ freeSpinButton?.setInteractivity(!shouldBeDisabled);
121
125
  const buttonsToChange = [
122
126
  RainMan.componentRegistry.get(BUTTONS.plus),
123
127
  RainMan.componentRegistry.get(BUTTONS.neg),
@@ -138,16 +142,10 @@ export class AbstractController {
138
142
  ];
139
143
  buttonsToChange.forEach((button) => button.flipDisabledFlag(shouldBeDisabled));
140
144
  }
141
- disableFreeSpinButton(shouldBeDisabled) {
142
- const freeSpinButton = this.mainContainer.getFreeSpinButton();
143
- if (freeSpinButton)
144
- freeSpinButton?.setInteractivity(!shouldBeDisabled);
145
- }
146
145
  handleDisablingButtons(disabled) {
147
146
  this.disableBetButtons(disabled ?? this.shouldBetButtonsBeDisabled);
148
147
  this.disableSpeedButton(disabled ?? this.shouldButtonsBeDisabled);
149
148
  this.disableInformationButtons(disabled ?? this.shouldButtonsBeDisabled);
150
- this.disableFreeSpinButton(disabled ?? this.shouldButtonsBeDisabled);
151
149
  }
152
150
  initButtons() {
153
151
  this.buttonsEventManager.initVolumeButtonEvent();
@@ -182,7 +180,10 @@ export class AbstractController {
182
180
  }
183
181
  initSpinButton() {
184
182
  const refreshButton = RainMan.componentRegistry.get(RefreshButton.registryName);
185
- refreshButton.setOnClick(() => this.handleSpinLogic());
183
+ refreshButton.setOnClick(() => {
184
+ this.handleDisablingButtons(true);
185
+ this.handleSpinLogic();
186
+ });
186
187
  const clearMobileSpinTimeout = () => {
187
188
  if (this.mobileSpinTimeout) {
188
189
  clearInterval(this.mobileSpinTimeout);
@@ -191,9 +192,12 @@ export class AbstractController {
191
192
  };
192
193
  refreshButton.on("touchstart", () => {
193
194
  this.mobileSpinTimeout = setInterval(() => {
195
+ this.handleDisablingButtons(true);
194
196
  if (this.invokeFreeSpinPlateAfterWin ||
195
197
  this.invokeFreeSpinSummaryPlateAfterWin ||
196
- this.resolveBigWin !== undefined) {
198
+ this.resolveBigWin !== undefined ||
199
+ this.resolveSuperBonusWin !== undefined ||
200
+ this.resolveMysteryWin !== undefined) {
197
201
  clearMobileSpinTimeout();
198
202
  return;
199
203
  }
@@ -209,13 +213,13 @@ export class AbstractController {
209
213
  });
210
214
  }
211
215
  get shouldButtonsBeDisabled() {
212
- if (this.gamePhase === gamePhases.DATA_FETCH ||
213
- this.gamePhase === gamePhases.SPINNING ||
214
- this.gamePhase === gamePhases.CONFIGURING_SPIN)
216
+ if (this.quickStopController.quickStopCounterLock)
215
217
  return true;
216
218
  if (RainMan.settingsStore.isAutoplayEnabled)
217
219
  return true;
218
- return this.quickStopController.quickStopCounterLock;
220
+ return (this.gamePhase === gamePhases.SPINNING ||
221
+ this.gamePhase === gamePhases.CONFIGURING_SPIN ||
222
+ this.gamePhase === gamePhases.DATA_FETCH);
219
223
  }
220
224
  get shouldBetButtonsBeDisabled() {
221
225
  return this.shouldButtonsBeDisabled || RainMan.settingsStore.isFreeSpinsPlayEnabled;
@@ -253,6 +257,7 @@ export class AbstractController {
253
257
  changeGamePhase(newPhase) {
254
258
  logInfo(`πŸ‘‹πŸΌπŸ‘‹πŸΌπŸ‘‹πŸΌπŸ‘‹πŸΌ ${this.gamePhase} --> ${newPhase}`);
255
259
  this.gamePhase = newPhase;
260
+ this.handleDisablingButtons(true);
256
261
  this.setMessageBoxBasedOnPhase(newPhase);
257
262
  this.setRefreshButtonBasedOnPhase(newPhase);
258
263
  }
@@ -334,9 +339,9 @@ export class AbstractController {
334
339
  * Function is responsible for initializing the spin process
335
340
  * This also is handler for refresh button and space functionalities
336
341
  * After the spin, this function removes free spin plate/summary, big win, mystery containers
337
- *
338
342
  */
339
343
  handleSpinLogic() {
344
+ this.handleDisablingButtons(true);
340
345
  if (this.mainContainer.freeSpinPlate) {
341
346
  if (this.mainContainer.freeSpinPlate.shownAt === null ||
342
347
  performance.now() - this.mainContainer.freeSpinPlate.shownAt <
@@ -487,6 +492,7 @@ export class AbstractController {
487
492
  */
488
493
  async fetchAndPrepareSpinData() {
489
494
  this.changeGamePhase(gamePhases.DATA_FETCH);
495
+ this.handleDisablingButtons(true);
490
496
  const data = RainMan.settingsStore.buyFreeSpinsData ||
491
497
  (await this.connection.fetchSpinData(this.roundNumber, RainMan.settingsStore.bet, this.getExtraData()));
492
498
  debugSpinData(data);
@@ -500,7 +506,6 @@ export class AbstractController {
500
506
  }
501
507
  }
502
508
  this.changeGamePhase(gamePhases.CONFIGURING_SPIN);
503
- this.handleDisablingButtons(true);
504
509
  this.uiController.currentBalance = data.balance;
505
510
  return {
506
511
  data,
@@ -606,6 +611,8 @@ export class AbstractController {
606
611
  this.uiController.limitWinAmount(spinLogic.winTotalAmount);
607
612
  }
608
613
  this.composeWinActionsQueue(spinLogic);
614
+ if (spinLogic.winTotalAmount === 0 && this.invokeFreeSpinPlateAfterWin)
615
+ this.uiController.messageBox.hideCurrentWinText();
609
616
  await this.playWinActionQueue();
610
617
  await this.countBigWin();
611
618
  await this.handleLoopingWinActionQueue();
@@ -629,16 +636,20 @@ export class AbstractController {
629
636
  this.columnsContainer.resetPlayedSounds();
630
637
  if (this.invokeFreeSpinPlateAfterWin || RainMan.settingsStore.isFreeSpinsBought) {
631
638
  this.mainContainer.messageBox.hideFreeSpinText();
639
+ hideLayerIfPresent();
632
640
  const freeSpinWins = this.getFreeSpinsWins(spinLogic);
633
641
  const freeSpinAward = RainMan.settingsStore.isFreeSpinsBought
634
642
  ? spinLogic.availableFreeSpins
635
643
  : freeSpinWins.at(0)?.freeSpinAward || 0;
636
644
  const isAdditionalFreeSpins = RainMan.settingsStore.howManyFreeSpinsLeft - freeSpinAward > 0;
645
+ if (spinLogic.winTotalAmount === 0 && this.invokeFreeSpinPlateAfterWin && !isAdditionalFreeSpins)
646
+ this.uiController.messageBox.hideCurrentWinText();
637
647
  await this.handleFreeSpinPlateInvocation(freeSpinAward, isAdditionalFreeSpins);
638
648
  this.uiController.triggerUiElementsUpdate();
639
649
  this.uiController.messageBox.showFreeSpinText();
640
650
  }
641
651
  if (this.invokeFreeSpinSummaryPlateAfterWin && !this.skipFreeSpinSummary) {
652
+ hideLayerIfPresent();
642
653
  await this.handleFreeSpinSummaryPlateInvocation();
643
654
  }
644
655
  if (RainMan.settingsStore.isAutoplayEnabled) {
@@ -697,6 +708,7 @@ export class AbstractController {
697
708
  this.autoplaySpin();
698
709
  }
699
710
  lockLogicWhileSpinning() {
711
+ this.handleDisablingButtons(true);
700
712
  this.columnsContainer.setInteractivityForSymbols(false);
701
713
  this.buttonsEventManager.disableButtons();
702
714
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixi-rainman-game-engine",
3
- "version": "0.1.53",
3
+ "version": "0.2.0",
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",