pixi-rainman-game-engine 0.1.9 → 0.1.11

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 (66) hide show
  1. package/dist/ComponentRegistry/types.d.ts +2 -2
  2. package/dist/ComponentRegistry/types.js +1 -1
  3. package/dist/DescribedPlayableAction/DescribedPlayableAction.d.ts +2 -1
  4. package/dist/DescribedPlayableAction/DescribedPlayableAction.js +3 -1
  5. package/dist/Rainman/Rainman.d.ts +2 -3
  6. package/dist/Rainman/Rainman.js +1 -3
  7. package/dist/Rainman/appConfig.js +3 -1
  8. package/dist/Rainman/types.d.ts +3 -1
  9. package/dist/SettingsUI/components/OptionButton/index.jsx +2 -0
  10. package/dist/application/ApiConfig/ApiConfig.js +3 -2
  11. package/dist/application/ButtonsEventManager/ButtonsEventManager.js +2 -2
  12. package/dist/application/SpinLogic/SpinLogic.d.ts +3 -1
  13. package/dist/application/SpinLogic/SpinLogic.js +5 -0
  14. package/dist/application/SpinLogic/SpinLogicDTO.d.ts +1 -0
  15. package/dist/application/SpinLogic/SpinLogicDTO.js +3 -0
  16. package/dist/application/SpinLogic/types.d.ts +2 -4
  17. package/dist/components/AbstractMainContainer/AbstractMainContainer.d.ts +9 -6
  18. package/dist/components/AbstractMainContainer/AbstractMainContainer.js +41 -4
  19. package/dist/components/GambleGame/GambleGame.js +6 -5
  20. package/dist/components/buttons/buttonGroups/LeftButtons.d.ts +1 -1
  21. package/dist/components/buttons/buttonGroups/LeftButtons.js +2 -2
  22. package/dist/components/common/AnimatedBackground.js +2 -0
  23. package/dist/components/common/AnimatedNumber.d.ts +12 -0
  24. package/dist/components/common/AnimatedNumber.js +44 -0
  25. package/dist/components/common/{FreeSpinBox.d.ts → FreeSpinButton.d.ts} +4 -4
  26. package/dist/components/common/{FreeSpinBox.js → FreeSpinButton.js} +5 -5
  27. package/dist/components/common/index.d.ts +2 -1
  28. package/dist/components/common/index.js +2 -1
  29. package/dist/components/dictionary/locales/en.json +3 -0
  30. package/dist/components/frame/AbstractColumnsContainer.d.ts +2 -1
  31. package/dist/components/frame/AbstractColumnsContainer.js +4 -6
  32. package/dist/components/frame/AbstractFrame.d.ts +1 -1
  33. package/dist/components/frame/AbstractFrame.js +1 -0
  34. package/dist/components/symbols/AbstractSymbolBase.d.ts +1 -1
  35. package/dist/components/symbols/AbstractSymbolBase.js +1 -1
  36. package/dist/components/symbols/AbstractSymbolsColumn.d.ts +2 -2
  37. package/dist/components/symbols/AbstractSymbolsColumn.js +1 -0
  38. package/dist/components/updatable/GambleUpdatableText.js +1 -1
  39. package/dist/components/updatable/UpdatableValueComponent.d.ts +1 -0
  40. package/dist/components/updatable/UpdatableValueComponent.js +3 -0
  41. package/dist/components/winLineIndicator/WinLineIndicator.js +1 -0
  42. package/dist/connectivity/ConnectionWrapper.d.ts +2 -2
  43. package/dist/connectivity/ConnectionWrapper.js +2 -1
  44. package/dist/connectivity/LocalConnectionWrapper.d.ts +1 -1
  45. package/dist/connectivity/apiQueue.d.ts +1 -1
  46. package/dist/connectivity/serverConnection.d.ts +4 -1
  47. package/dist/connectivity/serverData.d.ts +6 -4
  48. package/dist/connectivity/spinData.js +2 -2
  49. package/dist/connectivity/wins.d.ts +16 -1
  50. package/dist/constants/gamble.d.ts +2 -2
  51. package/dist/constants/gamble.js +3 -3
  52. package/dist/controllers/AbstractController.d.ts +14 -10
  53. package/dist/controllers/AbstractController.js +35 -15
  54. package/dist/controllers/UiController.js +1 -1
  55. package/dist/loading/AbstractLoadingContainer.d.ts +1 -1
  56. package/dist/loading/AbstractLoadingContainer.js +2 -1
  57. package/dist/stores/SettingsStore.d.ts +3 -1
  58. package/dist/stores/SettingsStore.js +18 -4
  59. package/dist/utils/assets/assetGetter.js +2 -7
  60. package/dist/utils/common/functions.d.ts +2 -0
  61. package/dist/utils/common/functions.js +3 -0
  62. package/dist/winComponents/UpdatableSpineContainer.d.ts +3 -3
  63. package/dist/winComponents/UpdatableSpineContainer.js +1 -1
  64. package/dist/winComponents/winFactory.d.ts +1 -1
  65. package/dist/winComponents/winFactory.js +3 -3
  66. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { AbstractColumnsContainer, AbstractFrame, AbstractInnerFrame, AutoplayButton, Background, BaseButton, BUTTONS, COMPONENTS, FreeSpinBox, InfoButton, MessageBox, MoreButton, NegButton, PlusButton, RefreshButton, SpeedControlButton, StylefulUpdatableText, UpdatableTextComponent, UpdatableValueComponent, VolumeButton } from "../components";
1
+ import { AbstractColumnsContainer, AbstractFrame, AbstractInnerFrame, AutoplayButton, Background, BaseButton, BUTTONS, COMPONENTS, FreeSpinButton, InfoButton, MessageBox, MoreButton, NegButton, PlusButton, RefreshButton, SpeedControlButton, StylefulUpdatableText, UpdatableTextComponent, UpdatableValueComponent, VolumeButton } from "../components";
2
2
  export interface RegistryMap {
3
3
  [MessageBox.autoSpinTextRegistryName]: UpdatableValueComponent;
4
4
  [MessageBox.currentWinTextRegistryName]: UpdatableTextComponent;
@@ -8,7 +8,7 @@ export interface RegistryMap {
8
8
  [Background.registryName]: Background;
9
9
  [VolumeButton.registryName]: VolumeButton;
10
10
  [AutoplayButton.registryName]: AutoplayButton;
11
- [FreeSpinBox.registryName]?: FreeSpinBox;
11
+ [FreeSpinButton.registryName]?: FreeSpinButton;
12
12
  [AbstractFrame.registryName]: AbstractFrame;
13
13
  [AbstractInnerFrame.registryName]: AbstractInnerFrame;
14
14
  [AbstractColumnsContainer.registryName]: AbstractColumnsContainer;
@@ -1 +1 @@
1
- import { AbstractColumnsContainer, AbstractFrame, AbstractInnerFrame, AutoplayButton, Background, BUTTONS, COMPONENTS, FreeSpinBox, InfoButton, MessageBox, MoreButton, NegButton, PlusButton, RefreshButton, SpeedControlButton, VolumeButton, } from "../components";
1
+ import { AbstractColumnsContainer, AbstractFrame, AbstractInnerFrame, AutoplayButton, Background, BUTTONS, COMPONENTS, FreeSpinButton, InfoButton, MessageBox, MoreButton, NegButton, PlusButton, RefreshButton, SpeedControlButton, VolumeButton, } from "../components";
@@ -3,6 +3,7 @@ export declare class DescribedPlayableAction<T> {
3
3
  readonly type: T;
4
4
  action: PlayableAction;
5
5
  winAmount: Nullable<number>;
6
+ skipLooping: boolean;
6
7
  isFirstStreak: boolean;
7
- constructor(type: T, action: PlayableAction, winAmount?: Nullable<number>);
8
+ constructor(type: T, action: PlayableAction, winAmount?: Nullable<number>, skipLooping?: boolean);
8
9
  }
@@ -2,10 +2,12 @@ export class DescribedPlayableAction {
2
2
  type;
3
3
  action;
4
4
  winAmount;
5
+ skipLooping;
5
6
  isFirstStreak = false;
6
- constructor(type, action, winAmount = null) {
7
+ constructor(type, action, winAmount = null, skipLooping = false) {
7
8
  this.type = type;
8
9
  this.action = action;
9
10
  this.winAmount = winAmount;
11
+ this.skipLooping = skipLooping;
10
12
  }
11
13
  }
@@ -1,6 +1,6 @@
1
1
  import "../components/dictionary/i18n";
2
2
  import { Application } from "pixi.js";
3
- import { SpinLogicFactory, SymbolIds, WinTypeIds } from "../application";
3
+ import { SymbolIds, WinTypeIds } from "../application";
4
4
  import { ComponentRegistry } from "../ComponentRegistry";
5
5
  import { SettingsStore } from "../stores";
6
6
  import { AppConfig, Globals, OptionalAppConfig, RequiredAppConfig } from "./types";
@@ -11,7 +11,6 @@ export declare class RainMan {
11
11
  static winTypeIds: WinTypeIds;
12
12
  static settingsStore: SettingsStore;
13
13
  static componentRegistry: ComponentRegistry;
14
- static spinLogicFactory: SpinLogicFactory;
15
14
  static globals: Globals;
16
- constructor(app: Application, config: AppConfig, symbolIds: SymbolIds, winTypeIds: WinTypeIds, spinLogicFactory: SpinLogicFactory);
15
+ constructor(app: Application, config: AppConfig, symbolIds: SymbolIds, winTypeIds: WinTypeIds);
17
16
  }
@@ -11,16 +11,14 @@ export class RainMan {
11
11
  static winTypeIds;
12
12
  static settingsStore;
13
13
  static componentRegistry;
14
- static spinLogicFactory;
15
14
  static globals;
16
- constructor(app, config, symbolIds, winTypeIds, spinLogicFactory) {
15
+ constructor(app, config, symbolIds, winTypeIds) {
17
16
  RainMan.app = app;
18
17
  RainMan.config = merge(defaultAppConfig, config);
19
18
  RainMan.symbolIds = symbolIds;
20
19
  RainMan.winTypeIds = winTypeIds;
21
20
  RainMan.settingsStore = settingStore;
22
21
  RainMan.componentRegistry = new ComponentRegistry(app);
23
- RainMan.spinLogicFactory = spinLogicFactory;
24
22
  RainMan.globals = {
25
23
  currency: Currencies["USD"],
26
24
  };
@@ -13,6 +13,7 @@ export const defaultAppConfig = {
13
13
  mobileFontSize: 45,
14
14
  updatableSpineContainerFontSize: 50,
15
15
  updatableTextValueColor: new Color(0xffffff).toHex(),
16
+ autoplayGlowColor: new Color(0xff3000).toNumber(),
16
17
  fontFace: ["HelveticaNeueLTStd"],
17
18
  winLineIndicatorSymbolScale: 0.75,
18
19
  durationOfActions: {
@@ -21,7 +22,7 @@ export const defaultAppConfig = {
21
22
  timeToSpeedUp: 200,
22
23
  timeToSlowDown: 10,
23
24
  symbolDropDownTime: 500,
24
- wiggleTweenDuration: 400,
25
+ wiggleTweenDuration: 1000,
25
26
  balloonFlyUpTime: 500,
26
27
  timeToSetResults: 10,
27
28
  bigWinDuration: 2000,
@@ -43,5 +44,6 @@ export const defaultAppConfig = {
43
44
  },
44
45
  constants: {
45
46
  bigWinMultiplier: 30,
47
+ bigWinTextOffset: 0,
46
48
  },
47
49
  };
@@ -8,7 +8,6 @@ export type RequiredAppConfig = {
8
8
  numberOfColumns: number;
9
9
  numberOfRows: number;
10
10
  fontColor: string;
11
- autoplayGlowColor: number;
12
11
  };
13
12
  export type OptionalAppConfig = {
14
13
  gameWidth: number;
@@ -21,6 +20,7 @@ export type OptionalAppConfig = {
21
20
  updatableTextValueColor: string;
22
21
  fontFace: string[];
23
22
  mobileFontFace?: string[];
23
+ autoplayGlowColor: number;
24
24
  winLineIndicatorSymbolScale: number;
25
25
  durationOfActions: {
26
26
  eachColumnsSpinDelay: number[];
@@ -50,9 +50,11 @@ export type OptionalAppConfig = {
50
50
  };
51
51
  constants: {
52
52
  bigWinMultiplier: number;
53
+ bigWinTextOffset: number;
53
54
  };
54
55
  };
55
56
  export type AppConfig = RequiredAppConfig & DeepPartial<OptionalAppConfig>;
56
57
  export interface Globals {
57
58
  currency: Currency;
59
+ throttledSpin?: () => void;
58
60
  }
@@ -1,6 +1,7 @@
1
1
  import i18next from "i18next";
2
2
  import { upperFirst } from "lodash";
3
3
  import React from "react";
4
+ import { RainMan } from "../../../Rainman";
4
5
  import { UI_ITEMS } from "../../../utils";
5
6
  import { useStores } from "../../hooks";
6
7
  import { closeModal } from "../CloseModalButton";
@@ -22,6 +23,7 @@ export const OptionButton = ({ option, currency, setMessage }) => {
22
23
  settingStore.setIsFreeSpinBought(true, data);
23
24
  settingStore.setRoundNumber(data.getRawData().round_number);
24
25
  settingStore.setFreeSpinNumberBought(option.amount);
26
+ RainMan.globals.throttledSpin?.();
25
27
  closeModal(UI_ITEMS.freeSpin);
26
28
  }
27
29
  catch (err) {
@@ -47,10 +47,11 @@ export class ApiConfig {
47
47
  return {
48
48
  action: spinLogicResponse.action,
49
49
  balance: spinLogicResponse.balance,
50
- availableFreeSpins: spinLogicResponse.available_free_spins,
50
+ availableFreeSpins: spinLogicResponse.available_free_spins || 0,
51
51
  symbolsOnReels: blindsConfiguredByResponse,
52
52
  finalBlindsConfiguration: finalSpinPositionOnReels,
53
53
  winAmountTotal: spinLogicResponse.win_amount_total,
54
+ extraData: spinLogicResponse.extra_data || {},
54
55
  };
55
56
  }
56
57
  /**
@@ -61,7 +62,7 @@ export class ApiConfig {
61
62
  * @param defaultNumber
62
63
  * @returns {string | number}
63
64
  */
64
- getWinLineNumber(winLineAnimationName, defaultNumber = "unknown") {
65
+ getWinLineNumber(winLineAnimationName, defaultNumber = "") {
65
66
  return this.streakMap.get(winLineAnimationName) ?? defaultNumber;
66
67
  }
67
68
  /**
@@ -1,6 +1,6 @@
1
1
  import i18n from "i18next";
2
2
  import { sample } from "lodash";
3
- import { AutoplayButton, Background, BUTTONS, COMPONENTS, FreeSpinBox, MessageBox, SpeedControlButton, VolumeButton, } from "../../components";
3
+ import { AutoplayButton, Background, BUTTONS, COMPONENTS, FreeSpinButton, MessageBox, SpeedControlButton, VolumeButton, } from "../../components";
4
4
  import { RainMan } from "../../Rainman";
5
5
  import { allUiItems, hideLayerIfPresent, UI_ITEMS } from "../../utils";
6
6
  import { SPEED_LEVELS } from "../SpeedState";
@@ -141,7 +141,7 @@ export class ButtonsEventManager {
141
141
  */
142
142
  initFreeSpinModal() {
143
143
  RainMan.componentRegistry
144
- .getIfExists(FreeSpinBox.registryName)
144
+ .getIfExists(FreeSpinButton.registryName)
145
145
  ?.setOnClick(() => this.handleModalInvocation(UI_ITEMS.freeSpin));
146
146
  }
147
147
  /**
@@ -1,4 +1,4 @@
1
- import { SymbolReels, TransformationDetails } from "../../connectivity";
1
+ import { ExtraData, SymbolReels, TransformationDetails } from "../../connectivity";
2
2
  import { ApiConfig } from "../ApiConfig";
3
3
  import { AdaptedSpinResponse } from "./types";
4
4
  import { WinScenarios } from "./WinScenarios";
@@ -18,6 +18,7 @@ export declare class SpinLogic {
18
18
  private readonly _hasMysteryWin;
19
19
  private readonly _winScenarios;
20
20
  private readonly _standaloneTransformations;
21
+ private readonly _extraData;
21
22
  constructor(spinConfig: AdaptedSpinResponse, gameConfig: ApiConfig);
22
23
  get postSpinBalance(): number;
23
24
  get winTotalAmount(): number;
@@ -28,4 +29,5 @@ export declare class SpinLogic {
28
29
  get hasMysteryWin(): boolean;
29
30
  get winScenarios(): WinScenarios[];
30
31
  get standaloneTransformations(): TransformationDetails[][];
32
+ get extraData(): ExtraData;
31
33
  }
@@ -17,6 +17,7 @@ export class SpinLogic {
17
17
  _hasMysteryWin;
18
18
  _winScenarios;
19
19
  _standaloneTransformations;
20
+ _extraData;
20
21
  constructor(spinConfig, gameConfig) {
21
22
  const spinLogicReader = new SpinLogicDTO(spinConfig, gameConfig);
22
23
  this._postSpinBalance = spinLogicReader.updatedBalance;
@@ -27,6 +28,7 @@ export class SpinLogic {
27
28
  this._hasMysteryWin = spinLogicReader.hasMysteryWin;
28
29
  this._winScenarios = spinLogicReader.winScenarios;
29
30
  this._standaloneTransformations = spinLogicReader.standaloneTransformations;
31
+ this._extraData = spinLogicReader.extraData;
30
32
  logInfo("Spin logic", JSON.parse(JSON.stringify(this)));
31
33
  }
32
34
  get postSpinBalance() {
@@ -57,4 +59,7 @@ export class SpinLogic {
57
59
  get standaloneTransformations() {
58
60
  return this._standaloneTransformations;
59
61
  }
62
+ get extraData() {
63
+ return this._extraData;
64
+ }
60
65
  }
@@ -11,6 +11,7 @@ export declare class SpinLogicDTO {
11
11
  get totalWonAmount(): number;
12
12
  get finalBlindsConfiguration(): SymbolReels;
13
13
  get onStopBlindsConfiguration(): SymbolReels;
14
+ get extraData(): import("../../connectivity").ExtraData;
14
15
  get winScenarios(): WinScenarios[];
15
16
  get standaloneTransformations(): TransformationDetails[][];
16
17
  get hasMysteryWin(): boolean;
@@ -38,6 +38,9 @@ export class SpinLogicDTO {
38
38
  get onStopBlindsConfiguration() {
39
39
  return this.rawData.symbolsOnReels.map((reel) => reel.map((symbol) => this.stringToSymbolId(symbol)));
40
40
  }
41
+ get extraData() {
42
+ return this.rawData.extraData;
43
+ }
41
44
  get winScenarios() {
42
45
  const { results, availableFreeSpins } = this.rawData;
43
46
  if (results === undefined)
@@ -1,6 +1,4 @@
1
- import { SpinDataInterface, SymbolReels, TransformationDetails, WinWithTransformation } from "../../connectivity";
2
- import { ApiConfig } from "../ApiConfig";
3
- import { SpinLogic } from "./SpinLogic";
1
+ import { ExtraData, SymbolReels, TransformationDetails, WinWithTransformation } from "../../connectivity";
4
2
  export type AdaptedSpinResponse = {
5
3
  action: string;
6
4
  balance: number;
@@ -10,5 +8,5 @@ export type AdaptedSpinResponse = {
10
8
  winAmountTotal: number;
11
9
  results: WinWithTransformation[];
12
10
  standaloneTransformations: TransformationDetails[][];
11
+ extraData: ExtraData;
13
12
  };
14
- export type SpinLogicFactory = (spinLogicResponse: SpinDataInterface, gameConfig: ApiConfig) => SpinLogic;
@@ -1,11 +1,12 @@
1
1
  import { Container, Graphics, Sprite } from "pixi.js";
2
2
  import { ButtonsEventManager } from "../../application";
3
3
  import { AbstractController } from "../../controllers";
4
+ import { RainMan } from "../../Rainman";
4
5
  import { Nullable } from "../../utils";
5
6
  import { UpdatableSpineContainer } from "../../winComponents";
6
7
  import { AbstractFreeSpinContainer } from "../AbstractFreeSpinContainer";
7
8
  import { LeftButtons, LeftButtonsLandscape, LeftButtonsMobile, MiddleButtons, RightButtons, RightButtonsLandscape, RightButtonsMobile } from "../buttons";
8
- import { FreeSpinBox, Logo, ResponsiveContainer } from "../common";
9
+ import { FreeSpinButton, Logo, ResponsiveContainer } from "../common";
9
10
  import { IResizableContainer } from "../common/IResizableContainer";
10
11
  import { AbstractFrame } from "../frame";
11
12
  import { MessageBox } from "../messageBox";
@@ -19,13 +20,15 @@ export declare abstract class AbstractMainContainer extends Container {
19
20
  protected logo: Nullable<Logo>;
20
21
  protected abstract background: IResizableContainer;
21
22
  protected animatedFront: Nullable<IResizableContainer>;
22
- protected freeSpinBox: Nullable<FreeSpinBox>;
23
+ protected freeSpinButton: Nullable<FreeSpinButton>;
23
24
  protected underFramePanel: Nullable<Graphics | Sprite>;
24
25
  protected portraitPlayButtons: Nullable<MiddleButtons>;
25
26
  protected landscapePlayButtons: Nullable<MiddleButtons>;
26
27
  protected abstract leftButtons: ResponsiveContainer;
27
28
  protected abstract rightButtons: ResponsiveContainer;
28
29
  protected bottomPanel: Nullable<Sprite>;
30
+ private gambleGame;
31
+ protected gambleGameSpineName: Nullable<string>;
29
32
  protected _freeSpinPlate: Nullable<AbstractFreeSpinContainer>;
30
33
  protected _freeSpinSummary: Nullable<AbstractFreeSpinContainer>;
31
34
  private _bigWinInvokedAt;
@@ -33,12 +36,12 @@ export declare abstract class AbstractMainContainer extends Container {
33
36
  protected abstract _frame: AbstractFrame;
34
37
  protected _controller: Nullable<AbstractController<unknown>>;
35
38
  protected constructor();
36
- protected abstract triggerStoreInitState(): void;
39
+ protected triggerStoreInitState(...containersWithSpines: typeof RainMan.settingsStore.containersWithSpines): void;
37
40
  get freeSpinPlate(): Nullable<AbstractFreeSpinContainer>;
38
41
  get freeSpinSummary(): Nullable<AbstractFreeSpinContainer>;
39
- protected abstract createFreeSpinPlate(resolver: () => void, freeSpinCount: number, isAdditionalFreeSpin: boolean): AbstractFreeSpinContainer;
42
+ protected createFreeSpinPlate(_resolver: () => void, _freeSpinCount: number, _isAdditionalFreeSpin: boolean): AbstractFreeSpinContainer | null;
40
43
  invokeFreeSpinPlate(freeSpinCount: number, isAdditionalFreeSpin?: boolean): Promise<void>;
41
- protected abstract createFreeSpinSummary(resolver: () => void, freeSpinCount: number, winAmount: number): AbstractFreeSpinContainer;
44
+ protected createFreeSpinSummary(_resolver: () => void, _freeSpinCount: number, _winAmount: number): AbstractFreeSpinContainer | null;
42
45
  invokeFreeSpinSummary(freeSpinCount: number, winAmount: number): Promise<void>;
43
46
  hideFreeSpinSummary(): void;
44
47
  private showOverlay;
@@ -51,7 +54,7 @@ export declare abstract class AbstractMainContainer extends Container {
51
54
  invokeMysteryWin(): void;
52
55
  destroyBigWin(): void;
53
56
  destroyMysteryWin(): void;
54
- invokeGambleGame(): void;
57
+ invokeGambleGame(): Promise<void>;
55
58
  protected createUnderFramePanel(): Graphics | Sprite;
56
59
  enableForMobile(): void;
57
60
  enableForLandscape(): void;
@@ -5,6 +5,7 @@ import { RainMan } from "../../Rainman";
5
5
  import { settingStore } from "../../SettingsUI/hooks";
6
6
  import { getDeviceOrientation, globalMinRatio } from "../../utils";
7
7
  import { BUTTONS, LeftButtons, LeftButtonsLandscape, LeftButtonsMobile, MiddleButtons, RefreshButton, RightButtons, RightButtonsLandscape, RightButtonsMobile, } from "../buttons";
8
+ import { GambleGame } from "../GambleGame";
8
9
  import { MessageBox } from "../messageBox";
9
10
  export class AbstractMainContainer extends Container {
10
11
  static registryName = "mainContainer";
@@ -15,11 +16,13 @@ export class AbstractMainContainer extends Container {
15
16
  buttonsEventManager;
16
17
  logo = null;
17
18
  animatedFront = null;
18
- freeSpinBox = null;
19
+ freeSpinButton = null;
19
20
  underFramePanel = null;
20
21
  portraitPlayButtons = null;
21
22
  landscapePlayButtons = null;
22
23
  bottomPanel = null;
24
+ gambleGame = null;
25
+ gambleGameSpineName = null;
23
26
  _freeSpinPlate = null;
24
27
  _freeSpinSummary = null;
25
28
  _bigWinInvokedAt = null;
@@ -34,17 +37,29 @@ export class AbstractMainContainer extends Container {
34
37
  SoundManager.play(SoundTracks.music);
35
38
  RainMan.app.renderer.on("resize", () => this.resize());
36
39
  }
40
+ triggerStoreInitState(...containersWithSpines) {
41
+ RainMan.settingsStore.containersWithSpines.push(...containersWithSpines);
42
+ RainMan.settingsStore.containersWithSpines.forEach((spine) => {
43
+ spine.setAnimationTimescale(RainMan.settingsStore.batterySaverFlag);
44
+ });
45
+ RainMan.settingsStore.refreshBatterySaver();
46
+ }
37
47
  get freeSpinPlate() {
38
48
  return this._freeSpinPlate;
39
49
  }
40
50
  get freeSpinSummary() {
41
51
  return this._freeSpinSummary;
42
52
  }
53
+ createFreeSpinPlate(_resolver, _freeSpinCount, _isAdditionalFreeSpin) {
54
+ return null;
55
+ }
43
56
  async invokeFreeSpinPlate(freeSpinCount, isAdditionalFreeSpin = false) {
44
57
  const refreshButton = RainMan.componentRegistry.get(RefreshButton.registryName);
45
58
  refreshButton.flipDisabledFlag(true);
46
59
  await new Promise(async (resolve) => {
47
60
  this._freeSpinPlate = this.createFreeSpinPlate(resolve, freeSpinCount, isAdditionalFreeSpin);
61
+ if (this._freeSpinPlate === null)
62
+ return resolve();
48
63
  this._freeSpinPlate.resize();
49
64
  this.showOverlay();
50
65
  this.addChild(this._freeSpinPlate);
@@ -57,11 +72,16 @@ export class AbstractMainContainer extends Container {
57
72
  this.hideOverlay();
58
73
  refreshButton.flipDisabledFlag(false);
59
74
  }
75
+ createFreeSpinSummary(_resolver, _freeSpinCount, _winAmount) {
76
+ return null;
77
+ }
60
78
  async invokeFreeSpinSummary(freeSpinCount, winAmount) {
61
79
  const refreshButton = RainMan.componentRegistry.get(BUTTONS.refresh);
62
80
  refreshButton.flipDisabledFlag(true);
63
81
  await new Promise((resolve) => {
64
82
  this._freeSpinSummary = this.createFreeSpinSummary(resolve, freeSpinCount, winAmount);
83
+ if (this._freeSpinSummary === null)
84
+ return resolve();
65
85
  this._freeSpinSummary.resize();
66
86
  this.showOverlay();
67
87
  this.addChild(this._freeSpinSummary);
@@ -152,7 +172,21 @@ export class AbstractMainContainer extends Container {
152
172
  this.mysteryWinContainer = null;
153
173
  this._mysteryWinInvokedAt = null;
154
174
  }
155
- invokeGambleGame() { }
175
+ async invokeGambleGame() {
176
+ if (!this.gambleGameSpineName)
177
+ return;
178
+ const newBalance = await new Promise((resolve) => {
179
+ this.gambleGame = new GambleGame(this.gambleGameSpineName, resolve, this._controller.lastWinAmount, this._controller.balance);
180
+ this.showOverlay();
181
+ this.addChild(this.gambleGame);
182
+ });
183
+ if (this.gambleGame) {
184
+ this.removeChild(this.gambleGame);
185
+ this.gambleGame = null;
186
+ }
187
+ this._controller.balance = newBalance;
188
+ this.hideOverlay();
189
+ }
156
190
  createUnderFramePanel() {
157
191
  const underFramePanel = new Graphics();
158
192
  underFramePanel.beginFill(0x0, 0.5);
@@ -203,8 +237,8 @@ export class AbstractMainContainer extends Container {
203
237
  }
204
238
  this.background.resize();
205
239
  this.animatedFront?.resize();
206
- if (this.freeSpinBox)
207
- this.freeSpinBox.resize();
240
+ if (this.freeSpinButton)
241
+ this.freeSpinButton.resize();
208
242
  this.addChild(this._frame);
209
243
  this._frame.resize();
210
244
  this.initComponentsForScreenRatio();
@@ -299,6 +333,9 @@ export class AbstractMainContainer extends Container {
299
333
  this.addChild(this.mysteryWinContainer);
300
334
  this.mysteryWinContainer.resize();
301
335
  }
336
+ if (this.gambleGame) {
337
+ this.gambleGame.resize();
338
+ }
302
339
  if (this.bottomPanel) {
303
340
  this.bottomPanel.scale.set(resizingHelper);
304
341
  this.bottomPanel.width = RainMan.app.screen.width;
@@ -39,25 +39,26 @@ export class GambleGame extends Container {
39
39
  this.resolver = resolver;
40
40
  this.bet = bet;
41
41
  this.balanceValue = balanceValue;
42
- this.interactive = true;
42
+ this.eventMode = "static";
43
43
  this.background = new Sprite(Texture.from("black-bg.png"));
44
44
  this.frame = new Sprite(Texture.from("frame-v2.png"));
45
- this.previousGamblesText = new Text(i18next.t("previousCards"), gamblesTextStyle);
45
+ this.previousGamblesText = new Text(i18next.t("previousCards"), gamblesTextStyle());
46
46
  this.previousGamblesContainer = new Container();
47
47
  this.collectButton = new CollectButton();
48
48
  this.redButton = new RedButton();
49
49
  this.blackButton = new BlackButton();
50
50
  this.collectButton.pivot.x = this.collectButton.width / 2;
51
- this.collectText = new Text(i18next.t("collect"), gamblesTextStyle);
51
+ this.collectText = new Text(i18next.t("collect"), gamblesTextStyle());
52
52
  this.collectText.pivot.x = this.collectText.width / 2;
53
53
  this.collectText.pivot.y = this.collectText.height / 2;
54
54
  this.card = new Spine(getSpineData(cardSpineName));
55
55
  this.card.state.addAnimation(0, "idle", true, 0);
56
56
  this.currentWin = new GambleUpdatableText(GambleGame.gambleCurrentWinRegistryName, i18next.t("currentWinGamble"), this.bet, 1);
57
- this.gambleWin = new GambleUpdatableText(GambleGame.gambleWinRegistryName, i18next.t("currentWinGamble"), this.bet * 2, 2);
57
+ this.gambleWin = new GambleUpdatableText(GambleGame.gambleWinRegistryName, i18next.t("gambleToWin"), this.bet * 2, 2);
58
58
  this.redButton.setOnClick(() => this.handleGamblePlay("red"));
59
59
  this.blackButton.setOnClick(() => this.handleGamblePlay("black"));
60
60
  this.collectButton.setOnClick(() => this.resolver(this.balanceValue));
61
+ this.resize();
61
62
  }
62
63
  showPreviousGambles(previousGambles) {
63
64
  const { width } = RainMan.app.screen;
@@ -138,8 +139,8 @@ export class GambleGame extends Container {
138
139
  this.collectButton.scale.set(globalMinRatio() * 0.8);
139
140
  this.collectButton.x = CENTER;
140
141
  this.collectButton.y = this.collectText.y - this.collectButton.height - 30;
141
- const COLOR_BUTTONS_Y = this.card.y - this.redButton.height / 2;
142
142
  this.redButton.scale.set(globalMinRatio() * COLOR_BUTTONS_SCALE_X);
143
+ const COLOR_BUTTONS_Y = this.card.y - this.redButton.height / 2;
143
144
  this.redButton.x = CENTER - COLOR_BUTTONS_CENTER_OFFSET - this.redButton.width;
144
145
  this.redButton.y = COLOR_BUTTONS_Y;
145
146
  this.blackButton.scale.set(globalMinRatio() * COLOR_BUTTONS_SCALE_X);
@@ -7,7 +7,7 @@ export declare class LeftButtons extends ResponsiveContainer {
7
7
  protected readonly infoButton: InfoButton;
8
8
  protected readonly credit: UpdatableTextComponent;
9
9
  protected readonly bet: UpdatableTextComponent;
10
- constructor();
10
+ constructor(scaleMultiplier?: number);
11
11
  removeChildrenFromRegistry(): void;
12
12
  protected reposition(): void;
13
13
  }
@@ -11,8 +11,8 @@ export class LeftButtons extends ResponsiveContainer {
11
11
  infoButton = new InfoButton();
12
12
  credit = new UpdatableTextComponent(COMPONENTS.creditText, i18next.t("credit"), UPDATABLE_MODES.money);
13
13
  bet = new UpdatableTextComponent(COMPONENTS.betText, i18next.t("bet"), UPDATABLE_MODES.money);
14
- constructor() {
15
- super();
14
+ constructor(scaleMultiplier) {
15
+ super(scaleMultiplier);
16
16
  this.name = REGISTRY.leftButtons;
17
17
  this.parentLayer = UXLayer;
18
18
  this.volumeButton.anchor.set(0, 0);
@@ -1,4 +1,5 @@
1
1
  import { Spine } from "pixi-spine";
2
+ import { BackgroundLayer } from "../../layers";
2
3
  import { RainMan } from "../../Rainman";
3
4
  import { getDeviceOrientation, getSpineData } from "../../utils";
4
5
  import { ResumableContainer } from "./ResumableContainers";
@@ -23,6 +24,7 @@ export class AnimatedBackground extends ResumableContainer {
23
24
  this.animationName = animationName;
24
25
  this.mobileSpineName = mobileSpineName;
25
26
  this.name = AnimatedBackground.registryName;
27
+ this.parentLayer = BackgroundLayer;
26
28
  }
27
29
  resize() {
28
30
  this.changeSpineForOrientation();
@@ -0,0 +1,12 @@
1
+ import { Container } from "pixi.js";
2
+ export declare class AnimatedNumber extends Container {
3
+ private spineName;
4
+ private number;
5
+ private digits;
6
+ constructor(spineName: string, number: number);
7
+ private setDigits;
8
+ private removeDigits;
9
+ get value(): number;
10
+ set value(value: number);
11
+ play(): void;
12
+ }
@@ -0,0 +1,44 @@
1
+ import { Container } from "pixi.js";
2
+ import { Spine } from "pixi-spine";
3
+ import { getSpineData } from "../../utils";
4
+ export class AnimatedNumber extends Container {
5
+ spineName;
6
+ number;
7
+ digits = [];
8
+ constructor(spineName, number) {
9
+ super();
10
+ this.spineName = spineName;
11
+ this.number = number;
12
+ this.setDigits();
13
+ }
14
+ setDigits() {
15
+ this.removeDigits();
16
+ Array.from(this.number.toString()).forEach((digit) => {
17
+ const digitSpine = new Spine(getSpineData(this.spineName));
18
+ digitSpine.state.setAnimation(0, digit, true);
19
+ digitSpine.x = (this.digits.at(-1)?.x || 0) + digitSpine.width;
20
+ if (digit === "." || digit === ",") {
21
+ digitSpine.x += 10;
22
+ digitSpine.y += 20;
23
+ }
24
+ digitSpine.state.timeScale = 0;
25
+ this.addChild(digitSpine);
26
+ this.digits.push(digitSpine);
27
+ });
28
+ this.pivot.set(this.width / 2, this.height / 2);
29
+ }
30
+ removeDigits() {
31
+ this.digits.forEach((digit) => this.removeChild(digit));
32
+ this.digits = [];
33
+ }
34
+ get value() {
35
+ return this.number;
36
+ }
37
+ set value(value) {
38
+ this.number = value;
39
+ this.setDigits();
40
+ }
41
+ play() {
42
+ this.digits.forEach((digit) => (digit.state.timeScale = 1));
43
+ }
44
+ }
@@ -3,15 +3,15 @@ import { ResumableContainer } from "./ResumableContainers";
3
3
  * This class represents button/box with ability to buy free games
4
4
  *
5
5
  * @export
6
- * @class FreeSpinBox
7
- * @typedef {FreeSpinBox}
6
+ * @class FreeSpinButton
7
+ * @typedef {FreeSpinButton}
8
8
  * @extends {ResumableContainer}
9
9
  */
10
- export declare class FreeSpinBox extends ResumableContainer {
10
+ export declare class FreeSpinButton extends ResumableContainer {
11
11
  private spineName;
12
12
  private animationName;
13
13
  private mobileSpineName;
14
- static readonly registryName = "freeSpinBox";
14
+ static readonly registryName = "freeSpinButton";
15
15
  private spine;
16
16
  private lastDeviceOrientation?;
17
17
  constructor(spineName: string, animationName: string, mobileSpineName?: string);
@@ -9,15 +9,15 @@ import { ResumableContainer } from "./ResumableContainers";
9
9
  * This class represents button/box with ability to buy free games
10
10
  *
11
11
  * @export
12
- * @class FreeSpinBox
13
- * @typedef {FreeSpinBox}
12
+ * @class FreeSpinButton
13
+ * @typedef {FreeSpinButton}
14
14
  * @extends {ResumableContainer}
15
15
  */
16
- export class FreeSpinBox extends ResumableContainer {
16
+ export class FreeSpinButton extends ResumableContainer {
17
17
  spineName;
18
18
  animationName;
19
19
  mobileSpineName;
20
- static registryName = "freeSpinBox";
20
+ static registryName = "freeSpinButton";
21
21
  spine;
22
22
  lastDeviceOrientation;
23
23
  constructor(spineName, animationName, mobileSpineName = spineName) {
@@ -25,7 +25,7 @@ export class FreeSpinBox extends ResumableContainer {
25
25
  this.spineName = spineName;
26
26
  this.animationName = animationName;
27
27
  this.mobileSpineName = mobileSpineName;
28
- this.name = FreeSpinBox.registryName;
28
+ this.name = FreeSpinButton.registryName;
29
29
  this.allSpines.push(this.spine);
30
30
  this.visible = true;
31
31
  this.parentLayer = UXLayer;
@@ -1,6 +1,7 @@
1
1
  export * from "./AnimatedBackground";
2
+ export * from "./AnimatedNumber";
2
3
  export * from "./Background";
3
- export * from "./FreeSpinBox";
4
+ export * from "./FreeSpinButton";
4
5
  export * from "./Logo";
5
6
  export * from "./LogoStatic";
6
7
  export * from "./ResponsiveComponent";
@@ -1,6 +1,7 @@
1
1
  export * from "./AnimatedBackground";
2
+ export * from "./AnimatedNumber";
2
3
  export * from "./Background";
3
- export * from "./FreeSpinBox";
4
+ export * from "./FreeSpinButton";
4
5
  export * from "./Logo";
5
6
  export * from "./LogoStatic";
6
7
  export * from "./ResponsiveComponent";