pixi-rainman-game-engine 0.3.0 → 0.3.2

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 (186) hide show
  1. package/dist/ComponentRegistry/ComponentRegistry.d.ts +23 -9
  2. package/dist/ComponentRegistry/ComponentRegistry.js +25 -10
  3. package/dist/ComponentRegistry/types.d.ts +3 -4
  4. package/dist/DescribedPlayableAction/DescribedPlayableAction.d.ts +2 -0
  5. package/dist/DescribedPlayableAction/DescribedPlayableAction.js +2 -0
  6. package/dist/Money/MoneyText.d.ts +5 -0
  7. package/dist/Money/MoneyText.js +5 -0
  8. package/dist/Rainman/appConfig.js +1 -0
  9. package/dist/Rainman/types.d.ts +1 -0
  10. package/dist/SettingsUI/hooks/useBuyFreeSpins/useBuyFreeSpins.d.ts +4 -0
  11. package/dist/SettingsUI/hooks/useBuyFreeSpins/useBuyFreeSpins.js +4 -0
  12. package/dist/SettingsUI/hooks/useDeviceOrientations.d.ts +4 -0
  13. package/dist/SettingsUI/hooks/useDeviceOrientations.js +4 -0
  14. package/dist/application/ApiConfig/ApiConfig.d.ts +2 -1
  15. package/dist/application/ApiConfig/ApiConfig.js +3 -2
  16. package/dist/application/ApiConfig/SymbolId.d.ts +1 -1
  17. package/dist/application/ButtonsEventManager/ButtonsEventManager.d.ts +42 -5
  18. package/dist/application/ButtonsEventManager/ButtonsEventManager.js +51 -9
  19. package/dist/application/SoundManager/SoundManager.d.ts +26 -1
  20. package/dist/application/SoundManager/SoundManager.js +30 -2
  21. package/dist/application/SpeedState/SpeedAdapter.d.ts +9 -0
  22. package/dist/application/SpeedState/SpeedAdapter.js +9 -0
  23. package/dist/application/SpeedState/SpeedLevel.d.ts +42 -0
  24. package/dist/application/SpeedState/SpeedLevel.js +30 -0
  25. package/dist/application/SpeedState/SpeedLevelHandler.d.ts +7 -0
  26. package/dist/application/SpeedState/SpeedLevelHandler.js +7 -0
  27. package/dist/application/SpinLogic/SpinLogic.d.ts +58 -0
  28. package/dist/application/SpinLogic/SpinLogic.js +58 -0
  29. package/dist/application/SpinLogic/SpinLogicDTO.d.ts +70 -0
  30. package/dist/application/SpinLogic/SpinLogicDTO.js +70 -0
  31. package/dist/application/SpinLogic/WinScenarios.d.ts +12 -0
  32. package/dist/application/SpinLogic/WinScenarios.js +12 -0
  33. package/dist/application/SpinLogic/types.d.ts +10 -0
  34. package/dist/application/TimedActions/IncentiveComponent.d.ts +10 -0
  35. package/dist/application/TimedActions/IncentiveComponent.js +9 -1
  36. package/dist/application/TimedActions/TimedIncentiveController.d.ts +37 -0
  37. package/dist/application/TimedActions/TimedIncentiveController.js +37 -0
  38. package/dist/application/setup.d.ts +0 -1
  39. package/dist/application/setup.js +0 -1
  40. package/dist/components/AbstractFreeSpinContainer/AbstractFreeSpinContainer.d.ts +36 -1
  41. package/dist/components/AbstractFreeSpinContainer/AbstractFreeSpinContainer.js +25 -0
  42. package/dist/components/AbstractMainContainer/AbstractMainContainer.d.ts +83 -2
  43. package/dist/components/AbstractMainContainer/AbstractMainContainer.js +97 -11
  44. package/dist/components/DoubleBorderText/DoubleBorderText.d.ts +10 -0
  45. package/dist/components/DoubleBorderText/DoubleBorderText.js +24 -0
  46. package/dist/components/DoubleBorderText/index.d.ts +1 -0
  47. package/dist/components/DoubleBorderText/index.js +1 -0
  48. package/dist/components/GambleGame/GambleGame.d.ts +39 -0
  49. package/dist/components/GambleGame/GambleGame.js +44 -3
  50. package/dist/components/GambleGame/types.d.ts +5 -0
  51. package/dist/components/buttons/BaseButton/BaseButton.d.ts +73 -2
  52. package/dist/components/buttons/BaseButton/BaseButton.js +73 -2
  53. package/dist/components/buttons/BaseButton/types.d.ts +5 -0
  54. package/dist/components/buttons/buttonGroups/LeftButtons.d.ts +11 -0
  55. package/dist/components/buttons/buttonGroups/LeftButtons.js +11 -0
  56. package/dist/components/buttons/buttonGroups/LeftButtonsLandscape.d.ts +13 -1
  57. package/dist/components/buttons/buttonGroups/LeftButtonsLandscape.js +13 -1
  58. package/dist/components/buttons/buttonGroups/LeftButtonsMobile.d.ts +19 -1
  59. package/dist/components/buttons/buttonGroups/LeftButtonsMobile.js +19 -1
  60. package/dist/components/buttons/buttonGroups/MiddleButtons.d.ts +27 -2
  61. package/dist/components/buttons/buttonGroups/MiddleButtons.js +46 -3
  62. package/dist/components/buttons/buttonGroups/RightButtons.d.ts +19 -3
  63. package/dist/components/buttons/buttonGroups/RightButtons.js +29 -1
  64. package/dist/components/buttons/buttonGroups/RightButtonsLandscape.d.ts +11 -0
  65. package/dist/components/buttons/buttonGroups/RightButtonsLandscape.js +11 -0
  66. package/dist/components/buttons/buttonGroups/RightButtonsMobile.d.ts +17 -0
  67. package/dist/components/buttons/buttonGroups/RightButtonsMobile.js +17 -0
  68. package/dist/components/buttons/default/AutoplayButton.d.ts +6 -0
  69. package/dist/components/buttons/default/AutoplayButton.js +8 -1
  70. package/dist/components/buttons/default/GambleButton.d.ts +13 -0
  71. package/dist/components/buttons/default/GambleButton.js +43 -0
  72. package/dist/components/buttons/default/RefreshButton.d.ts +30 -0
  73. package/dist/components/buttons/default/RefreshButton.js +36 -3
  74. package/dist/components/buttons/default/SpeedControlButton.d.ts +2 -0
  75. package/dist/components/buttons/default/SpeedControlButton.js +2 -0
  76. package/dist/components/buttons/default/TakeButton.d.ts +13 -0
  77. package/dist/components/buttons/default/TakeButton.js +37 -0
  78. package/dist/components/buttons/default/VolumeButton.d.ts +2 -0
  79. package/dist/components/buttons/default/VolumeButton.js +2 -0
  80. package/dist/components/buttons/default/index.d.ts +2 -0
  81. package/dist/components/buttons/default/index.js +2 -0
  82. package/dist/components/buttons/registrynames.d.ts +2 -0
  83. package/dist/components/buttons/registrynames.js +3 -1
  84. package/dist/components/common/AnimatedBackground.d.ts +22 -0
  85. package/dist/components/common/AnimatedBackground.js +22 -0
  86. package/dist/components/common/AnimatedNumber.d.ts +36 -0
  87. package/dist/components/common/AnimatedNumber.js +36 -0
  88. package/dist/components/common/Background.d.ts +20 -0
  89. package/dist/components/common/Background.js +22 -1
  90. package/dist/components/common/FreeSpinButton.d.ts +33 -1
  91. package/dist/components/common/FreeSpinButton.js +37 -4
  92. package/dist/components/common/IResizableContainer.d.ts +4 -0
  93. package/dist/components/common/Logo.d.ts +21 -0
  94. package/dist/components/common/Logo.js +21 -0
  95. package/dist/components/common/LogoStatic.d.ts +10 -0
  96. package/dist/components/common/LogoStatic.js +10 -0
  97. package/dist/components/common/ResponsiveComponent.d.ts +22 -0
  98. package/dist/components/common/ResponsiveComponent.js +10 -0
  99. package/dist/components/common/ResumableContainers.d.ts +6 -0
  100. package/dist/components/common/ResumableContainers.js +6 -0
  101. package/dist/components/common/ScalableSpine.d.ts +11 -0
  102. package/dist/components/common/ScalableSpine.js +11 -0
  103. package/dist/components/frame/AbstractColumnsContainer.d.ts +20 -6
  104. package/dist/components/frame/AbstractColumnsContainer.js +18 -4
  105. package/dist/components/frame/AbstractFrame.d.ts +115 -0
  106. package/dist/components/frame/AbstractFrame.js +97 -2
  107. package/dist/components/frame/AbstractInnerFrame.d.ts +5 -0
  108. package/dist/components/frame/AbstractInnerFrame.js +5 -0
  109. package/dist/components/frame/WinLineAnimation.d.ts +10 -0
  110. package/dist/components/frame/WinLineAnimation.js +12 -1
  111. package/dist/components/frame/constants.d.ts +7 -0
  112. package/dist/components/frame/constants.js +3 -0
  113. package/dist/components/index.d.ts +1 -0
  114. package/dist/components/index.js +1 -0
  115. package/dist/components/messageBox/MessageBox.d.ts +33 -0
  116. package/dist/components/messageBox/MessageBox.js +34 -1
  117. package/dist/components/symbols/AbstractSymbolBase.d.ts +146 -2
  118. package/dist/components/symbols/AbstractSymbolBase.js +137 -14
  119. package/dist/components/symbols/AbstractSymbolsColumn.d.ts +233 -3
  120. package/dist/components/symbols/AbstractSymbolsColumn.js +220 -10
  121. package/dist/components/symbols/DroppableSymbol.d.ts +16 -0
  122. package/dist/components/symbols/DroppableSymbol.js +16 -0
  123. package/dist/components/symbols/DroppableSymbolsColumn.d.ts +51 -0
  124. package/dist/components/symbols/DroppableSymbolsColumn.js +57 -3
  125. package/dist/components/symbols/types.d.ts +8 -0
  126. package/dist/components/symbols/types.js +4 -0
  127. package/dist/components/updatable/GambleUpdatableText.d.ts +5 -0
  128. package/dist/components/updatable/GambleUpdatableText.js +5 -0
  129. package/dist/components/updatable/StylefulUpdatableText.d.ts +23 -0
  130. package/dist/components/updatable/StylefulUpdatableText.js +25 -1
  131. package/dist/components/updatable/UpdatableValueComponent.d.ts +71 -0
  132. package/dist/components/updatable/UpdatableValueComponent.js +77 -4
  133. package/dist/connectivity/ConnectionWrapper.d.ts +20 -1
  134. package/dist/connectivity/ConnectionWrapper.js +23 -3
  135. package/dist/connectivity/LocalConnectionWrapper.d.ts +2 -2
  136. package/dist/connectivity/LocalConnectionWrapper.js +2 -2
  137. package/dist/connectivity/serverConnection.d.ts +59 -0
  138. package/dist/connectivity/serverData.d.ts +3 -1
  139. package/dist/connectivity/spinData.d.ts +15 -0
  140. package/dist/connectivity/spinData.js +15 -0
  141. package/dist/constants/gamePhase.d.ts +4 -0
  142. package/dist/controllers/AbstractController.d.ts +114 -5
  143. package/dist/controllers/AbstractController.js +180 -37
  144. package/dist/controllers/QuickStopController.d.ts +3 -0
  145. package/dist/controllers/QuickStopController.js +3 -0
  146. package/dist/controllers/UiController.d.ts +163 -1
  147. package/dist/controllers/UiController.js +170 -5
  148. package/dist/errors/LanguageNotDefinedError.d.ts +4 -0
  149. package/dist/errors/LanguageNotDefinedError.js +4 -0
  150. package/dist/errors/SpineDataNotFound.d.ts +4 -0
  151. package/dist/errors/SpineDataNotFound.js +4 -0
  152. package/dist/errors/TextureNotFound.d.ts +4 -0
  153. package/dist/errors/TextureNotFound.js +4 -0
  154. package/dist/loading/AbstractLoadingContainer.d.ts +16 -0
  155. package/dist/loading/AbstractLoadingContainer.js +16 -0
  156. package/dist/loading/SpriteLoadingContainer.d.ts +18 -0
  157. package/dist/loading/SpriteLoadingContainer.js +18 -0
  158. package/dist/localStorage/localStorage.d.ts +23 -0
  159. package/dist/localStorage/localStorage.js +19 -0
  160. package/dist/stores/SettingsStore.d.ts +276 -4
  161. package/dist/stores/SettingsStore.js +309 -14
  162. package/dist/stores/types.d.ts +4 -0
  163. package/dist/utils/assets/assetGetter.js +6 -3
  164. package/dist/utils/common/deviceOrientation.js +2 -1
  165. package/dist/utils/common/functions.d.ts +57 -1
  166. package/dist/utils/common/functions.js +63 -4
  167. package/dist/utils/common/logger.js +4 -2
  168. package/dist/utils/common/placementHelpers.d.ts +14 -0
  169. package/dist/utils/common/placementHelpers.js +20 -1
  170. package/dist/utils/common/screenHelpers.d.ts +28 -0
  171. package/dist/utils/common/screenHelpers.js +34 -3
  172. package/dist/utils/common/sound.d.ts +1 -0
  173. package/dist/utils/common/sound.js +2 -0
  174. package/dist/utils/common/stats.d.ts +1 -0
  175. package/dist/utils/common/stats.js +2 -0
  176. package/dist/winComponents/AnimableParticlesEmitter.d.ts +6 -0
  177. package/dist/winComponents/AnimableParticlesEmitter.js +6 -0
  178. package/dist/winComponents/BaseWinContainer.d.ts +64 -0
  179. package/dist/winComponents/BaseWinContainer.js +66 -1
  180. package/dist/winComponents/PositioningFrame.d.ts +7 -0
  181. package/dist/winComponents/PositioningFrame.js +7 -0
  182. package/dist/winComponents/TexturedText.d.ts +23 -0
  183. package/dist/winComponents/TexturedText.js +23 -0
  184. package/dist/winComponents/UpdatableSpineContainer.d.ts +25 -0
  185. package/dist/winComponents/UpdatableSpineContainer.js +25 -0
  186. package/package.json +1 -1
@@ -18,15 +18,73 @@ export declare class SpinLogic {
18
18
  private readonly _standaloneTransformations;
19
19
  private readonly _extraData;
20
20
  constructor(spinConfig: AdaptedSpinResponse, gameConfig: ApiConfig);
21
+ /**
22
+ * Getter for post spin balance
23
+ * @public
24
+ * @returns {number} post spin balance
25
+ */
21
26
  get postSpinBalance(): number;
27
+ /**
28
+ * Getter for win total amount
29
+ * @public
30
+ * @returns {number} win total amount
31
+ */
22
32
  get winTotalAmount(): number;
33
+ /**
34
+ * Getter for win total streak amount
35
+ * @public
36
+ * @returns {number} win total streak amount
37
+ */
23
38
  get winTotalStreakAmount(): number;
39
+ /**
40
+ * Getter for win total amount without mystery wins
41
+ * @public
42
+ * @returns {number} win total amount without mystery wins
43
+ */
24
44
  get winTotalAmountWithoutMystery(): number;
45
+ /**
46
+ * Getter for on stop blinds configuration
47
+ * @public
48
+ * @returns {SymbolReels} on stop blinds configuration
49
+ */
25
50
  get onStopBlindsConfiguration(): SymbolReels;
51
+ /**
52
+ * Getter for final blinds configuration
53
+ * @public
54
+ * @returns {SymbolReels} final blinds configuration
55
+ */
26
56
  get finalBlindsConfiguration(): SymbolReels;
57
+ /**
58
+ * Getter for available free spins
59
+ * @public
60
+ * @returns {number} available free spins
61
+ */
27
62
  get availableFreeSpins(): number;
63
+ /**
64
+ * Getter for indicator if there's mystery win
65
+ * @public
66
+ * @returns {boolean} has mystery win
67
+ */
28
68
  get hasMysteryWin(): boolean;
69
+ /**
70
+ * Getter for win scenarios
71
+ * @public
72
+ * @returns {WinScenarios[]} win scenarios
73
+ */
29
74
  get winScenarios(): WinScenarios[];
75
+ /**
76
+ * Getter for standalone transformations
77
+ * @public
78
+ * @returns {TransformationDetails[][]} standalone transformations
79
+ */
30
80
  get standaloneTransformations(): TransformationDetails[][];
81
+ /**
82
+ * Getter for extra data
83
+ *
84
+ * **NOTE**: Extra data can be different between games in general, as some games have
85
+ * unique extra data structures.
86
+ * @public
87
+ * @returns {ExtraData} extra data
88
+ */
31
89
  get extraData(): ExtraData;
32
90
  }
@@ -29,38 +29,96 @@ export class SpinLogic {
29
29
  this._extraData = spinLogicReader.extraData;
30
30
  logInfo("Spin logic", JSON.parse(JSON.stringify(this)));
31
31
  }
32
+ /**
33
+ * Getter for post spin balance
34
+ * @public
35
+ * @returns {number} post spin balance
36
+ */
32
37
  get postSpinBalance() {
33
38
  return this._postSpinBalance;
34
39
  }
40
+ /**
41
+ * Getter for win total amount
42
+ * @public
43
+ * @returns {number} win total amount
44
+ */
35
45
  get winTotalAmount() {
36
46
  return this._winTotalAmount;
37
47
  }
48
+ /**
49
+ * Getter for win total streak amount
50
+ * @public
51
+ * @returns {number} win total streak amount
52
+ */
38
53
  get winTotalStreakAmount() {
39
54
  return this._winScenarios.reduce((accumulator, scenario) => accumulator +
40
55
  scenario.wins.reduce((winAccumulator, currentWin) => currentWin.type === PossibleWins.streak ? winAccumulator + currentWin.amount : winAccumulator, 0), 0);
41
56
  }
57
+ /**
58
+ * Getter for win total amount without mystery wins
59
+ * @public
60
+ * @returns {number} win total amount without mystery wins
61
+ */
42
62
  get winTotalAmountWithoutMystery() {
43
63
  return this._winScenarios.reduce((accumulator, scenario) => accumulator +
44
64
  scenario.wins.reduce((winAccumulator, currentWin) => currentWin.type === PossibleWins.mystery ? winAccumulator : winAccumulator + currentWin.amount, 0), 0);
45
65
  }
66
+ /**
67
+ * Getter for on stop blinds configuration
68
+ * @public
69
+ * @returns {SymbolReels} on stop blinds configuration
70
+ */
46
71
  get onStopBlindsConfiguration() {
47
72
  return this._onStopBlindsConfiguration;
48
73
  }
74
+ /**
75
+ * Getter for final blinds configuration
76
+ * @public
77
+ * @returns {SymbolReels} final blinds configuration
78
+ */
49
79
  get finalBlindsConfiguration() {
50
80
  return this._finalBlindsConfiguration;
51
81
  }
82
+ /**
83
+ * Getter for available free spins
84
+ * @public
85
+ * @returns {number} available free spins
86
+ */
52
87
  get availableFreeSpins() {
53
88
  return this._availableFreeSpins;
54
89
  }
90
+ /**
91
+ * Getter for indicator if there's mystery win
92
+ * @public
93
+ * @returns {boolean} has mystery win
94
+ */
55
95
  get hasMysteryWin() {
56
96
  return this._hasMysteryWin;
57
97
  }
98
+ /**
99
+ * Getter for win scenarios
100
+ * @public
101
+ * @returns {WinScenarios[]} win scenarios
102
+ */
58
103
  get winScenarios() {
59
104
  return this._winScenarios;
60
105
  }
106
+ /**
107
+ * Getter for standalone transformations
108
+ * @public
109
+ * @returns {TransformationDetails[][]} standalone transformations
110
+ */
61
111
  get standaloneTransformations() {
62
112
  return this._standaloneTransformations;
63
113
  }
114
+ /**
115
+ * Getter for extra data
116
+ *
117
+ * **NOTE**: Extra data can be different between games in general, as some games have
118
+ * unique extra data structures.
119
+ * @public
120
+ * @returns {ExtraData} extra data
121
+ */
64
122
  get extraData() {
65
123
  return this._extraData;
66
124
  }
@@ -4,22 +4,90 @@ import { AdaptedSpinResponse } from "./types";
4
4
  import { WinScenarios } from "./WinScenarios";
5
5
  /**
6
6
  * This class represents mapped data from backend
7
+ * It takes raw spin data and adapts it to the format used in the game.
8
+ * @class SpinLogicDTO
9
+ * @typedef {SpinLogicDTO}
10
+ * @property {AdaptedSpinResponse} rawData - The raw data from the backend.
11
+ * @property {ApiConfig} gameConfig - The game configuration used to map IDs.
7
12
  */
8
13
  export declare class SpinLogicDTO {
9
14
  private rawData;
10
15
  private gameConfig;
11
16
  constructor(rawData: AdaptedSpinResponse, gameConfig: ApiConfig);
17
+ /**
18
+ * Getter for updated balance
19
+ * @public
20
+ * @returns {number} updated balance
21
+ * @throws {Error} if balance is not found in ApiResponse
22
+ */
12
23
  get updatedBalance(): number;
24
+ /**
25
+ * Getter for free spins remaining
26
+ * @public
27
+ * @returns {number} free spins remaining
28
+ * @throws {Error} if available_free_spins is not found in ApiResponse
29
+ */
13
30
  get freeSpinsRemaining(): number;
31
+ /**
32
+ * Getter for total win amount
33
+ * @public
34
+ * @returns {number} total win amount
35
+ * @throws {Error} if win_amount_total is not found in ApiResponse
36
+ */
14
37
  get totalWonAmount(): number;
38
+ /**
39
+ * Getter for final blinds configuration
40
+ * This is a final configuration of symbols on reels after the spin.
41
+ * @public
42
+ * @returns {SymbolReels} final blinds configuration
43
+ * @throws {Error} if finalBlindsConfiguration is not found in ApiResponse
44
+ */
15
45
  get finalBlindsConfiguration(): SymbolReels;
46
+ /**
47
+ * Getter for on stop blinds configuration
48
+ * This is a configuration of symbols on reels when the spin stops.
49
+ * @public
50
+ * @returns {SymbolReels} on stop blinds configuration
51
+ * @throws {Error} if symbolsOnReels is not found in ApiResponse
52
+ */
16
53
  get onStopBlindsConfiguration(): SymbolReels;
54
+ /**
55
+ * Getter for extra data, which provides additional information about the spin.
56
+ * In some games, this can include information about the spin's outcome,
57
+ * such as whether it was a win, the type of win, or any special features
58
+ * that were triggered during the spin.
59
+ * @public
60
+ * @returns {ExtraData} extra data
61
+ */
17
62
  get extraData(): import("../../connectivity").ExtraData;
63
+ /**
64
+ * Getter for win scenarios
65
+ * This provides information about the wins that occurred during the spin.
66
+ * @public
67
+ * @returns {WinScenarios[]} array of win scenarios
68
+ */
18
69
  get winScenarios(): WinScenarios[];
70
+ /**
71
+ * Getter for standalone transformations
72
+ * This provides information about the transformations that occurred during the spin.
73
+ * Standalone transformations are not part of a win scenario,
74
+ * but are still important for the game logic.
75
+ * @public
76
+ * @returns {TransformationDetails[][]} array of standalone transformations
77
+ */
19
78
  get standaloneTransformations(): TransformationDetails[][];
79
+ /**
80
+ * Getter for mystery wins are in the spin
81
+ * This checks if there are any mystery wins in the spin.
82
+ * Mystery wins are special types of wins that can occur in some games,
83
+ * and they are usually triggered by specific symbols.
84
+ * @public
85
+ * @returns {boolean} whether there are mystery wins
86
+ */
20
87
  get hasMysteryWin(): boolean;
21
88
  /**
22
89
  * Function for mapping the single win from raw backend data
90
+ * @private
23
91
  * @param {WinDetails} singleWin single win from raw backend data
24
92
  * @param {number} availableFreeSpins number of available free spins (if game have free spins)
25
93
  * @returns {Win} mapped win
@@ -27,6 +95,7 @@ export declare class SpinLogicDTO {
27
95
  private getSingleWin;
28
96
  /**
29
97
  * Function for mapping wins from raw backend data
98
+ * @private
30
99
  * @param {WinWithTransformation} rawData raw data from backend
31
100
  * @param {number} availableFreeSpins number of available free spins (if game have free spins)
32
101
  * @returns {Win[]} mapped array of wins
@@ -34,6 +103,7 @@ export declare class SpinLogicDTO {
34
103
  private getWinsFromRawData;
35
104
  /**
36
105
  * Function for converting backend symbol id to frontend symbol id
106
+ * @private
37
107
  * @param {string} symbol backend symbol id
38
108
  * @returns {SymbolId} frontend symbol id
39
109
  */
@@ -3,6 +3,11 @@ import { RainMan } from "../../Rainman";
3
3
  import { WinScenarios } from "./WinScenarios";
4
4
  /**
5
5
  * This class represents mapped data from backend
6
+ * It takes raw spin data and adapts it to the format used in the game.
7
+ * @class SpinLogicDTO
8
+ * @typedef {SpinLogicDTO}
9
+ * @property {AdaptedSpinResponse} rawData - The raw data from the backend.
10
+ * @property {ApiConfig} gameConfig - The game configuration used to map IDs.
6
11
  */
7
12
  export class SpinLogicDTO {
8
13
  rawData;
@@ -11,6 +16,12 @@ export class SpinLogicDTO {
11
16
  this.rawData = rawData;
12
17
  this.gameConfig = gameConfig;
13
18
  }
19
+ /**
20
+ * Getter for updated balance
21
+ * @public
22
+ * @returns {number} updated balance
23
+ * @throws {Error} if balance is not found in ApiResponse
24
+ */
14
25
  get updatedBalance() {
15
26
  try {
16
27
  return this.rawData.balance;
@@ -19,6 +30,12 @@ export class SpinLogicDTO {
19
30
  throw new Error("No balance found in ApiResponse!");
20
31
  }
21
32
  }
33
+ /**
34
+ * Getter for free spins remaining
35
+ * @public
36
+ * @returns {number} free spins remaining
37
+ * @throws {Error} if available_free_spins is not found in ApiResponse
38
+ */
22
39
  get freeSpinsRemaining() {
23
40
  try {
24
41
  return this.rawData.availableFreeSpins;
@@ -27,6 +44,12 @@ export class SpinLogicDTO {
27
44
  throw new Error("No available_free_spins found in ApiResponse!");
28
45
  }
29
46
  }
47
+ /**
48
+ * Getter for total win amount
49
+ * @public
50
+ * @returns {number} total win amount
51
+ * @throws {Error} if win_amount_total is not found in ApiResponse
52
+ */
30
53
  get totalWonAmount() {
31
54
  try {
32
55
  return this.rawData.winAmountTotal;
@@ -35,32 +58,77 @@ export class SpinLogicDTO {
35
58
  throw new Error("No win_amount_total found in ApiResponse!");
36
59
  }
37
60
  }
61
+ /**
62
+ * Getter for final blinds configuration
63
+ * This is a final configuration of symbols on reels after the spin.
64
+ * @public
65
+ * @returns {SymbolReels} final blinds configuration
66
+ * @throws {Error} if finalBlindsConfiguration is not found in ApiResponse
67
+ */
38
68
  get finalBlindsConfiguration() {
39
69
  return this.rawData.finalBlindsConfiguration.map((reel) => reel.map((symbol) => this.stringToSymbolId(symbol)));
40
70
  }
71
+ /**
72
+ * Getter for on stop blinds configuration
73
+ * This is a configuration of symbols on reels when the spin stops.
74
+ * @public
75
+ * @returns {SymbolReels} on stop blinds configuration
76
+ * @throws {Error} if symbolsOnReels is not found in ApiResponse
77
+ */
41
78
  get onStopBlindsConfiguration() {
42
79
  return this.rawData.symbolsOnReels.map((reel) => reel.map((symbol) => this.stringToSymbolId(symbol)));
43
80
  }
81
+ /**
82
+ * Getter for extra data, which provides additional information about the spin.
83
+ * In some games, this can include information about the spin's outcome,
84
+ * such as whether it was a win, the type of win, or any special features
85
+ * that were triggered during the spin.
86
+ * @public
87
+ * @returns {ExtraData} extra data
88
+ */
44
89
  get extraData() {
45
90
  return this.rawData.extraData;
46
91
  }
92
+ /**
93
+ * Getter for win scenarios
94
+ * This provides information about the wins that occurred during the spin.
95
+ * @public
96
+ * @returns {WinScenarios[]} array of win scenarios
97
+ */
47
98
  get winScenarios() {
48
99
  const { results, availableFreeSpins } = this.rawData;
49
100
  if (results === undefined)
50
101
  return [];
51
102
  return results.map((result) => new WinScenarios(this.getWinsFromRawData(result, availableFreeSpins), result.transformations));
52
103
  }
104
+ /**
105
+ * Getter for standalone transformations
106
+ * This provides information about the transformations that occurred during the spin.
107
+ * Standalone transformations are not part of a win scenario,
108
+ * but are still important for the game logic.
109
+ * @public
110
+ * @returns {TransformationDetails[][]} array of standalone transformations
111
+ */
53
112
  get standaloneTransformations() {
54
113
  const { standaloneTransformations } = this.rawData;
55
114
  if (!standaloneTransformations)
56
115
  return [];
57
116
  return standaloneTransformations;
58
117
  }
118
+ /**
119
+ * Getter for mystery wins are in the spin
120
+ * This checks if there are any mystery wins in the spin.
121
+ * Mystery wins are special types of wins that can occur in some games,
122
+ * and they are usually triggered by specific symbols.
123
+ * @public
124
+ * @returns {boolean} whether there are mystery wins
125
+ */
59
126
  get hasMysteryWin() {
60
127
  return this.winScenarios.some((winScenario) => winScenario.wins.some((win) => win.type === PossibleWins.mystery));
61
128
  }
62
129
  /**
63
130
  * Function for mapping the single win from raw backend data
131
+ * @private
64
132
  * @param {WinDetails} singleWin single win from raw backend data
65
133
  * @param {number} availableFreeSpins number of available free spins (if game have free spins)
66
134
  * @returns {Win} mapped win
@@ -84,6 +152,7 @@ export class SpinLogicDTO {
84
152
  }
85
153
  /**
86
154
  * Function for mapping wins from raw backend data
155
+ * @private
87
156
  * @param {WinWithTransformation} rawData raw data from backend
88
157
  * @param {number} availableFreeSpins number of available free spins (if game have free spins)
89
158
  * @returns {Win[]} mapped array of wins
@@ -93,6 +162,7 @@ export class SpinLogicDTO {
93
162
  }
94
163
  /**
95
164
  * Function for converting backend symbol id to frontend symbol id
165
+ * @private
96
166
  * @param {string} symbol backend symbol id
97
167
  * @returns {SymbolId} frontend symbol id
98
168
  */
@@ -1,11 +1,23 @@
1
1
  import { TransformationDetails, Win } from "../../connectivity";
2
2
  /**
3
3
  * This class represents win and transformation scenarios described in {@link transformationTypes} and {@link PossibleWins}
4
+ * @class WinScenarios
5
+ * @typedef {WinScenarios}
4
6
  */
5
7
  export declare class WinScenarios {
6
8
  private readonly _wins;
7
9
  private readonly _transformations;
8
10
  constructor(wins: Win[], transformations: TransformationDetails[]);
11
+ /**
12
+ * Getter for wins
13
+ * @public
14
+ * @returns {Win[]} array of wins
15
+ */
9
16
  get wins(): Win[];
17
+ /**
18
+ * Getter for transformations
19
+ * @public
20
+ * @returns {TransformationDetails[]} array of transformations
21
+ */
10
22
  get transformations(): TransformationDetails[];
11
23
  }
@@ -1,5 +1,7 @@
1
1
  /**
2
2
  * This class represents win and transformation scenarios described in {@link transformationTypes} and {@link PossibleWins}
3
+ * @class WinScenarios
4
+ * @typedef {WinScenarios}
3
5
  */
4
6
  export class WinScenarios {
5
7
  _wins;
@@ -8,9 +10,19 @@ export class WinScenarios {
8
10
  this._wins = wins;
9
11
  this._transformations = transformations;
10
12
  }
13
+ /**
14
+ * Getter for wins
15
+ * @public
16
+ * @returns {Win[]} array of wins
17
+ */
11
18
  get wins() {
12
19
  return this._wins;
13
20
  }
21
+ /**
22
+ * Getter for transformations
23
+ * @public
24
+ * @returns {TransformationDetails[]} array of transformations
25
+ */
14
26
  get transformations() {
15
27
  return this._transformations;
16
28
  }
@@ -1,4 +1,14 @@
1
1
  import { ExtraData, SymbolReels, TransformationDetails, WinWithTransformation } from "../../connectivity";
2
+ /**
3
+ * Type for adapted spin response
4
+ * This type represents the structure of the spin response
5
+ * that is adapted from the backend to the format used in the game.
6
+ * It includes information about the spin action, balance, available free spins,
7
+ * symbols on reels, final blinds configuration, total win amount,
8
+ * results of the spin with transformations, standalone transformations,
9
+ * and extra data.
10
+ * @typedef {AdaptedSpinResponse}
11
+ */
2
12
  export type AdaptedSpinResponse = {
3
13
  action: string;
4
14
  balance: number;
@@ -1,6 +1,16 @@
1
+ /**
2
+ * Interface for incentive components
3
+ * This is used by refresh button to have spinning effect with arrows
4
+ * @typedef {IncentiveComponent}
5
+ */
1
6
  export interface IncentiveComponent {
2
7
  name: string;
3
8
  initIncentiveAction: (incentiveJobFlag: Record<string, boolean>, afterAllDoneCallback: () => void) => void;
4
9
  animate: () => void;
5
10
  }
11
+ /**
12
+ * Type guard for incentive components
13
+ * @param {unknown} obj object to check
14
+ * @returns {boolean} whether the object is a valid IncentiveComponent
15
+ */
6
16
  export declare const isIncentiveComponentInterface: (obj: unknown) => obj is IncentiveComponent;
@@ -1,9 +1,17 @@
1
1
  import { z } from "zod";
2
+ /**
3
+ * Schema for incentive components
4
+ */
2
5
  const incentiveComponentSchema = z.object({
3
6
  name: z.string(),
4
7
  initIncentiveAction: z.function().args(z.record(z.boolean()), z.function()),
5
- animate: z.function(),
8
+ animate: z.function()
6
9
  });
10
+ /**
11
+ * Type guard for incentive components
12
+ * @param {unknown} obj object to check
13
+ * @returns {boolean} whether the object is a valid IncentiveComponent
14
+ */
7
15
  export const isIncentiveComponentInterface = (obj) => {
8
16
  return incentiveComponentSchema.safeParse(obj).success;
9
17
  };
@@ -1,14 +1,51 @@
1
1
  import { IncentiveComponent } from "./IncentiveComponent";
2
+ /**
3
+ * Controller for managing timed incentive actions
4
+ * @class TimedIncentiveController
5
+ * @typedef {TimedIncentiveController}
6
+ */
2
7
  export declare class TimedIncentiveController {
3
8
  private recentActivityTime;
4
9
  private timerTicker;
5
10
  private timer;
6
11
  private readonly incentiveComponents;
7
12
  constructor();
13
+ /**
14
+ * Updates the last time the user clicked
15
+ * @public
16
+ * @returns {void}
17
+ */
8
18
  updateLastTimeClicked(): void;
19
+ /**
20
+ * Animates all incentive components
21
+ * @public
22
+ * @returns {void}
23
+ */
9
24
  animateAll(): void;
25
+ /**
26
+ * Adds a new incentive component
27
+ * @public
28
+ * @param {IncentiveComponent} component component to add
29
+ * @returns {void}
30
+ */
10
31
  addComponent(component: IncentiveComponent): void;
32
+ /**
33
+ * Removes an incentive component
34
+ * @public
35
+ * @param {IncentiveComponent} component component to remove
36
+ * @returns {void}
37
+ */
11
38
  removeComponent(component: IncentiveComponent): void;
39
+ /**
40
+ * Handles the timed event
41
+ * @private
42
+ * @returns {void}
43
+ */
12
44
  private timedEvent;
45
+ /**
46
+ * Stops the timer ticker
47
+ * @private
48
+ * @returns {void}
49
+ */
13
50
  private stopTicker;
14
51
  }
@@ -1,5 +1,10 @@
1
1
  import { Ticker } from "pixi.js";
2
2
  import { RainMan } from "../../Rainman";
3
+ /**
4
+ * Controller for managing timed incentive actions
5
+ * @class TimedIncentiveController
6
+ * @typedef {TimedIncentiveController}
7
+ */
3
8
  export class TimedIncentiveController {
4
9
  recentActivityTime = performance.now();
5
10
  timerTicker = new Ticker();
@@ -11,9 +16,19 @@ export class TimedIncentiveController {
11
16
  this.timer = setInterval(this.timedEvent.bind(this), RainMan.config.idleTimeout);
12
17
  this.timerTicker.add(this.animateAll, this);
13
18
  }
19
+ /**
20
+ * Updates the last time the user clicked
21
+ * @public
22
+ * @returns {void}
23
+ */
14
24
  updateLastTimeClicked() {
15
25
  this.recentActivityTime = performance.now();
16
26
  }
27
+ /**
28
+ * Animates all incentive components
29
+ * @public
30
+ * @returns {void}
31
+ */
17
32
  animateAll() {
18
33
  Object.values(this.incentiveComponents).forEach((incentiveComponent) => {
19
34
  if (incentiveComponent !== null) {
@@ -21,14 +36,31 @@ export class TimedIncentiveController {
21
36
  }
22
37
  });
23
38
  }
39
+ /**
40
+ * Adds a new incentive component
41
+ * @public
42
+ * @param {IncentiveComponent} component component to add
43
+ * @returns {void}
44
+ */
24
45
  addComponent(component) {
25
46
  this.incentiveComponents[component.name] = component;
26
47
  }
48
+ /**
49
+ * Removes an incentive component
50
+ * @public
51
+ * @param {IncentiveComponent} component component to remove
52
+ * @returns {void}
53
+ */
27
54
  removeComponent(component) {
28
55
  if (this.incentiveComponents[component.name]) {
29
56
  this.incentiveComponents[component.name] = null;
30
57
  }
31
58
  }
59
+ /**
60
+ * Handles the timed event
61
+ * @private
62
+ * @returns {void}
63
+ */
32
64
  timedEvent() {
33
65
  const now = performance.now();
34
66
  const secondsElapsedFromLastUserActivity = Math.abs((this.recentActivityTime - now) / 1000);
@@ -44,6 +76,11 @@ export class TimedIncentiveController {
44
76
  });
45
77
  }
46
78
  }
79
+ /**
80
+ * Stops the timer ticker
81
+ * @private
82
+ * @returns {void}
83
+ */
47
84
  stopTicker() {
48
85
  this.timerTicker.stop();
49
86
  }
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * This function is for setup the whole games
3
- *
4
3
  * Note: This should be done once at the lifecycle of the game
5
4
  * Function creates also the react layer
6
5
  * @returns {ReactNode} the root element with canvas and react layer
@@ -4,7 +4,6 @@ import { SettingsUI } from "../SettingsUI";
4
4
  import { changeResolution, disableMagnifyingGlassOnIOS, getDeviceOrientation, invokeStatsBoard, loadSoundsOnTabChange, resizeCanvas, setupFullscreenForIOS } from "../utils";
5
5
  /**
6
6
  * This function is for setup the whole games
7
- *
8
7
  * Note: This should be done once at the lifecycle of the game
9
8
  * Function creates also the react layer
10
9
  * @returns {ReactNode} the root element with canvas and react layer