pixi-rainman-game-engine 0.2.17 → 0.2.18

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.
@@ -5,6 +5,8 @@ import React from "react";
5
5
  import { useStores } from "../../hooks";
6
6
  export const BetControls = observer(() => {
7
7
  const { settingStore } = useStores();
8
+ const { isFreeSpinsPlayEnabled, isFreeSpinsBought, betChangeDisabled } = settingStore;
9
+ const isDisabled = isFreeSpinsPlayEnabled || betChangeDisabled || isFreeSpinsBought;
8
10
  const onClick = (type) => {
9
11
  if (type === "increase") {
10
12
  settingStore.increaseBet?.();
@@ -16,13 +18,13 @@ export const BetControls = observer(() => {
16
18
  return (<div className="bet-container">
17
19
  <h2>{i18next.t("totalBet")}</h2>
18
20
  <div className="bet-container__controls">
19
- <button disabled={settingStore.isFreeSpinsPlayEnabled || settingStore.betChangeDisabled} onClick={() => onClick("decrease")} className="bet-container__button" name="bet-minus">
21
+ <button disabled={isDisabled} onClick={() => onClick("decrease")} className="bet-container__button" name="bet-minus">
20
22
  -
21
23
  </button>
22
24
  <div className="bet-container__value">
23
25
  <p>{settingStore.betText}</p>
24
26
  </div>
25
- <button disabled={settingStore.isFreeSpinsPlayEnabled || settingStore.betChangeDisabled} onClick={() => onClick("increase")} className="bet-container__button" name="bet-plus">
27
+ <button disabled={isDisabled} onClick={() => onClick("increase")} className="bet-container__button" name="bet-plus">
26
28
  +
27
29
  </button>
28
30
  </div>
@@ -144,9 +144,12 @@ export class ButtonsEventManager {
144
144
  * @param {(strategy: "first" | "increase" | "decrease") => void} setBetCallback - callback for setting bet
145
145
  */
146
146
  initBetPlusButtonEvent(setBetCallback) {
147
+ const { isFreeSpinsBought, isFreeSpinsPlayEnabled, betChangeDisabled } = RainMan.settingsStore;
147
148
  if (this.settingsPlusButton === null) {
148
149
  this.settingsPlusButton = window.document.getElementsByName("bet-plus")[0];
149
150
  this.settingsPlusButton.addEventListener("click", () => {
151
+ if (isFreeSpinsBought || isFreeSpinsPlayEnabled || betChangeDisabled)
152
+ return;
150
153
  setBetCallback("increase");
151
154
  });
152
155
  }
@@ -159,8 +162,11 @@ export class ButtonsEventManager {
159
162
  */
160
163
  initBetMinusButtonEvent(setBetCallback) {
161
164
  if (this.settingsMinusButton === null) {
165
+ const { isFreeSpinsBought, isFreeSpinsPlayEnabled, betChangeDisabled } = RainMan.settingsStore;
162
166
  this.settingsMinusButton = window.document.getElementsByName("bet-minus")[0];
163
167
  this.settingsMinusButton.addEventListener("click", () => {
168
+ if (isFreeSpinsBought || isFreeSpinsPlayEnabled || betChangeDisabled)
169
+ return;
164
170
  setBetCallback("decrease");
165
171
  });
166
172
  }
@@ -173,6 +173,7 @@ export class AbstractController {
173
173
  });
174
174
  }
175
175
  initBetButtons() {
176
+ const { isFreeSpinsBought, isFreeSpinsPlayEnabled, betChangeDisabled } = RainMan.settingsStore;
176
177
  this.buttonsEventManager.initBetPlusButtonEvent(this.uiController.updateBet.bind(this.uiController));
177
178
  this.buttonsEventManager.initBetMinusButtonEvent(this.uiController.updateBet.bind(this.uiController));
178
179
  if (RainMan.settingsStore.isAutoplayEnabled) {
@@ -180,14 +181,20 @@ export class AbstractController {
180
181
  }
181
182
  if (getDeviceOrientation().includes("mobile")) {
182
183
  RainMan.componentRegistry.get(BUTTONS.plus).setOnClick(() => {
184
+ if (isFreeSpinsBought || isFreeSpinsPlayEnabled || betChangeDisabled)
185
+ return;
183
186
  RainMan.settingsStore.handleModalInvocation?.(UI_ITEMS.bet);
184
187
  });
185
188
  return;
186
189
  }
187
190
  RainMan.componentRegistry.get(BUTTONS.plus).setOnClick(() => {
191
+ if (isFreeSpinsBought || isFreeSpinsPlayEnabled || betChangeDisabled)
192
+ return;
188
193
  this.uiController.updateBet("increase");
189
194
  });
190
195
  RainMan.componentRegistry.get(BUTTONS.neg).setOnClick(() => {
196
+ if (isFreeSpinsBought || isFreeSpinsPlayEnabled || betChangeDisabled)
197
+ return;
191
198
  this.uiController.updateBet("decrease");
192
199
  });
193
200
  }
@@ -713,6 +720,8 @@ export class AbstractController {
713
720
  this.uiController.triggerUiElementsUpdate();
714
721
  this.uiController.messageBox.showFreeSpinText();
715
722
  }
723
+ if (availableFreeSpinsIncreased)
724
+ this.uiController.updateShownFreeSpinAmount(availableFreeSpins);
716
725
  if (this.invokeFreeSpinSummaryPlateAfterWin && !this.skipFreeSpinSummary) {
717
726
  hideLayerIfPresent();
718
727
  await this.handleFreeSpinSummaryPlateInvocation();
@@ -154,7 +154,6 @@ export class UiController {
154
154
  this.updateBet("remain");
155
155
  this.setDisplayedBalance();
156
156
  this.setDisplayedCurrentWin();
157
- this.updateShownFreeSpinAmount(RainMan.settingsStore.howManyFreeSpinsLeft);
158
157
  }
159
158
  setDisplayedBalance() {
160
159
  RainMan.componentRegistry.get(COMPONENTS.creditText).set(this.currentBalance);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixi-rainman-game-engine",
3
- "version": "0.2.17",
3
+ "version": "0.2.18",
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",