pixi-rainman-game-engine 0.3.38 → 0.3.39

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.
Files changed (33) hide show
  1. package/dist/Rainman/Rainman.js +1 -3
  2. package/dist/Rainman/appConfig.js +0 -1
  3. package/dist/Rainman/types.d.ts +0 -2
  4. package/dist/SettingsUI/components/CloseModalButton/index.jsx +0 -5
  5. package/dist/SettingsUI/components/UXSettings/index.jsx +0 -3
  6. package/dist/SettingsUI/components/index.d.ts +0 -1
  7. package/dist/SettingsUI/components/index.jsx +0 -1
  8. package/dist/SettingsUI/index.jsx +1 -6
  9. package/dist/application/ButtonsEventManager/ButtonsEventManager.d.ts +3 -17
  10. package/dist/application/ButtonsEventManager/ButtonsEventManager.js +62 -95
  11. package/dist/application/SoundManager/SoundManager.d.ts +6 -0
  12. package/dist/application/SoundManager/SoundManager.js +50 -21
  13. package/dist/application/SpeedState/SpeedLevelHandler.js +0 -2
  14. package/dist/application/setup.js +1 -1
  15. package/dist/components/AbstractBuyFreeSpins/AbstractBuyFreeSpinsPlate.js +1 -0
  16. package/dist/components/AbstractMainContainer/AbstractMainContainer.js +4 -1
  17. package/dist/controllers/AbstractController.d.ts +3 -4
  18. package/dist/controllers/AbstractController.js +22 -30
  19. package/dist/controllers/index.d.ts +0 -1
  20. package/dist/controllers/index.js +0 -1
  21. package/dist/localStorage/localStorage.d.ts +0 -1
  22. package/dist/localStorage/localStorage.js +0 -1
  23. package/dist/stores/SettingsStore.d.ts +3 -13
  24. package/dist/stores/SettingsStore.js +16 -23
  25. package/dist/utils/common/functions.d.ts +1 -1
  26. package/dist/utils/common/functions.js +2 -3
  27. package/dist/utils/common/sound.js +5 -8
  28. package/package.json +1 -1
  29. package/dist/SettingsUI/components/SpeedSettingsPopup/index.d.ts +0 -7
  30. package/dist/SettingsUI/components/SpeedSettingsPopup/index.jsx +0 -27
  31. package/dist/SettingsUI/components/SpeedSettingsPopup/speedSettingsPopup.css +0 -159
  32. package/dist/controllers/QuickStopController.d.ts +0 -54
  33. package/dist/controllers/QuickStopController.js +0 -86
@@ -6,7 +6,6 @@ import { SpinData } from "../connectivity";
6
6
  import { gamePhases, PossibleWins } from "../constants";
7
7
  import { RainMan } from "../Rainman";
8
8
  import { ceilToDecimal, debugSpinData, debugSymbolsMatchConfiguration, getDeviceOrientation, hideLayerIfPresent, hidePaytable, hideVolumeModal, logGroup, logGroupEnd, logInfo, logWarn, UI_ITEMS } from "../utils";
9
- import { QuickStopController } from "./QuickStopController";
10
9
  import { UiController } from "./UiController";
11
10
  /**
12
11
  * Abstract controller class for games, this class control game flow
@@ -42,7 +41,6 @@ export class AbstractController {
42
41
  invokeFreeSpinPlateAfterWin = false;
43
42
  invokeFreeSpinSummaryPlateAfterWin = false;
44
43
  hideFreeSpinsMessageBox = false;
45
- quickStopController;
46
44
  uiController;
47
45
  mysteryFxSymbol = null;
48
46
  mysteryFxSymbolMustFormWinningLine = false;
@@ -53,12 +51,13 @@ export class AbstractController {
53
51
  shouldDisableBetButtons = false;
54
52
  wasAutoplayEnabledBeforeFreeSpin = false;
55
53
  setSlowerSpeedForFreeSpins = false;
56
- quickReelsCounter = 0;
54
+ speedLevelBeforeFreeSpins = null;
57
55
  buttonPressed = false;
58
56
  buttonHeldSince = 0;
59
57
  shouldStopMobileSpin = false;
60
58
  disableMessageBoxChange = false;
61
59
  shouldClearQuickReelsStopAfterSpin = false;
60
+ freeSpinsWin = null;
62
61
  resolveBigWin;
63
62
  resolveMysteryWin;
64
63
  resolveBonusWin;
@@ -74,7 +73,6 @@ export class AbstractController {
74
73
  const initData = this.connection.initData();
75
74
  this.initData = initData;
76
75
  this.config = new ApiConfig(initData);
77
- this.quickStopController = new QuickStopController(buttonsEventManager);
78
76
  this.uiController = new UiController(this.config);
79
77
  this.componentRegistry = RainMan.componentRegistry;
80
78
  this.setupSpaceOrEnterListener();
@@ -119,7 +117,6 @@ export class AbstractController {
119
117
  this.buttonsEventManager.initFreeSpinModal();
120
118
  this.buttonsEventManager.setUpUIElementsInteractivity();
121
119
  this.buttonsEventManager.setConfirmAutoplayButton(() => {
122
- this.quickStopController.speedPopupDisabled = true;
123
120
  if (RainMan.settingsStore.isAutoplayEnabled) {
124
121
  return;
125
122
  }
@@ -315,8 +312,7 @@ export class AbstractController {
315
312
  this.buttonsEventManager.initGambleButton(() => {
316
313
  RainMan.settingsStore.isGambleGameAvailable = false;
317
314
  this.mainContainer.invokeGambleGame();
318
- }, this.lastWinAmount === 0 ||
319
- !RainMan.settingsStore.isGambleGameAvailable ||
315
+ }, !RainMan.settingsStore.isGambleGameAvailable ||
320
316
  RainMan.settingsStore.isPlayingAnyAction ||
321
317
  this.gamePhase === gamePhases.HANDLING_ACTIONS ||
322
318
  this.gamePhase === gamePhases.STOPPING_HANDLING_ACTIONS ||
@@ -344,7 +340,6 @@ export class AbstractController {
344
340
  this.gamePhase === gamePhases.GAME_SUMMARY);
345
341
  }
346
342
  RainMan.componentRegistry.get(SpeedControlButton.registryName).setOnClick(() => {
347
- this.quickStopController.speedPopupDisabled = true;
348
343
  RainMan.settingsStore.closeCurrentlyOpenModal?.();
349
344
  RainMan.componentRegistry.nextSpeedLevel();
350
345
  this.uiController.messageBox.updateIncentiveText(sample(i18next.t("idleMessages", { returnObjects: true })[RainMan.componentRegistry.getSpeedLevel()]));
@@ -416,7 +411,7 @@ export class AbstractController {
416
411
  }
417
412
  this.roundNumber = spinData.getRawData().round_number;
418
413
  RainMan.settingsStore.setRoundNumber(this.roundNumber);
419
- if (this._lastWinAmount !== 0) {
414
+ if (this._lastWinAmount !== 0 && spinData.getRawData().round_win_amount) {
420
415
  RainMan.settingsStore.isTakeActionAvailable = true;
421
416
  RainMan.settingsStore.isGambleGameAvailable = true;
422
417
  }
@@ -469,7 +464,6 @@ export class AbstractController {
469
464
  }
470
465
  else {
471
466
  this.columnsContainer.clearQuickReelsStop();
472
- this.quickStopController.setQuickStopCounterLock(false);
473
467
  this.shouldClearQuickReelsStopAfterSpin = false;
474
468
  }
475
469
  };
@@ -530,7 +524,6 @@ export class AbstractController {
530
524
  }
531
525
  this.columnsContainer.enableQuickReelsStop();
532
526
  this.handleDisablingButtons(true);
533
- this.quickStopController.setQuickStopCounterLock(true);
534
527
  this.summaryStop = this.skipFreeSpinSummary ? false : this.invokeFreeSpinSummaryPlateAfterWin;
535
528
  if (this.invokeFreeSpinPlateAfterWin ||
536
529
  this.summaryStop ||
@@ -554,9 +547,6 @@ export class AbstractController {
554
547
  * @returns {boolean} should buttons be disabled
555
548
  */
556
549
  get shouldButtonsBeDisabled() {
557
- if (this.quickStopController.quickStopCounterLock) {
558
- return true;
559
- }
560
550
  if (RainMan.settingsStore.isAutoplayEnabled) {
561
551
  return true;
562
552
  }
@@ -812,23 +802,15 @@ export class AbstractController {
812
802
  * @returns {void}
813
803
  */
814
804
  throttledSpin() {
815
- this.quickReelsCounter += 1;
816
805
  this.columnsContainer.setInteractivityForSymbols(false);
817
806
  this.handleDisablingButtons(true);
818
807
  RainMan.globals.shouldShowModals = false;
819
- if (performance.now() - this.buttonsEventManager.speedPopupShownAt <
820
- RainMan.config.durationOfActions.speedPopupVisibleTime) {
821
- RainMan.globals.handleDisablingButtons?.();
822
- this.columnsContainer.clearQuickReelsStop();
823
- }
824
808
  hidePaytable();
825
809
  if (this.gamePhase === gamePhases.DATA_FETCH ||
826
810
  this.gamePhase === gamePhases.SPINNING ||
827
811
  this.gamePhase === gamePhases.CONFIGURING_SPIN) {
828
812
  this.columnsContainer.enableQuickReelsStop();
829
813
  this.isSpinThrottled = true;
830
- this.quickStopController.handleResetCounter(this.spinThrottlerTimeout !== null);
831
- this.quickStopController.handleInvokingSpeedPopup();
832
814
  return;
833
815
  }
834
816
  this.prepareBoughtFreeSpins();
@@ -944,7 +926,6 @@ export class AbstractController {
944
926
  * @returns {void}
945
927
  */
946
928
  disableAutoplay() {
947
- this.quickStopController.speedPopupDisabled = false;
948
929
  this.autoSpinBalance = 0;
949
930
  RainMan.componentRegistry.get(MessageBox.registryName).hideAutoSpinText();
950
931
  RainMan.componentRegistry.get(AutoplayButton.registryName).activate(false);
@@ -1104,7 +1085,6 @@ export class AbstractController {
1104
1085
  default:
1105
1086
  throw new Error(`Exception in game phase: ${this.gamePhase}`);
1106
1087
  }
1107
- this.buttonsEventManager.setSpeedPopupVisibility("none");
1108
1088
  RainMan.settingsStore.setModalsAvailability(false);
1109
1089
  this.spinning = true;
1110
1090
  logGroup("🟢 spinning start");
@@ -1124,12 +1104,12 @@ export class AbstractController {
1124
1104
  RainMan.settingsStore.disableSpecialButtons();
1125
1105
  this.columnsContainer.blindSpin();
1126
1106
  this.clearAndDestroyActions();
1127
- const { spinLogic } = await this.fetchAndPrepareSpinData();
1107
+ const { spinLogic, data } = await this.fetchAndPrepareSpinData();
1128
1108
  const beforeFetchFreeSpins = RainMan.settingsStore.howManyFreeSpinsLeft;
1129
1109
  const availableFreeSpins = spinLogic.availableFreeSpins;
1130
1110
  const availableFreeSpinsIncreased = availableFreeSpins > RainMan.settingsStore.howManyFreeSpinsLeft;
1131
1111
  this.hideFreeSpinsMessageBox = availableFreeSpinsIncreased;
1132
- if (this._lastWinAmount !== 0 && !(availableFreeSpins > 0)) {
1112
+ if ((this._lastWinAmount !== 0 || data.getRawData().round_win_amount) && !(availableFreeSpins > 0)) {
1133
1113
  RainMan.settingsStore.isTakeActionAvailable = true;
1134
1114
  RainMan.settingsStore.isGambleGameAvailable = true;
1135
1115
  }
@@ -1181,6 +1161,9 @@ export class AbstractController {
1181
1161
  (this.invokeFreeSpinPlateAfterWin || this.setSlowerSpeedForFreeSpins) &&
1182
1162
  RainMan.settingsStore.isFreeSpinsPlayEnabled) {
1183
1163
  this.columnsContainer.clearQuickReelsStop();
1164
+ if (this.speedLevelBeforeFreeSpins === null) {
1165
+ this.speedLevelBeforeFreeSpins = RainMan.settingsStore.currentSpeed;
1166
+ }
1184
1167
  RainMan.settingsStore.setIsTemporarySpeed(false);
1185
1168
  RainMan.componentRegistry.setSpeedLevel(SPEED_LEVELS.slow);
1186
1169
  this.uiController.updateShownSpeedLevel(SPEED_LEVELS.slow);
@@ -1190,8 +1173,6 @@ export class AbstractController {
1190
1173
  debugSymbolsMatchConfiguration(spinLogic.finalBlindsConfiguration);
1191
1174
  await Promise.allSettled(this.uiController.promisesToSetBalances);
1192
1175
  this.changeGamePhase(this.uiController.recentWin === 0 ? gamePhases.IDLE : gamePhases.GAME_SUMMARY);
1193
- this.quickStopController.handleSpeedPopupInvocation();
1194
- this.quickStopController.handleResetCounter(!this.isSpinThrottled);
1195
1176
  logInfo("🔴 spinning end");
1196
1177
  RainMan.settingsStore.reinitData = undefined;
1197
1178
  logGroupEnd();
@@ -1230,12 +1211,15 @@ export class AbstractController {
1230
1211
  if (availableFreeSpinsIncreased) {
1231
1212
  this.uiController.updateShownFreeSpinAmount(availableFreeSpins);
1232
1213
  }
1214
+ let gambleWinAmount = this.lastWinAmount;
1233
1215
  if (this.invokeFreeSpinSummaryPlateAfterWin && !this.skipFreeSpinSummary) {
1216
+ gambleWinAmount = this.uiController.totalFreeSpinWinAmount;
1234
1217
  hideLayerIfPresent();
1235
1218
  await this.handleFreeSpinSummaryPlateInvocation();
1236
1219
  }
1237
1220
  await this.performActionsAfterSpin();
1238
- this.gambleGameEnabler(this.lastWinAmount);
1221
+ this.freeSpinsWin = gambleWinAmount > 0 ? gambleWinAmount : null;
1222
+ this.gambleGameEnabler(gambleWinAmount);
1239
1223
  if (RainMan.settingsStore.isAutoplayEnabled ||
1240
1224
  (RainMan.settingsStore.howManyFreeSpinsLeft !== 0 && this.shouldAutoplayFreeSpins)) {
1241
1225
  this.handleAutoplayLogic();
@@ -1250,6 +1234,13 @@ export class AbstractController {
1250
1234
  this.disableAutoplayButton(false);
1251
1235
  }
1252
1236
  await this.performActionsAfterAllActions();
1237
+ if (this.speedLevelBeforeFreeSpins !== null &&
1238
+ !RainMan.settingsStore.isFreeSpinsPlayEnabled &&
1239
+ !RainMan.globals.isSuperBonusGameEnabled) {
1240
+ RainMan.componentRegistry.setSpeedLevel(this.speedLevelBeforeFreeSpins);
1241
+ this.uiController.updateShownSpeedLevel(this.speedLevelBeforeFreeSpins);
1242
+ this.speedLevelBeforeFreeSpins = null;
1243
+ }
1253
1244
  if (this.wasAutoplayEnabledBeforeFreeSpin &&
1254
1245
  !RainMan.settingsStore.isFreeSpinsPlayEnabled &&
1255
1246
  !RainMan.globals.isSuperBonusGameEnabled) {
@@ -1296,7 +1287,6 @@ export class AbstractController {
1296
1287
  return;
1297
1288
  }
1298
1289
  this.columnsContainer.clearQuickReelsStop();
1299
- this.quickStopController.setQuickStopCounterLock(false);
1300
1290
  this.shouldClearQuickReelsStopAfterSpin = false;
1301
1291
  }
1302
1292
  /**
@@ -1315,6 +1305,7 @@ export class AbstractController {
1315
1305
  });
1316
1306
  this.changeGamePhase(gamePhases.IDLE);
1317
1307
  this.invokeFreeSpinPlateAfterWin = false;
1308
+ RainMan.settingsStore.isFreeSpinsStarted = true;
1318
1309
  }
1319
1310
  /**
1320
1311
  * Function for invoking free spin summary plate, invoked in mainContainer
@@ -1337,6 +1328,7 @@ export class AbstractController {
1337
1328
  RainMan.settingsStore.resetFreeSpinNumberBought();
1338
1329
  this.changeGamePhase(gamePhases.IDLE);
1339
1330
  this.invokeFreeSpinSummaryPlateAfterWin = false;
1331
+ RainMan.settingsStore.isFreeSpinsStarted = false;
1340
1332
  }
1341
1333
  /**
1342
1334
  * Function for handling autoplay logic
@@ -1,4 +1,3 @@
1
1
  export * from "./AbstractController";
2
- export * from "./QuickStopController";
3
2
  export * from "./types";
4
3
  export * from "./UiController";
@@ -1,4 +1,3 @@
1
1
  export * from "./AbstractController";
2
- export * from "./QuickStopController";
3
2
  export * from "./types";
4
3
  export * from "./UiController";
@@ -3,7 +3,6 @@
3
3
  */
4
4
  export declare const LOCAL_STORAGE: {
5
5
  readonly roundNumber: "roundNumberLocalStorage";
6
- readonly hiResolution: "hiResolutionLocalStorage";
7
6
  readonly batterySaver: "batterySaverLocalStorage";
8
7
  readonly volumeLevel: "volumeLevelLocalStorage";
9
8
  readonly isSoundEnabled: "isSoundEnabledLocalStorage";
@@ -3,7 +3,6 @@
3
3
  */
4
4
  export const LOCAL_STORAGE = {
5
5
  roundNumber: "roundNumberLocalStorage",
6
- hiResolution: "hiResolutionLocalStorage",
7
6
  batterySaver: "batterySaverLocalStorage",
8
7
  volumeLevel: "volumeLevelLocalStorage",
9
8
  isSoundEnabled: "isSoundEnabledLocalStorage",
@@ -31,7 +31,6 @@ export declare class SettingsStore {
31
31
  infinitySpinsEnabled: boolean;
32
32
  roundNumber: number;
33
33
  reelSetId: number;
34
- HiResolutionFlag: boolean;
35
34
  batterySaverFlag: boolean;
36
35
  isGambleGameAvailable: boolean;
37
36
  isGambleGameActive: boolean;
@@ -58,8 +57,8 @@ export declare class SettingsStore {
58
57
  disableBigWin: boolean;
59
58
  isAfterFreeSpinsSummary: boolean;
60
59
  isSpeedModalShown: boolean;
60
+ isFreeSpinsStarted: boolean;
61
61
  reinitData?: SpinDataInterface[];
62
- setSpeedPopupVisibility?: (visibility: "flex" | "none") => void;
63
62
  popupPaytableRepositionCallback?: () => void;
64
63
  updateVolumeButtonTexture?: () => void;
65
64
  handleModalInvocation?: (layerId: string) => void;
@@ -137,8 +136,7 @@ export declare class SettingsStore {
137
136
  /**
138
137
  * Sets the free spins price table.
139
138
  * @public
140
- * @param freeSpinsBuyOptions
141
- * @param {Record<number, number>} freeSpinsPriceTable table with free spins prices
139
+ * @param {FreeSpinsBuyOption[]} freeSpinsBuyOptions array with free spins buy options
142
140
  * @returns {void}
143
141
  */
144
142
  setFreeSpinsBuyOptions(freeSpinsBuyOptions: FreeSpinsBuyOption[]): void;
@@ -152,8 +150,7 @@ export declare class SettingsStore {
152
150
  /**
153
151
  * Sets the free spins price table.
154
152
  * @public
155
- * @param buyTypes
156
- * @param {Record<number, number>} jokerBuyOption table with free spins prices
153
+ * @param {BuyType[]} buyTypes array with available buy types
157
154
  * @returns {void}
158
155
  */
159
156
  setGameBuyTypes(buyTypes: BuyType[]): void;
@@ -221,13 +218,6 @@ export declare class SettingsStore {
221
218
  * @returns {void}
222
219
  */
223
220
  setFullScreenFlag(flag: boolean): void;
224
- /**
225
- * Sets the high resolution flag.
226
- * @public
227
- * @param {boolean} flag - New value for high resolution flag.
228
- * @returns {void}
229
- */
230
- setHiResolutionFlag(flag: boolean): void;
231
221
  /**
232
222
  * Sets the temporary speed flag.
233
223
  * @public
@@ -1,12 +1,14 @@
1
1
  import { first, last, range } from "lodash";
2
2
  import { action, computed, makeAutoObservable, observable } from "mobx";
3
- import { SoundManager, SoundTracks } from "../application";
3
+ import { Ticker } from "pixi.js";
4
+ import { SoundManager } from "../application";
4
5
  import { BUTTONS } from "../components";
5
6
  import { PaytableTypes } from "../constants";
6
7
  import { getFromLocalStorage, LOCAL_STORAGE, removeFromLocalStorage, setToLocalStorage } from "../localStorage";
7
8
  import { RainMan } from "../Rainman";
8
- import { changeResolution, logError } from "../utils";
9
+ import { logError } from "../utils";
9
10
  const INITIAL_AUTO_SPIN_COUNT = 50;
11
+ const BATTERY_SAVER_MAX_FPS = 30;
10
12
  /**
11
13
  * This class represents global state of pixi and react application
12
14
  * @class SettingsStore
@@ -35,7 +37,6 @@ export class SettingsStore {
35
37
  infinitySpinsEnabled = false;
36
38
  roundNumber = 0;
37
39
  reelSetId = 0;
38
- HiResolutionFlag = getFromLocalStorage(LOCAL_STORAGE.hiResolution, false);
39
40
  batterySaverFlag = getFromLocalStorage(LOCAL_STORAGE.batterySaver, false);
40
41
  isGambleGameAvailable = true;
41
42
  isGambleGameActive = false;
@@ -49,7 +50,6 @@ export class SettingsStore {
49
50
  howManyFreeSpinsLeft = 0;
50
51
  balanceAfterSpin = 0;
51
52
  howManyAutoSpinsLeft = INITIAL_AUTO_SPIN_COUNT;
52
- // public freeSpinBuyTable: Record<number, number> = {};
53
53
  freeSpinsBuyOptions = [];
54
54
  jokerBuyOptions = [];
55
55
  gameBuyTypes = [];
@@ -63,8 +63,8 @@ export class SettingsStore {
63
63
  disableBigWin = false;
64
64
  isAfterFreeSpinsSummary = true;
65
65
  isSpeedModalShown = false;
66
+ isFreeSpinsStarted = false;
66
67
  reinitData;
67
- setSpeedPopupVisibility;
68
68
  popupPaytableRepositionCallback;
69
69
  updateVolumeButtonTexture;
70
70
  handleModalInvocation;
@@ -100,7 +100,6 @@ export class SettingsStore {
100
100
  setShouldPlayAmbientMusic: action.bound,
101
101
  setShouldPlayFxSounds: action.bound,
102
102
  setFullScreenFlag: action.bound,
103
- setHiResolutionFlag: action.bound,
104
103
  setSpeedLevel: action.bound,
105
104
  setVolumeLevel: action.bound,
106
105
  setOnAnyWin: action.bound,
@@ -220,8 +219,7 @@ export class SettingsStore {
220
219
  /**
221
220
  * Sets the free spins price table.
222
221
  * @public
223
- * @param freeSpinsBuyOptions
224
- * @param {Record<number, number>} freeSpinsPriceTable table with free spins prices
222
+ * @param {FreeSpinsBuyOption[]} freeSpinsBuyOptions array with free spins buy options
225
223
  * @returns {void}
226
224
  */
227
225
  setFreeSpinsBuyOptions(freeSpinsBuyOptions) {
@@ -239,8 +237,7 @@ export class SettingsStore {
239
237
  /**
240
238
  * Sets the free spins price table.
241
239
  * @public
242
- * @param buyTypes
243
- * @param {Record<number, number>} jokerBuyOption table with free spins prices
240
+ * @param {BuyType[]} buyTypes array with available buy types
244
241
  * @returns {void}
245
242
  */
246
243
  setGameBuyTypes(buyTypes) {
@@ -281,6 +278,9 @@ export class SettingsStore {
281
278
  * @returns {void}
282
279
  */
283
280
  refreshBatterySaver() {
281
+ const maxFPS = this.batterySaverFlag ? BATTERY_SAVER_MAX_FPS : 0;
282
+ RainMan.app.ticker.maxFPS = maxFPS;
283
+ Ticker.shared.maxFPS = maxFPS;
284
284
  this.containersWithSpines.forEach((spine) => spine.setAnimationTimescale(!this.batterySaverFlag));
285
285
  }
286
286
  /**
@@ -292,7 +292,12 @@ export class SettingsStore {
292
292
  */
293
293
  setShouldPlayAmbientMusic(flag, saveToLocalStorage = true) {
294
294
  this.shouldPlayAmbientMusic = flag;
295
- SoundManager.setPlayStatus(this.isFreeSpinsPlayEnabled ? SoundTracks.freeSpinsMusic : SoundTracks.music, flag);
295
+ if (!flag) {
296
+ SoundManager.stopAmbientMusic();
297
+ }
298
+ else {
299
+ SoundManager.restoreAmbientPlayback();
300
+ }
296
301
  this.updateVolumeButtonTexture?.();
297
302
  if (saveToLocalStorage) {
298
303
  setToLocalStorage(LOCAL_STORAGE.isAmbientMusicEnabled, flag);
@@ -371,18 +376,6 @@ export class SettingsStore {
371
376
  window.document.exitFullscreen();
372
377
  }
373
378
  }
374
- /**
375
- * Sets the high resolution flag.
376
- * @public
377
- * @param {boolean} flag - New value for high resolution flag.
378
- * @returns {void}
379
- */
380
- setHiResolutionFlag(flag) {
381
- this.HiResolutionFlag = flag;
382
- setToLocalStorage(LOCAL_STORAGE.hiResolution, flag);
383
- changeResolution(flag);
384
- window.dispatchEvent(new Event("resize"));
385
- }
386
379
  /**
387
380
  * Sets the temporary speed flag.
388
381
  * @public
@@ -77,7 +77,7 @@ export declare const setTimeScale: (spine: Spine, flag: boolean) => void;
77
77
  * @param {boolean} high should be true for high resolution, false for low resolution
78
78
  * @returns {void}
79
79
  */
80
- export declare const changeResolution: (high: boolean) => void;
80
+ export declare const changeResolution: () => void;
81
81
  /**
82
82
  * Helper function for checking if the value is not null or undefined
83
83
  * @template T
@@ -145,9 +145,8 @@ export const setTimeScale = (spine, flag) => {
145
145
  * @param {boolean} high should be true for high resolution, false for low resolution
146
146
  * @returns {void}
147
147
  */
148
- export const changeResolution = (high) => {
149
- const lowRes = Math.max(window.devicePixelRatio * 0.5, 1);
150
- const resolution = high ? window.devicePixelRatio : lowRes;
148
+ export const changeResolution = () => {
149
+ const resolution = window.devicePixelRatio;
151
150
  RainMan.app.renderer.resolution = resolution;
152
151
  RainMan.app.renderer.resize(RainMan.app.screen.width, RainMan.app.screen.height);
153
152
  };
@@ -24,7 +24,7 @@ const pauseAudio = () => {
24
24
  shouldResumeAudioOnInterruption = false;
25
25
  removeInterruptedAudioResumeListeners();
26
26
  if (RainMan.settingsStore.isSoundEnabled()) {
27
- SoundManager.pauseAll();
27
+ SoundManager.stopSoundsForPageHide();
28
28
  }
29
29
  };
30
30
  /**
@@ -40,13 +40,10 @@ const resumeAudio = async () => {
40
40
  }
41
41
  isResumingAudio = true;
42
42
  try {
43
- if (RainMan.settingsStore.isSoundEnabled()) {
44
- const hasResumedAudioContext = await SoundManager.resumeOnFocus();
45
- if (!hasResumedAudioContext) {
46
- interruptedAudioResume();
47
- return;
48
- }
49
- SoundManager.resumeAll();
43
+ const hasResumedAudioContext = await SoundManager.resumeOnFocus();
44
+ if (!hasResumedAudioContext) {
45
+ interruptedAudioResume();
46
+ return;
50
47
  }
51
48
  if (SoundManager.isAudioContextRunning()) {
52
49
  shouldResumeAudioOnInterruption = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixi-rainman-game-engine",
3
- "version": "0.3.38",
3
+ "version": "0.3.39",
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",
@@ -1,7 +0,0 @@
1
- import "react-custom-scroll/dist/customScroll.css";
2
- import "./speedSettingsPopup.css";
3
- import React from "react";
4
- export declare const SPEED_PREFIX = "speed-";
5
- export declare const SpeedSettingsPopup: (() => React.JSX.Element) & {
6
- displayName: string;
7
- };
@@ -1,27 +0,0 @@
1
- import "react-custom-scroll/dist/customScroll.css";
2
- import "./speedSettingsPopup.css";
3
- import i18next from "i18next";
4
- import { observer } from "mobx-react-lite";
5
- import React from "react";
6
- import { SPEED_LEVELS } from "../../../application";
7
- import { UI_ITEMS } from "../../../utils";
8
- import { useStores } from "../../hooks";
9
- import { CloseModalButton } from "../CloseModalButton";
10
- export const SPEED_PREFIX = "speed-";
11
- export const SpeedSettingsPopup = observer(() => {
12
- const speedLevelMapper = {
13
- slow: SPEED_LEVELS.slow,
14
- normal: SPEED_LEVELS.normal,
15
- fast: SPEED_LEVELS.fast,
16
- };
17
- const { settingStore } = useStores();
18
- return (<div className="speed-settings-popup">
19
- <CloseModalButton layerId={UI_ITEMS.speedSettings}/>
20
- <div className="speed-settings-popup__title">{i18next.t("howDoYouWantToPlay")}</div>
21
- <div className="speed-settings-popup__speed-options">
22
- {Object.keys(speedLevelMapper).map((speedLevelKey) => (<div id={`${SPEED_PREFIX}${speedLevelKey}`} key={`${SPEED_PREFIX}${speedLevelKey}`} className={`speed-settings-popup__option ${speedLevelKey === settingStore.currentSpeed ? "speed-settings-popup_option--active" : ""}`}>
23
- <img className={`speed-settings-popup__icon ${speedLevelMapper[speedLevelKey]}`} src={`../../../assets/settings/speedPopup/speed-${speedLevelMapper[speedLevelKey]}.png`}/>
24
- </div>))}
25
- </div>
26
- </div>);
27
- });
@@ -1,159 +0,0 @@
1
- .speed-settings-modal {
2
- width: 50vw;
3
- height: 30vh;
4
- top: 40vh;
5
- left: 25vw;
6
- align-items: center;
7
- justify-content: center;
8
- z-index: 0;
9
- }
10
-
11
- .modal-overlay {
12
- position: fixed;
13
- inset: 0;
14
- background: rgba(0, 0, 0, 0.6);
15
- backdrop-filter: blur(2px);
16
- display: flex;
17
- align-items: center;
18
- justify-content: center;
19
- z-index: 0;
20
- }
21
-
22
- .speed-settings-popup {
23
- display: flex;
24
- flex-direction: column;
25
- gap: 20px;
26
- align-items: center;
27
- justify-content: space-between;
28
- }
29
-
30
- .speed-settings-popup__title {
31
- font-size: 25px;
32
- color: white;
33
- text-transform: uppercase;
34
- margin-top: 10px;
35
- }
36
-
37
- .speed-settings-popup__speed-options {
38
- display: flex;
39
- flex-direction: row;
40
- justify-content: space-between;
41
- gap: 25px;
42
- width: 100%;
43
- height: 120px;
44
- }
45
-
46
- .speed-settings-popup__option {
47
- display: flex;
48
- justify-content: center;
49
- align-items: center;
50
- background-image: url("/assets/settings/speedPopup/speed-frame.png");
51
- width: 145px;
52
- height: 78px;
53
- background-repeat: no-repeat no-repeat;
54
- background-size: contain;
55
- cursor: pointer;
56
- }
57
-
58
- .speed-settings-popup__option:hover {
59
- background-image: url("/assets/settings/speedPopup/speed-frame-active.png");
60
- width: 145px;
61
- height: 78px;
62
- background-repeat: no-repeat no-repeat;
63
- background-size: contain;
64
- }
65
-
66
- .speed-settings-popup_option--active {
67
- background-image: url("/assets/settings/speedPopup/speed-frame-active.png");
68
- width: 145px;
69
- height: 78px;
70
- background-repeat: no-repeat no-repeat;
71
- background-size: contain;
72
- }
73
-
74
- .speed-settings-popup__icon.slow {
75
- width: 70px;
76
- }
77
-
78
- .speed-settings-popup__icon.normal {
79
- width: 35px;
80
- }
81
-
82
- .speed-settings-popup__icon.fast {
83
- width: 90px;
84
- }
85
-
86
- @media only screen and (max-width: 450px) {
87
- .speed-settings-modal {
88
- width: 80vw;
89
- height: 50vh;
90
- left: 10vw;
91
- top: 10vh;
92
- }
93
-
94
- .speed-settings-popup__title {
95
- margin-top: 10px;
96
- font-size: 14px;
97
- }
98
-
99
- .speed-settings-popup__speed-options {
100
- display: flex;
101
- flex-direction: column;
102
- justify-content: space-between;
103
- align-items: center;
104
- height: 75%;
105
- }
106
-
107
- .speed-settings-popup__option {
108
- width: 120px;
109
- height: 66px;
110
- }
111
-
112
- .speed-settings-popup__icon.slow {
113
- width: 60px;
114
- }
115
-
116
- .speed-settings-popup__icon.normal {
117
- width: 30px;
118
- }
119
-
120
- .speed-settings-popup__icon.fast {
121
- width: 70px;
122
- }
123
- }
124
-
125
- @media screen and (max-width: 450px) and (pointer: coarse) {
126
- .speed-settings-popup__option {
127
- width: 120px;
128
- height: 66px;
129
- }
130
-
131
- .speed-settings-popup__option:hover {
132
- background-image: url("/assets/settings/speedPopup/speed-frame-active.png");
133
- background-repeat: no-repeat no-repeat;
134
- background-size: contain;
135
- }
136
-
137
- .speed-settings-popup__option:focus {
138
- background-image: url("/assets/settings/speedPopup/speed-frame-active.png");
139
- background-repeat: no-repeat no-repeat;
140
- background-size: contain;
141
- }
142
- }
143
-
144
- @media only screen and (max-height: 450px) {
145
- .speed-settings-modal {
146
- width: 80vw;
147
- height: 50vh;
148
- left: 10vw;
149
- top: 10vh;
150
- }
151
-
152
- .speed-settings-popup__title {
153
- font-size: 20px;
154
- }
155
-
156
- .speed-settings-popup__speed-options {
157
- height: 60%;
158
- }
159
- }