@m2c2kit/core 0.3.18 → 0.3.20
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.ts +1161 -601
- package/dist/index.js +9864 -8019
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +3 -3
- package/package.json +9 -10
package/dist/index.d.ts
CHANGED
|
@@ -1,88 +1,5 @@
|
|
|
1
1
|
import { Canvas, Typeface, TypefaceFontProvider, Image, Paint, CanvasKit, Surface, Font, ParagraphBuilder, Paragraph, FontMgr, Path, PaintStyle } from 'canvaskit-wasm';
|
|
2
2
|
|
|
3
|
-
declare class GlobalVariables {
|
|
4
|
-
now: number;
|
|
5
|
-
deltaTime: number;
|
|
6
|
-
canvasScale: number;
|
|
7
|
-
rootScale: number;
|
|
8
|
-
canvasCssWidth: number;
|
|
9
|
-
canvasCssHeight: number;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
declare global {
|
|
13
|
-
var Globals: GlobalVariables;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=Globals.d.ts.map
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Base interface for all m2c2kit events.
|
|
19
|
-
*
|
|
20
|
-
* @remarks I would have named it Event, but that would collide with
|
|
21
|
-
* the existing DOM Event
|
|
22
|
-
*/
|
|
23
|
-
interface M2Event<T> {
|
|
24
|
-
/** Type of event. */
|
|
25
|
-
type: M2EventType | string;
|
|
26
|
-
/** The object on which the event occurred. */
|
|
27
|
-
target: T;
|
|
28
|
-
/** Has the event been taken care of by the listener and not be dispatched to other targets? */
|
|
29
|
-
handled?: boolean;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* The different events that are dispatched by m2c2kit core.
|
|
33
|
-
*/
|
|
34
|
-
declare const M2EventType: {
|
|
35
|
-
readonly ActivityStart: "ActivityStart";
|
|
36
|
-
readonly ActivityEnd: "ActivityEnd";
|
|
37
|
-
readonly ActivityCancel: "ActivityCancel";
|
|
38
|
-
readonly ActivityData: "ActivityData";
|
|
39
|
-
readonly GameWarmupStart: "GameWarmupStart";
|
|
40
|
-
readonly GameWarmupEnd: "GameWarmupEnd";
|
|
41
|
-
readonly TapDown: "TapDown";
|
|
42
|
-
readonly TapUp: "TapUp";
|
|
43
|
-
readonly TapUpAny: "TapUpAny";
|
|
44
|
-
readonly TapLeave: "TapLeave";
|
|
45
|
-
readonly PointerDown: "PointerDown";
|
|
46
|
-
readonly PointerUp: "PointerUp";
|
|
47
|
-
readonly PointerMove: "PointerMove";
|
|
48
|
-
readonly PointerLeave: "PointerLeave";
|
|
49
|
-
readonly Drag: "Drag";
|
|
50
|
-
readonly DragStart: "DragStart";
|
|
51
|
-
readonly DragEnd: "DragEnd";
|
|
52
|
-
readonly CompositeCustom: "CompositeCustom";
|
|
53
|
-
readonly FrameDidSimulatePhysics: "FrameDidSimulatePhysics";
|
|
54
|
-
readonly SceneSetup: "SceneSetup";
|
|
55
|
-
readonly SceneAppear: "SceneAppear";
|
|
56
|
-
};
|
|
57
|
-
type M2EventType = (typeof M2EventType)[keyof typeof M2EventType];
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Base interface for all m2c2kit event listeners.
|
|
61
|
-
*/
|
|
62
|
-
interface M2EventListener<T> {
|
|
63
|
-
/** Type of event to listen for. */
|
|
64
|
-
type: M2EventType | string;
|
|
65
|
-
/** Callback function to be called when the event is dispatched. */
|
|
66
|
-
callback: (event: T) => void;
|
|
67
|
-
/** Optional key (string identifier) used to identify the event listener. */
|
|
68
|
-
key?: string;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
interface M2NodeEventListener<M2NodeEvent> extends M2EventListener<M2NodeEvent> {
|
|
72
|
-
/** For composites that raise events, type of the composite custom event. */
|
|
73
|
-
compositeType?: string;
|
|
74
|
-
/** UUID of the node that the event listener is listening for. */
|
|
75
|
-
nodeUuid: string;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/** Base interface for all M2Node events. */
|
|
79
|
-
interface M2NodeEvent extends M2Event<M2Node> {
|
|
80
|
-
/** The M2Node on which the event occurred. */
|
|
81
|
-
target: M2Node;
|
|
82
|
-
/** For composites that raise events, type of the composite custom event. */
|
|
83
|
-
compositeType?: string;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
3
|
/**
|
|
87
4
|
* Position in two-dimensional space.
|
|
88
5
|
*/
|
|
@@ -93,30 +10,32 @@ interface Point {
|
|
|
93
10
|
y: number;
|
|
94
11
|
}
|
|
95
12
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
13
|
+
interface IDrawable {
|
|
14
|
+
draw(canvas: Canvas): void;
|
|
15
|
+
warmup(canvas: Canvas): void;
|
|
16
|
+
/**
|
|
17
|
+
* Frees up resources allocated by the Drawable M2Node.
|
|
18
|
+
*
|
|
19
|
+
* @internal For m2c2kit library use only
|
|
20
|
+
*
|
|
21
|
+
* @remarks This will be done automatically by the m2c2kit library; the
|
|
22
|
+
* end-user must not call this.
|
|
23
|
+
*/
|
|
24
|
+
dispose(): void;
|
|
25
|
+
anchorPoint: Point;
|
|
26
|
+
zPosition: number;
|
|
107
27
|
}
|
|
108
28
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
buttons: number;
|
|
29
|
+
declare enum M2NodeType {
|
|
30
|
+
Node = "Node",
|
|
31
|
+
Scene = "Scene",
|
|
32
|
+
Sprite = "Sprite",
|
|
33
|
+
Label = "Label",
|
|
34
|
+
TextLine = "TextLine",
|
|
35
|
+
Shape = "Shape",
|
|
36
|
+
Composite = "Composite",
|
|
37
|
+
SoundPlayer = "SoundPlayer",
|
|
38
|
+
SoundRecorder = "SoundRecorder"
|
|
120
39
|
}
|
|
121
40
|
|
|
122
41
|
interface DrawableOptions {
|
|
@@ -170,43 +89,6 @@ interface Layout {
|
|
|
170
89
|
constraints?: Constraints;
|
|
171
90
|
}
|
|
172
91
|
|
|
173
|
-
/**
|
|
174
|
-
* Color in red (0-255), green (0-255), blue (0-255), alpha (0-1) format. Must be numeric array of length 4.
|
|
175
|
-
*/
|
|
176
|
-
type RgbaColor = [number, number, number, number];
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Map of placeholders to values for use in string interpolation.
|
|
180
|
-
*/
|
|
181
|
-
interface StringInterpolationMap {
|
|
182
|
-
[placeholder: string]: string;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
interface TextOptions {
|
|
186
|
-
/** Text to be displayed */
|
|
187
|
-
text?: string;
|
|
188
|
-
/** Name of font to use for text. Must have been previously loaded */
|
|
189
|
-
fontName?: string;
|
|
190
|
-
/** Color of text. Default is Constants.DEFAULT_FONT_COLOR (WebColors.Black) */
|
|
191
|
-
fontColor?: RgbaColor;
|
|
192
|
-
/** Size of text. Default is Constants.DEFAULT_FONT_SIZE (16) */
|
|
193
|
-
fontSize?: number;
|
|
194
|
-
/** Map of placeholders to values for use in string interpolation during localization. */
|
|
195
|
-
interpolation?: StringInterpolationMap;
|
|
196
|
-
/** If true, try to use a localized version of the text. Default is true. */
|
|
197
|
-
localize?: boolean;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Width and height on two-dimensional space
|
|
202
|
-
*/
|
|
203
|
-
interface Size {
|
|
204
|
-
/** Horizontal width, x-axis */
|
|
205
|
-
width: number;
|
|
206
|
-
/** Vertical height, y-axis */
|
|
207
|
-
height: number;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
92
|
interface M2NodeOptions {
|
|
211
93
|
/** Name of the node. Only needed if the node will be referred to by name in a later function */
|
|
212
94
|
name?: string;
|
|
@@ -226,210 +108,46 @@ interface M2NodeOptions {
|
|
|
226
108
|
hidden?: boolean;
|
|
227
109
|
/** FOR INTERNAL USE ONLY */
|
|
228
110
|
layout?: Layout;
|
|
111
|
+
/** Unique identifier (UUID). Will be generated automatically. @internal For m2c2kit library use only */
|
|
112
|
+
uuid?: string;
|
|
113
|
+
/** Should the node not emit events to the EventStore? Default is false.
|
|
114
|
+
* @remarks This property is for use by authors of `Composite` nodes. It is not intended for general use. */
|
|
115
|
+
suppressEvents?: boolean;
|
|
229
116
|
}
|
|
230
117
|
|
|
231
|
-
|
|
232
|
-
Node = "Node",
|
|
233
|
-
Scene = "Scene",
|
|
234
|
-
Sprite = "Sprite",
|
|
235
|
-
Label = "Label",
|
|
236
|
-
TextLine = "TextLine",
|
|
237
|
-
Shape = "Shape",
|
|
238
|
-
Composite = "Composite",
|
|
239
|
-
SoundPlayer = "SoundPlayer",
|
|
240
|
-
SoundRecorder = "SoundRecorder"
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
type EasingFunction = (
|
|
244
|
-
/** elapsed time since start of action */
|
|
245
|
-
t: number,
|
|
246
|
-
/** start value of value to be eased */
|
|
247
|
-
b: number,
|
|
248
|
-
/** total change of value to be eased */
|
|
249
|
-
c: number,
|
|
250
|
-
/** total duration of action */
|
|
251
|
-
d: number) => number;
|
|
252
|
-
/**
|
|
253
|
-
* The Easings class has static methods for creating easings to be used in actions.
|
|
254
|
-
*/
|
|
255
|
-
declare class Easings {
|
|
256
|
-
static none: EasingFunction;
|
|
257
|
-
static linear: EasingFunction;
|
|
258
|
-
static quadraticIn: EasingFunction;
|
|
259
|
-
static quadraticOut: EasingFunction;
|
|
260
|
-
static quadraticInOut: EasingFunction;
|
|
261
|
-
static cubicIn: EasingFunction;
|
|
262
|
-
static cubicOut: EasingFunction;
|
|
263
|
-
static cubicInOut: EasingFunction;
|
|
264
|
-
static quarticIn: EasingFunction;
|
|
265
|
-
static quarticOut: EasingFunction;
|
|
266
|
-
static quarticInOut: EasingFunction;
|
|
267
|
-
static quinticIn: EasingFunction;
|
|
268
|
-
static quinticOut: EasingFunction;
|
|
269
|
-
static quinticInOut: EasingFunction;
|
|
270
|
-
static sinusoidalIn: EasingFunction;
|
|
271
|
-
static sinusoidalOut: EasingFunction;
|
|
272
|
-
static sinusoidalInOut: EasingFunction;
|
|
273
|
-
static exponentialIn: EasingFunction;
|
|
274
|
-
static exponentialOut: EasingFunction;
|
|
275
|
-
static exponentialInOut: EasingFunction;
|
|
276
|
-
static circularIn: EasingFunction;
|
|
277
|
-
static circularOut: EasingFunction;
|
|
278
|
-
static circularInOut: EasingFunction;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
interface IDrawable {
|
|
282
|
-
draw(canvas: Canvas): void;
|
|
283
|
-
warmup(canvas: Canvas): void;
|
|
284
|
-
/**
|
|
285
|
-
* Frees up resources allocated by the Drawable M2Node.
|
|
286
|
-
*
|
|
287
|
-
* @internal For m2c2kit library use only
|
|
288
|
-
*
|
|
289
|
-
* @remarks This will be done automatically by the m2c2kit library; the
|
|
290
|
-
* end-user must not call this.
|
|
291
|
-
*/
|
|
292
|
-
dispose(): void;
|
|
293
|
-
anchorPoint: Point;
|
|
294
|
-
zPosition: number;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
interface SceneOptions extends M2NodeOptions, DrawableOptions {
|
|
298
|
-
/** Background color of the scene. Default is Constants.DEFAULT_SCENE_BACKGROUND_COLOR (WebColors.White) */
|
|
299
|
-
backgroundColor?: RgbaColor;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
interface CallbackOptions {
|
|
303
|
-
/** Should the provided callback replace any existing callbacks of the same event type for this target? Default is false */
|
|
304
|
-
replaceExisting?: boolean;
|
|
305
|
-
/** String identifier used to identify the callback. Only needed if the callback will be removed later */
|
|
306
|
-
key?: string;
|
|
118
|
+
interface CompositeOptions extends M2NodeOptions, DrawableOptions {
|
|
307
119
|
}
|
|
308
120
|
|
|
309
|
-
declare class
|
|
310
|
-
readonly type = M2NodeType.
|
|
121
|
+
declare abstract class Composite extends M2Node implements IDrawable {
|
|
122
|
+
readonly type = M2NodeType.Composite;
|
|
123
|
+
compositeType: string;
|
|
311
124
|
isDrawable: boolean;
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
y: number;
|
|
315
|
-
};
|
|
316
|
-
zPosition: number;
|
|
317
|
-
private _backgroundColor;
|
|
318
|
-
_active: boolean;
|
|
319
|
-
_transitioning: boolean;
|
|
320
|
-
private backgroundPaint?;
|
|
125
|
+
private _anchorPoint;
|
|
126
|
+
private _zPosition;
|
|
321
127
|
/**
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
* @remarks The scene is the game screen or stage, and fills the entire available screen. There are usually multiple screens to contain multiple stages of the game, such as various instruction pages or phases of a game.
|
|
128
|
+
* Base Drawable object for creating custom nodes ("composites") composed of primitive nodes.
|
|
325
129
|
*
|
|
326
|
-
* @param options
|
|
130
|
+
* @param options
|
|
327
131
|
*/
|
|
328
|
-
constructor(options?:
|
|
132
|
+
constructor(options?: CompositeOptions);
|
|
329
133
|
initialize(): void;
|
|
134
|
+
get anchorPoint(): Point;
|
|
135
|
+
set anchorPoint(anchorPoint: Point);
|
|
136
|
+
get zPosition(): number;
|
|
137
|
+
set zPosition(zPosition: number);
|
|
330
138
|
dispose(): void;
|
|
331
|
-
set game(game: Game);
|
|
332
|
-
/**
|
|
333
|
-
* The game which this scene is a part of.
|
|
334
|
-
*
|
|
335
|
-
* @remarks Throws error if scene is not part of the game object.
|
|
336
|
-
*/
|
|
337
|
-
get game(): Game;
|
|
338
|
-
get backgroundColor(): RgbaColor;
|
|
339
|
-
set backgroundColor(backgroundColor: RgbaColor);
|
|
340
|
-
/**
|
|
341
|
-
* Duplicates a node using deep copy.
|
|
342
|
-
*
|
|
343
|
-
* @remarks This is a deep recursive clone (node and children).
|
|
344
|
-
* The uuid property of all duplicated nodes will be newly created,
|
|
345
|
-
* because uuid must be unique.
|
|
346
|
-
*
|
|
347
|
-
* @param newName - optional name of the new, duplicated node. If not
|
|
348
|
-
* provided, name will be the new uuid
|
|
349
|
-
*/
|
|
350
|
-
duplicate(newName?: string): Scene;
|
|
351
|
-
/**
|
|
352
|
-
* Code that will be called every time the scene is presented.
|
|
353
|
-
*
|
|
354
|
-
* @remarks Use this callback to set nodes to their initial state, if
|
|
355
|
-
* that state might be changed later. For example, if a scene allows
|
|
356
|
-
* players to place dots on a grid, the setup() method should ensure the
|
|
357
|
-
* grid is clear of any prior dots from previous times this scene may
|
|
358
|
-
* have been displayed. In addition, if nodes should vary in each
|
|
359
|
-
* iteration, that should be done here.
|
|
360
|
-
*
|
|
361
|
-
* @param callback - function to execute
|
|
362
|
-
* @param options - {@link CallbackOptions}
|
|
363
|
-
*/
|
|
364
|
-
onSetup(callback: (nodeEvent: M2NodeEvent) => void, options?: CallbackOptions): void;
|
|
365
|
-
/**
|
|
366
|
-
*
|
|
367
|
-
* Code that will be called after the scene has finished any transitions
|
|
368
|
-
* and has fully appeared on the screen.
|
|
369
|
-
*
|
|
370
|
-
* @param callback - function to execute
|
|
371
|
-
* @param options - {@link CallbackOptions}
|
|
372
|
-
*/
|
|
373
|
-
onAppear(callback: (nodeEvent: M2NodeEvent) => void, options?: CallbackOptions): void;
|
|
374
139
|
update(): void;
|
|
375
140
|
draw(canvas: Canvas): void;
|
|
376
|
-
warmup(canvas: Canvas): void;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
interface SlideTransitionOptions {
|
|
380
|
-
/** Direction in which the slide action goes */
|
|
381
|
-
direction: TransitionDirection;
|
|
382
|
-
/** Duration, in milliseconds, of the transition */
|
|
383
|
-
duration: number;
|
|
384
|
-
/** Easing function for movement; default is linear */
|
|
385
|
-
easing?: EasingFunction;
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* The Transition class has static methods for creating animations that run as one scene transitions to another.
|
|
389
|
-
*/
|
|
390
|
-
declare abstract class Transition {
|
|
391
|
-
abstract type: TransitionType;
|
|
392
|
-
abstract easing: EasingFunction;
|
|
393
|
-
abstract duration: number;
|
|
141
|
+
abstract warmup(canvas: Canvas): void;
|
|
394
142
|
/**
|
|
395
|
-
*
|
|
143
|
+
* Event handler for custom events a `Composite` may generate.
|
|
396
144
|
*
|
|
397
|
-
* @
|
|
398
|
-
*
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
/**
|
|
402
|
-
* Creates a scene transition with no animation or duration. The next scene is immediately drawn.
|
|
145
|
+
* @remarks If the `Composite` generates custom events, this method is
|
|
146
|
+
* necessary for the `Composite` to work in replay mode.
|
|
147
|
+
*
|
|
148
|
+
* @param event - event to handle
|
|
403
149
|
*/
|
|
404
|
-
|
|
405
|
-
}
|
|
406
|
-
declare class NoneTransition extends Transition {
|
|
407
|
-
type: TransitionType;
|
|
408
|
-
easing: EasingFunction;
|
|
409
|
-
duration: number;
|
|
410
|
-
constructor();
|
|
411
|
-
}
|
|
412
|
-
declare class SlideTransition extends Transition {
|
|
413
|
-
type: TransitionType;
|
|
414
|
-
easing: EasingFunction;
|
|
415
|
-
duration: number;
|
|
416
|
-
direction: TransitionDirection;
|
|
417
|
-
constructor(direction: TransitionDirection, duration: number, easing: EasingFunction);
|
|
418
|
-
}
|
|
419
|
-
declare enum TransitionType {
|
|
420
|
-
Slide = "Slide",
|
|
421
|
-
None = "None"
|
|
422
|
-
}
|
|
423
|
-
declare enum TransitionDirection {
|
|
424
|
-
Up = "Up",
|
|
425
|
-
Down = "Down",
|
|
426
|
-
Right = "Right",
|
|
427
|
-
Left = "Left"
|
|
428
|
-
}
|
|
429
|
-
declare class SceneTransition {
|
|
430
|
-
scene: Scene;
|
|
431
|
-
transition: Transition;
|
|
432
|
-
constructor(scene: Scene, transition: Transition);
|
|
150
|
+
handleCompositeEvent(event: CompositeEvent): void;
|
|
433
151
|
}
|
|
434
152
|
|
|
435
153
|
/** Base interface for all Activity events. */
|
|
@@ -577,6 +295,13 @@ interface IDataStore {
|
|
|
577
295
|
itemExists(key: string): Promise<boolean>;
|
|
578
296
|
}
|
|
579
297
|
|
|
298
|
+
interface CallbackOptions {
|
|
299
|
+
/** Should the provided callback replace any existing callbacks of the same event type for this target? Default is false */
|
|
300
|
+
replaceExisting?: boolean;
|
|
301
|
+
/** String identifier used to identify the callback. Only needed if the callback will be removed later */
|
|
302
|
+
key?: string;
|
|
303
|
+
}
|
|
304
|
+
|
|
580
305
|
interface Activity {
|
|
581
306
|
/** The type of activity: Game or Survey */
|
|
582
307
|
type: ActivityType;
|
|
@@ -616,48 +341,249 @@ interface Activity {
|
|
|
616
341
|
/**
|
|
617
342
|
* Executes a callback when the activity is canceled.
|
|
618
343
|
*
|
|
619
|
-
* @param callback - function to execute.
|
|
620
|
-
* @param options - options for the callback.
|
|
344
|
+
* @param callback - function to execute.
|
|
345
|
+
* @param options - options for the callback.
|
|
346
|
+
*/
|
|
347
|
+
onCancel(callback: (activityLifecycleEvent: ActivityLifecycleEvent) => void, options?: CallbackOptions): void;
|
|
348
|
+
/**
|
|
349
|
+
* Executes a callback when the activity ends.
|
|
350
|
+
*
|
|
351
|
+
* @param callback - function to execute.
|
|
352
|
+
* @param options - options for the callback.
|
|
353
|
+
*/
|
|
354
|
+
onEnd(callback: (activityLifecycleEvent: ActivityLifecycleEvent) => void, options?: CallbackOptions): void;
|
|
355
|
+
/**
|
|
356
|
+
* Executes a callback when the activity generates data.
|
|
357
|
+
*
|
|
358
|
+
* @param callback - function to execute.
|
|
359
|
+
* @param options - options for the callback.
|
|
360
|
+
*/
|
|
361
|
+
onData(callback: (activityResultsEvent: ActivityResultsEvent) => void, options?: CallbackOptions): void;
|
|
362
|
+
/** The activity's parent session unique identifier. This is newly generated each session. */
|
|
363
|
+
sessionUuid: string;
|
|
364
|
+
/** The activity's unique identifier. This is newly generated each session. The UUID for an activity will vary across sessions. */
|
|
365
|
+
uuid: string;
|
|
366
|
+
/** Human-friendly name of this activity */
|
|
367
|
+
name: string;
|
|
368
|
+
/** Short identifier of this activity */
|
|
369
|
+
id: string;
|
|
370
|
+
/** Persistent unique identifier (UUID) of the activity. Required for games. Optional or empty string if a survey. */
|
|
371
|
+
publishUuid: string;
|
|
372
|
+
/** The ID of the study (protocol, experiment, or other aggregate) that contains the repeated administrations of this activity. The ID should be short, url-friendly, human-readable text (no spaces, special characters, or slashes), e.g., `nyc-aging-cohort`. */
|
|
373
|
+
studyId?: string;
|
|
374
|
+
/** Unique identifier (UUID) of the study (protocol, experiment, or other aggregate) that contains the administration of this activity. */
|
|
375
|
+
studyUuid?: string;
|
|
376
|
+
/** The value of performance.now() immediately before the activity begins */
|
|
377
|
+
beginTimestamp: number;
|
|
378
|
+
/** The value of new Date().toISOString() immediately before the activity begins */
|
|
379
|
+
beginIso8601Timestamp: string;
|
|
380
|
+
/** Sets additional activity parameters if defaults are not sufficient. */
|
|
381
|
+
setParameters(additionalParameters: unknown): void;
|
|
382
|
+
/** Additional activity parameters that were set. */
|
|
383
|
+
readonly additionalParameters?: unknown;
|
|
384
|
+
/** Optional stores to use for saving data. The implementation of the store is not provided by the \@m2c2kit/core library. */
|
|
385
|
+
dataStores?: IDataStore[];
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/** Base interface for all M2Node events. */
|
|
389
|
+
interface M2NodeEvent extends M2Event<M2Node> {
|
|
390
|
+
/** The M2Node on which the event occurred. If the event has gone through serialization, the string will be the node's UUID. */
|
|
391
|
+
target: M2Node | string;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Color in red (0-255), green (0-255), blue (0-255), alpha (0-1) format. Must be numeric array of length 4.
|
|
396
|
+
*/
|
|
397
|
+
type RgbaColor = [number, number, number, number];
|
|
398
|
+
|
|
399
|
+
interface SceneOptions extends M2NodeOptions, DrawableOptions {
|
|
400
|
+
/** Background color of the scene. Default is Constants.DEFAULT_SCENE_BACKGROUND_COLOR (WebColors.White) */
|
|
401
|
+
backgroundColor?: RgbaColor;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
declare class Scene extends M2Node implements IDrawable, SceneOptions {
|
|
405
|
+
readonly type = M2NodeType.Scene;
|
|
406
|
+
isDrawable: boolean;
|
|
407
|
+
private _anchorPoint;
|
|
408
|
+
private _zPosition;
|
|
409
|
+
private _backgroundColor;
|
|
410
|
+
_active: boolean;
|
|
411
|
+
_transitioning: boolean;
|
|
412
|
+
private backgroundPaint?;
|
|
413
|
+
/**
|
|
414
|
+
* Top-level node that holds all other nodes, such as sprites, rectangles, or labels, that will be displayed on the screen
|
|
415
|
+
*
|
|
416
|
+
* @remarks The scene is the game screen or stage, and fills the entire available screen. There are usually multiple screens to contain multiple stages of the game, such as various instruction pages or phases of a game.
|
|
417
|
+
*
|
|
418
|
+
* @param options - {@link SceneOptions}
|
|
419
|
+
*/
|
|
420
|
+
constructor(options?: SceneOptions);
|
|
421
|
+
get completeNodeOptions(): {
|
|
422
|
+
backgroundColor: RgbaColor;
|
|
423
|
+
anchorPoint?: Point;
|
|
424
|
+
zPosition?: number;
|
|
425
|
+
name?: string;
|
|
426
|
+
position?: Point;
|
|
427
|
+
scale?: number;
|
|
428
|
+
alpha?: number;
|
|
429
|
+
zRotation?: number;
|
|
430
|
+
isUserInteractionEnabled?: boolean;
|
|
431
|
+
draggable?: boolean;
|
|
432
|
+
hidden?: boolean;
|
|
433
|
+
layout?: Layout;
|
|
434
|
+
uuid?: string;
|
|
435
|
+
suppressEvents?: boolean;
|
|
436
|
+
};
|
|
437
|
+
initialize(): void;
|
|
438
|
+
dispose(): void;
|
|
439
|
+
set game(game: Game);
|
|
440
|
+
/**
|
|
441
|
+
* The game which this scene is a part of.
|
|
442
|
+
*
|
|
443
|
+
* @remarks Throws error if scene is not part of the game object.
|
|
444
|
+
*/
|
|
445
|
+
get game(): Game;
|
|
446
|
+
get backgroundColor(): RgbaColor;
|
|
447
|
+
set backgroundColor(backgroundColor: RgbaColor);
|
|
448
|
+
get anchorPoint(): Point;
|
|
449
|
+
set anchorPoint(anchorPoint: Point);
|
|
450
|
+
get zPosition(): number;
|
|
451
|
+
set zPosition(zPosition: number);
|
|
452
|
+
/**
|
|
453
|
+
* Duplicates a node using deep copy.
|
|
454
|
+
*
|
|
455
|
+
* @remarks This is a deep recursive clone (node and children).
|
|
456
|
+
* The uuid property of all duplicated nodes will be newly created,
|
|
457
|
+
* because uuid must be unique.
|
|
458
|
+
*
|
|
459
|
+
* @param newName - optional name of the new, duplicated node. If not
|
|
460
|
+
* provided, name will be the new uuid
|
|
461
|
+
*/
|
|
462
|
+
duplicate(newName?: string): Scene;
|
|
463
|
+
/**
|
|
464
|
+
* Code that will be called every time the scene is presented.
|
|
465
|
+
*
|
|
466
|
+
* @remarks Use this callback to set nodes to their initial state, if
|
|
467
|
+
* that state might be changed later. For example, if a scene allows
|
|
468
|
+
* players to place dots on a grid, the setup() method should ensure the
|
|
469
|
+
* grid is clear of any prior dots from previous times this scene may
|
|
470
|
+
* have been displayed. In addition, if nodes should vary in each
|
|
471
|
+
* iteration, that should be done here.
|
|
472
|
+
*
|
|
473
|
+
* @param callback - function to execute
|
|
474
|
+
* @param options - {@link CallbackOptions}
|
|
475
|
+
*/
|
|
476
|
+
onSetup(callback: (nodeEvent: M2NodeEvent) => void, options?: CallbackOptions): void;
|
|
477
|
+
/**
|
|
478
|
+
*
|
|
479
|
+
* Code that will be called after the scene has finished any transitions
|
|
480
|
+
* and has fully appeared on the screen.
|
|
481
|
+
*
|
|
482
|
+
* @param callback - function to execute
|
|
483
|
+
* @param options - {@link CallbackOptions}
|
|
621
484
|
*/
|
|
622
|
-
|
|
485
|
+
onAppear(callback: (nodeEvent: M2NodeEvent) => void, options?: CallbackOptions): void;
|
|
486
|
+
update(): void;
|
|
487
|
+
draw(canvas: Canvas): void;
|
|
488
|
+
warmup(canvas: Canvas): void;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
type EasingFunction = (
|
|
492
|
+
/** elapsed time since start of action */
|
|
493
|
+
t: number,
|
|
494
|
+
/** start value of value to be eased */
|
|
495
|
+
b: number,
|
|
496
|
+
/** total change of value to be eased */
|
|
497
|
+
c: number,
|
|
498
|
+
/** total duration of action */
|
|
499
|
+
d: number) => number;
|
|
500
|
+
/**
|
|
501
|
+
* The Easings class has static methods for creating easings to be used in actions.
|
|
502
|
+
*/
|
|
503
|
+
declare class Easings {
|
|
504
|
+
static none: EasingFunction;
|
|
505
|
+
static linear: EasingFunction;
|
|
506
|
+
static quadraticIn: EasingFunction;
|
|
507
|
+
static quadraticOut: EasingFunction;
|
|
508
|
+
static quadraticInOut: EasingFunction;
|
|
509
|
+
static cubicIn: EasingFunction;
|
|
510
|
+
static cubicOut: EasingFunction;
|
|
511
|
+
static cubicInOut: EasingFunction;
|
|
512
|
+
static quarticIn: EasingFunction;
|
|
513
|
+
static quarticOut: EasingFunction;
|
|
514
|
+
static quarticInOut: EasingFunction;
|
|
515
|
+
static quinticIn: EasingFunction;
|
|
516
|
+
static quinticOut: EasingFunction;
|
|
517
|
+
static quinticInOut: EasingFunction;
|
|
518
|
+
static sinusoidalIn: EasingFunction;
|
|
519
|
+
static sinusoidalOut: EasingFunction;
|
|
520
|
+
static sinusoidalInOut: EasingFunction;
|
|
521
|
+
static exponentialIn: EasingFunction;
|
|
522
|
+
static exponentialOut: EasingFunction;
|
|
523
|
+
static exponentialInOut: EasingFunction;
|
|
524
|
+
static circularIn: EasingFunction;
|
|
525
|
+
static circularOut: EasingFunction;
|
|
526
|
+
static circularInOut: EasingFunction;
|
|
527
|
+
static toTypeAsString(easingFunction: EasingFunction): string;
|
|
528
|
+
static fromTypeAsString(easingType: string): EasingFunction;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
interface SlideTransitionOptions {
|
|
532
|
+
/** Direction in which the slide action goes */
|
|
533
|
+
direction: TransitionDirection;
|
|
534
|
+
/** Duration, in milliseconds, of the transition */
|
|
535
|
+
duration: number;
|
|
536
|
+
/** Easing function for movement or a string identifier of the easing function, e.g., `SinusoidalInOut`. Default is a linear easing function. */
|
|
537
|
+
easing?: EasingFunction | string;
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* The Transition class has static methods for creating animations that run as one scene transitions to another.
|
|
541
|
+
*/
|
|
542
|
+
declare abstract class Transition {
|
|
543
|
+
abstract type: TransitionType;
|
|
544
|
+
abstract easing: EasingFunction;
|
|
545
|
+
abstract duration: number;
|
|
623
546
|
/**
|
|
624
|
-
*
|
|
547
|
+
* Creates a scene transition in which the outgoing scene slides out and the incoming scene slides in, as if the incoming scene pushes it.
|
|
625
548
|
*
|
|
626
|
-
* @param
|
|
627
|
-
* @
|
|
549
|
+
* @param options - {@link SlideTransitionOptions}
|
|
550
|
+
* @returns
|
|
628
551
|
*/
|
|
629
|
-
|
|
552
|
+
static slide(options: SlideTransitionOptions): SlideTransition;
|
|
630
553
|
/**
|
|
631
|
-
*
|
|
632
|
-
*
|
|
633
|
-
* @param callback - function to execute.
|
|
634
|
-
* @param options - options for the callback.
|
|
554
|
+
* Creates a scene transition with no animation or duration. The next scene is immediately drawn.
|
|
635
555
|
*/
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
readonly
|
|
659
|
-
|
|
660
|
-
|
|
556
|
+
static none(): NoneTransition;
|
|
557
|
+
}
|
|
558
|
+
declare class NoneTransition extends Transition {
|
|
559
|
+
type: "None";
|
|
560
|
+
easing: EasingFunction;
|
|
561
|
+
duration: number;
|
|
562
|
+
constructor();
|
|
563
|
+
}
|
|
564
|
+
declare class SlideTransition extends Transition {
|
|
565
|
+
type: "Slide";
|
|
566
|
+
easing: EasingFunction;
|
|
567
|
+
duration: number;
|
|
568
|
+
direction: TransitionDirection;
|
|
569
|
+
constructor(direction: TransitionDirection, duration: number, easing: EasingFunction);
|
|
570
|
+
}
|
|
571
|
+
declare const TransitionType: {
|
|
572
|
+
readonly Slide: "Slide";
|
|
573
|
+
readonly None: "None";
|
|
574
|
+
};
|
|
575
|
+
type TransitionType = (typeof TransitionType)[keyof typeof TransitionType];
|
|
576
|
+
declare const TransitionDirection: {
|
|
577
|
+
readonly Up: "Up";
|
|
578
|
+
readonly Down: "Down";
|
|
579
|
+
readonly Right: "Right";
|
|
580
|
+
readonly Left: "Left";
|
|
581
|
+
};
|
|
582
|
+
type TransitionDirection = (typeof TransitionDirection)[keyof typeof TransitionDirection];
|
|
583
|
+
declare class SceneTransition {
|
|
584
|
+
scene: Scene;
|
|
585
|
+
transition: Transition;
|
|
586
|
+
constructor(scene: Scene, transition: Transition);
|
|
661
587
|
}
|
|
662
588
|
|
|
663
589
|
/**
|
|
@@ -677,6 +603,8 @@ interface BrowserImage {
|
|
|
677
603
|
svgString?: string;
|
|
678
604
|
/** URL of image asset (svg, png, jpg) to render and load */
|
|
679
605
|
url?: string;
|
|
606
|
+
/** Image asset as a Data URL. @internal For m2c2kit library use only */
|
|
607
|
+
dataUrl?: string;
|
|
680
608
|
/** If true, the image will not be fully loaded until it is needed. Default
|
|
681
609
|
* is false. Lazy loading is useful for large "banks" of images. These should
|
|
682
610
|
* be lazy loaded because they may not be needed. */
|
|
@@ -965,143 +893,48 @@ interface GameOptions extends LocalizationOptions {
|
|
|
965
893
|
shortDescription?: string;
|
|
966
894
|
/** Full description of game */
|
|
967
895
|
longDescription?: string;
|
|
968
|
-
/** Id of the HTML canvas that game will be drawn on. If not provided, the first canvas found will be used */
|
|
969
|
-
canvasId?: string;
|
|
970
|
-
/** Width of game canvas */
|
|
971
|
-
width: number;
|
|
972
|
-
/** Height of game canvas */
|
|
973
|
-
height: number;
|
|
974
|
-
/** Stretch to fill screen? Default is false */
|
|
975
|
-
stretch?: boolean;
|
|
976
|
-
/** Schema of trial data; JSON object where key is variable name, value is data type */
|
|
977
|
-
trialSchema?: TrialSchema;
|
|
978
|
-
/** Default game parameters; JSON object where key is the game parameter, value is default value */
|
|
979
|
-
parameters?: GameParameters;
|
|
980
|
-
/** Font assets to use. The first element will be the default font */
|
|
981
|
-
fonts?: Array<FontAsset>;
|
|
982
|
-
/** Array of BrowserImage objects to render and load */
|
|
983
|
-
images?: Array<BrowserImage>;
|
|
984
|
-
/** Array of SoundAsset objects to fetch and decode */
|
|
985
|
-
sounds?: Array<SoundAsset>;
|
|
986
|
-
/** Show FPS in upper left corner? Default is false */
|
|
987
|
-
showFps?: boolean;
|
|
988
|
-
/** Color of the html body, if the game does not fill the screen. Useful for showing scene boundaries. Default is the scene background color */
|
|
989
|
-
bodyBackgroundColor?: RgbaColor;
|
|
990
|
-
/** Maximum number of activity metrics to log. */
|
|
991
|
-
maximumRecordedActivityMetrics?: number;
|
|
992
|
-
/** The FPS will be logged in game metrics if the FPS is lower than this value. Default is 59, as defined in Constants.FPS_METRIC_REPORT_THRESHOLD */
|
|
993
|
-
fpsMetricReportThreshold?: number;
|
|
994
|
-
/** Advance through time step-by-step, for development and debugging */
|
|
995
|
-
timeStepping?: boolean;
|
|
996
|
-
/** Show
|
|
997
|
-
|
|
998
|
-
/** Should
|
|
999
|
-
|
|
1000
|
-
/**
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
}
|
|
1007
|
-
|
|
1008
|
-
interface
|
|
1009
|
-
|
|
1010
|
-
}
|
|
1011
|
-
interface TextLocalizationResult {
|
|
1012
|
-
text: string;
|
|
1013
|
-
fontName?: string;
|
|
1014
|
-
fontNames?: string[];
|
|
1015
|
-
isFallbackOrMissingTranslation: boolean;
|
|
1016
|
-
}
|
|
1017
|
-
declare class I18n {
|
|
1018
|
-
private _translation;
|
|
1019
|
-
locale: string;
|
|
1020
|
-
fallbackLocale: string;
|
|
1021
|
-
baseLocale: string;
|
|
1022
|
-
missingLocalizationColor: RgbaColor | undefined;
|
|
1023
|
-
game: Game;
|
|
1024
|
-
/**
|
|
1025
|
-
* The I18n class localizes text and images.
|
|
1026
|
-
*
|
|
1027
|
-
* @param game - game instance
|
|
1028
|
-
* @param options - {@link LocalizationOptions}
|
|
1029
|
-
*/
|
|
1030
|
-
constructor(game: Game, options: LocalizationOptions);
|
|
1031
|
-
/**
|
|
1032
|
-
* Initializes the I18n instance and sets the initial locale.
|
|
1033
|
-
*
|
|
1034
|
-
* @remarks If the game instance has been configured to use a data store,
|
|
1035
|
-
* the previously used locale and fallback locale will be retrieved from the
|
|
1036
|
-
* data store if they have been previously set.
|
|
1037
|
-
*/
|
|
1038
|
-
initialize(): Promise<void>;
|
|
1039
|
-
private configureInitialLocale;
|
|
1040
|
-
private localeTranslationAvailable;
|
|
1041
|
-
switchToLocale(locale: string): void;
|
|
1042
|
-
/**
|
|
1043
|
-
*
|
|
1044
|
-
* @param key - Translation key
|
|
1045
|
-
* @param interpolation - Interpolation keys and values to replace
|
|
1046
|
-
* placeholders in the translated text
|
|
1047
|
-
* @returns a `TextLocalizationResult` object with the localized text, font
|
|
1048
|
-
* information, and whether the translation is a fallback.
|
|
1049
|
-
*/
|
|
1050
|
-
getTextLocalization(key: string, interpolation?: StringInterpolationMap): TextLocalizationResult;
|
|
1051
|
-
/**
|
|
1052
|
-
* Returns the translation text for the given key in the current locale.
|
|
1053
|
-
*
|
|
1054
|
-
* @remarks Optional interpolation keys and values can be provided to replace
|
|
1055
|
-
* placeholders in the translated text. Placeholders are denoted by double
|
|
1056
|
-
* curly braces.
|
|
1057
|
-
*
|
|
1058
|
-
* @param key - key to look up in the translation
|
|
1059
|
-
* @param options - `TranslationOptions`, such as interpolation keys/values
|
|
1060
|
-
* and whether to translate using the fallback locale
|
|
1061
|
-
* @returns the translation text for the key in the current locale, or
|
|
1062
|
-
* undefined if the key is not found
|
|
1063
|
-
*
|
|
1064
|
-
* @example
|
|
1065
|
-
*
|
|
1066
|
-
* ```
|
|
1067
|
-
* const translation: Translation = {
|
|
1068
|
-
* "en-US": {
|
|
1069
|
-
* "GREETING": "Hello, {{name}}."
|
|
1070
|
-
* }
|
|
1071
|
-
* }
|
|
1072
|
-
* ...
|
|
1073
|
-
* i18n.t("GREETING", { name: "World" }); // returns "Hello, World."
|
|
1074
|
-
*
|
|
1075
|
-
* ```
|
|
1076
|
-
*/
|
|
1077
|
-
t(key: string, options?: TranslationOptions): string | undefined;
|
|
1078
|
-
/**
|
|
1079
|
-
* Returns the translation text and font information for the given key in the
|
|
1080
|
-
* current locale.
|
|
1081
|
-
*
|
|
1082
|
-
* @remarks Optional interpolation keys and values can be provided to replace
|
|
1083
|
-
* placeholders in the translated text. Placeholders are denoted by double
|
|
1084
|
-
* curly braces. See method {@link I18n.t()} for interpolation example.
|
|
1085
|
-
*
|
|
1086
|
-
* @param key - key to look up in the translation
|
|
1087
|
-
* @param options - `TranslationOptions`, such as interpolation keys/values
|
|
1088
|
-
* and whether to translate using the fallback locale
|
|
1089
|
-
* @returns the translation text and font information for the key in the
|
|
1090
|
-
* current locale, or undefined if the key is not found
|
|
1091
|
-
*/
|
|
1092
|
-
tf(key: string, options?: TranslationOptions): TextAndFont | undefined;
|
|
1093
|
-
private getKeyText;
|
|
1094
|
-
private getKeyTextAndFont;
|
|
1095
|
-
private insertInterpolations;
|
|
1096
|
-
get translation(): Translation;
|
|
1097
|
-
set translation(value: Translation);
|
|
1098
|
-
private getEnvironmentLocale;
|
|
1099
|
-
private mergeAdditionalTranslation;
|
|
1100
|
-
static makeLocalizationParameters(): GameParameters;
|
|
1101
|
-
private isTextWithFontCustomization;
|
|
1102
|
-
private isStringOrTextWithFontCustomization;
|
|
1103
|
-
private isStringArray;
|
|
1104
|
-
private isString;
|
|
896
|
+
/** Id of the HTML canvas that game will be drawn on. If not provided, the first canvas found will be used */
|
|
897
|
+
canvasId?: string;
|
|
898
|
+
/** Width of game canvas */
|
|
899
|
+
width: number;
|
|
900
|
+
/** Height of game canvas */
|
|
901
|
+
height: number;
|
|
902
|
+
/** Stretch to fill screen? Default is false */
|
|
903
|
+
stretch?: boolean;
|
|
904
|
+
/** Schema of trial data; JSON object where key is variable name, value is data type */
|
|
905
|
+
trialSchema?: TrialSchema;
|
|
906
|
+
/** Default game parameters; JSON object where key is the game parameter, value is default value */
|
|
907
|
+
parameters?: GameParameters;
|
|
908
|
+
/** Font assets to use. The first element will be the default font */
|
|
909
|
+
fonts?: Array<FontAsset>;
|
|
910
|
+
/** Array of BrowserImage objects to render and load */
|
|
911
|
+
images?: Array<BrowserImage>;
|
|
912
|
+
/** Array of SoundAsset objects to fetch and decode */
|
|
913
|
+
sounds?: Array<SoundAsset>;
|
|
914
|
+
/** Show FPS in upper left corner? Default is false */
|
|
915
|
+
showFps?: boolean;
|
|
916
|
+
/** Color of the html body, if the game does not fill the screen. Useful for showing scene boundaries. Default is the scene background color */
|
|
917
|
+
bodyBackgroundColor?: RgbaColor;
|
|
918
|
+
/** Maximum number of activity metrics to log. */
|
|
919
|
+
maximumRecordedActivityMetrics?: number;
|
|
920
|
+
/** The FPS will be logged in game metrics if the FPS is lower than this value. Default is 59, as defined in Constants.FPS_METRIC_REPORT_THRESHOLD */
|
|
921
|
+
fpsMetricReportThreshold?: number;
|
|
922
|
+
/** Advance through time step-by-step, for development and debugging */
|
|
923
|
+
timeStepping?: boolean;
|
|
924
|
+
/** Show controls for replaying and viewing the event store? Default is false */
|
|
925
|
+
showEventStoreControls?: boolean;
|
|
926
|
+
/** Should the game events be saved to the event store? Default is false */
|
|
927
|
+
recordEvents?: boolean;
|
|
928
|
+
/** Show logs for WebGl activity? */
|
|
929
|
+
logWebGl?: boolean;
|
|
930
|
+
/** Should games within a session share wasm and font assets that have identical filenames, in order to reduce bandwidth? Default is true. */
|
|
931
|
+
shareAssets?: boolean;
|
|
932
|
+
/** Game's module name, version, and dependencies. @internal For m2c2kit library use only */
|
|
933
|
+
moduleMetadata?: ModuleMetadata;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
interface GameData extends ActivityKeyValueData {
|
|
937
|
+
trials: Array<TrialData>;
|
|
1105
938
|
}
|
|
1106
939
|
|
|
1107
940
|
/**
|
|
@@ -1555,6 +1388,99 @@ interface GameEvent extends M2Event<Activity> {
|
|
|
1555
1388
|
target: Game;
|
|
1556
1389
|
}
|
|
1557
1390
|
|
|
1391
|
+
type M2EventTarget = M2Node | Element | ImageManager | I18n;
|
|
1392
|
+
|
|
1393
|
+
/**
|
|
1394
|
+
* Event store mode.
|
|
1395
|
+
*/
|
|
1396
|
+
declare const EventStoreMode: {
|
|
1397
|
+
readonly Disabled: "Disabled";
|
|
1398
|
+
readonly Record: "Record";
|
|
1399
|
+
readonly Replay: "Replay";
|
|
1400
|
+
};
|
|
1401
|
+
type EventStoreMode = (typeof EventStoreMode)[keyof typeof EventStoreMode];
|
|
1402
|
+
declare class EventStore {
|
|
1403
|
+
private events;
|
|
1404
|
+
private replayBeginTimestamp;
|
|
1405
|
+
private firstTimestamp;
|
|
1406
|
+
replayThoughSequence: number;
|
|
1407
|
+
serializedEventsBeforeReplay: string;
|
|
1408
|
+
mode: EventStoreMode;
|
|
1409
|
+
private serializeEvent;
|
|
1410
|
+
addEvent(event: M2Event<M2EventTarget>): void;
|
|
1411
|
+
addEvents(events: Array<M2Event<M2EventTarget>>): void;
|
|
1412
|
+
clearEvents(): void;
|
|
1413
|
+
record(): void;
|
|
1414
|
+
replay(events?: M2Event<M2EventTarget>[]): void;
|
|
1415
|
+
getEvents(): M2Event<M2EventTarget>[];
|
|
1416
|
+
dequeueEvents(timestamp: number): M2Event<M2EventTarget>[];
|
|
1417
|
+
get eventQueueLength(): number;
|
|
1418
|
+
/**
|
|
1419
|
+
* Sorts the events in the event store.
|
|
1420
|
+
*
|
|
1421
|
+
* @remarks The events are sorted by sequence number in ascending order.
|
|
1422
|
+
*/
|
|
1423
|
+
private sortEventStore;
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
declare class M2NodeFactory {
|
|
1427
|
+
/**
|
|
1428
|
+
* The `M2NodeFactory` creates nodes of the specified type with the specified
|
|
1429
|
+
* options for event replay.
|
|
1430
|
+
*/
|
|
1431
|
+
constructor();
|
|
1432
|
+
/**
|
|
1433
|
+
* Creates a new node of the specified type with the specified options.
|
|
1434
|
+
*
|
|
1435
|
+
* @param type - The type of node to create
|
|
1436
|
+
* @param compositeType - The composite type of the node to create
|
|
1437
|
+
* @param options - The options to use when creating the node
|
|
1438
|
+
* @returns created node
|
|
1439
|
+
*/
|
|
1440
|
+
createNode(type: string, compositeType: string | undefined, options: M2NodeOptions): M2Node;
|
|
1441
|
+
private hasClassRegistration;
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
interface EventMaterializerOptions {
|
|
1445
|
+
game: Game;
|
|
1446
|
+
nodeFactory: M2NodeFactory;
|
|
1447
|
+
freeNodesScene: Scene;
|
|
1448
|
+
configureI18n(localizationOptions: LocalizationOptions): Promise<void>;
|
|
1449
|
+
}
|
|
1450
|
+
declare class EventMaterializer {
|
|
1451
|
+
private game;
|
|
1452
|
+
private nodeFactory;
|
|
1453
|
+
private freeNodesScene;
|
|
1454
|
+
private eventMaterializers;
|
|
1455
|
+
private configureI18n;
|
|
1456
|
+
/**
|
|
1457
|
+
* The `EventMaterializer` class is responsible for taking serialized events
|
|
1458
|
+
* from an event store and replaying them in the game.
|
|
1459
|
+
*/
|
|
1460
|
+
constructor(options: EventMaterializerOptions);
|
|
1461
|
+
/**
|
|
1462
|
+
* Deserialize the events by materializing them into the game.
|
|
1463
|
+
*
|
|
1464
|
+
* @remarks This method is called when the game is replaying events from the
|
|
1465
|
+
* event store. Materializing an event means to take the event and apply its
|
|
1466
|
+
* changes to the game. For example, a `NodeNew` event will create a new node
|
|
1467
|
+
* in the game. A `NodePropertyChange` event will change a property of a node
|
|
1468
|
+
* in the game.
|
|
1469
|
+
*
|
|
1470
|
+
* @param events - The events to materialize
|
|
1471
|
+
*/
|
|
1472
|
+
materialize(events: ReadonlyArray<M2Event<M2EventTarget>>): void;
|
|
1473
|
+
private materializeCompositeEvent;
|
|
1474
|
+
private materializeNodeNewEvent;
|
|
1475
|
+
private materializeNodePropertyChangeEvent;
|
|
1476
|
+
private materializeNodeAddChildEvent;
|
|
1477
|
+
private materializeNodeRemoveChildEvent;
|
|
1478
|
+
private materializeDomPointerDownEvent;
|
|
1479
|
+
private materializeBrowserImageDataReadyEvent;
|
|
1480
|
+
private materializeI18nDataReadyEvent;
|
|
1481
|
+
private materializeScenePresentEvent;
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1558
1484
|
interface TrialData {
|
|
1559
1485
|
[key: string]: string | number | boolean | object | undefined | null;
|
|
1560
1486
|
}
|
|
@@ -1592,12 +1518,18 @@ declare class Game implements Activity {
|
|
|
1592
1518
|
private _imageManager?;
|
|
1593
1519
|
private _soundManager?;
|
|
1594
1520
|
manifest?: Manifest;
|
|
1521
|
+
eventStore: EventStore;
|
|
1522
|
+
private nodeFactory;
|
|
1523
|
+
private _eventMaterializer?;
|
|
1524
|
+
/** Nodes created during event replay */
|
|
1525
|
+
materializedNodes: M2Node[];
|
|
1595
1526
|
/**
|
|
1596
1527
|
* The base class for all games. New games should extend this class.
|
|
1597
1528
|
*
|
|
1598
1529
|
* @param options - {@link GameOptions}
|
|
1599
1530
|
*/
|
|
1600
1531
|
constructor(options: GameOptions);
|
|
1532
|
+
private createFreeNodesScene;
|
|
1601
1533
|
private getImportedModuleBaseUrl;
|
|
1602
1534
|
private addLocalizationParametersToGameParameters;
|
|
1603
1535
|
init(): Promise<void>;
|
|
@@ -1623,6 +1555,8 @@ declare class Game implements Activity {
|
|
|
1623
1555
|
* @returns base URLs for game assets and CanvasKit wasm binary
|
|
1624
1556
|
*/
|
|
1625
1557
|
resolveGameBaseUrls(game: Game): Promise<GameBaseUrls>;
|
|
1558
|
+
private configureI18n;
|
|
1559
|
+
private waitForErudaInitialization;
|
|
1626
1560
|
initialize(): Promise<void>;
|
|
1627
1561
|
/**
|
|
1628
1562
|
* Returns the manifest, if manifest.json was created during the build.
|
|
@@ -1643,6 +1577,8 @@ declare class Game implements Activity {
|
|
|
1643
1577
|
set imageManager(imageManager: ImageManager);
|
|
1644
1578
|
get soundManager(): SoundManager;
|
|
1645
1579
|
set soundManager(soundManager: SoundManager);
|
|
1580
|
+
get eventMaterializer(): EventMaterializer;
|
|
1581
|
+
set eventMaterializer(eventMaterializer: EventMaterializer);
|
|
1646
1582
|
/**
|
|
1647
1583
|
* Adds prefixes to a key to ensure that keys are unique across activities
|
|
1648
1584
|
* and studies.
|
|
@@ -1775,7 +1711,7 @@ declare class Game implements Activity {
|
|
|
1775
1711
|
surface?: Surface;
|
|
1776
1712
|
private showFps?;
|
|
1777
1713
|
private bodyBackgroundColor?;
|
|
1778
|
-
|
|
1714
|
+
currentScene?: Scene;
|
|
1779
1715
|
private priorUpdateTime?;
|
|
1780
1716
|
private fpsTextFont?;
|
|
1781
1717
|
private fpsTextPaint?;
|
|
@@ -1790,7 +1726,7 @@ declare class Game implements Activity {
|
|
|
1790
1726
|
canvasCssWidth: number;
|
|
1791
1727
|
canvasCssHeight: number;
|
|
1792
1728
|
scenes: Scene[];
|
|
1793
|
-
|
|
1729
|
+
freeNodesScene: Scene;
|
|
1794
1730
|
private incomingSceneTransitions;
|
|
1795
1731
|
private currentSceneSnapshot?;
|
|
1796
1732
|
private pendingScreenshot?;
|
|
@@ -1852,6 +1788,19 @@ declare class Game implements Activity {
|
|
|
1852
1788
|
* @param scene
|
|
1853
1789
|
*/
|
|
1854
1790
|
addScene(scene: Scene): void;
|
|
1791
|
+
/**
|
|
1792
|
+
* Adds events from a node and its children to the game's event store.
|
|
1793
|
+
*
|
|
1794
|
+
* @remarks This method is first called when a scene is added to the game.
|
|
1795
|
+
* If the scene or any of its descendants was constructed or had its
|
|
1796
|
+
* properties changed before it was added to the game, these events were
|
|
1797
|
+
* stored within the node (because the game event store was not yet
|
|
1798
|
+
* available). This method retrieves these events from the node and adds
|
|
1799
|
+
* them to the game's event store.
|
|
1800
|
+
*
|
|
1801
|
+
* @param node - node that contains events to add
|
|
1802
|
+
*/
|
|
1803
|
+
private addNodeEvents;
|
|
1855
1804
|
/**
|
|
1856
1805
|
* Adds multiple scenes to the game.
|
|
1857
1806
|
*
|
|
@@ -1867,10 +1816,10 @@ declare class Game implements Activity {
|
|
|
1867
1816
|
/**
|
|
1868
1817
|
* Specifies the scene that will be presented upon the next frame draw.
|
|
1869
1818
|
*
|
|
1870
|
-
* @param scene
|
|
1819
|
+
* @param scene - the scene, its string name, or UUID
|
|
1871
1820
|
* @param transition
|
|
1872
1821
|
*/
|
|
1873
|
-
presentScene(scene: string | Scene, transition?:
|
|
1822
|
+
presentScene(scene: string | Scene, transition?: Transition): void;
|
|
1874
1823
|
/**
|
|
1875
1824
|
* Gets the value of the game parameter. If parameterName
|
|
1876
1825
|
* is not found, then throw exception.
|
|
@@ -1909,6 +1858,11 @@ declare class Game implements Activity {
|
|
|
1909
1858
|
* @param entryScene - The scene (Scene object or its string name) to display when the game starts
|
|
1910
1859
|
*/
|
|
1911
1860
|
start(entryScene?: Scene | string): Promise<void>;
|
|
1861
|
+
playEventsHandler(mouseEvent: MouseEvent): void;
|
|
1862
|
+
private replayEventsButtonEnabled;
|
|
1863
|
+
private setReplayEventsButtonEnabled;
|
|
1864
|
+
private setStopReplayButtonEnabled;
|
|
1865
|
+
private addEventControlsToDom;
|
|
1912
1866
|
private addTimeSteppingControlsToDom;
|
|
1913
1867
|
private updateTimeSteppingOutput;
|
|
1914
1868
|
private advanceStepsHandler;
|
|
@@ -2234,6 +2188,326 @@ declare class Game implements Activity {
|
|
|
2234
2188
|
private IsCanvasPointWithinNodeBounds;
|
|
2235
2189
|
}
|
|
2236
2190
|
|
|
2191
|
+
/**
|
|
2192
|
+
* Map of placeholders to values for use in string interpolation.
|
|
2193
|
+
*/
|
|
2194
|
+
interface StringInterpolationMap {
|
|
2195
|
+
[placeholder: string]: string;
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
interface TranslationOptions {
|
|
2199
|
+
[key: string]: unknown;
|
|
2200
|
+
}
|
|
2201
|
+
interface TextLocalizationResult {
|
|
2202
|
+
text: string;
|
|
2203
|
+
fontName?: string;
|
|
2204
|
+
fontNames?: string[];
|
|
2205
|
+
isFallbackOrMissingTranslation: boolean;
|
|
2206
|
+
}
|
|
2207
|
+
declare class I18n {
|
|
2208
|
+
private _translation;
|
|
2209
|
+
locale: string;
|
|
2210
|
+
fallbackLocale: string;
|
|
2211
|
+
baseLocale: string;
|
|
2212
|
+
missingLocalizationColor: RgbaColor | undefined;
|
|
2213
|
+
game: Game;
|
|
2214
|
+
/**
|
|
2215
|
+
* The I18n class localizes text and images.
|
|
2216
|
+
*
|
|
2217
|
+
* @param game - game instance
|
|
2218
|
+
* @param options - {@link LocalizationOptions}
|
|
2219
|
+
*/
|
|
2220
|
+
constructor(game: Game, options: LocalizationOptions);
|
|
2221
|
+
/**
|
|
2222
|
+
* Initializes the I18n instance and sets the initial locale.
|
|
2223
|
+
*
|
|
2224
|
+
* @remarks If the game instance has been configured to use a data store,
|
|
2225
|
+
* the previously used locale and fallback locale will be retrieved from the
|
|
2226
|
+
* data store if they have been previously set.
|
|
2227
|
+
*/
|
|
2228
|
+
initialize(): Promise<void>;
|
|
2229
|
+
private configureInitialLocale;
|
|
2230
|
+
private localeTranslationAvailable;
|
|
2231
|
+
switchToLocale(locale: string): void;
|
|
2232
|
+
/**
|
|
2233
|
+
*
|
|
2234
|
+
* @param key - Translation key
|
|
2235
|
+
* @param interpolation - Interpolation keys and values to replace
|
|
2236
|
+
* placeholders in the translated text
|
|
2237
|
+
* @returns a `TextLocalizationResult` object with the localized text, font
|
|
2238
|
+
* information, and whether the translation is a fallback.
|
|
2239
|
+
*/
|
|
2240
|
+
getTextLocalization(key: string, interpolation?: StringInterpolationMap): TextLocalizationResult;
|
|
2241
|
+
/**
|
|
2242
|
+
* Returns the translation text for the given key in the current locale.
|
|
2243
|
+
*
|
|
2244
|
+
* @remarks Optional interpolation keys and values can be provided to replace
|
|
2245
|
+
* placeholders in the translated text. Placeholders are denoted by double
|
|
2246
|
+
* curly braces.
|
|
2247
|
+
*
|
|
2248
|
+
* @param key - key to look up in the translation
|
|
2249
|
+
* @param options - `TranslationOptions`, such as interpolation keys/values
|
|
2250
|
+
* and whether to translate using the fallback locale
|
|
2251
|
+
* @returns the translation text for the key in the current locale, or
|
|
2252
|
+
* undefined if the key is not found
|
|
2253
|
+
*
|
|
2254
|
+
* @example
|
|
2255
|
+
*
|
|
2256
|
+
* ```
|
|
2257
|
+
* const translation: Translation = {
|
|
2258
|
+
* "en-US": {
|
|
2259
|
+
* "GREETING": "Hello, {{name}}."
|
|
2260
|
+
* }
|
|
2261
|
+
* }
|
|
2262
|
+
* ...
|
|
2263
|
+
* i18n.t("GREETING", { name: "World" }); // returns "Hello, World."
|
|
2264
|
+
*
|
|
2265
|
+
* ```
|
|
2266
|
+
*/
|
|
2267
|
+
t(key: string, options?: TranslationOptions): string | undefined;
|
|
2268
|
+
/**
|
|
2269
|
+
* Returns the translation text and font information for the given key in the
|
|
2270
|
+
* current locale.
|
|
2271
|
+
*
|
|
2272
|
+
* @remarks Optional interpolation keys and values can be provided to replace
|
|
2273
|
+
* placeholders in the translated text. Placeholders are denoted by double
|
|
2274
|
+
* curly braces. See method {@link I18n.t()} for interpolation example.
|
|
2275
|
+
*
|
|
2276
|
+
* @param key - key to look up in the translation
|
|
2277
|
+
* @param options - `TranslationOptions`, such as interpolation keys/values
|
|
2278
|
+
* and whether to translate using the fallback locale
|
|
2279
|
+
* @returns the translation text and font information for the key in the
|
|
2280
|
+
* current locale, or undefined if the key is not found
|
|
2281
|
+
*/
|
|
2282
|
+
tf(key: string, options?: TranslationOptions): TextAndFont | undefined;
|
|
2283
|
+
private getKeyText;
|
|
2284
|
+
private getKeyTextAndFont;
|
|
2285
|
+
private insertInterpolations;
|
|
2286
|
+
get translation(): Translation;
|
|
2287
|
+
set translation(value: Translation);
|
|
2288
|
+
private getEnvironmentLocale;
|
|
2289
|
+
private mergeAdditionalTranslation;
|
|
2290
|
+
static makeLocalizationParameters(): GameParameters;
|
|
2291
|
+
private isTextWithFontCustomization;
|
|
2292
|
+
private isStringOrTextWithFontCustomization;
|
|
2293
|
+
private isStringArray;
|
|
2294
|
+
private isString;
|
|
2295
|
+
}
|
|
2296
|
+
|
|
2297
|
+
/**
|
|
2298
|
+
* Base interface for all m2c2kit events.
|
|
2299
|
+
*
|
|
2300
|
+
* @remarks I would have named it Event, but that would collide with
|
|
2301
|
+
* the existing DOM Event
|
|
2302
|
+
*/
|
|
2303
|
+
interface M2Event<T> {
|
|
2304
|
+
/** Type of event. */
|
|
2305
|
+
type: M2EventType | string;
|
|
2306
|
+
/** The object on which the event occurred. If the event has gone through serialization, the string will be the object's UUID (if an `M2Node`) or class name. */
|
|
2307
|
+
target: T | string;
|
|
2308
|
+
/** Has the event been taken care of by the listener and not be dispatched to other targets? */
|
|
2309
|
+
handled?: boolean;
|
|
2310
|
+
/** Timestamp of the event, `from performance.now()` */
|
|
2311
|
+
timestamp: number;
|
|
2312
|
+
/** Timestamp of th event, from `new Date().toISOString()` */
|
|
2313
|
+
iso8601Timestamp: string;
|
|
2314
|
+
/** Sequence number of event.
|
|
2315
|
+
* @remarks Sequence number is guaranteed to reflect order of events, but
|
|
2316
|
+
* not necessarily contiguous, e.g., could be 1, 2, 5, 10, 11, 24.
|
|
2317
|
+
* */
|
|
2318
|
+
sequence?: number;
|
|
2319
|
+
}
|
|
2320
|
+
interface DomPointerDownEvent extends M2Event<Element> {
|
|
2321
|
+
type: "DomPointerDown";
|
|
2322
|
+
target: Element;
|
|
2323
|
+
x: number;
|
|
2324
|
+
y: number;
|
|
2325
|
+
}
|
|
2326
|
+
interface CompositeEvent extends M2NodeEvent {
|
|
2327
|
+
/** The Composite on which the event occurred. If the event has gone through serialization, the string will be the composite's UUID. */
|
|
2328
|
+
target: Composite | string;
|
|
2329
|
+
type: "Composite";
|
|
2330
|
+
/** The type of the composite node. */
|
|
2331
|
+
compositeType: string;
|
|
2332
|
+
/** The type of the composite event. */
|
|
2333
|
+
compositeEventType: string;
|
|
2334
|
+
/** The composite event properties */
|
|
2335
|
+
[key: string]: number | string | boolean | object | null | undefined;
|
|
2336
|
+
}
|
|
2337
|
+
interface M2NodeNewEvent extends M2Event<M2Node> {
|
|
2338
|
+
type: "NodeNew";
|
|
2339
|
+
target: M2Node;
|
|
2340
|
+
/** The type of the new node. */
|
|
2341
|
+
nodeType: M2NodeType | string;
|
|
2342
|
+
/** If a composite node, the type of the composite. */
|
|
2343
|
+
compositeType?: string;
|
|
2344
|
+
/** The options of the at the time of instantiation. This includes options for any base types and interfaces. */
|
|
2345
|
+
nodeOptions: M2NodeOptions;
|
|
2346
|
+
}
|
|
2347
|
+
interface M2NodeAddChildEvent extends M2Event<M2Node> {
|
|
2348
|
+
type: "NodeAddChild";
|
|
2349
|
+
target: M2Node;
|
|
2350
|
+
/** The node's unique identifier (UUID). */
|
|
2351
|
+
uuid: string;
|
|
2352
|
+
/** The child node's unique identifier (UUID). */
|
|
2353
|
+
childUuid: string;
|
|
2354
|
+
}
|
|
2355
|
+
interface M2NodeRemoveChildEvent extends M2Event<M2Node> {
|
|
2356
|
+
type: "NodeRemoveChild";
|
|
2357
|
+
target: M2Node;
|
|
2358
|
+
/** The node's unique identifier (UUID). */
|
|
2359
|
+
uuid: string;
|
|
2360
|
+
/** The child node's unique identifier (UUID). */
|
|
2361
|
+
childUuid: string;
|
|
2362
|
+
}
|
|
2363
|
+
interface ScenePresentEvent extends M2Event<M2Node> {
|
|
2364
|
+
type: "ScenePresent";
|
|
2365
|
+
target: Scene;
|
|
2366
|
+
/** The node's unique identifier (UUID). */
|
|
2367
|
+
uuid: string;
|
|
2368
|
+
/** Transition type of the presented scene. */
|
|
2369
|
+
transitionType: TransitionType;
|
|
2370
|
+
direction?: TransitionDirection;
|
|
2371
|
+
duration?: number;
|
|
2372
|
+
easingType?: string;
|
|
2373
|
+
}
|
|
2374
|
+
interface M2NodePropertyChangeEvent extends M2Event<M2Node> {
|
|
2375
|
+
type: "NodePropertyChange";
|
|
2376
|
+
target: M2Node;
|
|
2377
|
+
/** The node's unique identifier (UUID). */
|
|
2378
|
+
uuid: string;
|
|
2379
|
+
/** The property that changed. */
|
|
2380
|
+
property: string;
|
|
2381
|
+
/** The new value of the property. */
|
|
2382
|
+
value: string | number | boolean | object | null | undefined;
|
|
2383
|
+
}
|
|
2384
|
+
interface BrowserImageDataReadyEvent extends M2Event<ImageManager> {
|
|
2385
|
+
type: "BrowserImageDataReady";
|
|
2386
|
+
target: ImageManager;
|
|
2387
|
+
/** The image name. */
|
|
2388
|
+
imageName: string;
|
|
2389
|
+
/** Width to scale image to */
|
|
2390
|
+
width: number;
|
|
2391
|
+
/** Height to scale image to */
|
|
2392
|
+
height: number;
|
|
2393
|
+
/** The image data URL. */
|
|
2394
|
+
dataUrl?: string;
|
|
2395
|
+
/** SVG string */
|
|
2396
|
+
svgString?: string;
|
|
2397
|
+
}
|
|
2398
|
+
interface I18nDataReadyEvent extends M2Event<I18n> {
|
|
2399
|
+
type: "I18nDataReadyEvent";
|
|
2400
|
+
target: I18n;
|
|
2401
|
+
localizationOptions: LocalizationOptions;
|
|
2402
|
+
}
|
|
2403
|
+
/**
|
|
2404
|
+
* The different events that are dispatched by m2c2kit core.
|
|
2405
|
+
*/
|
|
2406
|
+
declare const M2EventType: {
|
|
2407
|
+
readonly ActivityStart: "ActivityStart";
|
|
2408
|
+
readonly ActivityEnd: "ActivityEnd";
|
|
2409
|
+
readonly ActivityCancel: "ActivityCancel";
|
|
2410
|
+
readonly ActivityData: "ActivityData";
|
|
2411
|
+
readonly GameWarmupStart: "GameWarmupStart";
|
|
2412
|
+
readonly GameWarmupEnd: "GameWarmupEnd";
|
|
2413
|
+
readonly TapDown: "TapDown";
|
|
2414
|
+
readonly TapUp: "TapUp";
|
|
2415
|
+
readonly TapUpAny: "TapUpAny";
|
|
2416
|
+
readonly TapLeave: "TapLeave";
|
|
2417
|
+
readonly PointerDown: "PointerDown";
|
|
2418
|
+
readonly PointerUp: "PointerUp";
|
|
2419
|
+
readonly PointerMove: "PointerMove";
|
|
2420
|
+
readonly PointerLeave: "PointerLeave";
|
|
2421
|
+
readonly Drag: "Drag";
|
|
2422
|
+
readonly DragStart: "DragStart";
|
|
2423
|
+
readonly DragEnd: "DragEnd";
|
|
2424
|
+
readonly Composite: "Composite";
|
|
2425
|
+
readonly FrameDidSimulatePhysics: "FrameDidSimulatePhysics";
|
|
2426
|
+
readonly SceneSetup: "SceneSetup";
|
|
2427
|
+
readonly SceneAppear: "SceneAppear";
|
|
2428
|
+
readonly ScenePresent: "ScenePresent";
|
|
2429
|
+
readonly NodeNew: "NodeNew";
|
|
2430
|
+
readonly NodeAddChild: "NodeAddChild";
|
|
2431
|
+
readonly NodeRemoveChild: "NodeRemoveChild";
|
|
2432
|
+
readonly NodePropertyChange: "NodePropertyChange";
|
|
2433
|
+
readonly DomPointerDown: "DomPointerDown";
|
|
2434
|
+
readonly BrowserImageDataReady: "BrowserImageDataReady";
|
|
2435
|
+
readonly I18nDataReadyEvent: "I18nDataReadyEvent";
|
|
2436
|
+
};
|
|
2437
|
+
type M2EventType = (typeof M2EventType)[keyof typeof M2EventType];
|
|
2438
|
+
|
|
2439
|
+
/**
|
|
2440
|
+
* Base interface for all m2c2kit event listeners.
|
|
2441
|
+
*/
|
|
2442
|
+
interface M2EventListener<T> {
|
|
2443
|
+
/** Type of event to listen for. */
|
|
2444
|
+
type: M2EventType | string;
|
|
2445
|
+
/** Callback function to be called when the event is dispatched. */
|
|
2446
|
+
callback: (event: T) => void;
|
|
2447
|
+
/** Optional key (string identifier) used to identify the event listener. */
|
|
2448
|
+
key?: string;
|
|
2449
|
+
}
|
|
2450
|
+
|
|
2451
|
+
interface M2NodeEventListener<M2NodeEvent> extends M2EventListener<M2NodeEvent> {
|
|
2452
|
+
/** For composites that raise events, type of the composite node. */
|
|
2453
|
+
compositeType?: string;
|
|
2454
|
+
/** For composites that raise events, type of the composite event. */
|
|
2455
|
+
compositeEventType?: string;
|
|
2456
|
+
/** UUID of the node that the event listener is listening for. */
|
|
2457
|
+
nodeUuid: string;
|
|
2458
|
+
}
|
|
2459
|
+
|
|
2460
|
+
/**
|
|
2461
|
+
* Describes an interaction between the pointer (mouse, touches) and a node.
|
|
2462
|
+
*
|
|
2463
|
+
* @remarks I would have named it PointerEvent, but that would collide with
|
|
2464
|
+
* the existing DOM PointerEvent.
|
|
2465
|
+
*/
|
|
2466
|
+
interface M2PointerEvent extends M2NodeEvent {
|
|
2467
|
+
/** Point that was tapped on node, relative to the node coordinate system */
|
|
2468
|
+
point: Point;
|
|
2469
|
+
/** Buttons being pressed when event was fired. Taken from DOM MouseEvent.buttons */
|
|
2470
|
+
buttons: number;
|
|
2471
|
+
}
|
|
2472
|
+
|
|
2473
|
+
/**
|
|
2474
|
+
* Describes an interaction of a pointer (mouse, touches) pressing a node.
|
|
2475
|
+
*
|
|
2476
|
+
* @remarks Unlike M2PointerEvent, TapEvent considers how the pointer, while
|
|
2477
|
+
* in the down state, moves in relation to the bounds of the node.
|
|
2478
|
+
*/
|
|
2479
|
+
interface TapEvent extends M2NodeEvent {
|
|
2480
|
+
/** Point that was tapped on node, relative to the node coordinate system */
|
|
2481
|
+
point: Point;
|
|
2482
|
+
/** Buttons being pressed when event was fired. Taken from DOM MouseEvent.buttons */
|
|
2483
|
+
buttons: number;
|
|
2484
|
+
}
|
|
2485
|
+
|
|
2486
|
+
interface TextOptions {
|
|
2487
|
+
/** Text to be displayed */
|
|
2488
|
+
text?: string;
|
|
2489
|
+
/** Name of font to use for text. Must have been previously loaded */
|
|
2490
|
+
fontName?: string;
|
|
2491
|
+
/** Color of text. Default is Constants.DEFAULT_FONT_COLOR (WebColors.Black) */
|
|
2492
|
+
fontColor?: RgbaColor;
|
|
2493
|
+
/** Size of text. Default is Constants.DEFAULT_FONT_SIZE (16) */
|
|
2494
|
+
fontSize?: number;
|
|
2495
|
+
/** Map of placeholders to values for use in string interpolation during localization. */
|
|
2496
|
+
interpolation?: StringInterpolationMap;
|
|
2497
|
+
/** If true, try to use a localized version of the text. Default is true. */
|
|
2498
|
+
localize?: boolean;
|
|
2499
|
+
}
|
|
2500
|
+
|
|
2501
|
+
/**
|
|
2502
|
+
* Width and height on two-dimensional space
|
|
2503
|
+
*/
|
|
2504
|
+
interface Size {
|
|
2505
|
+
/** Horizontal width, x-axis */
|
|
2506
|
+
width: number;
|
|
2507
|
+
/** Vertical height, y-axis */
|
|
2508
|
+
height: number;
|
|
2509
|
+
}
|
|
2510
|
+
|
|
2237
2511
|
/**
|
|
2238
2512
|
* Describes a drag and drop operation.
|
|
2239
2513
|
*
|
|
@@ -2253,20 +2527,25 @@ declare abstract class M2Node implements M2NodeOptions {
|
|
|
2253
2527
|
isDrawable: boolean;
|
|
2254
2528
|
isShape: boolean;
|
|
2255
2529
|
isText: boolean;
|
|
2530
|
+
private _suppressEvents;
|
|
2531
|
+
options: M2NodeOptions;
|
|
2532
|
+
constructionTimeStamp: number;
|
|
2533
|
+
constructionIso8601TimeStamp: string;
|
|
2534
|
+
constructionSequence: number;
|
|
2256
2535
|
name: string;
|
|
2257
2536
|
_position: Point;
|
|
2258
2537
|
_scale: number;
|
|
2259
|
-
|
|
2538
|
+
_alpha: number;
|
|
2260
2539
|
_zRotation: number;
|
|
2261
2540
|
protected _isUserInteractionEnabled: boolean;
|
|
2262
|
-
|
|
2263
|
-
|
|
2541
|
+
protected _draggable: boolean;
|
|
2542
|
+
protected _hidden: boolean;
|
|
2264
2543
|
layout: Layout;
|
|
2265
2544
|
_game?: Game;
|
|
2266
2545
|
parent?: M2Node;
|
|
2267
2546
|
children: M2Node[];
|
|
2268
2547
|
absolutePosition: Point;
|
|
2269
|
-
|
|
2548
|
+
protected _size: Size;
|
|
2270
2549
|
absoluteScale: number;
|
|
2271
2550
|
absoluteAlpha: number;
|
|
2272
2551
|
absoluteAlphaChange: number;
|
|
@@ -2277,6 +2556,7 @@ declare abstract class M2Node implements M2NodeOptions {
|
|
|
2277
2556
|
needsInitialization: boolean;
|
|
2278
2557
|
userData: any;
|
|
2279
2558
|
loopMessages: Set<string>;
|
|
2559
|
+
nodeEvents: M2Event<M2Node>[];
|
|
2280
2560
|
/** Is the node in a pressed state? E.g., did the user put the pointer
|
|
2281
2561
|
* down on the node and not yet release it? */
|
|
2282
2562
|
pressed: boolean;
|
|
@@ -2297,6 +2577,28 @@ declare abstract class M2Node implements M2NodeOptions {
|
|
|
2297
2577
|
dragging: boolean;
|
|
2298
2578
|
constructor(options?: M2NodeOptions);
|
|
2299
2579
|
initialize(): void;
|
|
2580
|
+
protected get completeNodeOptions(): M2NodeOptions;
|
|
2581
|
+
/**
|
|
2582
|
+
* Save the node's construction event in the event store.
|
|
2583
|
+
*/
|
|
2584
|
+
protected saveNodeNewEvent(): void;
|
|
2585
|
+
/**
|
|
2586
|
+
* Saves the node's property change event in the event store.
|
|
2587
|
+
*
|
|
2588
|
+
* @param property - property name
|
|
2589
|
+
* @param value - property value
|
|
2590
|
+
*/
|
|
2591
|
+
protected savePropertyChangeEvent(property: string, value: string | number | boolean | object | null | undefined): void;
|
|
2592
|
+
/**
|
|
2593
|
+
* Saves the node's event.
|
|
2594
|
+
*
|
|
2595
|
+
* @remarks If the game event store is not available, the event is saved
|
|
2596
|
+
* within the node's `nodeEvents` event array. It will be added to the game
|
|
2597
|
+
* event store when the node is added to the game.
|
|
2598
|
+
*
|
|
2599
|
+
* @param event - event to save
|
|
2600
|
+
*/
|
|
2601
|
+
protected saveEvent(event: M2Event<M2Node>): void;
|
|
2300
2602
|
/**
|
|
2301
2603
|
* The game which this node is a part of.
|
|
2302
2604
|
*
|
|
@@ -2323,6 +2625,15 @@ declare abstract class M2Node implements M2NodeOptions {
|
|
|
2323
2625
|
* @param child - The child node to add
|
|
2324
2626
|
*/
|
|
2325
2627
|
addChild(child: M2Node): void;
|
|
2628
|
+
/**
|
|
2629
|
+
* Saves the child's events to the parent node.
|
|
2630
|
+
*
|
|
2631
|
+
* @remarks When a child is added to a parent, the parent receives all the
|
|
2632
|
+
* child's events and saves them.
|
|
2633
|
+
*
|
|
2634
|
+
* @param child - child node to save events to parent node
|
|
2635
|
+
*/
|
|
2636
|
+
private saveChildEvents;
|
|
2326
2637
|
/**
|
|
2327
2638
|
* Removes all children from the node.
|
|
2328
2639
|
*/
|
|
@@ -2554,14 +2865,24 @@ declare abstract class M2Node implements M2NodeOptions {
|
|
|
2554
2865
|
*/
|
|
2555
2866
|
get canvasKit(): CanvasKit;
|
|
2556
2867
|
get parentSceneAsNode(): M2Node;
|
|
2868
|
+
get size(): Size;
|
|
2869
|
+
set size(size: Size);
|
|
2557
2870
|
get position(): Point;
|
|
2558
2871
|
set position(position: Point);
|
|
2559
2872
|
get zRotation(): number;
|
|
2560
2873
|
set zRotation(zRotation: number);
|
|
2561
2874
|
get scale(): number;
|
|
2562
2875
|
set scale(scale: number);
|
|
2876
|
+
get alpha(): number;
|
|
2877
|
+
set alpha(alpha: number);
|
|
2563
2878
|
get isUserInteractionEnabled(): boolean;
|
|
2564
2879
|
set isUserInteractionEnabled(isUserInteractionEnabled: boolean);
|
|
2880
|
+
get hidden(): boolean;
|
|
2881
|
+
set hidden(hidden: boolean);
|
|
2882
|
+
get draggable(): boolean;
|
|
2883
|
+
set draggable(draggable: boolean);
|
|
2884
|
+
get suppressEvents(): boolean;
|
|
2885
|
+
set suppressEvents(value: boolean);
|
|
2565
2886
|
/**
|
|
2566
2887
|
* For a given directed acyclic graph, topological ordering of the vertices will be identified using BFS
|
|
2567
2888
|
* @param adjList Adjacency List that represent a graph with vertices and edges
|
|
@@ -3310,28 +3631,6 @@ declare class ColorfulMutablePath extends MutablePath {
|
|
|
3310
3631
|
duplicate(): ColorfulMutablePath;
|
|
3311
3632
|
}
|
|
3312
3633
|
|
|
3313
|
-
interface CompositeOptions extends M2NodeOptions, DrawableOptions {
|
|
3314
|
-
}
|
|
3315
|
-
|
|
3316
|
-
declare abstract class Composite extends M2Node implements IDrawable {
|
|
3317
|
-
readonly type = M2NodeType.Composite;
|
|
3318
|
-
compositeType: string;
|
|
3319
|
-
isDrawable: boolean;
|
|
3320
|
-
anchorPoint: Point;
|
|
3321
|
-
zPosition: number;
|
|
3322
|
-
/**
|
|
3323
|
-
* Base Drawable object for creating custom nodes ("composites") composed of primitive nodes.
|
|
3324
|
-
*
|
|
3325
|
-
* @param options
|
|
3326
|
-
*/
|
|
3327
|
-
constructor(options?: CompositeOptions);
|
|
3328
|
-
initialize(): void;
|
|
3329
|
-
dispose(): void;
|
|
3330
|
-
update(): void;
|
|
3331
|
-
draw(canvas: Canvas): void;
|
|
3332
|
-
abstract warmup(canvas: Canvas): void;
|
|
3333
|
-
}
|
|
3334
|
-
|
|
3335
3634
|
/**
|
|
3336
3635
|
* Reasonable defaults to use if values are not specified.
|
|
3337
3636
|
*/
|
|
@@ -3367,6 +3666,7 @@ declare class Constants {
|
|
|
3367
3666
|
/** Placeholder that will be populated during the build process. */
|
|
3368
3667
|
static readonly MODULE_METADATA_PLACEHOLDER: ModuleMetadata;
|
|
3369
3668
|
static readonly DEFAULT_ROOT_ELEMENT_ID = "m2c2kit";
|
|
3669
|
+
static readonly ERUDA_URL = "https://cdn.jsdelivr.net/npm/eruda@3.2.1/eruda.js";
|
|
3370
3670
|
}
|
|
3371
3671
|
|
|
3372
3672
|
/**
|
|
@@ -3390,10 +3690,79 @@ declare enum Dimensions {
|
|
|
3390
3690
|
MatchConstraint = 0
|
|
3391
3691
|
}
|
|
3392
3692
|
|
|
3693
|
+
type M2NodeConstructor = new (options?: M2NodeOptions) => M2Node;
|
|
3694
|
+
|
|
3393
3695
|
/**
|
|
3394
3696
|
* Utility class for comparing equality of m2c2kit objects.
|
|
3697
|
+
*
|
|
3698
|
+
* @deprecated Use the class `Equal` instead.
|
|
3395
3699
|
*/
|
|
3396
3700
|
declare class Equals {
|
|
3701
|
+
/**
|
|
3702
|
+
* Compares two RgbaColor objects and returns true if they are equal.
|
|
3703
|
+
*
|
|
3704
|
+
* @remarks If either of the colors is undefined, the comparison will
|
|
3705
|
+
* return false. RgbaColor is an array of 4 numbers, and thus is a
|
|
3706
|
+
* reference type. We need this method to compare two RgbaColor objects
|
|
3707
|
+
* for value equality.
|
|
3708
|
+
*
|
|
3709
|
+
* @deprecated Use the methods in `Equal` instead.
|
|
3710
|
+
*
|
|
3711
|
+
* @param color1
|
|
3712
|
+
* @param color2
|
|
3713
|
+
* @returns
|
|
3714
|
+
*/
|
|
3715
|
+
static rgbaColor(color1?: RgbaColor, color2?: RgbaColor): boolean;
|
|
3716
|
+
}
|
|
3717
|
+
|
|
3718
|
+
interface RectOptions {
|
|
3719
|
+
/** Position of rectangle */
|
|
3720
|
+
origin?: Point;
|
|
3721
|
+
/** Size of rectangle */
|
|
3722
|
+
size?: Size;
|
|
3723
|
+
/** X coordinate of rectangle position; this can be used instead of setting the origin property */
|
|
3724
|
+
x?: number;
|
|
3725
|
+
/** Y coordinate of rectangle position; this can be used instead of setting the origin property */
|
|
3726
|
+
y?: number;
|
|
3727
|
+
/** Width of rectangle; this can be used instead of setting the size property */
|
|
3728
|
+
width?: number;
|
|
3729
|
+
/** Height of rectangle; this can be used instead of setting the size property */
|
|
3730
|
+
height?: number;
|
|
3731
|
+
}
|
|
3732
|
+
|
|
3733
|
+
/**
|
|
3734
|
+
* A collection of multi-color lines to draw.
|
|
3735
|
+
*
|
|
3736
|
+
* @remarks Unlike `M2Path`, this interface allows for lines of different
|
|
3737
|
+
* colors and widths to be drawn in the same path.
|
|
3738
|
+
*/
|
|
3739
|
+
interface M2ColorfulPath extends M2Path {
|
|
3740
|
+
/** Colors and widths of lines in the path. */
|
|
3741
|
+
linePresentations: Array<LinePresentation>;
|
|
3742
|
+
}
|
|
3743
|
+
|
|
3744
|
+
/**
|
|
3745
|
+
* A path created from an SVG string path.
|
|
3746
|
+
*/
|
|
3747
|
+
interface SvgStringPath {
|
|
3748
|
+
/** SVG string from which to create the path */
|
|
3749
|
+
pathString?: string;
|
|
3750
|
+
/** SVG string from which to create the path @deprecated Use `pathString` */
|
|
3751
|
+
svgPathString?: string;
|
|
3752
|
+
/** If provided, scale the SVG path to this height, and scale the width to keep the original SVG proportions */
|
|
3753
|
+
height?: number;
|
|
3754
|
+
/** If provided, scale the SVG path to this width, and scale the height to keep the original SVG proportions */
|
|
3755
|
+
width?: number;
|
|
3756
|
+
}
|
|
3757
|
+
|
|
3758
|
+
type ValueType = string | number | boolean | null | undefined | Array<ValueType> | {
|
|
3759
|
+
[key: string]: ValueType;
|
|
3760
|
+
} | Point | RectOptions | M2Path | M2ColorfulPath | SvgStringPath | Size;
|
|
3761
|
+
/**
|
|
3762
|
+
* Utility class for comparing equality of m2c2kit objects.
|
|
3763
|
+
*
|
|
3764
|
+
*/
|
|
3765
|
+
declare class Equal {
|
|
3397
3766
|
/**
|
|
3398
3767
|
* Compares two RgbaColor objects and returns true if they are equal.
|
|
3399
3768
|
*
|
|
@@ -3407,6 +3776,28 @@ declare class Equals {
|
|
|
3407
3776
|
* @returns
|
|
3408
3777
|
*/
|
|
3409
3778
|
static rgbaColor(color1?: RgbaColor, color2?: RgbaColor): boolean;
|
|
3779
|
+
/**
|
|
3780
|
+
* Compares two values for deep equality.
|
|
3781
|
+
*
|
|
3782
|
+
* @remarks Supported values are string, number, boolean, null, undefined,
|
|
3783
|
+
* and object (note that arrays are objects in JavaScript).
|
|
3784
|
+
*
|
|
3785
|
+
* @param value1 - value to compare
|
|
3786
|
+
* @param value2 - value to compare
|
|
3787
|
+
* @returns true if values have deep equality
|
|
3788
|
+
*/
|
|
3789
|
+
static value(value1: ValueType, value2: ValueType): boolean;
|
|
3790
|
+
/**
|
|
3791
|
+
* Compares two objects for deep equality.
|
|
3792
|
+
*
|
|
3793
|
+
* @remarks In JavaScript, arrays are objects, so this method will also
|
|
3794
|
+
* compare arrays for deep equality.
|
|
3795
|
+
*
|
|
3796
|
+
* @param obj1 - object to compare
|
|
3797
|
+
* @param obj2 - object to compare
|
|
3798
|
+
* @returns true if objects have deep equality
|
|
3799
|
+
*/
|
|
3800
|
+
private static objectsDeepEqual;
|
|
3410
3801
|
}
|
|
3411
3802
|
|
|
3412
3803
|
/**
|
|
@@ -3451,6 +3842,80 @@ declare class M2c2KitHelpers {
|
|
|
3451
3842
|
* "https://", "file://", etc.)
|
|
3452
3843
|
*/
|
|
3453
3844
|
static urlHasScheme(url: string): boolean;
|
|
3845
|
+
/**
|
|
3846
|
+
* Load scripts from URLs.
|
|
3847
|
+
*
|
|
3848
|
+
* @remarks This is for debugging purposes only. If this is unwanted, it
|
|
3849
|
+
* can be disabled on the server side with an appropriate Content
|
|
3850
|
+
* Security Policy (CSP) header.
|
|
3851
|
+
*
|
|
3852
|
+
* @param urls - URLs with scripts to load
|
|
3853
|
+
*/
|
|
3854
|
+
static loadScriptUrls(urls: string[]): void;
|
|
3855
|
+
/**
|
|
3856
|
+
* Loads eruda from a CDN and initializes it.
|
|
3857
|
+
*
|
|
3858
|
+
* @remarks This is for debugging purposes only. If this is unwanted, it
|
|
3859
|
+
* can be disabled on the server side with an appropriate Content
|
|
3860
|
+
* Security Policy (CSP) header.
|
|
3861
|
+
* eruda is a dev console overlay for mobile web browsers and web views.
|
|
3862
|
+
* see https://github.com/liriliri/eruda
|
|
3863
|
+
*
|
|
3864
|
+
* @param pollingIntervalMs - milliseconds between each attempt
|
|
3865
|
+
* @param maxAttempts - how many attempts to make
|
|
3866
|
+
*/
|
|
3867
|
+
static loadEruda(pollingIntervalMs?: number, maxAttempts?: number): void;
|
|
3868
|
+
/**
|
|
3869
|
+
* Registers a `M2Node` class with the global class registry.
|
|
3870
|
+
*
|
|
3871
|
+
* @remarks This is used to register a class so that it can be
|
|
3872
|
+
* instantiated by the `M2NodeFactory`.
|
|
3873
|
+
*
|
|
3874
|
+
* @param nodeClass - class or classes to register.
|
|
3875
|
+
*/
|
|
3876
|
+
static registerM2NodeClass(...nodeClass: Array<M2NodeConstructor>): void;
|
|
3877
|
+
/**
|
|
3878
|
+
* Creates timestamps based on when the current frame's update began.
|
|
3879
|
+
*
|
|
3880
|
+
* @remarks When recording events related to node creation, node
|
|
3881
|
+
* parent-child relationships, and node properties, the timestamps should be
|
|
3882
|
+
* based on when current frame's update began -- not the current time. While
|
|
3883
|
+
* current time is most accurate for recording user interactions (use
|
|
3884
|
+
* `M2c2KitHelpers.createTimestamps()` for user interactions), the frame's
|
|
3885
|
+
* update is the best way to ensure that node events that occurred in the same
|
|
3886
|
+
* frame are recorded with the same timestamp and thus are replayed in the
|
|
3887
|
+
* correct order. For example, a node may be created, added to a scene, and
|
|
3888
|
+
* have its hidden property set to true, all in the same frame. If the
|
|
3889
|
+
* current timestamps were used for all these events, it could happen that
|
|
3890
|
+
* the hidden property is set slightly after the node is added to the scene.
|
|
3891
|
+
* When replayed, this could cause the node to be visible for a single frame
|
|
3892
|
+
* if the queue of replay events pulls only the creation and addition events.
|
|
3893
|
+
* By using the frame's update time, we ensure that all events related to a
|
|
3894
|
+
* node are recorded with the same timestamp and are replayed in the same
|
|
3895
|
+
* frame.
|
|
3896
|
+
* If game has not yet begun to run (i.e., frame updates have not yet started),
|
|
3897
|
+
* the timestamps will be based on the current time.
|
|
3898
|
+
*
|
|
3899
|
+
* @returns object with timestamps
|
|
3900
|
+
*/
|
|
3901
|
+
static createFrameUpdateTimestamps(): {
|
|
3902
|
+
timestamp: number;
|
|
3903
|
+
iso8601Timestamp: string;
|
|
3904
|
+
};
|
|
3905
|
+
/**
|
|
3906
|
+
* Creates timestamps based on the current time.
|
|
3907
|
+
*
|
|
3908
|
+
* @remarks Use `M2c2KitHelpers.createFrameUpdateTimestamps()` when requesting
|
|
3909
|
+
* timestamps for events related to node creation, parent-child
|
|
3910
|
+
* relationships, and properties.
|
|
3911
|
+
* See {@link createFrameUpdateTimestamps()} for explanation.
|
|
3912
|
+
*
|
|
3913
|
+
* @returns object with `timestamp` and `iso8601Timestamp` properties
|
|
3914
|
+
*/
|
|
3915
|
+
static createTimestamps(): {
|
|
3916
|
+
timestamp: number;
|
|
3917
|
+
iso8601Timestamp: string;
|
|
3918
|
+
};
|
|
3454
3919
|
/**
|
|
3455
3920
|
* Calculates the four points of the bounding box of the node, taking
|
|
3456
3921
|
* into account the node's rotation (as well as the rotation of its
|
|
@@ -3592,6 +4057,40 @@ interface FontData {
|
|
|
3592
4057
|
isDefault: boolean;
|
|
3593
4058
|
}
|
|
3594
4059
|
|
|
4060
|
+
declare global {
|
|
4061
|
+
var m2c2Globals: GlobalVariables;
|
|
4062
|
+
}
|
|
4063
|
+
interface GlobalVariables {
|
|
4064
|
+
now: number;
|
|
4065
|
+
iso8601Now: string;
|
|
4066
|
+
deltaTime: number;
|
|
4067
|
+
canvasScale: number;
|
|
4068
|
+
/**
|
|
4069
|
+
* rootScale is the scaling factor to be applied to scenes to scale up or
|
|
4070
|
+
* down to fit the device's window while preserving the aspect ratio the
|
|
4071
|
+
* game was designed for
|
|
4072
|
+
*/
|
|
4073
|
+
rootScale: number;
|
|
4074
|
+
canvasCssWidth: number;
|
|
4075
|
+
canvasCssHeight: number;
|
|
4076
|
+
erudaRequested?: boolean;
|
|
4077
|
+
erudaInitialized?: boolean;
|
|
4078
|
+
addedScriptUrls: string[];
|
|
4079
|
+
/**
|
|
4080
|
+
* A dictionary of all `M2Node` classes that have been registered.
|
|
4081
|
+
* This is used to instantiate `M2Node` objects from their class name.
|
|
4082
|
+
*
|
|
4083
|
+
* @remarks The type should be `{ [key: string]: M2NodeConstructor }` or
|
|
4084
|
+
* `M2NodeClassRegistry`. But, this creates problems in Jest: I could not
|
|
4085
|
+
* get ts-jest to compile when the type of a global variable is not a
|
|
4086
|
+
* simple type. Instead, the type of `m2NodeClassRegistry` is `object`,
|
|
4087
|
+
* and I will assert it to `M2NodeClassRegistry` when needed.
|
|
4088
|
+
*/
|
|
4089
|
+
m2NodeClassRegistry: object;
|
|
4090
|
+
get eventSequence(): number;
|
|
4091
|
+
__sequence: number;
|
|
4092
|
+
}
|
|
4093
|
+
|
|
3595
4094
|
interface IText {
|
|
3596
4095
|
text?: string;
|
|
3597
4096
|
fontName?: string;
|
|
@@ -3622,11 +4121,8 @@ declare class Label extends M2Node implements IDrawable, IText, LabelOptions {
|
|
|
3622
4121
|
readonly type = M2NodeType.Label;
|
|
3623
4122
|
isDrawable: boolean;
|
|
3624
4123
|
isText: boolean;
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
y: number;
|
|
3628
|
-
};
|
|
3629
|
-
zPosition: number;
|
|
4124
|
+
private _anchorPoint;
|
|
4125
|
+
private _zPosition;
|
|
3630
4126
|
private _text;
|
|
3631
4127
|
private _fontName;
|
|
3632
4128
|
private _fontNames;
|
|
@@ -3652,6 +4148,31 @@ declare class Label extends M2Node implements IDrawable, IText, LabelOptions {
|
|
|
3652
4148
|
* @param options - {@link LabelOptions}
|
|
3653
4149
|
*/
|
|
3654
4150
|
constructor(options?: LabelOptions);
|
|
4151
|
+
get completeNodeOptions(): {
|
|
4152
|
+
horizontalAlignmentMode: LabelHorizontalAlignmentMode;
|
|
4153
|
+
preferredMaxLayoutWidth: number | undefined;
|
|
4154
|
+
backgroundColor: RgbaColor | undefined;
|
|
4155
|
+
fontNames: string[] | undefined;
|
|
4156
|
+
text?: string;
|
|
4157
|
+
fontName?: string;
|
|
4158
|
+
fontColor?: RgbaColor;
|
|
4159
|
+
fontSize?: number;
|
|
4160
|
+
interpolation?: StringInterpolationMap;
|
|
4161
|
+
localize?: boolean;
|
|
4162
|
+
anchorPoint?: Point;
|
|
4163
|
+
zPosition?: number;
|
|
4164
|
+
name?: string;
|
|
4165
|
+
position?: Point;
|
|
4166
|
+
scale?: number;
|
|
4167
|
+
alpha?: number;
|
|
4168
|
+
zRotation?: number;
|
|
4169
|
+
isUserInteractionEnabled?: boolean;
|
|
4170
|
+
draggable?: boolean;
|
|
4171
|
+
hidden?: boolean;
|
|
4172
|
+
layout?: Layout;
|
|
4173
|
+
uuid?: string;
|
|
4174
|
+
suppressEvents?: boolean;
|
|
4175
|
+
};
|
|
3655
4176
|
initialize(): void;
|
|
3656
4177
|
/**
|
|
3657
4178
|
* Determines the M2Font objects that need to be ready in order to draw
|
|
@@ -3685,6 +4206,10 @@ declare class Label extends M2Node implements IDrawable, IText, LabelOptions {
|
|
|
3685
4206
|
set backgroundColor(backgroundColor: RgbaColor | undefined);
|
|
3686
4207
|
get localize(): boolean;
|
|
3687
4208
|
set localize(localize: boolean);
|
|
4209
|
+
get anchorPoint(): Point;
|
|
4210
|
+
set anchorPoint(anchorPoint: Point);
|
|
4211
|
+
get zPosition(): number;
|
|
4212
|
+
set zPosition(zPosition: number);
|
|
3688
4213
|
private get backgroundPaint();
|
|
3689
4214
|
private set backgroundPaint(value);
|
|
3690
4215
|
private get fontPaint();
|
|
@@ -3848,17 +4373,6 @@ declare class LegacyTimer {
|
|
|
3848
4373
|
static exists(name: string): boolean;
|
|
3849
4374
|
}
|
|
3850
4375
|
|
|
3851
|
-
/**
|
|
3852
|
-
* A collection of multi-color lines to draw.
|
|
3853
|
-
*
|
|
3854
|
-
* @remarks Unlike `M2Path`, this interface allows for lines of different
|
|
3855
|
-
* colors and widths to be drawn in the same path.
|
|
3856
|
-
*/
|
|
3857
|
-
interface M2ColorfulPath extends M2Path {
|
|
3858
|
-
/** Colors and widths of lines in the path. */
|
|
3859
|
-
linePresentations: Array<LinePresentation>;
|
|
3860
|
-
}
|
|
3861
|
-
|
|
3862
4376
|
/** Base interface for all Plugin events. */
|
|
3863
4377
|
interface PluginEvent extends M2Event<Plugin> {
|
|
3864
4378
|
target: Plugin;
|
|
@@ -3906,21 +4420,6 @@ declare class RandomDraws {
|
|
|
3906
4420
|
}>;
|
|
3907
4421
|
}
|
|
3908
4422
|
|
|
3909
|
-
interface RectOptions {
|
|
3910
|
-
/** Position of rectangle */
|
|
3911
|
-
origin?: Point;
|
|
3912
|
-
/** Size of rectangle */
|
|
3913
|
-
size?: Size;
|
|
3914
|
-
/** X coordinate of rectangle position; this can be used instead of setting the origin property */
|
|
3915
|
-
x?: number;
|
|
3916
|
-
/** Y coordinate of rectangle position; this can be used instead of setting the origin property */
|
|
3917
|
-
y?: number;
|
|
3918
|
-
/** Width of rectangle; this can be used instead of setting the size property */
|
|
3919
|
-
width?: number;
|
|
3920
|
-
/** Height of rectangle; this can be used instead of setting the size property */
|
|
3921
|
-
height?: number;
|
|
3922
|
-
}
|
|
3923
|
-
|
|
3924
4423
|
declare enum ShapeType {
|
|
3925
4424
|
Undefined = "Undefined",
|
|
3926
4425
|
Rectangle = "Rectangle",
|
|
@@ -3928,20 +4427,6 @@ declare enum ShapeType {
|
|
|
3928
4427
|
Path = "Path"
|
|
3929
4428
|
}
|
|
3930
4429
|
|
|
3931
|
-
/**
|
|
3932
|
-
* A path created from an SVG string path.
|
|
3933
|
-
*/
|
|
3934
|
-
interface SvgStringPath {
|
|
3935
|
-
/** SVG string from which to create the path */
|
|
3936
|
-
pathString?: string;
|
|
3937
|
-
/** SVG string from which to create the path @deprecated Use `pathString` */
|
|
3938
|
-
svgPathString?: string;
|
|
3939
|
-
/** If provided, scale the SVG path to this height, and scale the width to keep the original SVG proportions */
|
|
3940
|
-
height?: number;
|
|
3941
|
-
/** If provided, scale the SVG path to this width, and scale the height to keep the original SVG proportions */
|
|
3942
|
-
width?: number;
|
|
3943
|
-
}
|
|
3944
|
-
|
|
3945
4430
|
interface ShapeOptions extends M2NodeOptions, DrawableOptions {
|
|
3946
4431
|
shapeType?: ShapeType;
|
|
3947
4432
|
/** If provided, shape will be a circle with given radius */
|
|
@@ -3968,22 +4453,19 @@ declare class Shape extends M2Node implements IDrawable, ShapeOptions {
|
|
|
3968
4453
|
readonly type = M2NodeType.Shape;
|
|
3969
4454
|
isDrawable: boolean;
|
|
3970
4455
|
isShape: boolean;
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
y: number;
|
|
3974
|
-
};
|
|
3975
|
-
zPosition: number;
|
|
4456
|
+
private _anchorPoint;
|
|
4457
|
+
private _zPosition;
|
|
3976
4458
|
shapeType: ShapeType;
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
4459
|
+
private _circleOfRadius?;
|
|
4460
|
+
private _rect?;
|
|
4461
|
+
private _path?;
|
|
3980
4462
|
ckPath: Path | null;
|
|
3981
4463
|
ckPathWidth?: number;
|
|
3982
4464
|
ckPathHeight?: number;
|
|
3983
|
-
|
|
4465
|
+
private _cornerRadius;
|
|
3984
4466
|
private _fillColor;
|
|
3985
4467
|
private _strokeColor?;
|
|
3986
|
-
|
|
4468
|
+
private _lineWidth?;
|
|
3987
4469
|
private _isAntialiased;
|
|
3988
4470
|
private _fillColorPaintAntialiased?;
|
|
3989
4471
|
private _strokeColorPaintAntialiased?;
|
|
@@ -4004,7 +4486,35 @@ declare class Shape extends M2Node implements IDrawable, ShapeOptions {
|
|
|
4004
4486
|
* @param options - {@link ShapeOptions}
|
|
4005
4487
|
*/
|
|
4006
4488
|
constructor(options?: ShapeOptions);
|
|
4489
|
+
get completeNodeOptions(): {
|
|
4490
|
+
circleOfRadius: number | undefined;
|
|
4491
|
+
rect: RectOptions | undefined;
|
|
4492
|
+
cornerRadius: number;
|
|
4493
|
+
fillColor: RgbaColor;
|
|
4494
|
+
strokeColor: RgbaColor | undefined;
|
|
4495
|
+
lineWidth: number | undefined;
|
|
4496
|
+
path: M2Path | M2ColorfulPath | SvgStringPath | undefined;
|
|
4497
|
+
size: Size | undefined;
|
|
4498
|
+
isAntialiased: boolean;
|
|
4499
|
+
anchorPoint?: Point;
|
|
4500
|
+
zPosition?: number;
|
|
4501
|
+
name?: string;
|
|
4502
|
+
position?: Point;
|
|
4503
|
+
scale?: number;
|
|
4504
|
+
alpha?: number;
|
|
4505
|
+
zRotation?: number;
|
|
4506
|
+
isUserInteractionEnabled?: boolean;
|
|
4507
|
+
draggable?: boolean;
|
|
4508
|
+
hidden?: boolean;
|
|
4509
|
+
layout?: Layout;
|
|
4510
|
+
uuid?: string;
|
|
4511
|
+
suppressEvents?: boolean;
|
|
4512
|
+
};
|
|
4007
4513
|
initialize(): void;
|
|
4514
|
+
get anchorPoint(): Point;
|
|
4515
|
+
set anchorPoint(anchorPoint: Point);
|
|
4516
|
+
get zPosition(): number;
|
|
4517
|
+
set zPosition(zPosition: number);
|
|
4008
4518
|
dispose(): void;
|
|
4009
4519
|
/**
|
|
4010
4520
|
* Duplicates a node using deep copy.
|
|
@@ -4042,6 +4552,16 @@ declare class Shape extends M2Node implements IDrawable, ShapeOptions {
|
|
|
4042
4552
|
private warmupStrokedCircle;
|
|
4043
4553
|
private warmupFilledRectangle;
|
|
4044
4554
|
private warmupStrokedRectangle;
|
|
4555
|
+
get circleOfRadius(): number | undefined;
|
|
4556
|
+
set circleOfRadius(circleOfRadius: number | undefined);
|
|
4557
|
+
get rect(): RectOptions | undefined;
|
|
4558
|
+
set rect(rect: RectOptions | undefined);
|
|
4559
|
+
get cornerRadius(): number;
|
|
4560
|
+
set cornerRadius(cornerRadius: number | undefined);
|
|
4561
|
+
get lineWidth(): number | undefined;
|
|
4562
|
+
set lineWidth(lineWidth: number | undefined);
|
|
4563
|
+
get path(): M2Path | M2ColorfulPath | SvgStringPath | undefined;
|
|
4564
|
+
set path(path: M2Path | M2ColorfulPath | SvgStringPath | undefined);
|
|
4045
4565
|
get fillColor(): RgbaColor;
|
|
4046
4566
|
set fillColor(fillColor: RgbaColor);
|
|
4047
4567
|
get strokeColor(): RgbaColor | undefined;
|
|
@@ -4191,11 +4711,8 @@ interface SpriteOptions extends M2NodeOptions, DrawableOptions {
|
|
|
4191
4711
|
declare class Sprite extends M2Node implements IDrawable, SpriteOptions {
|
|
4192
4712
|
readonly type = M2NodeType.Sprite;
|
|
4193
4713
|
isDrawable: boolean;
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
y: number;
|
|
4197
|
-
};
|
|
4198
|
-
zPosition: number;
|
|
4714
|
+
private _anchorPoint;
|
|
4715
|
+
private _zPosition;
|
|
4199
4716
|
private _imageName;
|
|
4200
4717
|
private m2Image?;
|
|
4201
4718
|
private _paint?;
|
|
@@ -4207,10 +4724,30 @@ declare class Sprite extends M2Node implements IDrawable, SpriteOptions {
|
|
|
4207
4724
|
* @param options - {@link SpriteOptions}
|
|
4208
4725
|
*/
|
|
4209
4726
|
constructor(options?: SpriteOptions);
|
|
4727
|
+
get completeNodeOptions(): {
|
|
4728
|
+
imageName: string;
|
|
4729
|
+
anchorPoint?: Point;
|
|
4730
|
+
zPosition?: number;
|
|
4731
|
+
name?: string;
|
|
4732
|
+
position?: Point;
|
|
4733
|
+
scale?: number;
|
|
4734
|
+
alpha?: number;
|
|
4735
|
+
zRotation?: number;
|
|
4736
|
+
isUserInteractionEnabled?: boolean;
|
|
4737
|
+
draggable?: boolean;
|
|
4738
|
+
hidden?: boolean;
|
|
4739
|
+
layout?: Layout;
|
|
4740
|
+
uuid?: string;
|
|
4741
|
+
suppressEvents?: boolean;
|
|
4742
|
+
};
|
|
4210
4743
|
initialize(): void;
|
|
4211
4744
|
dispose(): void;
|
|
4212
|
-
set imageName(imageName: string);
|
|
4213
4745
|
get imageName(): string;
|
|
4746
|
+
set imageName(imageName: string);
|
|
4747
|
+
get anchorPoint(): Point;
|
|
4748
|
+
set anchorPoint(anchorPoint: Point);
|
|
4749
|
+
get zPosition(): number;
|
|
4750
|
+
set zPosition(zPosition: number);
|
|
4214
4751
|
private set paint(value);
|
|
4215
4752
|
private get paint();
|
|
4216
4753
|
/**
|
|
@@ -4257,11 +4794,8 @@ declare class TextLine extends M2Node implements IDrawable, IText, TextLineOptio
|
|
|
4257
4794
|
readonly type = M2NodeType.TextLine;
|
|
4258
4795
|
isDrawable: boolean;
|
|
4259
4796
|
isText: boolean;
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
x: number;
|
|
4263
|
-
y: number;
|
|
4264
|
-
};
|
|
4797
|
+
private _zPosition;
|
|
4798
|
+
private _anchorPoint;
|
|
4265
4799
|
private _text;
|
|
4266
4800
|
private _fontName;
|
|
4267
4801
|
private _fontColor;
|
|
@@ -4284,6 +4818,28 @@ declare class TextLine extends M2Node implements IDrawable, IText, TextLineOptio
|
|
|
4284
4818
|
* @param options - {@link TextLineOptions}
|
|
4285
4819
|
*/
|
|
4286
4820
|
constructor(options?: TextLineOptions);
|
|
4821
|
+
get completeNodeOptions(): {
|
|
4822
|
+
width: number;
|
|
4823
|
+
text?: string;
|
|
4824
|
+
fontName?: string;
|
|
4825
|
+
fontColor?: RgbaColor;
|
|
4826
|
+
fontSize?: number;
|
|
4827
|
+
interpolation?: StringInterpolationMap;
|
|
4828
|
+
localize?: boolean;
|
|
4829
|
+
anchorPoint?: Point;
|
|
4830
|
+
zPosition?: number;
|
|
4831
|
+
name?: string;
|
|
4832
|
+
position?: Point;
|
|
4833
|
+
scale?: number;
|
|
4834
|
+
alpha?: number;
|
|
4835
|
+
zRotation?: number;
|
|
4836
|
+
isUserInteractionEnabled?: boolean;
|
|
4837
|
+
draggable?: boolean;
|
|
4838
|
+
hidden?: boolean;
|
|
4839
|
+
layout?: Layout;
|
|
4840
|
+
uuid?: string;
|
|
4841
|
+
suppressEvents?: boolean;
|
|
4842
|
+
};
|
|
4287
4843
|
initialize(): void;
|
|
4288
4844
|
/**
|
|
4289
4845
|
* Determines the M2Font object that needs to be ready in order to draw
|
|
@@ -4310,6 +4866,10 @@ declare class TextLine extends M2Node implements IDrawable, IText, TextLineOptio
|
|
|
4310
4866
|
set interpolation(interpolation: StringInterpolationMap);
|
|
4311
4867
|
get localize(): boolean;
|
|
4312
4868
|
set localize(localize: boolean);
|
|
4869
|
+
get anchorPoint(): Point;
|
|
4870
|
+
set anchorPoint(anchorPoint: Point);
|
|
4871
|
+
get zPosition(): number;
|
|
4872
|
+
set zPosition(zPosition: number);
|
|
4313
4873
|
dispose(): void;
|
|
4314
4874
|
/**
|
|
4315
4875
|
* Duplicates a node using deep copy.
|
|
@@ -4612,4 +5172,4 @@ declare class WebGlInfo {
|
|
|
4612
5172
|
static dispose(): void;
|
|
4613
5173
|
}
|
|
4614
5174
|
|
|
4615
|
-
export { Action, type Activity, type ActivityCallbacks, type ActivityEvent, type ActivityEventListener, type ActivityKeyValueData, type ActivityLifecycleEvent, type ActivityResultsEvent, ActivityType, type BrowserImage, type CallbackOptions, CanvasKitHelpers, ColorfulMutablePath, Composite, type CompositeOptions, Constants, ConstraintType, type Constraints, CustomAction, type CustomActionOptions, type DefaultParameter, Dimensions, type DrawableOptions, type EasingFunction, Easings, Equals, FadeAlphaAction, type FadeAlphaActionOptions, type FontAsset, type FontData, FontManager, Game, type GameData, type GameEvent, type GameOptions, type GameParameters, GlobalVariables, GroupAction, I18n, type IDataStore, type IDrawable, type IText, ImageManager, Label, LabelHorizontalAlignmentMode, type LabelOptions, type Layout, LayoutConstraint, LegacyTimer, type LocaleSvg, type M2ColorfulPath, type M2DragEvent, type M2Event, type M2EventListener, M2EventType, type M2Image, M2ImageStatus, M2Node, type M2NodeEvent, type M2NodeEventListener, type M2NodeOptions, M2NodeType, type M2Path, type M2PointerEvent, type M2Sound, M2SoundStatus, M2c2KitHelpers, MoveAction, type MoveActionOptions, MutablePath, NoneTransition, PlayAction, type PlayActionOptions, type Plugin, type PluginEvent, type Point, RandomDraws, type RectOptions, RepeatAction, RepeatForeverAction, type RgbaColor, RotateAction, ScaleAction, type ScaleActionOptions, Scene, type SceneOptions, SceneTransition, SequenceAction, Shape, type ShapeOptions, ShapeType, type Size, SlideTransition, type SlideTransitionOptions, type SoundAsset, SoundManager, SoundPlayer, type SoundPlayerOptions, SoundRecorder, type SoundRecorderOptions, type SoundRecorderResults, Sprite, type SpriteOptions, Story, type StoryOptions, type StringInterpolationMap, type TapEvent, type TextAndFont, TextLine, type TextLineOptions, type TextLocalizationResult, type TextOptions, type TextWithFontCustomization, Timer, Transition, TransitionDirection, TransitionType, type Translation, type TranslationConfiguration, type TranslationOptions, type TrialData, type TrialSchema, Uuid, WaitAction, type WaitActionOptions, WebColors, WebGlInfo, handleInterfaceOptions };
|
|
5175
|
+
export { Action, type Activity, type ActivityCallbacks, type ActivityEvent, type ActivityEventListener, type ActivityKeyValueData, type ActivityLifecycleEvent, type ActivityResultsEvent, ActivityType, type BrowserImage, type BrowserImageDataReadyEvent, type CallbackOptions, CanvasKitHelpers, ColorfulMutablePath, Composite, type CompositeEvent, type CompositeOptions, Constants, ConstraintType, type Constraints, CustomAction, type CustomActionOptions, type DefaultParameter, Dimensions, type DomPointerDownEvent, type DrawableOptions, type EasingFunction, Easings, Equal, Equals, EventStore, EventStoreMode, FadeAlphaAction, type FadeAlphaActionOptions, type FontAsset, type FontData, FontManager, Game, type GameData, type GameEvent, type GameOptions, type GameParameters, type GlobalVariables, GroupAction, I18n, type I18nDataReadyEvent, type IDataStore, type IDrawable, type IText, ImageManager, Label, LabelHorizontalAlignmentMode, type LabelOptions, type Layout, LayoutConstraint, LegacyTimer, type LocaleSvg, type M2ColorfulPath, type M2DragEvent, type M2Event, type M2EventListener, M2EventType, type M2Image, M2ImageStatus, M2Node, type M2NodeAddChildEvent, type M2NodeConstructor, type M2NodeEvent, type M2NodeEventListener, M2NodeFactory, type M2NodeNewEvent, type M2NodeOptions, type M2NodePropertyChangeEvent, type M2NodeRemoveChildEvent, M2NodeType, type M2Path, type M2PointerEvent, type M2Sound, M2SoundStatus, M2c2KitHelpers, MoveAction, type MoveActionOptions, MutablePath, NoneTransition, PlayAction, type PlayActionOptions, type Plugin, type PluginEvent, type Point, RandomDraws, type RectOptions, RepeatAction, RepeatForeverAction, type RgbaColor, RotateAction, ScaleAction, type ScaleActionOptions, Scene, type SceneOptions, type ScenePresentEvent, SceneTransition, SequenceAction, Shape, type ShapeOptions, ShapeType, type Size, SlideTransition, type SlideTransitionOptions, type SoundAsset, SoundManager, SoundPlayer, type SoundPlayerOptions, SoundRecorder, type SoundRecorderOptions, type SoundRecorderResults, Sprite, type SpriteOptions, Story, type StoryOptions, type StringInterpolationMap, type TapEvent, type TextAndFont, TextLine, type TextLineOptions, type TextLocalizationResult, type TextOptions, type TextWithFontCustomization, Timer, Transition, TransitionDirection, TransitionType, type Translation, type TranslationConfiguration, type TranslationOptions, type TrialData, type TrialSchema, Uuid, WaitAction, type WaitActionOptions, WebColors, WebGlInfo, handleInterfaceOptions };
|