pixi-rainman-game-engine 0.1.2 → 0.1.4

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,4 +1,4 @@
1
- import "./uxsettings.css";
1
+ import "./UXSettings.css";
2
2
  import React from "react";
3
3
  export declare const UXSettings: (() => React.JSX.Element) & {
4
4
  displayName: string;
@@ -1,4 +1,4 @@
1
- import "./uxsettings.css";
1
+ import "./UXSettings.css";
2
2
  import { observer } from "mobx-react-lite";
3
3
  import React from "react";
4
4
  import { useStores } from "../../hooks";
@@ -8,7 +8,7 @@ import { useStores } from "../../hooks";
8
8
  const handleStyle = { width: "7px", height: "24px", bottom: "-6px", borderRadius: "4px" };
9
9
  const onChange = (newVolumeLevel) => {
10
10
  RainMan.settingsStore.setVolumeLevel(newVolumeLevel);
11
- RainMan.settingsStore.setIsSoundEnabled(newVolumeLevel > 0 && !RainMan.settingsStore.isSoundEnabled);
11
+ RainMan.settingsStore.setIsSoundEnabled(newVolumeLevel > 0);
12
12
  };
13
13
  export const VolumeSettings = observer(() => {
14
14
  const { settingStore } = useStores();
@@ -110,8 +110,9 @@ export class ButtonsEventManager {
110
110
  ?.setOnClick(() => this.handleModalInvocation(UI_ITEMS.freeSpin));
111
111
  }
112
112
  initVolumeButtonEvent() {
113
+ RainMan.settingsStore.setUpdateVolumeButtonTexture(() => RainMan.componentRegistry.get(VolumeButton.registryName).changeTextureDependOnVolume());
113
114
  RainMan.componentRegistry.get(VolumeButton.registryName).setOnClick(() => {
114
- RainMan.settingsStore.setIsSoundEnabled(RainMan.settingsStore.volumeLevel > 0 && !RainMan.settingsStore.isSoundEnabled);
115
+ RainMan.settingsStore.setIsSoundEnabled(!RainMan.settingsStore.isSoundEnabled);
115
116
  RainMan.componentRegistry.get(VolumeButton.registryName).changeTextureDependOnVolume();
116
117
  this.handleModalInvocation(UI_ITEMS.volume);
117
118
  });
@@ -16,13 +16,13 @@ export class VolumeButton extends BaseButton {
16
16
  [ButtonStates.OVER]: getTexture("mute-h.png"),
17
17
  [ButtonStates.CLICKED]: getTexture("mute-c.png"),
18
18
  };
19
- const isSoundEnabled = RainMan.settingsStore.volumeLevel > 0 && RainMan.settingsStore.isSoundEnabled;
19
+ const isSoundEnabled = RainMan.settingsStore.isSoundEnabled;
20
20
  super(VolumeButton.registryName, isSoundEnabled ? normalTextureMap : muteTextureMap);
21
21
  this.normalTextureMap = normalTextureMap;
22
22
  this.muteTextureMap = muteTextureMap;
23
23
  }
24
24
  changeTextureDependOnVolume() {
25
- if (RainMan.settingsStore.volumeLevel > 0 && RainMan.settingsStore.isSoundEnabled) {
25
+ if (RainMan.settingsStore.isSoundEnabled) {
26
26
  this.texture = this.normalTextureMap.NORMAL;
27
27
  this.textures = this.normalTextureMap;
28
28
  }
@@ -4,7 +4,7 @@ import { DropTransformationDetails, SymbolReel } from "../../connectivity";
4
4
  import { AbstractColumnsContainer, AbstractFrame } from "../frame";
5
5
  import { AbstractSymbolBase } from "./AbstractSymbolBase";
6
6
  export declare abstract class AbstractSymbolsColumn extends Container implements SpeedAdapterInterface<number> {
7
- private columnsContainer;
7
+ protected columnsContainer: AbstractColumnsContainer;
8
8
  protected allSymbols: SymbolId[];
9
9
  spinning: boolean;
10
10
  speedLevelMapper: import("../../application").SpeedLevelDirectory<number>;
@@ -29,6 +29,7 @@ export declare abstract class AbstractSymbolsColumn extends Container implements
29
29
  private spinEndPromise;
30
30
  protected abstract symbolTopOffset: number;
31
31
  skipHidingMysteryFx: boolean;
32
+ protected abstract bonusSymbol: SymbolId;
32
33
  private readonly _id;
33
34
  protected constructor(id: string, columnsContainer: AbstractColumnsContainer, allSymbols: SymbolId[]);
34
35
  protected abstract get tileHeight(): number;
@@ -51,7 +52,7 @@ export declare abstract class AbstractSymbolsColumn extends Container implements
51
52
  handleMultipleSymbolDropping(transformations: DropTransformationDetails[], skipAnimation?: boolean): Promise<void>;
52
53
  private changePhase;
53
54
  private moveToTop;
54
- protected abstract shouldPlaySpecialRollStopSound(): boolean;
55
+ protected shouldPlaySpecialRollStopSound(): boolean;
55
56
  handleStopping(): void;
56
57
  protected abstract createNewSymbol(): AbstractSymbolBase;
57
58
  private initSymbolSprites;
@@ -289,12 +289,25 @@ export class AbstractSymbolsColumn extends Container {
289
289
  this.ensureTopOffset();
290
290
  this.swapSymbolFace(symbol);
291
291
  }
292
+ shouldPlaySpecialRollStopSound() {
293
+ for (let i = 0; i <= RainMan.config.numberOfColumns; i++) {
294
+ const currentColumn = this.columnsContainer.getColumnAtPosition(i);
295
+ const hasBonus = !!currentColumn.symbols
296
+ .toSpliced(RainMan.config.numberOfRows, 1)
297
+ .find((symbol) => symbol.id === this.bonusSymbol);
298
+ if (hasBonus && currentColumn === this)
299
+ return true;
300
+ if (!hasBonus)
301
+ return false;
302
+ }
303
+ return false;
304
+ }
292
305
  handleStopping() {
293
306
  if (!this.topMostSymbol || this.phase === Phase.END)
294
307
  return;
295
308
  if (this.topMostSymbol.y >= this.tileHeight / 2) {
296
309
  if (!this.columnsContainer.quickReelsStop && RainMan.settingsStore.currentSpeed !== SPEED_LEVELS.fast)
297
- SoundManager.play(this.shouldPlaySpecialRollStopSound() ? SoundTracks.rollStop : SoundTracks.rollStop);
310
+ SoundManager.play(this.shouldPlaySpecialRollStopSound() ? SoundTracks.bonus : SoundTracks.rollStop);
298
311
  this.fixStationaryPositions();
299
312
  this.doStop();
300
313
  return;
@@ -33,6 +33,7 @@ export declare class SettingsStore {
33
33
  popupPaytableData?: PaytableData[];
34
34
  currentSpeed: SpeedLevel;
35
35
  popupPaytableRepositionCallback?: () => void;
36
+ updateVolumeButtonTexture?: () => void;
36
37
  private readonly initialAutoplaySettingsState;
37
38
  private modalsAvailable;
38
39
  private paytableMap;
@@ -55,6 +56,7 @@ export declare class SettingsStore {
55
56
  setBalancedDecreased(newValue: number): void;
56
57
  setDataForSymbolPaytablePopup(symbolId: SymbolId, repositionCallback: () => void): void;
57
58
  resetDataForSymbolPaytablePopup(): void;
59
+ setUpdateVolumeButtonTexture(fn: () => void): void;
58
60
  repositionSymbolPaytablePopup(x: number, y: number): void;
59
61
  initPaytableMap(initConfigData: InitDataInterface): void;
60
62
  decreaseAutoSpinsCount(): void;
@@ -36,6 +36,7 @@ export class SettingsStore {
36
36
  popupPaytableData;
37
37
  currentSpeed = "slow";
38
38
  popupPaytableRepositionCallback;
39
+ updateVolumeButtonTexture;
39
40
  initialAutoplaySettingsState = {
40
41
  infinitySpinsEnabled: false,
41
42
  onAnyWin: false,
@@ -183,6 +184,9 @@ export class SettingsStore {
183
184
  this.popupPaytableData = undefined;
184
185
  this.popupPaytableRepositionCallback = undefined;
185
186
  }
187
+ setUpdateVolumeButtonTexture(fn) {
188
+ this.updateVolumeButtonTexture = fn;
189
+ }
186
190
  repositionSymbolPaytablePopup(x, y) {
187
191
  this.popupPaytablePosition = { x, y };
188
192
  }
@@ -254,6 +258,7 @@ export class SettingsStore {
254
258
  }
255
259
  setIsSoundEnabled(flag) {
256
260
  this.isSoundEnabled = flag;
261
+ this.updateVolumeButtonTexture?.();
257
262
  setToLocalStorage(LOCAL_STORAGE.isSoundEnabled, flag);
258
263
  }
259
264
  getMysteryPaytable(mysterySymbol, quantity = 3) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixi-rainman-game-engine",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
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",