@vpmedia/phaser 1.20.0 → 1.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +2 -2
- package/src/phaser/core/animation.js +3 -6
- package/src/phaser/core/animation_manager.js +3 -5
- package/src/phaser/core/animation_parser.js +2 -3
- package/src/phaser/core/cache.js +37 -18
- package/src/phaser/core/dom.js +4 -5
- package/src/phaser/core/event_manager.js +1 -2
- package/src/phaser/core/factory.js +1 -2
- package/src/phaser/core/frame_data.js +7 -8
- package/src/phaser/core/input.js +13 -14
- package/src/phaser/core/input_handler.js +16 -19
- package/src/phaser/core/input_mouse.js +4 -5
- package/src/phaser/core/input_mspointer.js +1 -3
- package/src/phaser/core/input_pointer.js +2 -3
- package/src/phaser/core/input_touch.js +1 -3
- package/src/phaser/core/loader.js +70 -71
- package/src/phaser/core/raf.js +1 -3
- package/src/phaser/core/scale_manager.js +1 -2
- package/src/phaser/core/scene_manager.js +2 -3
- package/src/phaser/core/signal_binding.js +14 -7
- package/src/phaser/core/sound.js +1 -2
- package/src/phaser/core/sound_manager.js +1 -2
- package/src/phaser/core/sound_sprite.js +3 -6
- package/src/phaser/core/stage.js +1 -2
- package/src/phaser/core/time.js +1 -2
- package/src/phaser/core/timer.js +1 -2
- package/src/phaser/core/timer_event.js +1 -3
- package/src/phaser/core/tween.js +8 -10
- package/src/phaser/core/tween_data.js +1 -1
- package/src/phaser/core/tween_manager.js +1 -2
- package/src/phaser/core/world.js +1 -2
- package/src/phaser/display/bitmap_text.js +1 -2
- package/src/phaser/display/button.js +1 -2
- package/src/phaser/display/canvas/renderer.js +6 -7
- package/src/phaser/display/display_object.js +1 -0
- package/src/phaser/display/graphics.js +7 -9
- package/src/phaser/display/group.js +1 -2
- package/src/phaser/display/image.js +9 -10
- package/src/phaser/display/sprite_batch.js +1 -2
- package/src/phaser/display/sprite_util.js +2 -3
- package/src/phaser/display/text.js +43 -34
- package/src/phaser/display/webgl/abstract_filter.js +1 -1
- package/src/phaser/display/webgl/fast_sprite_batch.js +3 -3
- package/src/phaser/display/webgl/graphics.js +6 -6
- package/src/phaser/display/webgl/render_texture.js +1 -1
- package/src/phaser/display/webgl/renderer.js +8 -9
- package/src/phaser/display/webgl/shader/normal.js +1 -1
- package/src/phaser/display/webgl/shader_manager.js +3 -2
- package/src/phaser/display/webgl/sprite_batch.js +3 -5
- package/src/phaser/display/webgl/stencil_manager.js +6 -6
- package/src/phaser/display/webgl/texture.js +1 -2
- package/types/phaser/core/animation.d.ts +8 -11
- package/types/phaser/core/animation.d.ts.map +1 -1
- package/types/phaser/core/animation_manager.d.ts +10 -12
- package/types/phaser/core/animation_manager.d.ts.map +1 -1
- package/types/phaser/core/animation_parser.d.ts +4 -5
- package/types/phaser/core/animation_parser.d.ts.map +1 -1
- package/types/phaser/core/cache.d.ts +70 -48
- package/types/phaser/core/cache.d.ts.map +1 -1
- package/types/phaser/core/dom.d.ts +8 -9
- package/types/phaser/core/dom.d.ts.map +1 -1
- package/types/phaser/core/event_manager.d.ts +3 -4
- package/types/phaser/core/event_manager.d.ts.map +1 -1
- package/types/phaser/core/factory.d.ts +3 -4
- package/types/phaser/core/factory.d.ts.map +1 -1
- package/types/phaser/core/frame_data.d.ts +12 -13
- package/types/phaser/core/frame_data.d.ts.map +1 -1
- package/types/phaser/core/input.d.ts +22 -23
- package/types/phaser/core/input.d.ts.map +1 -1
- package/types/phaser/core/input_handler.d.ts +34 -37
- package/types/phaser/core/input_handler.d.ts.map +1 -1
- package/types/phaser/core/input_mouse.d.ts +5 -6
- package/types/phaser/core/input_mouse.d.ts.map +1 -1
- package/types/phaser/core/input_mspointer.d.ts +4 -5
- package/types/phaser/core/input_mspointer.d.ts.map +1 -1
- package/types/phaser/core/input_pointer.d.ts +5 -6
- package/types/phaser/core/input_pointer.d.ts.map +1 -1
- package/types/phaser/core/input_touch.d.ts +4 -5
- package/types/phaser/core/input_touch.d.ts.map +1 -1
- package/types/phaser/core/loader.d.ts +104 -105
- package/types/phaser/core/loader.d.ts.map +1 -1
- package/types/phaser/core/raf.d.ts +3 -4
- package/types/phaser/core/raf.d.ts.map +1 -1
- package/types/phaser/core/scale_manager.d.ts +3 -4
- package/types/phaser/core/scale_manager.d.ts.map +1 -1
- package/types/phaser/core/scene_manager.d.ts +5 -6
- package/types/phaser/core/scene_manager.d.ts.map +1 -1
- package/types/phaser/core/signal_binding.d.ts +22 -15
- package/types/phaser/core/signal_binding.d.ts.map +1 -1
- package/types/phaser/core/sound.d.ts +3 -4
- package/types/phaser/core/sound.d.ts.map +1 -1
- package/types/phaser/core/sound_manager.d.ts +3 -4
- package/types/phaser/core/sound_manager.d.ts.map +1 -1
- package/types/phaser/core/sound_sprite.d.ts +7 -9
- package/types/phaser/core/sound_sprite.d.ts.map +1 -1
- package/types/phaser/core/stage.d.ts +3 -4
- package/types/phaser/core/stage.d.ts.map +1 -1
- package/types/phaser/core/time.d.ts +3 -4
- package/types/phaser/core/time.d.ts.map +1 -1
- package/types/phaser/core/timer.d.ts +3 -4
- package/types/phaser/core/timer.d.ts.map +1 -1
- package/types/phaser/core/timer_event.d.ts +3 -4
- package/types/phaser/core/timer_event.d.ts.map +1 -1
- package/types/phaser/core/tween.d.ts +16 -19
- package/types/phaser/core/tween.d.ts.map +1 -1
- package/types/phaser/core/tween_data.d.ts +5 -5
- package/types/phaser/core/tween_data.d.ts.map +1 -1
- package/types/phaser/core/tween_manager.d.ts +3 -4
- package/types/phaser/core/tween_manager.d.ts.map +1 -1
- package/types/phaser/core/world.d.ts +2 -3
- package/types/phaser/core/world.d.ts.map +1 -1
- package/types/phaser/display/bitmap_text.d.ts +3 -4
- package/types/phaser/display/bitmap_text.d.ts.map +1 -1
- package/types/phaser/display/button.d.ts +2 -3
- package/types/phaser/display/button.d.ts.map +1 -1
- package/types/phaser/display/canvas/renderer.d.ts +9 -10
- package/types/phaser/display/canvas/renderer.d.ts.map +1 -1
- package/types/phaser/display/display_object.d.ts +4 -3
- package/types/phaser/display/display_object.d.ts.map +1 -1
- package/types/phaser/display/graphics.d.ts +13 -15
- package/types/phaser/display/graphics.d.ts.map +1 -1
- package/types/phaser/display/group.d.ts +3 -4
- package/types/phaser/display/group.d.ts.map +1 -1
- package/types/phaser/display/image.d.ts +22 -22
- package/types/phaser/display/image.d.ts.map +1 -1
- package/types/phaser/display/sprite_batch.d.ts +3 -4
- package/types/phaser/display/sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/sprite_util.d.ts +4 -5
- package/types/phaser/display/sprite_util.d.ts.map +1 -1
- package/types/phaser/display/text.d.ts +63 -53
- 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/fast_sprite_batch.d.ts +6 -6
- package/types/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/webgl/graphics.d.ts +13 -12
- package/types/phaser/display/webgl/graphics.d.ts.map +1 -1
- package/types/phaser/display/webgl/render_texture.d.ts +3 -3
- package/types/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/renderer.d.ts +12 -13
- package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/normal.d.ts +2 -2
- package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader_manager.d.ts +6 -5
- package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/sprite_batch.d.ts +5 -7
- package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/webgl/stencil_manager.d.ts +9 -9
- package/types/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/texture.d.ts +3 -4
- package/types/phaser/display/webgl/texture.d.ts.map +1 -1
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { Point } from '../geom/point';
|
|
2
2
|
import { GROUP } from './const';
|
|
3
3
|
import { distance } from '../util/math';
|
|
4
|
-
import { Pointer } from './input_pointer';
|
|
5
|
-
import { Rectangle } from '../geom/rectangle';
|
|
6
|
-
import { DisplayObject } from '../display/display_object';
|
|
7
4
|
|
|
8
5
|
export class InputHandler {
|
|
9
6
|
/**
|
|
10
7
|
* TBD.
|
|
11
|
-
* @param sprite
|
|
8
|
+
* @param {Image} sprite - TBD.
|
|
12
9
|
*/
|
|
13
10
|
constructor(sprite) {
|
|
14
11
|
this.sprite = sprite;
|
|
@@ -75,7 +72,7 @@ export class InputHandler {
|
|
|
75
72
|
* TBD.
|
|
76
73
|
* @param {number} priority - TBD.
|
|
77
74
|
* @param {boolean} useHandCursor - TBD.
|
|
78
|
-
* @returns {DisplayObject} TBD.
|
|
75
|
+
* @returns {import('../display/display_object').DisplayObject} TBD.
|
|
79
76
|
*/
|
|
80
77
|
start(priority = 0, useHandCursor = false) {
|
|
81
78
|
// Turning on
|
|
@@ -346,7 +343,7 @@ export class InputHandler {
|
|
|
346
343
|
|
|
347
344
|
/**
|
|
348
345
|
* TBD.
|
|
349
|
-
* @param {Pointer} pointer - TBD.
|
|
346
|
+
* @param {import('./input_pointer').Pointer} pointer - TBD.
|
|
350
347
|
* @param {boolean} fastTest - TBD.
|
|
351
348
|
* @returns {boolean} TBD.
|
|
352
349
|
*/
|
|
@@ -375,7 +372,7 @@ export class InputHandler {
|
|
|
375
372
|
|
|
376
373
|
/**
|
|
377
374
|
* TBD.
|
|
378
|
-
* @param {Pointer} pointer - TBD.
|
|
375
|
+
* @param {import('./input_pointer').Pointer} pointer - TBD.
|
|
379
376
|
* @param {boolean} fastTest - TBD.
|
|
380
377
|
* @returns {boolean} TBD.
|
|
381
378
|
*/
|
|
@@ -405,7 +402,7 @@ export class InputHandler {
|
|
|
405
402
|
* TBD.
|
|
406
403
|
* @param {number} x - TBD.
|
|
407
404
|
* @param {number} y - TBD.
|
|
408
|
-
* @param {Pointer} pointer - TBD.
|
|
405
|
+
* @param {import('./input_pointer').Pointer} pointer - TBD.
|
|
409
406
|
* @returns {boolean} TBD.
|
|
410
407
|
*/
|
|
411
408
|
checkPixel(x, y, pointer) {
|
|
@@ -454,7 +451,7 @@ export class InputHandler {
|
|
|
454
451
|
|
|
455
452
|
/**
|
|
456
453
|
* TBD.
|
|
457
|
-
* @param {Pointer} pointer - TBD.
|
|
454
|
+
* @param {import('./input_pointer').Pointer} pointer - TBD.
|
|
458
455
|
* @returns {boolean} TBD.
|
|
459
456
|
*/
|
|
460
457
|
update(pointer) {
|
|
@@ -491,7 +488,7 @@ export class InputHandler {
|
|
|
491
488
|
|
|
492
489
|
/**
|
|
493
490
|
* TBD.
|
|
494
|
-
* @param {Pointer} pointer - TBD.
|
|
491
|
+
* @param {import('./input_pointer').Pointer} pointer - TBD.
|
|
495
492
|
* @param {boolean} silent - TBD.
|
|
496
493
|
*/
|
|
497
494
|
_pointerOverHandler(pointer, silent) {
|
|
@@ -522,7 +519,7 @@ export class InputHandler {
|
|
|
522
519
|
|
|
523
520
|
/**
|
|
524
521
|
* TBD.
|
|
525
|
-
* @param {Pointer} pointer - TBD.
|
|
522
|
+
* @param {import('./input_pointer').Pointer} pointer - TBD.
|
|
526
523
|
* @param {boolean} silent - TBD.
|
|
527
524
|
*/
|
|
528
525
|
_pointerOutHandler(pointer, silent = false) {
|
|
@@ -548,7 +545,7 @@ export class InputHandler {
|
|
|
548
545
|
|
|
549
546
|
/**
|
|
550
547
|
* TBD.
|
|
551
|
-
* @param {Pointer} pointer - TBD.
|
|
548
|
+
* @param {import('./input_pointer').Pointer} pointer - TBD.
|
|
552
549
|
*/
|
|
553
550
|
_touchedHandler(pointer) {
|
|
554
551
|
if (this.sprite === null) {
|
|
@@ -600,7 +597,7 @@ export class InputHandler {
|
|
|
600
597
|
|
|
601
598
|
/**
|
|
602
599
|
* TBD.
|
|
603
|
-
* @param {Pointer} pointer - TBD.
|
|
600
|
+
* @param {import('./input_pointer').Pointer} pointer - TBD.
|
|
604
601
|
*/
|
|
605
602
|
dragTimeElapsed(pointer) {
|
|
606
603
|
this._dragTimePass = true;
|
|
@@ -613,7 +610,7 @@ export class InputHandler {
|
|
|
613
610
|
|
|
614
611
|
/**
|
|
615
612
|
* TBD.
|
|
616
|
-
* @param {Pointer} pointer - TBD.
|
|
613
|
+
* @param {import('./input_pointer').Pointer} pointer - TBD.
|
|
617
614
|
*/
|
|
618
615
|
_releasedHandler(pointer) {
|
|
619
616
|
if (this.sprite === null) {
|
|
@@ -661,7 +658,7 @@ export class InputHandler {
|
|
|
661
658
|
|
|
662
659
|
/**
|
|
663
660
|
* TBD.
|
|
664
|
-
* @param {Pointer} pointer - TBD.
|
|
661
|
+
* @param {import('./input_pointer').Pointer} pointer - TBD.
|
|
665
662
|
* @param {boolean} fromStart - TBD.
|
|
666
663
|
* @returns {boolean} TBD.
|
|
667
664
|
*/
|
|
@@ -769,8 +766,8 @@ export class InputHandler {
|
|
|
769
766
|
* @param {boolean} bringToTop - TBD.
|
|
770
767
|
* @param {boolean} pixelPerfect - TBD.
|
|
771
768
|
* @param {number} alphaThreshold - TBD.
|
|
772
|
-
* @param {Rectangle} boundsRect - TBD.
|
|
773
|
-
* @param {DisplayObject} boundsSprite - TBD.
|
|
769
|
+
* @param {import('../geom/rectangle').Rectangle} boundsRect - TBD.
|
|
770
|
+
* @param {import('../display/display_object').DisplayObject} boundsSprite - TBD.
|
|
774
771
|
*/
|
|
775
772
|
enableDrag(
|
|
776
773
|
lockCenter = false,
|
|
@@ -812,7 +809,7 @@ export class InputHandler {
|
|
|
812
809
|
|
|
813
810
|
/**
|
|
814
811
|
* TBD.
|
|
815
|
-
* @param {Pointer} pointer - TBD.
|
|
812
|
+
* @param {import('./input_pointer').Pointer} pointer - TBD.
|
|
816
813
|
*/
|
|
817
814
|
startDrag(pointer) {
|
|
818
815
|
const x = this.sprite.x;
|
|
@@ -869,7 +866,7 @@ export class InputHandler {
|
|
|
869
866
|
|
|
870
867
|
/**
|
|
871
868
|
* TBD.
|
|
872
|
-
* @param {Pointer} pointer - TBD.
|
|
869
|
+
* @param {import('./input_pointer').Pointer} pointer - TBD.
|
|
873
870
|
*/
|
|
874
871
|
stopDrag(pointer) {
|
|
875
872
|
this.isDragged = false;
|
|
@@ -7,13 +7,11 @@ const FORWARD_BUTTON = 4;
|
|
|
7
7
|
const WHEEL_UP = 1;
|
|
8
8
|
const WHEEL_DOWN = -1; */
|
|
9
9
|
|
|
10
|
-
import { Game } from './game';
|
|
11
|
-
|
|
12
10
|
class WheelEventProxy {
|
|
13
11
|
/**
|
|
14
12
|
* TBD.
|
|
15
|
-
* @param scaleFactor - TBD.
|
|
16
|
-
* @param deltaMode - TBD.
|
|
13
|
+
* @param {number} scaleFactor - TBD.
|
|
14
|
+
* @param {number} deltaMode - TBD.
|
|
17
15
|
*/
|
|
18
16
|
constructor(scaleFactor, deltaMode) {
|
|
19
17
|
this._scaleFactor = scaleFactor;
|
|
@@ -48,6 +46,7 @@ class WheelEventProxy {
|
|
|
48
46
|
|
|
49
47
|
/**
|
|
50
48
|
* TBD.
|
|
49
|
+
* @returns {number} TBD.
|
|
51
50
|
*/
|
|
52
51
|
get deltaMode() {
|
|
53
52
|
return this._deltaMode;
|
|
@@ -73,7 +72,7 @@ class WheelEventProxy {
|
|
|
73
72
|
export class Mouse {
|
|
74
73
|
/**
|
|
75
74
|
* TBD.
|
|
76
|
-
* @param {Game} game - TBD.
|
|
75
|
+
* @param {import('./game').Game} game - TBD.
|
|
77
76
|
*/
|
|
78
77
|
constructor(game) {
|
|
79
78
|
this.game = game;
|
|
@@ -8,12 +8,11 @@ import {
|
|
|
8
8
|
TOUCH_OVERRIDES_MOUSE,
|
|
9
9
|
MOUSE_TOUCH_COMBINE,
|
|
10
10
|
} from './const';
|
|
11
|
-
import { Game } from './game';
|
|
12
11
|
|
|
13
12
|
export class Pointer {
|
|
14
13
|
/**
|
|
15
14
|
* TBD.
|
|
16
|
-
* @param {Game} game - TBD.
|
|
15
|
+
* @param {import('./game').Game} game - TBD.
|
|
17
16
|
* @param {number} id - TBD.
|
|
18
17
|
* @param {number} pointerMode - TBD.
|
|
19
18
|
*/
|
|
@@ -302,7 +301,7 @@ export class Pointer {
|
|
|
302
301
|
|
|
303
302
|
/**
|
|
304
303
|
* TBD.
|
|
305
|
-
* @param newTarget - TBD.
|
|
304
|
+
* @param {import('./input_handler').InputHandler} newTarget - TBD.
|
|
306
305
|
* @param {boolean} silent - TBD.
|
|
307
306
|
*/
|
|
308
307
|
swapTarget(newTarget, silent = false) {
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { Signal } from './signal';
|
|
2
2
|
import { Rectangle } from '../geom/rectangle';
|
|
3
3
|
import { canPlayAudio } from './device_util';
|
|
4
|
-
import { Game } from './game';
|
|
5
4
|
|
|
6
5
|
const TEXTURE_ATLAS_JSON_HASH = 1;
|
|
7
6
|
|
|
8
7
|
export class Loader {
|
|
9
8
|
/**
|
|
10
9
|
* TBD.
|
|
11
|
-
* @param {Game} game - TBD.
|
|
10
|
+
* @param {import('./game').Game} game - TBD.
|
|
12
11
|
*/
|
|
13
12
|
constructor(game) {
|
|
14
13
|
this.game = game;
|
|
@@ -47,8 +46,8 @@ export class Loader {
|
|
|
47
46
|
|
|
48
47
|
/**
|
|
49
48
|
* TBD.
|
|
50
|
-
* @param sprite - TBD.
|
|
51
|
-
* @param direction - TBD.
|
|
49
|
+
* @param {Image} sprite - TBD.
|
|
50
|
+
* @param {number} direction - TBD.
|
|
52
51
|
*/
|
|
53
52
|
setPreloadSprite(sprite, direction = 0) {
|
|
54
53
|
this.preloadSprite = {
|
|
@@ -80,7 +79,7 @@ export class Loader {
|
|
|
80
79
|
|
|
81
80
|
/**
|
|
82
81
|
* TBD.
|
|
83
|
-
* @param type - TBD.
|
|
82
|
+
* @param {string} type - TBD.
|
|
84
83
|
* @param {string} key - TBD.
|
|
85
84
|
* @returns {boolean} TBD.
|
|
86
85
|
*/
|
|
@@ -90,7 +89,7 @@ export class Loader {
|
|
|
90
89
|
|
|
91
90
|
/**
|
|
92
91
|
* TBD.
|
|
93
|
-
* @param type - TBD.
|
|
92
|
+
* @param {string} type - TBD.
|
|
94
93
|
* @param {string} key - TBD.
|
|
95
94
|
* @returns {number} TBD.
|
|
96
95
|
*/
|
|
@@ -112,7 +111,7 @@ export class Loader {
|
|
|
112
111
|
|
|
113
112
|
/**
|
|
114
113
|
* TBD.
|
|
115
|
-
* @param type - TBD.
|
|
114
|
+
* @param {string} type - TBD.
|
|
116
115
|
* @param {string} key - TBD.
|
|
117
116
|
* @returns {object} TBD.
|
|
118
117
|
*/
|
|
@@ -126,10 +125,10 @@ export class Loader {
|
|
|
126
125
|
|
|
127
126
|
/**
|
|
128
127
|
* TBD.
|
|
129
|
-
* @param hard
|
|
130
|
-
* @param clearEvents
|
|
128
|
+
* @param {boolean} hard - TBD.
|
|
129
|
+
* @param {boolean} clearEvents - TBD.
|
|
131
130
|
*/
|
|
132
|
-
reset(hard, clearEvents = false) {
|
|
131
|
+
reset(hard = false, clearEvents = false) {
|
|
133
132
|
if (hard) {
|
|
134
133
|
this.preloadSprite = null;
|
|
135
134
|
}
|
|
@@ -154,12 +153,12 @@ export class Loader {
|
|
|
154
153
|
|
|
155
154
|
/**
|
|
156
155
|
* TBD.
|
|
157
|
-
* @param type - TBD.
|
|
156
|
+
* @param {string} type - TBD.
|
|
158
157
|
* @param {string} key - TBD.
|
|
159
158
|
* @param {string} url - TBD.
|
|
160
|
-
* @param properties - TBD.
|
|
161
|
-
* @param overwrite - TBD.
|
|
162
|
-
* @param extension - TBD.
|
|
159
|
+
* @param {object} properties - TBD.
|
|
160
|
+
* @param {boolean} overwrite - TBD.
|
|
161
|
+
* @param {string} extension - TBD.
|
|
163
162
|
* @returns {Loader} TBD.
|
|
164
163
|
*/
|
|
165
164
|
addToFileList(type, key = '', url = null, properties = null, overwrite = false, extension = null) {
|
|
@@ -211,10 +210,10 @@ export class Loader {
|
|
|
211
210
|
|
|
212
211
|
/**
|
|
213
212
|
* TBD.
|
|
214
|
-
* @param type - TBD.
|
|
213
|
+
* @param {string} type - TBD.
|
|
215
214
|
* @param {string} key - TBD.
|
|
216
215
|
* @param {string} url - TBD.
|
|
217
|
-
* @param properties - TBD.
|
|
216
|
+
* @param {object} properties - TBD.
|
|
218
217
|
* @returns {Loader} TBD.
|
|
219
218
|
*/
|
|
220
219
|
replaceInFileList(type, key, url, properties) {
|
|
@@ -225,7 +224,7 @@ export class Loader {
|
|
|
225
224
|
* TBD.
|
|
226
225
|
* @param {string} key - TBD.
|
|
227
226
|
* @param {string} url - TBD.
|
|
228
|
-
* @param data - TBD.
|
|
227
|
+
* @param {object} data - TBD.
|
|
229
228
|
* @param {object} callbackContext - TBD.
|
|
230
229
|
* @returns {Loader} TBD.
|
|
231
230
|
*/
|
|
@@ -264,17 +263,17 @@ export class Loader {
|
|
|
264
263
|
* TBD.
|
|
265
264
|
* @param {string} key - TBD.
|
|
266
265
|
* @param {string} url - TBD.
|
|
267
|
-
* @param overwrite - TBD.
|
|
266
|
+
* @param {boolean} overwrite - TBD.
|
|
268
267
|
* @returns {Loader} TBD.
|
|
269
268
|
*/
|
|
270
|
-
image(key, url, overwrite) {
|
|
269
|
+
image(key, url, overwrite = false) {
|
|
271
270
|
return this.addToFileList('image', key, url, undefined, overwrite, '.png');
|
|
272
271
|
}
|
|
273
272
|
|
|
274
273
|
/**
|
|
275
274
|
* TBD.
|
|
276
|
-
* @param keys - TBD.
|
|
277
|
-
* @param urls - TBD.
|
|
275
|
+
* @param {string[]} keys - TBD.
|
|
276
|
+
* @param {string[]} urls - TBD.
|
|
278
277
|
* @returns {Loader} TBD.
|
|
279
278
|
*/
|
|
280
279
|
images(keys, urls) {
|
|
@@ -294,7 +293,7 @@ export class Loader {
|
|
|
294
293
|
* TBD.
|
|
295
294
|
* @param {string} key - TBD.
|
|
296
295
|
* @param {string} url - TBD.
|
|
297
|
-
* @param overwrite - TBD.
|
|
296
|
+
* @param {boolean} overwrite - TBD.
|
|
298
297
|
* @returns {Loader} TBD.
|
|
299
298
|
*/
|
|
300
299
|
text(key, url, overwrite) {
|
|
@@ -305,7 +304,7 @@ export class Loader {
|
|
|
305
304
|
* TBD.
|
|
306
305
|
* @param {string} key - TBD.
|
|
307
306
|
* @param {string} url - TBD.
|
|
308
|
-
* @param overwrite - TBD.
|
|
307
|
+
* @param {boolean} overwrite - TBD.
|
|
309
308
|
* @returns {Loader} TBD.
|
|
310
309
|
*/
|
|
311
310
|
json(key, url, overwrite) {
|
|
@@ -316,7 +315,7 @@ export class Loader {
|
|
|
316
315
|
* TBD.
|
|
317
316
|
* @param {string} key - TBD.
|
|
318
317
|
* @param {string} url - TBD.
|
|
319
|
-
* @param overwrite - TBD.
|
|
318
|
+
* @param {boolean} overwrite - TBD.
|
|
320
319
|
* @returns {Loader} TBD.
|
|
321
320
|
*/
|
|
322
321
|
xml(key, url, overwrite) {
|
|
@@ -327,11 +326,11 @@ export class Loader {
|
|
|
327
326
|
* TBD.
|
|
328
327
|
* @param {string} key - TBD.
|
|
329
328
|
* @param {string} url - TBD.
|
|
330
|
-
* @param frameWidth - TBD.
|
|
331
|
-
* @param frameHeight - TBD.
|
|
332
|
-
* @param frameMax - TBD.
|
|
333
|
-
* @param margin - TBD.
|
|
334
|
-
* @param spacing - TBD.
|
|
329
|
+
* @param {number} frameWidth - TBD.
|
|
330
|
+
* @param {number} frameHeight - TBD.
|
|
331
|
+
* @param {number} frameMax - TBD.
|
|
332
|
+
* @param {number} margin - TBD.
|
|
333
|
+
* @param {number} spacing - TBD.
|
|
335
334
|
* @returns {Loader} TBD.
|
|
336
335
|
*/
|
|
337
336
|
spritesheet(key, url, frameWidth, frameHeight, frameMax = -1, margin = 0, spacing = 0) {
|
|
@@ -348,8 +347,8 @@ export class Loader {
|
|
|
348
347
|
/**
|
|
349
348
|
* TBD.
|
|
350
349
|
* @param {string} key - TBD.
|
|
351
|
-
* @param urls
|
|
352
|
-
* @param autoDecode
|
|
350
|
+
* @param {string[]} urls - TBD.
|
|
351
|
+
* @param {boolean} autoDecode - TBD.
|
|
353
352
|
* @returns {Loader} TBD.
|
|
354
353
|
*/
|
|
355
354
|
audio(key, urls, autoDecode = true) {
|
|
@@ -365,10 +364,10 @@ export class Loader {
|
|
|
365
364
|
/**
|
|
366
365
|
* TBD.
|
|
367
366
|
* @param {string} key - TBD.
|
|
368
|
-
* @param urls - TBD.
|
|
369
|
-
* @param jsonURL - TBD.
|
|
370
|
-
* @param jsonData - TBD.
|
|
371
|
-
* @param autoDecode - TBD.
|
|
367
|
+
* @param {string} urls - TBD.
|
|
368
|
+
* @param {string} jsonURL - TBD.
|
|
369
|
+
* @param {object} jsonData - TBD.
|
|
370
|
+
* @param {boolean} autoDecode - TBD.
|
|
372
371
|
* @returns {Loader} TBD.
|
|
373
372
|
*/
|
|
374
373
|
audioSprite(key, urls, jsonURL, jsonData, autoDecode = true) {
|
|
@@ -390,11 +389,11 @@ export class Loader {
|
|
|
390
389
|
/**
|
|
391
390
|
* TBD.
|
|
392
391
|
* @param {string} key - TBD.
|
|
393
|
-
* @param textureURL - TBD.
|
|
394
|
-
* @param atlasURL - TBD.
|
|
395
|
-
* @param atlasData - TBD.
|
|
396
|
-
* @param xSpacing - TBD.
|
|
397
|
-
* @param ySpacing - TBD.
|
|
392
|
+
* @param {string} textureURL - TBD.
|
|
393
|
+
* @param {string} atlasURL - TBD.
|
|
394
|
+
* @param {object} atlasData - TBD.
|
|
395
|
+
* @param {number} xSpacing - TBD.
|
|
396
|
+
* @param {number} ySpacing - TBD.
|
|
398
397
|
* @returns {Loader} TBD.
|
|
399
398
|
* @throws Error.
|
|
400
399
|
*/
|
|
@@ -434,10 +433,10 @@ export class Loader {
|
|
|
434
433
|
/**
|
|
435
434
|
* TBD.
|
|
436
435
|
* @param {string} key - TBD.
|
|
437
|
-
* @param textureURL - TBD.
|
|
438
|
-
* @param atlasURL - TBD.
|
|
439
|
-
* @param atlasData - TBD.
|
|
440
|
-
* @param format - TBD.
|
|
436
|
+
* @param {string} textureURL - TBD.
|
|
437
|
+
* @param {string} atlasURL - TBD.
|
|
438
|
+
* @param {object} atlasData - TBD.
|
|
439
|
+
* @param {number} format - TBD.
|
|
441
440
|
* @returns {Loader} TBD.
|
|
442
441
|
*/
|
|
443
442
|
atlas(key, textureURL, atlasURL = null, atlasData = null, format = TEXTURE_ATLAS_JSON_HASH) {
|
|
@@ -474,7 +473,7 @@ export class Loader {
|
|
|
474
473
|
|
|
475
474
|
/**
|
|
476
475
|
* TBD.
|
|
477
|
-
* @param type - TBD.
|
|
476
|
+
* @param {string} type - TBD.
|
|
478
477
|
* @param {string} key - TBD.
|
|
479
478
|
* @returns {Loader} TBD.
|
|
480
479
|
*/
|
|
@@ -488,7 +487,7 @@ export class Loader {
|
|
|
488
487
|
|
|
489
488
|
/**
|
|
490
489
|
* TBD.
|
|
491
|
-
* @param type - TBD.
|
|
490
|
+
* @param {string} type - TBD.
|
|
492
491
|
* @param {string} key - TBD.
|
|
493
492
|
*/
|
|
494
493
|
removeFile(type, key) {
|
|
@@ -621,7 +620,7 @@ export class Loader {
|
|
|
621
620
|
|
|
622
621
|
/**
|
|
623
622
|
* TBD.
|
|
624
|
-
* @param abnormal - TBD.
|
|
623
|
+
* @param {boolean} abnormal - TBD.
|
|
625
624
|
*/
|
|
626
625
|
finishedLoading(abnormal) {
|
|
627
626
|
if (this.hasLoaded) {
|
|
@@ -644,8 +643,8 @@ export class Loader {
|
|
|
644
643
|
|
|
645
644
|
/**
|
|
646
645
|
* TBD.
|
|
647
|
-
* @param file - TBD.
|
|
648
|
-
* @param errorMessage - TBD.
|
|
646
|
+
* @param {object} file - TBD.
|
|
647
|
+
* @param {string} errorMessage - TBD.
|
|
649
648
|
*/
|
|
650
649
|
asyncComplete(file, errorMessage = '') {
|
|
651
650
|
file.loaded = true;
|
|
@@ -660,7 +659,7 @@ export class Loader {
|
|
|
660
659
|
|
|
661
660
|
/**
|
|
662
661
|
* TBD.
|
|
663
|
-
* @param pack - TBD.
|
|
662
|
+
* @param {object} pack - TBD.
|
|
664
663
|
*/
|
|
665
664
|
processPack(pack) {
|
|
666
665
|
const packData = pack.data[pack.key];
|
|
@@ -724,7 +723,7 @@ export class Loader {
|
|
|
724
723
|
/**
|
|
725
724
|
* TBD.
|
|
726
725
|
* @param {string} url - TBD.
|
|
727
|
-
* @param file - TBD.
|
|
726
|
+
* @param {object} file - TBD.
|
|
728
727
|
* @returns {string} TBD.
|
|
729
728
|
*/
|
|
730
729
|
transformUrl(url, file) {
|
|
@@ -739,7 +738,7 @@ export class Loader {
|
|
|
739
738
|
|
|
740
739
|
/**
|
|
741
740
|
* TBD.
|
|
742
|
-
* @param file - TBD.
|
|
741
|
+
* @param {object} file - TBD.
|
|
743
742
|
*/
|
|
744
743
|
loadFile(file) {
|
|
745
744
|
switch (file.type) {
|
|
@@ -777,7 +776,7 @@ export class Loader {
|
|
|
777
776
|
|
|
778
777
|
/**
|
|
779
778
|
* TBD.
|
|
780
|
-
* @param file - TBD.
|
|
779
|
+
* @param {object} file - TBD.
|
|
781
780
|
*/
|
|
782
781
|
loadImageTag(file) {
|
|
783
782
|
this.log('loadImageTag', file);
|
|
@@ -809,13 +808,13 @@ export class Loader {
|
|
|
809
808
|
|
|
810
809
|
/**
|
|
811
810
|
* TBD.
|
|
812
|
-
* @param file - TBD.
|
|
811
|
+
* @param {object} file - TBD.
|
|
813
812
|
* @param {string} url - TBD.
|
|
814
|
-
* @param type - TBD.
|
|
815
|
-
* @param onload - TBD.
|
|
816
|
-
* @param onerror - TBD.
|
|
813
|
+
* @param {string} type - TBD.
|
|
814
|
+
* @param {Function} onload - TBD.
|
|
815
|
+
* @param {Function} onerror - TBD.
|
|
817
816
|
*/
|
|
818
|
-
xhrLoad(file, url, type, onload, onerror) {
|
|
817
|
+
xhrLoad(file, url, type, onload, onerror = null) {
|
|
819
818
|
this.log('xhrLoad', file);
|
|
820
819
|
const scope = this;
|
|
821
820
|
const xhr = new XMLHttpRequest();
|
|
@@ -884,7 +883,7 @@ export class Loader {
|
|
|
884
883
|
|
|
885
884
|
/**
|
|
886
885
|
* TBD.
|
|
887
|
-
* @param urls - TBD.
|
|
886
|
+
* @param {object[]} urls - TBD.
|
|
888
887
|
* @returns {string} TBD.
|
|
889
888
|
*/
|
|
890
889
|
getAudioURL(urls) {
|
|
@@ -922,9 +921,9 @@ export class Loader {
|
|
|
922
921
|
|
|
923
922
|
/**
|
|
924
923
|
* TBD.
|
|
925
|
-
* @param file - TBD.
|
|
926
|
-
* @param xhr - TBD.
|
|
927
|
-
* @param reason - TBD.
|
|
924
|
+
* @param {object} file - TBD.
|
|
925
|
+
* @param {XMLHttpRequest} xhr - TBD.
|
|
926
|
+
* @param {number} reason - TBD.
|
|
928
927
|
*/
|
|
929
928
|
fileError(file, xhr, reason) {
|
|
930
929
|
// const url = file.requestUrl || this.transformUrl(file.url, file);
|
|
@@ -940,8 +939,8 @@ export class Loader {
|
|
|
940
939
|
|
|
941
940
|
/**
|
|
942
941
|
* TBD.
|
|
943
|
-
* @param file - TBD.
|
|
944
|
-
* @param xhr - TBD.
|
|
942
|
+
* @param {object} file - TBD.
|
|
943
|
+
* @param {XMLHttpRequest} xhr - TBD.
|
|
945
944
|
* @throws Error.
|
|
946
945
|
*/
|
|
947
946
|
fileComplete(file, xhr) {
|
|
@@ -1032,8 +1031,8 @@ export class Loader {
|
|
|
1032
1031
|
|
|
1033
1032
|
/**
|
|
1034
1033
|
* TBD.
|
|
1035
|
-
* @param file - TBD.
|
|
1036
|
-
* @param xhr - TBD.
|
|
1034
|
+
* @param {object} file - TBD.
|
|
1035
|
+
* @param {XMLHttpRequest} xhr - TBD.
|
|
1037
1036
|
*/
|
|
1038
1037
|
jsonLoadComplete(file, xhr) {
|
|
1039
1038
|
const data = JSON.parse(xhr.responseText);
|
|
@@ -1057,8 +1056,8 @@ export class Loader {
|
|
|
1057
1056
|
|
|
1058
1057
|
/**
|
|
1059
1058
|
* TBD.
|
|
1060
|
-
* @param file - TBD.
|
|
1061
|
-
* @param xhr - TBD.
|
|
1059
|
+
* @param {object} file - TBD.
|
|
1060
|
+
* @param {XMLHttpRequest} xhr - TBD.
|
|
1062
1061
|
*/
|
|
1063
1062
|
xmlLoadComplete(file, xhr) {
|
|
1064
1063
|
// Always try parsing the content as XML, regardless of actually response type
|
|
@@ -1082,7 +1081,7 @@ export class Loader {
|
|
|
1082
1081
|
|
|
1083
1082
|
/**
|
|
1084
1083
|
* TBD.
|
|
1085
|
-
* @param data - TBD.
|
|
1084
|
+
* @param {object} data - TBD.
|
|
1086
1085
|
* @returns {Document} TBD.
|
|
1087
1086
|
*/
|
|
1088
1087
|
parseXml(data) {
|
|
@@ -1127,8 +1126,8 @@ export class Loader {
|
|
|
1127
1126
|
|
|
1128
1127
|
/**
|
|
1129
1128
|
* TBD.
|
|
1130
|
-
* @param message - TBD.
|
|
1131
|
-
* @param data - TBD.
|
|
1129
|
+
* @param {string} message - TBD.
|
|
1130
|
+
* @param {string|object} data - TBD.
|
|
1132
1131
|
*/
|
|
1133
1132
|
log(message, data = '') {
|
|
1134
1133
|
if (!this.isUseLog) {
|
package/src/phaser/core/raf.js
CHANGED
|
@@ -3,12 +3,11 @@ import { DOM } from './dom';
|
|
|
3
3
|
import { Point } from '../geom/point';
|
|
4
4
|
import { Rectangle } from '../geom/rectangle';
|
|
5
5
|
import { SCALE_OFF, SCALE_RESIZE, SCALE_EXACT_FIT, SCALE_USER, SCALE_SHOW_ALL, RENDER_CANVAS } from './const';
|
|
6
|
-
import { Game } from './game';
|
|
7
6
|
|
|
8
7
|
export class ScaleManager {
|
|
9
8
|
/**
|
|
10
9
|
* TBD.
|
|
11
|
-
* @param {Game} game - TBD.
|
|
10
|
+
* @param {import('./game').Game} game - TBD.
|
|
12
11
|
* @param {number} width - TBD.
|
|
13
12
|
* @param {number} height - TBD.
|
|
14
13
|
*/
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Game } from './game';
|
|
2
1
|
import { Scene } from './scene';
|
|
3
2
|
|
|
4
3
|
export class SceneManager {
|
|
5
4
|
/**
|
|
6
5
|
* TBD.
|
|
7
|
-
* @param {Game} game - TBD.
|
|
6
|
+
* @param {import('./game').Game} game - TBD.
|
|
8
7
|
* @param {string} pendingState - TBD.
|
|
9
8
|
*/
|
|
10
9
|
constructor(game, pendingState) {
|
|
@@ -40,7 +39,7 @@ export class SceneManager {
|
|
|
40
39
|
/**
|
|
41
40
|
* TBD.
|
|
42
41
|
* @param {string} key - TBD.
|
|
43
|
-
* @param state - TBD.
|
|
42
|
+
* @param {object} state - TBD.
|
|
44
43
|
* @param {boolean} autoStart - TBD.
|
|
45
44
|
* @returns {Scene|object} TBD.
|
|
46
45
|
*/
|