bard-legends-framework 1.5.3 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +428 -136
- package/dist/index.d.ts +428 -136
- package/dist/index.js +5 -5
- package/dist/index.mjs +5 -5
- package/package.json +20 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
import * as actions_lib from 'actions-lib';
|
|
2
|
-
import { IDAttachable, Attachable, AttachmentID, IdleSingleEvent, IdleSequence, Sequence, SingleNotifier, Notifier, SingleEvent,
|
|
3
|
-
import { Vector,
|
|
2
|
+
import { IDAttachable, Attachable, AttachmentID, IdleSingleEvent, IdleSequence, Variable, Reducer, Sequence, SingleNotifier, Notifier, SingleEvent, Action, ClassID, NotifierCallbackFunction, IAttachment } from 'actions-lib';
|
|
3
|
+
import { Vector, DynamicID, Vec2, RGBColor, Radian, Rectangle, Grid, GridNeighborType, Line } from 'helpers-lib';
|
|
4
|
+
import p2$1 from 'p2';
|
|
4
5
|
import * as Pixi from 'pixi.js';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Binds a controller to its gateway (the class produced by `Gateway<T>()`). The controller must
|
|
9
|
+
* structurally match the gateway's controller type, so wiring the wrong controller to a gateway is
|
|
10
|
+
* a compile error.
|
|
11
|
+
*
|
|
12
|
+
* The controller is instantiated now — its constructor dependencies are resolved through the DI
|
|
13
|
+
* container — and its methods are bound straight onto the gateway prototype, so a later
|
|
14
|
+
* `gateway.method(...)` is a direct call into the controller with no proxy and no per-call lookup.
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* @ControllerDecorator(SampleGateway)
|
|
18
|
+
* export class SampleController {
|
|
19
|
+
* constructor(private store: SampleStore) {}
|
|
20
|
+
* ...
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
declare function ControllerDecorator<TController>(gateway: new () => TController): (ControllerClass: new (...args: any[]) => TController) => void;
|
|
13
25
|
|
|
14
26
|
type EntityClassType<T extends Entity = Entity> = (new (...args: any[]) => T) & {
|
|
15
27
|
id: number;
|
|
@@ -40,6 +52,30 @@ declare abstract class SingletonEntity extends Entity {
|
|
|
40
52
|
constructor();
|
|
41
53
|
}
|
|
42
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Base class factory for a module's public Gateway. Use it as:
|
|
57
|
+
*
|
|
58
|
+
* ```ts
|
|
59
|
+
* @ServiceDecorator()
|
|
60
|
+
* export class SampleGateway extends Gateway<SampleController>() {}
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* The gateway body stays empty:
|
|
64
|
+
* - its instance type is its Controller, so calls are type-checked against the controller and
|
|
65
|
+
* "go to definition" / F12 jumps straight to the controller method;
|
|
66
|
+
* - its methods are installed once, at registration time, by `@ControllerDecorator(ThisGateway)`,
|
|
67
|
+
* as bound references to the controller's methods (see `bindControllerToGateway`).
|
|
68
|
+
*
|
|
69
|
+
* The controller is referenced here only as a *type* (`Gateway<SampleController>()`), so importing
|
|
70
|
+
* a gateway never pulls in its controller. That keeps two modules that use each other's gateways
|
|
71
|
+
* free of import/injection cycles: the gateway is a dependency-free runtime sink.
|
|
72
|
+
*
|
|
73
|
+
* Performance: there is no Proxy and no per-call dispatch table. After registration a call is a
|
|
74
|
+
* prototype-method lookup (monomorphic, inline-cacheable) plus one bound-function call into the
|
|
75
|
+
* controller — effectively a direct method call.
|
|
76
|
+
*/
|
|
77
|
+
declare function Gateway<TController>(): new () => TController;
|
|
78
|
+
|
|
43
79
|
declare class BardLegendsHardReset {
|
|
44
80
|
static readonly onHardReset: actions_lib.Notifier<void>;
|
|
45
81
|
static hardReset(): void;
|
|
@@ -60,7 +96,6 @@ declare abstract class Scene<InputType, OutputType> extends IDAttachable {
|
|
|
60
96
|
readonly onClose: actions_lib.PersistentSingleNotifier<OutputType>;
|
|
61
97
|
constructor();
|
|
62
98
|
close(...args: void extends OutputType ? (OutputType extends void ? [] : [OutputType]) : [OutputType]): IdleSingleEvent<OutputType>;
|
|
63
|
-
private animateAndClose;
|
|
64
99
|
protected abstract init(input: InputType): IdleSingleEvent;
|
|
65
100
|
protected abstract update(time: number, delta: number): void;
|
|
66
101
|
protected abstract prepareToClose(): IdleSingleEvent;
|
|
@@ -108,6 +143,227 @@ declare abstract class View extends IDAttachable {
|
|
|
108
143
|
update(time: number, delta: number): void;
|
|
109
144
|
}
|
|
110
145
|
|
|
146
|
+
type AudioAppearTransitionType = 'ease' | 'instant';
|
|
147
|
+
declare class Audio {
|
|
148
|
+
private constructor();
|
|
149
|
+
setVolumes(volumes: {
|
|
150
|
+
master: number;
|
|
151
|
+
music: number;
|
|
152
|
+
sound: number;
|
|
153
|
+
}): void;
|
|
154
|
+
appear(on: boolean, type?: AudioAppearTransitionType): IdleSingleEvent;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
interface FocusingNewTargetInfo {
|
|
158
|
+
time: number;
|
|
159
|
+
duration: number;
|
|
160
|
+
position: Vector;
|
|
161
|
+
roundPosition: boolean;
|
|
162
|
+
roundPositionThreshold: number;
|
|
163
|
+
focusingAnimation: FocusingAnimation;
|
|
164
|
+
}
|
|
165
|
+
declare class CameraEntity extends SingletonEntity {
|
|
166
|
+
readonly position: Variable<Vector>;
|
|
167
|
+
readonly offset: Variable<Vector>;
|
|
168
|
+
readonly targetPosition: Variable<Vector | undefined>;
|
|
169
|
+
readonly focusingNewTargetInfo: Variable<FocusingNewTargetInfo | undefined>;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
declare class CameraService {
|
|
173
|
+
createCamera(): CameraEntity;
|
|
174
|
+
getCameraPosition(): Vector;
|
|
175
|
+
setPosition(position: Vector): void;
|
|
176
|
+
setTransition(options: FocusingOptions): void;
|
|
177
|
+
update(time: number, delta: number): void;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
declare enum CameraLayer {
|
|
181
|
+
BackgroundScreen = "backgroundScreen",
|
|
182
|
+
Background = "background",
|
|
183
|
+
Main = "main",
|
|
184
|
+
Foreground = "foreground",
|
|
185
|
+
ForegroundScreen = "foregroundScreen"
|
|
186
|
+
}
|
|
187
|
+
declare enum FocusingAnimation {
|
|
188
|
+
Instant = 1,
|
|
189
|
+
EaseInOut = 2,
|
|
190
|
+
EaseOut = 3
|
|
191
|
+
}
|
|
192
|
+
interface FocusingOptions {
|
|
193
|
+
duration?: number;
|
|
194
|
+
animation?: FocusingAnimation;
|
|
195
|
+
roundPosition?: boolean;
|
|
196
|
+
roundPositionThreshold?: number;
|
|
197
|
+
}
|
|
198
|
+
type CameraAppearTransitionType = 'alpha' | 'pureBlack' | 'instant';
|
|
199
|
+
|
|
200
|
+
declare class CameraController {
|
|
201
|
+
constructor(_cameraService: CameraService);
|
|
202
|
+
createCamera(): number;
|
|
203
|
+
update(time: number, delta: number): void;
|
|
204
|
+
setPosition(position: Vector): void;
|
|
205
|
+
setTransition(options: FocusingOptions): void;
|
|
206
|
+
getCameraPosition(): Vector;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
declare const CameraGateway_base: new () => CameraController;
|
|
210
|
+
declare class CameraGateway extends CameraGateway_base {
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
declare class Camera {
|
|
214
|
+
readonly layers: Record<CameraLayer, number>;
|
|
215
|
+
get position(): Vector;
|
|
216
|
+
constructor();
|
|
217
|
+
setPosition(position: Vector): void;
|
|
218
|
+
setTransition(options: FocusingOptions): void;
|
|
219
|
+
appear(on: boolean, type?: CameraAppearTransitionType): IdleSingleEvent;
|
|
220
|
+
screenPositonToStagePosition(screenPosition: Vector): Vector;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
declare const DEFAULT_SHADER_RESOLUTION = 2;
|
|
224
|
+
interface AssetDefinition<T = string> {
|
|
225
|
+
readonly id: T;
|
|
226
|
+
readonly url: string;
|
|
227
|
+
}
|
|
228
|
+
declare enum BlendMode {
|
|
229
|
+
Normal = 0,
|
|
230
|
+
Add = 1,
|
|
231
|
+
Screen = 3,
|
|
232
|
+
Luminosity = 16,
|
|
233
|
+
ColorDodge = 7
|
|
234
|
+
}
|
|
235
|
+
interface SpriteIDRegistry {
|
|
236
|
+
}
|
|
237
|
+
type SpriteID = DynamicID<SpriteIDRegistry, 'SpriteID'>;
|
|
238
|
+
interface SpriteDefinition {
|
|
239
|
+
readonly id: SpriteID;
|
|
240
|
+
readonly scale: number;
|
|
241
|
+
readonly anchor: Vec2;
|
|
242
|
+
readonly size: Vec2;
|
|
243
|
+
readonly boundingShapes?: PolygonDefinition | undefined;
|
|
244
|
+
readonly destroyAssetOnDestroy?: boolean | undefined;
|
|
245
|
+
}
|
|
246
|
+
interface GlowingShapeDefinition {
|
|
247
|
+
readonly color: RGBColor;
|
|
248
|
+
readonly shapeAlpha: number;
|
|
249
|
+
readonly glowAlpha: number;
|
|
250
|
+
readonly glowOptions: GlowOptions;
|
|
251
|
+
readonly shapes: PolygonDefinition;
|
|
252
|
+
}
|
|
253
|
+
type PolygonDefinition = readonly (readonly Vec2[])[];
|
|
254
|
+
interface GlowOptions {
|
|
255
|
+
readonly color: RGBColor;
|
|
256
|
+
readonly blurRadius: number | Vector;
|
|
257
|
+
readonly expand: number;
|
|
258
|
+
readonly blendMode: BlendMode;
|
|
259
|
+
}
|
|
260
|
+
type GlowEffectOptions = Partial<GlowOptions> & {
|
|
261
|
+
glowAlpha?: number;
|
|
262
|
+
};
|
|
263
|
+
interface SoundIDRegistry {
|
|
264
|
+
}
|
|
265
|
+
type SoundID = DynamicID<SoundIDRegistry, 'SoundID'>;
|
|
266
|
+
interface SoundDefinition {
|
|
267
|
+
readonly id: SoundID;
|
|
268
|
+
readonly duration: number;
|
|
269
|
+
}
|
|
270
|
+
interface MusicIDRegistry {
|
|
271
|
+
}
|
|
272
|
+
type MusicID = DynamicID<MusicIDRegistry, 'MusicID'>;
|
|
273
|
+
interface MusicDefinition {
|
|
274
|
+
readonly id: MusicID;
|
|
275
|
+
readonly soundID: SoundID;
|
|
276
|
+
readonly loop: {
|
|
277
|
+
readonly from: number;
|
|
278
|
+
readonly to: number;
|
|
279
|
+
} | undefined;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
interface GameConfiguration {
|
|
283
|
+
readonly screenResolution: {
|
|
284
|
+
readonly width: number;
|
|
285
|
+
readonly height: number;
|
|
286
|
+
} | undefined;
|
|
287
|
+
readonly maxScreenResolution: {
|
|
288
|
+
readonly width: number;
|
|
289
|
+
readonly height: number;
|
|
290
|
+
} | undefined;
|
|
291
|
+
readonly devMode: boolean;
|
|
292
|
+
readonly backgroundColor: RGBColor;
|
|
293
|
+
readonly antialias: boolean;
|
|
294
|
+
readonly resolution: number;
|
|
295
|
+
}
|
|
296
|
+
interface GameSetupOptions {
|
|
297
|
+
readonly spriteAssetDefinitions: readonly AssetDefinition<SpriteID>[];
|
|
298
|
+
readonly spriteDefinitions: Readonly<Record<SpriteID, SpriteDefinition>>;
|
|
299
|
+
readonly fontAssetDefinitions: readonly AssetDefinition[];
|
|
300
|
+
readonly soundAssetDefinitions: readonly AssetDefinition<SoundID>[];
|
|
301
|
+
readonly soundDefinitions: Readonly<Record<SoundID, SoundDefinition>>;
|
|
302
|
+
readonly musicDefinitions: Readonly<Record<MusicID, MusicDefinition>>;
|
|
303
|
+
}
|
|
304
|
+
declare class Game {
|
|
305
|
+
static get instance(): Game;
|
|
306
|
+
static readonly pause: Reducer<boolean, boolean>;
|
|
307
|
+
static readonly freeze: Reducer<boolean, boolean>;
|
|
308
|
+
static get camera(): Camera;
|
|
309
|
+
static get audio(): Audio;
|
|
310
|
+
static appear(on: boolean, options?: {
|
|
311
|
+
camera?: CameraAppearTransitionType;
|
|
312
|
+
audio?: AudioAppearTransitionType;
|
|
313
|
+
}): IdleSingleEvent;
|
|
314
|
+
static get time(): number;
|
|
315
|
+
readonly renderer: Pixi.Renderer;
|
|
316
|
+
readonly _screenSize: Variable<Vector>;
|
|
317
|
+
readonly screenSize: actions_lib.PersistentNotifier<Vector>;
|
|
318
|
+
readonly _screenSizeCenter: Variable<Vector>;
|
|
319
|
+
readonly screenSizeCenter: actions_lib.PersistentNotifier<Vector>;
|
|
320
|
+
readonly devMode: boolean;
|
|
321
|
+
constructor(partialConfiguration?: Partial<GameConfiguration>);
|
|
322
|
+
setup(setupOptions: GameSetupOptions): Promise<void>;
|
|
323
|
+
setResolution(resolution: number): void;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
declare abstract class AudioContainer extends IDAttachable {
|
|
327
|
+
protected _source: AudioBufferSourceNode;
|
|
328
|
+
protected _gain: GainNode;
|
|
329
|
+
protected _startingTime: number;
|
|
330
|
+
protected readonly _time: Variable<number>;
|
|
331
|
+
readonly time: actions_lib.PersistentNotifier<number>;
|
|
332
|
+
constructor(output: AudioNode);
|
|
333
|
+
get volume(): number;
|
|
334
|
+
set volume(value: number);
|
|
335
|
+
setVolume(value: number): this;
|
|
336
|
+
/**
|
|
337
|
+
* @param time in seconds
|
|
338
|
+
* @returns IdleSingleEvent that resolves in the given time
|
|
339
|
+
*/
|
|
340
|
+
notifyOnTime(targetTime: number): IdleSingleEvent;
|
|
341
|
+
destroy(): void;
|
|
342
|
+
protected _play(options: {
|
|
343
|
+
readonly soundID: SoundID;
|
|
344
|
+
readonly start: number;
|
|
345
|
+
readonly end: number;
|
|
346
|
+
readonly loop: boolean;
|
|
347
|
+
readonly onComplete?: () => void;
|
|
348
|
+
}): void;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
interface MusicOptions {
|
|
352
|
+
readonly offset: number;
|
|
353
|
+
readonly muffle?: number;
|
|
354
|
+
}
|
|
355
|
+
declare class Music extends AudioContainer {
|
|
356
|
+
static createByName(musicName: MusicID, options?: MusicOptions): Music;
|
|
357
|
+
constructor(musicDefinition: MusicDefinition, options?: MusicOptions);
|
|
358
|
+
muffle(strength: number, transitionDuration?: number): IdleSingleEvent;
|
|
359
|
+
destroy(): void;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
declare class Sound extends AudioContainer {
|
|
363
|
+
static createByName(soundName: SoundID): Sound;
|
|
364
|
+
constructor(soundDefinition: SoundDefinition);
|
|
365
|
+
}
|
|
366
|
+
|
|
111
367
|
declare enum ContainerEventType {
|
|
112
368
|
Click = "click",
|
|
113
369
|
MouseOver = "mouseover",
|
|
@@ -224,51 +480,13 @@ declare class Filters {
|
|
|
224
480
|
removeColorFilter(): void;
|
|
225
481
|
}
|
|
226
482
|
|
|
227
|
-
declare const DEFAULT_SHADER_RESOLUTION = 2;
|
|
228
|
-
interface AssetDefinition<T extends string = string> {
|
|
229
|
-
readonly id: string;
|
|
230
|
-
readonly url: T;
|
|
231
|
-
}
|
|
232
|
-
declare enum BlendMode {
|
|
233
|
-
Normal = 0,
|
|
234
|
-
Add = 1,
|
|
235
|
-
Screen = 3,
|
|
236
|
-
Luminosity = 16,
|
|
237
|
-
ColorDodge = 7
|
|
238
|
-
}
|
|
239
|
-
interface SpriteDefinition {
|
|
240
|
-
readonly id: string;
|
|
241
|
-
readonly scale: number;
|
|
242
|
-
readonly anchor: Vec2;
|
|
243
|
-
readonly size: Vec2;
|
|
244
|
-
readonly boundingShapes?: PolygonDefinition | undefined;
|
|
245
|
-
readonly destroyAssetOnDestroy?: boolean | undefined;
|
|
246
|
-
}
|
|
247
|
-
interface GlowingShapeDefinition {
|
|
248
|
-
readonly color: RGBColor;
|
|
249
|
-
readonly shapeAlpha: number;
|
|
250
|
-
readonly glowAlpha: number;
|
|
251
|
-
readonly glowOptions: GlowOptions;
|
|
252
|
-
readonly shapes: PolygonDefinition;
|
|
253
|
-
}
|
|
254
|
-
type PolygonDefinition = readonly (readonly Vec2[])[];
|
|
255
|
-
interface GlowOptions {
|
|
256
|
-
readonly color: RGBColor;
|
|
257
|
-
readonly blurRadius: number | Vector;
|
|
258
|
-
readonly expand: number;
|
|
259
|
-
readonly blendMode: BlendMode;
|
|
260
|
-
}
|
|
261
|
-
type GlowEffectOptions = Partial<GlowOptions> & {
|
|
262
|
-
glowAlpha?: number;
|
|
263
|
-
};
|
|
264
|
-
|
|
265
483
|
interface SpriteOptions {
|
|
266
484
|
readonly textureSize?: Vector;
|
|
267
485
|
readonly texturePosition?: Vector;
|
|
268
486
|
readonly ignoreAnchor?: boolean;
|
|
269
487
|
}
|
|
270
488
|
declare class Sprite extends Container {
|
|
271
|
-
static createByName(spriteName:
|
|
489
|
+
static createByName(spriteName: SpriteID): Sprite;
|
|
272
490
|
static createSnapshotSprite(container: Container): Sprite;
|
|
273
491
|
readonly pixiSprite: Pixi.Sprite;
|
|
274
492
|
constructor(spriteDefinition: SpriteDefinition, options?: SpriteOptions);
|
|
@@ -444,7 +662,7 @@ declare class MenuUI extends Container {
|
|
|
444
662
|
readonly onCreate: actions_lib.PersistentSingleNotifier<void>;
|
|
445
663
|
readonly onOpen: actions_lib.PersistentSingleNotifier<void>;
|
|
446
664
|
readonly onClose: actions_lib.PersistentSingleNotifier<void>;
|
|
447
|
-
constructor(windowSprite:
|
|
665
|
+
constructor(windowSprite: SpriteID, partialOptions: Partial<MenuOptions>);
|
|
448
666
|
getBoundingMask(): Sprite;
|
|
449
667
|
close(): IdleSingleEvent;
|
|
450
668
|
}
|
|
@@ -453,7 +671,7 @@ interface MenuEntityOptions {
|
|
|
453
671
|
readonly closeOnBackgroundClick: boolean;
|
|
454
672
|
}
|
|
455
673
|
declare class MenuEntity extends SingletonEntity {
|
|
456
|
-
static subscribeIsOpen():
|
|
674
|
+
static subscribeIsOpen(): Sequence<boolean>;
|
|
457
675
|
constructor(partialOptions: Partial<MenuEntityOptions>);
|
|
458
676
|
onCreate(): IdleSingleEvent;
|
|
459
677
|
onOpen(): IdleSingleEvent;
|
|
@@ -469,7 +687,7 @@ declare class MenuView extends View {
|
|
|
469
687
|
readonly onCreate: SingleNotifier<Container>;
|
|
470
688
|
readonly onOpen: SingleNotifier;
|
|
471
689
|
readonly onClose: SingleNotifier;
|
|
472
|
-
constructor(entity: MenuEntity, windowSprite:
|
|
690
|
+
constructor(entity: MenuEntity, windowSprite: SpriteID, partialOptions: Partial<MenuViewOptions>);
|
|
473
691
|
}
|
|
474
692
|
|
|
475
693
|
interface ScrollAreaUIOptions {
|
|
@@ -496,6 +714,8 @@ declare class AnimationInterpolationFunctions {
|
|
|
496
714
|
static lineer(time: number): number;
|
|
497
715
|
static easeIn(time: number): number;
|
|
498
716
|
static easeOut(time: number): number;
|
|
717
|
+
static easeInCubic(time: number): number;
|
|
718
|
+
static easeOutCubic(time: number): number;
|
|
499
719
|
static easeInOut(time: number): number;
|
|
500
720
|
static easeInOutCubic(t: number): number;
|
|
501
721
|
static blink(t: number): number;
|
|
@@ -516,6 +736,14 @@ declare class AnimationEaseInOut implements AnimatorAnimation {
|
|
|
516
736
|
start(): void;
|
|
517
737
|
multiplierFunction(t: number): number;
|
|
518
738
|
}
|
|
739
|
+
declare class AnimationEaseInCubic implements AnimatorAnimation {
|
|
740
|
+
start(): void;
|
|
741
|
+
multiplierFunction(t: number): number;
|
|
742
|
+
}
|
|
743
|
+
declare class AnimationEaseOutCubic implements AnimatorAnimation {
|
|
744
|
+
start(): void;
|
|
745
|
+
multiplierFunction(t: number): number;
|
|
746
|
+
}
|
|
519
747
|
declare class AnimationEaseInOutCubic implements AnimatorAnimation {
|
|
520
748
|
start(): void;
|
|
521
749
|
multiplierFunction(t: number): number;
|
|
@@ -533,6 +761,8 @@ declare class Animations {
|
|
|
533
761
|
static easeIn: AnimationEaseIn;
|
|
534
762
|
static easeOut: AnimationEaseOut;
|
|
535
763
|
static easeInOut: AnimationEaseInOut;
|
|
764
|
+
static easeInCubic: AnimationEaseInCubic;
|
|
765
|
+
static easeOutCubic: AnimationEaseOutCubic;
|
|
536
766
|
static easeInOutCubic: AnimationEaseInOutCubic;
|
|
537
767
|
static blink: AnimationBlink;
|
|
538
768
|
}
|
|
@@ -711,87 +941,6 @@ declare class ScrollMaskUI extends Container {
|
|
|
711
941
|
constructor(container: Container, size: Vector, padding: number, direction?: ScrollDirection);
|
|
712
942
|
}
|
|
713
943
|
|
|
714
|
-
declare enum CameraLayer {
|
|
715
|
-
BackgroundScreen = "backgroundScreen",
|
|
716
|
-
Background = "background",
|
|
717
|
-
Main = "main",
|
|
718
|
-
Foreground = "foreground",
|
|
719
|
-
ForegroundScreen = "foregroundScreen"
|
|
720
|
-
}
|
|
721
|
-
declare enum FocusingAnimation {
|
|
722
|
-
Instant = 1,
|
|
723
|
-
EaseInOut = 2,
|
|
724
|
-
EaseOut = 3
|
|
725
|
-
}
|
|
726
|
-
interface FocusingOptions {
|
|
727
|
-
duration?: number;
|
|
728
|
-
animation?: FocusingAnimation;
|
|
729
|
-
roundPosition?: boolean;
|
|
730
|
-
roundPositionThreshold?: number;
|
|
731
|
-
}
|
|
732
|
-
type CameraAppearTransitionType = 'alpha' | 'pureBlack' | 'instant';
|
|
733
|
-
|
|
734
|
-
declare class CameraGateway {
|
|
735
|
-
createCamera(): string;
|
|
736
|
-
update(time: number, delta: number): void;
|
|
737
|
-
setPosition(position: Vector): void;
|
|
738
|
-
setTransition(options: FocusingOptions): void;
|
|
739
|
-
getCameraPosition(): Vector;
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
declare class Camera {
|
|
743
|
-
readonly layers: Record<CameraLayer, number>;
|
|
744
|
-
get position(): Vector;
|
|
745
|
-
constructor();
|
|
746
|
-
setPosition(position: Vector): void;
|
|
747
|
-
setTransition(options: FocusingOptions): void;
|
|
748
|
-
appear(on: boolean, type?: CameraAppearTransitionType): IdleSingleEvent;
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
interface GameConfiguration {
|
|
752
|
-
readonly screenResolution: {
|
|
753
|
-
readonly width: number;
|
|
754
|
-
readonly height: number;
|
|
755
|
-
} | undefined;
|
|
756
|
-
readonly maxScreenResolution: {
|
|
757
|
-
readonly width: number;
|
|
758
|
-
readonly height: number;
|
|
759
|
-
} | undefined;
|
|
760
|
-
readonly devMode: boolean;
|
|
761
|
-
readonly backgroundColor: RGBColor;
|
|
762
|
-
readonly antialias: boolean;
|
|
763
|
-
readonly resolution: number;
|
|
764
|
-
}
|
|
765
|
-
interface GameSetupOptions {
|
|
766
|
-
readonly assetDefinitions: readonly AssetDefinition<string>[];
|
|
767
|
-
readonly spriteDefinitions: Readonly<Record<string, SpriteDefinition>>;
|
|
768
|
-
}
|
|
769
|
-
declare class Game {
|
|
770
|
-
static get instance(): Game;
|
|
771
|
-
static readonly pause: Reducer<boolean, boolean>;
|
|
772
|
-
static get camera(): Camera;
|
|
773
|
-
static get time(): number;
|
|
774
|
-
readonly stage: Container;
|
|
775
|
-
readonly renderer: Pixi.Renderer;
|
|
776
|
-
readonly _screenSize: Variable<Vector>;
|
|
777
|
-
readonly screenSize: actions_lib.PersistentNotifier<Vector>;
|
|
778
|
-
readonly _screenSizeCenter: Variable<Vector>;
|
|
779
|
-
readonly screenSizeCenter: actions_lib.PersistentNotifier<Vector>;
|
|
780
|
-
readonly devMode: boolean;
|
|
781
|
-
constructor(partialConfiguration?: Partial<GameConfiguration>);
|
|
782
|
-
setup(setupOptions: GameSetupOptions): Promise<void>;
|
|
783
|
-
setResolution(resolution: number): void;
|
|
784
|
-
screenPositonToStagePosition(screenPosition: Vector): Vector;
|
|
785
|
-
setScreenPositionToStagePositionFunction(converterFunction: (screenPosition: Vector) => Vector): void;
|
|
786
|
-
resetScreenPositionToStagePositionFunction(): void;
|
|
787
|
-
destroyAsset(assetID: string): void;
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
declare class PositionConversionHelper {
|
|
791
|
-
static includeScaleInScreenPosition(screenPosition: Vector, gameInstanceScale: number, screenSizeCenter: Vector): Vector;
|
|
792
|
-
static normalizePolygonByAnchor(polygon: PolygonDefinition, frameSize: Vector, frameAnchor: Vector): PolygonDefinition;
|
|
793
|
-
}
|
|
794
|
-
|
|
795
944
|
interface KeyboardKeyInfo {
|
|
796
945
|
readonly key: string;
|
|
797
946
|
readonly code: string;
|
|
@@ -819,7 +968,6 @@ declare class MouseService {
|
|
|
819
968
|
* accounting for canvas offset (e.g. letterboxing when max resolution is smaller than the window)
|
|
820
969
|
* and CSS scaling of the canvas.
|
|
821
970
|
*/
|
|
822
|
-
private clientPositionToScreenPosition;
|
|
823
971
|
}
|
|
824
972
|
|
|
825
973
|
declare class MouseTargetFocusService {
|
|
@@ -995,7 +1143,147 @@ interface MapSizeDTO {
|
|
|
995
1143
|
readonly center: Vector;
|
|
996
1144
|
}
|
|
997
1145
|
|
|
998
|
-
declare class
|
|
1146
|
+
declare class PhysicsWorldEntity extends Entity {
|
|
1147
|
+
readonly mapSize: Vector;
|
|
1148
|
+
readonly mapSizeCenter: Vector;
|
|
1149
|
+
readonly modifyUpdateCycle: boolean;
|
|
1150
|
+
readonly p2World: p2$1.World;
|
|
1151
|
+
readonly materials: Readonly<Map<string, p2$1.Material>>;
|
|
1152
|
+
readonly materialDefinitions: Map<string, MaterialDefinition>;
|
|
1153
|
+
readonly physicsBodyGroupToP2Group: Map<string, number>;
|
|
1154
|
+
readonly physicsBodyGroupToP2Mask: Map<string, number>;
|
|
1155
|
+
readonly availabilityGridCache: Map<number, Map<PhysicsBodyGroup, Grid<boolean>>>;
|
|
1156
|
+
readonly vectorFieldCache: Map<string, VectorFieldPathFinder>;
|
|
1157
|
+
readonly bodiesInContactWith: Map<number, {
|
|
1158
|
+
p2Body: p2$1.Body;
|
|
1159
|
+
entity: PhysicsEntity;
|
|
1160
|
+
}>;
|
|
1161
|
+
readonly collisionReports: Map<number, CollisionReport[]>;
|
|
1162
|
+
readonly paused: Variable<boolean>;
|
|
1163
|
+
readonly lastP2Time: Variable<number>;
|
|
1164
|
+
readonly onPhysicsStep: Action<{
|
|
1165
|
+
time: number;
|
|
1166
|
+
delta: number;
|
|
1167
|
+
}>;
|
|
1168
|
+
constructor(mapSize: Vector, modifyUpdateCycle: boolean, p2World: p2$1.World, materials: Map<string, p2$1.Material>, materialContactDefinitions: Map<string, MaterialDefinition>, physicsBodyGroupToP2Group: Map<PhysicsBodyGroup, number>, physicsBodyGroupToP2Mask: Map<PhysicsBodyGroup, number>);
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
declare class PhysicsBodyGroupService {
|
|
1172
|
+
createBodyGroupsAndMasks(physicsBodyGroups: readonly PhysicsBodyGroup[], interactingBodyGroups: InteractingBodyGroups): {
|
|
1173
|
+
readonly physicsBodyGroupToP2Group: Map<PhysicsBodyGroup, number>;
|
|
1174
|
+
readonly physicsBodyGroupToP2Mask: Map<PhysicsBodyGroup, number>;
|
|
1175
|
+
};
|
|
1176
|
+
getGroupConstant(physicsWorldID: number, group: PhysicsBodyGroup): number;
|
|
1177
|
+
getMaskConstant(physicsWorldID: number, group: PhysicsBodyGroup): number;
|
|
1178
|
+
canCollide(physicsWorld: PhysicsWorldEntity, groupType1: PhysicsBodyGroup, groupType2: PhysicsBodyGroup): boolean;
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
declare class AvailabilityGridCacheService {
|
|
1182
|
+
constructor(_physicsBodyGroupService: PhysicsBodyGroupService);
|
|
1183
|
+
getCollidableGrids(physicsWorld: PhysicsWorldEntity, physicsBodyGroup: PhysicsBodyGroup): {
|
|
1184
|
+
grid: Grid<boolean>;
|
|
1185
|
+
cellSize: number;
|
|
1186
|
+
}[];
|
|
1187
|
+
get(physicsWorld: PhysicsWorldEntity, cellSize: number, group: PhysicsBodyGroup): Grid<boolean> | undefined;
|
|
1188
|
+
set(physicsWorld: PhysicsWorldEntity, cellSize: number, group: PhysicsBodyGroup, grid: Grid<boolean>): void;
|
|
1189
|
+
clear(physicsWorld: PhysicsWorldEntity): void;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
declare class AvailabilityGridService {
|
|
1193
|
+
constructor(_physicsBodyGroupService: PhysicsBodyGroupService, _availabilityGridCacheService: AvailabilityGridCacheService);
|
|
1194
|
+
onBodyAdded(physicsWorld: PhysicsWorldEntity, body: p2.Body, physicsBodyGroup: PhysicsBodyGroup): void;
|
|
1195
|
+
findClosestAvailableSpace(physicsWorld: PhysicsWorldEntity, body: p2.Body, physicsBodyGroup: PhysicsBodyGroup, gridCellSize?: number): Vector | undefined;
|
|
1196
|
+
getAvilabilityGrid(physicsWorld: PhysicsWorldEntity, cellSize: number, physicsBodyGroup: PhysicsBodyGroup): Grid<boolean>;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
declare class PathFinderService {
|
|
1200
|
+
constructor(_physicsAvailabilityGrid: AvailabilityGridService);
|
|
1201
|
+
findPathAStar(physicsWorldID: number, startingPosition: Vector, target: Vector | number, collidableWithGroup: PhysicsBodyGroup, options?: {
|
|
1202
|
+
neighborType?: GridNeighborType;
|
|
1203
|
+
gridCellSize?: number;
|
|
1204
|
+
}): PathFinderResult;
|
|
1205
|
+
findPathDirection(physicsWorldID: number, startingPosition: Vector, target: Vector | number, collidableWithGroup: PhysicsBodyGroup, gridCellSize?: number): Radian | undefined;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
declare class TestVisualsService {
|
|
1209
|
+
constructor(_availabilityGridService: AvailabilityGridService, _pathFinderService: PathFinderService);
|
|
1210
|
+
printPathfindingTestGrid(physicsWorldID: number, testLayerID: number, target: Vector | number, physicsBodyGroup: PhysicsBodyGroup, area: Rectangle, gridCellSize: number): void;
|
|
1211
|
+
createExplosionDebugVisual(physicsWorld: PhysicsWorldEntity, testLayerID: number, rayCasts: RayCast[], explosionCenter: Vector, radius: number, duration?: number): void;
|
|
1212
|
+
createElipticExplosionDebugVisual(physicsWorld: PhysicsWorldEntity, testLayerID: number, rayCasts: RayCast[], explosionCenter: Vector, rotation: Radian, size: Vector, duration?: number): void;
|
|
1213
|
+
createPhysicsEntityShapeVisual(p2Body: p2$1.Body, testLayerID: number, options?: {
|
|
1214
|
+
overridePosition?: Vector | undefined;
|
|
1215
|
+
overrideRotation?: Radian | undefined;
|
|
1216
|
+
color?: RGBColor | undefined;
|
|
1217
|
+
}): void;
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
declare class HitTestService {
|
|
1221
|
+
constructor(_testVisualsService: TestVisualsService);
|
|
1222
|
+
hitTest(p2Body: p2$1.Body, options?: Partial<HitTestOptions>): boolean;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
declare class CollisionsService {
|
|
1226
|
+
registerPhysicsWorld(physicsWorld: PhysicsWorldEntity): void;
|
|
1227
|
+
step(physicsWorld: PhysicsWorldEntity, time: number, delta: number): void;
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
declare class BorderService {
|
|
1231
|
+
createBorders(physicsWorldID: AttachmentID, mapSize: Vector, borderBodyGroup: PhysicsBodyGroup): void;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
declare class MaterialsService {
|
|
1235
|
+
createMaterials(p2World: p2$1.World, borderProperties: BorderProperties, materialDefinitions: readonly MaterialDefinition[], materialContactDefinitions: readonly MaterialContactDefinition[]): {
|
|
1236
|
+
materials: Map<string, p2$1.Material>;
|
|
1237
|
+
materialDefinitions: Map<string, MaterialDefinition>;
|
|
1238
|
+
};
|
|
1239
|
+
getMaterial(physicsWorldID: number, name: string): p2$1.Material;
|
|
1240
|
+
getMaterialDefinition(physicsWorldID: number, name: string): MaterialDefinition;
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
declare class PhysicsWorldService {
|
|
1244
|
+
constructor(_materialsService: MaterialsService, _borderService: BorderService, _availabilityGridService: AvailabilityGridService, _collisionsService: CollisionsService, _physicsBodyGroupService: PhysicsBodyGroupService);
|
|
1245
|
+
createPhysicsWorld(request: CreatePhysicsWorldRequestDTO): number;
|
|
1246
|
+
addBody(physicsWorldID: number, body: p2$1.Body, addInEmptySpace: boolean, physicsBodyGroup: PhysicsBodyGroup, includeOnPathfinding: boolean): boolean;
|
|
1247
|
+
removeBody(physicsWorldID: number, body: p2$1.Body): void;
|
|
1248
|
+
setPaused(pause: boolean, physicsWorldID: number): void;
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
declare class RayCastingService {
|
|
1252
|
+
castClosest(physicsWorld: PhysicsWorldEntity, line: Line, physicsBodyGroup: PhysicsBodyGroup): RayCastHit | undefined;
|
|
1253
|
+
castAllFirstContacts(physicsWorld: PhysicsWorldEntity, line: Line, physicsBodyGroup: PhysicsBodyGroup): RayCastHit[];
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
declare class ImpactService {
|
|
1257
|
+
applyImpulse(body: p2.Body, hitPosition: Vector, hitDirection: Vector, severity: number): void;
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
interface ExplosionHitWithP2Body extends ExplosionHit {
|
|
1261
|
+
p2Body: p2.Body;
|
|
1262
|
+
}
|
|
1263
|
+
declare class RayCastHitConverterService {
|
|
1264
|
+
toExplosionHits(rayCasts: RayCast[], allRaysStartingFromSamePosition?: boolean): ExplosionHitWithP2Body[];
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
declare class ElipticExplosionService {
|
|
1268
|
+
constructor(_rayCastingService: RayCastingService, _testVisualsService: TestVisualsService, _rayCastHitConverterService: RayCastHitConverterService, _impactService: ImpactService);
|
|
1269
|
+
createElipticExplosion(physicsWorldID: number, explosionCenter: Vector, rotation: Radian, size: Vector, physicsBodyGroup: PhysicsBodyGroup, severity: number, options?: PhysicsExplosionOptions): ExplosionHit[];
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
declare class ExplosionService {
|
|
1273
|
+
constructor(_rayCastingService: RayCastingService, _testVisualsService: TestVisualsService, _rayCastHitConverterService: RayCastHitConverterService, _impactService: ImpactService);
|
|
1274
|
+
createExplosion(physicsWorldID: number, explosionCenter: Vector, radius: number, physicsBodyGroup: PhysicsBodyGroup, severity: number, options?: PhysicsExplosionOptions): ExplosionHit[];
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
declare class PhysicsQueryService {
|
|
1278
|
+
getMapSize(physicsWorldID: number): MapSizeDTO;
|
|
1279
|
+
subscribeToPhysicsStep(physicsWorldID: number, callback: NotifierCallbackFunction<{
|
|
1280
|
+
time: number;
|
|
1281
|
+
delta: number;
|
|
1282
|
+
}>): IAttachment;
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
declare class PhysicsController {
|
|
1286
|
+
constructor(_physicsWorldService: PhysicsWorldService, _pathFinderService: PathFinderService, _testVisualsService: TestVisualsService, _explosionService: ExplosionService, _elipticExplosionService: ElipticExplosionService, _hitTestService: HitTestService, _physicsQueryService: PhysicsQueryService, _impactService: ImpactService);
|
|
999
1287
|
createPhysicsWorld(request: CreatePhysicsWorldRequestDTO): number;
|
|
1000
1288
|
getMapSize(physicsWorldID: number): MapSizeDTO;
|
|
1001
1289
|
setPaused(pause: boolean, physicsWorldID: number): void;
|
|
@@ -1008,4 +1296,8 @@ declare class PhysicsGateway {
|
|
|
1008
1296
|
printPathfindingTestGrid(physicsWorldID: number, testLayerID: number, target: Vector | number, physicsBodyGroup: PhysicsBodyGroup, area: Rectangle, gridCellSize?: number): void;
|
|
1009
1297
|
}
|
|
1010
1298
|
|
|
1011
|
-
|
|
1299
|
+
declare const PhysicsGateway_base: new () => PhysicsController;
|
|
1300
|
+
declare class PhysicsGateway extends PhysicsGateway_base {
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
export { AnimationFlicker, AnimationInterpolationFunctions, type AnimationOptions, Animations, AnimationsCompletionHandlingType, Animator, type AnimatorAnimation, type AssetDefinition, type AudioAppearTransitionType, BORDER_MATERIAL_NAME, BardLegendsHardReset, 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 ExplosionHit, FadeInContent, type FadeInContentOptions, FadeInStateAnimation, FocusingAnimation, Game, Gateway, type GlowEffectOptions, type GlowOptions, type GlowingShapeDefinition, Graphics, type HitTestOptions, ImmovablePhysicsEntity, type InteractingBodyGroups, type KeyboardKeyInfo, KeyboardService, type MapSizeDTO, type MaterialContactDefinition, type MaterialDefinition, MenuEntity, type MenuOptions, MenuUI, MenuView, MouseService, MouseTargetFocusService, MovableEntity, MovablePhysicsEntity, Music, type MusicDefinition, type MusicID, type MusicIDRegistry, type PartialTextOptions, PathFinder, type PathFinderResult, type PhysicsBodyDTO, PhysicsEntity, type PhysicsEntityDefinition, type PhysicsExplosionOptions, PhysicsGateway, PhysicsShapeType, Placeholder, type PolygonDefinition, type PolygonShapeData, ROTATIONAL_SPEED_LIMIT, type RayCast, type RayCastHit, ReAnimateHandlingType, type RectangleShapeData, RichText, type RichTextOptions, type RichTextRectangleCut, type RichTextStyles, 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, Sprite, type SpriteDefinition, type SpriteID, type SpriteIDRegistry, StateAnimation, type StateAnimationOptions, Text, type TextAlignment, type TextOptions, UpdatableContainer, UpdateCycle, VectorFieldPathFinder, VectorSet, View, ViewDecorator, type ViewDecoratorMeta };
|