@vpmedia/phaser 1.16.0 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +3 -3
- package/src/phaser/core/animation.js +31 -18
- package/src/phaser/core/animation_manager.js +36 -21
- package/src/phaser/core/animation_parser.js +1 -1
- package/src/phaser/core/array_set.js +17 -9
- package/src/phaser/core/cache.js +61 -45
- package/src/phaser/core/const.js +66 -0
- package/src/phaser/core/device.js +87 -0
- package/src/phaser/core/dom.js +13 -8
- package/src/phaser/core/event_manager.js +2 -1
- package/src/phaser/core/factory.js +21 -21
- package/src/phaser/core/frame_data.js +1 -1
- package/src/phaser/core/game.js +1 -0
- package/src/phaser/core/input.js +37 -20
- package/src/phaser/core/input_handler.js +1 -1
- package/src/phaser/core/input_mouse.js +16 -12
- package/src/phaser/core/input_mspointer.js +7 -7
- package/src/phaser/core/input_pointer.js +26 -17
- package/src/phaser/core/input_touch.js +7 -7
- package/src/phaser/core/loader.js +104 -75
- package/src/phaser/core/raf.js +1 -1
- package/src/phaser/core/scale_manager.js +46 -29
- package/src/phaser/core/scene_manager.js +13 -9
- package/src/phaser/core/sound.js +3 -3
- package/src/phaser/core/sound_manager.js +17 -10
- package/src/phaser/core/sound_sprite.js +7 -4
- package/src/phaser/core/timer.js +38 -26
- package/src/phaser/core/timer_event.js +10 -8
- package/src/phaser/core/tween.js +66 -46
- package/src/phaser/core/tween_data.js +22 -15
- package/src/phaser/core/tween_manager.js +10 -6
- package/src/phaser/display/bitmap_text.js +7 -6
- package/src/phaser/display/canvas/pool.js +1 -1
- package/src/phaser/display/canvas/renderer.js +5 -4
- package/src/phaser/display/canvas/util.js +2 -2
- package/src/phaser/display/display_object.js +33 -16
- package/src/phaser/display/graphics.js +57 -36
- package/src/phaser/display/graphics_data.js +7 -7
- package/src/phaser/display/group.js +28 -20
- package/src/phaser/display/image.js +19 -12
- package/src/phaser/display/sprite_util.js +3 -2
- package/src/phaser/display/text.js +27 -14
- package/src/phaser/display/webgl/abstract_filter.js +2 -2
- package/src/phaser/display/webgl/base_texture.js +2 -2
- package/src/phaser/display/webgl/blend_manager.js +3 -2
- package/src/phaser/display/webgl/earcut_node.js +1 -1
- package/src/phaser/display/webgl/fast_sprite_batch.js +6 -6
- package/src/phaser/display/webgl/filter_manager.js +1 -1
- package/src/phaser/display/webgl/filter_texture.js +2 -2
- package/src/phaser/display/webgl/graphics_data.js +1 -1
- package/src/phaser/display/webgl/render_texture.js +7 -3
- package/src/phaser/display/webgl/renderer.js +9 -6
- package/src/phaser/display/webgl/shader/complex.js +1 -1
- package/src/phaser/display/webgl/shader/fast.js +1 -1
- package/src/phaser/display/webgl/shader/normal.js +2 -2
- package/src/phaser/display/webgl/shader/primitive.js +1 -1
- package/src/phaser/display/webgl/shader/strip.js +1 -1
- package/src/phaser/display/webgl/shader_manager.js +3 -3
- package/src/phaser/display/webgl/sprite_batch.js +9 -7
- package/src/phaser/display/webgl/stencil_manager.js +7 -7
- package/src/phaser/display/webgl/texture.js +8 -6
- package/types/phaser/core/animation.d.ts +43 -30
- package/types/phaser/core/animation.d.ts.map +1 -1
- package/types/phaser/core/animation_manager.d.ts +59 -43
- package/types/phaser/core/animation_manager.d.ts.map +1 -1
- package/types/phaser/core/animation_parser.d.ts +2 -2
- package/types/phaser/core/array_set.d.ts +24 -16
- package/types/phaser/core/array_set.d.ts.map +1 -1
- package/types/phaser/core/cache.d.ts +79 -73
- package/types/phaser/core/cache.d.ts.map +1 -1
- package/types/phaser/core/const.d.ts +88 -22
- package/types/phaser/core/const.d.ts.map +1 -1
- package/types/phaser/core/device.d.ts +87 -0
- package/types/phaser/core/device.d.ts.map +1 -1
- package/types/phaser/core/dom.d.ts +19 -27
- package/types/phaser/core/dom.d.ts.map +1 -1
- package/types/phaser/core/event_manager.d.ts +4 -3
- package/types/phaser/core/event_manager.d.ts.map +1 -1
- package/types/phaser/core/factory.d.ts +28 -28
- package/types/phaser/core/factory.d.ts.map +1 -1
- package/types/phaser/core/frame_data.d.ts +2 -2
- package/types/phaser/core/frame_data.d.ts.map +1 -1
- package/types/phaser/core/game.d.ts +1 -0
- package/types/phaser/core/game.d.ts.map +1 -1
- package/types/phaser/core/input.d.ts +51 -34
- package/types/phaser/core/input.d.ts.map +1 -1
- package/types/phaser/core/input_handler.d.ts +2 -2
- package/types/phaser/core/input_handler.d.ts.map +1 -1
- package/types/phaser/core/input_mouse.d.ts +20 -19
- package/types/phaser/core/input_mouse.d.ts.map +1 -1
- package/types/phaser/core/input_mspointer.d.ts +15 -15
- package/types/phaser/core/input_mspointer.d.ts.map +1 -1
- package/types/phaser/core/input_pointer.d.ts +39 -30
- package/types/phaser/core/input_pointer.d.ts.map +1 -1
- package/types/phaser/core/input_touch.d.ts +15 -15
- package/types/phaser/core/input_touch.d.ts.map +1 -1
- package/types/phaser/core/loader.d.ts +118 -92
- package/types/phaser/core/loader.d.ts.map +1 -1
- package/types/phaser/core/raf.d.ts +3 -3
- package/types/phaser/core/raf.d.ts.map +1 -1
- package/types/phaser/core/scale_manager.d.ts +68 -51
- package/types/phaser/core/scale_manager.d.ts.map +1 -1
- package/types/phaser/core/scene_manager.d.ts +18 -13
- package/types/phaser/core/scene_manager.d.ts.map +1 -1
- package/types/phaser/core/sound.d.ts +4 -4
- package/types/phaser/core/sound.d.ts.map +1 -1
- package/types/phaser/core/sound_manager.d.ts +22 -15
- package/types/phaser/core/sound_manager.d.ts.map +1 -1
- package/types/phaser/core/sound_sprite.d.ts +10 -7
- package/types/phaser/core/sound_sprite.d.ts.map +1 -1
- package/types/phaser/core/timer.d.ts +47 -35
- package/types/phaser/core/timer.d.ts.map +1 -1
- package/types/phaser/core/timer_event.d.ts +15 -14
- package/types/phaser/core/timer_event.d.ts.map +1 -1
- package/types/phaser/core/tween.d.ts +81 -61
- package/types/phaser/core/tween.d.ts.map +1 -1
- package/types/phaser/core/tween_data.d.ts +26 -19
- package/types/phaser/core/tween_data.d.ts.map +1 -1
- package/types/phaser/core/tween_manager.d.ts +16 -12
- package/types/phaser/core/tween_manager.d.ts.map +1 -1
- package/types/phaser/display/bitmap_text.d.ts +10 -9
- package/types/phaser/display/bitmap_text.d.ts.map +1 -1
- package/types/phaser/display/canvas/buffer.d.ts +2 -2
- package/types/phaser/display/canvas/buffer.d.ts.map +1 -1
- package/types/phaser/display/canvas/pool.d.ts +2 -2
- package/types/phaser/display/canvas/pool.d.ts.map +1 -1
- package/types/phaser/display/canvas/renderer.d.ts +5 -4
- package/types/phaser/display/canvas/renderer.d.ts.map +1 -1
- package/types/phaser/display/canvas/util.d.ts +2 -2
- package/types/phaser/display/canvas/util.d.ts.map +1 -1
- package/types/phaser/display/display_object.d.ts +50 -33
- package/types/phaser/display/display_object.d.ts.map +1 -1
- package/types/phaser/display/graphics.d.ts +65 -47
- package/types/phaser/display/graphics.d.ts.map +1 -1
- package/types/phaser/display/graphics_data.d.ts +16 -16
- package/types/phaser/display/graphics_data.d.ts.map +1 -1
- package/types/phaser/display/group.d.ts +38 -30
- package/types/phaser/display/group.d.ts.map +1 -1
- package/types/phaser/display/image.d.ts +24 -23
- package/types/phaser/display/image.d.ts.map +1 -1
- package/types/phaser/display/sprite_util.d.ts +5 -4
- package/types/phaser/display/sprite_util.d.ts.map +1 -1
- package/types/phaser/display/text.d.ts +33 -55
- package/types/phaser/display/text.d.ts.map +1 -1
- package/types/phaser/display/webgl/abstract_filter.d.ts +3 -3
- package/types/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
- package/types/phaser/display/webgl/base_texture.d.ts +4 -4
- package/types/phaser/display/webgl/base_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/blend_manager.d.ts +6 -5
- package/types/phaser/display/webgl/blend_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/earcut_node.d.ts +3 -3
- package/types/phaser/display/webgl/earcut_node.d.ts.map +1 -1
- package/types/phaser/display/webgl/fast_sprite_batch.d.ts +12 -12
- package/types/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/webgl/filter_manager.d.ts +3 -3
- package/types/phaser/display/webgl/filter_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/filter_texture.d.ts +7 -7
- package/types/phaser/display/webgl/filter_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/graphics_data.d.ts +5 -5
- package/types/phaser/display/webgl/graphics_data.d.ts.map +1 -1
- package/types/phaser/display/webgl/render_texture.d.ts +9 -9
- package/types/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/renderer.d.ts +10 -7
- package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/complex.d.ts +11 -11
- package/types/phaser/display/webgl/shader/complex.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/fast.d.ts +15 -15
- package/types/phaser/display/webgl/shader/fast.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/normal.d.ts +11 -11
- package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/primitive.d.ts +12 -12
- package/types/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/strip.d.ts +12 -12
- package/types/phaser/display/webgl/shader/strip.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader_manager.d.ts +5 -5
- package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/sprite_batch.d.ts +16 -14
- package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/webgl/stencil_manager.d.ts +12 -12
- package/types/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/texture.d.ts +15 -12
- package/types/phaser/display/webgl/texture.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @vpmedia/phaser
|
|
2
2
|
|
|
3
|
-
[](https://badge.fury.io/js/@vpmedia%2Fphaser)
|
|
4
4
|
[](https://github.com/vpmedia/phaser/actions/workflows/node.js.yml)
|
|
5
5
|
|
|
6
6
|
@vpmedia/phaser is the modern ECMAScript port of the popular Phaser game engine v2.6.2.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vpmedia/phaser",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"description": "@vpmedia/phaser is the modern ECMAScript port of the popular Phaser game engine v2.6.2",
|
|
5
5
|
"author": "Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"main": "./src/index.js",
|
|
23
23
|
"types": "./types/index.d.ts",
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"eslint": "^8.
|
|
25
|
+
"eslint": "^8.39.0",
|
|
26
26
|
"eslint-config-prettier": "^8.8.0",
|
|
27
27
|
"eslint-plugin-import": "^2.27.5",
|
|
28
28
|
"eslint-plugin-jest": "^27.2.1",
|
|
29
|
-
"eslint-plugin-jsdoc": "^43.0.
|
|
29
|
+
"eslint-plugin-jsdoc": "^43.0.7",
|
|
30
30
|
"eslint-plugin-prettier": "^4.2.1",
|
|
31
31
|
"husky": "^8.0.3",
|
|
32
32
|
"jest": "^29.5.0",
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { Game } from './game';
|
|
2
2
|
import { Signal } from './signal';
|
|
3
|
+
import { FrameData } from './frame_data';
|
|
4
|
+
import { Image } from '../display/image';
|
|
3
5
|
|
|
4
6
|
export class Animation {
|
|
5
7
|
/**
|
|
6
8
|
* TBD.
|
|
7
9
|
* @param {Game} game - TBD.
|
|
8
|
-
* @param parent - TBD.
|
|
9
|
-
* @param name - TBD.
|
|
10
|
-
* @param frameData - TBD.
|
|
11
|
-
* @param frames - TBD.
|
|
12
|
-
* @param frameRate - TBD.
|
|
13
|
-
* @param loop - TBD.
|
|
10
|
+
* @param {Image} parent - TBD.
|
|
11
|
+
* @param {string} name - TBD.
|
|
12
|
+
* @param {FrameData} frameData - TBD.
|
|
13
|
+
* @param {string[]|number[]} frames - TBD.
|
|
14
|
+
* @param {number} frameRate - TBD.
|
|
15
|
+
* @param {boolean} loop - TBD.
|
|
14
16
|
*/
|
|
15
17
|
constructor(game, parent, name, frameData, frames, frameRate, loop = false) {
|
|
16
18
|
this.game = game;
|
|
@@ -43,9 +45,10 @@ export class Animation {
|
|
|
43
45
|
|
|
44
46
|
/**
|
|
45
47
|
* TBD.
|
|
46
|
-
* @param frameRate - TBD.
|
|
47
|
-
* @param loop - TBD.
|
|
48
|
-
* @param killOnComplete - TBD.
|
|
48
|
+
* @param {number} frameRate - TBD.
|
|
49
|
+
* @param {boolean} loop - TBD.
|
|
50
|
+
* @param {boolean} killOnComplete - TBD.
|
|
51
|
+
* @returns {Animation} TBD.
|
|
49
52
|
*/
|
|
50
53
|
play(frameRate, loop, killOnComplete) {
|
|
51
54
|
if (typeof frameRate === 'number') {
|
|
@@ -95,6 +98,7 @@ export class Animation {
|
|
|
95
98
|
|
|
96
99
|
/**
|
|
97
100
|
* TBD.
|
|
101
|
+
* @returns {Animation} TBD.
|
|
98
102
|
*/
|
|
99
103
|
reverse() {
|
|
100
104
|
this.reversed = !this.reversed;
|
|
@@ -103,6 +107,7 @@ export class Animation {
|
|
|
103
107
|
|
|
104
108
|
/**
|
|
105
109
|
* TBD.
|
|
110
|
+
* @returns {Animation} TBD.
|
|
106
111
|
*/
|
|
107
112
|
reverseOnce() {
|
|
108
113
|
this.onComplete.addOnce(this.reverse, this);
|
|
@@ -111,8 +116,8 @@ export class Animation {
|
|
|
111
116
|
|
|
112
117
|
/**
|
|
113
118
|
* TBD.
|
|
114
|
-
* @param frameId - TBD.
|
|
115
|
-
* @param useLocalFrameIndex - TBD.
|
|
119
|
+
* @param {number|string} frameId - TBD.
|
|
120
|
+
* @param {boolean} useLocalFrameIndex - TBD.
|
|
116
121
|
*/
|
|
117
122
|
setFrame(frameId, useLocalFrameIndex = false) {
|
|
118
123
|
let frameIndex;
|
|
@@ -145,8 +150,8 @@ export class Animation {
|
|
|
145
150
|
|
|
146
151
|
/**
|
|
147
152
|
* TBD.
|
|
148
|
-
* @param resetFrame - TBD.
|
|
149
|
-
* @param dispatchComplete - TBD.
|
|
153
|
+
* @param {boolean} resetFrame - TBD.
|
|
154
|
+
* @param {boolean} dispatchComplete - TBD.
|
|
150
155
|
*/
|
|
151
156
|
stop(resetFrame = false, dispatchComplete = false) {
|
|
152
157
|
this.isPlaying = false;
|
|
@@ -184,6 +189,7 @@ export class Animation {
|
|
|
184
189
|
|
|
185
190
|
/**
|
|
186
191
|
* TBD.
|
|
192
|
+
* @returns {boolean} TBD.
|
|
187
193
|
*/
|
|
188
194
|
update() {
|
|
189
195
|
if (this.isPaused) {
|
|
@@ -242,8 +248,9 @@ export class Animation {
|
|
|
242
248
|
|
|
243
249
|
/**
|
|
244
250
|
* TBD.
|
|
245
|
-
* @param signalUpdate - TBD.
|
|
246
|
-
* @param fromPlay - TBD.
|
|
251
|
+
* @param {boolean} signalUpdate - TBD.
|
|
252
|
+
* @param {boolean} fromPlay - TBD.
|
|
253
|
+
* @returns {boolean} TBD.
|
|
247
254
|
*/
|
|
248
255
|
updateCurrentFrame(signalUpdate, fromPlay = false) {
|
|
249
256
|
if (!this._frameData || !this.currentFrame) {
|
|
@@ -266,7 +273,7 @@ export class Animation {
|
|
|
266
273
|
|
|
267
274
|
/**
|
|
268
275
|
* TBD.
|
|
269
|
-
* @param quantity - TBD.
|
|
276
|
+
* @param {number} quantity - TBD.
|
|
270
277
|
*/
|
|
271
278
|
next(quantity = 1) {
|
|
272
279
|
let frame = this._frameIndex + quantity;
|
|
@@ -285,7 +292,7 @@ export class Animation {
|
|
|
285
292
|
|
|
286
293
|
/**
|
|
287
294
|
* TBD.
|
|
288
|
-
* @param quantity - TBD.
|
|
295
|
+
* @param {number} quantity - TBD.
|
|
289
296
|
*/
|
|
290
297
|
previous(quantity = 1) {
|
|
291
298
|
let frame = this._frameIndex - quantity;
|
|
@@ -304,7 +311,7 @@ export class Animation {
|
|
|
304
311
|
|
|
305
312
|
/**
|
|
306
313
|
* TBD.
|
|
307
|
-
* @param frameData - TBD.
|
|
314
|
+
* @param {FrameData} frameData - TBD.
|
|
308
315
|
*/
|
|
309
316
|
updateFrameData(frameData) {
|
|
310
317
|
this._frameData = frameData;
|
|
@@ -355,6 +362,7 @@ export class Animation {
|
|
|
355
362
|
|
|
356
363
|
/**
|
|
357
364
|
* TBD.
|
|
365
|
+
* @returns {boolean} TBD.
|
|
358
366
|
*/
|
|
359
367
|
get paused() {
|
|
360
368
|
return this.isPaused;
|
|
@@ -374,6 +382,7 @@ export class Animation {
|
|
|
374
382
|
|
|
375
383
|
/**
|
|
376
384
|
* TBD.
|
|
385
|
+
* @returns {boolean} TBD.
|
|
377
386
|
*/
|
|
378
387
|
get reversed() {
|
|
379
388
|
return this.isReversed;
|
|
@@ -388,6 +397,7 @@ export class Animation {
|
|
|
388
397
|
|
|
389
398
|
/**
|
|
390
399
|
* TBD.
|
|
400
|
+
* @returns {number} TBD.
|
|
391
401
|
*/
|
|
392
402
|
get frameTotal() {
|
|
393
403
|
return this._frames.length;
|
|
@@ -395,6 +405,7 @@ export class Animation {
|
|
|
395
405
|
|
|
396
406
|
/**
|
|
397
407
|
* TBD.
|
|
408
|
+
* @returns {number} TBD.
|
|
398
409
|
*/
|
|
399
410
|
get frame() {
|
|
400
411
|
if (this.currentFrame !== null) {
|
|
@@ -419,6 +430,7 @@ export class Animation {
|
|
|
419
430
|
|
|
420
431
|
/**
|
|
421
432
|
* TBD.
|
|
433
|
+
* @returns {number} TBD.
|
|
422
434
|
*/
|
|
423
435
|
get speed() {
|
|
424
436
|
return 1000 / this.delay;
|
|
@@ -435,6 +447,7 @@ export class Animation {
|
|
|
435
447
|
|
|
436
448
|
/**
|
|
437
449
|
* TBD.
|
|
450
|
+
* @returns {boolean} TBD.
|
|
438
451
|
*/
|
|
439
452
|
get enableUpdate() {
|
|
440
453
|
return this.onUpdate !== null;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Animation } from './animation';
|
|
2
|
+
import { FrameData } from './frame_data';
|
|
3
|
+
import { Image } from '../display/image';
|
|
2
4
|
|
|
3
5
|
export class AnimationManager {
|
|
4
6
|
/**
|
|
5
7
|
* TBD.
|
|
6
|
-
* @param sprite - TBD.
|
|
8
|
+
* @param {Image} sprite - TBD.
|
|
7
9
|
*/
|
|
8
10
|
constructor(sprite) {
|
|
9
11
|
this.sprite = sprite;
|
|
@@ -36,8 +38,9 @@ export class AnimationManager {
|
|
|
36
38
|
|
|
37
39
|
/**
|
|
38
40
|
* TBD.
|
|
39
|
-
* @param frameData - TBD.
|
|
40
|
-
* @param frame - TBD.
|
|
41
|
+
* @param {FrameData} frameData - TBD.
|
|
42
|
+
* @param {number|string} frame - TBD.
|
|
43
|
+
* @returns {boolean} TBD.
|
|
41
44
|
*/
|
|
42
45
|
loadFrameData(frameData, frame) {
|
|
43
46
|
if (!frameData) {
|
|
@@ -65,8 +68,9 @@ export class AnimationManager {
|
|
|
65
68
|
|
|
66
69
|
/**
|
|
67
70
|
* TBD.
|
|
68
|
-
* @param frameData - TBD.
|
|
69
|
-
* @param frame - TBD.
|
|
71
|
+
* @param {FrameData} frameData - TBD.
|
|
72
|
+
* @param {number|string} frame - TBD.
|
|
73
|
+
* @returns {boolean} TBD.
|
|
70
74
|
*/
|
|
71
75
|
copyFrameData(frameData, frame) {
|
|
72
76
|
this._frameData = frameData.clone();
|
|
@@ -91,11 +95,12 @@ export class AnimationManager {
|
|
|
91
95
|
|
|
92
96
|
/**
|
|
93
97
|
* TBD.
|
|
94
|
-
* @param name - TBD.
|
|
95
|
-
* @param frameList - TBD.
|
|
96
|
-
* @param frameRate - TBD.
|
|
97
|
-
* @param loop - TBD.
|
|
98
|
-
* @param useNumericIndex - TBD.
|
|
98
|
+
* @param {string} name - TBD.
|
|
99
|
+
* @param {number[]|string[]} frameList - TBD.
|
|
100
|
+
* @param {number} frameRate - TBD.
|
|
101
|
+
* @param {boolean} loop - TBD.
|
|
102
|
+
* @param {boolean} useNumericIndex - TBD.
|
|
103
|
+
* @returns {Animation} TBD.
|
|
99
104
|
*/
|
|
100
105
|
add(name, frameList, frameRate = 60, loop = false, useNumericIndex = undefined) {
|
|
101
106
|
const frames = frameList || [];
|
|
@@ -127,8 +132,9 @@ export class AnimationManager {
|
|
|
127
132
|
|
|
128
133
|
/**
|
|
129
134
|
* TBD.
|
|
130
|
-
* @param frames - TBD.
|
|
131
|
-
* @param useNumericIndex - TBD.
|
|
135
|
+
* @param {string[]|number[]} frames - TBD.
|
|
136
|
+
* @param {boolean} useNumericIndex - TBD.
|
|
137
|
+
* @returns {boolean} TBD.
|
|
132
138
|
*/
|
|
133
139
|
validateFrames(frames, useNumericIndex = false) {
|
|
134
140
|
for (let i = 0; i < frames.length; i += 1) {
|
|
@@ -145,10 +151,11 @@ export class AnimationManager {
|
|
|
145
151
|
|
|
146
152
|
/**
|
|
147
153
|
* TBD.
|
|
148
|
-
* @param name - TBD.
|
|
149
|
-
* @param frameRate - TBD.
|
|
150
|
-
* @param loop - TBD.
|
|
151
|
-
* @param killOnComplete - TBD.
|
|
154
|
+
* @param {string} name - TBD.
|
|
155
|
+
* @param {number} frameRate - TBD.
|
|
156
|
+
* @param {boolean} loop - TBD.
|
|
157
|
+
* @param {boolean} killOnComplete - TBD.
|
|
158
|
+
* @returns {Animation} TBD.
|
|
152
159
|
*/
|
|
153
160
|
play(name, frameRate, loop, killOnComplete) {
|
|
154
161
|
if (this._anims[name]) {
|
|
@@ -172,8 +179,8 @@ export class AnimationManager {
|
|
|
172
179
|
|
|
173
180
|
/**
|
|
174
181
|
* TBD.
|
|
175
|
-
* @param name - TBD.
|
|
176
|
-
* @param resetFrame - TBD.
|
|
182
|
+
* @param {string} name - TBD.
|
|
183
|
+
* @param {boolean} resetFrame - TBD.
|
|
177
184
|
*/
|
|
178
185
|
stop(name, resetFrame = false) {
|
|
179
186
|
if (this.currentAnim && (typeof name !== 'string' || name === this.currentAnim.name)) {
|
|
@@ -183,6 +190,7 @@ export class AnimationManager {
|
|
|
183
190
|
|
|
184
191
|
/**
|
|
185
192
|
* TBD.
|
|
193
|
+
* @returns {boolean} TBD.
|
|
186
194
|
*/
|
|
187
195
|
update() {
|
|
188
196
|
if (this.updateIfVisible && !this.sprite.visible) {
|
|
@@ -197,7 +205,7 @@ export class AnimationManager {
|
|
|
197
205
|
|
|
198
206
|
/**
|
|
199
207
|
* TBD.
|
|
200
|
-
* @param quantity - TBD.
|
|
208
|
+
* @param {number} quantity - TBD.
|
|
201
209
|
*/
|
|
202
210
|
next(quantity) {
|
|
203
211
|
if (this.currentAnim) {
|
|
@@ -208,7 +216,7 @@ export class AnimationManager {
|
|
|
208
216
|
|
|
209
217
|
/**
|
|
210
218
|
* TBD.
|
|
211
|
-
* @param quantity - TBD.
|
|
219
|
+
* @param {number} quantity - TBD.
|
|
212
220
|
*/
|
|
213
221
|
previous(quantity) {
|
|
214
222
|
if (this.currentAnim) {
|
|
@@ -219,7 +227,8 @@ export class AnimationManager {
|
|
|
219
227
|
|
|
220
228
|
/**
|
|
221
229
|
* TBD.
|
|
222
|
-
* @param name - TBD.
|
|
230
|
+
* @param {string} name - TBD.
|
|
231
|
+
* @returns {Animation} TBD.
|
|
223
232
|
*/
|
|
224
233
|
getAnimation(name) {
|
|
225
234
|
if (name && this._anims[name]) {
|
|
@@ -239,6 +248,7 @@ export class AnimationManager {
|
|
|
239
248
|
|
|
240
249
|
/**
|
|
241
250
|
* TBD.
|
|
251
|
+
* @returns {FrameData} TBD.
|
|
242
252
|
*/
|
|
243
253
|
get frameData() {
|
|
244
254
|
return this._frameData;
|
|
@@ -246,6 +256,7 @@ export class AnimationManager {
|
|
|
246
256
|
|
|
247
257
|
/**
|
|
248
258
|
* TBD.
|
|
259
|
+
* @returns {number} TBD.
|
|
249
260
|
*/
|
|
250
261
|
get frameTotal() {
|
|
251
262
|
return this._frameData.total;
|
|
@@ -253,6 +264,7 @@ export class AnimationManager {
|
|
|
253
264
|
|
|
254
265
|
/**
|
|
255
266
|
* TBD.
|
|
267
|
+
* @returns {boolean} TBD.
|
|
256
268
|
*/
|
|
257
269
|
get paused() {
|
|
258
270
|
return this.currentAnim.isPaused;
|
|
@@ -267,6 +279,7 @@ export class AnimationManager {
|
|
|
267
279
|
|
|
268
280
|
/**
|
|
269
281
|
* TBD.
|
|
282
|
+
* @returns {string} TBD.
|
|
270
283
|
*/
|
|
271
284
|
get name() {
|
|
272
285
|
if (this.currentAnim) {
|
|
@@ -277,6 +290,7 @@ export class AnimationManager {
|
|
|
277
290
|
|
|
278
291
|
/**
|
|
279
292
|
* TBD.
|
|
293
|
+
* @returns {number} TBD.
|
|
280
294
|
*/
|
|
281
295
|
get frame() {
|
|
282
296
|
if (this.currentFrame) {
|
|
@@ -301,6 +315,7 @@ export class AnimationManager {
|
|
|
301
315
|
|
|
302
316
|
/**
|
|
303
317
|
* TBD.
|
|
318
|
+
* @returns {string} TBD.
|
|
304
319
|
*/
|
|
305
320
|
get frameName() {
|
|
306
321
|
if (this.currentFrame) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export class ArraySet {
|
|
2
2
|
/**
|
|
3
3
|
* TBD.
|
|
4
|
-
* @param list - TBD.
|
|
4
|
+
* @param {object[]} list - TBD.
|
|
5
5
|
*/
|
|
6
6
|
constructor(list = []) {
|
|
7
7
|
this.position = 0;
|
|
@@ -10,7 +10,8 @@ export class ArraySet {
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* TBD.
|
|
13
|
-
* @param item - TBD.
|
|
13
|
+
* @param {object} item - TBD.
|
|
14
|
+
* @returns {object} TBD.
|
|
14
15
|
*/
|
|
15
16
|
add(item) {
|
|
16
17
|
if (!this.exists(item)) {
|
|
@@ -21,7 +22,8 @@ export class ArraySet {
|
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* TBD.
|
|
24
|
-
* @param item - TBD.
|
|
25
|
+
* @param {object} item - TBD.
|
|
26
|
+
* @returns {number} TBD.
|
|
25
27
|
*/
|
|
26
28
|
getIndex(item) {
|
|
27
29
|
return this.list.indexOf(item);
|
|
@@ -29,8 +31,9 @@ export class ArraySet {
|
|
|
29
31
|
|
|
30
32
|
/**
|
|
31
33
|
* TBD.
|
|
32
|
-
* @param property - TBD.
|
|
33
|
-
* @param value - TBD.
|
|
34
|
+
* @param {string} property - TBD.
|
|
35
|
+
* @param {object} value - TBD.
|
|
36
|
+
* @returns {object} TBD.
|
|
34
37
|
*/
|
|
35
38
|
getByKey(property, value) {
|
|
36
39
|
let i = this.list.length;
|
|
@@ -45,7 +48,8 @@ export class ArraySet {
|
|
|
45
48
|
|
|
46
49
|
/**
|
|
47
50
|
* TBD.
|
|
48
|
-
* @param item - TBD.
|
|
51
|
+
* @param {object} item - TBD.
|
|
52
|
+
* @returns {boolean} TBD.
|
|
49
53
|
*/
|
|
50
54
|
exists(item) {
|
|
51
55
|
return this.list.indexOf(item) > -1;
|
|
@@ -60,7 +64,8 @@ export class ArraySet {
|
|
|
60
64
|
|
|
61
65
|
/**
|
|
62
66
|
* TBD.
|
|
63
|
-
* @param item - TBD.
|
|
67
|
+
* @param {object} item - TBD.
|
|
68
|
+
* @returns {object} TBD.
|
|
64
69
|
*/
|
|
65
70
|
remove(item) {
|
|
66
71
|
const idx = this.list.indexOf(item);
|
|
@@ -74,7 +79,7 @@ export class ArraySet {
|
|
|
74
79
|
/**
|
|
75
80
|
* TBD.
|
|
76
81
|
* @param {string} key - TBD.
|
|
77
|
-
* @param value - TBD.
|
|
82
|
+
* @param {object} value - TBD.
|
|
78
83
|
*/
|
|
79
84
|
setAll(key, value) {
|
|
80
85
|
let i = this.list.length;
|
|
@@ -103,7 +108,7 @@ export class ArraySet {
|
|
|
103
108
|
|
|
104
109
|
/**
|
|
105
110
|
* TBD.
|
|
106
|
-
* @param destroy - TBD.
|
|
111
|
+
* @param {boolean} destroy - TBD.
|
|
107
112
|
*/
|
|
108
113
|
removeAll(destroy = false) {
|
|
109
114
|
let i = this.list.length;
|
|
@@ -122,6 +127,7 @@ export class ArraySet {
|
|
|
122
127
|
|
|
123
128
|
/**
|
|
124
129
|
* TBD.
|
|
130
|
+
* @returns {number} TBD.
|
|
125
131
|
*/
|
|
126
132
|
get total() {
|
|
127
133
|
return this.list.length;
|
|
@@ -129,6 +135,7 @@ export class ArraySet {
|
|
|
129
135
|
|
|
130
136
|
/**
|
|
131
137
|
* TBD.
|
|
138
|
+
* @returns {object} TBD.
|
|
132
139
|
*/
|
|
133
140
|
get first() {
|
|
134
141
|
this.position = 0;
|
|
@@ -140,6 +147,7 @@ export class ArraySet {
|
|
|
140
147
|
|
|
141
148
|
/**
|
|
142
149
|
* TBD.
|
|
150
|
+
* @returns {object} TBD.
|
|
143
151
|
*/
|
|
144
152
|
get next() {
|
|
145
153
|
if (this.position < this.list.length) {
|