@vpmedia/phaser 1.17.0 → 1.19.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 +4 -4
- package/src/phaser/core/animation.js +3 -2
- package/src/phaser/core/animation_manager.js +3 -2
- package/src/phaser/core/cache.js +38 -17
- 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 +11 -11
- package/src/phaser/core/game.js +1 -0
- package/src/phaser/core/input.js +13 -12
- package/src/phaser/core/input_handler.js +2 -1
- package/src/phaser/core/input_mouse.js +3 -2
- package/src/phaser/core/input_mspointer.js +6 -6
- package/src/phaser/core/input_pointer.js +3 -2
- package/src/phaser/core/loader.js +70 -69
- package/src/phaser/core/scale_manager.js +41 -24
- package/src/phaser/core/scene_manager.js +11 -7
- package/src/phaser/core/signal_binding.js +16 -7
- package/src/phaser/core/sound_manager.js +14 -7
- package/src/phaser/core/sound_sprite.js +7 -4
- package/src/phaser/core/timer.js +33 -21
- package/src/phaser/core/timer_event.js +8 -6
- package/src/phaser/core/tween.js +66 -45
- package/src/phaser/core/tween_data.js +23 -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 +9 -5
- package/src/phaser/display/canvas/util.js +2 -2
- package/src/phaser/display/display_object.js +35 -16
- package/src/phaser/display/graphics.js +61 -40
- package/src/phaser/display/graphics_data.js +7 -7
- package/src/phaser/display/image.js +19 -12
- package/src/phaser/display/sprite_util.js +3 -2
- package/src/phaser/display/text.js +57 -33
- 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 +8 -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.js +6 -6
- package/src/phaser/display/webgl/graphics_data.js +1 -1
- package/src/phaser/display/webgl/render_texture.js +9 -3
- package/src/phaser/display/webgl/renderer.js +13 -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 +4 -3
- package/src/phaser/display/webgl/sprite_batch.js +10 -7
- package/src/phaser/display/webgl/stencil_manager.js +12 -10
- package/src/phaser/display/webgl/texture.js +8 -6
- package/typedefs/global.d.ts +1 -1
- package/types/phaser/core/animation.d.ts +5 -4
- package/types/phaser/core/animation.d.ts.map +1 -1
- package/types/phaser/core/animation_manager.d.ts +7 -6
- package/types/phaser/core/animation_manager.d.ts.map +1 -1
- package/types/phaser/core/cache.d.ts +69 -45
- 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 +15 -15
- package/types/phaser/core/factory.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 +22 -21
- package/types/phaser/core/input.d.ts.map +1 -1
- package/types/phaser/core/input_handler.d.ts +5 -4
- package/types/phaser/core/input_handler.d.ts.map +1 -1
- package/types/phaser/core/input_mouse.d.ts +1 -1
- package/types/phaser/core/input_mouse.d.ts.map +1 -1
- package/types/phaser/core/input_mspointer.d.ts +13 -13
- package/types/phaser/core/input_mspointer.d.ts.map +1 -1
- package/types/phaser/core/input_pointer.d.ts +5 -4
- package/types/phaser/core/input_pointer.d.ts.map +1 -1
- package/types/phaser/core/loader.d.ts +104 -103
- package/types/phaser/core/loader.d.ts.map +1 -1
- package/types/phaser/core/scale_manager.d.ts +57 -40
- package/types/phaser/core/scale_manager.d.ts.map +1 -1
- package/types/phaser/core/scene_manager.d.ts +16 -11
- package/types/phaser/core/scene_manager.d.ts.map +1 -1
- package/types/phaser/core/signal_binding.d.ts +23 -15
- package/types/phaser/core/signal_binding.d.ts.map +1 -1
- package/types/phaser/core/sound_manager.d.ts +16 -9
- 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 +41 -29
- package/types/phaser/core/timer.d.ts.map +1 -1
- package/types/phaser/core/timer_event.d.ts +12 -11
- package/types/phaser/core/timer_event.d.ts.map +1 -1
- package/types/phaser/core/tween.d.ts +82 -62
- package/types/phaser/core/tween.d.ts.map +1 -1
- package/types/phaser/core/tween_data.d.ts +31 -23
- 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/button.d.ts +3 -2
- package/types/phaser/display/button.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 +11 -7
- 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 +55 -36
- package/types/phaser/display/display_object.d.ts.map +1 -1
- package/types/phaser/display/graphics.d.ts +71 -53
- 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/image.d.ts +27 -25
- 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 +82 -93
- package/types/phaser/display/text.d.ts.map +1 -1
- package/types/phaser/display/webgl/abstract_filter.d.ts +4 -4
- 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 +14 -13
- 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.d.ts +13 -12
- package/types/phaser/display/webgl/graphics.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 +12 -10
- package/types/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/renderer.d.ts +16 -9
- 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 +12 -12
- 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 +9 -8
- package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/sprite_batch.d.ts +17 -14
- package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/webgl/stencil_manager.d.ts +17 -15
- 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/src/phaser/core/input.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ArraySet } from './array_set';
|
|
2
2
|
import { Graphics } from '../display/graphics';
|
|
3
|
+
import { DisplayObject } from '../display/display_object';
|
|
3
4
|
import { Image } from '../display/image';
|
|
4
5
|
import { Signal } from './signal';
|
|
5
6
|
import { Point } from '../geom/point';
|
|
@@ -125,7 +126,7 @@ export class Input {
|
|
|
125
126
|
/**
|
|
126
127
|
* TBD.
|
|
127
128
|
* @param {Function} callback - TBD.
|
|
128
|
-
* @param context - TBD.
|
|
129
|
+
* @param {object} context - TBD.
|
|
129
130
|
*/
|
|
130
131
|
setInteractiveCandidateHandler(callback, context) {
|
|
131
132
|
this.customCandidateHandler = callback;
|
|
@@ -135,7 +136,7 @@ export class Input {
|
|
|
135
136
|
/**
|
|
136
137
|
* TBD.
|
|
137
138
|
* @param {Function} callback - TBD.
|
|
138
|
-
* @param context - TBD.
|
|
139
|
+
* @param {object} context - TBD.
|
|
139
140
|
*/
|
|
140
141
|
addMoveCallback(callback, context) {
|
|
141
142
|
this.moveCallbacks.push({ callback, context });
|
|
@@ -144,7 +145,7 @@ export class Input {
|
|
|
144
145
|
/**
|
|
145
146
|
* TBD.
|
|
146
147
|
* @param {Function} callback - TBD.
|
|
147
|
-
* @param context - TBD.
|
|
148
|
+
* @param {object} context - TBD.
|
|
148
149
|
*/
|
|
149
150
|
deleteMoveCallback(callback, context) {
|
|
150
151
|
let i = this.moveCallbacks.length;
|
|
@@ -298,7 +299,7 @@ export class Input {
|
|
|
298
299
|
|
|
299
300
|
/**
|
|
300
301
|
* TBD.
|
|
301
|
-
* @param limit - TBD.
|
|
302
|
+
* @param {number} limit - TBD.
|
|
302
303
|
* @returns {number} TBD.
|
|
303
304
|
*/
|
|
304
305
|
countActivePointers(limit = this.pointers.length) {
|
|
@@ -329,7 +330,7 @@ export class Input {
|
|
|
329
330
|
|
|
330
331
|
/**
|
|
331
332
|
* TBD.
|
|
332
|
-
* @param identifier - TBD.
|
|
333
|
+
* @param {number} identifier - TBD.
|
|
333
334
|
* @returns {Pointer} TBD.
|
|
334
335
|
*/
|
|
335
336
|
getPointerFromIdentifier(identifier) {
|
|
@@ -345,7 +346,7 @@ export class Input {
|
|
|
345
346
|
|
|
346
347
|
/**
|
|
347
348
|
* TBD.
|
|
348
|
-
* @param pointerId - TBD.
|
|
349
|
+
* @param {number} pointerId - TBD.
|
|
349
350
|
* @returns {Pointer} TBD.
|
|
350
351
|
*/
|
|
351
352
|
getPointerFromId(pointerId) {
|
|
@@ -361,9 +362,9 @@ export class Input {
|
|
|
361
362
|
|
|
362
363
|
/**
|
|
363
364
|
* TBD.
|
|
364
|
-
* @param displayObject - TBD.
|
|
365
|
-
* @param pointer - TBD.
|
|
366
|
-
* @param output - TBD.
|
|
365
|
+
* @param {DisplayObject} displayObject - TBD.
|
|
366
|
+
* @param {Pointer} pointer - TBD.
|
|
367
|
+
* @param {Point} output - TBD.
|
|
367
368
|
* @returns {Point} TBD.
|
|
368
369
|
*/
|
|
369
370
|
getLocalPosition(displayObject, pointer, output = null) {
|
|
@@ -378,9 +379,9 @@ export class Input {
|
|
|
378
379
|
|
|
379
380
|
/**
|
|
380
381
|
* TBD.
|
|
381
|
-
* @param displayObject - TBD.
|
|
382
|
-
* @param pointer - TBD.
|
|
383
|
-
* @param localPoint - TBD.
|
|
382
|
+
* @param {DisplayObject} displayObject - TBD.
|
|
383
|
+
* @param {Pointer} pointer - TBD.
|
|
384
|
+
* @param {Point} localPoint - TBD.
|
|
384
385
|
* @returns {boolean} TBD.
|
|
385
386
|
*/
|
|
386
387
|
hitTest(displayObject, pointer, localPoint) {
|
|
@@ -3,12 +3,13 @@ import { GROUP } from './const';
|
|
|
3
3
|
import { distance } from '../util/math';
|
|
4
4
|
import { Pointer } from './input_pointer';
|
|
5
5
|
import { Rectangle } from '../geom/rectangle';
|
|
6
|
+
import { Image } from '../display/image';
|
|
6
7
|
import { DisplayObject } from '../display/display_object';
|
|
7
8
|
|
|
8
9
|
export class InputHandler {
|
|
9
10
|
/**
|
|
10
11
|
* TBD.
|
|
11
|
-
* @param sprite
|
|
12
|
+
* @param {Image} sprite - TBD.
|
|
12
13
|
*/
|
|
13
14
|
constructor(sprite) {
|
|
14
15
|
this.sprite = sprite;
|
|
@@ -12,8 +12,8 @@ import { Game } from './game';
|
|
|
12
12
|
class WheelEventProxy {
|
|
13
13
|
/**
|
|
14
14
|
* TBD.
|
|
15
|
-
* @param scaleFactor - TBD.
|
|
16
|
-
* @param deltaMode - TBD.
|
|
15
|
+
* @param {number} scaleFactor - TBD.
|
|
16
|
+
* @param {number} deltaMode - TBD.
|
|
17
17
|
*/
|
|
18
18
|
constructor(scaleFactor, deltaMode) {
|
|
19
19
|
this._scaleFactor = scaleFactor;
|
|
@@ -48,6 +48,7 @@ class WheelEventProxy {
|
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* TBD.
|
|
51
|
+
* @returns {number} TBD.
|
|
51
52
|
*/
|
|
52
53
|
get deltaMode() {
|
|
53
54
|
return this._deltaMode;
|
|
@@ -83,7 +83,7 @@ export class MSPointer {
|
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
85
|
* TBD.
|
|
86
|
-
* @param {
|
|
86
|
+
* @param {PointerEvent} event - TBD.
|
|
87
87
|
*/
|
|
88
88
|
onPointerDown(event) {
|
|
89
89
|
this.event = event;
|
|
@@ -104,7 +104,7 @@ export class MSPointer {
|
|
|
104
104
|
|
|
105
105
|
/**
|
|
106
106
|
* TBD.
|
|
107
|
-
* @param {
|
|
107
|
+
* @param {PointerEvent} event - TBD.
|
|
108
108
|
*/
|
|
109
109
|
onPointerMove(event) {
|
|
110
110
|
this.event = event;
|
|
@@ -125,7 +125,7 @@ export class MSPointer {
|
|
|
125
125
|
|
|
126
126
|
/**
|
|
127
127
|
* TBD.
|
|
128
|
-
* @param {
|
|
128
|
+
* @param {PointerEvent} event - TBD.
|
|
129
129
|
*/
|
|
130
130
|
onPointerUp(event) {
|
|
131
131
|
this.event = event;
|
|
@@ -146,7 +146,7 @@ export class MSPointer {
|
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
* TBD.
|
|
149
|
-
* @param {
|
|
149
|
+
* @param {PointerEvent} event - TBD.
|
|
150
150
|
*/
|
|
151
151
|
onPointerUpGlobal(event) {
|
|
152
152
|
if ((event.pointerType === 'mouse' || event.pointerType === 0x00000004) && !this.input.mousePointer.withinGame) {
|
|
@@ -161,7 +161,7 @@ export class MSPointer {
|
|
|
161
161
|
|
|
162
162
|
/**
|
|
163
163
|
* TBD.
|
|
164
|
-
* @param {
|
|
164
|
+
* @param {PointerEvent} event - TBD.
|
|
165
165
|
*/
|
|
166
166
|
onPointerOut(event) {
|
|
167
167
|
this.event = event;
|
|
@@ -193,7 +193,7 @@ export class MSPointer {
|
|
|
193
193
|
|
|
194
194
|
/**
|
|
195
195
|
* TBD.
|
|
196
|
-
* @param {
|
|
196
|
+
* @param {PointerEvent} event - TBD.
|
|
197
197
|
*/
|
|
198
198
|
onPointerOver(event) {
|
|
199
199
|
this.event = event;
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
MOUSE_TOUCH_COMBINE,
|
|
10
10
|
} from './const';
|
|
11
11
|
import { Game } from './game';
|
|
12
|
+
import { InputHandler } from './input_handler';
|
|
12
13
|
|
|
13
14
|
export class Pointer {
|
|
14
15
|
/**
|
|
@@ -302,7 +303,7 @@ export class Pointer {
|
|
|
302
303
|
|
|
303
304
|
/**
|
|
304
305
|
* TBD.
|
|
305
|
-
* @param newTarget - TBD.
|
|
306
|
+
* @param {InputHandler} newTarget - TBD.
|
|
306
307
|
* @param {boolean} silent - TBD.
|
|
307
308
|
*/
|
|
308
309
|
swapTarget(newTarget, silent = false) {
|
|
@@ -422,7 +423,7 @@ export class Pointer {
|
|
|
422
423
|
* @param {string} name - TBD.
|
|
423
424
|
* @param {Function} callback - TBD.
|
|
424
425
|
* @param {object} callbackContext - TBD.
|
|
425
|
-
* @param callbackArgs - TBD.
|
|
426
|
+
* @param {...any} callbackArgs - TBD.
|
|
426
427
|
*/
|
|
427
428
|
addClickTrampoline(name, callback, callbackContext, callbackArgs) {
|
|
428
429
|
if (!this.isDown) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Signal } from './signal';
|
|
2
2
|
import { Rectangle } from '../geom/rectangle';
|
|
3
|
+
import { Image } from '../display/image';
|
|
3
4
|
import { canPlayAudio } from './device_util';
|
|
4
5
|
import { Game } from './game';
|
|
5
6
|
|
|
@@ -47,8 +48,8 @@ export class Loader {
|
|
|
47
48
|
|
|
48
49
|
/**
|
|
49
50
|
* TBD.
|
|
50
|
-
* @param sprite - TBD.
|
|
51
|
-
* @param direction - TBD.
|
|
51
|
+
* @param {Image} sprite - TBD.
|
|
52
|
+
* @param {number} direction - TBD.
|
|
52
53
|
*/
|
|
53
54
|
setPreloadSprite(sprite, direction = 0) {
|
|
54
55
|
this.preloadSprite = {
|
|
@@ -80,7 +81,7 @@ export class Loader {
|
|
|
80
81
|
|
|
81
82
|
/**
|
|
82
83
|
* TBD.
|
|
83
|
-
* @param type - TBD.
|
|
84
|
+
* @param {string} type - TBD.
|
|
84
85
|
* @param {string} key - TBD.
|
|
85
86
|
* @returns {boolean} TBD.
|
|
86
87
|
*/
|
|
@@ -90,7 +91,7 @@ export class Loader {
|
|
|
90
91
|
|
|
91
92
|
/**
|
|
92
93
|
* TBD.
|
|
93
|
-
* @param type - TBD.
|
|
94
|
+
* @param {string} type - TBD.
|
|
94
95
|
* @param {string} key - TBD.
|
|
95
96
|
* @returns {number} TBD.
|
|
96
97
|
*/
|
|
@@ -112,7 +113,7 @@ export class Loader {
|
|
|
112
113
|
|
|
113
114
|
/**
|
|
114
115
|
* TBD.
|
|
115
|
-
* @param type - TBD.
|
|
116
|
+
* @param {string} type - TBD.
|
|
116
117
|
* @param {string} key - TBD.
|
|
117
118
|
* @returns {object} TBD.
|
|
118
119
|
*/
|
|
@@ -126,10 +127,10 @@ export class Loader {
|
|
|
126
127
|
|
|
127
128
|
/**
|
|
128
129
|
* TBD.
|
|
129
|
-
* @param hard
|
|
130
|
-
* @param clearEvents
|
|
130
|
+
* @param {boolean} hard - TBD.
|
|
131
|
+
* @param {boolean} clearEvents - TBD.
|
|
131
132
|
*/
|
|
132
|
-
reset(hard, clearEvents = false) {
|
|
133
|
+
reset(hard = false, clearEvents = false) {
|
|
133
134
|
if (hard) {
|
|
134
135
|
this.preloadSprite = null;
|
|
135
136
|
}
|
|
@@ -154,12 +155,12 @@ export class Loader {
|
|
|
154
155
|
|
|
155
156
|
/**
|
|
156
157
|
* TBD.
|
|
157
|
-
* @param type - TBD.
|
|
158
|
+
* @param {string} type - TBD.
|
|
158
159
|
* @param {string} key - TBD.
|
|
159
160
|
* @param {string} url - TBD.
|
|
160
|
-
* @param properties - TBD.
|
|
161
|
-
* @param overwrite - TBD.
|
|
162
|
-
* @param extension - TBD.
|
|
161
|
+
* @param {object} properties - TBD.
|
|
162
|
+
* @param {boolean} overwrite - TBD.
|
|
163
|
+
* @param {string} extension - TBD.
|
|
163
164
|
* @returns {Loader} TBD.
|
|
164
165
|
*/
|
|
165
166
|
addToFileList(type, key = '', url = null, properties = null, overwrite = false, extension = null) {
|
|
@@ -211,10 +212,10 @@ export class Loader {
|
|
|
211
212
|
|
|
212
213
|
/**
|
|
213
214
|
* TBD.
|
|
214
|
-
* @param type - TBD.
|
|
215
|
+
* @param {string} type - TBD.
|
|
215
216
|
* @param {string} key - TBD.
|
|
216
217
|
* @param {string} url - TBD.
|
|
217
|
-
* @param properties - TBD.
|
|
218
|
+
* @param {object} properties - TBD.
|
|
218
219
|
* @returns {Loader} TBD.
|
|
219
220
|
*/
|
|
220
221
|
replaceInFileList(type, key, url, properties) {
|
|
@@ -225,7 +226,7 @@ export class Loader {
|
|
|
225
226
|
* TBD.
|
|
226
227
|
* @param {string} key - TBD.
|
|
227
228
|
* @param {string} url - TBD.
|
|
228
|
-
* @param data - TBD.
|
|
229
|
+
* @param {object} data - TBD.
|
|
229
230
|
* @param {object} callbackContext - TBD.
|
|
230
231
|
* @returns {Loader} TBD.
|
|
231
232
|
*/
|
|
@@ -264,17 +265,17 @@ export class Loader {
|
|
|
264
265
|
* TBD.
|
|
265
266
|
* @param {string} key - TBD.
|
|
266
267
|
* @param {string} url - TBD.
|
|
267
|
-
* @param overwrite - TBD.
|
|
268
|
+
* @param {boolean} overwrite - TBD.
|
|
268
269
|
* @returns {Loader} TBD.
|
|
269
270
|
*/
|
|
270
|
-
image(key, url, overwrite) {
|
|
271
|
+
image(key, url, overwrite = false) {
|
|
271
272
|
return this.addToFileList('image', key, url, undefined, overwrite, '.png');
|
|
272
273
|
}
|
|
273
274
|
|
|
274
275
|
/**
|
|
275
276
|
* TBD.
|
|
276
|
-
* @param keys - TBD.
|
|
277
|
-
* @param urls - TBD.
|
|
277
|
+
* @param {string[]} keys - TBD.
|
|
278
|
+
* @param {string[]} urls - TBD.
|
|
278
279
|
* @returns {Loader} TBD.
|
|
279
280
|
*/
|
|
280
281
|
images(keys, urls) {
|
|
@@ -294,7 +295,7 @@ export class Loader {
|
|
|
294
295
|
* TBD.
|
|
295
296
|
* @param {string} key - TBD.
|
|
296
297
|
* @param {string} url - TBD.
|
|
297
|
-
* @param overwrite - TBD.
|
|
298
|
+
* @param {boolean} overwrite - TBD.
|
|
298
299
|
* @returns {Loader} TBD.
|
|
299
300
|
*/
|
|
300
301
|
text(key, url, overwrite) {
|
|
@@ -305,7 +306,7 @@ export class Loader {
|
|
|
305
306
|
* TBD.
|
|
306
307
|
* @param {string} key - TBD.
|
|
307
308
|
* @param {string} url - TBD.
|
|
308
|
-
* @param overwrite - TBD.
|
|
309
|
+
* @param {boolean} overwrite - TBD.
|
|
309
310
|
* @returns {Loader} TBD.
|
|
310
311
|
*/
|
|
311
312
|
json(key, url, overwrite) {
|
|
@@ -316,7 +317,7 @@ export class Loader {
|
|
|
316
317
|
* TBD.
|
|
317
318
|
* @param {string} key - TBD.
|
|
318
319
|
* @param {string} url - TBD.
|
|
319
|
-
* @param overwrite - TBD.
|
|
320
|
+
* @param {boolean} overwrite - TBD.
|
|
320
321
|
* @returns {Loader} TBD.
|
|
321
322
|
*/
|
|
322
323
|
xml(key, url, overwrite) {
|
|
@@ -327,11 +328,11 @@ export class Loader {
|
|
|
327
328
|
* TBD.
|
|
328
329
|
* @param {string} key - TBD.
|
|
329
330
|
* @param {string} url - TBD.
|
|
330
|
-
* @param frameWidth - TBD.
|
|
331
|
-
* @param frameHeight - TBD.
|
|
332
|
-
* @param frameMax - TBD.
|
|
333
|
-
* @param margin - TBD.
|
|
334
|
-
* @param spacing - TBD.
|
|
331
|
+
* @param {number} frameWidth - TBD.
|
|
332
|
+
* @param {number} frameHeight - TBD.
|
|
333
|
+
* @param {number} frameMax - TBD.
|
|
334
|
+
* @param {number} margin - TBD.
|
|
335
|
+
* @param {number} spacing - TBD.
|
|
335
336
|
* @returns {Loader} TBD.
|
|
336
337
|
*/
|
|
337
338
|
spritesheet(key, url, frameWidth, frameHeight, frameMax = -1, margin = 0, spacing = 0) {
|
|
@@ -348,8 +349,8 @@ export class Loader {
|
|
|
348
349
|
/**
|
|
349
350
|
* TBD.
|
|
350
351
|
* @param {string} key - TBD.
|
|
351
|
-
* @param urls
|
|
352
|
-
* @param autoDecode
|
|
352
|
+
* @param {string[]} urls - TBD.
|
|
353
|
+
* @param {boolean} autoDecode - TBD.
|
|
353
354
|
* @returns {Loader} TBD.
|
|
354
355
|
*/
|
|
355
356
|
audio(key, urls, autoDecode = true) {
|
|
@@ -365,10 +366,10 @@ export class Loader {
|
|
|
365
366
|
/**
|
|
366
367
|
* TBD.
|
|
367
368
|
* @param {string} key - TBD.
|
|
368
|
-
* @param urls - TBD.
|
|
369
|
-
* @param jsonURL - TBD.
|
|
370
|
-
* @param jsonData - TBD.
|
|
371
|
-
* @param autoDecode - TBD.
|
|
369
|
+
* @param {string} urls - TBD.
|
|
370
|
+
* @param {string} jsonURL - TBD.
|
|
371
|
+
* @param {object} jsonData - TBD.
|
|
372
|
+
* @param {boolean} autoDecode - TBD.
|
|
372
373
|
* @returns {Loader} TBD.
|
|
373
374
|
*/
|
|
374
375
|
audioSprite(key, urls, jsonURL, jsonData, autoDecode = true) {
|
|
@@ -390,11 +391,11 @@ export class Loader {
|
|
|
390
391
|
/**
|
|
391
392
|
* TBD.
|
|
392
393
|
* @param {string} key - TBD.
|
|
393
|
-
* @param textureURL - TBD.
|
|
394
|
-
* @param atlasURL - TBD.
|
|
395
|
-
* @param atlasData - TBD.
|
|
396
|
-
* @param xSpacing - TBD.
|
|
397
|
-
* @param ySpacing - TBD.
|
|
394
|
+
* @param {string} textureURL - TBD.
|
|
395
|
+
* @param {string} atlasURL - TBD.
|
|
396
|
+
* @param {object} atlasData - TBD.
|
|
397
|
+
* @param {number} xSpacing - TBD.
|
|
398
|
+
* @param {number} ySpacing - TBD.
|
|
398
399
|
* @returns {Loader} TBD.
|
|
399
400
|
* @throws Error.
|
|
400
401
|
*/
|
|
@@ -434,10 +435,10 @@ export class Loader {
|
|
|
434
435
|
/**
|
|
435
436
|
* TBD.
|
|
436
437
|
* @param {string} key - TBD.
|
|
437
|
-
* @param textureURL - TBD.
|
|
438
|
-
* @param atlasURL - TBD.
|
|
439
|
-
* @param atlasData - TBD.
|
|
440
|
-
* @param format - TBD.
|
|
438
|
+
* @param {string} textureURL - TBD.
|
|
439
|
+
* @param {string} atlasURL - TBD.
|
|
440
|
+
* @param {object} atlasData - TBD.
|
|
441
|
+
* @param {number} format - TBD.
|
|
441
442
|
* @returns {Loader} TBD.
|
|
442
443
|
*/
|
|
443
444
|
atlas(key, textureURL, atlasURL = null, atlasData = null, format = TEXTURE_ATLAS_JSON_HASH) {
|
|
@@ -474,7 +475,7 @@ export class Loader {
|
|
|
474
475
|
|
|
475
476
|
/**
|
|
476
477
|
* TBD.
|
|
477
|
-
* @param type - TBD.
|
|
478
|
+
* @param {string} type - TBD.
|
|
478
479
|
* @param {string} key - TBD.
|
|
479
480
|
* @returns {Loader} TBD.
|
|
480
481
|
*/
|
|
@@ -488,7 +489,7 @@ export class Loader {
|
|
|
488
489
|
|
|
489
490
|
/**
|
|
490
491
|
* TBD.
|
|
491
|
-
* @param type - TBD.
|
|
492
|
+
* @param {string} type - TBD.
|
|
492
493
|
* @param {string} key - TBD.
|
|
493
494
|
*/
|
|
494
495
|
removeFile(type, key) {
|
|
@@ -621,7 +622,7 @@ export class Loader {
|
|
|
621
622
|
|
|
622
623
|
/**
|
|
623
624
|
* TBD.
|
|
624
|
-
* @param abnormal - TBD.
|
|
625
|
+
* @param {boolean} abnormal - TBD.
|
|
625
626
|
*/
|
|
626
627
|
finishedLoading(abnormal) {
|
|
627
628
|
if (this.hasLoaded) {
|
|
@@ -644,8 +645,8 @@ export class Loader {
|
|
|
644
645
|
|
|
645
646
|
/**
|
|
646
647
|
* TBD.
|
|
647
|
-
* @param file - TBD.
|
|
648
|
-
* @param errorMessage - TBD.
|
|
648
|
+
* @param {object} file - TBD.
|
|
649
|
+
* @param {string} errorMessage - TBD.
|
|
649
650
|
*/
|
|
650
651
|
asyncComplete(file, errorMessage = '') {
|
|
651
652
|
file.loaded = true;
|
|
@@ -660,7 +661,7 @@ export class Loader {
|
|
|
660
661
|
|
|
661
662
|
/**
|
|
662
663
|
* TBD.
|
|
663
|
-
* @param pack - TBD.
|
|
664
|
+
* @param {object} pack - TBD.
|
|
664
665
|
*/
|
|
665
666
|
processPack(pack) {
|
|
666
667
|
const packData = pack.data[pack.key];
|
|
@@ -724,7 +725,7 @@ export class Loader {
|
|
|
724
725
|
/**
|
|
725
726
|
* TBD.
|
|
726
727
|
* @param {string} url - TBD.
|
|
727
|
-
* @param file - TBD.
|
|
728
|
+
* @param {object} file - TBD.
|
|
728
729
|
* @returns {string} TBD.
|
|
729
730
|
*/
|
|
730
731
|
transformUrl(url, file) {
|
|
@@ -739,7 +740,7 @@ export class Loader {
|
|
|
739
740
|
|
|
740
741
|
/**
|
|
741
742
|
* TBD.
|
|
742
|
-
* @param file - TBD.
|
|
743
|
+
* @param {object} file - TBD.
|
|
743
744
|
*/
|
|
744
745
|
loadFile(file) {
|
|
745
746
|
switch (file.type) {
|
|
@@ -777,7 +778,7 @@ export class Loader {
|
|
|
777
778
|
|
|
778
779
|
/**
|
|
779
780
|
* TBD.
|
|
780
|
-
* @param file - TBD.
|
|
781
|
+
* @param {object} file - TBD.
|
|
781
782
|
*/
|
|
782
783
|
loadImageTag(file) {
|
|
783
784
|
this.log('loadImageTag', file);
|
|
@@ -809,13 +810,13 @@ export class Loader {
|
|
|
809
810
|
|
|
810
811
|
/**
|
|
811
812
|
* TBD.
|
|
812
|
-
* @param file - TBD.
|
|
813
|
+
* @param {object} file - TBD.
|
|
813
814
|
* @param {string} url - TBD.
|
|
814
|
-
* @param type - TBD.
|
|
815
|
-
* @param onload - TBD.
|
|
816
|
-
* @param onerror - TBD.
|
|
815
|
+
* @param {string} type - TBD.
|
|
816
|
+
* @param {Function} onload - TBD.
|
|
817
|
+
* @param {Function} onerror - TBD.
|
|
817
818
|
*/
|
|
818
|
-
xhrLoad(file, url, type, onload, onerror) {
|
|
819
|
+
xhrLoad(file, url, type, onload, onerror = null) {
|
|
819
820
|
this.log('xhrLoad', file);
|
|
820
821
|
const scope = this;
|
|
821
822
|
const xhr = new XMLHttpRequest();
|
|
@@ -884,7 +885,7 @@ export class Loader {
|
|
|
884
885
|
|
|
885
886
|
/**
|
|
886
887
|
* TBD.
|
|
887
|
-
* @param urls - TBD.
|
|
888
|
+
* @param {object[]} urls - TBD.
|
|
888
889
|
* @returns {string} TBD.
|
|
889
890
|
*/
|
|
890
891
|
getAudioURL(urls) {
|
|
@@ -922,9 +923,9 @@ export class Loader {
|
|
|
922
923
|
|
|
923
924
|
/**
|
|
924
925
|
* TBD.
|
|
925
|
-
* @param file - TBD.
|
|
926
|
-
* @param xhr - TBD.
|
|
927
|
-
* @param reason - TBD.
|
|
926
|
+
* @param {object} file - TBD.
|
|
927
|
+
* @param {XMLHttpRequest} xhr - TBD.
|
|
928
|
+
* @param {number} reason - TBD.
|
|
928
929
|
*/
|
|
929
930
|
fileError(file, xhr, reason) {
|
|
930
931
|
// const url = file.requestUrl || this.transformUrl(file.url, file);
|
|
@@ -940,8 +941,8 @@ export class Loader {
|
|
|
940
941
|
|
|
941
942
|
/**
|
|
942
943
|
* TBD.
|
|
943
|
-
* @param file - TBD.
|
|
944
|
-
* @param xhr - TBD.
|
|
944
|
+
* @param {object} file - TBD.
|
|
945
|
+
* @param {XMLHttpRequest} xhr - TBD.
|
|
945
946
|
* @throws Error.
|
|
946
947
|
*/
|
|
947
948
|
fileComplete(file, xhr) {
|
|
@@ -1032,8 +1033,8 @@ export class Loader {
|
|
|
1032
1033
|
|
|
1033
1034
|
/**
|
|
1034
1035
|
* TBD.
|
|
1035
|
-
* @param file - TBD.
|
|
1036
|
-
* @param xhr - TBD.
|
|
1036
|
+
* @param {object} file - TBD.
|
|
1037
|
+
* @param {XMLHttpRequest} xhr - TBD.
|
|
1037
1038
|
*/
|
|
1038
1039
|
jsonLoadComplete(file, xhr) {
|
|
1039
1040
|
const data = JSON.parse(xhr.responseText);
|
|
@@ -1057,8 +1058,8 @@ export class Loader {
|
|
|
1057
1058
|
|
|
1058
1059
|
/**
|
|
1059
1060
|
* TBD.
|
|
1060
|
-
* @param file - TBD.
|
|
1061
|
-
* @param xhr - TBD.
|
|
1061
|
+
* @param {object} file - TBD.
|
|
1062
|
+
* @param {XMLHttpRequest} xhr - TBD.
|
|
1062
1063
|
*/
|
|
1063
1064
|
xmlLoadComplete(file, xhr) {
|
|
1064
1065
|
// Always try parsing the content as XML, regardless of actually response type
|
|
@@ -1082,7 +1083,7 @@ export class Loader {
|
|
|
1082
1083
|
|
|
1083
1084
|
/**
|
|
1084
1085
|
* TBD.
|
|
1085
|
-
* @param data - TBD.
|
|
1086
|
+
* @param {object} data - TBD.
|
|
1086
1087
|
* @returns {Document} TBD.
|
|
1087
1088
|
*/
|
|
1088
1089
|
parseXml(data) {
|
|
@@ -1127,8 +1128,8 @@ export class Loader {
|
|
|
1127
1128
|
|
|
1128
1129
|
/**
|
|
1129
1130
|
* TBD.
|
|
1130
|
-
* @param message - TBD.
|
|
1131
|
-
* @param data - TBD.
|
|
1131
|
+
* @param {string} message - TBD.
|
|
1132
|
+
* @param {string|object} data - TBD.
|
|
1132
1133
|
*/
|
|
1133
1134
|
log(message, data = '') {
|
|
1134
1135
|
if (!this.isUseLog) {
|