@energy8platform/game-engine 0.22.0 → 0.24.0
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.
- package/dist/core.cjs.js +2 -2
- package/dist/core.cjs.js.map +1 -1
- package/dist/core.d.ts +3 -3
- package/dist/core.esm.js +2 -2
- package/dist/core.esm.js.map +1 -1
- package/dist/host.cjs.js +35 -10
- package/dist/host.cjs.js.map +1 -1
- package/dist/host.d.ts +22 -9
- package/dist/host.esm.js +24 -11
- package/dist/host.esm.js.map +1 -1
- package/dist/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.esm.js +2 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/shell.cjs.js +4 -4
- package/dist/shell.d.ts +1 -1
- package/dist/shell.esm.js +1 -1
- package/dist/slot.cjs.js +226 -75
- package/dist/slot.cjs.js.map +1 -1
- package/dist/slot.d.ts +137 -19
- package/dist/slot.esm.js +224 -76
- package/dist/slot.esm.js.map +1 -1
- package/package.json +4 -4
- package/src/core/GameApplication.ts +3 -3
- package/src/host/createSlotGame.ts +6 -3
- package/src/host/index.ts +11 -1
- package/src/host/shellConfig.ts +22 -12
- package/src/host/types.ts +13 -2
- package/src/shell/index.ts +4 -3
- package/src/slot/cascade/TumbleController.ts +6 -3
- package/src/slot/config/ReelSystemConfig.ts +19 -0
- package/src/slot/features/extra.ts +1 -2
- package/src/slot/features/symbols.ts +10 -10
- package/src/slot/features/types.ts +13 -5
- package/src/slot/features/wilds.ts +1 -1
- package/src/slot/grid/AnimatedSymbol.ts +20 -11
- package/src/slot/grid/ReelGrid.ts +80 -41
- package/src/slot/grid/SymbolCell.ts +14 -7
- package/src/slot/grid/SymbolView.ts +2 -2
- package/src/slot/grid/geometry.ts +155 -0
- package/src/slot/index.ts +3 -0
- package/src/slot/motion/SpinEngine.ts +1 -1
- package/src/slot/system/ReelSystem.ts +10 -0
- package/src/types.ts +1 -1
package/dist/slot.d.ts
CHANGED
|
@@ -5,8 +5,11 @@ interface SymbolView extends Container {
|
|
|
5
5
|
playIdle?(): void;
|
|
6
6
|
playWin?(): Promise<void>;
|
|
7
7
|
showStatic?(): void;
|
|
8
|
-
/** Resize the symbol to the given cell size in pixels. */
|
|
9
|
-
resize?(size: number
|
|
8
|
+
/** Resize the symbol to the given cell size in pixels (square scalar or rectangular). */
|
|
9
|
+
resize?(size: number | {
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
}): void;
|
|
10
13
|
}
|
|
11
14
|
/** Game-supplied factory: build the view for a symbol id (sprite / layered sprites / Spine / composite). */
|
|
12
15
|
type SymbolResolver = (symbolId: string) => SymbolView | null;
|
|
@@ -18,7 +21,10 @@ interface SymbolTextures {
|
|
|
18
21
|
}
|
|
19
22
|
interface AnimatedSymbolConfig {
|
|
20
23
|
textures: SymbolTextures;
|
|
21
|
-
size: number
|
|
24
|
+
size: number | {
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
};
|
|
22
28
|
fps?: number;
|
|
23
29
|
}
|
|
24
30
|
/** Built-in SymbolView: a static base sprite with optional idle/win spritesheet frames. */
|
|
@@ -26,11 +32,15 @@ declare class AnimatedSymbol extends Container implements SymbolView {
|
|
|
26
32
|
private _base;
|
|
27
33
|
private _anim;
|
|
28
34
|
private _textures;
|
|
29
|
-
private
|
|
35
|
+
private _w;
|
|
36
|
+
private _h;
|
|
30
37
|
private _fps;
|
|
31
38
|
constructor(config: AnimatedSymbolConfig);
|
|
32
39
|
setTextures(t: SymbolTextures): void;
|
|
33
|
-
resize(size: number
|
|
40
|
+
resize(size: number | {
|
|
41
|
+
width: number;
|
|
42
|
+
height: number;
|
|
43
|
+
}): void;
|
|
34
44
|
showStatic(): void;
|
|
35
45
|
playIdle(): void;
|
|
36
46
|
playWin(): Promise<void>;
|
|
@@ -70,13 +80,18 @@ interface CellState {
|
|
|
70
80
|
fresh?: boolean;
|
|
71
81
|
}
|
|
72
82
|
interface SymbolCellConfig {
|
|
73
|
-
size
|
|
83
|
+
/** Square scalar or rectangular cell size in px. */
|
|
84
|
+
size: number | {
|
|
85
|
+
width: number;
|
|
86
|
+
height: number;
|
|
87
|
+
};
|
|
74
88
|
resolve: SymbolResolver;
|
|
75
89
|
frameStyle?: CellFrameStyle;
|
|
76
90
|
}
|
|
77
91
|
declare class SymbolCell extends Container {
|
|
78
92
|
readonly __uiComponent: true;
|
|
79
|
-
private
|
|
93
|
+
private _w;
|
|
94
|
+
private _h;
|
|
80
95
|
private _resolve;
|
|
81
96
|
private _style;
|
|
82
97
|
private _frame;
|
|
@@ -99,6 +114,64 @@ declare class SymbolCell extends Container {
|
|
|
99
114
|
private _badge;
|
|
100
115
|
}
|
|
101
116
|
|
|
117
|
+
/** Per-strip cell size override: a square scalar, or an explicit width/height. */
|
|
118
|
+
type CellSizeSpec = number | {
|
|
119
|
+
width: number;
|
|
120
|
+
height: number;
|
|
121
|
+
};
|
|
122
|
+
/** Structural input any grid config (GridConfig / ReelGridConfig) satisfies. */
|
|
123
|
+
interface GeometryInput {
|
|
124
|
+
cols: number;
|
|
125
|
+
/** Uniform row count. Ignored when `rowsPerReel` is set (and length matches `cols`). */
|
|
126
|
+
rows: number;
|
|
127
|
+
rowsPerReel?: number[];
|
|
128
|
+
/** Square cell size (shorthand: same width & height, all reels). */
|
|
129
|
+
cellSize: number;
|
|
130
|
+
/** Rectangular cells, uniform across reels. Override `cellSize`. */
|
|
131
|
+
cellWidth?: number;
|
|
132
|
+
cellHeight?: number;
|
|
133
|
+
/** Per-strip cell size (square scalar or {width,height}). Overrides the above for that reel. */
|
|
134
|
+
cellSizePerReel?: CellSizeSpec[];
|
|
135
|
+
/** Uniform gap (shorthand for both axes). */
|
|
136
|
+
gap?: number;
|
|
137
|
+
/** Horizontal gap between adjacent reels. Scalar, or per-boundary (length cols-1). */
|
|
138
|
+
colGap?: number | number[];
|
|
139
|
+
/** Vertical gap between rows. Scalar, or per-reel (length cols). */
|
|
140
|
+
rowGap?: number | number[];
|
|
141
|
+
}
|
|
142
|
+
interface ResolvedGeometry {
|
|
143
|
+
cols: number;
|
|
144
|
+
rowsPerReel: number[];
|
|
145
|
+
maxRows: number;
|
|
146
|
+
/** Per-reel cell width / height (px). */
|
|
147
|
+
cellW: number[];
|
|
148
|
+
cellH: number[];
|
|
149
|
+
/** Per-reel vertical gap between rows (px). */
|
|
150
|
+
rowGap: number[];
|
|
151
|
+
/** Horizontal gap between reel i and i+1 (px), length cols-1. */
|
|
152
|
+
colGap: number[];
|
|
153
|
+
/** Cell-centre X of each reel (px). */
|
|
154
|
+
colX: number[];
|
|
155
|
+
/** Row-0 cell-centre Y of each reel (px) — centring offset baked in. */
|
|
156
|
+
yOff: number[];
|
|
157
|
+
/** Total grid bounding size (px). */
|
|
158
|
+
gridW: number;
|
|
159
|
+
gridH: number;
|
|
160
|
+
/** Grid bounding-box centre in local coords (px). */
|
|
161
|
+
centerX: number;
|
|
162
|
+
centerY: number;
|
|
163
|
+
/** Top-left corner of the grid bounding box in local coords (px). */
|
|
164
|
+
leftX: number;
|
|
165
|
+
topY: number;
|
|
166
|
+
}
|
|
167
|
+
/** Resolve a grid config into a fully-populated per-reel geometry. */
|
|
168
|
+
declare function resolveGeometry(g: GeometryInput): ResolvedGeometry;
|
|
169
|
+
/** Cell-centre position from a resolved geometry. */
|
|
170
|
+
declare function cellPositionOf(geom: ResolvedGeometry, col: number, row: number): {
|
|
171
|
+
x: number;
|
|
172
|
+
y: number;
|
|
173
|
+
};
|
|
174
|
+
|
|
102
175
|
interface DecorationConfig {
|
|
103
176
|
texture?: Texture;
|
|
104
177
|
padding?: number;
|
|
@@ -109,48 +182,80 @@ interface ReelGridConfig {
|
|
|
109
182
|
rows: number;
|
|
110
183
|
/** Per-reel row counts for Megaways / variable-height reels. Length must equal `cols`. */
|
|
111
184
|
rowsPerReel?: number[];
|
|
185
|
+
/** Square cell size (shorthand: same width & height, all reels). */
|
|
112
186
|
cellSize: number;
|
|
187
|
+
/** Rectangular cells, uniform across reels. Override `cellSize` when set. */
|
|
188
|
+
cellWidth?: number;
|
|
189
|
+
cellHeight?: number;
|
|
190
|
+
/** Per-strip cell size (square scalar or {width,height}). */
|
|
191
|
+
cellSizePerReel?: CellSizeSpec[];
|
|
192
|
+
/** Uniform gap (shorthand for both axes). */
|
|
113
193
|
gap?: number;
|
|
194
|
+
/** Horizontal gap between adjacent reels. Scalar, or per-boundary (length cols-1). */
|
|
195
|
+
colGap?: number | number[];
|
|
196
|
+
/** Vertical gap between rows. Scalar, or per-reel (length cols). */
|
|
197
|
+
rowGap?: number | number[];
|
|
114
198
|
resolve: SymbolResolver;
|
|
115
199
|
frameStyle?: CellFrameStyle;
|
|
116
200
|
decoration?: DecorationConfig;
|
|
117
201
|
mask?: boolean;
|
|
118
202
|
}
|
|
119
203
|
/**
|
|
120
|
-
* A grid of `SymbolCell`s. Supports uniform grids
|
|
121
|
-
*
|
|
204
|
+
* A grid of `SymbolCell`s. Supports uniform grids, variable-height reels (Megaways), and
|
|
205
|
+
* rectangular / per-strip cell sizes with per-strip gaps. All layout flows through a single
|
|
206
|
+
* resolved geometry (see grid/geometry.ts); every consumer reads positions via `cellPosition`
|
|
207
|
+
* and dimensions via `cellSize(col)` rather than assuming a square cell.
|
|
122
208
|
*/
|
|
123
209
|
declare class ReelGrid extends Container {
|
|
124
210
|
readonly __uiComponent: true;
|
|
125
|
-
private
|
|
126
|
-
private
|
|
127
|
-
private _maxRows;
|
|
128
|
-
private _cellSize;
|
|
129
|
-
private _gap;
|
|
211
|
+
private _cfg;
|
|
212
|
+
private _geom;
|
|
130
213
|
private _cells;
|
|
131
214
|
private _cellLayer;
|
|
132
215
|
private _resolve;
|
|
133
216
|
private _frameStyle?;
|
|
134
217
|
private _mask;
|
|
135
218
|
constructor(config: ReelGridConfig);
|
|
219
|
+
private get _cols();
|
|
220
|
+
private get _rowsPerReel();
|
|
136
221
|
private _buildCells;
|
|
222
|
+
/** Per-strip mask: one window per reel sized to that reel's own cell width × column height. */
|
|
137
223
|
private _applyMask;
|
|
138
224
|
get cols(): number;
|
|
139
225
|
/** Tallest reel's row count (the grid's visual height in rows). */
|
|
140
226
|
get rows(): number;
|
|
141
|
-
|
|
227
|
+
/** Cell dimensions (px) for a reel. Rectangular / per-strip aware. */
|
|
228
|
+
cellSize(col: number): {
|
|
229
|
+
width: number;
|
|
230
|
+
height: number;
|
|
231
|
+
};
|
|
232
|
+
/** The fully-resolved grid geometry (read-only view). */
|
|
233
|
+
get geometry(): ResolvedGeometry;
|
|
142
234
|
rowsOf(col: number): number;
|
|
143
235
|
get rowsPerReel(): number[];
|
|
144
|
-
/** Cell centre position. Variable-height reels are centred
|
|
236
|
+
/** Cell centre position. Variable-height reels are centred about a shared centre line. */
|
|
145
237
|
cellPosition(col: number, row: number): {
|
|
146
238
|
x: number;
|
|
147
239
|
y: number;
|
|
148
240
|
};
|
|
241
|
+
/** Grid bounding-box centre in local coords. */
|
|
242
|
+
center(): {
|
|
243
|
+
x: number;
|
|
244
|
+
y: number;
|
|
245
|
+
};
|
|
149
246
|
getCell(col: number, row: number): SymbolCell;
|
|
150
247
|
setGrid(cells: CellData[][]): void;
|
|
151
248
|
/** Rebuild the grid with new per-reel row counts (Megaways re-roll / dynamic rows). */
|
|
152
249
|
reshape(rowsPerReel: number[]): void;
|
|
153
|
-
|
|
250
|
+
/**
|
|
251
|
+
* Re-resolve geometry after a base cell-size change and reposition cells. Accepts a square
|
|
252
|
+
* scalar (updates `cellSize`) or explicit `{width,height}`. Per-strip overrides still apply.
|
|
253
|
+
* (Cell frames are not re-drawn here — a geometry change routes through a full rebuild upstream.)
|
|
254
|
+
*/
|
|
255
|
+
resize(size: number | {
|
|
256
|
+
width: number;
|
|
257
|
+
height: number;
|
|
258
|
+
}): void;
|
|
154
259
|
}
|
|
155
260
|
|
|
156
261
|
interface CascadeStepData {
|
|
@@ -266,8 +371,19 @@ interface GridConfig {
|
|
|
266
371
|
rows: number;
|
|
267
372
|
/** Per-reel row counts (Megaways / variable-height reels). Length should equal `cols`. */
|
|
268
373
|
rowsPerReel?: number[];
|
|
374
|
+
/** Square cell size (shorthand: same width & height, all reels). */
|
|
269
375
|
cellSize: number;
|
|
376
|
+
/** Rectangular cells, uniform across reels. Override `cellSize` when set. */
|
|
377
|
+
cellWidth?: number;
|
|
378
|
+
cellHeight?: number;
|
|
379
|
+
/** Per-strip cell size (square scalar or {width,height}). Overrides the above for that reel. */
|
|
380
|
+
cellSizePerReel?: CellSizeSpec[];
|
|
381
|
+
/** Uniform gap (shorthand for both axes). */
|
|
270
382
|
gap: number;
|
|
383
|
+
/** Horizontal gap between adjacent reels. Scalar, or per-boundary (length cols-1). Overrides `gap`. */
|
|
384
|
+
colGap?: number | number[];
|
|
385
|
+
/** Vertical gap between rows. Scalar, or per-reel (length cols). Overrides `gap`. */
|
|
386
|
+
rowGap?: number | number[];
|
|
271
387
|
evaluation: EvaluationMode;
|
|
272
388
|
/** For Megaways: clamp per-reel rows to [minRows, maxRows]. */
|
|
273
389
|
minRows?: number;
|
|
@@ -557,6 +673,8 @@ declare function mergeReelConfig<T>(base: T, partial?: DeepPartial<T>): T;
|
|
|
557
673
|
declare function resolveReelConfig(partial?: DeepPartial<ReelSystemConfig>): ReelSystemConfig;
|
|
558
674
|
/** Effective per-reel row counts (resolves Megaways `rowsPerReel`, else uniform `rows`). */
|
|
559
675
|
declare function effectiveRowsPerReel(grid: GridConfig): number[];
|
|
676
|
+
/** Resolve a `GridConfig` into a fully-populated per-reel geometry (rectangular / per-strip aware). */
|
|
677
|
+
declare function resolveGridGeometry(grid: GridConfig): ResolvedGeometry;
|
|
560
678
|
/** Total ways-to-win for a ways/megaways grid (product of per-reel heights). */
|
|
561
679
|
declare function waysCount(grid: GridConfig): number;
|
|
562
680
|
|
|
@@ -856,5 +974,5 @@ declare class MultiplierAccumulator {
|
|
|
856
974
|
reset(boundary: CarryPolicy): void;
|
|
857
975
|
}
|
|
858
976
|
|
|
859
|
-
export { AnimatedSymbol, AnticipationController, BigWinOverlay, CascadeController, CountUpDisplay, DEFAULT_REEL_CONFIG, EASING_BY_NAME, FEATURES, FEATURE_KEYS, FEATURE_LIST, INTENSITY_SCALE, MultiplierAccumulator, PRESETS, PRESET_LIST, ReelGrid, ReelSpinController, SpinEngine, SymbolCell, TumbleController, createReelSystem, easingByName, effectiveRowsPerReel, mergeReelConfig, pickTier, resolveReelConfig, tierIndexAtValue, valueAt, waysCount };
|
|
860
|
-
export type { AnimatedSymbolConfig, AnticipationConfig, AnticipationDecision, BigWinOverlayConfig, BlurConfig, CarryPolicy, CascadeAnim, CascadeConfig, CascadeStepData, CascadeTimings, CellData, CellFrameStyle, CellState, CountUpConfig, CreateReelSystemOptions, DecorationConfig, DeepPartial, EasingName, EvaluationMode, ExpandingWildConfig, FeatureContext, FeatureKey, FeaturesConfig, GiantConfig, GridConfig, HoldAndSpinConfig, Intensity, MotionConfig, MotionStyle, MultiplierConfig, MysteryConfig, NudgeConfig, PresetId, RandomWildConfig, ReelFeature, ReelGridConfig, ReelModifierConfig, ReelPreset, ReelSpinData, ReelSpinTimings, ReelStopPlan$1 as ReelStopPlan, ReelSystem, ReelSystemConfig, SettleConfig, SpinData, SpinRunOpts, ReelStopPlan as SpinStopPlan, SplitConfig, SquashConfig, StackedConfig, StickyConfig, StopMode, StopOrder, SymbolCellConfig, SymbolResolver, SymbolTextures, SymbolView, TransformConfig, TumbleStep, WalkingWildConfig, WinConfig, WinTier };
|
|
977
|
+
export { AnimatedSymbol, AnticipationController, BigWinOverlay, CascadeController, CountUpDisplay, DEFAULT_REEL_CONFIG, EASING_BY_NAME, FEATURES, FEATURE_KEYS, FEATURE_LIST, INTENSITY_SCALE, MultiplierAccumulator, PRESETS, PRESET_LIST, ReelGrid, ReelSpinController, SpinEngine, SymbolCell, TumbleController, cellPositionOf, createReelSystem, easingByName, effectiveRowsPerReel, mergeReelConfig, pickTier, resolveGeometry, resolveGridGeometry, resolveReelConfig, tierIndexAtValue, valueAt, waysCount };
|
|
978
|
+
export type { AnimatedSymbolConfig, AnticipationConfig, AnticipationDecision, BigWinOverlayConfig, BlurConfig, CarryPolicy, CascadeAnim, CascadeConfig, CascadeStepData, CascadeTimings, CellData, CellFrameStyle, CellSizeSpec, CellState, CountUpConfig, CreateReelSystemOptions, DecorationConfig, DeepPartial, EasingName, EvaluationMode, ExpandingWildConfig, FeatureContext, FeatureKey, FeaturesConfig, GeometryInput, GiantConfig, GridConfig, HoldAndSpinConfig, Intensity, MotionConfig, MotionStyle, MultiplierConfig, MysteryConfig, NudgeConfig, PresetId, RandomWildConfig, ReelFeature, ReelGridConfig, ReelModifierConfig, ReelPreset, ReelSpinData, ReelSpinTimings, ReelStopPlan$1 as ReelStopPlan, ReelSystem, ReelSystemConfig, ResolvedGeometry, SettleConfig, SpinData, SpinRunOpts, ReelStopPlan as SpinStopPlan, SplitConfig, SquashConfig, StackedConfig, StickyConfig, StopMode, StopOrder, SymbolCellConfig, SymbolResolver, SymbolTextures, SymbolView, TransformConfig, TumbleStep, WalkingWildConfig, WinConfig, WinTier };
|