import { Win } from '../config/types.js'; import { ReelSet } from '../core/ReelSet.js'; import { SymbolPosition } from '../events/ReelEvents.js'; import { ReelSymbol } from '../symbols/ReelSymbol.js'; import { Disposable } from '../utils/Disposable.js'; /** * What to play on each cell being highlighted. * * - `'win'`. default. Calls `symbol.playWin()` (your subclass's hook). * - `string`. a named animation. If the symbol exposes a * `playAnimation(name)` method (e.g. SpineSymbol), it's invoked; else * it falls back to `playWin()`. * - `(symbol, cell, win) => Promise`. drive the animation * yourself. Good for GSAP bounces, line-specific pulses, etc. */ export type WinSymbolAnim = 'win' | string | ((symbol: ReelSymbol, cell: SymbolPosition, win: Win) => Promise); export interface WinPresenterOptions { /** * Fade non-winning symbols to this alpha while a win is active. * - `true` (default) → alpha 0.35 * - number → that alpha * - `false` → don't touch non-winners * * Restored on `win:end`. */ dimLosers?: boolean | { alpha?: number; }; /** See {@link WinSymbolAnim}. Default `'win'`. */ symbolAnim?: WinSymbolAnim; /** * Delay between cells *within* a single win (ms). * - `0` (default) → all cells animate simultaneously * - `> 0` → cells start one after another in array order (e.g. a * left-to-right sweep across a payline's cells) */ stagger?: number; /** Delay between successive wins in the sequence (ms). Default 400. */ cycleGap?: number; /** Number of full cycles through the wins list. `-1` for infinite. Default 1. */ cycles?: number; /** Sort wins by `value` descending before cycling. Default true. */ sortByValue?: boolean; } /** * Highlights winning cells on a reel set. One job: animate the symbols. * * The presenter doesn't draw lines, outlines, or any per-win visual. it * emits `win:start` / `win:group` / `win:symbol` / `win:end` events so * your code can hook anything it wants (polylines, Spine line rigs, * popup numbers, sound cues) by subscribing and using * `reelSet.getCellBounds(reel, cell)` to place graphics. * * Two knobs cover the common presentation modes: * * - `stagger: 0` → all cells in a win pulse together * - `stagger: 60` → cells start one after another. a left-to-right * sweep if you pass cells in reel order * * ```ts * const presenter = new WinPresenter(reelSet, { stagger: 80 }); * * reelSet.events.on('spin:complete', async () => { * const wins = await server.wins(result); // your wins, your shape * await presenter.show(wins); * }); * reelSet.events.on('spin:start', () => presenter.abort()); * ``` * * Cascades: drive `presenter.show([{ cells: winners }])` from * `runCascade`'s `onWinnersVanish` hook. cluster pops and payline hits * are the same shape to the presenter. */ export declare class WinPresenter implements Disposable { private _reelSet; private _options; private _abort; private _isActive; private _isDestroyed; constructor(reelSet: ReelSet, options?: WinPresenterOptions); get isActive(): boolean; get isDestroyed(): boolean; /** * Present the given wins. Cancels any in-flight sequence first. * Resolves when all cycles complete or when `abort()` is called. * * Empty input resolves immediately without firing any events. */ show(wins: readonly Win[]): Promise; /** Abort any in-flight `show()`. */ abort(): void; destroy(): void; private _showOne; private _playAnim; private _applyDim; private _restoreAlpha; private _wait; private static _resolve; } //# sourceMappingURL=WinPresenter.d.ts.map