v3.60 Beta 22 Release

This commit is contained in:
Richard Davey 2023-03-31 16:49:54 +01:00
parent f69292ed38
commit f221831749
9 changed files with 4571 additions and 325 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

1067
dist/phaser-ie9.js vendored

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

1067
dist/phaser.esm.js vendored

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

1067
dist/phaser.js vendored

File diff suppressed because it is too large Load diff

2
dist/phaser.min.js vendored

File diff suppressed because one or more lines are too long

484
types/phaser.d.ts vendored
View file

@ -8525,7 +8525,7 @@ declare namespace Phaser {
/** /**
* Returns the unrotated bounds of the Game Object as a rectangle. * Returns the unrotated bounds of the Game Object as a rectangle.
* @param gameObject The Game Object to get the bounds value from. * @param gameObject The Game Object to get the bounds value from.
* @param output An object to store the values in. * @param output An object to store the values in. If not provided a new Rectangle will be created.
*/ */
function GetBounds(gameObject: Phaser.GameObjects.GameObject, output?: Phaser.Geom.Rectangle | object): Phaser.Geom.Rectangle | object; function GetBounds(gameObject: Phaser.GameObjects.GameObject, output?: Phaser.Geom.Rectangle | object): Phaser.Geom.Rectangle | object;
@ -9972,7 +9972,7 @@ declare namespace Phaser {
/** /**
* *
* @param gameObject A reference to the Game Object that has this fx. * @param gameObject A reference to the Game Object that has this fx.
* @param color The color of the Bloom, as a hex value. * @param color The color of the Bloom, as a hex value. Default 0xffffff.
* @param offsetX The horizontal offset of the bloom effect. Default 1. * @param offsetX The horizontal offset of the bloom effect. Default 1.
* @param offsetY The vertical offset of the bloom effect. Default 1. * @param offsetY The vertical offset of the bloom effect. Default 1.
* @param blurStrength The strength of the blur process of the bloom effect. Default 1. * @param blurStrength The strength of the blur process of the bloom effect. Default 1.
@ -10425,6 +10425,14 @@ declare namespace Phaser {
*/ */
active: boolean; active: boolean;
/**
* Sets the active state of this FX Controller.
*
* A disabled FX Controller will not be updated.
* @param value `true` to enable this FX Controller, or `false` to disable it.
*/
setActive(value: boolean): this;
/** /**
* Destroys this FX Controller. * Destroys this FX Controller.
*/ */
@ -14802,17 +14810,19 @@ declare namespace Phaser {
*/ */
enable(padding?: number): void; enable(padding?: number): void;
/** /**
* Destroys and removes all FX Controllers that are part of this FX Component, * Destroys and removes all Pre and Post FX Controllers that are part of this FX Component,
* then disables it. * then disables it.
* @param removePre Should the Pre FX Controllers be removed? Default true.
* @param removePost Should the Post FX Controllers be removed? Default true.
*/ */
clear(): void; clear(removePre?: boolean, removePost?: boolean): this;
/** /**
* Searches for the given FX Controler within this FX Component. * Searches for the given FX Controller within this FX Component.
* *
* If found, the controller is removed from this compoent and then destroyed. * If found, the controller is removed from this compoent and then destroyed.
* @param fx The FX Controller to remove from this FX Component. * @param fx The FX Controller to remove from this FX Component.
*/ */
remove(fx: Phaser.FX.Controller): void; remove(fx: Phaser.FX.Controller): this;
/** /**
* Disables this FX Component. * Disables this FX Component.
* *
@ -14821,10 +14831,10 @@ declare namespace Phaser {
* *
* You can re-enable it again by calling `enable`. * You can re-enable it again by calling `enable`.
* *
* Optionally, set `clear` to destroy all current FX Controllers. * Optionally, set `clear` to destroy all current Per and Post FX Controllers.
* @param clear Destroy and remove all FX Controllers that are part of this FX Component. Default false. * @param clear Destroy and remove all Pre and Post FX Controllers that are part of this FX Component. Default false.
*/ */
disable(clear?: boolean): void; disable(clear?: boolean): this;
/** /**
* Adds the given FX Controler to this FX Component. * Adds the given FX Controler to this FX Component.
* *
@ -20952,6 +20962,77 @@ declare namespace Phaser {
*/ */
tilemap(key?: string, tileWidth?: number, tileHeight?: number, width?: number, height?: number, data?: number[][], insertNull?: boolean): Phaser.Tilemaps.Tilemap; tilemap(key?: string, tileWidth?: number, tileHeight?: number, width?: number, height?: number, data?: number[][], insertNull?: boolean): Phaser.Tilemaps.Tilemap;
/**
* A Timeline is a way to schedule events to happen at specific times in the future.
*
* You can think of it as an event sequencer for your game, allowing you to schedule the
* running of callbacks, events and other actions at specific times in the future.
*
* A Timeline is a Scene level system, meaning you can have as many Timelines as you like, each
* belonging to a different Scene. You can also have multiple Timelines running at the same time.
*
* If the Scene is paused, the Timeline will also pause. If the Scene is destroyed, the Timeline
* will be automatically destroyed. However, you can control the Timeline directly, pausing,
* resuming and stopping it at any time.
*
* Create an instance of a Timeline via the Game Object Factory:
*
* ```js
* const timeline = this.add.timeline();
* ```
*
* The Timeline always starts paused. You must call `play` on it to start it running.
*
* You can also pass in a configuration object on creation, or an array of them:
*
* ```js
* const timeline = this.add.timeline({
* at: 1000,
* run: () => {
* this.add.sprite(400, 300, 'logo');
* }
* });
*
* timeline.play();
* ```
*
* In this example we sequence a few different events:
*
* ```js
* const timeline = this.add.timeline([
* {
* at: 1000,
* run: () => { this.logo = this.add.sprite(400, 300, 'logo'); },
* sound: 'TitleMusic'
* },
* {
* at: 2500,
* tween: {
* targets: this.logo,
* y: 600,
* yoyo: true
* },
* sound: 'Explode'
* },
* {
* at: 8000,
* event: 'HURRY_PLAYER',
* target: this.background,
* set: {
* tint: 0xff0000
* }
* }
* ]);
*
* timeline.play();
* ```
*
* There are lots of options available to you via the configuration object. See the
* {@link Phaser.Types.Time.TimelineEventConfig} typedef for more details.
* @param config The configuration object for this Timeline Event, or an array of them.
*/
timeline(config: Phaser.Types.Time.TimelineEventConfig | Phaser.Types.Time.TimelineEventConfig[]): Phaser.Time.Timeline;
/** /**
* Creates a new Tween object. * Creates a new Tween object.
* *
@ -76632,6 +76713,92 @@ declare namespace Phaser {
} }
namespace Time { namespace Time {
type TimelineEvent = {
/**
* Has this event completed yet?
*/
complete: boolean;
/**
* Is this a once only event?
*/
once: boolean;
/**
* The time (in elapsed ms) at which this event will fire.
*/
time: number;
/**
* User-land callback which will be called when the Event fires if set.
*/
run?: Function;
/**
* Tween configuration object which will be used to create a Tween when the Event fires if set.
*/
tween?: Phaser.Types.Tweens.TweenBuilderConfig | Phaser.Types.Tweens.TweenChainBuilderConfig | Phaser.Tweens.Tween | Phaser.Tweens.TweenChain;
/**
* Object containing properties to set on the `target` when the Event fires if set.
*/
set?: object;
/**
* Sound configuration object which will be used to create a Sound when the Event fires if set.
*/
sound?: string | object;
/**
* The scope (`this` object) with which to invoke the run `callback`.
*/
target?: any;
/**
* Optional event name to emit when the Event fires.
*/
event?: string;
};
type TimelineEventConfig = {
/**
* The time (in ms) at which the Event will fire. The Timeline starts at 0.
*/
at?: number;
/**
* If the Timeline is already running, this is the time (in ms) at which the Event will fire based on its current elapsed value. If set, overrides the `at` property.
*/
in?: number;
/**
* Fire this event 'from' milliseconds after the previous event in the Timeline. If set it overrides the `at` and `in` properties.
*/
from?: number;
/**
* A function which will be called when the Event fires.
*/
run?: Function;
/**
* Optional string-based event name to emit when the Event fires. The event is emitted from the Timeline instance.
*/
event?: string;
/**
* The scope (`this` object) with which to invoke the run `callback`, if set.
*/
target?: any;
/**
* If set, the Event will be removed from the Timeline when it fires.
*/
once?: boolean;
/**
* If set, the Timeline will stop and enter a complete state when this Event fires, even if there are other events after it.
*/
stop?: boolean;
/**
* A Tween or TweenChain configuration object or instance. If set, the Event will create this Tween when it fires.
*/
tween?: Phaser.Types.Tweens.TweenBuilderConfig | Phaser.Types.Tweens.TweenChainBuilderConfig | Phaser.Tweens.Tween | Phaser.Tweens.TweenChain;
/**
* A key-value object of properties to set on the `target` when the Event fires. Ignored if no `target` is given.
*/
set?: object;
/**
* A key from the Sound Manager to play, or a config object for a sound to play when the Event fires. If a config object it must provide two properties: `key` and `config`. The `key` is the key of the sound to play, and the `config` is the config is a Phaser.Types.Sound.SoundConfig object.
*/
sound?: string | object;
};
type TimerEventConfig = { type TimerEventConfig = {
/** /**
* The delay after which the Timer Event should fire, in milliseconds. * The delay after which the Timer Event should fire, in milliseconds.
@ -93713,8 +93880,10 @@ declare namespace Phaser {
* @param minFilter The minFilter mode of the texture when created. 0 is `LINEAR`, 1 is `NEAREST`. Default 0. * @param minFilter The minFilter mode of the texture when created. 0 is `LINEAR`, 1 is `NEAREST`. Default 0.
* @param autoClear Automatically clear this framebuffer when bound? Default true. * @param autoClear Automatically clear this framebuffer when bound? Default true.
* @param autoResize Automatically resize this Render Target if the WebGL Renderer resizes? Default false. * @param autoResize Automatically resize this Render Target if the WebGL Renderer resizes? Default false.
* @param addDepthBuffer Add a DEPTH_STENCIL and attachment to this Render Target? Default true.
* @param forceClamp Force the texture to use the CLAMP_TO_EDGE wrap mode, even if a power of two? Default true.
*/ */
constructor(renderer: Phaser.Renderer.WebGL.WebGLRenderer, width: number, height: number, scale?: number, minFilter?: number, autoClear?: boolean, autoResize?: boolean); constructor(renderer: Phaser.Renderer.WebGL.WebGLRenderer, width: number, height: number, scale?: number, minFilter?: number, autoClear?: boolean, autoResize?: boolean, addDepthBuffer?: boolean, forceClamp?: boolean);
/** /**
* A reference to the WebGLRenderer instance. * A reference to the WebGLRenderer instance.
@ -93778,6 +93947,14 @@ declare namespace Phaser {
*/ */
readonly hasDepthBuffer: boolean; readonly hasDepthBuffer: boolean;
/**
* Force the WebGL Texture to use the CLAMP_TO_EDGE wrap mode, even if a power of two?
*
* If `false` it will use `gl.REPEAT` instead, which may be required for some effects, such
* as using this Render Target as a texture for a Shader.
*/
forceClamp: boolean;
/** /**
* Sets if this Render Target should automatically resize when the WebGL Renderer * Sets if this Render Target should automatically resize when the WebGL Renderer
* emits a resize event. * emits a resize event.
@ -104656,6 +104833,22 @@ declare namespace Phaser {
*/ */
hexSideLength: number; hexSideLength: number;
/**
* The Stagger Axis as defined in Tiled.
*
* Only used for hexagonal orientation Tilemaps.
*/
staggerAxis: string;
/**
* The Stagger Index as defined in Tiled.
*
* Either 'odd' or 'even'.
*
* Only used for hexagonal orientation Tilemaps.
*/
staggerIndex: string;
} }
/** /**
@ -105751,6 +105944,11 @@ declare namespace Phaser {
*/ */
layers: Phaser.Tilemaps.LayerData[]; layers: Phaser.Tilemaps.LayerData[];
/**
* Master list of tiles -> x, y, index in tileset.
*/
tiles: any[];
/** /**
* An array of Tilesets used in the map. * An array of Tilesets used in the map.
*/ */
@ -105816,8 +106014,10 @@ declare namespace Phaser {
* If not specified, it will default to 0 or the value specified in the Tiled JSON file. * If not specified, it will default to 0 or the value specified in the Tiled JSON file.
* @param gid If adding multiple tilesets to a blank map, specify the starting * @param gid If adding multiple tilesets to a blank map, specify the starting
* GID this set will use here. Default 0. * GID this set will use here. Default 0.
* @param tileOffset Tile texture drawing offset.
* If not specified, it will default to {0, 0} Default {x: 0, y: 0}.
*/ */
addTilesetImage(tilesetName: string, key?: string, tileWidth?: number, tileHeight?: number, tileMargin?: number, tileSpacing?: number, gid?: number): Phaser.Tilemaps.Tileset | null; addTilesetImage(tilesetName: string, key?: string, tileWidth?: number, tileHeight?: number, tileMargin?: number, tileSpacing?: number, gid?: number, tileOffset?: object): Phaser.Tilemaps.Tileset | null;
/** /**
* Copies the tiles in the source rectangular area to a new destination (all specified in tile * Copies the tiles in the source rectangular area to a new destination (all specified in tile
@ -108629,6 +108829,264 @@ declare namespace Phaser {
} }
/**
* A Timeline is a way to schedule events to happen at specific times in the future.
*
* You can think of it as an event sequencer for your game, allowing you to schedule the
* running of callbacks, events and other actions at specific times in the future.
*
* A Timeline is a Scene level system, meaning you can have as many Timelines as you like, each
* belonging to a different Scene. You can also have multiple Timelines running at the same time.
*
* If the Scene is paused, the Timeline will also pause. If the Scene is destroyed, the Timeline
* will be automatically destroyed. However, you can control the Timeline directly, pausing,
* resuming and stopping it at any time.
*
* Create an instance of a Timeline via the Game Object Factory:
*
* ```js
* const timeline = this.add.timeline();
* ```
*
* The Timeline always starts paused. You must call `play` on it to start it running.
*
* You can also pass in a configuration object on creation, or an array of them:
*
* ```js
* const timeline = this.add.timeline({
* at: 1000,
* run: () => {
* this.add.sprite(400, 300, 'logo');
* }
* });
*
* timeline.play();
* ```
*
* In this example we sequence a few different events:
*
* ```js
* const timeline = this.add.timeline([
* {
* at: 1000,
* run: () => { this.logo = this.add.sprite(400, 300, 'logo'); },
* sound: 'TitleMusic'
* },
* {
* at: 2500,
* tween: {
* targets: this.logo,
* y: 600,
* yoyo: true
* },
* sound: 'Explode'
* },
* {
* at: 8000,
* event: 'HURRY_PLAYER',
* target: this.background,
* set: {
* tint: 0xff0000
* }
* }
* ]);
*
* timeline.play();
* ```
*
* There are lots of options available to you via the configuration object. See the
* {@link Phaser.Types.Time.TimelineEventConfig} typedef for more details.
*/
class Timeline {
/**
*
* @param scene The Scene which owns this Timeline.
* @param config The configuration object for this Timeline Event, or an array of them.
*/
constructor(scene: Phaser.Scene, config: Phaser.Types.Time.TimelineEventConfig | Phaser.Types.Time.TimelineEventConfig[]);
/**
* The Scene to which this Timeline belongs.
*/
scene: Phaser.Scene;
/**
* A reference to the Scene Systems.
*/
systems: Phaser.Scenes.Systems;
/**
* The elapsed time counter.
*
* Treat this as read-only.
*/
elapsed: number;
/**
* Whether the Timeline is running (`true`) or active (`false`).
*
* When paused, the Timeline will not run any of its actions.
*
* By default a Timeline is always paused and should be started by
* calling the `Timeline.play` method.
*
* You can use the `Timeline.pause` and `Timeline.resume` methods to control
* this value in a chainable way.
*/
paused: boolean;
/**
* Whether the Timeline is complete (`true`) or not (`false`).
*
* A Timeline is considered complete when all of its events have been run.
*
* If you wish to restart a Timeline after it has completed, you can do so
* by calling the `Timeline.restart` method.
*
* You can also use the `Timeline.stop` method to stop a running Timeline,
* at any point, without resetting it.
*/
complete: boolean;
/**
* The total number of events that have been run.
*
* This value is reset to zero if the Timeline is restarted.
*
* Treat this as read-only.
*/
totalComplete: number;
/**
* An array of all the Timeline Events.
*/
events: Phaser.Types.Time.TimelineEvent[];
/**
* Updates the elapsed time counter, if this Timeline is not paused.
* @param time The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout.
* @param delta The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate.
*/
preUpdate(time: number, delta: number): void;
/**
* Called automatically by the Scene update step.
*
* Iterates through all of the Timeline Events and checks to see if they should be run.
*
* If they should be run, then the `TimelineEvent.action` callback is invoked.
*
* If the `TimelineEvent.once` property is `true` then the event is removed from the Timeline.
*
* If the `TimelineEvent.event` property is set then the Timeline emits that event.
*
* If the `TimelineEvent.run` property is set then the Timeline invokes that method.
*
* If the `TimelineEvent.target` property is set then the Timeline invokes the `run` method on that target.
* @param time The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout.
* @param delta The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate.
*/
update(time: number, delta: number): void;
/**
* Starts this Timeline running.
*
* If the Timeline is already running and the `fromStart` parameter is `true`,
* then calling this method will reset the Timeline events as incomplete.
*
* If you wish to resume a paused Timeline, then use the `Timeline.resume` method instead.
* @param fromStart Reset this Timeline back to the start before playing. Default true.
*/
play(fromStart?: boolean): this;
/**
* Pauses this Timeline.
*
* To resume it again, call the `Timeline.resume` method or set the `Timeline.paused` property to `false`.
*
* If the Timeline is paused while processing the current game step, then it
* will carry on with all events that are due to run during that step and pause
* from the next game step.
*/
pause(): this;
/**
* Resumes this Timeline from a paused state.
*
* The Timeline will carry on from where it left off.
*
* If you need to reset the Timeline to the start, then call the `Timeline.reset` method.
*/
resume(): this;
/**
* Stops this Timeline.
*
* This will set the `paused` and `complete` properties to `true`.
*
* If you wish to reset the Timeline to the start, then call the `Timeline.reset` method.
*/
stop(): this;
/**
* Resets this Timeline back to the start.
*
* This will set the elapsed time to zero and set all events to be incomplete.
*
* If the Timeline had any events that were set to `once` that have already
* been removed, they will **not** be present again after calling this method.
*
* If the Timeline isn't currently running (i.e. it's paused or complete) then
* calling this method resets those states, the same as calling `Timeline.play(true)`.
*/
reset(): this;
/**
* Adds one or more events to this Timeline.
* @param config The configuration object for this Timeline Event, or an array of them.
*/
add(config: Phaser.Types.Time.TimelineEventConfig | Phaser.Types.Time.TimelineEventConfig[]): this;
/**
* Removes all events from this Timeline, resets the elapsed time to zero
* and pauses the Timeline.
*/
clear(): this;
/**
* Returns `true` if this Timeline is currently playing.
*
* A Timeline is playing if it is not paused or not complete.
*/
isPlaying(): boolean;
/**
* Returns a number between 0 and 1 representing the progress of this Timeline.
*
* A value of 0 means the Timeline has just started, 0.5 means it's half way through,
* and 1 means it's complete.
*
* If the Timeline has no events, or all events have been removed, this will return 1.
*
* If the Timeline is paused, this will return the progress value at the time it was paused.
*
* Note that the value returned is based on the number of events that have been completed,
* not the 'duration' of the events (as this is unknown to the Timeline).
*/
getProgress(): number;
/**
* Destroys this Timeline.
*
* This will remove all events from the Timeline and stop it from processing.
*
* This method is called automatically when the Scene shuts down, but you may
* also call it directly should you need to destroy the Timeline earlier.
*/
destroy(): void;
}
/** /**
* A Timer Event represents a delayed function call. It's managed by a Scene's {@link Clock} and will call its function after a set amount of time has passed. The Timer Event can optionally repeat - i.e. call its function multiple times before finishing, or loop indefinitely. * A Timer Event represents a delayed function call. It's managed by a Scene's {@link Clock} and will call its function after a set amount of time has passed. The Timer Event can optionally repeat - i.e. call its function multiple times before finishing, or loop indefinitely.
* *
@ -110671,9 +111129,9 @@ declare namespace Phaser {
* otherwise it will linger in memory forever. * otherwise it will linger in memory forever.
* *
* If you wish to chain Tweens together for sequential playback, see the `TweenManager.chain` method. * If you wish to chain Tweens together for sequential playback, see the `TweenManager.chain` method.
* @param config A Tween Configuration object. * @param config A Tween Configuration object, or a Tween or TweenChain instance.
*/ */
add(config: Phaser.Types.Tweens.TweenBuilderConfig | object): Phaser.Tweens.Tween; add(config: Phaser.Types.Tweens.TweenBuilderConfig | Phaser.Types.Tweens.TweenChainBuilderConfig | Phaser.Tweens.Tween | Phaser.Tweens.TweenChain): Phaser.Tweens.Tween;
/** /**
* Create multiple Tweens and add them all to this Tween Manager, by passing an array of Tween Configuration objects. * Create multiple Tweens and add them all to this Tween Manager, by passing an array of Tween Configuration objects.