pixi-rainman-game-engine 0.2.10 β†’ 0.2.12

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,7 +14,7 @@ export declare class ComponentRegistry {
14
14
  /**
15
15
  * Method for changing temporarily speed for turbo spin
16
16
  * @public
17
- * @param {SpeedLevel} newSpeedLevel
17
+ * @param {SpeedLevel} newSpeedLevel - new speed level
18
18
  */
19
19
  setTemporarySpeedLevel(newSpeedLevel: SpeedLevel): void;
20
20
  /**
@@ -25,7 +25,7 @@ export declare class ComponentRegistry {
25
25
  /**
26
26
  * Setter fo speed level
27
27
  * @public
28
- * @param {SpeedLevel} newSpeedLevel
28
+ * @param {SpeedLevel} newSpeedLevel - new speed level
29
29
  */
30
30
  setSpeedLevel(newSpeedLevel: SpeedLevel): void;
31
31
  /**
@@ -36,7 +36,7 @@ export declare class ComponentRegistry {
36
36
  /**
37
37
  * Getter for current speed level
38
38
  * @public
39
- * @returns {SpeedLevel}
39
+ * @returns {SpeedLevel} speed of the game
40
40
  */
41
41
  getSpeedLevel(): SpeedLevel;
42
42
  /**
@@ -47,26 +47,26 @@ export declare class ComponentRegistry {
47
47
  /**
48
48
  * Function for adding components into ComponentRegistry
49
49
  * @public
50
- * @param {Container} component
50
+ * @param {Container} component component to be added
51
51
  */
52
52
  add(component: Container): void;
53
53
  /**
54
54
  * Function for updating component that are in ComponentRegistry
55
55
  * @public
56
- * @param {Container} oldComponent
57
- * @param {Container} newComponent
56
+ * @param {Container} oldComponent - old component
57
+ * @param {Container} newComponent - new component
58
58
  */
59
59
  update(oldComponent: Container, newComponent: Container): void;
60
60
  /**
61
61
  * Function for removing components from Component Registry
62
62
  * @public
63
- * @param {Container} component
63
+ * @param {Container} component - component to be removed
64
64
  */
65
65
  remove(component: Container): void;
66
66
  /**
67
67
  * Function that adapt speed of all components
68
68
  * @public
69
- * @param {SpeedLevel} speedLevel
69
+ * @param {SpeedLevel} speedLevel - speed lever for updating
70
70
  */
71
71
  updateAllSpeedAdaptable(speedLevel: SpeedLevel): void;
72
72
  /**
@@ -74,36 +74,36 @@ export declare class ComponentRegistry {
74
74
  * Throws error if component is not present
75
75
  * @public
76
76
  * @template {keyof RegistryMap} T
77
- * @param {T} componentName
78
- * @returns {RegistryMap[T]}
77
+ * @param {T} componentName - name of the component
78
+ * @returns {RegistryMap[T]} - component from registry
79
79
  */
80
80
  get<T extends keyof RegistryMap>(componentName: T): RegistryMap[T];
81
81
  /**
82
82
  * Getter for existing components that are in ComponentRegistry
83
83
  * @public
84
84
  * @template {keyof RegistryMap} T
85
- * @param {T} componentName
86
- * @returns {RegistryMap[T]}
85
+ * @param {T} componentName - component name
86
+ * @returns {RegistryMap[T]} - component from registry
87
87
  */
88
88
  getIfExists<T extends keyof RegistryMap>(componentName: T): RegistryMap[T];
89
89
  /**
90
90
  * Helper function to check if the component is present in ComponentRegistry
91
91
  * @public
92
92
  * @template {keyof RegistryMap} T
93
- * @param {T} componentName
94
- * @returns {boolean}
93
+ * @param {T} componentName - component name
94
+ * @returns {boolean} - true if component is present
95
95
  */
96
96
  has<T extends keyof RegistryMap>(componentName: T): boolean;
97
97
  /**
98
98
  * Function for adding components
99
99
  * @public
100
- * @param {Container[]} components
100
+ * @param {Container[]} components - components to be added
101
101
  */
102
102
  addMany(components: Container[]): void;
103
103
  /**
104
104
  * Function for removing components
105
105
  * @public
106
- * @param {Container[]} components
106
+ * @param {Container[]} components - components to be removed
107
107
  */
108
108
  removeMany(components: Container[]): void;
109
109
  }
@@ -21,7 +21,7 @@ export class ComponentRegistry {
21
21
  /**
22
22
  * Method for changing temporarily speed for turbo spin
23
23
  * @public
24
- * @param {SpeedLevel} newSpeedLevel
24
+ * @param {SpeedLevel} newSpeedLevel - new speed level
25
25
  */
26
26
  setTemporarySpeedLevel(newSpeedLevel) {
27
27
  this.speedLevelHandler.setSpeed(newSpeedLevel);
@@ -38,7 +38,7 @@ export class ComponentRegistry {
38
38
  /**
39
39
  * Setter fo speed level
40
40
  * @public
41
- * @param {SpeedLevel} newSpeedLevel
41
+ * @param {SpeedLevel} newSpeedLevel - new speed level
42
42
  */
43
43
  setSpeedLevel(newSpeedLevel) {
44
44
  this.speedLevelHandler.setSpeed(newSpeedLevel);
@@ -59,7 +59,7 @@ export class ComponentRegistry {
59
59
  /**
60
60
  * Getter for current speed level
61
61
  * @public
62
- * @returns {SpeedLevel}
62
+ * @returns {SpeedLevel} speed of the game
63
63
  */
64
64
  getSpeedLevel() {
65
65
  return this.speedLevelHandler.currentSpeed;
@@ -74,7 +74,7 @@ export class ComponentRegistry {
74
74
  /**
75
75
  * Function for adding components into ComponentRegistry
76
76
  * @public
77
- * @param {Container} component
77
+ * @param {Container} component component to be added
78
78
  */
79
79
  add(component) {
80
80
  if (isSpeedAdapterInterface(component)) {
@@ -95,8 +95,8 @@ export class ComponentRegistry {
95
95
  /**
96
96
  * Function for updating component that are in ComponentRegistry
97
97
  * @public
98
- * @param {Container} oldComponent
99
- * @param {Container} newComponent
98
+ * @param {Container} oldComponent - old component
99
+ * @param {Container} newComponent - new component
100
100
  */
101
101
  update(oldComponent, newComponent) {
102
102
  if (oldComponent.name !== newComponent.name) {
@@ -114,7 +114,7 @@ export class ComponentRegistry {
114
114
  /**
115
115
  * Function for removing components from Component Registry
116
116
  * @public
117
- * @param {Container} component
117
+ * @param {Container} component - component to be removed
118
118
  */
119
119
  remove(component) {
120
120
  if (component.name)
@@ -123,7 +123,7 @@ export class ComponentRegistry {
123
123
  /**
124
124
  * Function that adapt speed of all components
125
125
  * @public
126
- * @param {SpeedLevel} speedLevel
126
+ * @param {SpeedLevel} speedLevel - speed lever for updating
127
127
  */
128
128
  updateAllSpeedAdaptable(speedLevel) {
129
129
  this.speedAdaptableComponents.forEach((speedAdaptableComponent) => {
@@ -135,8 +135,8 @@ export class ComponentRegistry {
135
135
  * Throws error if component is not present
136
136
  * @public
137
137
  * @template {keyof RegistryMap} T
138
- * @param {T} componentName
139
- * @returns {RegistryMap[T]}
138
+ * @param {T} componentName - name of the component
139
+ * @returns {RegistryMap[T]} - component from registry
140
140
  */
141
141
  get(componentName) {
142
142
  const componentToReturn = this.registry.get(componentName);
@@ -149,8 +149,8 @@ export class ComponentRegistry {
149
149
  * Getter for existing components that are in ComponentRegistry
150
150
  * @public
151
151
  * @template {keyof RegistryMap} T
152
- * @param {T} componentName
153
- * @returns {RegistryMap[T]}
152
+ * @param {T} componentName - component name
153
+ * @returns {RegistryMap[T]} - component from registry
154
154
  */
155
155
  getIfExists(componentName) {
156
156
  const componentToReturn = this.registry.get(componentName);
@@ -160,8 +160,8 @@ export class ComponentRegistry {
160
160
  * Helper function to check if the component is present in ComponentRegistry
161
161
  * @public
162
162
  * @template {keyof RegistryMap} T
163
- * @param {T} componentName
164
- * @returns {boolean}
163
+ * @param {T} componentName - component name
164
+ * @returns {boolean} - true if component is present
165
165
  */
166
166
  has(componentName) {
167
167
  return this.registry.has(componentName);
@@ -169,7 +169,7 @@ export class ComponentRegistry {
169
169
  /**
170
170
  * Function for adding components
171
171
  * @public
172
- * @param {Container[]} components
172
+ * @param {Container[]} components - components to be added
173
173
  */
174
174
  addMany(components) {
175
175
  for (const component of components) {
@@ -179,7 +179,7 @@ export class ComponentRegistry {
179
179
  /**
180
180
  * Function for removing components
181
181
  * @public
182
- * @param {Container[]} components
182
+ * @param {Container[]} components - components to be removed
183
183
  */
184
184
  removeMany(components) {
185
185
  for (const component of components) {
@@ -28,6 +28,7 @@ export class RainMan {
28
28
  RainMan.settingsStore = settingStore;
29
29
  RainMan.componentRegistry = new ComponentRegistry(app);
30
30
  RainMan.globals = {
31
+ shouldShowModals: false,
31
32
  currency: Currencies["USD"],
32
33
  };
33
34
  }
@@ -66,6 +66,7 @@ export type AppConfig = RequiredAppConfig & DeepPartial<OptionalAppConfig>;
66
66
  */
67
67
  export interface Globals {
68
68
  currency: Currency;
69
+ shouldShowModals: boolean;
69
70
  actionsAfterClosureWebSocket?: () => void;
70
71
  disableSpeedPopup?: (value: boolean) => void;
71
72
  handleDisablingButtons?: (value?: boolean) => void;
@@ -49,7 +49,7 @@ export const AutoplaySettings = observer(() => {
49
49
  useEffect(() => {
50
50
  updateLimitsBounds(initialAutoSpinCount);
51
51
  }, []);
52
- const { singleWinExceeds, balancedIncreased, balancedDecreased, howManyAutoSpinsLeft, infinitySpinsEnabled, setSingleWinExceeds, setBalancedIncreased, setBalancedDecreased, setAutoSpinsCount, flipInfinitySpinsFlag, resetAutoplaySettings, } = settingStore;
52
+ const { singleWinExceeds, balancedIncreased, balancedDecreased, howManyAutoSpinsLeft, infinitySpinsEnabled, setSingleWinExceeds, setBalancedIncreased, setBalancedDecreased, setAutoSpinsCount, flipInfinitySpinsFlag, resetAutoplaySettings, isAutoplayEnabled, } = settingStore;
53
53
  return (<div className="autoplay-settings">
54
54
  <CloseModalButton layerId={UI_ITEMS.autoplay}/>
55
55
  <div className="autoplay-settings__title">
@@ -110,7 +110,11 @@ export const AutoplaySettings = observer(() => {
110
110
  }}>
111
111
  <p>{i18next.t("cancel")}</p>
112
112
  </button>
113
- <button id={COMPONENTS.autoSpinConfirm} onClick={() => settingStore.decreaseAutoSpinsCount()} className="autoplay-settings__confirmation-button">
113
+ <button id={COMPONENTS.autoSpinConfirm} onClick={() => {
114
+ if (isAutoplayEnabled)
115
+ return;
116
+ settingStore.decreaseAutoSpinsCount();
117
+ }} className="autoplay-settings__confirmation-button">
114
118
  <p>{i18next.t("confirm")}</p>
115
119
  </button>
116
120
  </div>
@@ -304,7 +304,7 @@ export class ButtonsEventManager {
304
304
  * @param {string} layerName - name of layer
305
305
  */
306
306
  handleModalInvocation(layerName) {
307
- if (this.checkAnyLayerIsPresent(layerName))
307
+ if (this.checkAnyLayerIsPresent(layerName) && RainMan.globals.shouldShowModals)
308
308
  return;
309
309
  const layer = window.document.getElementById(layerName);
310
310
  if (layer !== null) {
@@ -20,10 +20,13 @@ export declare class SpeedLevelHandler {
20
20
  /**
21
21
  * Setter for speed level
22
22
  * @param {SpeedLevel} newSpeedLevel - new speed level
23
+ * @throws {Error} - if no matched speed level
23
24
  */
24
25
  setSpeed(newSpeedLevel: SpeedLevel): void;
25
26
  /**
26
27
  * Function for setting next speed level
28
+ * This will after switching speed level check if the speed level is normal or fast
29
+ * and if so, it will disable the speed popup
27
30
  */
28
31
  nextSpeed(): void;
29
32
  /**
@@ -1,3 +1,4 @@
1
+ import { RainMan } from "../../Rainman";
1
2
  import { DEFAULT_SPEED, SPEED_LEVELS } from "./SpeedLevel";
2
3
  /**
3
4
  * Class for handling speed levels
@@ -29,6 +30,7 @@ export class SpeedLevelHandler {
29
30
  /**
30
31
  * Setter for speed level
31
32
  * @param {SpeedLevel} newSpeedLevel - new speed level
33
+ * @throws {Error} - if no matched speed level
32
34
  */
33
35
  setSpeed(newSpeedLevel) {
34
36
  switch (newSpeedLevel) {
@@ -47,8 +49,11 @@ export class SpeedLevelHandler {
47
49
  }
48
50
  /**
49
51
  * Function for setting next speed level
52
+ * This will after switching speed level check if the speed level is normal or fast
53
+ * and if so, it will disable the speed popup
50
54
  */
51
55
  nextSpeed() {
56
+ RainMan.globals.disableSpeedPopup?.(true);
52
57
  if (this.shouldResetSpeedOptionsLoop()) {
53
58
  this.chosenSpeedLevel = 0;
54
59
  return;
@@ -276,6 +276,12 @@ export class AbstractController {
276
276
  changeGamePhase(newPhase) {
277
277
  logInfo(`πŸ‘‹πŸΌπŸ‘‹πŸΌπŸ‘‹πŸΌπŸ‘‹πŸΌ ${this.gamePhase} --> ${newPhase}`);
278
278
  this.gamePhase = newPhase;
279
+ if (this.gamePhase === gamePhases.HANDLING_ACTIONS ||
280
+ this.gamePhase === gamePhases.STOPPING_HANDLING_ACTIONS ||
281
+ this.gamePhase === gamePhases.SPINNING ||
282
+ this.gamePhase === gamePhases.GAME_SUMMARY) {
283
+ RainMan.globals.shouldShowModals = false;
284
+ }
279
285
  this.handleDisablingButtons(true);
280
286
  this.setMessageBoxBasedOnPhase(newPhase);
281
287
  this.setRefreshButtonBasedOnPhase(newPhase);
@@ -366,6 +372,7 @@ export class AbstractController {
366
372
  */
367
373
  handleSpinLogic() {
368
374
  this.handleDisablingButtons(true);
375
+ RainMan.globals.shouldShowModals = false;
369
376
  if (this.mainContainer.freeSpinPlate) {
370
377
  if (this.mainContainer.freeSpinPlate.shownAt === null ||
371
378
  performance.now() - this.mainContainer.freeSpinPlate.shownAt <
@@ -421,6 +428,7 @@ export class AbstractController {
421
428
  */
422
429
  throttledSpin() {
423
430
  this.handleDisablingButtons(true);
431
+ RainMan.globals.shouldShowModals = false;
424
432
  const elementsToSkipHide = [];
425
433
  if (performance.now() - this.buttonsEventManager.speedPopupShownAt <
426
434
  RainMan.config.durationOfActions.speedPopupVisibleTime) {
@@ -473,6 +481,7 @@ export class AbstractController {
473
481
  * @returns {void} promise
474
482
  */
475
483
  autoplaySpin() {
484
+ RainMan.globals.shouldShowModals = false;
476
485
  if (!RainMan.settingsStore.howManyAutoSpinsLeft)
477
486
  return;
478
487
  if (!RainMan.settingsStore.infinitySpinsEnabled) {
@@ -480,6 +489,7 @@ export class AbstractController {
480
489
  }
481
490
  if (RainMan.settingsStore.howManyAutoSpinsLeft === 0) {
482
491
  this.uiController.messageBox.showIncentiveText();
492
+ RainMan.globals.shouldShowModals = false;
483
493
  this.disableAutoplay();
484
494
  }
485
495
  this.changeGamePhase(gamePhases.IDLE);
@@ -498,9 +508,10 @@ export class AbstractController {
498
508
  disableAutoplay() {
499
509
  RainMan.componentRegistry.get(AutoplayButton.registryName).activate(false);
500
510
  RainMan.componentRegistry.get(MessageBox.registryName).hideAutoSpinText();
501
- RainMan.settingsStore.resetAutoplaySettings();
502
511
  RainMan.componentRegistry.get(BUTTONS.plus).flipDisabledFlag(false);
503
512
  RainMan.componentRegistry.get(BUTTONS.neg).flipDisabledFlag(false);
513
+ RainMan.settingsStore.resetAutoplaySettings();
514
+ RainMan.globals.shouldShowModals = false;
504
515
  }
505
516
  /**
506
517
  * This function is responsible for actions while fetching data
@@ -573,6 +584,7 @@ export class AbstractController {
573
584
  * @returns {Promise<void>}
574
585
  */
575
586
  async spin() {
587
+ RainMan.globals.shouldShowModals = false;
576
588
  if (this.uiController.currentBalance < RainMan.settingsStore.bet) {
577
589
  try {
578
590
  this.uiController.updateBet("highest");
@@ -695,6 +707,7 @@ export class AbstractController {
695
707
  this.handleDisablingButtons();
696
708
  RainMan.settingsStore.setModalsAvailability(true);
697
709
  await this.performActionsAfterSpin();
710
+ RainMan.globals.shouldShowModals = true;
698
711
  }
699
712
  /**
700
713
  * Function for invoking free spin plate, invoked in mainContainer
@@ -732,6 +745,7 @@ export class AbstractController {
732
745
  this.invokeFreeSpinSummaryPlateAfterWin = false;
733
746
  }
734
747
  handleAutoplayLogic() {
748
+ RainMan.globals.shouldShowModals = false;
735
749
  this.autoSpinBalance += this.uiController.recentWin;
736
750
  const { balancedIncreased, balancedDecreased, singleWinExceeds } = RainMan.settingsStore;
737
751
  if (balancedIncreased > 0) {
@@ -782,7 +796,7 @@ export class AbstractController {
782
796
  async countBigWin(customAmount) {
783
797
  if (RainMan.config.disableBigWinOnBonus)
784
798
  return;
785
- if (this.uiController.recentWin <= RainMan.config.constants.bigWinMultiplier * RainMan.settingsStore.bet &&
799
+ if (this.uiController.recentWin < RainMan.config.constants.bigWinMultiplier * RainMan.settingsStore.bet &&
786
800
  !customAmount)
787
801
  return;
788
802
  const amount = customAmount || this.uiController.recentWin;
@@ -3,8 +3,6 @@ import { ButtonsEventManager } from "../application";
3
3
  * This controller is used to show the speed popup and handle quick stops
4
4
  * After 4 quick stops, the speed popup will be shown.
5
5
  * Number of quick spin can be adjusted in {@link MAX_QUICK_STOPS}
6
- *
7
- *
8
6
  */
9
7
  export declare class QuickStopController {
10
8
  private buttonsEventManager;
@@ -5,8 +5,6 @@ const MAX_QUICK_STOPS = 4;
5
5
  * This controller is used to show the speed popup and handle quick stops
6
6
  * After 4 quick stops, the speed popup will be shown.
7
7
  * Number of quick spin can be adjusted in {@link MAX_QUICK_STOPS}
8
- *
9
- *
10
8
  */
11
9
  export class QuickStopController {
12
10
  buttonsEventManager;
@@ -16,7 +14,7 @@ export class QuickStopController {
16
14
  speedPopupDisabled = false;
17
15
  constructor(buttonsEventManager) {
18
16
  this.buttonsEventManager = buttonsEventManager;
19
- RainMan.globals.disableSpeedPopup = this.handleSpeedPopupInvocation.bind(this);
17
+ RainMan.globals.disableSpeedPopup = this.setSpeedPopupDisabled.bind(this);
20
18
  }
21
19
  handleInvokingSpeedPopup() {
22
20
  if (!this.quickStopCounterLock &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixi-rainman-game-engine",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
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",