@vpmedia/phaser 1.116.0 → 1.118.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +195 -229
- package/dist/index.js.map +1 -1
- package/dist/phaser/core/animation.d.ts.map +1 -1
- package/dist/phaser/core/animation_manager.d.ts +16 -15
- package/dist/phaser/core/animation_manager.d.ts.map +1 -1
- package/dist/phaser/core/animation_parser.d.ts.map +1 -1
- package/dist/phaser/core/array_set.d.ts.map +1 -1
- package/dist/phaser/core/cache.d.ts +76 -47
- package/dist/phaser/core/cache.d.ts.map +1 -1
- package/dist/phaser/core/device_util.d.ts.map +1 -1
- package/dist/phaser/core/dom.d.ts.map +1 -1
- package/dist/phaser/core/factory.d.ts.map +1 -1
- package/dist/phaser/core/game.d.ts.map +1 -1
- package/dist/phaser/core/input.d.ts +17 -17
- package/dist/phaser/core/input.d.ts.map +1 -1
- package/dist/phaser/core/input_handler.d.ts +11 -13
- package/dist/phaser/core/input_handler.d.ts.map +1 -1
- package/dist/phaser/core/input_mouse.d.ts.map +1 -1
- package/dist/phaser/core/input_mspointer.d.ts +8 -7
- package/dist/phaser/core/input_mspointer.d.ts.map +1 -1
- package/dist/phaser/core/input_pointer.d.ts +19 -8
- package/dist/phaser/core/input_pointer.d.ts.map +1 -1
- package/dist/phaser/core/input_touch.d.ts.map +1 -1
- package/dist/phaser/core/loader.d.ts +30 -1
- package/dist/phaser/core/loader.d.ts.map +1 -1
- package/dist/phaser/core/loader_parser.d.ts +24 -4
- package/dist/phaser/core/loader_parser.d.ts.map +1 -1
- package/dist/phaser/core/raf.d.ts.map +1 -1
- package/dist/phaser/core/scale_manager.d.ts +37 -12
- package/dist/phaser/core/scale_manager.d.ts.map +1 -1
- package/dist/phaser/core/scene.d.ts.map +1 -1
- package/dist/phaser/core/scene_manager.d.ts.map +1 -1
- package/dist/phaser/core/signal.d.ts.map +1 -1
- package/dist/phaser/core/signal_binding.d.ts.map +1 -1
- package/dist/phaser/core/sound.d.ts +15 -5
- package/dist/phaser/core/sound.d.ts.map +1 -1
- package/dist/phaser/core/sound_manager.d.ts +24 -22
- package/dist/phaser/core/sound_manager.d.ts.map +1 -1
- package/dist/phaser/core/sound_sprite.d.ts.map +1 -1
- package/dist/phaser/core/stage.d.ts.map +1 -1
- package/dist/phaser/core/time.d.ts.map +1 -1
- package/dist/phaser/core/timer.d.ts +1 -1
- package/dist/phaser/core/timer.d.ts.map +1 -1
- package/dist/phaser/core/tween.d.ts +3 -3
- package/dist/phaser/core/tween.d.ts.map +1 -1
- package/dist/phaser/core/tween_data.d.ts +26 -26
- package/dist/phaser/core/tween_data.d.ts.map +1 -1
- package/dist/phaser/core/tween_manager.d.ts +8 -6
- package/dist/phaser/core/tween_manager.d.ts.map +1 -1
- package/dist/phaser/core/world.d.ts.map +1 -1
- package/dist/phaser/display/bitmap_text.d.ts +13 -8
- package/dist/phaser/display/bitmap_text.d.ts.map +1 -1
- package/dist/phaser/display/button.d.ts.map +1 -1
- package/dist/phaser/display/canvas/buffer.d.ts.map +1 -1
- package/dist/phaser/display/canvas/graphics.d.ts.map +1 -1
- package/dist/phaser/display/canvas/masker.d.ts.map +1 -1
- package/dist/phaser/display/canvas/pool.d.ts.map +1 -1
- package/dist/phaser/display/canvas/renderer.d.ts.map +1 -1
- package/dist/phaser/display/canvas/tinter.d.ts +3 -2
- package/dist/phaser/display/canvas/tinter.d.ts.map +1 -1
- package/dist/phaser/display/canvas/util.d.ts.map +1 -1
- package/dist/phaser/display/display_object.d.ts.map +1 -1
- package/dist/phaser/display/graphics.d.ts.map +1 -1
- package/dist/phaser/display/graphics_data.d.ts.map +1 -1
- package/dist/phaser/display/graphics_data_util.d.ts.map +1 -1
- package/dist/phaser/display/group.d.ts.map +1 -1
- package/dist/phaser/display/image.d.ts +2 -2
- package/dist/phaser/display/image.d.ts.map +1 -1
- package/dist/phaser/display/sprite_util.d.ts.map +1 -1
- package/dist/phaser/display/text.d.ts.map +1 -1
- package/dist/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
- package/dist/phaser/display/webgl/base_texture.d.ts +12 -10
- package/dist/phaser/display/webgl/base_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/blend_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/earcut.d.ts.map +1 -1
- package/dist/phaser/display/webgl/fast_sprite_batch.d.ts +13 -12
- package/dist/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/webgl/filter_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/filter_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/graphics.d.ts +9 -7
- package/dist/phaser/display/webgl/graphics.d.ts.map +1 -1
- package/dist/phaser/display/webgl/graphics_data.d.ts.map +1 -1
- package/dist/phaser/display/webgl/mask_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/renderer.d.ts +12 -10
- package/dist/phaser/display/webgl/renderer.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/normal.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/texture.d.ts +18 -33
- package/dist/phaser/display/webgl/texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/texture_util.d.ts.map +1 -1
- package/dist/phaser/display/webgl/util.d.ts.map +1 -1
- package/dist/phaser/geom/circle.d.ts.map +1 -1
- package/dist/phaser/geom/ellipse.d.ts.map +1 -1
- package/dist/phaser/geom/line.d.ts.map +1 -1
- package/dist/phaser/geom/matrix.d.ts +1 -1
- package/dist/phaser/geom/matrix.d.ts.map +1 -1
- package/dist/phaser/geom/point.d.ts.map +1 -1
- package/dist/phaser/geom/polygon.d.ts.map +1 -1
- package/dist/phaser/geom/rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/rounded_rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/util/circle.d.ts.map +1 -1
- package/dist/phaser/geom/util/ellipse.d.ts.map +1 -1
- package/dist/phaser/geom/util/line.d.ts +5 -4
- package/dist/phaser/geom/util/line.d.ts.map +1 -1
- package/dist/phaser/geom/util/matrix.d.ts.map +1 -1
- package/dist/phaser/geom/util/point.d.ts.map +1 -1
- package/dist/phaser/geom/util/polygon.d.ts.map +1 -1
- package/dist/phaser/geom/util/rectangle.d.ts +10 -1
- package/dist/phaser/geom/util/rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/phaser/core/animation.ts +20 -20
- package/src/phaser/core/animation_manager.ts +27 -24
- package/src/phaser/core/animation_parser.ts +2 -2
- package/src/phaser/core/array_set.ts +7 -7
- package/src/phaser/core/cache.test.ts +201 -0
- package/src/phaser/core/cache.ts +174 -130
- package/src/phaser/core/device_util.ts +13 -13
- package/src/phaser/core/dom.ts +26 -22
- package/src/phaser/core/factory.ts +6 -6
- package/src/phaser/core/game.ts +10 -10
- package/src/phaser/core/input.ts +36 -38
- package/src/phaser/core/input_handler.ts +90 -93
- package/src/phaser/core/input_mouse.ts +19 -19
- package/src/phaser/core/input_mspointer.ts +25 -28
- package/src/phaser/core/input_pointer.ts +37 -28
- package/src/phaser/core/input_touch.ts +17 -17
- package/src/phaser/core/loader.ts +132 -92
- package/src/phaser/core/loader_parser.test.ts +115 -0
- package/src/phaser/core/loader_parser.ts +66 -38
- package/src/phaser/core/raf.ts +3 -3
- package/src/phaser/core/scale_manager.ts +86 -67
- package/src/phaser/core/scene.ts +7 -7
- package/src/phaser/core/scene_manager.ts +16 -16
- package/src/phaser/core/signal.ts +29 -19
- package/src/phaser/core/signal_binding.ts +4 -4
- package/src/phaser/core/sound.ts +45 -33
- package/src/phaser/core/sound_manager.ts +72 -73
- package/src/phaser/core/sound_sprite.ts +1 -1
- package/src/phaser/core/stage.ts +7 -7
- package/src/phaser/core/time.ts +16 -16
- package/src/phaser/core/timer.ts +36 -26
- package/src/phaser/core/tween.ts +29 -29
- package/src/phaser/core/tween_data.ts +41 -37
- package/src/phaser/core/tween_manager.ts +50 -43
- package/src/phaser/core/world.ts +1 -1
- package/src/phaser/display/bitmap_text.test.ts +212 -0
- package/src/phaser/display/bitmap_text.ts +52 -37
- package/src/phaser/display/button.ts +13 -13
- package/src/phaser/display/canvas/buffer.ts +3 -3
- package/src/phaser/display/canvas/graphics.ts +3 -3
- package/src/phaser/display/canvas/masker.ts +2 -2
- package/src/phaser/display/canvas/pool.ts +6 -6
- package/src/phaser/display/canvas/renderer.ts +6 -6
- package/src/phaser/display/canvas/tinter.ts +39 -8
- package/src/phaser/display/canvas/util.ts +15 -9
- package/src/phaser/display/display_object.ts +38 -38
- package/src/phaser/display/graphics.ts +30 -30
- package/src/phaser/display/graphics_data.ts +1 -1
- package/src/phaser/display/graphics_data_util.ts +1 -1
- package/src/phaser/display/group.ts +16 -16
- package/src/phaser/display/image.ts +30 -26
- package/src/phaser/display/sprite_util.ts +12 -4
- package/src/phaser/display/text.ts +55 -55
- package/src/phaser/display/webgl/abstract_filter.ts +1 -1
- package/src/phaser/display/webgl/base_texture.ts +22 -18
- package/src/phaser/display/webgl/blend_manager.ts +3 -3
- package/src/phaser/display/webgl/earcut.ts +3 -3
- package/src/phaser/display/webgl/fast_sprite_batch.ts +26 -24
- package/src/phaser/display/webgl/filter_manager.ts +7 -7
- package/src/phaser/display/webgl/filter_texture.ts +3 -3
- package/src/phaser/display/webgl/graphics.ts +43 -41
- package/src/phaser/display/webgl/graphics_data.ts +2 -2
- package/src/phaser/display/webgl/mask_manager.ts +2 -2
- package/src/phaser/display/webgl/render_texture.ts +6 -6
- package/src/phaser/display/webgl/renderer.ts +20 -25
- package/src/phaser/display/webgl/shader/normal.ts +3 -3
- package/src/phaser/display/webgl/shader_manager.ts +2 -2
- package/src/phaser/display/webgl/sprite_batch.ts +9 -9
- package/src/phaser/display/webgl/stencil_manager.ts +4 -4
- package/src/phaser/display/webgl/texture.ts +23 -42
- package/src/phaser/display/webgl/texture_util.ts +2 -2
- package/src/phaser/display/webgl/util.ts +11 -7
- package/src/phaser/geom/circle.ts +21 -21
- package/src/phaser/geom/ellipse.ts +7 -7
- package/src/phaser/geom/line.ts +29 -29
- package/src/phaser/geom/matrix.ts +13 -13
- package/src/phaser/geom/point.ts +36 -30
- package/src/phaser/geom/polygon.ts +6 -6
- package/src/phaser/geom/rectangle.ts +42 -42
- package/src/phaser/geom/rounded_rectangle.ts +2 -2
- package/src/phaser/geom/util/circle.ts +7 -7
- package/src/phaser/geom/util/ellipse.ts +1 -1
- package/src/phaser/geom/util/line.ts +13 -5
- package/src/phaser/geom/util/matrix.ts +3 -3
- package/src/phaser/geom/util/point.ts +20 -20
- package/src/phaser/geom/util/polygon.ts +1 -1
- package/src/phaser/geom/util/rectangle.ts +34 -17
- package/src/phaser/geom/util/rounded_rectangle.ts +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Rectangle } from '../rectangle.js';
|
|
1
2
|
import { Line } from '../line.js';
|
|
2
3
|
import { Point } from '../point.js';
|
|
3
4
|
/**
|
|
@@ -17,7 +18,7 @@ export declare const clone: (input: Line, output?: Line | null) => Line;
|
|
|
17
18
|
* @param {Point} output - Optional point to store the result in.
|
|
18
19
|
* @returns {Point} The intersection point, or null if there is no intersection.
|
|
19
20
|
*/
|
|
20
|
-
export declare const intersectsPoints: (a:
|
|
21
|
+
export declare const intersectsPoints: (a: Point, b: Point, e: Point, f: Point, asSegment?: boolean, output?: Point | null) => Point | null;
|
|
21
22
|
/**
|
|
22
23
|
* Gets the intersection point of two lines (alternative implementation).
|
|
23
24
|
* @param {object} a - The first line (with x1, y1, x2, y2 properties).
|
|
@@ -26,19 +27,19 @@ export declare const intersectsPoints: (a: any, b: any, e: any, f: any, asSegmen
|
|
|
26
27
|
* @param {Point} result - Optional point to store the result in.
|
|
27
28
|
* @returns {Point} The intersection point, or null if there is no intersection.
|
|
28
29
|
*/
|
|
29
|
-
export declare const intersects: (a:
|
|
30
|
+
export declare const intersects: (a: Line, b: Line, asSegment: boolean, result: Point) => Point | null;
|
|
30
31
|
/**
|
|
31
32
|
* Checks if a line intersects with a rectangle.
|
|
32
33
|
* @param {object} line - The line to check (with x1, y1, x2, y2 properties).
|
|
33
34
|
* @param {object} rect - The rectangle to check (with x, y, width, height properties).
|
|
34
35
|
* @returns {boolean} True if the line intersects with the rectangle, false otherwise.
|
|
35
36
|
*/
|
|
36
|
-
export declare const intersectsRectangle: (line:
|
|
37
|
+
export declare const intersectsRectangle: (line: Line, rect: Rectangle) => boolean;
|
|
37
38
|
/**
|
|
38
39
|
* Calculates the distance between two points (line length).
|
|
39
40
|
* @param {object} a - The first point (with x, y properties).
|
|
40
41
|
* @param {object} b - The second point (with x, y properties).
|
|
41
42
|
* @returns {number} The distance between the points.
|
|
42
43
|
*/
|
|
43
|
-
export declare const reflect: (a:
|
|
44
|
+
export declare const reflect: (a: Line, b: Line) => number;
|
|
44
45
|
//# sourceMappingURL=line.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../../../src/phaser/geom/util/line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC;;;;;GAKG;AACH,eAAO,MAAM,KAAK,UAAW,IAAI,WAAU,IAAI,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../../../src/phaser/geom/util/line.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC;;;;;GAKG;AACH,eAAO,MAAM,KAAK,UAAW,IAAI,WAAU,IAAI,GAAG,IAAI,KAAU,IAO/D,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,MACxB,KAAK,KACL,KAAK,KACL,KAAK,KACL,KAAK,gCAEA,KAAK,GAAG,IAAI,KACnB,KAAK,GAAG,IAwBV,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,MAAO,IAAI,KAAK,IAAI,aAAa,OAAO,UAAU,KAAK,KAAG,KAAK,GAAG,IACpB,CAAC;AAEtE;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,SAAU,IAAI,QAAQ,SAAS,KAAG,OA8CjE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,OAAO,MAAO,IAAI,KAAK,IAAI,KAAG,MAA+C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matrix.d.ts","sourceRoot":"","sources":["../../../../src/phaser/geom/util/matrix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC;;;;;GAKG;AACH,eAAO,MAAM,KAAK,UAAW,MAAM,WAAU,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"matrix.d.ts","sourceRoot":"","sources":["../../../../src/phaser/geom/util/matrix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC;;;;;GAKG;AACH,eAAO,MAAM,KAAK,UAAW,MAAM,WAAU,MAAM,GAAG,IAAI,KAAU,MASnE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAO,MAIpC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,QAAO,MAIhC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../../src/phaser/geom/util/point.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE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eAAe,CAAC;AAExC;;;;;GAKG;AACH,eAAO,MAAM,KAAK,UAAW,OAAO,WAAU,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"polygon.d.ts","sourceRoot":"","sources":["../../../../src/phaser/geom/util/polygon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;;;;GAKG;AACH,eAAO,MAAM,KAAK,UAAW,OAAO,WAAU,OAAO,GAAG,IAAI,KAAU,OAIrE,CAAC"}
|
|
@@ -82,7 +82,16 @@ export declare const sameDimensions: (a: Rectangle, b: Rectangle) => boolean;
|
|
|
82
82
|
* @param {Rectangle} b - The second rectangle to check.
|
|
83
83
|
* @returns {boolean} True if the rectangles intersect, false otherwise.
|
|
84
84
|
*/
|
|
85
|
-
|
|
85
|
+
/** Anything with an axis-aligned extent, which Line exposes as well as Rectangle. */
|
|
86
|
+
export type Bounds = {
|
|
87
|
+
x: number;
|
|
88
|
+
y: number;
|
|
89
|
+
width: number;
|
|
90
|
+
height: number;
|
|
91
|
+
right: number;
|
|
92
|
+
bottom: number;
|
|
93
|
+
};
|
|
94
|
+
export declare const intersects: (a: Bounds, b: Bounds) => boolean;
|
|
86
95
|
/**
|
|
87
96
|
* Gets the intersection of two rectangles.
|
|
88
97
|
* @param {Rectangle} a - The first rectangle.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rectangle.d.ts","sourceRoot":"","sources":["../../../../src/phaser/geom/util/rectangle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,MAAO,SAAS,MAAM,MAAM,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"rectangle.d.ts","sourceRoot":"","sources":["../../../../src/phaser/geom/util/rectangle.ts"],"names":[],"mappings":"AAAA,OAAO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IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,UAAU,MAAO,MAAM,KAAK,MAAM,KAAG,OAKjD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,MAAO,SAAS,KAAK,SAAS,WAAU,SAAS,GAAG,IAAI,KAAU,SAS1F,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,MACrB,SAAS,QACN,MAAM,SACL,MAAM,OACR,MAAM,UACH,MAAM,yBAEb,OAMA,CAAC;AAEJ;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,MAAO,SAAS,KAAK,SAAS,WAAU,SAAS,GAAG,IAAI,KAAU,SAQnF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,IAAI,WAAY,KAAK,EAAE,WAAU,SAAS,GAAG,IAAI,KAAU,SAsBvE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAO,SAIpC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rounded_rectangle.d.ts","sourceRoot":"","sources":["../../../../src/phaser/geom/util/rounded_rectangle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;;;;GAKG;AACH,eAAO,MAAM,KAAK,UAAW,gBAAgB,WAAU,gBAAgB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"rounded_rectangle.d.ts","sourceRoot":"","sources":["../../../../src/phaser/geom/util/rounded_rectangle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;;;;GAKG;AACH,eAAO,MAAM,KAAK,UAAW,gBAAgB,WAAU,gBAAgB,GAAG,IAAI,KAAU,gBAQvF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vpmedia/phaser",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.118.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",
|
|
@@ -98,7 +98,7 @@ export class Animation {
|
|
|
98
98
|
* @param {boolean} loop - Whether to loop this animation (if null, uses the original loop setting).
|
|
99
99
|
* @returns {Animation} This Animation instance for chaining.
|
|
100
100
|
*/
|
|
101
|
-
public play(frameRate: number | null = null, loop: boolean | null = null) {
|
|
101
|
+
public play(frameRate: number | null = null, loop: boolean | null = null): this {
|
|
102
102
|
if (typeof frameRate === 'number') {
|
|
103
103
|
// If they set a new frame rate then use it, otherwise use the one set on creation
|
|
104
104
|
this.delay = 1000 / frameRate;
|
|
@@ -125,7 +125,7 @@ export class Animation {
|
|
|
125
125
|
/**
|
|
126
126
|
* Restarts this animation from the beginning.
|
|
127
127
|
*/
|
|
128
|
-
public restart() {
|
|
128
|
+
public restart(): void {
|
|
129
129
|
this.isPlaying = true;
|
|
130
130
|
this.isFinished = false;
|
|
131
131
|
this.paused = false;
|
|
@@ -144,7 +144,7 @@ export class Animation {
|
|
|
144
144
|
* Reverses the direction of this animation.
|
|
145
145
|
* @returns {Animation} This Animation instance for chaining.
|
|
146
146
|
*/
|
|
147
|
-
public reverse() {
|
|
147
|
+
public reverse(): this {
|
|
148
148
|
this.reversed = !this.reversed;
|
|
149
149
|
return this;
|
|
150
150
|
}
|
|
@@ -153,7 +153,7 @@ export class Animation {
|
|
|
153
153
|
* Reverses the animation direction once, then returns to normal direction.
|
|
154
154
|
* @returns {Animation} This Animation instance for chaining.
|
|
155
155
|
*/
|
|
156
|
-
public reverseOnce() {
|
|
156
|
+
public reverseOnce(): this {
|
|
157
157
|
this.onComplete.addOnce(this.reverse, this);
|
|
158
158
|
this.reverse();
|
|
159
159
|
return this;
|
|
@@ -164,7 +164,7 @@ export class Animation {
|
|
|
164
164
|
* @param {string|number} frameId - The identifier (name or index) of the frame to set.
|
|
165
165
|
* @param {boolean} useLocalFrameIndex - If true, treats frameId as an index into the local frames array.
|
|
166
166
|
*/
|
|
167
|
-
public setFrame(frameId: string | number, useLocalFrameIndex = false) {
|
|
167
|
+
public setFrame(frameId: string | number, useLocalFrameIndex = false): void {
|
|
168
168
|
let frameIndex;
|
|
169
169
|
// Find the index to the desired frame.
|
|
170
170
|
if (typeof frameId === 'string') {
|
|
@@ -198,7 +198,7 @@ export class Animation {
|
|
|
198
198
|
* @param {boolean} resetFrame - If true, resets to the first frame.
|
|
199
199
|
* @param {boolean} dispatchComplete - If true, dispatches the onComplete signal.
|
|
200
200
|
*/
|
|
201
|
-
public stop(resetFrame = false, dispatchComplete = false) {
|
|
201
|
+
public stop(resetFrame = false, dispatchComplete = false): void {
|
|
202
202
|
this.isPlaying = false;
|
|
203
203
|
this.isFinished = true;
|
|
204
204
|
this.paused = false;
|
|
@@ -217,7 +217,7 @@ export class Animation {
|
|
|
217
217
|
/**
|
|
218
218
|
* Called when the game is paused.
|
|
219
219
|
*/
|
|
220
|
-
public onPause() {
|
|
220
|
+
public onPause(): void {
|
|
221
221
|
if (this.isPlaying) {
|
|
222
222
|
this._frameDiff = this._timeNextFrame - this.game.time.time;
|
|
223
223
|
}
|
|
@@ -226,7 +226,7 @@ export class Animation {
|
|
|
226
226
|
/**
|
|
227
227
|
* Called when the game is resumed.
|
|
228
228
|
*/
|
|
229
|
-
public onResume() {
|
|
229
|
+
public onResume(): void {
|
|
230
230
|
if (this.isPlaying) {
|
|
231
231
|
this._timeNextFrame = this.game.time.time + this._frameDiff;
|
|
232
232
|
}
|
|
@@ -236,7 +236,7 @@ export class Animation {
|
|
|
236
236
|
* Updates this animation.
|
|
237
237
|
* @returns {boolean} True if the animation was updated, false otherwise.
|
|
238
238
|
*/
|
|
239
|
-
public update() {
|
|
239
|
+
public update(): boolean {
|
|
240
240
|
if (this.isPaused) {
|
|
241
241
|
return false;
|
|
242
242
|
}
|
|
@@ -297,7 +297,7 @@ export class Animation {
|
|
|
297
297
|
* @param {boolean} fromPlay - Whether this call is from play().
|
|
298
298
|
* @returns {boolean} True if the frame was updated, false otherwise.
|
|
299
299
|
*/
|
|
300
|
-
public updateCurrentFrame(signalUpdate: boolean, fromPlay = false) {
|
|
300
|
+
public updateCurrentFrame(signalUpdate: boolean, fromPlay = false): boolean {
|
|
301
301
|
if (!this._frameData || !this.currentFrame) {
|
|
302
302
|
// The animation is already destroyed, probably from a callback
|
|
303
303
|
return false;
|
|
@@ -320,7 +320,7 @@ export class Animation {
|
|
|
320
320
|
* Advances the animation to the next frame(s).
|
|
321
321
|
* @param {number} quantity - The number of frames to advance by.
|
|
322
322
|
*/
|
|
323
|
-
public next(quantity = 1) {
|
|
323
|
+
public next(quantity = 1): void {
|
|
324
324
|
let frame = this._frameIndex + quantity;
|
|
325
325
|
if (frame >= this._frames.length) {
|
|
326
326
|
if (this.loop) {
|
|
@@ -339,7 +339,7 @@ export class Animation {
|
|
|
339
339
|
* Moves the animation to the previous frame(s).
|
|
340
340
|
* @param {number} quantity - The number of frames to move back by.
|
|
341
341
|
*/
|
|
342
|
-
public previous(quantity = 1) {
|
|
342
|
+
public previous(quantity = 1): void {
|
|
343
343
|
let frame = this._frameIndex - quantity;
|
|
344
344
|
if (frame < 0) {
|
|
345
345
|
if (this.loop) {
|
|
@@ -358,7 +358,7 @@ export class Animation {
|
|
|
358
358
|
* Updates the frame data used by this animation.
|
|
359
359
|
* @param {FrameData} frameData - The new FrameData object to use.
|
|
360
360
|
*/
|
|
361
|
-
public updateFrameData(frameData: FrameData) {
|
|
361
|
+
public updateFrameData(frameData: FrameData): void {
|
|
362
362
|
this._frameData = frameData;
|
|
363
363
|
this.currentFrame = this._frameData
|
|
364
364
|
? this._frameData.getFrame(this._frames[this._frameIndex % this._frames.length])
|
|
@@ -368,7 +368,7 @@ export class Animation {
|
|
|
368
368
|
/**
|
|
369
369
|
* Destroys this animation and cleans up resources.
|
|
370
370
|
*/
|
|
371
|
-
public destroy() {
|
|
371
|
+
public destroy(): void {
|
|
372
372
|
if (!this._frameData) {
|
|
373
373
|
// Already destroyed
|
|
374
374
|
return;
|
|
@@ -392,7 +392,7 @@ export class Animation {
|
|
|
392
392
|
/**
|
|
393
393
|
* Completes this animation, setting it to the final frame.
|
|
394
394
|
*/
|
|
395
|
-
public complete() {
|
|
395
|
+
public complete(): void {
|
|
396
396
|
this._frameIndex = this._frames.length - 1;
|
|
397
397
|
this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]);
|
|
398
398
|
this.isPlaying = false;
|
|
@@ -406,7 +406,7 @@ export class Animation {
|
|
|
406
406
|
* Gets whether this animation is currently paused.
|
|
407
407
|
* @returns {boolean} True if the animation is paused, false otherwise.
|
|
408
408
|
*/
|
|
409
|
-
public get paused() {
|
|
409
|
+
public get paused(): boolean {
|
|
410
410
|
return this.isPaused;
|
|
411
411
|
}
|
|
412
412
|
|
|
@@ -427,7 +427,7 @@ export class Animation {
|
|
|
427
427
|
* Gets whether this animation is currently reversed.
|
|
428
428
|
* @returns {boolean} True if the animation is reversed, false otherwise.
|
|
429
429
|
*/
|
|
430
|
-
public get reversed() {
|
|
430
|
+
public get reversed(): boolean {
|
|
431
431
|
return this.isReversed;
|
|
432
432
|
}
|
|
433
433
|
|
|
@@ -451,7 +451,7 @@ export class Animation {
|
|
|
451
451
|
* Gets the current frame index.
|
|
452
452
|
* @returns {number} The current frame index.
|
|
453
453
|
*/
|
|
454
|
-
public get frame() {
|
|
454
|
+
public get frame(): number {
|
|
455
455
|
if (this.currentFrame !== null) {
|
|
456
456
|
return this.currentFrame.index;
|
|
457
457
|
}
|
|
@@ -477,7 +477,7 @@ export class Animation {
|
|
|
477
477
|
* Gets the current animation speed (frame rate).
|
|
478
478
|
* @returns {number} The frame rate in frames per second.
|
|
479
479
|
*/
|
|
480
|
-
public get speed() {
|
|
480
|
+
public get speed(): number {
|
|
481
481
|
return 1000 / this.delay;
|
|
482
482
|
}
|
|
483
483
|
|
|
@@ -495,7 +495,7 @@ export class Animation {
|
|
|
495
495
|
* Gets whether the update signal is enabled.
|
|
496
496
|
* @returns {boolean} True if the update signal is enabled, false otherwise.
|
|
497
497
|
*/
|
|
498
|
-
public get enableUpdate() {
|
|
498
|
+
public get enableUpdate(): boolean {
|
|
499
499
|
return this.onUpdate !== null;
|
|
500
500
|
}
|
|
501
501
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Frame } from './frame.js';
|
|
1
2
|
import type { Game } from './game.js';
|
|
2
3
|
import { Animation } from './animation.js';
|
|
3
4
|
import { ENGINE_ERROR_CANNOT_SET_FRAME, ENGINE_ERROR_CANNOT_SET_FRAME_NAME } from './error_code.js';
|
|
@@ -5,13 +6,13 @@ import type { Image } from '../display/image.js';
|
|
|
5
6
|
import type { FrameData } from './frame_data.js';
|
|
6
7
|
|
|
7
8
|
export class AnimationManager {
|
|
8
|
-
public sprite!:
|
|
9
|
+
public sprite!: Image;
|
|
9
10
|
public game!: Game;
|
|
10
|
-
public currentFrame!:
|
|
11
|
-
public currentAnim!:
|
|
11
|
+
public currentFrame!: Frame | null;
|
|
12
|
+
public currentAnim!: Animation | null;
|
|
12
13
|
public updateIfVisible!: boolean;
|
|
13
14
|
public isLoaded!: boolean;
|
|
14
|
-
public _frameData!:
|
|
15
|
+
public _frameData!: FrameData | null;
|
|
15
16
|
public _anims!: Record<string, Animation>;
|
|
16
17
|
public _outputFrames!: number[];
|
|
17
18
|
public _frameIndex!: number;
|
|
@@ -35,7 +36,7 @@ export class AnimationManager {
|
|
|
35
36
|
/**
|
|
36
37
|
* Destroys the AnimationManager and cleans up resources.
|
|
37
38
|
*/
|
|
38
|
-
public destroy() {
|
|
39
|
+
public destroy(): void {
|
|
39
40
|
for (const anim of Object.values(this._anims)) {
|
|
40
41
|
anim.destroy();
|
|
41
42
|
}
|
|
@@ -44,7 +45,6 @@ export class AnimationManager {
|
|
|
44
45
|
this._frameData = null;
|
|
45
46
|
this.currentAnim = null;
|
|
46
47
|
this.currentFrame = null;
|
|
47
|
-
this.sprite = null;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/**
|
|
@@ -53,7 +53,7 @@ export class AnimationManager {
|
|
|
53
53
|
* @param {string|number} frame - The frame index or name to set as current.
|
|
54
54
|
* @returns {boolean} True if the frame data was loaded successfully, false otherwise.
|
|
55
55
|
*/
|
|
56
|
-
public loadFrameData(frameData: FrameData, frame: string | number) {
|
|
56
|
+
public loadFrameData(frameData: FrameData | null, frame: string | number): boolean {
|
|
57
57
|
if (!frameData) {
|
|
58
58
|
return false;
|
|
59
59
|
}
|
|
@@ -81,7 +81,7 @@ export class AnimationManager {
|
|
|
81
81
|
* @param {string|number} frame - The frame index or name to set as current.
|
|
82
82
|
* @returns {boolean} True if the frame data was copied successfully, false otherwise.
|
|
83
83
|
*/
|
|
84
|
-
public copyFrameData(frameData: FrameData, frame: string | number) {
|
|
84
|
+
public copyFrameData(frameData: FrameData, frame: string | number): boolean {
|
|
85
85
|
this._frameData = frameData.clone();
|
|
86
86
|
if (this.isLoaded) {
|
|
87
87
|
// We need to update the frameData that the animations are using
|
|
@@ -115,7 +115,7 @@ export class AnimationManager {
|
|
|
115
115
|
frameRate = 60,
|
|
116
116
|
loop = false,
|
|
117
117
|
useNumericIndex?: boolean
|
|
118
|
-
) {
|
|
118
|
+
): Animation {
|
|
119
119
|
const frames = frameList ?? [];
|
|
120
120
|
// If they didn't set the useNumericIndex then let's at least try and guess it
|
|
121
121
|
if (useNumericIndex === undefined) {
|
|
@@ -126,12 +126,12 @@ export class AnimationManager {
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
this._outputFrames = [];
|
|
129
|
-
this._frameData
|
|
129
|
+
this._frameData!.getFrameIndexes(frames, useNumericIndex, this._outputFrames);
|
|
130
130
|
this._anims[name] = new Animation(
|
|
131
131
|
this.game,
|
|
132
132
|
this.sprite,
|
|
133
133
|
name,
|
|
134
|
-
this._frameData
|
|
134
|
+
this._frameData!,
|
|
135
135
|
this._outputFrames,
|
|
136
136
|
frameRate,
|
|
137
137
|
loop
|
|
@@ -149,13 +149,14 @@ export class AnimationManager {
|
|
|
149
149
|
* @param {boolean} useNumericIndex - Whether to treat frameList as numeric indices.
|
|
150
150
|
* @returns {boolean} True if all frames are valid, false otherwise.
|
|
151
151
|
*/
|
|
152
|
-
public validateFrames(frames: string[] | number[], useNumericIndex = false) {
|
|
152
|
+
public validateFrames(frames: string[] | number[], useNumericIndex = false): boolean {
|
|
153
153
|
for (let i = 0; i < frames.length; i += 1) {
|
|
154
|
+
const frame = frames[i]!;
|
|
154
155
|
if (useNumericIndex) {
|
|
155
|
-
if (
|
|
156
|
+
if (Number(frame) > this._frameData!.total) {
|
|
156
157
|
return false;
|
|
157
158
|
}
|
|
158
|
-
} else if (this._frameData
|
|
159
|
+
} else if (!this._frameData!.checkFrameName(String(frame))) {
|
|
159
160
|
return false;
|
|
160
161
|
}
|
|
161
162
|
}
|
|
@@ -172,7 +173,7 @@ export class AnimationManager {
|
|
|
172
173
|
public play(name: string, frameRate: number | null = null, loop: boolean | null = null) {
|
|
173
174
|
if (this._anims[name]) {
|
|
174
175
|
if (this.currentAnim === this._anims[name]) {
|
|
175
|
-
if (this.currentAnim.isPlaying
|
|
176
|
+
if (!this.currentAnim.isPlaying) {
|
|
176
177
|
this.currentAnim.paused = false;
|
|
177
178
|
return this.currentAnim.play(frameRate, loop);
|
|
178
179
|
}
|
|
@@ -194,7 +195,7 @@ export class AnimationManager {
|
|
|
194
195
|
* @param {string} name - The name of the animation to stop, or null to stop the current animation.
|
|
195
196
|
* @param {boolean} resetFrame - Whether to reset the frame to the first frame of the animation.
|
|
196
197
|
*/
|
|
197
|
-
public stop(name: string | null = null, resetFrame = false) {
|
|
198
|
+
public stop(name: string | null = null, resetFrame = false): void {
|
|
198
199
|
if (this.currentAnim && (typeof name !== 'string' || name === this.currentAnim.name)) {
|
|
199
200
|
this.currentAnim.stop(resetFrame);
|
|
200
201
|
}
|
|
@@ -204,7 +205,7 @@ export class AnimationManager {
|
|
|
204
205
|
* Updates the animation manager state.
|
|
205
206
|
* @returns {boolean} True if an animation was updated, false otherwise.
|
|
206
207
|
*/
|
|
207
|
-
public update() {
|
|
208
|
+
public update(): boolean {
|
|
208
209
|
if (this.updateIfVisible && !this.sprite.visible) {
|
|
209
210
|
return false;
|
|
210
211
|
}
|
|
@@ -219,7 +220,7 @@ export class AnimationManager {
|
|
|
219
220
|
* Advances the current animation by a specified number of frames.
|
|
220
221
|
* @param {number} quantity - The number of frames to advance by.
|
|
221
222
|
*/
|
|
222
|
-
public next(quantity: number) {
|
|
223
|
+
public next(quantity: number): void {
|
|
223
224
|
if (this.currentAnim) {
|
|
224
225
|
this.currentAnim.next(quantity);
|
|
225
226
|
this.currentFrame = this.currentAnim.currentFrame;
|
|
@@ -230,7 +231,7 @@ export class AnimationManager {
|
|
|
230
231
|
* Moves the current animation back by a specified number of frames.
|
|
231
232
|
* @param {number} quantity - The number of frames to move back by.
|
|
232
233
|
*/
|
|
233
|
-
public previous(quantity: number) {
|
|
234
|
+
public previous(quantity: number): void {
|
|
234
235
|
if (this.currentAnim) {
|
|
235
236
|
this.currentAnim.previous(quantity);
|
|
236
237
|
this.currentFrame = this.currentAnim.currentFrame;
|
|
@@ -242,7 +243,7 @@ export class AnimationManager {
|
|
|
242
243
|
* @param {string} name - The name of the animation to retrieve.
|
|
243
244
|
* @returns {Animation} The Animation object, or null if not found.
|
|
244
245
|
*/
|
|
245
|
-
public getAnimation(name: string) {
|
|
246
|
+
public getAnimation(name: string): Animation | null {
|
|
246
247
|
if (name && this._anims[name]) {
|
|
247
248
|
return this._anims[name];
|
|
248
249
|
}
|
|
@@ -252,7 +253,7 @@ export class AnimationManager {
|
|
|
252
253
|
/**
|
|
253
254
|
* Refreshes the current frame texture (not implemented).
|
|
254
255
|
*/
|
|
255
|
-
public refreshFrame() {
|
|
256
|
+
public refreshFrame(): void {
|
|
256
257
|
// TODO
|
|
257
258
|
this.game.logger.warn('animation_manager.refreshFrame() is not implemented');
|
|
258
259
|
// this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]);
|
|
@@ -271,7 +272,7 @@ export class AnimationManager {
|
|
|
271
272
|
* @returns {number} The total number of frames.
|
|
272
273
|
*/
|
|
273
274
|
public get frameTotal() {
|
|
274
|
-
return this._frameData
|
|
275
|
+
return this._frameData!.total;
|
|
275
276
|
}
|
|
276
277
|
|
|
277
278
|
/**
|
|
@@ -279,14 +280,16 @@ export class AnimationManager {
|
|
|
279
280
|
* @returns {boolean} True if the current animation is paused, false otherwise.
|
|
280
281
|
*/
|
|
281
282
|
public get paused() {
|
|
282
|
-
return this.currentAnim
|
|
283
|
+
return this.currentAnim?.isPaused ?? false;
|
|
283
284
|
}
|
|
284
285
|
|
|
285
286
|
/**
|
|
286
287
|
* Sets the paused state of the current animation.
|
|
287
288
|
*/
|
|
288
289
|
public set paused(value) {
|
|
289
|
-
this.currentAnim
|
|
290
|
+
if (this.currentAnim) {
|
|
291
|
+
this.currentAnim.paused = value;
|
|
292
|
+
}
|
|
290
293
|
}
|
|
291
294
|
|
|
292
295
|
/**
|
|
@@ -21,7 +21,7 @@ export const spriteSheet = (
|
|
|
21
21
|
frameMax: number,
|
|
22
22
|
margin: number,
|
|
23
23
|
spacing: number
|
|
24
|
-
) => {
|
|
24
|
+
): FrameData | null => {
|
|
25
25
|
let img: any = key;
|
|
26
26
|
if (typeof key === 'string') {
|
|
27
27
|
img = game.cache.getImage(key);
|
|
@@ -71,7 +71,7 @@ export const spriteSheet = (
|
|
|
71
71
|
* @param {object} json - TBD.
|
|
72
72
|
* @returns {FrameData} TBD.
|
|
73
73
|
*/
|
|
74
|
-
export const JSONDataHash = (game: Game, json: any, _key?: any) => {
|
|
74
|
+
export const JSONDataHash = (game: Game, json: any, _key?: any): FrameData | null => {
|
|
75
75
|
if (!json.frames) {
|
|
76
76
|
game.logger.warn('JSONDataHash: Invalid Texture Atlas JSON given, missing frames object', json);
|
|
77
77
|
return null;
|
|
@@ -27,7 +27,7 @@ export class ArraySet {
|
|
|
27
27
|
* @param {object} item - TBD.
|
|
28
28
|
* @returns {number} TBD.
|
|
29
29
|
*/
|
|
30
|
-
public getIndex(item: any) {
|
|
30
|
+
public getIndex(item: any): number {
|
|
31
31
|
return this.list.indexOf(item);
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -53,14 +53,14 @@ export class ArraySet {
|
|
|
53
53
|
* @param {object} item - TBD.
|
|
54
54
|
* @returns {boolean} TBD.
|
|
55
55
|
*/
|
|
56
|
-
public exists(item: any) {
|
|
56
|
+
public exists(item: any): boolean {
|
|
57
57
|
return this.list.includes(item);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* TBD.
|
|
62
62
|
*/
|
|
63
|
-
public reset() {
|
|
63
|
+
public reset(): void {
|
|
64
64
|
this.list.length = 0;
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -83,7 +83,7 @@ export class ArraySet {
|
|
|
83
83
|
* @param {string} key - TBD.
|
|
84
84
|
* @param {object} value - TBD.
|
|
85
85
|
*/
|
|
86
|
-
public setAll(key: string, value: any) {
|
|
86
|
+
public setAll(key: string, value: any): void {
|
|
87
87
|
let i = this.list.length;
|
|
88
88
|
while (i) {
|
|
89
89
|
i -= 1;
|
|
@@ -98,7 +98,7 @@ export class ArraySet {
|
|
|
98
98
|
* @param {string} key - TBD.
|
|
99
99
|
* @param {...any} args - TBD.
|
|
100
100
|
*/
|
|
101
|
-
public callAll(key: string, ...args: unknown[]) {
|
|
101
|
+
public callAll(key: string, ...args: unknown[]): void {
|
|
102
102
|
let i = this.list.length;
|
|
103
103
|
while (i) {
|
|
104
104
|
i -= 1;
|
|
@@ -112,7 +112,7 @@ export class ArraySet {
|
|
|
112
112
|
* TBD.
|
|
113
113
|
* @param {boolean} destroy - TBD.
|
|
114
114
|
*/
|
|
115
|
-
public removeAll(destroy = false) {
|
|
115
|
+
public removeAll(destroy = false): void {
|
|
116
116
|
let i = this.list.length;
|
|
117
117
|
while (i) {
|
|
118
118
|
i -= 1;
|
|
@@ -131,7 +131,7 @@ export class ArraySet {
|
|
|
131
131
|
* TBD.
|
|
132
132
|
* @returns {number} TBD.
|
|
133
133
|
*/
|
|
134
|
-
public get total() {
|
|
134
|
+
public get total(): number {
|
|
135
135
|
return this.list.length;
|
|
136
136
|
}
|
|
137
137
|
|