@energy8platform/game-engine 0.20.0 → 0.22.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/README.md +121 -0
- package/dist/animation.cjs.js +18 -3
- package/dist/animation.cjs.js.map +1 -1
- package/dist/animation.esm.js +18 -3
- package/dist/animation.esm.js.map +1 -1
- package/dist/core.cjs.js +18 -3
- package/dist/core.cjs.js.map +1 -1
- package/dist/core.esm.js +18 -3
- package/dist/core.esm.js.map +1 -1
- package/dist/host.cjs.js +18 -3
- package/dist/host.cjs.js.map +1 -1
- package/dist/host.d.ts +3 -5
- package/dist/host.esm.js +18 -3
- package/dist/host.esm.js.map +1 -1
- package/dist/index.cjs.js +18 -2535
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +3 -1020
- package/dist/index.esm.js +20 -2525
- package/dist/index.esm.js.map +1 -1
- package/dist/slot.cjs.js +1872 -61
- package/dist/slot.cjs.js.map +1 -1
- package/dist/slot.d.ts +555 -28
- package/dist/slot.esm.js +1857 -62
- package/dist/slot.esm.js.map +1 -1
- package/dist/vite.cjs.js +0 -5
- package/dist/vite.cjs.js.map +1 -1
- package/dist/vite.esm.js +0 -5
- package/dist/vite.esm.js.map +1 -1
- package/package.json +2 -35
- package/src/animation/Tween.ts +14 -3
- package/src/host/index.ts +0 -1
- package/src/host/types.ts +0 -3
- package/src/index.ts +0 -28
- package/src/slot/anim/easing-map.ts +16 -2
- package/src/slot/cascade/TumbleController.ts +230 -0
- package/src/slot/config/ReelSystemConfig.ts +559 -0
- package/src/slot/config/presets.ts +222 -0
- package/src/slot/features/extra.ts +189 -0
- package/src/slot/features/index.ts +44 -0
- package/src/slot/features/symbols.ts +183 -0
- package/src/slot/features/types.ts +136 -0
- package/src/slot/features/wilds.ts +151 -0
- package/src/slot/grid/ReelGrid.ts +93 -24
- package/src/slot/grid/SymbolCell.ts +45 -11
- package/src/slot/index.ts +61 -2
- package/src/slot/motion/AnticipationController.ts +96 -0
- package/src/slot/motion/SpinEngine.ts +384 -0
- package/src/slot/system/ReelSystem.ts +295 -0
- package/src/vite/index.ts +0 -5
- package/dist/react-jsx.cjs.js +0 -3
- package/dist/react-jsx.cjs.js.map +0 -1
- package/dist/react-jsx.d.ts +0 -602
- package/dist/react-jsx.esm.js +0 -2
- package/dist/react-jsx.esm.js.map +0 -1
- package/dist/react.cjs.js +0 -3787
- package/dist/react.cjs.js.map +0 -1
- package/dist/react.d.ts +0 -1467
- package/dist/react.esm.js +0 -3771
- package/dist/react.esm.js.map +0 -1
- package/dist/ui.cjs.js +0 -2999
- package/dist/ui.cjs.js.map +0 -1
- package/dist/ui.d.ts +0 -1116
- package/dist/ui.esm.js +0 -2983
- package/dist/ui.esm.js.map +0 -1
- package/src/react/EngineContext.ts +0 -26
- package/src/react/ReactScene.ts +0 -88
- package/src/react/applyProps.ts +0 -271
- package/src/react/catalogue.ts +0 -17
- package/src/react/createPixiRoot.ts +0 -31
- package/src/react/extendAll.ts +0 -74
- package/src/react/hooks.ts +0 -46
- package/src/react/index.ts +0 -29
- package/src/react/jsx-runtime.ts +0 -346
- package/src/react/reconciler.ts +0 -338
- package/src/slot/freeSpins/FreeSpinsSession.ts +0 -40
- package/src/state/StateMachine.ts +0 -231
- package/src/state/index.ts +0 -1
- package/src/ui/BalanceDisplay.ts +0 -159
- package/src/ui/Button.ts +0 -304
- package/src/ui/FlexContainer.ts +0 -775
- package/src/ui/Label.ts +0 -124
- package/src/ui/LabelValue.ts +0 -122
- package/src/ui/Layout.ts +0 -291
- package/src/ui/Modal.ts +0 -170
- package/src/ui/Panel.ts +0 -204
- package/src/ui/ProgressBar.ts +0 -170
- package/src/ui/ScrollContainer.ts +0 -478
- package/src/ui/Slider.ts +0 -241
- package/src/ui/Toast.ts +0 -150
- package/src/ui/Toggle.ts +0 -201
- package/src/ui/WinDisplay.ts +0 -145
- package/src/ui/index.ts +0 -33
- package/src/ui/view.ts +0 -28
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _energy8platform_platform_core_shell from '@energy8platform/platform-core/shell';
|
|
2
|
-
import { Container, ApplicationOptions, Application, Texture, AnimatedSprite, Spritesheet
|
|
2
|
+
import { Container, ApplicationOptions, Application, Texture, AnimatedSprite, Spritesheet } from 'pixi.js';
|
|
3
3
|
import { CasinoGameSDK, InitData, GameConfigData, SessionData } from '@energy8platform/game-sdk';
|
|
4
4
|
export { AnywhereWinData, BalanceData, BridgeDestroyedError, BridgeNotReadyError, GameConfigData, InitData, PaylineData, PlayParams, PlayResultData, SDKError, SessionData, SymbolData, TimeoutError, WinLineData } from '@energy8platform/game-sdk';
|
|
5
5
|
import { LoadingScreenConfig, AssetManifest, PlatformSession } from '@energy8platform/platform-core';
|
|
@@ -786,126 +786,6 @@ declare abstract class Scene implements IScene {
|
|
|
786
786
|
onDestroy?(): void;
|
|
787
787
|
}
|
|
788
788
|
|
|
789
|
-
interface StateConfig<TContext> {
|
|
790
|
-
enter?: (ctx: TContext, data?: unknown) => void | Promise<void>;
|
|
791
|
-
exit?: (ctx: TContext) => void | Promise<void>;
|
|
792
|
-
update?: (ctx: TContext, dt: number) => void;
|
|
793
|
-
}
|
|
794
|
-
interface StateMachineEvents {
|
|
795
|
-
transition: {
|
|
796
|
-
from: string | null;
|
|
797
|
-
to: string;
|
|
798
|
-
};
|
|
799
|
-
error: Error;
|
|
800
|
-
}
|
|
801
|
-
/**
|
|
802
|
-
* Generic finite state machine for game flow management.
|
|
803
|
-
*
|
|
804
|
-
* Supports:
|
|
805
|
-
* - Typed context object shared across all states
|
|
806
|
-
* - Async enter/exit hooks
|
|
807
|
-
* - Per-frame update per state
|
|
808
|
-
* - Transition guards
|
|
809
|
-
* - Event emission on state change
|
|
810
|
-
*
|
|
811
|
-
* @example
|
|
812
|
-
* ```ts
|
|
813
|
-
* interface GameContext {
|
|
814
|
-
* balance: number;
|
|
815
|
-
* bet: number;
|
|
816
|
-
* lastWin: number;
|
|
817
|
-
* }
|
|
818
|
-
*
|
|
819
|
-
* const fsm = new StateMachine<GameContext>({ balance: 1000, bet: 10, lastWin: 0 });
|
|
820
|
-
*
|
|
821
|
-
* fsm.addState('idle', {
|
|
822
|
-
* enter: (ctx) => console.log('Waiting for spin...'),
|
|
823
|
-
* update: (ctx, dt) => { // optional per-frame },
|
|
824
|
-
* });
|
|
825
|
-
*
|
|
826
|
-
* fsm.addState('spinning', {
|
|
827
|
-
* enter: async (ctx) => {
|
|
828
|
-
* const result = await sdk.play({ action: 'spin', bet: ctx.bet });
|
|
829
|
-
* ctx.lastWin = result.totalWin;
|
|
830
|
-
* await fsm.transition('presenting');
|
|
831
|
-
* },
|
|
832
|
-
* });
|
|
833
|
-
*
|
|
834
|
-
* fsm.addState('presenting', {
|
|
835
|
-
* enter: async (ctx) => {
|
|
836
|
-
* await showWinPresentation(ctx.lastWin);
|
|
837
|
-
* await fsm.transition('idle');
|
|
838
|
-
* },
|
|
839
|
-
* });
|
|
840
|
-
*
|
|
841
|
-
* // Optional guard
|
|
842
|
-
* fsm.addGuard('idle', 'spinning', (ctx) => ctx.balance >= ctx.bet);
|
|
843
|
-
*
|
|
844
|
-
* await fsm.start('idle');
|
|
845
|
-
* ```
|
|
846
|
-
*/
|
|
847
|
-
declare class StateMachine<TContext = Record<string, unknown>> extends EventEmitter<StateMachineEvents> {
|
|
848
|
-
private static MAX_TRANSITION_DEPTH;
|
|
849
|
-
private _states;
|
|
850
|
-
private _guards;
|
|
851
|
-
private _current;
|
|
852
|
-
private _transitionDepth;
|
|
853
|
-
private _context;
|
|
854
|
-
constructor(context: TContext);
|
|
855
|
-
/** Current state name */
|
|
856
|
-
get current(): string | null;
|
|
857
|
-
/** Whether a transition is in progress */
|
|
858
|
-
get isTransitioning(): boolean;
|
|
859
|
-
/** State machine context (shared data) */
|
|
860
|
-
get context(): TContext;
|
|
861
|
-
/**
|
|
862
|
-
* Register a state with optional enter/exit/update hooks.
|
|
863
|
-
*/
|
|
864
|
-
addState(name: string, config: StateConfig<TContext>): this;
|
|
865
|
-
/**
|
|
866
|
-
* Add a transition guard.
|
|
867
|
-
* The guard function must return true to allow the transition.
|
|
868
|
-
*
|
|
869
|
-
* @param from - Source state
|
|
870
|
-
* @param to - Target state
|
|
871
|
-
* @param guard - Guard function
|
|
872
|
-
*/
|
|
873
|
-
addGuard(from: string, to: string, guard: (ctx: TContext) => boolean): this;
|
|
874
|
-
/**
|
|
875
|
-
* Start the state machine in the given initial state.
|
|
876
|
-
*/
|
|
877
|
-
start(initialState: string, data?: unknown): Promise<void>;
|
|
878
|
-
/**
|
|
879
|
-
* Transition to a new state.
|
|
880
|
-
*
|
|
881
|
-
* @param to - Target state name
|
|
882
|
-
* @param data - Optional data passed to the new state's enter hook
|
|
883
|
-
* @returns true if the transition succeeded, false if blocked by a guard
|
|
884
|
-
*/
|
|
885
|
-
transition(to: string, data?: unknown): Promise<boolean>;
|
|
886
|
-
/**
|
|
887
|
-
* Call the current state's update function.
|
|
888
|
-
* Should be called from the game loop.
|
|
889
|
-
*/
|
|
890
|
-
update(dt: number): void;
|
|
891
|
-
/**
|
|
892
|
-
* Check if a state is registered.
|
|
893
|
-
*/
|
|
894
|
-
hasState(name: string): boolean;
|
|
895
|
-
/**
|
|
896
|
-
* Check if a transition is allowed (guard passes).
|
|
897
|
-
*/
|
|
898
|
-
canTransition(to: string): boolean;
|
|
899
|
-
/**
|
|
900
|
-
* Reset the state machine (exit current state, clear current).
|
|
901
|
-
*/
|
|
902
|
-
reset(): Promise<void>;
|
|
903
|
-
/**
|
|
904
|
-
* Destroy the state machine.
|
|
905
|
-
*/
|
|
906
|
-
destroy(): Promise<void>;
|
|
907
|
-
}
|
|
908
|
-
|
|
909
789
|
/**
|
|
910
790
|
* Lightweight tween system integrated with PixiJS Ticker.
|
|
911
791
|
* Zero external dependencies — no GSAP required.
|
|
@@ -1251,903 +1131,6 @@ declare class SpriteAnimation {
|
|
|
1251
1131
|
static getTexturesByPrefix(sheet: Spritesheet, prefix: string): Texture[];
|
|
1252
1132
|
}
|
|
1253
1133
|
|
|
1254
|
-
type FlexDirection = 'row' | 'column';
|
|
1255
|
-
type JustifyContent = 'start' | 'center' | 'end' | 'space-between' | 'space-around';
|
|
1256
|
-
type AlignItems = 'start' | 'center' | 'end' | 'stretch';
|
|
1257
|
-
type AlignContent = 'start' | 'center' | 'end' | 'space-between' | 'stretch';
|
|
1258
|
-
type AlignSelf = 'auto' | 'start' | 'center' | 'end' | 'stretch';
|
|
1259
|
-
interface FlexItemConfig {
|
|
1260
|
-
/** Flex grow factor (0 = fixed size) */
|
|
1261
|
-
flexGrow?: number;
|
|
1262
|
-
/** Flex shrink factor (0 = don't shrink, default: 1) */
|
|
1263
|
-
flexShrink?: number;
|
|
1264
|
-
/** Explicit width override for layout calculations */
|
|
1265
|
-
layoutWidth?: number | string;
|
|
1266
|
-
/** Explicit height override for layout calculations */
|
|
1267
|
-
layoutHeight?: number | string;
|
|
1268
|
-
/** Override parent's alignItems for this child */
|
|
1269
|
-
alignSelf?: AlignSelf;
|
|
1270
|
-
/**
|
|
1271
|
-
* Exclude from flex layout (acts like position: absolute).
|
|
1272
|
-
*
|
|
1273
|
-
* Positioning props (`top`/`right`/`bottom`/`left`/`centerX`/`centerY`) describe
|
|
1274
|
-
* the **visual bounding rectangle**, so children with a centered internal
|
|
1275
|
-
* origin (Button, Label — `anchor = 0.5`) are positioned intuitively.
|
|
1276
|
-
* `left: 100` places the visible left edge at 100px, regardless of origin.
|
|
1277
|
-
*/
|
|
1278
|
-
flexExclude?: boolean;
|
|
1279
|
-
/** Distance from top edge of parent content area to the child's visual top */
|
|
1280
|
-
top?: number;
|
|
1281
|
-
/** Distance from right edge of parent content area to the child's visual right */
|
|
1282
|
-
right?: number;
|
|
1283
|
-
/** Distance from bottom edge of parent content area to the child's visual bottom */
|
|
1284
|
-
bottom?: number;
|
|
1285
|
-
/** Distance from left edge of parent content area to the child's visual left */
|
|
1286
|
-
left?: number;
|
|
1287
|
-
/**
|
|
1288
|
-
* X coordinate of the child's visual center within parent content area.
|
|
1289
|
-
* Accepts pixels (`200`) or a percentage of parent content width (`'50%'`).
|
|
1290
|
-
* Takes precedence over `left`/`right`.
|
|
1291
|
-
*/
|
|
1292
|
-
centerX?: number | string;
|
|
1293
|
-
/**
|
|
1294
|
-
* Y coordinate of the child's visual center within parent content area.
|
|
1295
|
-
* Accepts pixels or a percentage of parent content height (`'50%'`).
|
|
1296
|
-
* Takes precedence over `top`/`bottom`.
|
|
1297
|
-
*/
|
|
1298
|
-
centerY?: number | string;
|
|
1299
|
-
}
|
|
1300
|
-
interface FlexContainerConfig {
|
|
1301
|
-
/** Layout direction (default: 'row') */
|
|
1302
|
-
direction?: FlexDirection;
|
|
1303
|
-
/** Main-axis distribution (default: 'start') */
|
|
1304
|
-
justifyContent?: JustifyContent;
|
|
1305
|
-
/** Cross-axis alignment (default: 'start') */
|
|
1306
|
-
alignItems?: AlignItems;
|
|
1307
|
-
/** Gap between children in pixels (default: 0) */
|
|
1308
|
-
gap?: number;
|
|
1309
|
-
/** Padding [top, right, bottom, left] or single number (default: 0) */
|
|
1310
|
-
padding?: number | [number, number, number, number];
|
|
1311
|
-
/** Individual padding overrides (take priority over `padding`) */
|
|
1312
|
-
paddingTop?: number;
|
|
1313
|
-
paddingRight?: number;
|
|
1314
|
-
paddingBottom?: number;
|
|
1315
|
-
paddingLeft?: number;
|
|
1316
|
-
/** Enable wrapping to next line (default: false) */
|
|
1317
|
-
flexWrap?: boolean;
|
|
1318
|
-
/** Distribution of lines along the cross axis when wrapping (default: 'start') */
|
|
1319
|
-
alignContent?: AlignContent;
|
|
1320
|
-
/** Maximum width before wrapping (only with flexWrap) */
|
|
1321
|
-
maxWidth?: number;
|
|
1322
|
-
/** Maximum height before wrapping (only with flexWrap + column) */
|
|
1323
|
-
maxHeight?: number;
|
|
1324
|
-
/** Explicit container width — number in pixels, or string percentage (e.g. "50%") resolved against parent */
|
|
1325
|
-
width?: number | string;
|
|
1326
|
-
/** Explicit container height — number in pixels, or string percentage (e.g. "50%") resolved against parent */
|
|
1327
|
-
height?: number | string;
|
|
1328
|
-
}
|
|
1329
|
-
/**
|
|
1330
|
-
* Lightweight flexbox-like layout container for PixiJS.
|
|
1331
|
-
*
|
|
1332
|
-
* Supports row/column direction, justify/align, gap, padding, wrapping,
|
|
1333
|
-
* and flex-grow distribution. Zero external dependencies.
|
|
1334
|
-
*
|
|
1335
|
-
* @example
|
|
1336
|
-
* ```ts
|
|
1337
|
-
* const toolbar = new FlexContainer({
|
|
1338
|
-
* direction: 'row',
|
|
1339
|
-
* justifyContent: 'space-between',
|
|
1340
|
-
* alignItems: 'center',
|
|
1341
|
-
* gap: 16,
|
|
1342
|
-
* padding: 12,
|
|
1343
|
-
* });
|
|
1344
|
-
*
|
|
1345
|
-
* toolbar.addFlexChild(button1);
|
|
1346
|
-
* toolbar.addFlexChild(button2);
|
|
1347
|
-
* toolbar.resize(800, 60);
|
|
1348
|
-
* ```
|
|
1349
|
-
*/
|
|
1350
|
-
declare class FlexContainer extends Container {
|
|
1351
|
-
readonly __uiComponent: true;
|
|
1352
|
-
private _config;
|
|
1353
|
-
private _padding;
|
|
1354
|
-
private _maxWidth;
|
|
1355
|
-
private _maxHeight;
|
|
1356
|
-
/** @internal */ _explicitWidth: number;
|
|
1357
|
-
/** @internal */ _explicitHeight: number;
|
|
1358
|
-
/** @internal */ _computedWidth: number;
|
|
1359
|
-
/** @internal */ _computedHeight: number;
|
|
1360
|
-
/** @internal */ _availableWidth: number;
|
|
1361
|
-
/** @internal */ _availableHeight: number;
|
|
1362
|
-
/** @internal */ _rawWidth: number | string;
|
|
1363
|
-
/** @internal */ _rawHeight: number | string;
|
|
1364
|
-
private _layoutChildren;
|
|
1365
|
-
private _layoutDirty;
|
|
1366
|
-
private _layoutSuspended;
|
|
1367
|
-
constructor(config?: FlexContainerConfig);
|
|
1368
|
-
/** Add a child with optional flex config. Also registers in flex layout. */
|
|
1369
|
-
addFlexChild(child: Container, flexConfig?: FlexItemConfig): this;
|
|
1370
|
-
/** Remove a child from flex layout and display list */
|
|
1371
|
-
removeFlexChild(child: Container): this;
|
|
1372
|
-
/** Remove all flex children */
|
|
1373
|
-
clearFlexChildren(): this;
|
|
1374
|
-
/**
|
|
1375
|
-
* Override addChild so children automatically participate in flex layout.
|
|
1376
|
-
* This enables declarative usage from React JSX.
|
|
1377
|
-
*/
|
|
1378
|
-
addChild<T extends Container>(...children: T[]): T;
|
|
1379
|
-
addChildAt<T extends Container>(child: T, index: number): T;
|
|
1380
|
-
removeChild<T extends Container>(...children: T[]): T;
|
|
1381
|
-
/** Get all flex layout children (read-only) */
|
|
1382
|
-
get flexChildren(): readonly Container[];
|
|
1383
|
-
/** Suspend automatic layout recalculation. Call resumeLayout() to flush. */
|
|
1384
|
-
suspendLayout(): void;
|
|
1385
|
-
/** Resume automatic layout and flush if dirty. */
|
|
1386
|
-
resumeLayout(): void;
|
|
1387
|
-
/** Update the container size and recalculate layout */
|
|
1388
|
-
resize(width: number, height: number): void;
|
|
1389
|
-
/** Update layout direction */
|
|
1390
|
-
setDirection(direction: FlexDirection): void;
|
|
1391
|
-
/** Update justifyContent */
|
|
1392
|
-
setJustifyContent(justify: JustifyContent): void;
|
|
1393
|
-
/** Update alignItems */
|
|
1394
|
-
setAlignItems(align: AlignItems): void;
|
|
1395
|
-
/** Update gap */
|
|
1396
|
-
setGap(gap: number): void;
|
|
1397
|
-
/** Update padding */
|
|
1398
|
-
setPadding(padding: number | [number, number, number, number]): void;
|
|
1399
|
-
/**
|
|
1400
|
-
* Recalculate and apply layout positions for all children.
|
|
1401
|
-
* Called automatically by `resize()`. Call manually after
|
|
1402
|
-
* adding/removing children without resize.
|
|
1403
|
-
*/
|
|
1404
|
-
updateLayout(): void;
|
|
1405
|
-
/** Computed content size (after layout) */
|
|
1406
|
-
getContentSize(): {
|
|
1407
|
-
width: number;
|
|
1408
|
-
height: number;
|
|
1409
|
-
};
|
|
1410
|
-
/** React reconciler update hook — applies changed config props */
|
|
1411
|
-
updateConfig(changed: Record<string, any>): void;
|
|
1412
|
-
destroy(options?: boolean | {
|
|
1413
|
-
children?: boolean;
|
|
1414
|
-
texture?: boolean;
|
|
1415
|
-
textureSource?: boolean;
|
|
1416
|
-
}): void;
|
|
1417
|
-
}
|
|
1418
|
-
|
|
1419
|
-
/**
|
|
1420
|
-
* Universal view input type for UI component visual slots.
|
|
1421
|
-
*
|
|
1422
|
-
* - `string` — texture name, resolved via `Sprite.from()`
|
|
1423
|
-
* - `Texture` — wrapped in a `Sprite`
|
|
1424
|
-
* - `Container` — used as-is (Sprite, Graphics, NineSliceSprite, AnimatedSprite, custom...)
|
|
1425
|
-
*/
|
|
1426
|
-
type ViewInput = string | Texture | Container;
|
|
1427
|
-
|
|
1428
|
-
type ButtonState = 'default' | 'hover' | 'pressed' | 'disabled';
|
|
1429
|
-
interface ButtonConfig {
|
|
1430
|
-
/** Custom view for default state (string texture name, Texture, or Container) */
|
|
1431
|
-
defaultView?: ViewInput;
|
|
1432
|
-
/** Custom view for hover state */
|
|
1433
|
-
hoverView?: ViewInput;
|
|
1434
|
-
/** Custom view for pressed state */
|
|
1435
|
-
pressedView?: ViewInput;
|
|
1436
|
-
/** Custom view for disabled state */
|
|
1437
|
-
disabledView?: ViewInput;
|
|
1438
|
-
/** Width (for Graphics-based button, ignored when custom views provided) */
|
|
1439
|
-
width?: number;
|
|
1440
|
-
/** Height (for Graphics-based button) */
|
|
1441
|
-
height?: number;
|
|
1442
|
-
/** Corner radius (for Graphics-based button) */
|
|
1443
|
-
borderRadius?: number;
|
|
1444
|
-
/** Colors for each state (for Graphics-based button) */
|
|
1445
|
-
colors?: Partial<Record<ButtonState, number>>;
|
|
1446
|
-
/** Scale on press */
|
|
1447
|
-
pressScale?: number;
|
|
1448
|
-
/** Scale animation duration (ms) */
|
|
1449
|
-
animationDuration?: number;
|
|
1450
|
-
/** Start disabled */
|
|
1451
|
-
disabled?: boolean;
|
|
1452
|
-
/** Button text (rendered on top of the view) */
|
|
1453
|
-
text?: string;
|
|
1454
|
-
/** Button text style */
|
|
1455
|
-
textStyle?: Record<string, unknown>;
|
|
1456
|
-
/** Press callback */
|
|
1457
|
-
onPress?: () => void;
|
|
1458
|
-
}
|
|
1459
|
-
/**
|
|
1460
|
-
* Interactive button with per-state custom views and animations.
|
|
1461
|
-
*
|
|
1462
|
-
* Each visual state accepts a `ViewInput`: texture name, Texture, or any Container
|
|
1463
|
-
* (Sprite, NineSliceSprite, AnimatedSprite, custom artwork, etc).
|
|
1464
|
-
* Falls back to colored Graphics when no custom view is provided.
|
|
1465
|
-
*
|
|
1466
|
-
* @example
|
|
1467
|
-
* ```ts
|
|
1468
|
-
* // Graphics-based (quick prototyping)
|
|
1469
|
-
* const btn = new Button({
|
|
1470
|
-
* width: 200, height: 60, borderRadius: 12,
|
|
1471
|
-
* colors: { default: 0x22aa22, hover: 0x33cc33 },
|
|
1472
|
-
* text: 'SPIN',
|
|
1473
|
-
* onPress: () => spin(),
|
|
1474
|
-
* });
|
|
1475
|
-
*
|
|
1476
|
-
* // Asset-based (production art)
|
|
1477
|
-
* const btn = new Button({
|
|
1478
|
-
* defaultView: 'btn-idle',
|
|
1479
|
-
* hoverView: 'btn-hover',
|
|
1480
|
-
* pressedView: 'btn-pressed',
|
|
1481
|
-
* disabledView: 'btn-disabled',
|
|
1482
|
-
* text: 'SPIN',
|
|
1483
|
-
* onPress: () => spin(),
|
|
1484
|
-
* });
|
|
1485
|
-
*
|
|
1486
|
-
* // Custom Container view
|
|
1487
|
-
* const btn = new Button({
|
|
1488
|
-
* defaultView: myAnimatedSprite,
|
|
1489
|
-
* text: 'SPIN',
|
|
1490
|
-
* });
|
|
1491
|
-
* ```
|
|
1492
|
-
*/
|
|
1493
|
-
declare class Button extends Container {
|
|
1494
|
-
readonly __uiComponent: true;
|
|
1495
|
-
private _views;
|
|
1496
|
-
private _state;
|
|
1497
|
-
private _enabled;
|
|
1498
|
-
private _config;
|
|
1499
|
-
private _textObj;
|
|
1500
|
-
/** Press callback */
|
|
1501
|
-
onPress?: () => void;
|
|
1502
|
-
constructor(config?: ButtonConfig);
|
|
1503
|
-
/** Current button state */
|
|
1504
|
-
get state(): ButtonState;
|
|
1505
|
-
/** Enable the button */
|
|
1506
|
-
enable(): void;
|
|
1507
|
-
/** Disable the button */
|
|
1508
|
-
disable(): void;
|
|
1509
|
-
/** Whether the button is enabled */
|
|
1510
|
-
get enabled(): boolean;
|
|
1511
|
-
set enabled(value: boolean);
|
|
1512
|
-
/** Whether the button is disabled */
|
|
1513
|
-
get disabled(): boolean;
|
|
1514
|
-
/** Update button text */
|
|
1515
|
-
set text(value: string);
|
|
1516
|
-
private _buildViews;
|
|
1517
|
-
private _rebuildViews;
|
|
1518
|
-
private _setState;
|
|
1519
|
-
private _onPointerOver;
|
|
1520
|
-
private _onPointerOut;
|
|
1521
|
-
private _onPointerDown;
|
|
1522
|
-
private _onPointerUp;
|
|
1523
|
-
private _onPointerUpOutside;
|
|
1524
|
-
/** React reconciler update hook */
|
|
1525
|
-
updateConfig(changed: Record<string, any>): void;
|
|
1526
|
-
destroy(options?: boolean | {
|
|
1527
|
-
children?: boolean;
|
|
1528
|
-
texture?: boolean;
|
|
1529
|
-
textureSource?: boolean;
|
|
1530
|
-
}): void;
|
|
1531
|
-
}
|
|
1532
|
-
|
|
1533
|
-
interface ProgressBarConfig {
|
|
1534
|
-
/** Width of the bar */
|
|
1535
|
-
width?: number;
|
|
1536
|
-
/** Height of the bar */
|
|
1537
|
-
height?: number;
|
|
1538
|
-
/** Corner radius (for Graphics-based bar) */
|
|
1539
|
-
borderRadius?: number;
|
|
1540
|
-
/** Fill color (for Graphics-based bar, ignored when fillView provided) */
|
|
1541
|
-
fillColor?: number;
|
|
1542
|
-
/** Track background color (for Graphics-based bar, ignored when trackView provided) */
|
|
1543
|
-
trackColor?: number;
|
|
1544
|
-
/** Border color */
|
|
1545
|
-
borderColor?: number;
|
|
1546
|
-
/** Border width */
|
|
1547
|
-
borderWidth?: number;
|
|
1548
|
-
/** Animated fill (smoothly interpolate) */
|
|
1549
|
-
animated?: boolean;
|
|
1550
|
-
/** Animation speed (0..1 per frame, default: 0.1) */
|
|
1551
|
-
animationSpeed?: number;
|
|
1552
|
-
/** Custom track background (string texture name, Texture, or Container) */
|
|
1553
|
-
trackView?: ViewInput;
|
|
1554
|
-
/** Custom fill bar (string texture name, Texture, or Container) */
|
|
1555
|
-
fillView?: ViewInput;
|
|
1556
|
-
}
|
|
1557
|
-
/**
|
|
1558
|
-
* Horizontal progress bar with optional custom track/fill views.
|
|
1559
|
-
*
|
|
1560
|
-
* Supports asset-based skinning: provide `trackView` and/or `fillView`
|
|
1561
|
-
* as texture names, Textures, or any Container (NineSliceSprite, custom artwork, etc).
|
|
1562
|
-
* Falls back to colored Graphics when no custom views are provided.
|
|
1563
|
-
*
|
|
1564
|
-
* @example
|
|
1565
|
-
* ```ts
|
|
1566
|
-
* // Graphics-based (quick prototyping)
|
|
1567
|
-
* const bar = new ProgressBar({ width: 300, height: 20, fillColor: 0x22cc22 });
|
|
1568
|
-
* bar.progress = 0.5;
|
|
1569
|
-
*
|
|
1570
|
-
* // Asset-based (production art)
|
|
1571
|
-
* const bar = new ProgressBar({
|
|
1572
|
-
* width: 300, height: 20,
|
|
1573
|
-
* trackView: 'bar-track',
|
|
1574
|
-
* fillView: new NineSliceSprite({ texture: 'bar-fill', ... }),
|
|
1575
|
-
* });
|
|
1576
|
-
* bar.progress = 0.75;
|
|
1577
|
-
* ```
|
|
1578
|
-
*/
|
|
1579
|
-
declare class ProgressBar extends Container {
|
|
1580
|
-
readonly __uiComponent: true;
|
|
1581
|
-
private _track;
|
|
1582
|
-
private _fill;
|
|
1583
|
-
private _fillMask;
|
|
1584
|
-
private _borderGfx;
|
|
1585
|
-
private _config;
|
|
1586
|
-
private _progress;
|
|
1587
|
-
private _displayedProgress;
|
|
1588
|
-
constructor(config?: ProgressBarConfig);
|
|
1589
|
-
/** Get/set progress (0..1) */
|
|
1590
|
-
get progress(): number;
|
|
1591
|
-
set progress(value: number);
|
|
1592
|
-
/**
|
|
1593
|
-
* Call each frame if animated is true.
|
|
1594
|
-
*/
|
|
1595
|
-
update(_dt: number): void;
|
|
1596
|
-
/** React reconciler update hook */
|
|
1597
|
-
updateConfig(changed: Record<string, any>): void;
|
|
1598
|
-
private updateMask;
|
|
1599
|
-
}
|
|
1600
|
-
|
|
1601
|
-
interface LabelConfig {
|
|
1602
|
-
text?: string;
|
|
1603
|
-
style?: Partial<TextStyle>;
|
|
1604
|
-
/** Maximum width — text will be scaled down to fit */
|
|
1605
|
-
maxWidth?: number;
|
|
1606
|
-
/** Auto-fit: scale text to fit maxWidth */
|
|
1607
|
-
autoFit?: boolean;
|
|
1608
|
-
}
|
|
1609
|
-
/**
|
|
1610
|
-
* Enhanced text label with auto-fit scaling and currency formatting.
|
|
1611
|
-
*
|
|
1612
|
-
* @example
|
|
1613
|
-
* ```ts
|
|
1614
|
-
* const label = new Label({
|
|
1615
|
-
* text: 'BALANCE',
|
|
1616
|
-
* style: { fontSize: 24, fill: 0xffd700 },
|
|
1617
|
-
* maxWidth: 200,
|
|
1618
|
-
* autoFit: true,
|
|
1619
|
-
* });
|
|
1620
|
-
* ```
|
|
1621
|
-
*/
|
|
1622
|
-
declare class Label extends Container {
|
|
1623
|
-
readonly __uiComponent: true;
|
|
1624
|
-
private _text;
|
|
1625
|
-
private _maxWidth;
|
|
1626
|
-
private _autoFit;
|
|
1627
|
-
constructor(config?: LabelConfig);
|
|
1628
|
-
/** Get/set the displayed text */
|
|
1629
|
-
get text(): string;
|
|
1630
|
-
set text(value: string);
|
|
1631
|
-
/** Get/set the text style */
|
|
1632
|
-
get style(): TextStyle;
|
|
1633
|
-
/** Set max width constraint */
|
|
1634
|
-
set maxWidth(value: number);
|
|
1635
|
-
/**
|
|
1636
|
-
* Format and display a number as currency.
|
|
1637
|
-
*
|
|
1638
|
-
* @param amount - The numeric amount
|
|
1639
|
-
* @param currency - Currency code (e.g., 'USD', 'EUR')
|
|
1640
|
-
* @param locale - Locale string (default: 'en-US')
|
|
1641
|
-
*/
|
|
1642
|
-
setCurrency(amount: number, currency: string, locale?: string): void;
|
|
1643
|
-
/**
|
|
1644
|
-
* Format a number with thousands separators.
|
|
1645
|
-
*/
|
|
1646
|
-
setNumber(value: number, decimals?: number, locale?: string): void;
|
|
1647
|
-
/** React reconciler update hook */
|
|
1648
|
-
updateConfig(changed: Record<string, any>): void;
|
|
1649
|
-
private fitText;
|
|
1650
|
-
}
|
|
1651
|
-
|
|
1652
|
-
interface PanelConfig {
|
|
1653
|
-
/** Width */
|
|
1654
|
-
width?: number;
|
|
1655
|
-
/** Height */
|
|
1656
|
-
height?: number;
|
|
1657
|
-
/** Background color (for Graphics-based panel) */
|
|
1658
|
-
backgroundColor?: number;
|
|
1659
|
-
/** Background alpha */
|
|
1660
|
-
backgroundAlpha?: number;
|
|
1661
|
-
/** Corner radius */
|
|
1662
|
-
borderRadius?: number;
|
|
1663
|
-
/** Border color */
|
|
1664
|
-
borderColor?: number;
|
|
1665
|
-
/** Border width */
|
|
1666
|
-
borderWidth?: number;
|
|
1667
|
-
/** 9-slice texture (if provided, uses NineSliceSprite instead of Graphics) */
|
|
1668
|
-
nineSliceTexture?: string | Texture;
|
|
1669
|
-
/** 9-slice borders [left, top, right, bottom] */
|
|
1670
|
-
nineSliceBorders?: [number, number, number, number];
|
|
1671
|
-
/** Padding inside the panel */
|
|
1672
|
-
padding?: number;
|
|
1673
|
-
/** Flex layout config for content */
|
|
1674
|
-
layout?: Partial<FlexContainerConfig>;
|
|
1675
|
-
}
|
|
1676
|
-
/**
|
|
1677
|
-
* Background panel with optional flexbox content layout.
|
|
1678
|
-
*
|
|
1679
|
-
* Supports both Graphics-based (color + border) and 9-slice sprite backgrounds.
|
|
1680
|
-
* Children added via `addContent()` participate in flex layout automatically.
|
|
1681
|
-
*
|
|
1682
|
-
* @example
|
|
1683
|
-
* ```ts
|
|
1684
|
-
* // Simple colored panel
|
|
1685
|
-
* const panel = new Panel({ width: 400, height: 300, backgroundColor: 0x222222, borderRadius: 12 });
|
|
1686
|
-
*
|
|
1687
|
-
* // 9-slice panel (texture-based)
|
|
1688
|
-
* const panel = new Panel({
|
|
1689
|
-
* nineSliceTexture: 'panel-bg',
|
|
1690
|
-
* nineSliceBorders: [20, 20, 20, 20],
|
|
1691
|
-
* width: 400, height: 300,
|
|
1692
|
-
* });
|
|
1693
|
-
* ```
|
|
1694
|
-
*/
|
|
1695
|
-
declare class Panel extends Container {
|
|
1696
|
-
readonly __uiComponent: true;
|
|
1697
|
-
private _bg;
|
|
1698
|
-
private _content;
|
|
1699
|
-
private _internalSetup;
|
|
1700
|
-
private _panelConfig;
|
|
1701
|
-
constructor(config?: PanelConfig);
|
|
1702
|
-
/** Access the content flex container — add children here for layout */
|
|
1703
|
-
get content(): FlexContainer;
|
|
1704
|
-
/** Suspend content layout recalculation. Call resumeLayout() to flush. */
|
|
1705
|
-
suspendLayout(): void;
|
|
1706
|
-
/** Resume content layout and flush if dirty. */
|
|
1707
|
-
resumeLayout(): void;
|
|
1708
|
-
/** Convenience: add a child to the content layout */
|
|
1709
|
-
addContent(child: Container): this;
|
|
1710
|
-
/** Resize the panel */
|
|
1711
|
-
setSize(width: number, height: number): void;
|
|
1712
|
-
/**
|
|
1713
|
-
* Override addChild so external children are routed to content FlexContainer.
|
|
1714
|
-
* Enables `<panel><label /><button /></panel>` in React JSX.
|
|
1715
|
-
*/
|
|
1716
|
-
addChild<T extends Container>(...children: T[]): T;
|
|
1717
|
-
removeChild<T extends Container>(...children: T[]): T;
|
|
1718
|
-
/** React reconciler update hook */
|
|
1719
|
-
updateConfig(changed: Record<string, any>): void;
|
|
1720
|
-
destroy(options?: boolean | {
|
|
1721
|
-
children?: boolean;
|
|
1722
|
-
texture?: boolean;
|
|
1723
|
-
textureSource?: boolean;
|
|
1724
|
-
}): void;
|
|
1725
|
-
}
|
|
1726
|
-
|
|
1727
|
-
interface BalanceDisplayConfig {
|
|
1728
|
-
/** Label prefix (e.g., "BALANCE") */
|
|
1729
|
-
prefix?: string;
|
|
1730
|
-
/** Text style overrides */
|
|
1731
|
-
style?: Record<string, unknown>;
|
|
1732
|
-
/** Currency code */
|
|
1733
|
-
currency?: string;
|
|
1734
|
-
/** Locale for number formatting */
|
|
1735
|
-
locale?: string;
|
|
1736
|
-
/** Max width */
|
|
1737
|
-
maxWidth?: number;
|
|
1738
|
-
/** Animate value changes */
|
|
1739
|
-
animated?: boolean;
|
|
1740
|
-
/** Animation duration in ms */
|
|
1741
|
-
animationDuration?: number;
|
|
1742
|
-
}
|
|
1743
|
-
/**
|
|
1744
|
-
* Reactive balance display component.
|
|
1745
|
-
*
|
|
1746
|
-
* Automatically formats currency and can animate value changes
|
|
1747
|
-
* with a smooth countup/countdown effect using engine Tween.
|
|
1748
|
-
*
|
|
1749
|
-
* @example
|
|
1750
|
-
* ```ts
|
|
1751
|
-
* const balance = new BalanceDisplay({ currency: 'USD', animated: true });
|
|
1752
|
-
* balance.setValue(1000);
|
|
1753
|
-
*
|
|
1754
|
-
* // Wire to SDK
|
|
1755
|
-
* sdk.on('balanceUpdate', ({ balance: val }) => balance.setValue(val));
|
|
1756
|
-
* ```
|
|
1757
|
-
*/
|
|
1758
|
-
declare class BalanceDisplay extends Container {
|
|
1759
|
-
readonly __uiComponent: true;
|
|
1760
|
-
private _prefixLabel;
|
|
1761
|
-
private _valueLabel;
|
|
1762
|
-
private _config;
|
|
1763
|
-
private _currentValue;
|
|
1764
|
-
private _displayedValue;
|
|
1765
|
-
/** Internal target for Tween animation */
|
|
1766
|
-
private _tweenTarget;
|
|
1767
|
-
constructor(config?: BalanceDisplayConfig);
|
|
1768
|
-
/** Current displayed value */
|
|
1769
|
-
get value(): number;
|
|
1770
|
-
/**
|
|
1771
|
-
* Set the balance value. If animated, smoothly counts to the new value.
|
|
1772
|
-
*/
|
|
1773
|
-
setValue(value: number): void;
|
|
1774
|
-
/**
|
|
1775
|
-
* Set the currency code.
|
|
1776
|
-
*/
|
|
1777
|
-
setCurrency(currency: string): void;
|
|
1778
|
-
private animateValue;
|
|
1779
|
-
private updateDisplay;
|
|
1780
|
-
private layoutLabels;
|
|
1781
|
-
/** React reconciler update hook */
|
|
1782
|
-
updateConfig(changed: Record<string, any>): void;
|
|
1783
|
-
destroy(options?: boolean | {
|
|
1784
|
-
children?: boolean;
|
|
1785
|
-
texture?: boolean;
|
|
1786
|
-
textureSource?: boolean;
|
|
1787
|
-
}): void;
|
|
1788
|
-
}
|
|
1789
|
-
|
|
1790
|
-
interface WinDisplayConfig {
|
|
1791
|
-
/** Text style overrides */
|
|
1792
|
-
style?: Record<string, unknown>;
|
|
1793
|
-
/** Currency code */
|
|
1794
|
-
currency?: string;
|
|
1795
|
-
/** Locale for number formatting */
|
|
1796
|
-
locale?: string;
|
|
1797
|
-
/** Countup duration in ms */
|
|
1798
|
-
countupDuration?: number;
|
|
1799
|
-
/** Scale pop animation on win */
|
|
1800
|
-
popScale?: number;
|
|
1801
|
-
}
|
|
1802
|
-
/**
|
|
1803
|
-
* Win amount display with countup animation.
|
|
1804
|
-
*
|
|
1805
|
-
* Shows a dramatic countup from 0 to the win amount, with optional
|
|
1806
|
-
* scale pop effect — typical of slot games. Uses engine Tween system.
|
|
1807
|
-
*
|
|
1808
|
-
* @example
|
|
1809
|
-
* ```ts
|
|
1810
|
-
* const winDisplay = new WinDisplay({ currency: 'USD' });
|
|
1811
|
-
* scene.container.addChild(winDisplay);
|
|
1812
|
-
* await winDisplay.showWin(150.50); // countup animation
|
|
1813
|
-
* winDisplay.hide();
|
|
1814
|
-
* ```
|
|
1815
|
-
*/
|
|
1816
|
-
declare class WinDisplay extends Container {
|
|
1817
|
-
readonly __uiComponent: true;
|
|
1818
|
-
private _label;
|
|
1819
|
-
private _config;
|
|
1820
|
-
/** Internal target for Tween countup */
|
|
1821
|
-
private _tweenTarget;
|
|
1822
|
-
constructor(config?: WinDisplayConfig);
|
|
1823
|
-
/**
|
|
1824
|
-
* Show a win with countup animation.
|
|
1825
|
-
*
|
|
1826
|
-
* @param amount - Win amount
|
|
1827
|
-
* @returns Promise that resolves when the animation completes
|
|
1828
|
-
*/
|
|
1829
|
-
showWin(amount: number): Promise<void>;
|
|
1830
|
-
/**
|
|
1831
|
-
* Skip the countup animation and show the final amount immediately.
|
|
1832
|
-
*/
|
|
1833
|
-
skipCountup(amount: number): void;
|
|
1834
|
-
/**
|
|
1835
|
-
* Hide the win display.
|
|
1836
|
-
*/
|
|
1837
|
-
hide(): void;
|
|
1838
|
-
private displayAmount;
|
|
1839
|
-
/** React reconciler update hook */
|
|
1840
|
-
updateConfig(changed: Record<string, any>): void;
|
|
1841
|
-
destroy(options?: boolean | {
|
|
1842
|
-
children?: boolean;
|
|
1843
|
-
texture?: boolean;
|
|
1844
|
-
textureSource?: boolean;
|
|
1845
|
-
}): void;
|
|
1846
|
-
}
|
|
1847
|
-
|
|
1848
|
-
interface ModalConfig {
|
|
1849
|
-
/** Overlay color */
|
|
1850
|
-
overlayColor?: number;
|
|
1851
|
-
/** Overlay alpha */
|
|
1852
|
-
overlayAlpha?: number;
|
|
1853
|
-
/** Close on overlay tap */
|
|
1854
|
-
closeOnOverlay?: boolean;
|
|
1855
|
-
/** Animation duration */
|
|
1856
|
-
animationDuration?: number;
|
|
1857
|
-
}
|
|
1858
|
-
/**
|
|
1859
|
-
* Modal overlay component.
|
|
1860
|
-
* Shows content on top of a dark overlay with enter/exit animations.
|
|
1861
|
-
*
|
|
1862
|
-
* Content is automatically centered via position calculations.
|
|
1863
|
-
*
|
|
1864
|
-
* @example
|
|
1865
|
-
* ```ts
|
|
1866
|
-
* const modal = new Modal({ closeOnOverlay: true });
|
|
1867
|
-
* modal.content.addChild(settingsPanel);
|
|
1868
|
-
* modal.onClose = () => console.log('Closed');
|
|
1869
|
-
* await modal.show(1920, 1080);
|
|
1870
|
-
* ```
|
|
1871
|
-
*/
|
|
1872
|
-
declare class Modal extends Container {
|
|
1873
|
-
readonly __uiComponent: true;
|
|
1874
|
-
private _overlay;
|
|
1875
|
-
private _contentContainer;
|
|
1876
|
-
private _config;
|
|
1877
|
-
private _showing;
|
|
1878
|
-
private _internalSetup;
|
|
1879
|
-
/** Called when the modal is closed */
|
|
1880
|
-
onClose?: () => void;
|
|
1881
|
-
constructor(config?: ModalConfig);
|
|
1882
|
-
/** Content container — add your UI here */
|
|
1883
|
-
get content(): Container;
|
|
1884
|
-
/**
|
|
1885
|
-
* Override addChild so external children are routed to _contentContainer.
|
|
1886
|
-
* Enables `<modal><flexContainer>...</flexContainer></modal>` in React JSX.
|
|
1887
|
-
*/
|
|
1888
|
-
addChild<T extends Container>(...children: T[]): T;
|
|
1889
|
-
removeChild<T extends Container>(...children: T[]): T;
|
|
1890
|
-
/** Whether the modal is currently showing */
|
|
1891
|
-
get isShowing(): boolean;
|
|
1892
|
-
/**
|
|
1893
|
-
* Show the modal with animation.
|
|
1894
|
-
*/
|
|
1895
|
-
show(viewWidth: number, viewHeight: number): Promise<void>;
|
|
1896
|
-
/**
|
|
1897
|
-
* Hide the modal with animation.
|
|
1898
|
-
*/
|
|
1899
|
-
hide(): Promise<void>;
|
|
1900
|
-
/** React reconciler update hook */
|
|
1901
|
-
updateConfig(changed: Record<string, any>): void;
|
|
1902
|
-
}
|
|
1903
|
-
|
|
1904
|
-
type ToastType = 'info' | 'success' | 'warning' | 'error';
|
|
1905
|
-
interface ToastConfig {
|
|
1906
|
-
/** Auto-dismiss after this many ms (0 = manual dismiss only) */
|
|
1907
|
-
duration?: number;
|
|
1908
|
-
/** Toast position from bottom */
|
|
1909
|
-
bottomOffset?: number;
|
|
1910
|
-
/** Custom background view (string texture name, Texture, or Container). Sized to fit text. */
|
|
1911
|
-
backgroundView?: ViewInput;
|
|
1912
|
-
}
|
|
1913
|
-
/**
|
|
1914
|
-
* Toast notification component for displaying transient messages.
|
|
1915
|
-
*
|
|
1916
|
-
* @example
|
|
1917
|
-
* ```ts
|
|
1918
|
-
* const toast = new Toast();
|
|
1919
|
-
* scene.container.addChild(toast);
|
|
1920
|
-
* await toast.show('Connection lost', 'error', 1920, 1080);
|
|
1921
|
-
* ```
|
|
1922
|
-
*/
|
|
1923
|
-
declare class Toast extends Container {
|
|
1924
|
-
readonly __uiComponent: true;
|
|
1925
|
-
private _bg;
|
|
1926
|
-
private _customBg;
|
|
1927
|
-
private _text;
|
|
1928
|
-
private _config;
|
|
1929
|
-
private _dismissPending;
|
|
1930
|
-
constructor(config?: ToastConfig);
|
|
1931
|
-
/**
|
|
1932
|
-
* Show a toast message.
|
|
1933
|
-
*/
|
|
1934
|
-
show(message: string, type?: ToastType, viewWidth?: number, viewHeight?: number): Promise<void>;
|
|
1935
|
-
/**
|
|
1936
|
-
* Dismiss the toast.
|
|
1937
|
-
*/
|
|
1938
|
-
dismiss(): Promise<void>;
|
|
1939
|
-
/** React reconciler update hook */
|
|
1940
|
-
updateConfig(changed: Record<string, any>): void;
|
|
1941
|
-
destroy(options?: boolean | {
|
|
1942
|
-
children?: boolean;
|
|
1943
|
-
texture?: boolean;
|
|
1944
|
-
textureSource?: boolean;
|
|
1945
|
-
}): void;
|
|
1946
|
-
}
|
|
1947
|
-
|
|
1948
|
-
type LayoutDirection = 'horizontal' | 'vertical' | 'grid' | 'wrap';
|
|
1949
|
-
type LayoutAlignment = 'start' | 'center' | 'end' | 'stretch';
|
|
1950
|
-
type LayoutAnchor = 'top-left' | 'top-center' | 'top-right' | 'center-left' | 'center' | 'center-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
1951
|
-
interface LayoutConfig {
|
|
1952
|
-
/** Layout direction (default: 'vertical') */
|
|
1953
|
-
direction?: LayoutDirection;
|
|
1954
|
-
/** Gap between children in pixels (default: 0) */
|
|
1955
|
-
gap?: number;
|
|
1956
|
-
/** Padding inside the layout container [top, right, bottom, left] or a single number */
|
|
1957
|
-
padding?: number | [number, number, number, number];
|
|
1958
|
-
/** Alignment of children on the cross axis (default: 'start') */
|
|
1959
|
-
alignment?: LayoutAlignment;
|
|
1960
|
-
/** Anchor point determining where the layout is positioned relative to its coordinates */
|
|
1961
|
-
anchor?: LayoutAnchor;
|
|
1962
|
-
/** Number of columns (only for 'grid' direction) */
|
|
1963
|
-
columns?: number;
|
|
1964
|
-
/** Maximum width for 'wrap' direction before wrapping to next line */
|
|
1965
|
-
maxWidth?: number;
|
|
1966
|
-
/** Whether to auto-layout when children change (default: true) */
|
|
1967
|
-
autoLayout?: boolean;
|
|
1968
|
-
/** Breakpoints: map of max viewport widths to override configs */
|
|
1969
|
-
breakpoints?: Record<number, Partial<LayoutConfig>>;
|
|
1970
|
-
}
|
|
1971
|
-
/**
|
|
1972
|
-
* Responsive layout container powered by a lightweight built-in flex layout solver.
|
|
1973
|
-
*
|
|
1974
|
-
* Supports horizontal, vertical, grid, and wrap layout modes with
|
|
1975
|
-
* alignment, padding, gap, and viewport-anchor positioning.
|
|
1976
|
-
* Breakpoints allow different layouts for different screen sizes.
|
|
1977
|
-
*
|
|
1978
|
-
* @example
|
|
1979
|
-
* ```ts
|
|
1980
|
-
* const toolbar = new Layout({
|
|
1981
|
-
* direction: 'horizontal',
|
|
1982
|
-
* gap: 20,
|
|
1983
|
-
* alignment: 'center',
|
|
1984
|
-
* anchor: 'bottom-center',
|
|
1985
|
-
* padding: 16,
|
|
1986
|
-
* breakpoints: {
|
|
1987
|
-
* 768: { direction: 'vertical', gap: 10 },
|
|
1988
|
-
* },
|
|
1989
|
-
* });
|
|
1990
|
-
*
|
|
1991
|
-
* toolbar.addItem(spinButton);
|
|
1992
|
-
* toolbar.addItem(betLabel);
|
|
1993
|
-
* scene.container.addChild(toolbar);
|
|
1994
|
-
*
|
|
1995
|
-
* toolbar.updateViewport(width, height);
|
|
1996
|
-
* ```
|
|
1997
|
-
*/
|
|
1998
|
-
declare class Layout extends Container {
|
|
1999
|
-
readonly __uiComponent: true;
|
|
2000
|
-
private _layoutConfig;
|
|
2001
|
-
private _padding;
|
|
2002
|
-
private _anchor;
|
|
2003
|
-
private _maxWidth;
|
|
2004
|
-
private _breakpoints;
|
|
2005
|
-
private _items;
|
|
2006
|
-
private _viewportWidth;
|
|
2007
|
-
private _viewportHeight;
|
|
2008
|
-
private _flex;
|
|
2009
|
-
constructor(config?: LayoutConfig);
|
|
2010
|
-
/** Add an item to the layout */
|
|
2011
|
-
addItem(child: Container): this;
|
|
2012
|
-
/** Remove an item from the layout */
|
|
2013
|
-
removeItem(child: Container): this;
|
|
2014
|
-
/** Remove all items */
|
|
2015
|
-
clearItems(): this;
|
|
2016
|
-
/** Get all layout items */
|
|
2017
|
-
get items(): readonly Container[];
|
|
2018
|
-
/**
|
|
2019
|
-
* Update the viewport size and recalculate layout.
|
|
2020
|
-
* Should be called from `Scene.onResize()`.
|
|
2021
|
-
*/
|
|
2022
|
-
updateViewport(width: number, height: number): void;
|
|
2023
|
-
private applyLayoutStyles;
|
|
2024
|
-
private buildFlexItemConfig;
|
|
2025
|
-
private applyAnchor;
|
|
2026
|
-
private resolveConfig;
|
|
2027
|
-
/** React reconciler update hook */
|
|
2028
|
-
updateConfig(changed: Record<string, any>): void;
|
|
2029
|
-
destroy(options?: boolean | {
|
|
2030
|
-
children?: boolean;
|
|
2031
|
-
texture?: boolean;
|
|
2032
|
-
textureSource?: boolean;
|
|
2033
|
-
}): void;
|
|
2034
|
-
}
|
|
2035
|
-
|
|
2036
|
-
type ScrollDirection = 'vertical' | 'horizontal' | 'both';
|
|
2037
|
-
interface ScrollContainerConfig {
|
|
2038
|
-
/** Visible viewport width */
|
|
2039
|
-
width: number;
|
|
2040
|
-
/** Visible viewport height */
|
|
2041
|
-
height: number;
|
|
2042
|
-
/** Scroll direction (default: 'vertical') */
|
|
2043
|
-
direction?: ScrollDirection;
|
|
2044
|
-
/** Background color (undefined = transparent) */
|
|
2045
|
-
backgroundColor?: ColorSource;
|
|
2046
|
-
/** Border radius for the mask (default: 0) */
|
|
2047
|
-
borderRadius?: number;
|
|
2048
|
-
/** Gap between items (default: 0) */
|
|
2049
|
-
elementsMargin?: number;
|
|
2050
|
-
/** Padding */
|
|
2051
|
-
padding?: number;
|
|
2052
|
-
/** Disable easing/inertia */
|
|
2053
|
-
disableEasing?: boolean;
|
|
2054
|
-
/** Show scrollbar indicator (default: false) */
|
|
2055
|
-
scrollbar?: boolean;
|
|
2056
|
-
/** Custom scrollbar thumb view (string texture name, Texture, or Container) */
|
|
2057
|
-
thumbView?: ViewInput;
|
|
2058
|
-
/** Scrollbar width in px (default: 6) */
|
|
2059
|
-
scrollbarWidth?: number;
|
|
2060
|
-
/** Scrollbar padding from edge (default: 4) */
|
|
2061
|
-
scrollbarPadding?: number;
|
|
2062
|
-
/** Scrollbar color (when no thumbView, default: 0xaaaaaa) */
|
|
2063
|
-
scrollbarColor?: number;
|
|
2064
|
-
/** Scrollbar alpha (default: 0.5) */
|
|
2065
|
-
scrollbarAlpha?: number;
|
|
2066
|
-
}
|
|
2067
|
-
/**
|
|
2068
|
-
* Scrollable container with touch/drag, mouse wheel, and inertia.
|
|
2069
|
-
*
|
|
2070
|
-
* @example
|
|
2071
|
-
* ```ts
|
|
2072
|
-
* const scroll = new ScrollContainer({
|
|
2073
|
-
* width: 600,
|
|
2074
|
-
* height: 400,
|
|
2075
|
-
* direction: 'vertical',
|
|
2076
|
-
* elementsMargin: 8,
|
|
2077
|
-
* });
|
|
2078
|
-
*
|
|
2079
|
-
* for (let i = 0; i < 50; i++) {
|
|
2080
|
-
* scroll.addItem(createRow(i));
|
|
2081
|
-
* }
|
|
2082
|
-
*
|
|
2083
|
-
* scene.container.addChild(scroll);
|
|
2084
|
-
* ```
|
|
2085
|
-
*/
|
|
2086
|
-
declare class ScrollContainer extends Container {
|
|
2087
|
-
readonly __uiComponent: true;
|
|
2088
|
-
private _viewport;
|
|
2089
|
-
private _internalSetup;
|
|
2090
|
-
private _content;
|
|
2091
|
-
private _maskGfx;
|
|
2092
|
-
private _bg;
|
|
2093
|
-
private _scrollConfig;
|
|
2094
|
-
private _items;
|
|
2095
|
-
private _scrollbar;
|
|
2096
|
-
private _scrollbarConfig;
|
|
2097
|
-
private _dragging;
|
|
2098
|
-
private _dragStart;
|
|
2099
|
-
private _contentStart;
|
|
2100
|
-
private _velocity;
|
|
2101
|
-
private _lastDragPos;
|
|
2102
|
-
private _lastDragTime;
|
|
2103
|
-
private _inertiaActive;
|
|
2104
|
-
private _onTickBound;
|
|
2105
|
-
private _onWheelBound;
|
|
2106
|
-
constructor(config: ScrollContainerConfig);
|
|
2107
|
-
/**
|
|
2108
|
-
* Override addChild so external children are routed to scroll content.
|
|
2109
|
-
* Enables `<scrollContainer><label /><panel /></scrollContainer>` in React JSX.
|
|
2110
|
-
*/
|
|
2111
|
-
addChild<T extends Container>(...children: T[]): T;
|
|
2112
|
-
removeChild<T extends Container>(...children: T[]): T;
|
|
2113
|
-
/** React reconciler update hook */
|
|
2114
|
-
updateConfig(changed: Record<string, any>): void;
|
|
2115
|
-
/** Enable mouse wheel scrolling (call after adding to stage) */
|
|
2116
|
-
enableWheel(canvas: HTMLCanvasElement): void;
|
|
2117
|
-
/** Set scrollable content. Replaces any existing items. */
|
|
2118
|
-
setContent(content: Container): void;
|
|
2119
|
-
/** Add a single item */
|
|
2120
|
-
addItem(child: Container): this;
|
|
2121
|
-
/** Remove all items */
|
|
2122
|
-
clearItems(): void;
|
|
2123
|
-
/** Get items */
|
|
2124
|
-
get items(): readonly Container[];
|
|
2125
|
-
/** Scroll to make a specific item index visible */
|
|
2126
|
-
scrollToItem(index: number): void;
|
|
2127
|
-
/** Current scroll position */
|
|
2128
|
-
get scrollPosition(): {
|
|
2129
|
-
x: number;
|
|
2130
|
-
y: number;
|
|
2131
|
-
};
|
|
2132
|
-
/** Resize the scroll viewport */
|
|
2133
|
-
setViewportSize(width: number, height: number): void;
|
|
2134
|
-
private layoutItems;
|
|
2135
|
-
private _onPointerDown;
|
|
2136
|
-
private _onPointerMove;
|
|
2137
|
-
private _onPointerUp;
|
|
2138
|
-
private startInertia;
|
|
2139
|
-
private stopInertia;
|
|
2140
|
-
private _inertiaTick;
|
|
2141
|
-
private _onWheel;
|
|
2142
|
-
private clampScroll;
|
|
2143
|
-
private updateScrollbar;
|
|
2144
|
-
destroy(options?: boolean | {
|
|
2145
|
-
children?: boolean;
|
|
2146
|
-
texture?: boolean;
|
|
2147
|
-
textureSource?: boolean;
|
|
2148
|
-
}): void;
|
|
2149
|
-
}
|
|
2150
|
-
|
|
2151
1134
|
/**
|
|
2152
1135
|
* Built-in loading screen.
|
|
2153
1136
|
*
|
|
@@ -2182,5 +1165,5 @@ declare class LoadingScene extends Scene {
|
|
|
2182
1165
|
private transitionToGame;
|
|
2183
1166
|
}
|
|
2184
1167
|
|
|
2185
|
-
export { AssetManager, AudioManager,
|
|
2186
|
-
export type {
|
|
1168
|
+
export { AssetManager, AudioManager, Easing, EventEmitter, FPSOverlay, GameApplication, InputManager, LoadingScene, Orientation, ScaleMode, Scene, SceneManager, SpineHelper, SpriteAnimation, Timeline, TransitionType, Tween, ViewportManager };
|
|
1169
|
+
export type { AudioConfig, EasingFunction, GameApplicationConfig, GameEngineEvents, IScene, SceneConstructor, SpriteAnimationConfig, TransitionConfig, TweenOptions };
|