@vpmedia/phaser 1.95.0 → 1.97.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/CHANGELOG.md +51 -0
- package/package.json +10 -10
- package/src/phaser/core/animation.js +61 -56
- package/src/phaser/core/animation_manager.js +55 -55
- package/src/phaser/core/cache.js +154 -154
- package/src/phaser/core/device.js +2 -1
- package/src/phaser/core/device_util.js +27 -27
- package/src/phaser/core/dom.js +43 -43
- package/src/phaser/core/event_manager.js +63 -63
- package/src/phaser/core/factory.js +47 -47
- package/src/phaser/core/frame.js +30 -30
- package/src/phaser/core/frame_data.js +30 -28
- package/src/phaser/core/frame_util.js +8 -8
- package/src/phaser/core/game.js +34 -18
- package/src/phaser/core/loader.js +170 -170
- package/src/phaser/core/loader_parser.js +22 -22
- package/src/phaser/core/raf.js +1 -1
- package/src/phaser/core/scene.js +16 -10
- package/src/phaser/core/scene_manager.js +51 -43
- package/src/phaser/core/signal.js +68 -52
- package/src/phaser/core/signal.test.js +37 -0
- package/src/phaser/core/sound.js +54 -54
- package/src/phaser/core/sound_manager.js +49 -49
- package/src/phaser/core/stage.js +16 -16
- package/src/phaser/core/time.js +30 -30
- package/src/phaser/core/timer.js +79 -64
- package/src/phaser/core/timer_event.js +9 -9
- package/src/phaser/core/tween.js +90 -90
- package/src/phaser/core/tween_data.js +30 -30
- package/src/phaser/core/tween_manager.js +29 -24
- package/src/phaser/core/world.js +4 -3
- package/src/phaser/display/bitmap_text.js +61 -54
- package/src/phaser/display/button.js +48 -47
- package/src/phaser/display/canvas/buffer.js +8 -8
- package/src/phaser/display/canvas/graphics.js +8 -8
- package/src/phaser/display/canvas/masker.js +5 -5
- package/src/phaser/display/canvas/pool.js +18 -18
- package/src/phaser/display/canvas/renderer.js +16 -16
- package/src/phaser/display/canvas/tinter.js +22 -22
- package/src/phaser/display/canvas/util.js +42 -42
- package/src/phaser/display/display_object.js +119 -108
- package/src/phaser/display/graphics.js +112 -112
- package/src/phaser/display/graphics_data.js +10 -10
- package/src/phaser/display/graphics_data_util.js +3 -3
- package/src/phaser/display/group.js +50 -50
- package/src/phaser/display/image.js +54 -50
- package/src/phaser/display/sprite_batch.js +2 -2
- package/src/phaser/display/sprite_util.js +19 -19
- package/src/phaser/display/text.js +212 -187
- package/src/phaser/display/webgl/abstract_filter.js +4 -4
- package/src/phaser/display/webgl/base_texture.js +9 -9
- package/src/phaser/display/webgl/blend_manager.js +7 -7
- package/src/phaser/display/webgl/earcut.js +95 -95
- package/src/phaser/display/webgl/earcut_node.js +4 -4
- package/src/phaser/display/webgl/fast_sprite_batch.js +15 -15
- package/src/phaser/display/webgl/filter_manager.js +9 -9
- package/src/phaser/display/webgl/filter_texture.js +10 -10
- package/src/phaser/display/webgl/graphics.js +37 -37
- package/src/phaser/display/webgl/graphics_data.js +4 -4
- package/src/phaser/display/webgl/mask_manager.js +6 -6
- package/src/phaser/display/webgl/render_texture.js +16 -16
- package/src/phaser/display/webgl/renderer.js +20 -20
- package/src/phaser/display/webgl/shader/complex.js +4 -4
- package/src/phaser/display/webgl/shader/fast.js +4 -4
- package/src/phaser/display/webgl/shader/normal.js +8 -8
- package/src/phaser/display/webgl/shader/primitive.js +4 -4
- package/src/phaser/display/webgl/shader/strip.js +4 -4
- package/src/phaser/display/webgl/shader_manager.js +9 -9
- package/src/phaser/display/webgl/sprite_batch.js +18 -18
- package/src/phaser/display/webgl/stencil_manager.js +16 -16
- package/src/phaser/display/webgl/texture.js +13 -13
- package/src/phaser/display/webgl/texture_util.js +8 -8
- package/src/phaser/display/webgl/util.js +25 -25
- package/src/phaser/geom/circle.js +69 -69
- package/src/phaser/geom/circle.test.js +1 -0
- package/src/phaser/geom/ellipse.js +28 -28
- package/src/phaser/geom/ellipse.test.js +1 -0
- package/src/phaser/geom/line.js +93 -93
- package/src/phaser/geom/line.test.js +1 -0
- package/src/phaser/geom/matrix.js +54 -54
- package/src/phaser/geom/matrix.test.js +1 -0
- package/src/phaser/geom/point.js +96 -96
- package/src/phaser/geom/point.test.js +1 -0
- package/src/phaser/geom/polygon.js +22 -22
- package/src/phaser/geom/rectangle.js +132 -132
- package/src/phaser/geom/rectangle.test.js +1 -0
- package/src/phaser/geom/rounded_rectangle.js +12 -12
- package/src/phaser/geom/rounded_rectangle.test.js +1 -0
- package/src/phaser/geom/util/circle.js +33 -33
- package/src/phaser/geom/util/circle.test.js +1 -0
- package/src/phaser/geom/util/ellipse.js +5 -5
- package/src/phaser/geom/util/ellipse.test.js +1 -0
- package/src/phaser/geom/util/line.js +26 -26
- package/src/phaser/geom/util/line.test.js +1 -0
- package/src/phaser/geom/util/matrix.js +8 -8
- package/src/phaser/geom/util/matrix.test.js +1 -0
- package/src/phaser/geom/util/point.js +97 -97
- package/src/phaser/geom/util/point.test.js +1 -0
- package/src/phaser/geom/util/polygon.js +4 -4
- package/src/phaser/geom/util/polygon.test.js +1 -0
- package/src/phaser/geom/util/rectangle.js +74 -74
- package/src/phaser/geom/util/rectangle.test.js +1 -0
- package/src/phaser/geom/util/rounded_rectangle.js +4 -4
- package/src/phaser/geom/util/rounded_rectangle.test.js +1 -0
- package/src/phaser/util/math.js +81 -81
- package/src/phaser/util/math.test.js +1 -0
- package/types/phaser/core/animation.d.ts +61 -56
- package/types/phaser/core/animation.d.ts.map +1 -1
- package/types/phaser/core/animation_manager.d.ts +55 -55
- package/types/phaser/core/cache.d.ts +154 -154
- package/types/phaser/core/device.d.ts.map +1 -1
- package/types/phaser/core/dom.d.ts +43 -43
- package/types/phaser/core/event_manager.d.ts +63 -63
- package/types/phaser/core/factory.d.ts +47 -47
- package/types/phaser/core/frame.d.ts +30 -30
- package/types/phaser/core/frame_data.d.ts +28 -27
- package/types/phaser/core/frame_data.d.ts.map +1 -1
- package/types/phaser/core/game.d.ts +52 -19
- package/types/phaser/core/game.d.ts.map +1 -1
- package/types/phaser/core/loader.d.ts +170 -170
- package/types/phaser/core/loader_parser.d.ts.map +1 -1
- package/types/phaser/core/raf.d.ts +1 -1
- package/types/phaser/core/scene.d.ts +15 -9
- package/types/phaser/core/scene.d.ts.map +1 -1
- package/types/phaser/core/scene_manager.d.ts +51 -43
- package/types/phaser/core/scene_manager.d.ts.map +1 -1
- package/types/phaser/core/signal.d.ts +54 -51
- package/types/phaser/core/signal.d.ts.map +1 -1
- package/types/phaser/core/sound.d.ts +54 -54
- package/types/phaser/core/sound_manager.d.ts +49 -49
- package/types/phaser/core/stage.d.ts +10 -10
- package/types/phaser/core/time.d.ts +30 -30
- package/types/phaser/core/timer.d.ts +64 -64
- package/types/phaser/core/timer_event.d.ts +9 -9
- package/types/phaser/core/tween.d.ts +90 -90
- package/types/phaser/core/tween_data.d.ts +30 -30
- package/types/phaser/core/tween_manager.d.ts +29 -24
- package/types/phaser/core/tween_manager.d.ts.map +1 -1
- package/types/phaser/core/world.d.ts +4 -3
- package/types/phaser/core/world.d.ts.map +1 -1
- package/types/phaser/display/bitmap_text.d.ts +59 -52
- package/types/phaser/display/bitmap_text.d.ts.map +1 -1
- package/types/phaser/display/button.d.ts +47 -46
- package/types/phaser/display/button.d.ts.map +1 -1
- package/types/phaser/display/canvas/buffer.d.ts +8 -8
- package/types/phaser/display/canvas/renderer.d.ts +16 -16
- package/types/phaser/display/display_object.d.ts +119 -108
- package/types/phaser/display/display_object.d.ts.map +1 -1
- package/types/phaser/display/graphics.d.ts +101 -101
- package/types/phaser/display/graphics_data.d.ts +10 -10
- package/types/phaser/display/group.d.ts +47 -47
- package/types/phaser/display/image.d.ts +42 -40
- package/types/phaser/display/image.d.ts.map +1 -1
- package/types/phaser/display/text.d.ts +207 -184
- 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/base_texture.d.ts +9 -9
- package/types/phaser/display/webgl/blend_manager.d.ts +6 -6
- package/types/phaser/display/webgl/earcut.d.ts +95 -95
- package/types/phaser/display/webgl/earcut_node.d.ts +4 -4
- package/types/phaser/display/webgl/fast_sprite_batch.d.ts +15 -15
- package/types/phaser/display/webgl/filter_manager.d.ts +8 -8
- package/types/phaser/display/webgl/filter_texture.d.ts +10 -10
- package/types/phaser/display/webgl/graphics_data.d.ts +4 -4
- package/types/phaser/display/webgl/render_texture.d.ts +16 -16
- package/types/phaser/display/webgl/renderer.d.ts +20 -20
- package/types/phaser/display/webgl/shader/complex.d.ts +4 -4
- package/types/phaser/display/webgl/shader/fast.d.ts +4 -4
- package/types/phaser/display/webgl/shader/normal.d.ts +8 -8
- package/types/phaser/display/webgl/shader/primitive.d.ts +4 -4
- package/types/phaser/display/webgl/shader/strip.d.ts +4 -4
- package/types/phaser/display/webgl/shader_manager.d.ts +8 -8
- package/types/phaser/display/webgl/sprite_batch.d.ts +17 -17
- package/types/phaser/display/webgl/stencil_manager.d.ts +15 -15
- package/types/phaser/display/webgl/texture.d.ts +12 -12
- package/types/phaser/geom/circle.d.ts +69 -69
- package/types/phaser/geom/ellipse.d.ts +28 -28
- package/types/phaser/geom/line.d.ts +93 -93
- package/types/phaser/geom/matrix.d.ts +54 -54
- package/types/phaser/geom/point.d.ts +96 -96
- package/types/phaser/geom/polygon.d.ts +22 -22
- package/types/phaser/geom/rectangle.d.ts +132 -132
- package/types/phaser/geom/rounded_rectangle.d.ts +12 -12
- package/pnpm-workspace.yaml +0 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export class Loader {
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* @param {import('./game.js').Game} game -
|
|
3
|
+
* Creates a new Loader instance.
|
|
4
|
+
* @param {import('./game.js').Game} game - Reference to the Phaser Game instance.
|
|
5
5
|
*/
|
|
6
6
|
constructor(game: import("./game.js").Game);
|
|
7
7
|
game: import("./game.js").Game;
|
|
@@ -43,254 +43,254 @@ export class Loader {
|
|
|
43
43
|
_loadedPackCount: number;
|
|
44
44
|
_loadedFileCount: number;
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
47
|
-
* @param {import('../display/image.js').Image} sprite -
|
|
48
|
-
* @param {number} direction -
|
|
46
|
+
* Sets the preload sprite for displaying loading progress.
|
|
47
|
+
* @param {import('../display/image.js').Image} sprite - The image to use as the preload sprite.
|
|
48
|
+
* @param {number} direction - The direction of the progress (0 = horizontal, 1 = vertical).
|
|
49
49
|
*/
|
|
50
50
|
setPreloadSprite(sprite: import("../display/image.js").Image, direction?: number): void;
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
52
|
+
* Resizes the preload sprite when the window is resized.
|
|
53
53
|
*/
|
|
54
54
|
resize(): void;
|
|
55
55
|
/**
|
|
56
|
-
*
|
|
57
|
-
* @param {string} type -
|
|
58
|
-
* @param {string} key -
|
|
59
|
-
* @returns {boolean}
|
|
56
|
+
* Checks if a file with the given type and key already exists in the file list.
|
|
57
|
+
* @param {string} type - The type of file to check for.
|
|
58
|
+
* @param {string} key - The key of the file to check for.
|
|
59
|
+
* @returns {boolean} True if the file exists, false otherwise.
|
|
60
60
|
*/
|
|
61
61
|
checkKeyExists(type: string, key: string): boolean;
|
|
62
62
|
/**
|
|
63
|
-
*
|
|
64
|
-
* @param {string} type -
|
|
65
|
-
* @param {string} key -
|
|
66
|
-
* @returns {number}
|
|
63
|
+
* Gets the index of a file in the file list by type and key.
|
|
64
|
+
* @param {string} type - The type of file to find.
|
|
65
|
+
* @param {string} key - The key of the file to find.
|
|
66
|
+
* @returns {number} The index of the file in the list, or -1 if not found.
|
|
67
67
|
*/
|
|
68
68
|
getAssetIndex(type: string, key: string): number;
|
|
69
69
|
/**
|
|
70
|
-
*
|
|
71
|
-
* @param {string} type -
|
|
72
|
-
* @param {string} key -
|
|
73
|
-
* @returns {{index: number, file: object} | null}
|
|
70
|
+
* Gets a file from the file list by type and key.
|
|
71
|
+
* @param {string} type - The type of file to get.
|
|
72
|
+
* @param {string} key - The key of the file to get.
|
|
73
|
+
* @returns {{index: number, file: object} | null} The file and its index, or null if not found.
|
|
74
74
|
*/
|
|
75
75
|
getAsset(type: string, key: string): {
|
|
76
76
|
index: number;
|
|
77
77
|
file: object;
|
|
78
78
|
} | null;
|
|
79
79
|
/**
|
|
80
|
-
*
|
|
81
|
-
* @param {boolean} hard -
|
|
82
|
-
* @param {boolean} clearEvents -
|
|
80
|
+
* Resets the loader state, optionally clearing event listeners.
|
|
81
|
+
* @param {boolean} hard - Whether to perform a hard reset (clears preload sprite).
|
|
82
|
+
* @param {boolean} clearEvents - Whether to clear event listeners.
|
|
83
83
|
*/
|
|
84
84
|
reset(hard?: boolean, clearEvents?: boolean): void;
|
|
85
85
|
/**
|
|
86
|
-
*
|
|
87
|
-
* @param {string} type -
|
|
88
|
-
* @param {string} key -
|
|
89
|
-
* @param {string} url -
|
|
90
|
-
* @param {object} properties -
|
|
91
|
-
* @param {boolean} overwrite -
|
|
92
|
-
* @param {string} extension -
|
|
93
|
-
* @returns {Loader}
|
|
86
|
+
* Adds a file to the file list for loading.
|
|
87
|
+
* @param {string} type - The type of file to add.
|
|
88
|
+
* @param {string} key - The key to identify the file.
|
|
89
|
+
* @param {string} url - The URL of the file to load.
|
|
90
|
+
* @param {object} properties - Additional properties for the file.
|
|
91
|
+
* @param {boolean} overwrite - Whether to overwrite an existing file with the same key.
|
|
92
|
+
* @param {string} extension - The file extension to use if URL is not provided.
|
|
93
|
+
* @returns {Loader} This Loader instance for chaining.
|
|
94
94
|
*/
|
|
95
95
|
addToFileList(type: string, key?: string, url?: string, properties?: object, overwrite?: boolean, extension?: string): Loader;
|
|
96
96
|
/**
|
|
97
|
-
*
|
|
98
|
-
* @param {string} type -
|
|
99
|
-
* @param {string} key -
|
|
100
|
-
* @param {string} url -
|
|
101
|
-
* @param {object} properties -
|
|
102
|
-
* @returns {Loader}
|
|
97
|
+
* Replaces a file in the file list with new properties.
|
|
98
|
+
* @param {string} type - The type of file to replace.
|
|
99
|
+
* @param {string} key - The key of the file to replace.
|
|
100
|
+
* @param {string} url - The new URL for the file.
|
|
101
|
+
* @param {object} properties - The new properties for the file.
|
|
102
|
+
* @returns {Loader} This Loader instance for chaining.
|
|
103
103
|
*/
|
|
104
104
|
replaceInFileList(type: string, key: string, url: string, properties: object): Loader;
|
|
105
105
|
/**
|
|
106
|
-
*
|
|
107
|
-
* @param {string} key -
|
|
108
|
-
* @param {string} url -
|
|
109
|
-
* @param {object} data -
|
|
110
|
-
* @param {object} callbackContext -
|
|
111
|
-
* @returns {Loader}
|
|
106
|
+
* Adds a pack file to the file list.
|
|
107
|
+
* @param {string} key - The key to identify the pack file.
|
|
108
|
+
* @param {string} url - The URL of the pack file to load.
|
|
109
|
+
* @param {object} data - The parsed pack data.
|
|
110
|
+
* @param {object} callbackContext - The context in which to call the callback.
|
|
111
|
+
* @returns {Loader} This Loader instance for chaining.
|
|
112
112
|
*/
|
|
113
113
|
pack(key: string, url: string, data: object, callbackContext: object): Loader;
|
|
114
114
|
/**
|
|
115
|
-
*
|
|
116
|
-
* @param {string} key -
|
|
117
|
-
* @param {string} url -
|
|
118
|
-
* @param {boolean} overwrite -
|
|
119
|
-
* @returns {Loader}
|
|
115
|
+
* Adds an image file to the file list.
|
|
116
|
+
* @param {string} key - The key to identify the image file.
|
|
117
|
+
* @param {string} url - The URL of the image file to load.
|
|
118
|
+
* @param {boolean} overwrite - Whether to overwrite an existing file with the same key.
|
|
119
|
+
* @returns {Loader} This Loader instance for chaining.
|
|
120
120
|
*/
|
|
121
121
|
image(key: string, url: string, overwrite?: boolean): Loader;
|
|
122
122
|
/**
|
|
123
|
-
*
|
|
124
|
-
* @param {string[]} keys -
|
|
125
|
-
* @param {string[]} urls -
|
|
126
|
-
* @returns {Loader}
|
|
123
|
+
* Adds multiple image files to the file list.
|
|
124
|
+
* @param {string[]} keys - The keys to identify the image files.
|
|
125
|
+
* @param {string[]} urls - The URLs of the image files to load.
|
|
126
|
+
* @returns {Loader} This Loader instance for chaining.
|
|
127
127
|
*/
|
|
128
128
|
images(keys: string[], urls: string[]): Loader;
|
|
129
129
|
/**
|
|
130
|
-
*
|
|
131
|
-
* @param {string} key -
|
|
132
|
-
* @param {string} url -
|
|
133
|
-
* @param {boolean} overwrite -
|
|
134
|
-
* @returns {Loader}
|
|
130
|
+
* Adds a text file to the file list.
|
|
131
|
+
* @param {string} key - The key to identify the text file.
|
|
132
|
+
* @param {string} url - The URL of the text file to load.
|
|
133
|
+
* @param {boolean} overwrite - Whether to overwrite an existing file with the same key.
|
|
134
|
+
* @returns {Loader} This Loader instance for chaining.
|
|
135
135
|
*/
|
|
136
136
|
text(key: string, url: string, overwrite?: boolean): Loader;
|
|
137
137
|
/**
|
|
138
|
-
*
|
|
139
|
-
* @param {string} key -
|
|
140
|
-
* @param {string} url -
|
|
141
|
-
* @param {boolean} overwrite -
|
|
142
|
-
* @returns {Loader}
|
|
138
|
+
* Adds a JSON file to the file list.
|
|
139
|
+
* @param {string} key - The key to identify the JSON file.
|
|
140
|
+
* @param {string} url - The URL of the JSON file to load.
|
|
141
|
+
* @param {boolean} overwrite - Whether to overwrite an existing file with the same key.
|
|
142
|
+
* @returns {Loader} This Loader instance for chaining.
|
|
143
143
|
*/
|
|
144
144
|
json(key: string, url: string, overwrite?: boolean): Loader;
|
|
145
145
|
/**
|
|
146
|
-
*
|
|
147
|
-
* @param {string} key -
|
|
148
|
-
* @param {string} url -
|
|
149
|
-
* @param {boolean} overwrite -
|
|
150
|
-
* @returns {Loader}
|
|
146
|
+
* Adds an XML file to the file list.
|
|
147
|
+
* @param {string} key - The key to identify the XML file.
|
|
148
|
+
* @param {string} url - The URL of the XML file to load.
|
|
149
|
+
* @param {boolean} overwrite - Whether to overwrite an existing file with the same key.
|
|
150
|
+
* @returns {Loader} This Loader instance for chaining.
|
|
151
151
|
*/
|
|
152
152
|
xml(key: string, url: string, overwrite?: boolean): Loader;
|
|
153
153
|
/**
|
|
154
|
-
*
|
|
155
|
-
* @param {string} key -
|
|
156
|
-
* @param {string} url -
|
|
157
|
-
* @param {number} frameWidth -
|
|
158
|
-
* @param {number} frameHeight -
|
|
159
|
-
* @param {number} frameMax -
|
|
160
|
-
* @param {number} margin -
|
|
161
|
-
* @param {number} spacing -
|
|
162
|
-
* @returns {Loader}
|
|
154
|
+
* Adds a spritesheet file to the file list.
|
|
155
|
+
* @param {string} key - The key to identify the spritesheet file.
|
|
156
|
+
* @param {string} url - The URL of the spritesheet file to load.
|
|
157
|
+
* @param {number} frameWidth - The width of each frame in the spritesheet.
|
|
158
|
+
* @param {number} frameHeight - The height of each frame in the spritesheet.
|
|
159
|
+
* @param {number} frameMax - The maximum number of frames to load (-1 for all).
|
|
160
|
+
* @param {number} margin - The margin around each frame in pixels.
|
|
161
|
+
* @param {number} spacing - The spacing between frames in pixels.
|
|
162
|
+
* @returns {Loader} This Loader instance for chaining.
|
|
163
163
|
*/
|
|
164
164
|
spritesheet(key: string, url: string, frameWidth: number, frameHeight: number, frameMax?: number, margin?: number, spacing?: number): Loader;
|
|
165
165
|
/**
|
|
166
|
-
*
|
|
167
|
-
* @param {string} key -
|
|
168
|
-
* @param {string[]} urls -
|
|
169
|
-
* @param {boolean} autoDecode -
|
|
170
|
-
* @returns {Loader}
|
|
166
|
+
* Adds an audio file to the file list.
|
|
167
|
+
* @param {string} key - The key to identify the audio file.
|
|
168
|
+
* @param {string[]} urls - The URLs of the audio files to load.
|
|
169
|
+
* @param {boolean} autoDecode - Whether to automatically decode the audio file.
|
|
170
|
+
* @returns {Loader} This Loader instance for chaining.
|
|
171
171
|
*/
|
|
172
172
|
audio(key: string, urls: string[], autoDecode?: boolean): Loader;
|
|
173
173
|
/**
|
|
174
|
-
*
|
|
175
|
-
* @param {string} key -
|
|
176
|
-
* @param {string} urls -
|
|
177
|
-
* @param {string} jsonURL -
|
|
178
|
-
* @param {object} jsonData -
|
|
179
|
-
* @param {boolean} autoDecode -
|
|
180
|
-
* @returns {Loader}
|
|
174
|
+
* Adds an audio sprite file to the file list.
|
|
175
|
+
* @param {string} key - The key to identify the audio sprite file.
|
|
176
|
+
* @param {string} urls - The URLs of the audio files to load.
|
|
177
|
+
* @param {string} jsonURL - The URL of the JSON file containing audio sprite data.
|
|
178
|
+
* @param {object} jsonData - The parsed JSON data containing audio sprite data.
|
|
179
|
+
* @param {boolean} autoDecode - Whether to automatically decode the audio file.
|
|
180
|
+
* @returns {Loader} This Loader instance for chaining.
|
|
181
181
|
*/
|
|
182
182
|
audioSprite(key: string, urls: string, jsonURL: string, jsonData: object, autoDecode?: boolean): Loader;
|
|
183
183
|
/**
|
|
184
|
-
*
|
|
185
|
-
* @param {string} key -
|
|
186
|
-
* @param {string} textureURL -
|
|
187
|
-
* @param {string} atlasURL -
|
|
188
|
-
* @param {object} atlasData -
|
|
189
|
-
* @param {number} xSpacing -
|
|
190
|
-
* @param {number} ySpacing -
|
|
191
|
-
* @returns {Loader}
|
|
192
|
-
* @throws {Error}
|
|
184
|
+
* Adds a bitmap font file to the file list.
|
|
185
|
+
* @param {string} key - The key to identify the bitmap font file.
|
|
186
|
+
* @param {string} textureURL - The URL of the font texture image.
|
|
187
|
+
* @param {string} atlasURL - The URL of the XML or JSON file containing font data.
|
|
188
|
+
* @param {object} atlasData - The parsed data containing font information.
|
|
189
|
+
* @param {number} xSpacing - The horizontal spacing between characters in pixels.
|
|
190
|
+
* @param {number} ySpacing - The vertical spacing between characters in pixels.
|
|
191
|
+
* @returns {Loader} This Loader instance for chaining.
|
|
192
|
+
* @throws {Error} If the bitmap font atlas data is invalid.
|
|
193
193
|
*/
|
|
194
194
|
bitmapFont(key: string, textureURL?: string, atlasURL?: string, atlasData?: object, xSpacing?: number, ySpacing?: number): Loader;
|
|
195
195
|
/**
|
|
196
|
-
*
|
|
197
|
-
* @param {string} key -
|
|
198
|
-
* @param {string} textureURL -
|
|
199
|
-
* @param {string} atlasURL -
|
|
200
|
-
* @param {object} atlasData -
|
|
201
|
-
* @param {number} format -
|
|
202
|
-
* @returns {Loader}
|
|
196
|
+
* Adds a texture atlas file to the file list.
|
|
197
|
+
* @param {string} key - The key to identify the texture atlas file.
|
|
198
|
+
* @param {string} textureURL - The URL of the texture image file.
|
|
199
|
+
* @param {string} atlasURL - The URL of the JSON or XML file containing atlas data.
|
|
200
|
+
* @param {object} atlasData - The parsed data containing atlas information.
|
|
201
|
+
* @param {number} format - The format of the atlas file (JSON or XML).
|
|
202
|
+
* @returns {Loader} This Loader instance for chaining.
|
|
203
203
|
*/
|
|
204
204
|
atlas(key: string, textureURL: string, atlasURL?: string, atlasData?: object, format?: number): Loader;
|
|
205
205
|
/**
|
|
206
|
-
*
|
|
207
|
-
* @param {Function} callback -
|
|
208
|
-
* @param {object} callbackContext -
|
|
209
|
-
* @returns {Loader}
|
|
206
|
+
* Creates a sync point for loading files, ensuring all files in the block are loaded before continuing.
|
|
207
|
+
* @param {Function} callback - The callback function to execute within the sync point.
|
|
208
|
+
* @param {object} callbackContext - The context in which to call the callback.
|
|
209
|
+
* @returns {Loader} This Loader instance for chaining.
|
|
210
210
|
*/
|
|
211
211
|
withSyncPoint(callback: Function, callbackContext: object): Loader;
|
|
212
212
|
/**
|
|
213
|
-
*
|
|
214
|
-
* @param {string} type -
|
|
215
|
-
* @param {string} key -
|
|
216
|
-
* @returns {Loader}
|
|
213
|
+
* Adds a sync point to a specific file, preventing other files from loading until this one is processed.
|
|
214
|
+
* @param {string} type - The type of file to add a sync point to.
|
|
215
|
+
* @param {string} key - The key of the file to add a sync point to.
|
|
216
|
+
* @returns {Loader} This Loader instance for chaining.
|
|
217
217
|
*/
|
|
218
218
|
addSyncPoint(type: string, key: string): Loader;
|
|
219
219
|
/**
|
|
220
|
-
*
|
|
221
|
-
* @param {string} type -
|
|
222
|
-
* @param {string} key -
|
|
220
|
+
* Removes a file from the file list if it's not currently loading or loaded.
|
|
221
|
+
* @param {string} type - The type of file to remove.
|
|
222
|
+
* @param {string} key - The key of the file to remove.
|
|
223
223
|
*/
|
|
224
224
|
removeFile(type: string, key: string): void;
|
|
225
225
|
/**
|
|
226
|
-
*
|
|
226
|
+
* Removes all files from the file list.
|
|
227
227
|
*/
|
|
228
228
|
removeAll(): void;
|
|
229
229
|
/**
|
|
230
|
-
*
|
|
230
|
+
* Starts the loading process for all queued files.
|
|
231
231
|
*/
|
|
232
232
|
start(): void;
|
|
233
233
|
/**
|
|
234
|
-
*
|
|
234
|
+
* Processes the loading queue, loading files as appropriate.
|
|
235
235
|
*/
|
|
236
236
|
processLoadQueue(): void;
|
|
237
237
|
/**
|
|
238
|
-
*
|
|
239
|
-
* @param {boolean} abnormal -
|
|
238
|
+
* Finishes the loading process, optionally reporting an abnormal termination.
|
|
239
|
+
* @param {boolean} abnormal - Whether the loading was terminated abnormally.
|
|
240
240
|
*/
|
|
241
241
|
finishedLoading(abnormal?: boolean): void;
|
|
242
242
|
/**
|
|
243
|
-
*
|
|
244
|
-
* @param {object} file -
|
|
245
|
-
* @param {string} errorMessage -
|
|
243
|
+
* Marks a file as complete or failed, updating the loading state.
|
|
244
|
+
* @param {object} file - The file to complete or mark as failed.
|
|
245
|
+
* @param {string} errorMessage - An error message if the file failed to load.
|
|
246
246
|
*/
|
|
247
247
|
asyncComplete(file: object, errorMessage?: string): void;
|
|
248
248
|
/**
|
|
249
|
-
*
|
|
250
|
-
* @param {object} pack -
|
|
249
|
+
* Processes a pack file, adding its contained files to the loader.
|
|
250
|
+
* @param {object} pack - The pack file object to process.
|
|
251
251
|
*/
|
|
252
252
|
processPack(pack: object): void;
|
|
253
253
|
/**
|
|
254
|
-
*
|
|
255
|
-
* @param {string} url -
|
|
256
|
-
* @param {object} file -
|
|
257
|
-
* @returns {string}
|
|
254
|
+
* Transforms a URL by adding the base URL and path prefix if needed.
|
|
255
|
+
* @param {string} url - The original URL to transform.
|
|
256
|
+
* @param {object} file - The file object containing path information.
|
|
257
|
+
* @returns {string} The transformed URL.
|
|
258
258
|
*/
|
|
259
259
|
transformUrl(url: string, file: object): string;
|
|
260
260
|
/**
|
|
261
|
-
*
|
|
262
|
-
* @param {object} file -
|
|
261
|
+
* Loads a file using XMLHttpRequest, handling image files specially.
|
|
262
|
+
* @param {object} file - The file object to load.
|
|
263
263
|
*/
|
|
264
264
|
loadFile(file: object): void;
|
|
265
265
|
/**
|
|
266
|
-
*
|
|
267
|
-
* @param {object} file -
|
|
266
|
+
* Loads an image file using the Image DOM element.
|
|
267
|
+
* @param {object} file - The file object to load.
|
|
268
268
|
*/
|
|
269
269
|
loadImageTag(file: object): void;
|
|
270
270
|
/**
|
|
271
|
-
*
|
|
272
|
-
* @param {object} file -
|
|
273
|
-
* @param {string} url -
|
|
274
|
-
* @param {string} type -
|
|
275
|
-
* @param {Function} onload -
|
|
276
|
-
* @param {Function} onerror -
|
|
271
|
+
* Loads a file using XMLHttpRequest with the specified parameters.
|
|
272
|
+
* @param {object} file - The file object to load.
|
|
273
|
+
* @param {string} url - The URL of the file to load.
|
|
274
|
+
* @param {string} type - The expected response type (e.g., 'text', 'arraybuffer').
|
|
275
|
+
* @param {Function} onload - The function to call when the file loads successfully.
|
|
276
|
+
* @param {Function} onerror - The function to call if the file fails to load.
|
|
277
277
|
*/
|
|
278
278
|
xhrLoad(file: object, url: string, type: string, onload: Function, onerror?: Function): void;
|
|
279
279
|
/**
|
|
280
|
-
*
|
|
280
|
+
* Placeholder for XDomainRequest loading (not implemented).
|
|
281
281
|
*/
|
|
282
282
|
xhrLoadWithXDR(): void;
|
|
283
283
|
/**
|
|
284
|
-
*
|
|
285
|
-
* @param {object[]} urls -
|
|
286
|
-
* @returns {string}
|
|
284
|
+
* Gets the first supported audio URL from a list of URLs.
|
|
285
|
+
* @param {object[]} urls - The array of URLs to check for supported audio formats.
|
|
286
|
+
* @returns {string} The first URL with a supported audio format, or null if none found.
|
|
287
287
|
*/
|
|
288
288
|
getAudioURL(urls: object[]): string;
|
|
289
289
|
/**
|
|
290
|
-
*
|
|
291
|
-
* @param {object} file -
|
|
292
|
-
* @param {XMLHttpRequest} xhr -
|
|
293
|
-
* @param {number | string} reason -
|
|
290
|
+
* Handles file loading errors, optionally retrying or marking the file as failed.
|
|
291
|
+
* @param {object} file - The file object that failed to load.
|
|
292
|
+
* @param {XMLHttpRequest} xhr - The XMLHttpRequest object that failed.
|
|
293
|
+
* @param {number | string} reason - The error code or message explaining the failure.
|
|
294
294
|
*/
|
|
295
295
|
fileError(file: object, xhr?: XMLHttpRequest, reason?: number | string): void;
|
|
296
296
|
/**
|
|
@@ -301,9 +301,9 @@ export class Loader {
|
|
|
301
301
|
*/
|
|
302
302
|
fileComplete(file: object, xhr: XMLHttpRequest): void;
|
|
303
303
|
/**
|
|
304
|
-
*
|
|
305
|
-
* @param {object} file -
|
|
306
|
-
* @param {XMLHttpRequest} xhr -
|
|
304
|
+
* Handles successful file loading, processing the file content appropriately.
|
|
305
|
+
* @param {object} file - The file object that was loaded successfully.
|
|
306
|
+
* @param {XMLHttpRequest} xhr - The XMLHttpRequest object containing the file data.
|
|
307
307
|
*/
|
|
308
308
|
jsonLoadComplete(file: object, xhr: XMLHttpRequest): void;
|
|
309
309
|
/**
|
|
@@ -311,55 +311,55 @@ export class Loader {
|
|
|
311
311
|
*/
|
|
312
312
|
csvLoadComplete(): void;
|
|
313
313
|
/**
|
|
314
|
-
*
|
|
315
|
-
* @param {object} file -
|
|
316
|
-
* @param {XMLHttpRequest} xhr -
|
|
314
|
+
* Processes JSON file data after loading.
|
|
315
|
+
* @param {object} file - The file object containing the JSON data.
|
|
316
|
+
* @param {XMLHttpRequest} xhr - The XMLHttpRequest object containing the file data.
|
|
317
317
|
*/
|
|
318
318
|
xmlLoadComplete(file: object, xhr: XMLHttpRequest): void;
|
|
319
319
|
/**
|
|
320
|
-
*
|
|
321
|
-
* @param {object} data -
|
|
322
|
-
* @returns {Document}
|
|
320
|
+
* Parses XML string data into a DOM Document object.
|
|
321
|
+
* @param {object} data - The XML string data to parse.
|
|
322
|
+
* @returns {Document} The parsed DOM Document, or null if parsing failed.
|
|
323
323
|
*/
|
|
324
324
|
parseXml(data: object): Document;
|
|
325
325
|
/**
|
|
326
|
-
*
|
|
326
|
+
* Updates the preload sprite's progress indicator.
|
|
327
327
|
*/
|
|
328
328
|
updateProgress(): void;
|
|
329
329
|
/**
|
|
330
|
-
*
|
|
331
|
-
* @param {string} message -
|
|
332
|
-
* @param {string|object} data -
|
|
330
|
+
* Logs a message to the console if logging is enabled.
|
|
331
|
+
* @param {string} message - The message to log.
|
|
332
|
+
* @param {string|object} data - Additional data to log with the message.
|
|
333
333
|
*/
|
|
334
334
|
log(message: string, data?: string | object): void;
|
|
335
335
|
/**
|
|
336
|
-
*
|
|
337
|
-
* @returns {number}
|
|
336
|
+
* Gets the number of files that have been loaded.
|
|
337
|
+
* @returns {number} The total number of loaded files.
|
|
338
338
|
*/
|
|
339
339
|
totalLoadedFiles(): number;
|
|
340
340
|
/**
|
|
341
|
-
*
|
|
342
|
-
* @returns {number}
|
|
341
|
+
* Gets the number of files that are still queued for loading.
|
|
342
|
+
* @returns {number} The total number of queued files.
|
|
343
343
|
*/
|
|
344
344
|
totalQueuedFiles(): number;
|
|
345
345
|
/**
|
|
346
|
-
*
|
|
347
|
-
* @returns {number}
|
|
346
|
+
* Gets the number of pack files that have been loaded.
|
|
347
|
+
* @returns {number} The total number of loaded pack files.
|
|
348
348
|
*/
|
|
349
349
|
totalLoadedPacks(): number;
|
|
350
350
|
/**
|
|
351
|
-
*
|
|
352
|
-
* @returns {number}
|
|
351
|
+
* Gets the number of pack files that are still queued for loading.
|
|
352
|
+
* @returns {number} The total number of queued pack files.
|
|
353
353
|
*/
|
|
354
354
|
totalQueuedPacks(): number;
|
|
355
355
|
/**
|
|
356
|
-
*
|
|
357
|
-
* @returns {number}
|
|
356
|
+
* Gets the loading progress as a percentage (0-100).
|
|
357
|
+
* @returns {number} The current loading progress as a percentage.
|
|
358
358
|
*/
|
|
359
359
|
get progressFloat(): number;
|
|
360
360
|
/**
|
|
361
|
-
*
|
|
362
|
-
* @returns {number}
|
|
361
|
+
* Gets the loading progress as a rounded percentage (0-100).
|
|
362
|
+
* @returns {number} The current loading progress as a rounded percentage.
|
|
363
363
|
*/
|
|
364
364
|
get progress(): number;
|
|
365
365
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader_parser.d.ts","sourceRoot":"","sources":["../../../src/phaser/core/loader_parser.js"],"names":[],"mappings":"AASO,
|
|
1
|
+
{"version":3,"file":"loader_parser.d.ts","sourceRoot":"","sources":["../../../src/phaser/core/loader_parser.js"],"names":[],"mappings":"AASO,gDAJM,OAAO,kCAAkC,EAAE,WAAW,kBACtD,MAAM,GACJ,MAAM,CAQpB;AAUM,mCANM,MAAM,eACN,OAAO,kCAAkC,EAAE,WAAW,YACtD,MAAM,YACN,MAAM,GACJ,MAAM,CAgCpB;AAUM,gCANM,MAAM,eACN,OAAO,kCAAkC,EAAE,WAAW,YACtD,MAAM,YACN,MAAM,GACJ,MAAM,CAIpB;AAUM,qCANM,MAAM,eACN,OAAO,kCAAkC,EAAE,WAAW,YACtD,MAAM,YACN,MAAM,GACJ,MAAM,CA4BpB"}
|
|
@@ -16,7 +16,7 @@ export class RequestAnimationFrame {
|
|
|
16
16
|
stop: () => void;
|
|
17
17
|
/**
|
|
18
18
|
* Performs an animation frame request.
|
|
19
|
-
* @param {number} rafTime -
|
|
19
|
+
* @param {number} rafTime - The timestamp provided by the browser's animation frame.
|
|
20
20
|
*/
|
|
21
21
|
update: (rafTime: number) => void;
|
|
22
22
|
}
|
|
@@ -2,33 +2,39 @@ export class Scene {
|
|
|
2
2
|
game: any;
|
|
3
3
|
key: string;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Initialize the scene.
|
|
6
|
+
* This method is called before preload() and create().
|
|
6
7
|
*/
|
|
7
8
|
init(): void;
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
+
* Load assets for the scene.
|
|
11
|
+
* This method is called after init() and before create().
|
|
10
12
|
*/
|
|
11
13
|
preload(): void;
|
|
12
14
|
/**
|
|
13
|
-
*
|
|
15
|
+
* Create the scene.
|
|
16
|
+
* This method is called after preload() and is where you create your game objects.
|
|
14
17
|
*/
|
|
15
18
|
create(): void;
|
|
16
19
|
/**
|
|
17
|
-
*
|
|
20
|
+
* Update the scene.
|
|
21
|
+
* This method is called every frame while the scene is active.
|
|
18
22
|
*/
|
|
19
23
|
update(): void;
|
|
20
24
|
/**
|
|
21
|
-
*
|
|
22
|
-
* @param {number} width -
|
|
23
|
-
* @param {number} height -
|
|
25
|
+
* Handle scene resize.
|
|
26
|
+
* @param {number} width - The new width of the scene.
|
|
27
|
+
* @param {number} height - The new height of the scene.
|
|
24
28
|
*/
|
|
25
29
|
resize(width: number, height: number): void;
|
|
26
30
|
/**
|
|
27
|
-
*
|
|
31
|
+
* Update the scene while paused.
|
|
32
|
+
* This method is called every frame while the scene is paused.
|
|
28
33
|
*/
|
|
29
34
|
pauseUpdate(): void;
|
|
30
35
|
/**
|
|
31
|
-
*
|
|
36
|
+
* Shutdown the scene.
|
|
37
|
+
* This method is called when the scene is about to be destroyed.
|
|
32
38
|
*/
|
|
33
39
|
shutdown(): void;
|
|
34
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scene.d.ts","sourceRoot":"","sources":["../../../src/phaser/core/scene.js"],"names":[],"mappings":"AAAA;IAKI,UAAgB;IAChB,YAAa;IAGf
|
|
1
|
+
{"version":3,"file":"scene.d.ts","sourceRoot":"","sources":["../../../src/phaser/core/scene.js"],"names":[],"mappings":"AAAA;IAKI,UAAgB;IAChB,YAAa;IAGf;;;OAGG;IACH,aAEC;IAED;;;OAGG;IACH,gBAEC;IAED;;;OAGG;IACH,eAEC;IAED;;;OAGG;IACH,eAEC;IAED;;;;OAIG;IACH,cAHW,MAAM,UACN,MAAM,QAIhB;IAED;;;OAGG;IACH,oBAEC;IAED;;;OAGG;IACH,iBAEC;CACF"}
|