pixi-rainman-game-engine 0.3.43-b → 0.3.43

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.
@@ -1,5 +1,5 @@
1
1
  import { isIncentiveComponentInterface, isSpeedAdapterInterface, SpeedLevelHandler, TimedIncentiveController } from "../application";
2
- import { AbstractSymbolsColumn, SpeedControlButton, SpeedControlButtonMobile } from "../components";
2
+ import { AbstractSymbolsColumn, SpeedControlButton } from "../components";
3
3
  import { RainMan } from "../Rainman";
4
4
  import { openFullscreen } from "../utils";
5
5
  /**
@@ -60,8 +60,7 @@ export class ComponentRegistry {
60
60
  this.speedLevelHandler.nextSpeed();
61
61
  RainMan.settingsStore.setSpeedLevel(this.speedLevelHandler.currentSpeed);
62
62
  this.updateAllSpeedAdaptable(RainMan.settingsStore.currentSpeed);
63
- this.getIfExists(SpeedControlButton.registryName)?.forceTextureUpdate();
64
- this.getIfExists(SpeedControlButtonMobile.registryName)?.forceTextureUpdate();
63
+ this.get(SpeedControlButton.registryName).forceTextureUpdate();
65
64
  }
66
65
  /**
67
66
  * Getter for current speed level
@@ -1,4 +1,4 @@
1
- import { AbstractColumnsContainer, AbstractFrame, AbstractInnerFrame, AutoplayButton, Background, BUTTONS, COMPONENTS, FreeSpinButton, GambleButton, InfoButton, MessageBox, MoreButton, NegButton, PlusButton, RefreshButton, SpeedControlButton, SpeedControlButtonMobile, StylefulUpdatableText, TakeButton, UpdatableTextComponent, UpdatableValueComponent, VolumeButton } from "../components";
1
+ import { AbstractColumnsContainer, AbstractFrame, AbstractInnerFrame, AutoplayButton, Background, BUTTONS, COMPONENTS, FreeSpinButton, GambleButton, InfoButton, MessageBox, MoreButton, NegButton, PlusButton, RefreshButton, SpeedControlButton, StylefulUpdatableText, TakeButton, UpdatableTextComponent, UpdatableValueComponent, VolumeButton } from "../components";
2
2
  /**
3
3
  * RegistryMap is a map of all components that are registered in the ComponentRegistry.
4
4
  * It is used to type-check the components that are registered in the ComponentRegistry.
@@ -11,7 +11,6 @@ export interface RegistryMap {
11
11
  [MessageBox.gamePaysTextRegistryName]: UpdatableTextComponent;
12
12
  [MessageBox.registryName]: MessageBox;
13
13
  [SpeedControlButton.registryName]: SpeedControlButton;
14
- [SpeedControlButtonMobile.registryName]: SpeedControlButtonMobile;
15
14
  [Background.registryName]: Background;
16
15
  [VolumeButton.registryName]: VolumeButton;
17
16
  [AutoplayButton.registryName]: AutoplayButton;
@@ -1 +1 @@
1
- import { AbstractColumnsContainer, AbstractFrame, AbstractInnerFrame, AutoplayButton, Background, BUTTONS, COMPONENTS, FreeSpinButton, InfoButton, MessageBox, MoreButton, NegButton, PlusButton, RefreshButton, SpeedControlButton, SpeedControlButtonMobile, VolumeButton } from "../components";
1
+ import { AbstractColumnsContainer, AbstractFrame, AbstractInnerFrame, AutoplayButton, Background, BUTTONS, COMPONENTS, FreeSpinButton, InfoButton, MessageBox, MoreButton, NegButton, PlusButton, RefreshButton, SpeedControlButton, VolumeButton } from "../components";
@@ -6,7 +6,7 @@ import { RainMan } from "../../Rainman";
6
6
  import { Nullable, PromiseResolverType } from "../../utils";
7
7
  import { BigWinContainer, MysteryWinContainer, UpdatableSpineContainer } from "../../winComponents";
8
8
  import { AbstractFreeSpinContainer } from "../AbstractFreeSpinContainer";
9
- import { LeftButtons, LeftButtonsLandscape, LeftButtonsMobile, MiddleButtons, RightButtons, RightButtonsLandscape, RightButtonsMobile, SpeedControlButtonMobile } from "../buttons";
9
+ import { LeftButtons, LeftButtonsLandscape, LeftButtonsMobile, MiddleButtons, RightButtons, RightButtonsLandscape, RightButtonsMobile } from "../buttons";
10
10
  import { FreeSpinButton, Logo, ResponsiveContainer } from "../common";
11
11
  import { IResizableContainer } from "../common/IResizableContainer";
12
12
  import { AbstractFrame } from "../frame";
@@ -34,7 +34,6 @@ export declare abstract class AbstractMainContainer extends Container {
34
34
  static readonly registryName = "mainContainer";
35
35
  messageBox: MessageBox;
36
36
  protected bigWinContainer: Nullable<UpdatableSpineContainer> | BigWinContainer;
37
- protected readonly mobileSpeedButton: SpeedControlButtonMobile;
38
37
  protected mysteryWinContainer: Nullable<UpdatableSpineContainer> | MysteryWinContainer;
39
38
  protected bonusWinContainer: Nullable<UpdatableSpineContainer>;
40
39
  protected superBonusWinContainer: Nullable<UpdatableSpineContainer>;
@@ -76,7 +75,6 @@ export declare abstract class AbstractMainContainer extends Container {
76
75
  * @returns {Promise<void>} - A promise that resolves when the animation is complete.
77
76
  */
78
77
  invokeMysteryWinPlate(_animationName: string, _popupAnimation: string, _winType: WinTypeId, _amount: number, _isAdditionalFreeSpins: boolean): Promise<void>;
79
- protected attachMobileSpeedButton(parent: Container): void;
80
78
  /**
81
79
  * This function initializes the spines that should be paused when the battery saver is on
82
80
  * @protected
@@ -3,7 +3,7 @@ import { ButtonsEventManager, SoundManager, SoundTracks } from "../../applicatio
3
3
  import { AnimationLayer, BackgroundLayer, FrameLayer, UXLayer } from "../../layers";
4
4
  import { RainMan } from "../../Rainman";
5
5
  import { getDeviceOrientation, globalMinRatio } from "../../utils";
6
- import { BUTTONS, LeftButtons, LeftButtonsLandscape, LeftButtonsMobile, MiddleButtons, RefreshButton, RightButtons, RightButtonsLandscape, RightButtonsMobile, SpeedControlButtonMobile } from "../buttons";
6
+ import { BUTTONS, LeftButtons, LeftButtonsLandscape, LeftButtonsMobile, MiddleButtons, RefreshButton, RightButtons, RightButtonsLandscape, RightButtonsMobile } from "../buttons";
7
7
  import { GambleGame } from "../GambleGame";
8
8
  import { MessageBox } from "../messageBox";
9
9
  /**
@@ -29,7 +29,6 @@ export class AbstractMainContainer extends Container {
29
29
  static registryName = "mainContainer";
30
30
  messageBox;
31
31
  bigWinContainer = null;
32
- mobileSpeedButton = new SpeedControlButtonMobile();
33
32
  mysteryWinContainer = null;
34
33
  bonusWinContainer = null;
35
34
  superBonusWinContainer = null;
@@ -60,9 +59,6 @@ export class AbstractMainContainer extends Container {
60
59
  this.name = AbstractMainContainer.registryName;
61
60
  this.buttonsEventManager = new ButtonsEventManager();
62
61
  this.messageBox = new MessageBox();
63
- if (!RainMan.componentRegistry.has(SpeedControlButtonMobile.registryName)) {
64
- RainMan.componentRegistry.add(this.mobileSpeedButton);
65
- }
66
62
  SoundManager.setPlayStatus(SoundTracks.music, RainMan.settingsStore.shouldPlayAmbientMusic);
67
63
  RainMan.settingsStore.setHandleInvokeFreeSpinPlate(this.invokeFreeSpinPlate.bind(this));
68
64
  RainMan.settingsStore.setHandleBuyFreeSpinPopupActivatio(this.invokeBuyFreeSpinPlate.bind(this));
@@ -79,13 +75,6 @@ export class AbstractMainContainer extends Container {
79
75
  * @returns {Promise<void>} - A promise that resolves when the animation is complete.
80
76
  */
81
77
  async invokeMysteryWinPlate(_animationName, _popupAnimation, _winType, _amount, _isAdditionalFreeSpins) { }
82
- attachMobileSpeedButton(parent) {
83
- if (this.mobileSpeedButton.parent) {
84
- this.mobileSpeedButton.parent.removeChild(this.mobileSpeedButton);
85
- }
86
- parent.addChild(this.mobileSpeedButton);
87
- this.mobileSpeedButton.adaptToSpeed(RainMan.componentRegistry.getSpeedLevel());
88
- }
89
78
  /**
90
79
  * This function initializes the spines that should be paused when the battery saver is on
91
80
  * @protected
@@ -782,7 +771,7 @@ export class AbstractMainContainer extends Container {
782
771
  * @returns {RightButtonsMobile} - Returns a new instance of RightButtonsMobile for mobile portrait orientation.
783
772
  */
784
773
  createRightButtonsMobile() {
785
- return new RightButtonsMobile(this.mobileSpeedButton);
774
+ return new RightButtonsMobile();
786
775
  }
787
776
  /**
788
777
  * Function for creating the left buttons for landscape orientation
@@ -806,7 +795,7 @@ export class AbstractMainContainer extends Container {
806
795
  * @returns {MiddleButtons} - Returns a new instance of MiddleButtons for portrait orientation.
807
796
  */
808
797
  createPortraitPlayButtons() {
809
- return new MiddleButtons(false);
798
+ return new MiddleButtons();
810
799
  }
811
800
  /**
812
801
  * Function for creating the landscape play buttons
@@ -814,7 +803,7 @@ export class AbstractMainContainer extends Container {
814
803
  * @returns {MiddleButtons} - Returns a new instance of MiddleButtons for landscape orientation.
815
804
  */
816
805
  createLandscapePlayButtons() {
817
- return new MiddleButtons(true, this.mobileSpeedButton);
806
+ return new MiddleButtons(true);
818
807
  }
819
808
  /**
820
809
  * This method initializes the components for the current screen ratio.
@@ -1,6 +1,6 @@
1
1
  import { Graphics } from "pixi.js";
2
2
  import { ResponsiveContainer } from "../../common";
3
- import { AutoplayButton, GambleButton, PlusButton, RefreshButton, SpeedControlButtonMobile, TakeButton } from "../default";
3
+ import { AutoplayButton, GambleButton, PlusButton, RefreshButton, TakeButton } from "../default";
4
4
  /**
5
5
  * Class for managing middle buttons in game (MOBILE ONLY).
6
6
  * The class uses {@link AutoplayButton}, {@link PlusButton}, {@link RefreshButton}.
@@ -8,14 +8,13 @@ import { AutoplayButton, GambleButton, PlusButton, RefreshButton, SpeedControlBu
8
8
  */
9
9
  export declare class MiddleButtons extends ResponsiveContainer {
10
10
  private landscape;
11
- private readonly speedButtonMobile?;
12
11
  protected readonly autoplayButton: AutoplayButton;
13
12
  protected readonly betButton: PlusButton;
14
13
  protected readonly refreshButton: RefreshButton;
15
14
  protected readonly positioningFrame: Graphics;
16
15
  protected readonly gambleButton: GambleButton;
17
16
  protected readonly takeButton: TakeButton;
18
- constructor(landscape?: boolean, speedButtonMobile?: SpeedControlButtonMobile | undefined);
17
+ constructor(landscape?: boolean);
19
18
  /**
20
19
  * Function for removing children from the registry
21
20
  * @public
@@ -11,37 +11,26 @@ import { REGISTRY } from "../registrynames";
11
11
  */
12
12
  export class MiddleButtons extends ResponsiveContainer {
13
13
  landscape;
14
- speedButtonMobile;
15
14
  autoplayButton = new AutoplayButton(true);
16
15
  betButton = new PlusButton(true);
17
16
  refreshButton = new RefreshButton(true);
18
17
  positioningFrame = new Graphics();
19
18
  gambleButton = new GambleButton(true);
20
19
  takeButton = new TakeButton(true);
21
- constructor(landscape = false, speedButtonMobile) {
20
+ constructor(landscape = false) {
22
21
  super();
23
22
  this.landscape = landscape;
24
- this.speedButtonMobile = speedButtonMobile;
25
23
  this.name = REGISTRY.middleButtons;
26
24
  this.parentLayer = UXLayer;
27
25
  const buttons = [this.autoplayButton, this.betButton, this.refreshButton];
28
26
  this.addChild(...buttons);
29
27
  RainMan.componentRegistry.addMany(buttons);
30
- if (this.speedButtonMobile) {
31
- this.speedButtonMobile.visible = true;
32
- this.speedButtonMobile.scale.set(1);
33
- this.speedButtonMobile.adaptToSpeed(RainMan.componentRegistry.getSpeedLevel());
34
- this.addChild(this.speedButtonMobile);
35
- }
36
28
  this.addGambleAndTakeButtons();
37
29
  this.positioningFrame.beginFill(0x000000, 0);
38
30
  this.positioningFrame.drawRect(0, 0, 800, 250);
39
31
  this.addChild(this.positioningFrame);
40
32
  this.refreshButton.scale.set(0.75);
41
33
  this.autoplayButton.scale.set(0.75);
42
- if (this.speedButtonMobile) {
43
- this.speedButtonMobile.scale.set(1);
44
- }
45
34
  this.betButton.scale.set(0.75);
46
35
  this.takeButton.scale.set(0.75);
47
36
  this.gambleButton.scale.set(0.75);
@@ -74,6 +63,7 @@ export class MiddleButtons extends ResponsiveContainer {
74
63
  this.refreshButton,
75
64
  this.autoplayButton,
76
65
  this.betButton,
66
+ this.positioningFrame,
77
67
  ...(this.gambleButton && RainMan.config.gambleGameEnabled ? [this.gambleButton] : []),
78
68
  ...(this.takeButton ? [this.takeButton] : [])
79
69
  ]);
@@ -102,19 +92,15 @@ export class MiddleButtons extends ResponsiveContainer {
102
92
  const { width, height } = this.positioningFrame;
103
93
  this.refreshButton.x = width / 2;
104
94
  this.refreshButton.y = height / 2;
105
- if (this.speedButtonMobile) {
106
- this.speedButtonMobile.x = width / 2;
107
- this.speedButtonMobile.y = 150;
108
- }
109
95
  if (this.landscape) {
110
96
  this.betButton.x = width / 2;
111
- this.betButton.y = -20;
97
+ this.betButton.y = 0;
112
98
  this.autoplayButton.x = width / 2;
113
- this.autoplayButton.y = height + 30;
99
+ this.autoplayButton.y = height;
114
100
  }
115
101
  else {
116
102
  this.autoplayButton.x = -width;
117
- this.autoplayButton.y = 50;
103
+ this.autoplayButton.y = 0;
118
104
  this.betButton.x = width;
119
105
  this.betButton.y = height;
120
106
  }
@@ -1,17 +1,17 @@
1
1
  import { ITextStyle } from "pixi.js";
2
2
  import { ResponsiveContainer } from "../../common";
3
3
  import { UpdatableTextComponent } from "../../updatable";
4
- import { InfoButton, NegButton, SpeedControlButtonMobile } from "../default";
4
+ import { InfoButton, NegButton, SpeedControlButton } from "../default";
5
5
  /**
6
6
  * Buttons for mobile version. It has a current bet and game information button.
7
7
  * @augments {ResponsiveContainer}
8
8
  */
9
9
  export declare class RightButtonsMobile extends ResponsiveContainer {
10
- private readonly speedButtonMobile;
11
10
  protected readonly infoButton: InfoButton;
12
11
  protected readonly negButton: NegButton;
12
+ protected readonly speedControlButton: SpeedControlButton;
13
13
  protected bet: UpdatableTextComponent;
14
- constructor(speedButtonMobile: SpeedControlButtonMobile);
14
+ constructor();
15
15
  /**
16
16
  * Function for removing children from the registry.
17
17
  * @public
@@ -3,7 +3,7 @@ import { UXLayer } from "../../../layers";
3
3
  import { RainMan } from "../../../Rainman";
4
4
  import { ResponsiveContainer } from "../../common";
5
5
  import { UPDATABLE_MODES, UpdatableTextComponent } from "../../updatable";
6
- import { InfoButton, NegButton } from "../default";
6
+ import { InfoButton, NegButton, SpeedControlButton } from "../default";
7
7
  import { COMPONENTS, REGISTRY } from "../registrynames";
8
8
  import { MOBILE_BUTTONS_GAP, MOBILE_PANEL_BUTTON_SCALE, MOBILE_X_OFFSET, MOBILE_Y_BOTTOM_OFFSET } from "./constants";
9
9
  /**
@@ -11,25 +11,22 @@ import { MOBILE_BUTTONS_GAP, MOBILE_PANEL_BUTTON_SCALE, MOBILE_X_OFFSET, MOBILE_
11
11
  * @augments {ResponsiveContainer}
12
12
  */
13
13
  export class RightButtonsMobile extends ResponsiveContainer {
14
- speedButtonMobile;
15
14
  infoButton = new InfoButton(true);
16
15
  negButton = new NegButton();
16
+ speedControlButton = new SpeedControlButton();
17
17
  bet = new UpdatableTextComponent(COMPONENTS.betText, i18next.t("bet"), UPDATABLE_MODES.money, RainMan.config.mobileFontSize);
18
- constructor(speedButtonMobile) {
18
+ constructor() {
19
19
  super(-1);
20
- this.speedButtonMobile = speedButtonMobile;
21
20
  this.name = REGISTRY.rightButtons;
22
21
  this.parentLayer = UXLayer;
23
22
  this.negButton.visible = false;
23
+ this.speedControlButton.visible = false;
24
24
  this.infoButton.anchor.set(1, 0.5);
25
25
  this.infoButton.scale.set(-MOBILE_PANEL_BUTTON_SCALE);
26
26
  this.bet.pivot.set(this.bet.width, this.bet.height / 2);
27
27
  this.bet.scale.set(-1);
28
- this.speedButtonMobile.scale.set(-1);
29
- this.speedButtonMobile.x = 100;
30
- this.speedButtonMobile.y = 200;
31
- this.addChild(this.infoButton, this.bet, this.speedButtonMobile);
32
- RainMan.componentRegistry.addMany([this.infoButton, this.bet, this.negButton]);
28
+ this.addChild(this.infoButton, this.bet);
29
+ RainMan.componentRegistry.addMany([this.infoButton, this.bet, this.negButton, this.speedControlButton]);
33
30
  this.resize();
34
31
  }
35
32
  /**
@@ -38,7 +35,7 @@ export class RightButtonsMobile extends ResponsiveContainer {
38
35
  * @returns {void}
39
36
  */
40
37
  removeChildrenFromRegistry() {
41
- RainMan.componentRegistry.removeMany([this.infoButton, this.bet, this.negButton]);
38
+ RainMan.componentRegistry.removeMany([this.infoButton, this.bet, this.negButton, this.speedControlButton]);
42
39
  }
43
40
  /**
44
41
  * Function for repositioning components on mobile screens.
@@ -9,7 +9,6 @@ export * from "./PlusButton";
9
9
  export * from "./RedButton";
10
10
  export * from "./RefreshButton";
11
11
  export * from "./SpeedControlButton";
12
- export * from "./SpeedControlButtonMobile";
13
12
  export * from "./SpinConfirmationButton";
14
13
  export * from "./TakeButton";
15
14
  export * from "./VolumeButton";
@@ -9,7 +9,6 @@ export * from "./PlusButton";
9
9
  export * from "./RedButton";
10
10
  export * from "./RefreshButton";
11
11
  export * from "./SpeedControlButton";
12
- export * from "./SpeedControlButtonMobile";
13
12
  export * from "./SpinConfirmationButton";
14
13
  export * from "./TakeButton";
15
14
  export * from "./VolumeButton";
@@ -1,7 +1,7 @@
1
1
  import i18next from "i18next";
2
2
  import { sample } from "lodash";
3
3
  import { ApiConfig, SoundManager, SoundTracks, SPEED_LEVELS } from "../application";
4
- import { AbstractFrame, AutoplayButton, BUTTONS, COMPONENTS, FreeSpinButton, MessageBox, RefreshButton, SpeedControlButton, SpeedControlButtonMobile } from "../components";
4
+ import { AbstractFrame, AutoplayButton, BUTTONS, COMPONENTS, FreeSpinButton, MessageBox, RefreshButton, SpeedControlButton } from "../components";
5
5
  import { SpinData } from "../connectivity";
6
6
  import { gamePhases, PossibleWins } from "../constants";
7
7
  import { RainMan } from "../Rainman";
@@ -256,10 +256,7 @@ export class AbstractController {
256
256
  * @returns {void}
257
257
  */
258
258
  disableSpeedButton(shouldBeDisabled) {
259
- RainMan.componentRegistry.getIfExists(SpeedControlButton.registryName)?.flipDisabledFlag(shouldBeDisabled);
260
- RainMan.componentRegistry
261
- .getIfExists(SpeedControlButtonMobile.registryName)
262
- ?.flipDisabledFlag(shouldBeDisabled);
259
+ RainMan.componentRegistry.get(SpeedControlButton.registryName).flipDisabledFlag(shouldBeDisabled);
263
260
  }
264
261
  /**
265
262
  * Function for disabling information buttons
@@ -292,11 +289,14 @@ export class AbstractController {
292
289
  */
293
290
  handleDisablingButtons(disabled) {
294
291
  this.disableBetButtons(disabled ?? this.shouldBetButtonsBeDisabled);
295
- const shouldSpeedBeDisabled = !RainMan.settingsStore.isFreeSpinsPlayEnabled &&
296
- !RainMan.globals.isSuperBonusGameEnabled &&
297
- !RainMan.settingsStore.isAutoplayEnabled &&
298
- this.shouldButtonsBeDisabled;
299
- this.disableSpeedButton(shouldSpeedBeDisabled);
292
+ if (RainMan.settingsStore.isFreeSpinsPlayEnabled ||
293
+ RainMan.globals.isSuperBonusGameEnabled ||
294
+ RainMan.settingsStore.isAutoplayEnabled) {
295
+ this.disableSpeedButton(false);
296
+ }
297
+ else {
298
+ this.disableSpeedButton(disabled ?? this.shouldButtonsBeDisabled);
299
+ }
300
300
  }
301
301
  /**
302
302
  * Function for initializing buttons
@@ -339,12 +339,10 @@ export class AbstractController {
339
339
  this.gamePhase === gamePhases.SPINNING ||
340
340
  this.gamePhase === gamePhases.GAME_SUMMARY);
341
341
  }
342
- RainMan.componentRegistry.getIfExists(SpeedControlButton.registryName)?.setOnClick(() => {
342
+ RainMan.componentRegistry.get(SpeedControlButton.registryName).setOnClick(() => {
343
343
  RainMan.settingsStore.closeCurrentlyOpenModal?.();
344
344
  RainMan.componentRegistry.nextSpeedLevel();
345
- const speedLevel = RainMan.componentRegistry.getSpeedLevel();
346
- this.uiController.updateShownSpeedLevel(speedLevel);
347
- this.uiController.messageBox.updateIncentiveText(sample(i18next.t("idleMessages", { returnObjects: true })[speedLevel]));
345
+ this.uiController.messageBox.updateIncentiveText(sample(i18next.t("idleMessages", { returnObjects: true })[RainMan.componentRegistry.getSpeedLevel()]));
348
346
  });
349
347
  }
350
348
  /**
@@ -367,13 +365,6 @@ export class AbstractController {
367
365
  }
368
366
  RainMan.settingsStore.handleModalInvocation?.(UI_ITEMS.bet);
369
367
  });
370
- if (RainMan.componentRegistry.has(SpeedControlButtonMobile.registryName)) {
371
- RainMan.componentRegistry.get(SpeedControlButtonMobile.registryName).setOnClick(() => {
372
- RainMan.settingsStore.closeCurrentlyOpenModal?.();
373
- RainMan.componentRegistry.nextSpeedLevel();
374
- this.uiController.messageBox.updateIncentiveText(sample(i18next.t("idleMessages", { returnObjects: true })[RainMan.componentRegistry.getSpeedLevel()]));
375
- });
376
- }
377
368
  return;
378
369
  }
379
370
  RainMan.componentRegistry.get(BUTTONS.plus).setOnClick(() => {
@@ -149,6 +149,7 @@ export declare class UiController {
149
149
  updateShownPossibleWin(): void;
150
150
  /**
151
151
  * Shows game pays in a bottom panel, if exists
152
+ * @param amount
152
153
  * @public
153
154
  * @returns {void}
154
155
  */
@@ -1,5 +1,5 @@
1
1
  import { round } from "lodash";
2
- import { COMPONENTS, MessageBox, SpeedControlButton, SpeedControlButtonMobile } from "../components";
2
+ import { COMPONENTS, MessageBox, SpeedControlButton } from "../components";
3
3
  import { RainMan } from "../Rainman";
4
4
  import { ceilToDecimal } from "../utils";
5
5
  /**
@@ -181,12 +181,8 @@ export class UiController {
181
181
  * @returns {void}
182
182
  */
183
183
  updateShownSpeedLevel(currentSpeed) {
184
- const speedButton = RainMan.componentRegistry.getIfExists(SpeedControlButton.registryName);
185
- const mobileSpeedButton = RainMan.componentRegistry.getIfExists(SpeedControlButtonMobile.registryName);
186
- speedButton?.adaptToSpeed(currentSpeed);
187
- speedButton?.forceTextureUpdate();
188
- mobileSpeedButton?.adaptToSpeed(currentSpeed);
189
- mobileSpeedButton?.forceTextureUpdate();
184
+ RainMan.componentRegistry.get(SpeedControlButton.registryName).adaptToSpeed(currentSpeed);
185
+ RainMan.componentRegistry.get(SpeedControlButton.registryName).forceTextureUpdate();
190
186
  }
191
187
  /**
192
188
  * Function for updating shown balance
@@ -220,6 +216,7 @@ export class UiController {
220
216
  }
221
217
  /**
222
218
  * Shows game pays in a bottom panel, if exists
219
+ * @param amount
223
220
  * @public
224
221
  * @returns {void}
225
222
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixi-rainman-game-engine",
3
- "version": "0.3.43b",
3
+ "version": "0.3.43",
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,22 +0,0 @@
1
- import { SpeedAdapterInterface, SpeedLevel, SpeedLevelDirectory } from "../../../application";
2
- import { BaseButton, TextureMap } from "../BaseButton";
3
- /**
4
- * Button for speed control {@link SpeedLevel}
5
- * It needs following textures:
6
- * - turtle - `speed-turtle.png`
7
- * - rabbit - `speed-rabbit.png`
8
- * - cheetah - `speed-cheetah.png`
9
- * @class
10
- */
11
- export declare class SpeedControlButtonMobile extends BaseButton implements SpeedAdapterInterface<TextureMap> {
12
- static readonly registryName = "speedControlButtonMobile";
13
- readonly speedLevelMapper: SpeedLevelDirectory<TextureMap>;
14
- constructor();
15
- /**
16
- * Change button's texture according to speed level
17
- * @public
18
- * @param {SpeedLevel} speedLevel - new speed level
19
- * @returns {void}
20
- */
21
- adaptToSpeed(speedLevel: SpeedLevel): void;
22
- }
@@ -1,51 +0,0 @@
1
- import { RainMan } from "../../../Rainman";
2
- import { getTexture } from "../../../utils";
3
- import { BaseButton, ButtonStates } from "../BaseButton";
4
- const createTextureMap = (speedLevel) => {
5
- return {
6
- [ButtonStates.NORMAL]: getTexture(`${speedLevel}.png`),
7
- [ButtonStates.CLICKED]: getTexture(`${speedLevel}-c.png`)
8
- };
9
- };
10
- const createTextureMapForSpeed = (speedLevel) => {
11
- const speedLevelMapper = {
12
- slow: createTextureMap("turtle"),
13
- normal: createTextureMap("rabbit"),
14
- fast: createTextureMap("cheetah")
15
- };
16
- return speedLevelMapper[speedLevel];
17
- };
18
- /**
19
- * Button for speed control {@link SpeedLevel}
20
- * It needs following textures:
21
- * - turtle - `speed-turtle.png`
22
- * - rabbit - `speed-rabbit.png`
23
- * - cheetah - `speed-cheetah.png`
24
- * @class
25
- */
26
- export class SpeedControlButtonMobile extends BaseButton {
27
- static registryName = "speedControlButtonMobile";
28
- speedLevelMapper;
29
- constructor() {
30
- super(SpeedControlButtonMobile.registryName, createTextureMapForSpeed(RainMan.settingsStore.currentSpeed));
31
- this.speedLevelMapper = {
32
- slow: createTextureMap("turtle"),
33
- normal: createTextureMap("rabbit"),
34
- fast: createTextureMap("cheetah")
35
- };
36
- }
37
- /**
38
- * Change button's texture according to speed level
39
- * @public
40
- * @param {SpeedLevel} speedLevel - new speed level
41
- * @returns {void}
42
- */
43
- adaptToSpeed(speedLevel) {
44
- if (RainMan.settingsStore.isTemporarySpeed) {
45
- return;
46
- }
47
- const textureMap = this.speedLevelMapper[speedLevel];
48
- this.setTextureMap(textureMap);
49
- this.texture = textureMap[ButtonStates.NORMAL];
50
- }
51
- }