import { Spine, TrackEntry } from '@esotericsoftware/spine-pixi-v8'; import { ReelSymbol } from '../symbols/ReelSymbol.js'; /** * Per-symbol overrides so a skeleton with unusual animation names still works. * * Example: Bonanza's `low_1` has a typo (`ide` instead of `idle`). * `{ low1: { idle: 'ide' } }` fixes it without touching the asset. */ export type SymbolAnimOverrides = Record>>; /** One spine source: a skeleton/atlas alias pair plus an optional skin. */ export interface SpineSymbolSource { skeleton: string; atlas: string; /** * Skin applied when the instance is created. Lets several symbolIds share * one multi-skin skeleton (e.g. a `lowSymbols` skeleton with skins * `low1`..`low5`) instead of shipping one skeleton per symbol. */ skin?: string; } export interface SpineReelSymbolOptions { /** Map of symbolId -> spine source. */ spineMap: Record; /** Default idle animation name. Default: 'idle'. */ idleAnimation?: string; /** Default win animation name. Default: 'win'. */ winAnimation?: string; /** Default landing (one-shot) animation name. Default: 'landing'. */ landingAnimation?: string; /** * Default "exit" animation name. used as the cascade pop / disintegrate. * If the skeleton doesn't have it, callers should fall back to an alpha tween. * Default: 'disintegration'. */ outAnimation?: string; /** Default "blur" (fast spin) animation name. Default: 'blur'. */ blurAnimation?: string; /** Per-symbol overrides (see SymbolAnimOverrides). */ animations?: SymbolAnimOverrides; /** Scale for spine instances. Default: 1. */ scale?: number; /** * If true, automatically plays the `blur` animation when the owning reel * enters the spin phase, and reverts to idle when it lands. Requires the * skeleton to have a `blur` animation (or the overridden name). Default: false. */ autoPlayBlur?: boolean; /** * If true, automatically plays the `landing` animation concurrently with * the stop-phase bounce. Requires the skeleton to have a `landing` * animation (or the overridden name). Default: false. */ autoPlayLanding?: boolean; } /** * ReelSymbol implementation using Spine 2D skeletons. * * Caches one Spine instance per symbolId for instant swapping, plays idle on * activate, and exposes the canonical set of one-shot animations (`landing`, * `win`, `out`, reactions). Modeled on the Bonanza / Hold & Win slot-game * conventions. drop in any skeleton that follows the same vocabulary. * * Import from the `pixi-reels/spine` subpath so non-Spine consumers can * tree-shake this module and `@esotericsoftware/spine-pixi-v8` out of their * production bundle: * * ```ts * import { SpineReelSymbol } from 'pixi-reels/spine'; * ``` */ export declare class SpineReelSymbol extends ReelSymbol { private _spines; private _currentSpine; private _spineMap; private _defaultAnims; private _overrides; private _scale; private _autoPlayBlur; private _autoPlayLanding; private _oneShotResolve; private _cellWidth; private _cellHeight; constructor(options: SpineReelSymbolOptions); onReelSpinStart(): void; onReelSpinEnd(): void; onReelLanded(): void; /** Resolve an animation name for the current symbol, respecting overrides. */ private _animNameFor; protected onActivate(symbolId: string): void; /** Instantiate a spine from a source config: scale, optional skin, attach. */ private _createSpine; protected onDeactivate(): void; /** Play the win animation on track 0. Returns when it completes. */ playWin(): Promise; /** * Play the landing animation (one-shot). Call this when the reel settles. * typically inside a `spin:reelLanded` listener. */ playLanding(): Promise; /** * Play the exit / disintegrate animation. Returns a promise that resolves * when it completes. Use in cascades instead of the default alpha fade. */ playOut(): Promise; /** * Cascade-destruction override. If the skeleton has the configured * `out` (disintegration) animation, play it. Otherwise fall back to the * base class's GSAP scale-and-fade so a partial skeleton still cascades * cleanly. `opts.delay` is honored (seconds, mirrors the GSAP version) * so callers can stagger a winning cluster. `opts.signal` aborts * the (pre-delay or in-flight) animation early. the spine state is * snapped to the next track entry and the resolve fires immediately; * the view is left at `alpha: 0` for parity with the GSAP fallback so * the destroyed pose is consistent across symbol kinds. */ playDestroy(opts?: { delay?: number; signal?: AbortSignal; }): Promise; /** * Swap the primary track to the blur animation for the SPIN phase. Reverts * to idle automatically on `stopAnimation()` or next activate. * * If a one-shot promise (`playWin` / `playLanding` / `playOut`) is in * flight on the same track, settle it first so the caller's `await` * doesn't dangle when its track is hijacked. */ playBlur(): void; /** Play an arbitrary animation on a given track. Non-blocking. */ playOnTrack(track: number, animName: string, loop?: boolean): TrackEntry | null; stopAnimation(): void; /** Access the underlying Spine. for advanced needs (reactions, events). */ get spine(): Spine | null; private _currentListener; /** * Settle any one-shot promise currently in flight and remove its * listener. Safe to call when no one-shot is pending. both fields are * cleared. * * Called by `onActivate`, `onDeactivate`, `stopAnimation`, `playBlur`, * and the start of every new `_playOneShot` so that: * - a `playWin()` promise resolves rather than hangs when the symbol * is recycled mid-animation, * - calling `playOut` while `playWin` is in flight resolves the * `playWin` promise (its track was hijacked), * - the prior listener is detached so spine state doesn't leak * listeners across consecutive one-shots. */ private _resolveOneShot; private _playOneShot; resize(width: number, height: number): void; private _positionSpine; protected onDestroy(): void; } //# sourceMappingURL=SpineReelSymbol.d.ts.map