bard-legends-framework 1.11.3 → 1.11.5
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/AGENTS.md +61 -4
- package/dist/index.d.mts +113 -71
- package/dist/index.d.ts +113 -71
- package/dist/index.js +3 -3
- package/dist/index.mjs +3 -3
- package/package.json +5 -4
package/AGENTS.md
CHANGED
|
@@ -324,10 +324,67 @@ Resolve via constructor injection or `Service.get(X)`:
|
|
|
324
324
|
|
|
325
325
|
## Testing
|
|
326
326
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
327
|
+
All testing utilities live on `BardLegendsTestingHelper`.
|
|
328
|
+
|
|
329
|
+
### Concepts
|
|
330
|
+
|
|
331
|
+
- **`BardLegendsTestingHelper.hardReset()`** — call it first thing in `beforeEach`. It calls
|
|
332
|
+
`ActionLib.hardReset()` itself (no separate call needed) and resets all per-test state: DI
|
|
333
|
+
service instances, entity instances, singleton creation latches, and mock gateway bindings.
|
|
334
|
+
**Import-time registrations survive the reset** — `@ServiceDecorator`/`@EntityDecorator`
|
|
335
|
+
metadata and real controller→gateway bindings stay valid, so modules imported once at the top
|
|
336
|
+
of a test file keep working across tests.
|
|
337
|
+
- **Module-level (gateway) tests** — a module's public surface is its gateway. Test through
|
|
338
|
+
`Service.get(TheGateway)`: side-effect-import the module's own `*.controller.ts` (this registers
|
|
339
|
+
the real controller and pulls in its services/entities), and do **not** import any `*.view.ts`
|
|
340
|
+
(unimported views never activate, so entities render nothing).
|
|
341
|
+
- **`BardLegendsTestingHelper.bindMockControllerToGateway(Gateway, mock)`** — fills a foreign
|
|
342
|
+
module's gateway with a mock controller, exactly like `@ControllerDecorator` does for a real
|
|
343
|
+
one. Since the foreign module's controller file is never imported in the test, its gateway
|
|
344
|
+
prototype is empty; the mock's prototype methods fill it. Colliding with an already registered
|
|
345
|
+
method throws. All mock bindings are removed on the next `hardReset()`, so bind them in every
|
|
346
|
+
test's setup, after the reset.
|
|
347
|
+
- Mocks are plain classes matching the foreign controller's shape (`implements
|
|
348
|
+
Partial<TheController>`): mutable public fields for state, regular class methods reading them.
|
|
349
|
+
Methods must live on the prototype — arrow-function fields are not bound.
|
|
350
|
+
|
|
351
|
+
### Sample (module test with a mocked neighbor)
|
|
352
|
+
|
|
353
|
+
```ts
|
|
354
|
+
import './sample.controller'; // registers the module under test
|
|
355
|
+
|
|
356
|
+
describe('SampleController', () => {
|
|
357
|
+
let otherGatewayMock: OtherGatewayMock;
|
|
358
|
+
let sampleGateway: InstanceType<typeof SampleGateway>;
|
|
359
|
+
|
|
360
|
+
beforeEach(() => {
|
|
361
|
+
BardLegendsTestingHelper.hardReset(); // always first
|
|
362
|
+
otherGatewayMock = new OtherGatewayMock();
|
|
363
|
+
BardLegendsTestingHelper.bindMockControllerToGateway(OtherGateway, otherGatewayMock);
|
|
364
|
+
sampleGateway = Service.get(SampleGateway);
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
test('does the thing', () => {
|
|
368
|
+
otherGatewayMock.value = 42; // steer the mock through its state fields
|
|
369
|
+
expect(sampleGateway.doTheThing()).toEqual(42);
|
|
370
|
+
});
|
|
371
|
+
});
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### Do / Don't
|
|
375
|
+
|
|
376
|
+
```ts
|
|
377
|
+
// DO: hardReset() first in beforeEach, then bind mocks, then Service.get(...) fresh handles.
|
|
378
|
+
// DO: test a module only through its gateway; mock every foreign gateway it reaches.
|
|
379
|
+
// DO: drive frames with UpdateCycle.triggerUpdateTick(delta); use fake timers for wait/animations.
|
|
380
|
+
// DO: assert synchronously — actions-lib delivery is synchronous, most flows need no awaiting.
|
|
381
|
+
|
|
382
|
+
// DON'T: import another module's *.controller.ts or any *.view.ts in a module test.
|
|
383
|
+
// DON'T: use arrow-function fields as mock methods — only prototype methods are bound.
|
|
384
|
+
// DON'T: hold gateway/service references across tests — re-fetch after each hardReset().
|
|
385
|
+
// DON'T: put state in services — controllers/services persist across hardReset by design;
|
|
386
|
+
// per-test state belongs in entities, which do reset.
|
|
387
|
+
```
|
|
331
388
|
|
|
332
389
|
---
|
|
333
390
|
|
package/dist/index.d.mts
CHANGED
|
@@ -3,6 +3,7 @@ import { IDAttachable, AttachmentID, Attachable, IdleSingleEvent, IdleSequence,
|
|
|
3
3
|
import { Vector, DynamicID, Vec2, RGBColor, Radian, Rectangle, Grid, GridNeighborType, Line } from 'helpers-lib';
|
|
4
4
|
import p2$1 from 'p2';
|
|
5
5
|
import * as Pixi from 'pixi.js';
|
|
6
|
+
import { LayoutStyles } from '@pixi/layout';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Binds a controller to its gateway (the class produced by `Gateway<T>()`). The controller must
|
|
@@ -79,11 +80,6 @@ declare abstract class SingletonEntity extends Entity {
|
|
|
79
80
|
*/
|
|
80
81
|
declare function Gateway<TController>(): new () => TController;
|
|
81
82
|
|
|
82
|
-
declare class BardLegendsHardReset {
|
|
83
|
-
static readonly onHardReset: actions_lib.Notifier<void>;
|
|
84
|
-
static hardReset(): void;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
83
|
type SceneClassType = new (...services: any[]) => Scene<any, any>;
|
|
88
84
|
type SceneInput<T> = T extends Scene<infer I, any> ? I : never;
|
|
89
85
|
declare function SceneDecorator(): (SceneClass: SceneClassType) => any;
|
|
@@ -113,6 +109,23 @@ declare class Service {
|
|
|
113
109
|
static get<T extends Service>(ServiceClass: new (...args: any[]) => T): T;
|
|
114
110
|
}
|
|
115
111
|
|
|
112
|
+
declare class BardLegendsTestingHelper {
|
|
113
|
+
static readonly onHardReset: actions_lib.Notifier<void>;
|
|
114
|
+
static hardReset(): void;
|
|
115
|
+
/**
|
|
116
|
+
* Binds a partial mock controller to a gateway, exactly like `@ControllerDecorator` does for a
|
|
117
|
+
* real controller — its prototype methods are installed onto the gateway prototype. Intended for
|
|
118
|
+
* tests where the module behind a gateway is not loaded: the real controller never registers
|
|
119
|
+
* (controllers load via the eager `*.controller.ts` glob, which tests skip), so the mock's
|
|
120
|
+
* methods fill the gateway.
|
|
121
|
+
*
|
|
122
|
+
* The mock's methods must be prototype methods (regular class methods, not arrow-function
|
|
123
|
+
* fields). Colliding with an already registered method throws. All mock bindings are removed on
|
|
124
|
+
* `hardReset()`, so bind mocks in each test's setup after the reset.
|
|
125
|
+
*/
|
|
126
|
+
static bindMockControllerToGateway<TController>(GatewayClass: new () => TController, mock: Partial<TController>): void;
|
|
127
|
+
}
|
|
128
|
+
|
|
116
129
|
declare class UpdateCycle {
|
|
117
130
|
static readonly beforeSceneUpdateAction: actions_lib.Notifier<{
|
|
118
131
|
time: number;
|
|
@@ -310,6 +323,7 @@ declare class Game {
|
|
|
310
323
|
readonly devMode: boolean;
|
|
311
324
|
constructor(partialConfiguration?: Partial<GameConfiguration>);
|
|
312
325
|
setup(setupOptions: GameSetupOptions): Promise<void>;
|
|
326
|
+
generateTexture(options: Pixi.GenerateTextureOptions | Pixi.Container): Pixi.Texture;
|
|
313
327
|
setResolution(resolution: number): void;
|
|
314
328
|
}
|
|
315
329
|
|
|
@@ -395,40 +409,17 @@ declare class MusicPlayer extends IDAttachable {
|
|
|
395
409
|
close(): IdleSingleEvent;
|
|
396
410
|
}
|
|
397
411
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
PointerUp = "pointerup",
|
|
404
|
-
PointerUpOutside = "pointerupoutside",
|
|
405
|
-
PointerMove = "pointermove",
|
|
406
|
-
PointerCancel = "pointercancel",
|
|
407
|
-
PointerOver = "pointerover",
|
|
408
|
-
PointerOut = "pointerout",
|
|
409
|
-
PointerEnter = "pointerenter",
|
|
410
|
-
PointerLeave = "pointerleave",
|
|
411
|
-
Added = "added",
|
|
412
|
-
Removed = "removed",
|
|
413
|
-
Update = "update",
|
|
414
|
-
Change = "change",
|
|
415
|
-
Wheel = "wheel"
|
|
416
|
-
}
|
|
417
|
-
type ContainerEventTypeToResultType = {
|
|
418
|
-
[K in ContainerEventType]: K extends ContainerEventType.Wheel ? {
|
|
419
|
-
deltaY: number;
|
|
420
|
-
} : undefined;
|
|
421
|
-
};
|
|
422
|
-
declare enum Cursor {
|
|
423
|
-
Default = "default",
|
|
424
|
-
Pointer = "pointer"
|
|
412
|
+
interface PixiDisplayObject {
|
|
413
|
+
x: number;
|
|
414
|
+
y: number;
|
|
415
|
+
rotation: number;
|
|
416
|
+
alpha: number;
|
|
425
417
|
}
|
|
426
|
-
declare abstract class
|
|
427
|
-
protected
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
setSize(value: Vector): this;
|
|
418
|
+
declare abstract class DisplayObjectAttributes extends IDAttachable {
|
|
419
|
+
protected readonly _pixiDisplayObject: PixiDisplayObject;
|
|
420
|
+
protected constructor(_pixiDisplayObject: PixiDisplayObject);
|
|
421
|
+
protected abstract _applyScale(x: number, y: number): void;
|
|
422
|
+
protected abstract _getHoldFromModifier(holdFrom: Vector): Vector;
|
|
432
423
|
/**
|
|
433
424
|
* @param value The position to set
|
|
434
425
|
* @param options.holdFrom An anchor point to hold the position from
|
|
@@ -445,7 +436,6 @@ declare abstract class ContainerAttributes extends IDAttachable {
|
|
|
445
436
|
set x(value: number);
|
|
446
437
|
get y(): number;
|
|
447
438
|
set y(value: number);
|
|
448
|
-
on<T extends ContainerEventType>(eventType: T): Sequence<ContainerEventTypeToResultType[T]>;
|
|
449
439
|
setRotation(value: Radian): this;
|
|
450
440
|
get rotation(): Radian;
|
|
451
441
|
set rotation(value: Radian);
|
|
@@ -454,38 +444,9 @@ declare abstract class ContainerAttributes extends IDAttachable {
|
|
|
454
444
|
*/
|
|
455
445
|
get rotationValue(): number;
|
|
456
446
|
set rotationValue(value: number);
|
|
457
|
-
setZIndex(value: number): this;
|
|
458
|
-
get zIndex(): number;
|
|
459
|
-
set zIndex(value: number);
|
|
460
|
-
setSkewX(radian: Radian): this;
|
|
461
|
-
get skewX(): Radian;
|
|
462
|
-
set skewX(radian: Radian);
|
|
463
|
-
setSkewY(radian: Radian): this;
|
|
464
|
-
get skewY(): Radian;
|
|
465
|
-
set skewY(radian: Radian);
|
|
466
|
-
setSortableChildren(value: boolean): this;
|
|
467
|
-
get sortableChildren(): boolean;
|
|
468
|
-
set sortableChildren(value: boolean);
|
|
469
447
|
setAlpha(value: number): this;
|
|
470
448
|
get alpha(): number;
|
|
471
449
|
set alpha(value: number);
|
|
472
|
-
setInteractive(value: boolean): this;
|
|
473
|
-
get interactive(): boolean;
|
|
474
|
-
set interactive(value: boolean);
|
|
475
|
-
/**
|
|
476
|
-
* Renders this subtree as an isolated render group: its cached render instructions are not
|
|
477
|
-
* rebuilt when other parts of the scene change, and moving the group only updates one transform.
|
|
478
|
-
* Use for subtrees that move as a whole (world under a camera) or rarely change (HUD vs world).
|
|
479
|
-
*/
|
|
480
|
-
setRenderGroup(value?: boolean): this;
|
|
481
|
-
setCursor(value: Cursor): this;
|
|
482
|
-
get cursor(): Cursor;
|
|
483
|
-
set cursor(value: Cursor);
|
|
484
|
-
protected getMask(): Pixi.Container;
|
|
485
|
-
setMask(mask: ContainerAttributes | undefined): this;
|
|
486
|
-
hitTest(stagePosition: Vector): boolean;
|
|
487
|
-
get boundingBox(): Rectangle;
|
|
488
|
-
ignoreBounds(value?: boolean): this;
|
|
489
450
|
setMirror(mirror?: boolean): this;
|
|
490
451
|
get mirror(): boolean;
|
|
491
452
|
set mirror(value: boolean);
|
|
@@ -560,11 +521,40 @@ declare class Sprite extends Container {
|
|
|
560
521
|
download(): this;
|
|
561
522
|
}
|
|
562
523
|
|
|
524
|
+
type LayoutStyle = LayoutStyles;
|
|
525
|
+
declare enum ContainerEventType {
|
|
526
|
+
Click = "click",
|
|
527
|
+
MouseOver = "mouseover",
|
|
528
|
+
MouseOut = "mouseout",
|
|
529
|
+
PointerDown = "pointerdown",
|
|
530
|
+
PointerUp = "pointerup",
|
|
531
|
+
PointerUpOutside = "pointerupoutside",
|
|
532
|
+
PointerMove = "pointermove",
|
|
533
|
+
PointerCancel = "pointercancel",
|
|
534
|
+
PointerOver = "pointerover",
|
|
535
|
+
PointerOut = "pointerout",
|
|
536
|
+
PointerEnter = "pointerenter",
|
|
537
|
+
PointerLeave = "pointerleave",
|
|
538
|
+
Added = "added",
|
|
539
|
+
Removed = "removed",
|
|
540
|
+
Update = "update",
|
|
541
|
+
Change = "change",
|
|
542
|
+
Wheel = "wheel"
|
|
543
|
+
}
|
|
544
|
+
type ContainerEventTypeToResultType = {
|
|
545
|
+
[K in ContainerEventType]: K extends ContainerEventType.Wheel ? {
|
|
546
|
+
deltaY: number;
|
|
547
|
+
} : undefined;
|
|
548
|
+
};
|
|
549
|
+
declare enum Cursor {
|
|
550
|
+
Default = "default",
|
|
551
|
+
Pointer = "pointer"
|
|
552
|
+
}
|
|
563
553
|
interface SetParentOptions {
|
|
564
554
|
addUnder: boolean;
|
|
565
555
|
cropOverflowingParts: boolean;
|
|
566
556
|
}
|
|
567
|
-
declare class Container extends
|
|
557
|
+
declare class Container extends DisplayObjectAttributes {
|
|
568
558
|
protected static allContainers: Map<number, Container>;
|
|
569
559
|
readonly filters: Filters;
|
|
570
560
|
protected addChildTo: Container;
|
|
@@ -572,8 +562,50 @@ declare class Container extends ContainerAttributes {
|
|
|
572
562
|
addUnder: boolean;
|
|
573
563
|
cropOverflowingParts: boolean;
|
|
574
564
|
};
|
|
575
|
-
constructor();
|
|
565
|
+
constructor(pixiContainer?: Pixi.Container);
|
|
576
566
|
destroy(): void;
|
|
567
|
+
protected _applyScale(x: number, y: number): void;
|
|
568
|
+
protected _getHoldFromModifier(holdFrom: Vector): Vector;
|
|
569
|
+
get size(): Vector;
|
|
570
|
+
set size(value: Vector);
|
|
571
|
+
getSize(): Vector;
|
|
572
|
+
setSize(value: Vector): this;
|
|
573
|
+
/**
|
|
574
|
+
* Makes this object a flex item of a LayoutContainer parent, treated as a box measured by its bounds.
|
|
575
|
+
* @param style Optional per-item overrides (alignSelf, margins, width, height...)
|
|
576
|
+
* @returns this
|
|
577
|
+
*/
|
|
578
|
+
setLayout(style?: LayoutStyle): this;
|
|
579
|
+
on<T extends ContainerEventType>(eventType: T): Sequence<ContainerEventTypeToResultType[T]>;
|
|
580
|
+
setZIndex(value: number): this;
|
|
581
|
+
get zIndex(): number;
|
|
582
|
+
set zIndex(value: number);
|
|
583
|
+
setSkewX(radian: Radian): this;
|
|
584
|
+
get skewX(): Radian;
|
|
585
|
+
set skewX(radian: Radian);
|
|
586
|
+
setSkewY(radian: Radian): this;
|
|
587
|
+
get skewY(): Radian;
|
|
588
|
+
set skewY(radian: Radian);
|
|
589
|
+
setSortableChildren(value: boolean): this;
|
|
590
|
+
get sortableChildren(): boolean;
|
|
591
|
+
set sortableChildren(value: boolean);
|
|
592
|
+
setInteractive(value: boolean): this;
|
|
593
|
+
get interactive(): boolean;
|
|
594
|
+
set interactive(value: boolean);
|
|
595
|
+
/**
|
|
596
|
+
* Renders this subtree as an isolated render group: its cached render instructions are not
|
|
597
|
+
* rebuilt when other parts of the scene change, and moving the group only updates one transform.
|
|
598
|
+
* Use for subtrees that move as a whole (world under a camera) or rarely change (HUD vs world).
|
|
599
|
+
*/
|
|
600
|
+
setRenderGroup(value?: boolean): this;
|
|
601
|
+
setCursor(value: Cursor): this;
|
|
602
|
+
get cursor(): Cursor;
|
|
603
|
+
set cursor(value: Cursor);
|
|
604
|
+
protected getMask(): Pixi.Container;
|
|
605
|
+
setMask(mask: Container | undefined): this;
|
|
606
|
+
hitTest(stagePosition: Vector): boolean;
|
|
607
|
+
get boundingBox(): Rectangle;
|
|
608
|
+
ignoreBounds(value?: boolean): this;
|
|
577
609
|
getBoundingMask(): Sprite;
|
|
578
610
|
displayParent(parent: Container | number, partialOptions?: Partial<SetParentOptions>): this;
|
|
579
611
|
}
|
|
@@ -970,6 +1002,16 @@ declare class ScrollMaskUI extends Container {
|
|
|
970
1002
|
constructor(container: Container, size: Vector, padding: number, direction?: ScrollDirection);
|
|
971
1003
|
}
|
|
972
1004
|
|
|
1005
|
+
/**
|
|
1006
|
+
* A flexbox container.
|
|
1007
|
+
*/
|
|
1008
|
+
declare class LayoutContainer extends Container {
|
|
1009
|
+
constructor(style?: LayoutStyle);
|
|
1010
|
+
setLayout(style: LayoutStyle): this;
|
|
1011
|
+
debug(): this;
|
|
1012
|
+
debugBackground(): this;
|
|
1013
|
+
}
|
|
1014
|
+
|
|
973
1015
|
interface KeyboardKeyInfo {
|
|
974
1016
|
readonly key: string;
|
|
975
1017
|
readonly code: string;
|
|
@@ -1330,4 +1372,4 @@ declare abstract class MovablePhysicsEntity extends PhysicsEntity {
|
|
|
1330
1372
|
convertToDTO(): PhysicsBodyDTO;
|
|
1331
1373
|
}
|
|
1332
1374
|
|
|
1333
|
-
export { AdvancedSound, type AdvancedSoundOptions, AnimationFlicker, AnimationInterpolationFunctions, type AnimationOptions, Animations, AnimationsCompletionHandlingType, Animator, type AnimatorAnimation, type AssetDefinition, type AudioAppearTransitionType, BORDER_MATERIAL_NAME,
|
|
1375
|
+
export { AdvancedSound, type AdvancedSoundOptions, AnimationFlicker, AnimationInterpolationFunctions, type AnimationOptions, Animations, AnimationsCompletionHandlingType, Animator, type AnimatorAnimation, type AssetDefinition, type AudioAppearTransitionType, BORDER_MATERIAL_NAME, BardLegendsTestingHelper, type BlendMode, type BorderProperties, Camera, CameraGateway, type CircleShapeData, ClosestAvailableSpaceHelper, type CollisionDetails, type CollisionReport, Container, ContainerEventType, ControllerDecorator, type CreateDashedLineOptions, type CreatePhysicsWorldRequestDTO, Cursor, DEFAULT_SHADER_RESOLUTION, DeltaTime, DisplayObjectArray, type DisplayObjectArrayOptions, type DropShadowOptions, Entity, EntityDecorator, type EntityID, type ExplosionHit, FadeInContent, type FadeInContentOptions, FocusingAnimation, Game, Gateway, type GlowEffectOptions, type GlowOptions, type GlowingShapeDefinition, Graphics, type HitTestOptions, ImmovablePhysicsEntity, type InteractingBodyGroups, type KeyboardKeyInfo, KeyboardService, LayoutContainer, type LayoutStyle, type MapSizeDTO, type MaterialContactDefinition, type MaterialDefinition, MenuEntity, type MenuOptions, MenuUI, MenuView, MouseService, MouseTargetFocusService, MovableEntity, MovablePhysicsEntity, Music, MusicPlayer, type MusicPlayerOptions, type PartialTextOptions, PathFinder, type PathFinderResult, type PhysicsBodyDTO, PhysicsEntity, type PhysicsEntityDefinition, type PhysicsExplosionOptions, PhysicsGateway, PhysicsShapeType, type PhysicsWorldID, Placeholder, type PolygonDefinition, type PolygonShapeData, ROTATIONAL_SPEED_LIMIT, type RayCast, type RayCastHit, ReAnimateHandlingType, type RectangleShapeData, RichText, type RichTextOptions, type RichTextRectangleCut, type RichTextStyles, SOUND_TRANSITION_DURATION, SPEED_LIMIT, Scene, SceneDecorator, ScrollAreaUI, ScrollDirection, type ScrollInContentOptions, ScrollMaskUI, Service, ServiceDecorator, type SetParentOptions, type ShapeDefinition, SingletonEntity, SlideInContent, SlideInContentByIndex, SlideStateAnimation, SlideStateAnimationState, Sound, type SoundDefinition, type SoundID, type SoundIDRegistry, type SoundOptions, Sprite, type SpriteDefinition, type SpriteID, type SpriteIDRegistry, StateAnimation, type StateAnimationOptions, type StateAnimationState, Text, type TextAlignment, type TextOptions, ThroughEmptyStateAnimation, UpdatableContainer, UpdateCycle, VectorFieldPathFinder, VectorSet, View, ViewDecorator, type ViewDecoratorMeta };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { IDAttachable, AttachmentID, Attachable, IdleSingleEvent, IdleSequence,
|
|
|
3
3
|
import { Vector, DynamicID, Vec2, RGBColor, Radian, Rectangle, Grid, GridNeighborType, Line } from 'helpers-lib';
|
|
4
4
|
import p2$1 from 'p2';
|
|
5
5
|
import * as Pixi from 'pixi.js';
|
|
6
|
+
import { LayoutStyles } from '@pixi/layout';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Binds a controller to its gateway (the class produced by `Gateway<T>()`). The controller must
|
|
@@ -79,11 +80,6 @@ declare abstract class SingletonEntity extends Entity {
|
|
|
79
80
|
*/
|
|
80
81
|
declare function Gateway<TController>(): new () => TController;
|
|
81
82
|
|
|
82
|
-
declare class BardLegendsHardReset {
|
|
83
|
-
static readonly onHardReset: actions_lib.Notifier<void>;
|
|
84
|
-
static hardReset(): void;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
83
|
type SceneClassType = new (...services: any[]) => Scene<any, any>;
|
|
88
84
|
type SceneInput<T> = T extends Scene<infer I, any> ? I : never;
|
|
89
85
|
declare function SceneDecorator(): (SceneClass: SceneClassType) => any;
|
|
@@ -113,6 +109,23 @@ declare class Service {
|
|
|
113
109
|
static get<T extends Service>(ServiceClass: new (...args: any[]) => T): T;
|
|
114
110
|
}
|
|
115
111
|
|
|
112
|
+
declare class BardLegendsTestingHelper {
|
|
113
|
+
static readonly onHardReset: actions_lib.Notifier<void>;
|
|
114
|
+
static hardReset(): void;
|
|
115
|
+
/**
|
|
116
|
+
* Binds a partial mock controller to a gateway, exactly like `@ControllerDecorator` does for a
|
|
117
|
+
* real controller — its prototype methods are installed onto the gateway prototype. Intended for
|
|
118
|
+
* tests where the module behind a gateway is not loaded: the real controller never registers
|
|
119
|
+
* (controllers load via the eager `*.controller.ts` glob, which tests skip), so the mock's
|
|
120
|
+
* methods fill the gateway.
|
|
121
|
+
*
|
|
122
|
+
* The mock's methods must be prototype methods (regular class methods, not arrow-function
|
|
123
|
+
* fields). Colliding with an already registered method throws. All mock bindings are removed on
|
|
124
|
+
* `hardReset()`, so bind mocks in each test's setup after the reset.
|
|
125
|
+
*/
|
|
126
|
+
static bindMockControllerToGateway<TController>(GatewayClass: new () => TController, mock: Partial<TController>): void;
|
|
127
|
+
}
|
|
128
|
+
|
|
116
129
|
declare class UpdateCycle {
|
|
117
130
|
static readonly beforeSceneUpdateAction: actions_lib.Notifier<{
|
|
118
131
|
time: number;
|
|
@@ -310,6 +323,7 @@ declare class Game {
|
|
|
310
323
|
readonly devMode: boolean;
|
|
311
324
|
constructor(partialConfiguration?: Partial<GameConfiguration>);
|
|
312
325
|
setup(setupOptions: GameSetupOptions): Promise<void>;
|
|
326
|
+
generateTexture(options: Pixi.GenerateTextureOptions | Pixi.Container): Pixi.Texture;
|
|
313
327
|
setResolution(resolution: number): void;
|
|
314
328
|
}
|
|
315
329
|
|
|
@@ -395,40 +409,17 @@ declare class MusicPlayer extends IDAttachable {
|
|
|
395
409
|
close(): IdleSingleEvent;
|
|
396
410
|
}
|
|
397
411
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
PointerUp = "pointerup",
|
|
404
|
-
PointerUpOutside = "pointerupoutside",
|
|
405
|
-
PointerMove = "pointermove",
|
|
406
|
-
PointerCancel = "pointercancel",
|
|
407
|
-
PointerOver = "pointerover",
|
|
408
|
-
PointerOut = "pointerout",
|
|
409
|
-
PointerEnter = "pointerenter",
|
|
410
|
-
PointerLeave = "pointerleave",
|
|
411
|
-
Added = "added",
|
|
412
|
-
Removed = "removed",
|
|
413
|
-
Update = "update",
|
|
414
|
-
Change = "change",
|
|
415
|
-
Wheel = "wheel"
|
|
416
|
-
}
|
|
417
|
-
type ContainerEventTypeToResultType = {
|
|
418
|
-
[K in ContainerEventType]: K extends ContainerEventType.Wheel ? {
|
|
419
|
-
deltaY: number;
|
|
420
|
-
} : undefined;
|
|
421
|
-
};
|
|
422
|
-
declare enum Cursor {
|
|
423
|
-
Default = "default",
|
|
424
|
-
Pointer = "pointer"
|
|
412
|
+
interface PixiDisplayObject {
|
|
413
|
+
x: number;
|
|
414
|
+
y: number;
|
|
415
|
+
rotation: number;
|
|
416
|
+
alpha: number;
|
|
425
417
|
}
|
|
426
|
-
declare abstract class
|
|
427
|
-
protected
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
setSize(value: Vector): this;
|
|
418
|
+
declare abstract class DisplayObjectAttributes extends IDAttachable {
|
|
419
|
+
protected readonly _pixiDisplayObject: PixiDisplayObject;
|
|
420
|
+
protected constructor(_pixiDisplayObject: PixiDisplayObject);
|
|
421
|
+
protected abstract _applyScale(x: number, y: number): void;
|
|
422
|
+
protected abstract _getHoldFromModifier(holdFrom: Vector): Vector;
|
|
432
423
|
/**
|
|
433
424
|
* @param value The position to set
|
|
434
425
|
* @param options.holdFrom An anchor point to hold the position from
|
|
@@ -445,7 +436,6 @@ declare abstract class ContainerAttributes extends IDAttachable {
|
|
|
445
436
|
set x(value: number);
|
|
446
437
|
get y(): number;
|
|
447
438
|
set y(value: number);
|
|
448
|
-
on<T extends ContainerEventType>(eventType: T): Sequence<ContainerEventTypeToResultType[T]>;
|
|
449
439
|
setRotation(value: Radian): this;
|
|
450
440
|
get rotation(): Radian;
|
|
451
441
|
set rotation(value: Radian);
|
|
@@ -454,38 +444,9 @@ declare abstract class ContainerAttributes extends IDAttachable {
|
|
|
454
444
|
*/
|
|
455
445
|
get rotationValue(): number;
|
|
456
446
|
set rotationValue(value: number);
|
|
457
|
-
setZIndex(value: number): this;
|
|
458
|
-
get zIndex(): number;
|
|
459
|
-
set zIndex(value: number);
|
|
460
|
-
setSkewX(radian: Radian): this;
|
|
461
|
-
get skewX(): Radian;
|
|
462
|
-
set skewX(radian: Radian);
|
|
463
|
-
setSkewY(radian: Radian): this;
|
|
464
|
-
get skewY(): Radian;
|
|
465
|
-
set skewY(radian: Radian);
|
|
466
|
-
setSortableChildren(value: boolean): this;
|
|
467
|
-
get sortableChildren(): boolean;
|
|
468
|
-
set sortableChildren(value: boolean);
|
|
469
447
|
setAlpha(value: number): this;
|
|
470
448
|
get alpha(): number;
|
|
471
449
|
set alpha(value: number);
|
|
472
|
-
setInteractive(value: boolean): this;
|
|
473
|
-
get interactive(): boolean;
|
|
474
|
-
set interactive(value: boolean);
|
|
475
|
-
/**
|
|
476
|
-
* Renders this subtree as an isolated render group: its cached render instructions are not
|
|
477
|
-
* rebuilt when other parts of the scene change, and moving the group only updates one transform.
|
|
478
|
-
* Use for subtrees that move as a whole (world under a camera) or rarely change (HUD vs world).
|
|
479
|
-
*/
|
|
480
|
-
setRenderGroup(value?: boolean): this;
|
|
481
|
-
setCursor(value: Cursor): this;
|
|
482
|
-
get cursor(): Cursor;
|
|
483
|
-
set cursor(value: Cursor);
|
|
484
|
-
protected getMask(): Pixi.Container;
|
|
485
|
-
setMask(mask: ContainerAttributes | undefined): this;
|
|
486
|
-
hitTest(stagePosition: Vector): boolean;
|
|
487
|
-
get boundingBox(): Rectangle;
|
|
488
|
-
ignoreBounds(value?: boolean): this;
|
|
489
450
|
setMirror(mirror?: boolean): this;
|
|
490
451
|
get mirror(): boolean;
|
|
491
452
|
set mirror(value: boolean);
|
|
@@ -560,11 +521,40 @@ declare class Sprite extends Container {
|
|
|
560
521
|
download(): this;
|
|
561
522
|
}
|
|
562
523
|
|
|
524
|
+
type LayoutStyle = LayoutStyles;
|
|
525
|
+
declare enum ContainerEventType {
|
|
526
|
+
Click = "click",
|
|
527
|
+
MouseOver = "mouseover",
|
|
528
|
+
MouseOut = "mouseout",
|
|
529
|
+
PointerDown = "pointerdown",
|
|
530
|
+
PointerUp = "pointerup",
|
|
531
|
+
PointerUpOutside = "pointerupoutside",
|
|
532
|
+
PointerMove = "pointermove",
|
|
533
|
+
PointerCancel = "pointercancel",
|
|
534
|
+
PointerOver = "pointerover",
|
|
535
|
+
PointerOut = "pointerout",
|
|
536
|
+
PointerEnter = "pointerenter",
|
|
537
|
+
PointerLeave = "pointerleave",
|
|
538
|
+
Added = "added",
|
|
539
|
+
Removed = "removed",
|
|
540
|
+
Update = "update",
|
|
541
|
+
Change = "change",
|
|
542
|
+
Wheel = "wheel"
|
|
543
|
+
}
|
|
544
|
+
type ContainerEventTypeToResultType = {
|
|
545
|
+
[K in ContainerEventType]: K extends ContainerEventType.Wheel ? {
|
|
546
|
+
deltaY: number;
|
|
547
|
+
} : undefined;
|
|
548
|
+
};
|
|
549
|
+
declare enum Cursor {
|
|
550
|
+
Default = "default",
|
|
551
|
+
Pointer = "pointer"
|
|
552
|
+
}
|
|
563
553
|
interface SetParentOptions {
|
|
564
554
|
addUnder: boolean;
|
|
565
555
|
cropOverflowingParts: boolean;
|
|
566
556
|
}
|
|
567
|
-
declare class Container extends
|
|
557
|
+
declare class Container extends DisplayObjectAttributes {
|
|
568
558
|
protected static allContainers: Map<number, Container>;
|
|
569
559
|
readonly filters: Filters;
|
|
570
560
|
protected addChildTo: Container;
|
|
@@ -572,8 +562,50 @@ declare class Container extends ContainerAttributes {
|
|
|
572
562
|
addUnder: boolean;
|
|
573
563
|
cropOverflowingParts: boolean;
|
|
574
564
|
};
|
|
575
|
-
constructor();
|
|
565
|
+
constructor(pixiContainer?: Pixi.Container);
|
|
576
566
|
destroy(): void;
|
|
567
|
+
protected _applyScale(x: number, y: number): void;
|
|
568
|
+
protected _getHoldFromModifier(holdFrom: Vector): Vector;
|
|
569
|
+
get size(): Vector;
|
|
570
|
+
set size(value: Vector);
|
|
571
|
+
getSize(): Vector;
|
|
572
|
+
setSize(value: Vector): this;
|
|
573
|
+
/**
|
|
574
|
+
* Makes this object a flex item of a LayoutContainer parent, treated as a box measured by its bounds.
|
|
575
|
+
* @param style Optional per-item overrides (alignSelf, margins, width, height...)
|
|
576
|
+
* @returns this
|
|
577
|
+
*/
|
|
578
|
+
setLayout(style?: LayoutStyle): this;
|
|
579
|
+
on<T extends ContainerEventType>(eventType: T): Sequence<ContainerEventTypeToResultType[T]>;
|
|
580
|
+
setZIndex(value: number): this;
|
|
581
|
+
get zIndex(): number;
|
|
582
|
+
set zIndex(value: number);
|
|
583
|
+
setSkewX(radian: Radian): this;
|
|
584
|
+
get skewX(): Radian;
|
|
585
|
+
set skewX(radian: Radian);
|
|
586
|
+
setSkewY(radian: Radian): this;
|
|
587
|
+
get skewY(): Radian;
|
|
588
|
+
set skewY(radian: Radian);
|
|
589
|
+
setSortableChildren(value: boolean): this;
|
|
590
|
+
get sortableChildren(): boolean;
|
|
591
|
+
set sortableChildren(value: boolean);
|
|
592
|
+
setInteractive(value: boolean): this;
|
|
593
|
+
get interactive(): boolean;
|
|
594
|
+
set interactive(value: boolean);
|
|
595
|
+
/**
|
|
596
|
+
* Renders this subtree as an isolated render group: its cached render instructions are not
|
|
597
|
+
* rebuilt when other parts of the scene change, and moving the group only updates one transform.
|
|
598
|
+
* Use for subtrees that move as a whole (world under a camera) or rarely change (HUD vs world).
|
|
599
|
+
*/
|
|
600
|
+
setRenderGroup(value?: boolean): this;
|
|
601
|
+
setCursor(value: Cursor): this;
|
|
602
|
+
get cursor(): Cursor;
|
|
603
|
+
set cursor(value: Cursor);
|
|
604
|
+
protected getMask(): Pixi.Container;
|
|
605
|
+
setMask(mask: Container | undefined): this;
|
|
606
|
+
hitTest(stagePosition: Vector): boolean;
|
|
607
|
+
get boundingBox(): Rectangle;
|
|
608
|
+
ignoreBounds(value?: boolean): this;
|
|
577
609
|
getBoundingMask(): Sprite;
|
|
578
610
|
displayParent(parent: Container | number, partialOptions?: Partial<SetParentOptions>): this;
|
|
579
611
|
}
|
|
@@ -970,6 +1002,16 @@ declare class ScrollMaskUI extends Container {
|
|
|
970
1002
|
constructor(container: Container, size: Vector, padding: number, direction?: ScrollDirection);
|
|
971
1003
|
}
|
|
972
1004
|
|
|
1005
|
+
/**
|
|
1006
|
+
* A flexbox container.
|
|
1007
|
+
*/
|
|
1008
|
+
declare class LayoutContainer extends Container {
|
|
1009
|
+
constructor(style?: LayoutStyle);
|
|
1010
|
+
setLayout(style: LayoutStyle): this;
|
|
1011
|
+
debug(): this;
|
|
1012
|
+
debugBackground(): this;
|
|
1013
|
+
}
|
|
1014
|
+
|
|
973
1015
|
interface KeyboardKeyInfo {
|
|
974
1016
|
readonly key: string;
|
|
975
1017
|
readonly code: string;
|
|
@@ -1330,4 +1372,4 @@ declare abstract class MovablePhysicsEntity extends PhysicsEntity {
|
|
|
1330
1372
|
convertToDTO(): PhysicsBodyDTO;
|
|
1331
1373
|
}
|
|
1332
1374
|
|
|
1333
|
-
export { AdvancedSound, type AdvancedSoundOptions, AnimationFlicker, AnimationInterpolationFunctions, type AnimationOptions, Animations, AnimationsCompletionHandlingType, Animator, type AnimatorAnimation, type AssetDefinition, type AudioAppearTransitionType, BORDER_MATERIAL_NAME,
|
|
1375
|
+
export { AdvancedSound, type AdvancedSoundOptions, AnimationFlicker, AnimationInterpolationFunctions, type AnimationOptions, Animations, AnimationsCompletionHandlingType, Animator, type AnimatorAnimation, type AssetDefinition, type AudioAppearTransitionType, BORDER_MATERIAL_NAME, BardLegendsTestingHelper, type BlendMode, type BorderProperties, Camera, CameraGateway, type CircleShapeData, ClosestAvailableSpaceHelper, type CollisionDetails, type CollisionReport, Container, ContainerEventType, ControllerDecorator, type CreateDashedLineOptions, type CreatePhysicsWorldRequestDTO, Cursor, DEFAULT_SHADER_RESOLUTION, DeltaTime, DisplayObjectArray, type DisplayObjectArrayOptions, type DropShadowOptions, Entity, EntityDecorator, type EntityID, type ExplosionHit, FadeInContent, type FadeInContentOptions, FocusingAnimation, Game, Gateway, type GlowEffectOptions, type GlowOptions, type GlowingShapeDefinition, Graphics, type HitTestOptions, ImmovablePhysicsEntity, type InteractingBodyGroups, type KeyboardKeyInfo, KeyboardService, LayoutContainer, type LayoutStyle, type MapSizeDTO, type MaterialContactDefinition, type MaterialDefinition, MenuEntity, type MenuOptions, MenuUI, MenuView, MouseService, MouseTargetFocusService, MovableEntity, MovablePhysicsEntity, Music, MusicPlayer, type MusicPlayerOptions, type PartialTextOptions, PathFinder, type PathFinderResult, type PhysicsBodyDTO, PhysicsEntity, type PhysicsEntityDefinition, type PhysicsExplosionOptions, PhysicsGateway, PhysicsShapeType, type PhysicsWorldID, Placeholder, type PolygonDefinition, type PolygonShapeData, ROTATIONAL_SPEED_LIMIT, type RayCast, type RayCastHit, ReAnimateHandlingType, type RectangleShapeData, RichText, type RichTextOptions, type RichTextRectangleCut, type RichTextStyles, SOUND_TRANSITION_DURATION, SPEED_LIMIT, Scene, SceneDecorator, ScrollAreaUI, ScrollDirection, type ScrollInContentOptions, ScrollMaskUI, Service, ServiceDecorator, type SetParentOptions, type ShapeDefinition, SingletonEntity, SlideInContent, SlideInContentByIndex, SlideStateAnimation, SlideStateAnimationState, Sound, type SoundDefinition, type SoundID, type SoundIDRegistry, type SoundOptions, Sprite, type SpriteDefinition, type SpriteID, type SpriteIDRegistry, StateAnimation, type StateAnimationOptions, type StateAnimationState, Text, type TextAlignment, type TextOptions, ThroughEmptyStateAnimation, UpdatableContainer, UpdateCycle, VectorFieldPathFinder, VectorSet, View, ViewDecorator, type ViewDecoratorMeta };
|