@vpmedia/phaser 1.95.0 → 1.96.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 +29 -0
- package/package.json +9 -9
- 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 +56 -52
- 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 +64 -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/ellipse.js +28 -28
- package/src/phaser/geom/line.js +93 -93
- package/src/phaser/geom/matrix.js +54 -54
- package/src/phaser/geom/point.js +96 -96
- package/src/phaser/geom/polygon.js +22 -22
- package/src/phaser/geom/rectangle.js +132 -132
- package/src/phaser/geom/rounded_rectangle.js +12 -12
- package/src/phaser/geom/util/circle.js +33 -33
- package/src/phaser/geom/util/ellipse.js +5 -5
- package/src/phaser/geom/util/line.js +26 -26
- package/src/phaser/geom/util/matrix.js +8 -8
- package/src/phaser/geom/util/point.js +97 -97
- package/src/phaser/geom/util/polygon.js +4 -4
- package/src/phaser/geom/util/rectangle.js +74 -74
- package/src/phaser/geom/util/rounded_rectangle.js +4 -4
- package/src/phaser/util/math.js +81 -81
- 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,8 +1,8 @@
|
|
|
1
1
|
export class SceneManager {
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* @param {import('./game.js').Game} game -
|
|
5
|
-
* @param {string} pendingState -
|
|
3
|
+
* Creates a new SceneManager instance.
|
|
4
|
+
* @param {import('./game.js').Game} game - The game instance this manager belongs to.
|
|
5
|
+
* @param {string} pendingState - The state to load when the game boots.
|
|
6
6
|
*/
|
|
7
7
|
constructor(game: import("./game.js").Game, pendingState: string);
|
|
8
8
|
game: import("./game.js").Game;
|
|
@@ -21,101 +21,109 @@ export class SceneManager {
|
|
|
21
21
|
onPauseUpdateCallback: any;
|
|
22
22
|
onShutDownCallback: any;
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Initialize the scene manager.
|
|
25
|
+
* This method is called when the game boots and sets up the initial state.
|
|
25
26
|
*/
|
|
26
27
|
boot(): void;
|
|
27
28
|
/**
|
|
28
|
-
*
|
|
29
|
-
* @param {string} key -
|
|
30
|
-
* @param {object} state -
|
|
31
|
-
* @param {boolean} autoStart -
|
|
32
|
-
* @returns {Scene|object}
|
|
29
|
+
* Add a new scene state to the manager.
|
|
30
|
+
* @param {string} key - The unique key for this state.
|
|
31
|
+
* @param {object} state - The scene state to add.
|
|
32
|
+
* @param {boolean} autoStart - Whether to start this state immediately.
|
|
33
|
+
* @returns {Scene|object} The created scene or state object.
|
|
33
34
|
*/
|
|
34
35
|
add(key: string, state: object, autoStart?: boolean): Scene | object;
|
|
35
36
|
/**
|
|
36
|
-
*
|
|
37
|
-
* @param {string} key -
|
|
37
|
+
* Remove a scene state from the manager.
|
|
38
|
+
* @param {string} key - The unique key for the state to remove.
|
|
38
39
|
*/
|
|
39
40
|
remove(key: string): void;
|
|
40
41
|
callbackContext: any;
|
|
41
42
|
/**
|
|
42
|
-
*
|
|
43
|
-
* @param {string} key -
|
|
44
|
-
* @param {boolean} clearWorld -
|
|
45
|
-
* @param {boolean} clearCache -
|
|
46
|
-
* @param {...any} args -
|
|
43
|
+
* Start a scene state.
|
|
44
|
+
* @param {string} key - The unique key for the state to start.
|
|
45
|
+
* @param {boolean} clearWorld - Whether to clear the world before starting.
|
|
46
|
+
* @param {boolean} clearCache - Whether to clear the cache before starting.
|
|
47
|
+
* @param {...any} args - Additional arguments to pass to the state.
|
|
47
48
|
*/
|
|
48
49
|
start(key: string, clearWorld?: boolean, clearCache?: boolean, ...args: any[]): void;
|
|
49
50
|
/**
|
|
50
|
-
*
|
|
51
|
-
* @param {boolean} clearWorld -
|
|
52
|
-
* @param {boolean} clearCache -
|
|
53
|
-
* @param {...any} args -
|
|
51
|
+
* Restart the current scene state.
|
|
52
|
+
* @param {boolean} clearWorld - Whether to clear the world before restarting.
|
|
53
|
+
* @param {boolean} clearCache - Whether to clear the cache before restarting.
|
|
54
|
+
* @param {...any} args - Additional arguments to pass to the state.
|
|
54
55
|
*/
|
|
55
56
|
restart(clearWorld?: boolean, clearCache?: boolean, ...args: any[]): void;
|
|
56
57
|
/**
|
|
57
|
-
*
|
|
58
|
+
* Pre-update the scene manager.
|
|
59
|
+
* This method is called before the game loop updates.
|
|
58
60
|
*/
|
|
59
61
|
preUpdate(): void;
|
|
60
62
|
/**
|
|
61
|
-
*
|
|
63
|
+
* Clear the current scene state.
|
|
64
|
+
* This method is called when switching scenes to clean up the previous scene.
|
|
62
65
|
*/
|
|
63
66
|
clearCurrentState(): void;
|
|
64
67
|
/**
|
|
65
|
-
*
|
|
66
|
-
* @param {string} key -
|
|
67
|
-
* @returns {boolean}
|
|
68
|
+
* Check if a scene state exists.
|
|
69
|
+
* @param {string} key - The unique key for the state to check.
|
|
70
|
+
* @returns {boolean} True if the scene exists, false otherwise.
|
|
68
71
|
*/
|
|
69
72
|
checkState(key: string): boolean;
|
|
70
73
|
/**
|
|
71
|
-
*
|
|
72
|
-
* @param {string} key -
|
|
74
|
+
* Link a scene state to the manager.
|
|
75
|
+
* @param {string} key - The unique key for the state to link.
|
|
73
76
|
*/
|
|
74
77
|
link(key: string): void;
|
|
75
78
|
/**
|
|
76
|
-
*
|
|
77
|
-
* @param {string} key -
|
|
79
|
+
* Unlink a scene state from the manager.
|
|
80
|
+
* @param {string} key - The unique key for the state to unlink.
|
|
78
81
|
*/
|
|
79
82
|
unlink(key: string): void;
|
|
80
83
|
/**
|
|
81
|
-
*
|
|
82
|
-
* @param {string} key -
|
|
84
|
+
* Set the current scene state.
|
|
85
|
+
* @param {string} key - The unique key for the state to set as current.
|
|
83
86
|
*/
|
|
84
87
|
setCurrentState(key: string): void;
|
|
85
88
|
/**
|
|
86
|
-
*
|
|
87
|
-
* @returns {Scene}
|
|
89
|
+
* Get the current scene state.
|
|
90
|
+
* @returns {Scene} The current scene state.
|
|
88
91
|
*/
|
|
89
92
|
getCurrentState(): Scene;
|
|
90
93
|
/**
|
|
91
|
-
*
|
|
94
|
+
* Handle loading completion.
|
|
95
|
+
* This method is called when scene loading is complete.
|
|
92
96
|
*/
|
|
93
97
|
loadComplete(): void;
|
|
94
98
|
/**
|
|
95
|
-
*
|
|
99
|
+
* Update the scene manager.
|
|
100
|
+
* This method is called every frame while the game is running.
|
|
96
101
|
*/
|
|
97
102
|
update(): void;
|
|
98
103
|
/**
|
|
99
|
-
*
|
|
104
|
+
* Pause the scene manager updates.
|
|
105
|
+
* This method is called when the game is paused.
|
|
100
106
|
*/
|
|
101
107
|
pauseUpdate(): void;
|
|
102
108
|
/**
|
|
103
|
-
*
|
|
104
|
-
* @param {number} width -
|
|
105
|
-
* @param {number} height -
|
|
109
|
+
* Handle scene resize.
|
|
110
|
+
* @param {number} width - The new width of the scene.
|
|
111
|
+
* @param {number} height - The new height of the scene.
|
|
106
112
|
*/
|
|
107
113
|
resize(width: number, height: number): void;
|
|
108
114
|
/**
|
|
109
|
-
*
|
|
115
|
+
* Destroy the scene manager.
|
|
116
|
+
* This method is called when the scene manager is about to be destroyed.
|
|
110
117
|
*/
|
|
111
118
|
destroy(): void;
|
|
112
119
|
/**
|
|
113
|
-
*
|
|
120
|
+
* Dummy function for callbacks.
|
|
121
|
+
* This is a placeholder function used when no callback is defined.
|
|
114
122
|
*/
|
|
115
123
|
dummy(): void;
|
|
116
124
|
/**
|
|
117
|
-
*
|
|
118
|
-
* @returns {boolean}
|
|
125
|
+
* Get whether the scene has been created.
|
|
126
|
+
* @returns {boolean} True if the scene has been created, false otherwise.
|
|
119
127
|
*/
|
|
120
128
|
get created(): boolean;
|
|
121
129
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scene_manager.d.ts","sourceRoot":"","sources":["../../../src/phaser/core/scene_manager.js"],"names":[],"mappings":"AAEA;IACE;;;;OAIG;IACH,kBAHW,OAAO,WAAW,EAAE,IAAI,gBACxB,MAAM,EAqBhB;IAlBC,+BAAgB;IAChB,WAAgB;IAChB,sBAAyB;IAIzB,qBAAwB;IACxB,qBAAwB;IACxB,kBAAqB;IACrB,aAAe;IACf,gBAAiB;IACjB,oBAA0B;IAC1B,uBAA6B;IAC7B,sBAA4B;IAC5B,sBAA4B;IAC5B,sBAA4B;IAC5B,2BAAiC;IACjC,wBAA8B;IAGhC
|
|
1
|
+
{"version":3,"file":"scene_manager.d.ts","sourceRoot":"","sources":["../../../src/phaser/core/scene_manager.js"],"names":[],"mappings":"AAEA;IACE;;;;OAIG;IACH,kBAHW,OAAO,WAAW,EAAE,IAAI,gBACxB,MAAM,EAqBhB;IAlBC,+BAAgB;IAChB,WAAgB;IAChB,sBAAyB;IAIzB,qBAAwB;IACxB,qBAAwB;IACxB,kBAAqB;IACrB,aAAe;IACf,gBAAiB;IACjB,oBAA0B;IAC1B,uBAA6B;IAC7B,sBAA4B;IAC5B,sBAA4B;IAC5B,sBAA4B;IAC5B,2BAAiC;IACjC,wBAA8B;IAGhC;;;OAGG;IACH,aAIC;IAED;;;;;;OAMG;IACH,SALW,MAAM,SACN,MAAM,cACN,OAAO,GACL,KAAK,GAAC,MAAM,CAqBxB;IAED;;;OAGG;IACH,YAFW,MAAM,QAchB;IAVG,qBAA2B;IAY/B;;;;;;OAMG;IACH,WALW,MAAM,eACN,OAAO,eACP,OAAO,WACJ,GAAG,EAAA,QAYhB;IAED;;;;;OAKG;IACH,qBAJW,OAAO,eACP,OAAO,WACJ,GAAG,EAAA,QAShB;IAED;;;OAGG;IACH,kBA6BC;IAED;;;OAGG;IACH,0BAgBC;IAED;;;;OAIG;IACH,gBAHW,MAAM,GACJ,OAAO,CAUnB;IAED;;;OAGG;IACH,UAFW,MAAM,QAKhB;IAED;;;OAGG;IACH,YAFW,MAAM,QAMhB;IAED;;;OAGG;IACH,qBAFW,MAAM,QAoBhB;IAED;;;OAGG;IACH,mBAFa,KAAK,CAIjB;IAED;;;OAGG;IACH,qBAOC;IAED;;;OAGG;IACH,eAIC;IAED;;;OAGG;IACH,oBAIC;IAED;;;;OAIG;IACH,cAHW,MAAM,UACN,MAAM,QAMhB;IAED;;;OAGG;IACH,gBAeC;IAED;;;OAGG;IACH,cAEC;IAED;;;OAGG;IACH,eAFa,OAAO,CAInB;CACF;sBAlUqB,YAAY"}
|
|
@@ -6,102 +6,105 @@ export class Signal {
|
|
|
6
6
|
active: boolean;
|
|
7
7
|
_boundDispatch: (...rest: any[]) => void;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
* @param {Function} listener -
|
|
11
|
-
* @param {string} fnName -
|
|
12
|
-
* @throws {Error}
|
|
9
|
+
* Validates that a listener is a function.
|
|
10
|
+
* @param {Function} listener - The listener to validate.
|
|
11
|
+
* @param {string} fnName - The name of the function this validation is for.
|
|
12
|
+
* @throws {Error} If the listener is not a function.
|
|
13
13
|
*/
|
|
14
14
|
validateListener(listener: Function, fnName: string): void;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
* @param {Function} listener -
|
|
18
|
-
* @param {boolean} isOnce -
|
|
19
|
-
* @param {object} listenerContext -
|
|
20
|
-
* @param {number} priority -
|
|
21
|
-
* @param {...any} args -
|
|
22
|
-
* @returns {SignalBinding}
|
|
23
|
-
* @throws {Error}
|
|
16
|
+
* Register a new listener with the signal.
|
|
17
|
+
* @param {Function} listener - The function to call when the signal is dispatched.
|
|
18
|
+
* @param {boolean} isOnce - Whether the listener should only be called once.
|
|
19
|
+
* @param {object} listenerContext - The context to apply when calling the listener.
|
|
20
|
+
* @param {number} priority - The priority of this listener (higher numbers execute first).
|
|
21
|
+
* @param {...any} args - Additional arguments to pass to the listener.
|
|
22
|
+
* @returns {SignalBinding} The binding for this listener.
|
|
23
|
+
* @throws {Error} If the listener is already registered with a different once setting.
|
|
24
24
|
*/
|
|
25
25
|
_registerListener(listener: Function, isOnce?: boolean, listenerContext?: object, priority?: number, args?: any[]): SignalBinding;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
28
|
-
* @param {SignalBinding} binding -
|
|
27
|
+
* Add a binding to the list of listeners.
|
|
28
|
+
* @param {SignalBinding} binding - The binding to add.
|
|
29
29
|
*/
|
|
30
30
|
_addBinding(binding: SignalBinding): void;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
33
|
-
* @param {Function} listener -
|
|
34
|
-
* @param {object} context -
|
|
35
|
-
* @returns {number}
|
|
32
|
+
* Find the index of a listener in the bindings array.
|
|
33
|
+
* @param {Function} listener - The listener to find.
|
|
34
|
+
* @param {object} context - The context of the listener.
|
|
35
|
+
* @returns {number} The index of the listener in the bindings array, or -1 if not found.
|
|
36
36
|
*/
|
|
37
37
|
_indexOfListener(listener: Function, context?: object): number;
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
40
|
-
* @param {Function} listener -
|
|
41
|
-
* @param {object} context -
|
|
42
|
-
* @returns {boolean}
|
|
39
|
+
* Check if a listener is registered with the signal.
|
|
40
|
+
* @param {Function} listener - The listener to check.
|
|
41
|
+
* @param {object} context - The context of the listener.
|
|
42
|
+
* @returns {boolean} True if the listener is registered, false otherwise.
|
|
43
43
|
*/
|
|
44
44
|
has(listener: Function, context?: object): boolean;
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
47
|
-
* @param {Function} listener -
|
|
48
|
-
* @param {object} listenerContext -
|
|
49
|
-
* @param {number} priority -
|
|
50
|
-
* @param {...any} args -
|
|
51
|
-
* @returns {SignalBinding}
|
|
46
|
+
* Add a listener that will be called every time the signal is dispatched.
|
|
47
|
+
* @param {Function} listener - The function to call when the signal is dispatched.
|
|
48
|
+
* @param {object} listenerContext - The context to apply when calling the listener.
|
|
49
|
+
* @param {number} priority - The priority of this listener (higher numbers execute first).
|
|
50
|
+
* @param {...any} args - Additional arguments to pass to the listener.
|
|
51
|
+
* @returns {SignalBinding} The binding for this listener.
|
|
52
52
|
*/
|
|
53
53
|
add(listener: Function, listenerContext?: object, priority?: number, ...args: any[]): SignalBinding;
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
56
|
-
* @param {Function} listener -
|
|
57
|
-
* @param {object} listenerContext -
|
|
58
|
-
* @param {number} priority -
|
|
59
|
-
* @param {...any} args -
|
|
60
|
-
* @returns {SignalBinding}
|
|
55
|
+
* Add a listener that will be called only once when the signal is dispatched.
|
|
56
|
+
* @param {Function} listener - The function to call when the signal is dispatched.
|
|
57
|
+
* @param {object} listenerContext - The context to apply when calling the listener.
|
|
58
|
+
* @param {number} priority - The priority of this listener (higher numbers execute first).
|
|
59
|
+
* @param {...any} args - Additional arguments to pass to the listener.
|
|
60
|
+
* @returns {SignalBinding} The binding for this listener.
|
|
61
61
|
*/
|
|
62
62
|
addOnce(listener: Function, listenerContext?: object, priority?: number, ...args: any[]): SignalBinding;
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
65
|
-
* @param {Function} listener -
|
|
66
|
-
* @param {object} context -
|
|
67
|
-
* @returns {Function}
|
|
64
|
+
* Remove a listener from the signal.
|
|
65
|
+
* @param {Function} listener - The listener to remove.
|
|
66
|
+
* @param {object} context - The context of the listener.
|
|
67
|
+
* @returns {Function} The removed listener function.
|
|
68
68
|
*/
|
|
69
69
|
remove(listener: Function, context?: object): Function;
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
72
|
-
* @param {object} context -
|
|
71
|
+
* Remove all listeners from the signal, or only those in a specific context.
|
|
72
|
+
* @param {object} context - The context to filter listeners by, or null to remove all.
|
|
73
73
|
*/
|
|
74
74
|
removeAll(context?: object): void;
|
|
75
75
|
/**
|
|
76
|
-
*
|
|
77
|
-
* @returns {number}
|
|
76
|
+
* Get the number of listeners registered with the signal.
|
|
77
|
+
* @returns {number} The number of registered listeners.
|
|
78
78
|
*/
|
|
79
79
|
getNumListeners(): number;
|
|
80
80
|
/**
|
|
81
|
-
*
|
|
81
|
+
* Stop the signal from propagating to other listeners.
|
|
82
|
+
* This method prevents any remaining listeners from being called.
|
|
82
83
|
*/
|
|
83
84
|
halt(): void;
|
|
84
85
|
/**
|
|
85
|
-
*
|
|
86
|
-
* @param {...any} args -
|
|
86
|
+
* Dispatch the signal to all registered listeners.
|
|
87
|
+
* @param {...any} args - Arguments to pass to the listeners.
|
|
87
88
|
*/
|
|
88
89
|
dispatch(...args: any[]): void;
|
|
89
90
|
/**
|
|
90
|
-
*
|
|
91
|
+
* Clear any previously memorized arguments.
|
|
92
|
+
* This removes the stored arguments from a previous dispatch.
|
|
91
93
|
*/
|
|
92
94
|
forget(): void;
|
|
93
95
|
/**
|
|
94
|
-
*
|
|
96
|
+
* Dispose of the signal and clean up all resources.
|
|
97
|
+
* This method removes all listeners and clears internal state.
|
|
95
98
|
*/
|
|
96
99
|
dispose(): void;
|
|
97
100
|
/**
|
|
98
|
-
*
|
|
99
|
-
* @returns {string}
|
|
101
|
+
* Get a string representation of the signal.
|
|
102
|
+
* @returns {string} A string representation of the signal.
|
|
100
103
|
*/
|
|
101
104
|
toString(): string;
|
|
102
105
|
/**
|
|
103
|
-
*
|
|
104
|
-
* @returns {Function}
|
|
106
|
+
* Get a bound version of the dispatch function.
|
|
107
|
+
* @returns {Function} A function that will dispatch the signal with the correct context.
|
|
105
108
|
*/
|
|
106
109
|
get boundDispatch(): Function;
|
|
107
110
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signal.d.ts","sourceRoot":"","sources":["../../../src/phaser/core/signal.js"],"names":[],"mappings":"AAEA;
|
|
1
|
+
{"version":3,"file":"signal.d.ts","sourceRoot":"","sources":["../../../src/phaser/core/signal.js"],"names":[],"mappings":"AAEA;IAMI,iBAAqB;IACrB,mBAAuB;IACvB,kBAAqB;IACrB,0BAA4B;IAC5B,gBAAkB;IAClB,yCAA0B;IAG5B;;;;;OAKG;IACH,6CAHW,MAAM,QAShB;IAED;;;;;;;;;OASG;IACH,+CAPW,OAAO,oBACP,MAAM,aACN,MAAM,SACH,GAAG,EAAA,GACJ,aAAa,CAuBzB;IAED;;;OAGG;IACH,qBAFW,aAAa,QAYvB;IAED;;;;;OAKG;IACH,+CAHW,MAAM,GACJ,MAAM,CAgBlB;IAED;;;;;OAKG;IACH,kCAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;;;;OAOG;IACH,0CALW,MAAM,aACN,MAAM,WACH,GAAG,EAAA,GACJ,aAAa,CAKzB;IAED;;;;;;;OAOG;IACH,8CALW,MAAM,aACN,MAAM,WACH,GAAG,EAAA,GACJ,aAAa,CAKzB;IAED;;;;;OAKG;IACH,qCAHW,MAAM,YAYhB;IAED;;;OAGG;IACH,oBAFW,MAAM,QAqBhB;IAED;;;OAGG;IACH,mBAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,aAEC;IAED;;;OAGG;IACH,kBAFc,GAAG,EAAA,QAwBhB;IAED;;;OAGG;IACH,eAIC;IAED;;;OAGG;IACH,gBAIC;IAED;;;OAGG;IACH,YAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,8BAMC;CACF;8BArQ6B,qBAAqB"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export class Sound {
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* @param {import('./game.js').Game} game -
|
|
5
|
-
* @param {string} key -
|
|
6
|
-
* @param {number} volume -
|
|
7
|
-
* @param {boolean} loop -
|
|
8
|
-
* @param {boolean} connect -
|
|
3
|
+
* Creates a new Sound instance.
|
|
4
|
+
* @param {import('./game.js').Game} game - Reference to the Phaser Game instance.
|
|
5
|
+
* @param {string} key - The key of the sound to play.
|
|
6
|
+
* @param {number} volume - The initial volume level (0.0 to 1.0).
|
|
7
|
+
* @param {boolean} loop - Whether the sound should loop.
|
|
8
|
+
* @param {boolean} connect - Whether to connect to the master gain node.
|
|
9
9
|
*/
|
|
10
10
|
constructor(game: import("./game.js").Game, key: string, volume?: number, loop?: boolean, connect?: boolean);
|
|
11
11
|
game: import("./game.js").Game;
|
|
@@ -61,111 +61,111 @@ export class Sound {
|
|
|
61
61
|
_tempLoop: boolean;
|
|
62
62
|
_paused: boolean;
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
65
|
-
* @param {string} key -
|
|
64
|
+
* Callback when a sound has been unlocked.
|
|
65
|
+
* @param {string} key - The key of the sound that was unlocked.
|
|
66
66
|
*/
|
|
67
67
|
soundHasUnlocked(key: string): void;
|
|
68
68
|
/**
|
|
69
|
-
*
|
|
70
|
-
* @param {string} name -
|
|
71
|
-
* @param {number} start -
|
|
72
|
-
* @param {number} duration -
|
|
73
|
-
* @param {number} volume -
|
|
74
|
-
* @param {boolean} loop -
|
|
69
|
+
* Adds a marker to the sound.
|
|
70
|
+
* @param {string} name - The name of the marker.
|
|
71
|
+
* @param {number} start - The start time (in seconds) of the marker.
|
|
72
|
+
* @param {number} duration - The duration (in seconds) of the marker.
|
|
73
|
+
* @param {number} volume - The volume level (0.0 to 1.0) of the marker.
|
|
74
|
+
* @param {boolean} loop - Whether the marker should loop.
|
|
75
75
|
*/
|
|
76
76
|
addMarker(name: string, start: number, duration?: number, volume?: number, loop?: boolean): void;
|
|
77
77
|
/**
|
|
78
|
-
*
|
|
79
|
-
* @param {string} name -
|
|
78
|
+
* Removes a marker from the sound.
|
|
79
|
+
* @param {string} name - The name of the marker to remove.
|
|
80
80
|
*/
|
|
81
81
|
removeMarker(name: string): void;
|
|
82
82
|
/**
|
|
83
|
-
*
|
|
83
|
+
* Handler for when the sound ends.
|
|
84
84
|
*/
|
|
85
85
|
onEndedHandler(): void;
|
|
86
86
|
/**
|
|
87
|
-
*
|
|
87
|
+
* Updates the sound state.
|
|
88
88
|
*/
|
|
89
89
|
update(): void;
|
|
90
90
|
/**
|
|
91
|
-
*
|
|
92
|
-
* @param {number} volume -
|
|
93
|
-
* @returns {Sound}
|
|
91
|
+
* Plays the sound at full volume in a loop.
|
|
92
|
+
* @param {number} volume - The volume level (0.0 to 1.0) to play at.
|
|
93
|
+
* @returns {Sound} This Sound instance for chaining.
|
|
94
94
|
*/
|
|
95
95
|
loopFull(volume: number): Sound;
|
|
96
96
|
/**
|
|
97
|
-
*
|
|
98
|
-
* @param {string} marker -
|
|
99
|
-
* @param {number} position -
|
|
100
|
-
* @param {number} volume -
|
|
101
|
-
* @param {boolean} loop -
|
|
102
|
-
* @param {boolean} forceRestart -
|
|
103
|
-
* @returns {Sound}
|
|
97
|
+
* Plays the sound, optionally using a marker.
|
|
98
|
+
* @param {string} marker - The name of the marker to play, or null/undefined to play the entire sound.
|
|
99
|
+
* @param {number} position - The position (in seconds) to start playing from.
|
|
100
|
+
* @param {number} volume - The volume level (0.0 to 1.0) to play at.
|
|
101
|
+
* @param {boolean} loop - Whether the sound should loop.
|
|
102
|
+
* @param {boolean} forceRestart - Whether to force restarting the sound even if it's already playing.
|
|
103
|
+
* @returns {Sound} This Sound instance for chaining.
|
|
104
104
|
*/
|
|
105
105
|
play(marker: string, position: number, volume: number, loop: boolean, forceRestart?: boolean): Sound;
|
|
106
106
|
/**
|
|
107
|
-
*
|
|
107
|
+
* Sets the volume of the sound.
|
|
108
108
|
*/
|
|
109
109
|
set volume(value: number);
|
|
110
110
|
/**
|
|
111
|
-
*
|
|
112
|
-
* @returns {number}
|
|
111
|
+
* Gets the volume of the sound.
|
|
112
|
+
* @returns {number} The volume level (0.0 to 1.0).
|
|
113
113
|
*/
|
|
114
114
|
get volume(): number;
|
|
115
115
|
/**
|
|
116
|
-
*
|
|
117
|
-
* @param {string} marker -
|
|
118
|
-
* @param {number} position -
|
|
119
|
-
* @param {number} volume -
|
|
120
|
-
* @param {boolean} loop -
|
|
116
|
+
* Restarts the sound, optionally using a marker.
|
|
117
|
+
* @param {string} marker - The name of the marker to play, or empty string to play the entire sound.
|
|
118
|
+
* @param {number} position - The position (in seconds) to start playing from.
|
|
119
|
+
* @param {number} volume - The volume level (0.0 to 1.0) to play at.
|
|
120
|
+
* @param {boolean} loop - Whether the sound should loop.
|
|
121
121
|
*/
|
|
122
122
|
restart(marker?: string, position?: number, volume?: number, loop?: boolean): void;
|
|
123
123
|
/**
|
|
124
|
-
*
|
|
124
|
+
* Pauses the sound.
|
|
125
125
|
*/
|
|
126
126
|
pause(): void;
|
|
127
127
|
/**
|
|
128
|
-
*
|
|
128
|
+
* Resumes the sound.
|
|
129
129
|
*/
|
|
130
130
|
resume(): void;
|
|
131
131
|
/**
|
|
132
|
-
*
|
|
132
|
+
* Stops the sound.
|
|
133
133
|
*/
|
|
134
134
|
stop(): void;
|
|
135
135
|
/**
|
|
136
|
-
*
|
|
137
|
-
* @param {number} duration -
|
|
138
|
-
* @param {boolean} loop -
|
|
139
|
-
* @param {string} marker -
|
|
136
|
+
* Fades in the sound to full volume.
|
|
137
|
+
* @param {number} duration - The fade-in duration (in milliseconds).
|
|
138
|
+
* @param {boolean} loop - Whether the sound should loop.
|
|
139
|
+
* @param {string} marker - The name of the marker to fade in, or empty string to use current marker.
|
|
140
140
|
*/
|
|
141
141
|
fadeIn(duration: number, loop?: boolean, marker?: string): void;
|
|
142
142
|
/**
|
|
143
|
-
*
|
|
144
|
-
* @param {number} duration -
|
|
143
|
+
* Fades out the sound to silence.
|
|
144
|
+
* @param {number} duration - The fade-out duration (in milliseconds).
|
|
145
145
|
*/
|
|
146
146
|
fadeOut(duration: number): void;
|
|
147
147
|
/**
|
|
148
|
-
*
|
|
149
|
-
* @param {number} duration -
|
|
150
|
-
* @param {number} volume -
|
|
148
|
+
* Fades the sound to a specific volume level.
|
|
149
|
+
* @param {number} duration - The fade duration (in milliseconds).
|
|
150
|
+
* @param {number} volume - The target volume level (0.0 to 1.0).
|
|
151
151
|
*/
|
|
152
152
|
fadeTo(duration?: number, volume?: number): void;
|
|
153
153
|
/**
|
|
154
|
-
*
|
|
154
|
+
* Callback when fade completes.
|
|
155
155
|
*/
|
|
156
156
|
fadeComplete(): void;
|
|
157
157
|
/**
|
|
158
|
-
*
|
|
159
|
-
* @param {boolean} remove -
|
|
158
|
+
* Destroys the sound and cleans up resources.
|
|
159
|
+
* @param {boolean} remove - Whether to remove the sound from the SoundManager.
|
|
160
160
|
*/
|
|
161
161
|
destroy(remove?: boolean): void;
|
|
162
162
|
/**
|
|
163
|
-
*
|
|
163
|
+
* Sets the muted state of the sound.
|
|
164
164
|
*/
|
|
165
165
|
set mute(value: boolean);
|
|
166
166
|
/**
|
|
167
|
-
*
|
|
168
|
-
* @returns {boolean}
|
|
167
|
+
* Gets the muted state of the sound.
|
|
168
|
+
* @returns {boolean} True if the sound is muted, false otherwise.
|
|
169
169
|
*/
|
|
170
170
|
get mute(): boolean;
|
|
171
171
|
}
|