pixi-rainman-game-engine 0.3.39 → 0.3.41

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.
@@ -5,13 +5,13 @@ export const SpeedButtonSwitch = observer(() => {
5
5
  const speedLevelMapper = {
6
6
  slow: "turtle",
7
7
  normal: "rabbit",
8
- fast: "cheetah",
8
+ fast: "cheetah"
9
9
  };
10
10
  const { settingStore } = useStores();
11
11
  const { currentSpeed } = settingStore;
12
12
  return (<label className="switch turtle-switch speed-level-id">
13
13
  <span className="turtle-switch-round-box"/>
14
- <img className="turtle-switch__icon" src={`assets/settings/speed-${speedLevelMapper[currentSpeed]}.png`}/>
14
+ <img className="turtle-switch__icon" src={`assets/settings/speed-${speedLevelMapper[currentSpeed]}.webp`}/>
15
15
  <div className="dot-container">
16
16
  {Array.from({ length: 3 }).map((_, i) => (<div key={i} className={`white-dot ${i < settingStore.indexOfSpeedLevel ? "white-dot--active" : ""}`}/>))}
17
17
  </div>
@@ -36,7 +36,7 @@
36
36
  bottom: 5px;
37
37
  width: 30px;
38
38
  height: 30px;
39
- background-image: url("/assets/settings/sound-icon.png");
39
+ background-image: url("/assets/settings/sound-icon.webp");
40
40
  background-position: center;
41
41
  background-size: contain;
42
42
  background-repeat: no-repeat;
@@ -1,7 +1,12 @@
1
1
  import { Sound, sound } from "@pixi/sound";
2
2
  import { RainMan } from "../../Rainman";
3
3
  import { SoundTracks } from "./types";
4
- const soundsToLoop = [SoundTracks.mysteryFxLoop, SoundTracks.music, SoundTracks.freeSpinsMusic];
4
+ const soundsToLoop = [
5
+ SoundTracks.mysteryFxLoop,
6
+ SoundTracks.music,
7
+ SoundTracks.freeSpinsMusic,
8
+ SoundTracks.cardDrawing
9
+ ];
5
10
  export const pixiSoundContext = sound.context;
6
11
  /**
7
12
  * Class for managing sound in game, uses the pixi sound library
@@ -148,7 +153,8 @@ export class SoundManagerInstance {
148
153
  sound.play({
149
154
  singleInstance: true,
150
155
  loop: soundsToLoop.includes(soundName),
151
- volume: this.getVolumeLevel(soundName)
156
+ volume: this.getVolumeLevel(soundName),
157
+ speed: soundName === "cardDrawing" ? 0.8 : 1
152
158
  });
153
159
  }
154
160
  /**
@@ -64,6 +64,10 @@ export interface SoundTracks {
64
64
  rouletteStop: "rouletteStop";
65
65
  mysterySymbol: "mysterySymbol";
66
66
  jackpotWin: "jackpotWin";
67
+ cardWin: "cardWin";
68
+ cardLose: "cardLose";
69
+ cardDrawing: "cardDrawing";
70
+ cardCollect: "cardCollect";
67
71
  }
68
72
  export type SoundTrack = SoundTracks[keyof SoundTracks];
69
73
  /**
@@ -61,5 +61,9 @@ export const SoundTracks = {
61
61
  rouletteStart: "rouletteStart",
62
62
  rouletteLoop: "rouletteLoop",
63
63
  rouletteStop: "rouletteStop",
64
- jackpotWin: "jackpotWin"
64
+ jackpotWin: "jackpotWin",
65
+ cardWin: "cardWin",
66
+ cardLose: "cardLose",
67
+ cardDrawing: "cardDrawing",
68
+ cardCollect: "cardCollect"
65
69
  };
@@ -717,6 +717,9 @@ export class AbstractMainContainer extends Container {
717
717
  if (this.mysteryBonusContainer) {
718
718
  this.removeChild(this.mysteryBonusContainer);
719
719
  }
720
+ if (RainMan.settingsStore.isAutoplayEnabled) {
721
+ RainMan.settingsStore.disableSpecialButtons();
722
+ }
720
723
  this.messageBox.resize();
721
724
  this.background.resize();
722
725
  this.animatedFront?.resize();
@@ -1,6 +1,7 @@
1
1
  import i18next from "i18next";
2
2
  import { Container, Sprite, Text, Texture } from "pixi.js";
3
3
  import { Spine } from "pixi-spine";
4
+ import { SoundManager } from "../../application";
4
5
  import { COLOR_BUTTONS_CENTER_OFFSET, COLOR_BUTTONS_SCALE_X, gamblesTextStyle } from "../../constants";
5
6
  import { RainMan } from "../../Rainman";
6
7
  import { getDeviceOrientation, getSpineData, globalMinRatio } from "../../utils";
@@ -60,6 +61,7 @@ export class GambleGame extends Container {
60
61
  this.addChildrenOnce();
61
62
  this.bindButtonsOnce();
62
63
  this.resize();
64
+ SoundManager.play("cardDrawing");
63
65
  }
64
66
  configureButtons() {
65
67
  this.collectButton.eventMode = "static";
@@ -88,6 +90,7 @@ export class GambleGame extends Container {
88
90
  this.collectButton.setOnClick(() => {
89
91
  RainMan.settingsStore.gambleGameWin = this.lastWinAmount;
90
92
  RainMan.componentRegistry.get(BUTTONS.gamble).flipDisabledFlag(true);
93
+ SoundManager.play("cardCollect");
91
94
  this.resolver(this.balanceValue);
92
95
  });
93
96
  }
@@ -170,6 +173,8 @@ export class GambleGame extends Container {
170
173
  if (this.lastWinAmount === 0) {
171
174
  return;
172
175
  }
176
+ SoundManager.stop("cardDrawing");
177
+ this.collectButton.flipDisabledFlag(true);
173
178
  this.redButton.flipDisabledFlag(true);
174
179
  this.blackButton.flipDisabledFlag(true);
175
180
  this.card.state.addAnimation(0, "wait", true, 0);
@@ -178,6 +183,12 @@ export class GambleGame extends Container {
178
183
  this.card.state.clearTracks();
179
184
  this.card.state.clearListeners();
180
185
  this.card.state.addAnimation(0, gambleData.winning_card, false, 0);
186
+ if (gambleData.win_amount > 0) {
187
+ SoundManager.play("cardWin");
188
+ }
189
+ else {
190
+ SoundManager.play("cardLose");
191
+ }
181
192
  this.card.state.addListener({ complete: () => resolve() });
182
193
  });
183
194
  if (gambleData.win_amount > 0) {
@@ -186,6 +197,8 @@ export class GambleGame extends Container {
186
197
  this.blackButton.flipDisabledFlag(false);
187
198
  this.redButton.eventMode = "static";
188
199
  this.blackButton.eventMode = "static";
200
+ SoundManager.play("cardDrawing");
201
+ this.collectButton.flipDisabledFlag(false);
189
202
  }
190
203
  this.card.state.addAnimation(0, "wait2", true, 0);
191
204
  this.lastWinAmount = gambleData.win_amount;
@@ -95,6 +95,16 @@ export declare abstract class AbstractColumnsContainer extends Container impleme
95
95
  * @returns {Promise<void>}
96
96
  */
97
97
  configBlindSpin(finalSymbolReels: SymbolReels, afterSpinResolver: (value: void | PromiseLike<void>) => void, indexesOfReelsToExtendSpinningTime: number[]): Promise<void>;
98
+ /**
99
+ * This function is responsible for setting symbols in single column
100
+ * @public
101
+ * @param {SymbolReels} finalSymbolReels final symbols in columns
102
+ * @param {(value: void | PromiseLike<void>) => void} afterSpinResolver resolver for after spin
103
+ * @param {number} columnIndex index of column to configure
104
+ * @param {boolean} shouldExtendSpinningTime determines whether to extend spinning time for the column
105
+ * @returns {Promise<void>}
106
+ */
107
+ configBlindSpinForColumn(finalSymbolReels: SymbolReels, afterSpinResolver: (value: void | PromiseLike<void>) => void, columnIndex: number, shouldExtendSpinningTime?: boolean): Promise<void>;
98
108
  /**
99
109
  * This cancels the timeout, removes the stored delayed action and invalidates
100
110
  * any older timeout callback that might still try to execute later.
@@ -227,4 +237,12 @@ export declare abstract class AbstractColumnsContainer extends Container impleme
227
237
  * @returns {PlayableAction[]} - array of playable actions
228
238
  */
229
239
  protected prepareConfiguringReelsEnd(finalSymbolReels: SymbolReels): PlayableAction[];
240
+ /**
241
+ * Function for preparing configuring for single reel
242
+ * @protected
243
+ * @param {SymbolReels} finalSymbolReels - final symbol reels
244
+ * @param {number} columnIndex - column index
245
+ * @returns {PlayableAction} - playable action
246
+ */
247
+ protected prepareConfiguringReelsEndForIndex(finalSymbolReels: SymbolReels, columnIndex: number): PlayableAction;
230
248
  }
@@ -187,6 +187,63 @@ export class AbstractColumnsContainer extends Container {
187
187
  resolve();
188
188
  });
189
189
  }
190
+ /**
191
+ * This function is responsible for setting symbols in single column
192
+ * @public
193
+ * @param {SymbolReels} finalSymbolReels final symbols in columns
194
+ * @param {(value: void | PromiseLike<void>) => void} afterSpinResolver resolver for after spin
195
+ * @param {number} columnIndex index of column to configure
196
+ * @param {boolean} shouldExtendSpinningTime determines whether to extend spinning time for the column
197
+ * @returns {Promise<void>}
198
+ */
199
+ async configBlindSpinForColumn(finalSymbolReels, afterSpinResolver, columnIndex, shouldExtendSpinningTime = false) {
200
+ return new Promise(async (resolve) => {
201
+ this.clearPendingMysteryDelay();
202
+ this.mysteryFxGeneration = 0;
203
+ this.skipRemainingMysteryFxs = false;
204
+ const frame = RainMan.componentRegistry.get(AbstractFrame.registryName);
205
+ const column = this.allColumns[columnIndex];
206
+ if (column === undefined) {
207
+ afterSpinResolver();
208
+ resolve();
209
+ return;
210
+ }
211
+ const configureSpinAction = this.prepareConfiguringReelsEndForIndex(finalSymbolReels, columnIndex);
212
+ if (this.quickReelsStop ||
213
+ this.skipRemainingMysteryFxs ||
214
+ RainMan.settingsStore.currentSpeed === SPEED_LEVELS.fast) {
215
+ await configureSpinAction();
216
+ SoundManager.play(SoundTracks.allRollStops);
217
+ }
218
+ else if (shouldExtendSpinningTime) {
219
+ this.currentColumn = column;
220
+ column.adaptToSpeed(RainMan.settingsStore.currentSpeed);
221
+ frame.invokeMysteryFx(column.x, column.y);
222
+ this.skipScatterDelay = configureSpinAction;
223
+ await column.speedUpForMysterySpin(100, 1500);
224
+ if (this.quickReelsStop || this.skipRemainingMysteryFxs) {
225
+ await column.changeVelocity(Speed.STOP, 0, frame);
226
+ }
227
+ else {
228
+ if (!RainMan.settingsStore.isAutoplayEnabled ||
229
+ (RainMan.settingsStore.isAutoplayEnabled && !this.quickReelsStop)) {
230
+ this.scheduleMysteryDelay(configureSpinAction, RainMan.config.durationOfActions.scatterDelayerTime);
231
+ }
232
+ await column.changeVelocity(Speed.STOP, RainMan.config.durationOfActions.scatterSpinningTime, frame);
233
+ }
234
+ frame.destroyMysteryFx();
235
+ }
236
+ else {
237
+ await configureSpinAction();
238
+ }
239
+ await column.getStopPromise();
240
+ this.clearPendingMysteryDelay();
241
+ this.mysteryFxGeneration = 0;
242
+ this.skipRemainingMysteryFxs = false;
243
+ afterSpinResolver();
244
+ resolve();
245
+ });
246
+ }
190
247
  /**
191
248
  * This cancels the timeout, removes the stored delayed action and invalidates
192
249
  * any older timeout callback that might still try to execute later.
@@ -441,4 +498,20 @@ export class AbstractColumnsContainer extends Container {
441
498
  this.currentColumn = null;
442
499
  });
443
500
  }
501
+ /**
502
+ * Function for preparing configuring for single reel
503
+ * @protected
504
+ * @param {SymbolReels} finalSymbolReels - final symbol reels
505
+ * @param {number} columnIndex - column index
506
+ * @returns {PlayableAction} - playable action
507
+ */
508
+ prepareConfiguringReelsEndForIndex(finalSymbolReels, columnIndex) {
509
+ const column = this.allColumns[columnIndex];
510
+ return async () => {
511
+ this.currentColumn = column;
512
+ column.configBlindSpin(finalSymbolReels[columnIndex]);
513
+ await column.getTriggersPromise();
514
+ this.currentColumn = null;
515
+ };
516
+ }
444
517
  }
@@ -322,7 +322,6 @@ export class AbstractController {
322
322
  if (RainMan.componentRegistry.has(BUTTONS.take)) {
323
323
  this.buttonsEventManager.initTakeButton(() => {
324
324
  RainMan.settingsStore.useTakeAction?.();
325
- this.uiController.currentBalance = RainMan.settingsStore.balanceAfterSpin;
326
325
  RainMan.settingsStore.isTakeActionAvailable = false;
327
326
  RainMan.settingsStore.isGambleGameAvailable = false;
328
327
  if (RainMan.componentRegistry.has(BUTTONS.gamble)) {
@@ -914,6 +913,7 @@ export class AbstractController {
914
913
  if (takeData.status.code === 200) {
915
914
  RainMan.settingsStore.isTakeActionAvailable = false;
916
915
  logInfo(`💰 Round ${takeData.round_number} ended with balance:`, takeData.balance);
916
+ this.uiController.currentBalance = takeData.balance;
917
917
  }
918
918
  else {
919
919
  RainMan.settingsStore.isTakeActionAvailable = true;
@@ -1237,6 +1237,7 @@ export class AbstractController {
1237
1237
  if (this.speedLevelBeforeFreeSpins !== null &&
1238
1238
  !RainMan.settingsStore.isFreeSpinsPlayEnabled &&
1239
1239
  !RainMan.globals.isSuperBonusGameEnabled) {
1240
+ RainMan.settingsStore.setIsTemporarySpeed(false);
1240
1241
  RainMan.componentRegistry.setSpeedLevel(this.speedLevelBeforeFreeSpins);
1241
1242
  this.uiController.updateShownSpeedLevel(this.speedLevelBeforeFreeSpins);
1242
1243
  this.speedLevelBeforeFreeSpins = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixi-rainman-game-engine",
3
- "version": "0.3.39",
3
+ "version": "0.3.41",
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",