pixi-rainman-game-engine 0.2.20 → 0.2.21-b

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.
@@ -232,6 +232,9 @@ export class ButtonsEventManager {
232
232
  */
233
233
  initAutoplayButtonEvent() {
234
234
  RainMan.componentRegistry.get(AutoplayButton.registryName).setOnClick(() => {
235
+ if (!RainMan.settingsStore.isModalsAvailable() || RainMan.settingsStore.isPlayingAnyAction) {
236
+ return;
237
+ }
235
238
  if (RainMan.settingsStore.isAutoplayEnabled) {
236
239
  RainMan.settingsStore.resetAutoplaySettings();
237
240
  RainMan.componentRegistry.get(MessageBox.registryName).hideAutoSpinText();
@@ -240,9 +243,6 @@ export class ButtonsEventManager {
240
243
  RainMan.componentRegistry.get(BUTTONS.neg).flipDisabledFlag(false);
241
244
  return;
242
245
  }
243
- if (!RainMan.settingsStore.isModalsAvailable()) {
244
- return;
245
- }
246
246
  this.handleModalInvocation(UI_ITEMS.autoplay);
247
247
  });
248
248
  }
@@ -282,6 +282,8 @@ export class ButtonsEventManager {
282
282
  const confirmAutoplayButton = window.document.getElementById(COMPONENTS.autoSpinConfirm);
283
283
  if (confirmAutoplayButton !== null) {
284
284
  confirmAutoplayButton.addEventListener("click", () => {
285
+ if (RainMan.settingsStore.isPlayingAnyAction)
286
+ return;
285
287
  RainMan.settingsStore.handleModalInvocation?.(UI_ITEMS.autoplay);
286
288
  confirmAutoplayButtonCallback();
287
289
  wait(1).then(() => RainMan.settingsStore.decreaseAutoSpinsCount());
@@ -1,6 +1,6 @@
1
1
  import { Container, Sprite } from "pixi.js";
2
2
  import { Spine } from "pixi-spine";
3
- import { SymbolId } from "../../application";
3
+ import { SpeedAdapterInterface, SpeedLevel, SymbolId } from "../../application";
4
4
  import { LoadersSpineData, Nullable } from "../../utils";
5
5
  /**
6
6
  * Class represents symbol which is displayed in columns
@@ -9,10 +9,11 @@ import { LoadersSpineData, Nullable } from "../../utils";
9
9
  * @typedef {AbstractSymbolBase}
10
10
  * @augments {Container}
11
11
  */
12
- export declare abstract class AbstractSymbolBase extends Container {
12
+ export declare abstract class AbstractSymbolBase extends Container implements SpeedAdapterInterface<number> {
13
13
  private multiplierSpineName;
14
14
  symbolImage: Sprite;
15
15
  spine: Spine;
16
+ speedLevelMapper: import("../../application").SpeedLevelDirectory<number>;
16
17
  protected destroySuffix: string;
17
18
  protected animationSpeedMultiplier: number;
18
19
  private endOfMultiplierAnimationPromise;
@@ -22,6 +23,7 @@ export declare abstract class AbstractSymbolBase extends Container {
22
23
  protected abstract paytableIgnoredSymbols: SymbolId[];
23
24
  private _id;
24
25
  protected constructor(parent: Container, symbolId: SymbolId, multiplierSpineName?: Nullable<string>);
26
+ adaptToSpeed(speedLevel: SpeedLevel): void;
25
27
  get id(): SymbolId;
26
28
  setInteractiveFlag(flag: boolean): void;
27
29
  updateTimeScaleOfSpine(scale?: number): void;
@@ -15,6 +15,7 @@ export class AbstractSymbolBase extends Container {
15
15
  multiplierSpineName;
16
16
  symbolImage;
17
17
  spine;
18
+ speedLevelMapper = animationsSpeedLevels;
18
19
  destroySuffix = "destroy";
19
20
  animationSpeedMultiplier = defaultSpeedConfig.animationDefaultSpeedScale;
20
21
  endOfMultiplierAnimationPromise;
@@ -39,6 +40,9 @@ export class AbstractSymbolBase extends Container {
39
40
  this.hitArea = new Rectangle(-symbolRadius, -symbolRadius, 2 * symbolRadius, 2 * symbolRadius);
40
41
  this.setupClickListener();
41
42
  }
43
+ adaptToSpeed(speedLevel) {
44
+ this.updateTimeScaleOfSpine(this.speedLevelMapper[speedLevel]);
45
+ }
42
46
  get id() {
43
47
  return this._id;
44
48
  }
@@ -79,9 +83,7 @@ export class AbstractSymbolBase extends Container {
79
83
  this.spine.scale.set(spineScale);
80
84
  this.addChild(this.spine);
81
85
  this.spine.state.addListener({
82
- complete: () => {
83
- resolve();
84
- },
86
+ complete: () => resolve()
85
87
  });
86
88
  });
87
89
  };
@@ -122,7 +124,7 @@ export class AbstractSymbolBase extends Container {
122
124
  symbolMultiplier.state.setAnimation(0, `x${multiplier}`, false);
123
125
  this.endOfMultiplierAnimationPromise = resolve;
124
126
  symbolMultiplier.state.addListener({
125
- complete: () => resolve(),
127
+ complete: () => resolve()
126
128
  });
127
129
  });
128
130
  this.removeChild(symbolMultiplier);
@@ -136,7 +138,7 @@ export class AbstractSymbolBase extends Container {
136
138
  this.spine.state.timeScale = this.animationSpeedMultiplier;
137
139
  this.spine.state.setAnimation(0, animationName, false);
138
140
  this.spine.state.addListener({
139
- complete: () => resolve(),
141
+ complete: () => resolve()
140
142
  });
141
143
  });
142
144
  }
@@ -157,7 +159,7 @@ export class AbstractSymbolBase extends Container {
157
159
  this.spine.state.timeScale = this.animationSpeedMultiplier;
158
160
  this.spine.state.setAnimation(0, animationName, false);
159
161
  this.spine.state.addListener({
160
- complete: () => resolve(),
162
+ complete: () => resolve()
161
163
  });
162
164
  });
163
165
  }
@@ -163,6 +163,10 @@ export declare abstract class AbstractController<T> {
163
163
  * @param {SpinLogic} _spinLogic spin logic
164
164
  */
165
165
  protected onSpinningEnd(_spinLogic: SpinLogic): Promise<void>;
166
+ /**
167
+ * Function to perform actions after all actions are performed
168
+ */
169
+ protected performActionsAfterAllActions(): Promise<void>;
166
170
  /**
167
171
  * Function to perform additional actions after spin
168
172
  */
@@ -577,6 +577,10 @@ export class AbstractController {
577
577
  * @param {SpinLogic} _spinLogic spin logic
578
578
  */
579
579
  async onSpinningEnd(_spinLogic) { }
580
+ /**
581
+ * Function to perform actions after all actions are performed
582
+ */
583
+ async performActionsAfterAllActions() { }
580
584
  /**
581
585
  * Function to perform additional actions after spin
582
586
  */
@@ -685,6 +689,7 @@ export class AbstractController {
685
689
  this.composeWinActionsQueue(spinLogic);
686
690
  if (spinLogic.winTotalAmount === 0 && this.invokeFreeSpinPlateAfterWin)
687
691
  this.uiController.messageBox.hideCurrentWinText();
692
+ RainMan.settingsStore.setIsPlayingAnyAction(true);
688
693
  await this.playWinActionQueue();
689
694
  await this.countBigWin();
690
695
  await this.handleLoopingWinActionQueue();
@@ -728,6 +733,7 @@ export class AbstractController {
728
733
  hideLayerIfPresent();
729
734
  await this.handleFreeSpinSummaryPlateInvocation();
730
735
  }
736
+ await this.performActionsAfterSpin();
731
737
  if (RainMan.settingsStore.isAutoplayEnabled) {
732
738
  this.handleAutoplayLogic();
733
739
  }
@@ -736,9 +742,10 @@ export class AbstractController {
736
742
  if (RainMan.settingsStore.isFreeSpinsPlayEnabled) {
737
743
  this.disableAutoplayButton(false);
738
744
  }
745
+ await this.performActionsAfterAllActions();
739
746
  RainMan.settingsStore.setModalsAvailability(true);
740
- await this.performActionsAfterSpin();
741
747
  RainMan.globals.shouldShowModals = true;
748
+ RainMan.settingsStore.setIsPlayingAnyAction(false);
742
749
  }
743
750
  /**
744
751
  * Function for invoking free spin plate, invoked in mainContainer
@@ -832,7 +839,7 @@ export class AbstractController {
832
839
  return;
833
840
  const amount = customAmount || this.uiController.recentWin;
834
841
  this.mainContainer.invokeBigWin();
835
- const animationTimeDivider = RainMan.settingsStore.currentSpeed === SPEED_LEVELS.fast ? 3 : 1;
842
+ const animationTimeDivider = RainMan.settingsStore.currentSpeed === SPEED_LEVELS.fast ? 2 : 1;
836
843
  await RainMan.componentRegistry
837
844
  .get(COMPONENTS.bigWin)
838
845
  .update(amount, RainMan.config.durationOfActions.updatableTextCountingDuration / animationTimeDivider);
@@ -41,6 +41,7 @@ export declare class SettingsStore {
41
41
  popupPaytablePosition?: Point;
42
42
  popupPaytableData?: PaytableData[];
43
43
  currentSpeed: SpeedLevel;
44
+ isPlayingAnyAction: boolean;
44
45
  setSpeedPopupVisibility?: (visibility: "flex" | "none") => void;
45
46
  popupPaytableRepositionCallback?: () => void;
46
47
  updateVolumeButtonTexture?: () => void;
@@ -97,6 +98,7 @@ export declare class SettingsStore {
97
98
  resetDataForSymbolPaytablePopup(): void;
98
99
  setUpdateVolumeButtonTexture(fn: () => void): void;
99
100
  repositionSymbolPaytablePopup(x: number, y: number): void;
101
+ setIsPlayingAnyAction(flag: boolean): void;
100
102
  /**
101
103
  * Initialize paytable map for all symbols. based on backend data {@link InitDataInterface.paytable}
102
104
  * @param {InitDataInterface} initConfigData - initial data from backend
@@ -47,6 +47,7 @@ export class SettingsStore {
47
47
  popupPaytablePosition;
48
48
  popupPaytableData;
49
49
  currentSpeed = "slow";
50
+ isPlayingAnyAction = false;
50
51
  setSpeedPopupVisibility;
51
52
  popupPaytableRepositionCallback;
52
53
  updateVolumeButtonTexture;
@@ -280,6 +281,9 @@ export class SettingsStore {
280
281
  repositionSymbolPaytablePopup(x, y) {
281
282
  this.popupPaytablePosition = { x, y };
282
283
  }
284
+ setIsPlayingAnyAction(flag) {
285
+ this.isPlayingAnyAction = flag;
286
+ }
283
287
  /**
284
288
  * Initialize paytable map for all symbols. based on backend data {@link InitDataInterface.paytable}
285
289
  * @param {InitDataInterface} initConfigData - initial data from backend
@@ -32,12 +32,15 @@ export declare class BaseWinContainer extends Container {
32
32
  spineScale: number;
33
33
  emitters: AnimableParticlesEmitter[];
34
34
  frame: PositioningFrame;
35
+ speedLevelMapper: import("../application").SpeedLevelDirectory<number>;
36
+ protected velocityMultiplier: number;
35
37
  plateSpineName?: string;
36
38
  animationSpineName?: string;
37
39
  plateSpineBgName?: string;
38
40
  isBgAnimated: boolean;
39
41
  constructor(config: BaseWinContainerConfig);
40
42
  setScale(scale: number): void;
43
+ adaptToSpeed(): void;
41
44
  fadeInTextComponent(duration?: number, delay?: number): void;
42
45
  positionTextElement(x?: number, y?: number, scale?: number): void;
43
46
  positionAnimationElement(x?: number, y?: number, scale?: number): void;
@@ -1,6 +1,7 @@
1
1
  import * as TWEEN from "@tweenjs/tween.js";
2
2
  import { Container, TextStyle, Ticker } from "pixi.js";
3
3
  import { Spine } from "pixi-spine";
4
+ import { animationsSpeedLevels, defaultSpeedConfig } from "../application";
4
5
  import { COMPONENTS } from "../components";
5
6
  import { UXLayer } from "../layers";
6
7
  import { RainMan } from "../Rainman";
@@ -14,6 +15,8 @@ export class BaseWinContainer extends Container {
14
15
  spineScale;
15
16
  emitters;
16
17
  frame;
18
+ speedLevelMapper = animationsSpeedLevels;
19
+ velocityMultiplier = defaultSpeedConfig.animationDefaultSpeedScale;
17
20
  plateSpineName;
18
21
  animationSpineName;
19
22
  plateSpineBgName;
@@ -60,6 +63,7 @@ export class BaseWinContainer extends Container {
60
63
  this.addChild(this.textComponent);
61
64
  this.addChild(this.plateSpine);
62
65
  this.resize();
66
+ this.adaptToSpeed();
63
67
  Ticker.shared.add(this.animateBox, this);
64
68
  }
65
69
  setScale(scale) {
@@ -68,11 +72,16 @@ export class BaseWinContainer extends Container {
68
72
  this.plateSpineBg.scale.set(scale);
69
73
  this.textComponent.scale.set(scale);
70
74
  }
75
+ adaptToSpeed() {
76
+ this.velocityMultiplier = this.speedLevelMapper[RainMan.settingsStore.currentSpeed];
77
+ this.plateSpine.state.timeScale = this.velocityMultiplier;
78
+ this.plateSpineBg.state.timeScale = this.velocityMultiplier;
79
+ }
71
80
  fadeInTextComponent(duration = 1000, delay = 0) {
72
81
  this.textComponent.alpha = 0;
73
82
  new TWEEN.Tween({ alpha: 0 })
74
83
  .to({ alpha: 1 }, duration)
75
- .delay(delay)
84
+ .delay(delay / this.velocityMultiplier)
76
85
  .onUpdate((obj) => {
77
86
  this.textComponent.alpha = obj.alpha;
78
87
  })
@@ -1,6 +1,6 @@
1
1
  import { COMPONENTS } from "../components";
2
2
  import { BaseWinContainer, BaseWinContainerConfig } from "./BaseWinContainer";
3
- type MysteryWinContainerConfig = Omit<BaseWinContainerConfig, "componentType"> & {
3
+ type BigWinContainerConfig = Omit<BaseWinContainerConfig, "componentType"> & {
4
4
  componentType: typeof COMPONENTS.bigWin;
5
5
  };
6
6
  /**
@@ -10,6 +10,6 @@ type MysteryWinContainerConfig = Omit<BaseWinContainerConfig, "componentType"> &
10
10
  */
11
11
  export declare class BigWinContainer extends BaseWinContainer {
12
12
  static readonly name = "bigWinContainer";
13
- constructor(config: MysteryWinContainerConfig);
13
+ constructor(config: BigWinContainerConfig);
14
14
  }
15
15
  export {};
@@ -8,5 +8,6 @@ export class BigWinContainer extends BaseWinContainer {
8
8
  static name = "bigWinContainer";
9
9
  constructor(config) {
10
10
  super(config);
11
+ this.plateSpine.visible = false;
11
12
  }
12
13
  }
@@ -22,6 +22,7 @@ export class TexturedText extends UpdatableValueComponent {
22
22
  }
23
23
  async update(newValue) {
24
24
  const time = this.registryName === "bigWinText" ? 0 : RainMan.config.durationOfActions.updatableTextCountingDuration;
25
+ this.valueTextComponent.style.fontSize = -10 * new MoneyText(newValue).toString().length + 190;
25
26
  await super.update(newValue, time);
26
27
  }
27
28
  randomizeSet(value, _possibleValues) {
@@ -66,11 +66,8 @@ export const winFactoryV2 = ({ type, plateSpine: plateSpineSrc, plateSpineName,
66
66
  return new MysteryWinContainer({
67
67
  componentType: COMPONENTS.mysteryWin,
68
68
  plateSpineSrc,
69
- plateSpineName,
70
69
  animationSpineSrc,
71
- animationSpineName,
72
70
  plateSpineBgSrc,
73
- plateSpineBgName,
74
71
  frame,
75
72
  text,
76
73
  spineScale,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixi-rainman-game-engine",
3
- "version": "0.2.20",
3
+ "version": "0.2.21b",
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",