pixi-rainman-game-engine 0.1.42 → 0.1.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.
@@ -14,7 +14,7 @@
14
14
  min-width: 140px;
15
15
  width: fit-content;
16
16
  text-align: center;
17
- height: fit-content;
17
+ height: 62px;
18
18
  border-radius: 32px;
19
19
  border: 2px white;
20
20
  border-style: solid;
@@ -22,6 +22,10 @@
22
22
  * @property {string} specialSymbolOnReel - single reel stopping with special symbol like bonus or mystery
23
23
  * @property {string} start - on start spinning
24
24
  * @property {string} symbol - on symbol click and show payTable popup
25
+ * @property {string} lowWin - on low win - this sound is played when win of all streaks is less than x1 * bet
26
+ * @property {string} mediumWin - on medium win - this sound is played when win of all streaks is more than x1.1 * bet and less than x5 * bet
27
+ * @property {string} highWin - on high win - this sound is played when win of all streaks is more than x5.1 * bet and less than x15 * bet
28
+ * @property {string} veryHighWin - on very high win - this sound is played when win of all streaks is more than x15.1 * bet
25
29
  *
26
30
  * @exports SoundTracks
27
31
  */
@@ -42,6 +46,10 @@ export interface SoundTracks {
42
46
  line: "line";
43
47
  fewLine: "fewLine";
44
48
  oneLine: "oneLine";
49
+ lowWin: "lowWin";
50
+ mediumWin: "mediumWin";
51
+ highWin: "highWin";
52
+ veryHighWin: "veryHighWin";
45
53
  freeLine: "freeLine";
46
54
  mysteryDrawLoop: "mysteryDrawLoop";
47
55
  rollStop: "rollStop";
@@ -22,6 +22,10 @@
22
22
  * @property {string} specialSymbolOnReel - single reel stopping with special symbol like bonus or mystery
23
23
  * @property {string} start - on start spinning
24
24
  * @property {string} symbol - on symbol click and show payTable popup
25
+ * @property {string} lowWin - on low win - this sound is played when win of all streaks is less than x1 * bet
26
+ * @property {string} mediumWin - on medium win - this sound is played when win of all streaks is more than x1.1 * bet and less than x5 * bet
27
+ * @property {string} highWin - on high win - this sound is played when win of all streaks is more than x5.1 * bet and less than x15 * bet
28
+ * @property {string} veryHighWin - on very high win - this sound is played when win of all streaks is more than x15.1 * bet
25
29
  *
26
30
  * @exports SoundTracks
27
31
  */
@@ -42,6 +46,10 @@ export const SoundTracks = {
42
46
  freeLine: "freeLine",
43
47
  fewLine: "fewLine",
44
48
  oneLine: "oneLine",
49
+ lowWin: "lowWin",
50
+ mediumWin: "mediumWin",
51
+ highWin: "highWin",
52
+ veryHighWin: "veryHighWin",
45
53
  mysteryDrawLoop: "mysteryDrawLoop",
46
54
  rollStop: "rollStop",
47
55
  specialSymbolOnReel: "specialSymbolOnReel",
@@ -48,8 +48,9 @@ export declare abstract class AbstractColumnsContainer extends Container impleme
48
48
  * @returns {Promise<void>}
49
49
  */
50
50
  configBlindSpin(finalSymbolReels: SymbolReels, afterSpinResolver: (value: void | PromiseLike<void>) => void, indexesOfReelsToExtendSpinningTime: number[]): Promise<void>;
51
- playAllStreaks(streaks: StreakReelsIndexes[]): Promise<void>;
51
+ playAllStreaks(streaks: StreakReelsIndexes[], amount: number): Promise<void>;
52
52
  resetPlayedSounds(): void;
53
+ protected playSoundDependingOnAmount(amount: number): void;
53
54
  protected playStreakSound(symbols: SymbolId[]): void;
54
55
  /**
55
56
  * Function for playing animation of streak
@@ -4,6 +4,7 @@ import { FrameLayer } from "../../layers";
4
4
  import { RainMan } from "../../Rainman";
5
5
  import { Speed } from "../symbols";
6
6
  import { AbstractFrame } from "./AbstractFrame";
7
+ import { WIN_MULTIPLIER_VALUES } from "./constants";
7
8
  /**
8
9
  * Class represents columns container in game
9
10
  *
@@ -104,7 +105,7 @@ export class AbstractColumnsContainer extends Container {
104
105
  resolve();
105
106
  });
106
107
  }
107
- async playAllStreaks(streaks) {
108
+ async playAllStreaks(streaks, amount) {
108
109
  const columnsToPlay = [];
109
110
  streaks.forEach((streak) => {
110
111
  streak.forEach((symbolIndex, index) => {
@@ -120,12 +121,32 @@ export class AbstractColumnsContainer extends Container {
120
121
  columnsToPlay.forEach((column, index) => {
121
122
  column.forEach((symbolIndex) => promises.push(this.getColumnAtPosition(index).playSymbolAtPosition(symbolIndex, true)));
122
123
  });
123
- SoundManager.play(SoundTracks.fewLine);
124
+ this.playSoundDependingOnAmount(amount);
124
125
  await Promise.allSettled(promises);
125
126
  }
126
127
  resetPlayedSounds() {
127
128
  this.playedSounds = [];
128
129
  }
130
+ playSoundDependingOnAmount(amount) {
131
+ const bet = RainMan.settingsStore.bet;
132
+ if (amount < WIN_MULTIPLIER_VALUES.LOW_WIN * bet) {
133
+ SoundManager.play(SoundTracks.lowWin);
134
+ return;
135
+ }
136
+ if (amount > WIN_MULTIPLIER_VALUES.MEDIUM_WIN_MIN * bet &&
137
+ amount < WIN_MULTIPLIER_VALUES.MEDIUM_WIN_MAX * bet) {
138
+ SoundManager.play(SoundTracks.mediumWin);
139
+ return;
140
+ }
141
+ if (amount > WIN_MULTIPLIER_VALUES.HIGH_WIN_MIN * bet && amount < WIN_MULTIPLIER_VALUES.HIGH_WIN_MAX * bet) {
142
+ SoundManager.play(SoundTracks.highWin);
143
+ return;
144
+ }
145
+ if (amount > WIN_MULTIPLIER_VALUES.VERY_HIGH_WIN * bet) {
146
+ SoundManager.play(SoundTracks.veryHighWin);
147
+ return;
148
+ }
149
+ }
129
150
  playStreakSound(symbols) {
130
151
  for (const [symbol, sound] of Object.entries(this.mapSymbolToSound)) {
131
152
  if (!symbols.includes(symbol))
@@ -0,0 +1,9 @@
1
+ export declare const WIN_MULTIPLIER_VALUES: {
2
+ readonly LOW_WIN: 1;
3
+ readonly MEDIUM_WIN_MIN: 1.1;
4
+ readonly MEDIUM_WIN_MAX: 2;
5
+ readonly HIGH_WIN_MIN: 5.1;
6
+ readonly HIGH_WIN_MAX: 15;
7
+ readonly VERY_HIGH_WIN: 15.1;
8
+ };
9
+ export type WinMultiplierValues = (typeof WIN_MULTIPLIER_VALUES)[keyof typeof WIN_MULTIPLIER_VALUES];
@@ -0,0 +1,8 @@
1
+ export const WIN_MULTIPLIER_VALUES = {
2
+ LOW_WIN: 1,
3
+ MEDIUM_WIN_MIN: 1.1,
4
+ MEDIUM_WIN_MAX: 2,
5
+ HIGH_WIN_MIN: 5.1,
6
+ HIGH_WIN_MAX: 15,
7
+ VERY_HIGH_WIN: 15.1,
8
+ };
@@ -59,8 +59,14 @@ export class AbstractController {
59
59
  this.componentRegistry = RainMan.componentRegistry;
60
60
  this.setupSpaceOrEnterListener();
61
61
  RainMan.globals.handleDisablingButtons = this.handleDisablingButtons.bind(this);
62
- RainMan.settingsStore.increaseBet = () => this.uiController.updateBet("increase");
63
- RainMan.settingsStore.decreaseBet = () => this.uiController.updateBet("decrease");
62
+ RainMan.settingsStore.increaseBet = () => {
63
+ this.uiController.updateBet("increase");
64
+ SoundManager.play(SoundTracks.increaseRate);
65
+ };
66
+ RainMan.settingsStore.decreaseBet = () => {
67
+ this.uiController.updateBet("decrease");
68
+ SoundManager.play(SoundTracks.reductionRate);
69
+ };
64
70
  }
65
71
  init() {
66
72
  const initData = this.connection.initData();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixi-rainman-game-engine",
3
- "version": "0.1.42",
3
+ "version": "0.1.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",