Spine 3 Plugin dist for v3.70.0

This commit is contained in:
Richard Davey 2023-11-10 15:33:49 +00:00
parent ef78208168
commit 2aeaa4d0f2
6 changed files with 702 additions and 258 deletions

View file

@ -9763,7 +9763,7 @@ var SpinePlugin = new Class({
* Note: The ability to load this type of file will only be available if the Spine Plugin has been built or loaded into Phaser. * Note: The ability to load this type of file will only be available if the Spine Plugin has been built or loaded into Phaser.
* *
* @method Phaser.Loader.LoaderPlugin#spine * @method Phaser.Loader.LoaderPlugin#spine
* @fires Phaser.Loader.LoaderPlugin#ADD * @fires Phaser.Loader.Events#ADD
* @since 3.19.0 * @since 3.19.0
* *
* @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig|Phaser.Types.Loader.FileTypes.JSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig|Phaser.Types.Loader.FileTypes.JSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them.
@ -11256,7 +11256,7 @@ var SpineGameObject = new Class({
*/ */
setSkeletonFromJSON: function (atlasDataKey, skeletonJSON, animationName, loop) setSkeletonFromJSON: function (atlasDataKey, skeletonJSON, animationName, loop)
{ {
return this.setSkeleton(atlasDataKey, skeletonJSON, animationName, loop); return this.setSkeleton(atlasDataKey, animationName, loop, skeletonJSON);
}, },
/** /**
@ -12548,7 +12548,7 @@ var CONST = {
* @type {string} * @type {string}
* @since 3.0.0 * @since 3.0.0
*/ */
VERSION: '3.60.0', VERSION: '3.70.0',
BlendModes: __webpack_require__(8351), BlendModes: __webpack_require__(8351),
@ -12966,24 +12966,21 @@ var DataManager = new Class({
* @fires Phaser.Data.Events#CHANGE_DATA_KEY * @fires Phaser.Data.Events#CHANGE_DATA_KEY
* @since 3.23.0 * @since 3.23.0
* *
* @generic {any} T * @param {string} key - The key to change the value for.
* @genericUse {(string|T)} - [key] * @param {number} [amount=1] - The amount to increase the given key by. Pass a negative value to decrease the key.
*
* @param {(string|object)} key - The key to increase the value for.
* @param {number} [data=1] - The amount to increase the given key by. Pass a negative value to decrease the key.
* *
* @return {this} This Data Manager instance. * @return {this} This Data Manager instance.
*/ */
inc: function (key, data) inc: function (key, amount)
{ {
if (this._frozen) if (this._frozen)
{ {
return this; return this;
} }
if (data === undefined) if (amount === undefined)
{ {
data = 1; amount = 1;
} }
var value = this.get(key); var value = this.get(key);
@ -12993,7 +12990,7 @@ var DataManager = new Class({
value = 0; value = 0;
} }
this.set(key, (value + data)); this.set(key, (value + amount));
return this; return this;
}, },
@ -13009,10 +13006,7 @@ var DataManager = new Class({
* @fires Phaser.Data.Events#CHANGE_DATA_KEY * @fires Phaser.Data.Events#CHANGE_DATA_KEY
* @since 3.23.0 * @since 3.23.0
* *
* @generic {any} T * @param {string} key - The key to toggle the value for.
* @genericUse {(string|T)} - [key]
*
* @param {(string|object)} key - The key to toggle the value for.
* *
* @return {this} This Data Manager instance. * @return {this} This Data Manager instance.
*/ */
@ -13772,6 +13766,7 @@ function init ()
else if ((/AppleWebKit/).test(ua) && OS.iOS) else if ((/AppleWebKit/).test(ua) && OS.iOS)
{ {
Browser.mobileSafari = true; Browser.mobileSafari = true;
Browser.es2019 = true;
} }
else if ((/MSIE (\d+\.\d+);/).test(ua)) else if ((/MSIE (\d+\.\d+);/).test(ua))
{ {
@ -16679,7 +16674,7 @@ var Blur = new Class({
* @type {number} * @type {number}
* @since 3.60.0 * @since 3.60.0
*/ */
this.quality = 0; this.quality = quality;
/** /**
* The horizontal offset of the blur effect. * The horizontal offset of the blur effect.
@ -17105,8 +17100,28 @@ var Circle = new Class({
color[2] = (value & 0xFF) / 255; color[2] = (value & 0xFF) / 255;
} }
} },
/**
* The alpha of the background, behind the texture, given as a number value.
*
* @name Phaser.FX.Circle#backgroundAlpha
* @type {number}
* @since 3.70.0
*/
backgroundAlpha: {
get: function ()
{
return this.glcolor2[3];
},
set: function (value)
{
this.glcolor2[3] = value;
}
}
}); });
module.exports = Circle; module.exports = Circle;
@ -17609,10 +17624,10 @@ var FX_CONST = __webpack_require__(1571);
* @param {number} [color1=0xff0000] - The first gradient color, given as a number value. * @param {number} [color1=0xff0000] - The first gradient color, given as a number value.
* @param {number} [color2=0x00ff00] - The second gradient color, given as a number value. * @param {number} [color2=0x00ff00] - The second gradient color, given as a number value.
* @param {number} [alpha=0.2] - The alpha value of the gradient effect. * @param {number} [alpha=0.2] - The alpha value of the gradient effect.
* @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. * @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [fromY=0] - The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. * @param {number} [fromY=0] - The vertical position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toX=0] - The horizontal position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels. * @param {number} [toX=0] - The horizontal position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toY=1] - The vertical position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels. * @param {number} [toY=1] - The vertical position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [size=0] - How many 'chunks' the gradient is divided in to, as spread over the entire height of the texture. Leave this at zero for a smooth gradient, or set higher for a more retro chunky effect. * @param {number} [size=0] - How many 'chunks' the gradient is divided in to, as spread over the entire height of the texture. Leave this at zero for a smooth gradient, or set higher for a more retro chunky effect.
*/ */
var Gradient = new Class({ var Gradient = new Class({
@ -17654,7 +17669,7 @@ var Gradient = new Class({
this.size = size; this.size = size;
/** /**
* The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. * The horizontal position the gradient will start from. This value is normalized, between 0 and 1 and is not in pixels.
* *
* @name Phaser.FX.Gradient#fromX * @name Phaser.FX.Gradient#fromX
* @type {number} * @type {number}
@ -17663,7 +17678,7 @@ var Gradient = new Class({
this.fromX = fromX; this.fromX = fromX;
/** /**
* The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. * The vertical position the gradient will start from. This value is normalized, between 0 and 1 and is not in pixels.
* *
* @name Phaser.FX.Gradient#fromY * @name Phaser.FX.Gradient#fromY
* @type {number} * @type {number}
@ -17672,7 +17687,7 @@ var Gradient = new Class({
this.fromY = fromY; this.fromY = fromY;
/** /**
* The horizontal position the gradient will end. This value is noralized, between 0 and 1 and is not in pixels. * The horizontal position the gradient will end. This value is normalized, between 0 and 1 and is not in pixels.
* *
* @name Phaser.FX.Gradient#toX * @name Phaser.FX.Gradient#toX
* @type {number} * @type {number}
@ -17681,7 +17696,7 @@ var Gradient = new Class({
this.toX = toX; this.toX = toX;
/** /**
* The vertical position the gradient will end. This value is noralized, between 0 and 1 and is not in pixels. * The vertical position the gradient will end. This value is normalized, between 0 and 1 and is not in pixels.
* *
* @name Phaser.FX.Gradient#toY * @name Phaser.FX.Gradient#toY
* @type {number} * @type {number}
@ -19054,22 +19069,19 @@ var GameObject = new Class({
* @method Phaser.GameObjects.GameObject#incData * @method Phaser.GameObjects.GameObject#incData
* @since 3.23.0 * @since 3.23.0
* *
* @generic {any} T * @param {string} key - The key to change the value for.
* @genericUse {(string|T)} - [key] * @param {number} [amount=1] - The amount to increase the given key by. Pass a negative value to decrease the key.
*
* @param {(string|object)} key - The key to increase the value for.
* @param {*} [data] - The value to increase for the given key.
* *
* @return {this} This GameObject. * @return {this} This GameObject.
*/ */
incData: function (key, value) incData: function (key, amount)
{ {
if (!this.data) if (!this.data)
{ {
this.data = new DataManager(this); this.data = new DataManager(this);
} }
this.data.inc(key, value); this.data.inc(key, amount);
return this; return this;
}, },
@ -19087,10 +19099,7 @@ var GameObject = new Class({
* @method Phaser.GameObjects.GameObject#toggleData * @method Phaser.GameObjects.GameObject#toggleData
* @since 3.23.0 * @since 3.23.0
* *
* @generic {any} T * @param {string} key - The key to toggle the value for.
* @genericUse {(string|T)} - [key]
*
* @param {(string|object)} key - The key to toggle the value for.
* *
* @return {this} This GameObject. * @return {this} This GameObject.
*/ */
@ -21330,10 +21339,10 @@ var FX = new Class({
* @param {number} [color1=0xff0000] - The first gradient color, given as a number value. * @param {number} [color1=0xff0000] - The first gradient color, given as a number value.
* @param {number} [color2=0x00ff00] - The second gradient color, given as a number value. * @param {number} [color2=0x00ff00] - The second gradient color, given as a number value.
* @param {number} [alpha=0.2] - The alpha value of the gradient effect. * @param {number} [alpha=0.2] - The alpha value of the gradient effect.
* @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. * @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [fromY=0] - The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. * @param {number} [fromY=0] - The vertical position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toX=0] - The horizontal position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels. * @param {number} [toX=0] - The horizontal position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toY=1] - The vertical position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels. * @param {number} [toY=1] - The vertical position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [size=0] - How many 'chunks' the gradient is divided in to, as spread over the entire height of the texture. Leave this at zero for a smooth gradient, or set higher for a more retro chunky effect. * @param {number} [size=0] - How many 'chunks' the gradient is divided in to, as spread over the entire height of the texture. Leave this at zero for a smooth gradient, or set higher for a more retro chunky effect.
* *
* @return {Phaser.FX.Gradient} The Gradient FX Controller. * @return {Phaser.FX.Gradient} The Gradient FX Controller.
@ -22868,7 +22877,7 @@ var PathFollower = {
{ {
var tween = this.pathTween; var tween = this.pathTween;
if (tween) if (tween && tween.data)
{ {
var tweenData = tween.data[0]; var tweenData = tween.data[0];
var pathDelta = this.pathDelta; var pathDelta = this.pathDelta;
@ -23892,19 +23901,25 @@ var Texture = {
* *
* Textures are referenced by their string-based keys, as stored in the Texture Manager. * Textures are referenced by their string-based keys, as stored in the Texture Manager.
* *
* Calling this method will modify the `width` and `height` properties of your Game Object.
*
* It will also change the `origin` if the Frame has a custom pivot point, as exported from packages like Texture Packer.
*
* @method Phaser.GameObjects.Components.Texture#setTexture * @method Phaser.GameObjects.Components.Texture#setTexture
* @since 3.0.0 * @since 3.0.0
* *
* @param {(string|Phaser.Textures.Texture)} key - The key of the texture to be used, as stored in the Texture Manager, or a Texture instance. * @param {(string|Phaser.Textures.Texture)} key - The key of the texture to be used, as stored in the Texture Manager, or a Texture instance.
* @param {(string|number)} [frame] - The name or index of the frame within the Texture. * @param {(string|number)} [frame] - The name or index of the frame within the Texture.
* @param {boolean} [updateSize=true] - Should this call adjust the size of the Game Object?
* @param {boolean} [updateOrigin=true] - Should this call change the origin of the Game Object?
* *
* @return {this} This Game Object instance. * @return {this} This Game Object instance.
*/ */
setTexture: function (key, frame) setTexture: function (key, frame, updateSize, updateOrigin)
{ {
this.texture = this.scene.sys.textures.get(key); this.texture = this.scene.sys.textures.get(key);
return this.setFrame(frame); return this.setFrame(frame, updateSize, updateOrigin);
}, },
/** /**
@ -24389,7 +24404,7 @@ var Tint = {
/** /**
* The tint value being applied to the whole of the Game Object. * The tint value being applied to the whole of the Game Object.
* This property is a setter-only. Use the properties `tintTopLeft` etc to read the current tint value. * Return `tintTopLeft` when read this tint property.
* *
* @name Phaser.GameObjects.Components.Tint#tint * @name Phaser.GameObjects.Components.Tint#tint
* @type {number} * @type {number}
@ -24398,6 +24413,11 @@ var Tint = {
*/ */
tint: { tint: {
get: function ()
{
return this.tintTopLeft;
},
set: function (value) set: function (value)
{ {
this.setTint(value, value, value, value); this.setTint(value, value, value, value);
@ -25841,9 +25861,7 @@ var TransformMatrix = new Class({
*/ */
setToContext: function (ctx) setToContext: function (ctx)
{ {
var matrix = this.matrix; ctx.setTransform(this);
ctx.setTransform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
return ctx; return ctx;
}, },
@ -26053,13 +26071,14 @@ var TransformMatrix = new Class({
* @param {number} y - The y value. * @param {number} y - The y value.
* @param {number} xw - The xw value. * @param {number} xw - The xw value.
* @param {number} yh - The yh value. * @param {number} yh - The yh value.
* @param {boolean} roundPixels - Pass the results via Math.round? * @param {boolean} [roundPixels=false] - Pass the results via Math.round?
* @param {Float32Array} [quad] - Optional Float32Array to store the results in. Otherwises uses the local quad array. * @param {Float32Array} [quad] - Optional Float32Array to store the results in. Otherwises uses the local quad array.
* *
* @return {Float32Array} The quad Float32Array. * @return {Float32Array} The quad Float32Array.
*/ */
setQuad: function (x, y, xw, yh, roundPixels, quad) setQuad: function (x, y, xw, yh, roundPixels, quad)
{ {
if (roundPixels === undefined) { roundPixels = false; }
if (quad === undefined) { quad = this.quad; } if (quad === undefined) { quad = this.quad; }
var matrix = this.matrix; var matrix = this.matrix;
@ -26071,24 +26090,33 @@ var TransformMatrix = new Class({
var e = matrix[4]; var e = matrix[4];
var f = matrix[5]; var f = matrix[5];
quad[0] = x * a + y * c + e;
quad[1] = x * b + y * d + f;
quad[2] = x * a + yh * c + e;
quad[3] = x * b + yh * d + f;
quad[4] = xw * a + yh * c + e;
quad[5] = xw * b + yh * d + f;
quad[6] = xw * a + y * c + e;
quad[7] = xw * b + y * d + f;
if (roundPixels) if (roundPixels)
{ {
quad.forEach(function (value, index) quad[0] = Math.round(x * a + y * c + e);
{ quad[1] = Math.round(x * b + y * d + f);
quad[index] = Math.round(value);
}); quad[2] = Math.round(x * a + yh * c + e);
quad[3] = Math.round(x * b + yh * d + f);
quad[4] = Math.round(xw * a + yh * c + e);
quad[5] = Math.round(xw * b + yh * d + f);
quad[6] = Math.round(xw * a + y * c + e);
quad[7] = Math.round(xw * b + y * d + f);
}
else
{
quad[0] = x * a + y * c + e;
quad[1] = x * b + y * d + f;
quad[2] = x * a + yh * c + e;
quad[3] = x * b + yh * d + f;
quad[4] = xw * a + yh * c + e;
quad[5] = xw * b + yh * d + f;
quad[6] = xw * a + y * c + e;
quad[7] = xw * b + y * d + f;
} }
return quad; return quad;
@ -28903,6 +28931,28 @@ var Line = new Class({
return this; return this;
}, },
/**
* Sets this Line to match the x/y coordinates of the two given Vector2Like objects.
*
* @method Phaser.Geom.Line#setFromObjects
* @since 3.70.0
*
* @param {Phaser.Types.Math.Vector2Like} start - Any object with public `x` and `y` properties, whose values will be assigned to the x1/y1 components of this Line.
* @param {Phaser.Types.Math.Vector2Like} end - Any object with public `x` and `y` properties, whose values will be assigned to the x2/y2 components of this Line.
*
* @return {this} This Line object.
*/
setFromObjects: function (start, end)
{
this.x1 = start.x;
this.y1 = start.y;
this.x2 = end.x;
this.y2 = end.y;
return this;
},
/** /**
* Returns a Vector2 object that corresponds to the start of this Line. * Returns a Vector2 object that corresponds to the start of this Line.
* *
@ -30796,6 +30846,13 @@ var MultiFile = new Class({
*/ */
this.key = key; this.key = key;
var loadKey = this.key;
if (loader.prefix && loader.prefix !== '')
{
this.key = loader.prefix + loadKey;
}
/** /**
* The current index being used by multi-file loaders to avoid key clashes. * The current index being used by multi-file loaders to avoid key clashes.
* *
@ -31913,8 +31970,11 @@ var ImageFile = new Class({
// We do, but has it loaded? // We do, but has it loaded?
if (linkFile.state >= CONST.FILE_COMPLETE) if (linkFile.state >= CONST.FILE_COMPLETE)
{ {
// Both files have loaded if (linkFile.type === 'spritesheet')
if (this.type === 'normalMap') {
linkFile.addToCache();
}
else if (this.type === 'normalMap')
{ {
// linkFile.data = Image // linkFile.data = Image
// this.data = Normal Map // this.data = Normal Map
@ -32025,7 +32085,7 @@ var ImageFile = new Class({
* It is available in the default build but can be excluded from custom builds. * It is available in the default build but can be excluded from custom builds.
* *
* @method Phaser.Loader.LoaderPlugin#image * @method Phaser.Loader.LoaderPlugin#image
* @fires Phaser.Loader.LoaderPlugin#ADD * @fires Phaser.Loader.Events#ADD
* @since 3.0.0 * @since 3.0.0
* *
* @param {(string|Phaser.Types.Loader.FileTypes.ImageFileConfig|Phaser.Types.Loader.FileTypes.ImageFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {(string|Phaser.Types.Loader.FileTypes.ImageFileConfig|Phaser.Types.Loader.FileTypes.ImageFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them.
@ -32264,7 +32324,7 @@ var JSONFile = new Class({
* It is available in the default build but can be excluded from custom builds. * It is available in the default build but can be excluded from custom builds.
* *
* @method Phaser.Loader.LoaderPlugin#json * @method Phaser.Loader.LoaderPlugin#json
* @fires Phaser.Loader.LoaderPlugin#ADD * @fires Phaser.Loader.Events#ADD
* @since 3.0.0 * @since 3.0.0
* *
* @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig|Phaser.Types.Loader.FileTypes.JSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig|Phaser.Types.Loader.FileTypes.JSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them.
@ -32445,7 +32505,7 @@ var TextFile = new Class({
* It is available in the default build but can be excluded from custom builds. * It is available in the default build but can be excluded from custom builds.
* *
* @method Phaser.Loader.LoaderPlugin#text * @method Phaser.Loader.LoaderPlugin#text
* @fires Phaser.Loader.LoaderPlugin#ADD * @fires Phaser.Loader.Events#ADD
* @since 3.0.0 * @since 3.0.0
* *
* @param {(string|Phaser.Types.Loader.FileTypes.TextFileConfig|Phaser.Types.Loader.FileTypes.TextFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {(string|Phaser.Types.Loader.FileTypes.TextFileConfig|Phaser.Types.Loader.FileTypes.TextFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them.
@ -40069,12 +40129,6 @@ module.exports = Within;
*/ */
var Wrap = function (value, min, max) var Wrap = function (value, min, max)
{ {
if (value >= min && value <= max)
{
// Skip modulo if already in range
return value;
}
var range = max - min; var range = max - min;
return (min + ((((value - min) % range) + range) % range)); return (min + ((((value - min) % range) + range) % range));
@ -43641,7 +43695,7 @@ var RandomDataGenerator = new Class({
*/ */
weightedPick: function (array) weightedPick: function (array)
{ {
return array[~~(Math.pow(this.frac(), 2) * (array.length - 1) + 0.5)]; return array[~~(Math.pow(this.frac(), 2) * array.length + 0.5)];
}, },
/** /**
@ -45946,6 +46000,14 @@ var Frame = new Class({
y: 0, y: 0,
width: 0, width: 0,
height: 0 height: 0
},
is3Slice: false,
scale9: false,
scale9Borders: {
x: 0,
y: 0,
w: 0,
h: 0
} }
}; };
@ -46065,6 +46127,38 @@ var Frame = new Class({
return this.updateUVs(); return this.updateUVs();
}, },
/**
* Sets the scale9 center rectangle values.
*
* Scale9 is a feature of Texture Packer, allowing you to define a nine-slice scaling grid.
*
* This is set automatically by the JSONArray and JSONHash parsers.
*
* @method Phaser.Textures.Frame#setScale9
* @since 3.70.0
*
* @param {number} x - The left coordinate of the center scale9 rectangle.
* @param {number} y - The top coordinate of the center scale9 rectangle.
* @param {number} width - The width of the center scale9 rectangle.
* @param {number} height - The height coordinate of the center scale9 rectangle.
*
* @return {this} This Frame object.
*/
setScale9: function (x, y, width, height)
{
var data = this.data;
data.scale9 = true;
data.is3Slice = (y === 0 && height === this.height);
data.scale9Borders.x = x;
data.scale9Borders.y = y;
data.scale9Borders.w = width;
data.scale9Borders.h = height;
return this;
},
/** /**
* Takes a crop data object and, based on the rectangular region given, calculates the * Takes a crop data object and, based on the rectangular region given, calculates the
* required UV coordinates in order to crop this Frame for WebGL and Canvas rendering. * required UV coordinates in order to crop this Frame for WebGL and Canvas rendering.
@ -46366,8 +46460,8 @@ var Frame = new Class({
*/ */
destroy: function () destroy: function ()
{ {
this.source = null;
this.texture = null; this.texture = null;
this.source = null;
this.glTexture = null; this.glTexture = null;
this.customData = null; this.customData = null;
this.data = null; this.data = null;
@ -46443,6 +46537,40 @@ var Frame = new Class({
}, },
/**
* Does the Frame have scale9 border data?
*
* @name Phaser.Textures.Frame#scale9
* @type {boolean}
* @readonly
* @since 3.70.0
*/
scale9: {
get: function ()
{
return this.data.scale9;
}
},
/**
* If the Frame has scale9 border data, is it 3-slice or 9-slice data?
*
* @name Phaser.Textures.Frame#is3Slice
* @type {boolean}
* @readonly
* @since 3.70.0
*/
is3Slice: {
get: function ()
{
return this.data.is3Slice;
}
},
/** /**
* The Canvas drawImage data object. * The Canvas drawImage data object.
* *
@ -47724,11 +47852,15 @@ module.exports = GetFirst;
* @function Phaser.Utils.Array.GetRandom * @function Phaser.Utils.Array.GetRandom
* @since 3.0.0 * @since 3.0.0
* *
* @param {array} array - The array to select the random entry from. * @generic T
* @genericUse {T[]} - [array]
* @genericUse {T} - [$return]
*
* @param {T[]} array - The array to select the random entry from.
* @param {number} [startIndex=0] - An optional start index. * @param {number} [startIndex=0] - An optional start index.
* @param {number} [length=array.length] - An optional length, the total number of elements (from the startIndex) to choose from. * @param {number} [length=array.length] - An optional length, the total number of elements (from the startIndex) to choose from.
* *
* @return {*} A random element from the array, or `null` if no element could be found in the range given. * @return {T} A random element from the array, or `null` if no element could be found in the range given.
*/ */
var GetRandom = function (array, startIndex, length) var GetRandom = function (array, startIndex, length)
{ {
@ -49723,12 +49855,20 @@ var RotateMatrix = __webpack_require__(7116);
* @genericUse {T[][]} - [matrix,$return] * @genericUse {T[][]} - [matrix,$return]
* *
* @param {T[][]} [matrix] - The array to rotate. * @param {T[][]} [matrix] - The array to rotate.
* @param {number} [amount=1] - The number of times to rotate the matrix.
* *
* @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix. * @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix.
*/ */
var RotateLeft = function (matrix) var RotateLeft = function (matrix, amount)
{ {
return RotateMatrix(matrix, 90); if (amount === undefined) { amount = 1; }
for (var i = 0; i < amount; i++)
{
matrix = RotateMatrix(matrix, 90);
}
return matrix;
}; };
module.exports = RotateLeft; module.exports = RotateLeft;
@ -49858,12 +49998,20 @@ var RotateMatrix = __webpack_require__(7116);
* @genericUse {T[][]} - [matrix,$return] * @genericUse {T[][]} - [matrix,$return]
* *
* @param {T[][]} [matrix] - The array to rotate. * @param {T[][]} [matrix] - The array to rotate.
* @param {number} [amount=1] - The number of times to rotate the matrix.
* *
* @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix. * @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix.
*/ */
var RotateRight = function (matrix) var RotateRight = function (matrix, amount)
{ {
return RotateMatrix(matrix, -90); if (amount === undefined) { amount = 1; }
for (var i = 0; i < amount; i++)
{
matrix = RotateMatrix(matrix, -90);
}
return matrix;
}; };
module.exports = RotateRight; module.exports = RotateRight;
@ -50224,7 +50372,7 @@ var GetValue = __webpack_require__(5851);
* *
* Allowed types: * Allowed types:
* *
* Implicit * Explicit:
* { * {
* x: 4 * x: 4
* } * }

File diff suppressed because one or more lines are too long

View file

@ -12103,7 +12103,7 @@ var SpinePlugin = new Class({
* Note: The ability to load this type of file will only be available if the Spine Plugin has been built or loaded into Phaser. * Note: The ability to load this type of file will only be available if the Spine Plugin has been built or loaded into Phaser.
* *
* @method Phaser.Loader.LoaderPlugin#spine * @method Phaser.Loader.LoaderPlugin#spine
* @fires Phaser.Loader.LoaderPlugin#ADD * @fires Phaser.Loader.Events#ADD
* @since 3.19.0 * @since 3.19.0
* *
* @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig|Phaser.Types.Loader.FileTypes.JSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig|Phaser.Types.Loader.FileTypes.JSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them.
@ -13725,7 +13725,7 @@ var SpineGameObject = new Class({
*/ */
setSkeletonFromJSON: function (atlasDataKey, skeletonJSON, animationName, loop) setSkeletonFromJSON: function (atlasDataKey, skeletonJSON, animationName, loop)
{ {
return this.setSkeleton(atlasDataKey, skeletonJSON, animationName, loop); return this.setSkeleton(atlasDataKey, animationName, loop, skeletonJSON);
}, },
/** /**
@ -15309,7 +15309,7 @@ var CONST = {
* @type {string} * @type {string}
* @since 3.0.0 * @since 3.0.0
*/ */
VERSION: '3.60.0', VERSION: '3.70.0',
BlendModes: __webpack_require__(8351), BlendModes: __webpack_require__(8351),
@ -15727,24 +15727,21 @@ var DataManager = new Class({
* @fires Phaser.Data.Events#CHANGE_DATA_KEY * @fires Phaser.Data.Events#CHANGE_DATA_KEY
* @since 3.23.0 * @since 3.23.0
* *
* @generic {any} T * @param {string} key - The key to change the value for.
* @genericUse {(string|T)} - [key] * @param {number} [amount=1] - The amount to increase the given key by. Pass a negative value to decrease the key.
*
* @param {(string|object)} key - The key to increase the value for.
* @param {number} [data=1] - The amount to increase the given key by. Pass a negative value to decrease the key.
* *
* @return {this} This Data Manager instance. * @return {this} This Data Manager instance.
*/ */
inc: function (key, data) inc: function (key, amount)
{ {
if (this._frozen) if (this._frozen)
{ {
return this; return this;
} }
if (data === undefined) if (amount === undefined)
{ {
data = 1; amount = 1;
} }
var value = this.get(key); var value = this.get(key);
@ -15754,7 +15751,7 @@ var DataManager = new Class({
value = 0; value = 0;
} }
this.set(key, (value + data)); this.set(key, (value + amount));
return this; return this;
}, },
@ -15770,10 +15767,7 @@ var DataManager = new Class({
* @fires Phaser.Data.Events#CHANGE_DATA_KEY * @fires Phaser.Data.Events#CHANGE_DATA_KEY
* @since 3.23.0 * @since 3.23.0
* *
* @generic {any} T * @param {string} key - The key to toggle the value for.
* @genericUse {(string|T)} - [key]
*
* @param {(string|object)} key - The key to toggle the value for.
* *
* @return {this} This Data Manager instance. * @return {this} This Data Manager instance.
*/ */
@ -16533,6 +16527,7 @@ function init ()
else if ((/AppleWebKit/).test(ua) && OS.iOS) else if ((/AppleWebKit/).test(ua) && OS.iOS)
{ {
Browser.mobileSafari = true; Browser.mobileSafari = true;
Browser.es2019 = true;
} }
else if ((/MSIE (\d+\.\d+);/).test(ua)) else if ((/MSIE (\d+\.\d+);/).test(ua))
{ {
@ -19440,7 +19435,7 @@ var Blur = new Class({
* @type {number} * @type {number}
* @since 3.60.0 * @since 3.60.0
*/ */
this.quality = 0; this.quality = quality;
/** /**
* The horizontal offset of the blur effect. * The horizontal offset of the blur effect.
@ -19866,8 +19861,28 @@ var Circle = new Class({
color[2] = (value & 0xFF) / 255; color[2] = (value & 0xFF) / 255;
} }
} },
/**
* The alpha of the background, behind the texture, given as a number value.
*
* @name Phaser.FX.Circle#backgroundAlpha
* @type {number}
* @since 3.70.0
*/
backgroundAlpha: {
get: function ()
{
return this.glcolor2[3];
},
set: function (value)
{
this.glcolor2[3] = value;
}
}
}); });
module.exports = Circle; module.exports = Circle;
@ -20370,10 +20385,10 @@ var FX_CONST = __webpack_require__(1571);
* @param {number} [color1=0xff0000] - The first gradient color, given as a number value. * @param {number} [color1=0xff0000] - The first gradient color, given as a number value.
* @param {number} [color2=0x00ff00] - The second gradient color, given as a number value. * @param {number} [color2=0x00ff00] - The second gradient color, given as a number value.
* @param {number} [alpha=0.2] - The alpha value of the gradient effect. * @param {number} [alpha=0.2] - The alpha value of the gradient effect.
* @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. * @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [fromY=0] - The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. * @param {number} [fromY=0] - The vertical position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toX=0] - The horizontal position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels. * @param {number} [toX=0] - The horizontal position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toY=1] - The vertical position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels. * @param {number} [toY=1] - The vertical position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [size=0] - How many 'chunks' the gradient is divided in to, as spread over the entire height of the texture. Leave this at zero for a smooth gradient, or set higher for a more retro chunky effect. * @param {number} [size=0] - How many 'chunks' the gradient is divided in to, as spread over the entire height of the texture. Leave this at zero for a smooth gradient, or set higher for a more retro chunky effect.
*/ */
var Gradient = new Class({ var Gradient = new Class({
@ -20415,7 +20430,7 @@ var Gradient = new Class({
this.size = size; this.size = size;
/** /**
* The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. * The horizontal position the gradient will start from. This value is normalized, between 0 and 1 and is not in pixels.
* *
* @name Phaser.FX.Gradient#fromX * @name Phaser.FX.Gradient#fromX
* @type {number} * @type {number}
@ -20424,7 +20439,7 @@ var Gradient = new Class({
this.fromX = fromX; this.fromX = fromX;
/** /**
* The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. * The vertical position the gradient will start from. This value is normalized, between 0 and 1 and is not in pixels.
* *
* @name Phaser.FX.Gradient#fromY * @name Phaser.FX.Gradient#fromY
* @type {number} * @type {number}
@ -20433,7 +20448,7 @@ var Gradient = new Class({
this.fromY = fromY; this.fromY = fromY;
/** /**
* The horizontal position the gradient will end. This value is noralized, between 0 and 1 and is not in pixels. * The horizontal position the gradient will end. This value is normalized, between 0 and 1 and is not in pixels.
* *
* @name Phaser.FX.Gradient#toX * @name Phaser.FX.Gradient#toX
* @type {number} * @type {number}
@ -20442,7 +20457,7 @@ var Gradient = new Class({
this.toX = toX; this.toX = toX;
/** /**
* The vertical position the gradient will end. This value is noralized, between 0 and 1 and is not in pixels. * The vertical position the gradient will end. This value is normalized, between 0 and 1 and is not in pixels.
* *
* @name Phaser.FX.Gradient#toY * @name Phaser.FX.Gradient#toY
* @type {number} * @type {number}
@ -21815,22 +21830,19 @@ var GameObject = new Class({
* @method Phaser.GameObjects.GameObject#incData * @method Phaser.GameObjects.GameObject#incData
* @since 3.23.0 * @since 3.23.0
* *
* @generic {any} T * @param {string} key - The key to change the value for.
* @genericUse {(string|T)} - [key] * @param {number} [amount=1] - The amount to increase the given key by. Pass a negative value to decrease the key.
*
* @param {(string|object)} key - The key to increase the value for.
* @param {*} [data] - The value to increase for the given key.
* *
* @return {this} This GameObject. * @return {this} This GameObject.
*/ */
incData: function (key, value) incData: function (key, amount)
{ {
if (!this.data) if (!this.data)
{ {
this.data = new DataManager(this); this.data = new DataManager(this);
} }
this.data.inc(key, value); this.data.inc(key, amount);
return this; return this;
}, },
@ -21848,10 +21860,7 @@ var GameObject = new Class({
* @method Phaser.GameObjects.GameObject#toggleData * @method Phaser.GameObjects.GameObject#toggleData
* @since 3.23.0 * @since 3.23.0
* *
* @generic {any} T * @param {string} key - The key to toggle the value for.
* @genericUse {(string|T)} - [key]
*
* @param {(string|object)} key - The key to toggle the value for.
* *
* @return {this} This GameObject. * @return {this} This GameObject.
*/ */
@ -24163,10 +24172,10 @@ var FX = new Class({
* @param {number} [color1=0xff0000] - The first gradient color, given as a number value. * @param {number} [color1=0xff0000] - The first gradient color, given as a number value.
* @param {number} [color2=0x00ff00] - The second gradient color, given as a number value. * @param {number} [color2=0x00ff00] - The second gradient color, given as a number value.
* @param {number} [alpha=0.2] - The alpha value of the gradient effect. * @param {number} [alpha=0.2] - The alpha value of the gradient effect.
* @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. * @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [fromY=0] - The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. * @param {number} [fromY=0] - The vertical position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toX=0] - The horizontal position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels. * @param {number} [toX=0] - The horizontal position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toY=1] - The vertical position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels. * @param {number} [toY=1] - The vertical position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [size=0] - How many 'chunks' the gradient is divided in to, as spread over the entire height of the texture. Leave this at zero for a smooth gradient, or set higher for a more retro chunky effect. * @param {number} [size=0] - How many 'chunks' the gradient is divided in to, as spread over the entire height of the texture. Leave this at zero for a smooth gradient, or set higher for a more retro chunky effect.
* *
* @return {Phaser.FX.Gradient} The Gradient FX Controller. * @return {Phaser.FX.Gradient} The Gradient FX Controller.
@ -25701,7 +25710,7 @@ var PathFollower = {
{ {
var tween = this.pathTween; var tween = this.pathTween;
if (tween) if (tween && tween.data)
{ {
var tweenData = tween.data[0]; var tweenData = tween.data[0];
var pathDelta = this.pathDelta; var pathDelta = this.pathDelta;
@ -26725,19 +26734,25 @@ var Texture = {
* *
* Textures are referenced by their string-based keys, as stored in the Texture Manager. * Textures are referenced by their string-based keys, as stored in the Texture Manager.
* *
* Calling this method will modify the `width` and `height` properties of your Game Object.
*
* It will also change the `origin` if the Frame has a custom pivot point, as exported from packages like Texture Packer.
*
* @method Phaser.GameObjects.Components.Texture#setTexture * @method Phaser.GameObjects.Components.Texture#setTexture
* @since 3.0.0 * @since 3.0.0
* *
* @param {(string|Phaser.Textures.Texture)} key - The key of the texture to be used, as stored in the Texture Manager, or a Texture instance. * @param {(string|Phaser.Textures.Texture)} key - The key of the texture to be used, as stored in the Texture Manager, or a Texture instance.
* @param {(string|number)} [frame] - The name or index of the frame within the Texture. * @param {(string|number)} [frame] - The name or index of the frame within the Texture.
* @param {boolean} [updateSize=true] - Should this call adjust the size of the Game Object?
* @param {boolean} [updateOrigin=true] - Should this call change the origin of the Game Object?
* *
* @return {this} This Game Object instance. * @return {this} This Game Object instance.
*/ */
setTexture: function (key, frame) setTexture: function (key, frame, updateSize, updateOrigin)
{ {
this.texture = this.scene.sys.textures.get(key); this.texture = this.scene.sys.textures.get(key);
return this.setFrame(frame); return this.setFrame(frame, updateSize, updateOrigin);
}, },
/** /**
@ -27222,7 +27237,7 @@ var Tint = {
/** /**
* The tint value being applied to the whole of the Game Object. * The tint value being applied to the whole of the Game Object.
* This property is a setter-only. Use the properties `tintTopLeft` etc to read the current tint value. * Return `tintTopLeft` when read this tint property.
* *
* @name Phaser.GameObjects.Components.Tint#tint * @name Phaser.GameObjects.Components.Tint#tint
* @type {number} * @type {number}
@ -27231,6 +27246,11 @@ var Tint = {
*/ */
tint: { tint: {
get: function ()
{
return this.tintTopLeft;
},
set: function (value) set: function (value)
{ {
this.setTint(value, value, value, value); this.setTint(value, value, value, value);
@ -28674,9 +28694,7 @@ var TransformMatrix = new Class({
*/ */
setToContext: function (ctx) setToContext: function (ctx)
{ {
var matrix = this.matrix; ctx.setTransform(this);
ctx.setTransform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
return ctx; return ctx;
}, },
@ -28886,13 +28904,14 @@ var TransformMatrix = new Class({
* @param {number} y - The y value. * @param {number} y - The y value.
* @param {number} xw - The xw value. * @param {number} xw - The xw value.
* @param {number} yh - The yh value. * @param {number} yh - The yh value.
* @param {boolean} roundPixels - Pass the results via Math.round? * @param {boolean} [roundPixels=false] - Pass the results via Math.round?
* @param {Float32Array} [quad] - Optional Float32Array to store the results in. Otherwises uses the local quad array. * @param {Float32Array} [quad] - Optional Float32Array to store the results in. Otherwises uses the local quad array.
* *
* @return {Float32Array} The quad Float32Array. * @return {Float32Array} The quad Float32Array.
*/ */
setQuad: function (x, y, xw, yh, roundPixels, quad) setQuad: function (x, y, xw, yh, roundPixels, quad)
{ {
if (roundPixels === undefined) { roundPixels = false; }
if (quad === undefined) { quad = this.quad; } if (quad === undefined) { quad = this.quad; }
var matrix = this.matrix; var matrix = this.matrix;
@ -28904,24 +28923,33 @@ var TransformMatrix = new Class({
var e = matrix[4]; var e = matrix[4];
var f = matrix[5]; var f = matrix[5];
quad[0] = x * a + y * c + e;
quad[1] = x * b + y * d + f;
quad[2] = x * a + yh * c + e;
quad[3] = x * b + yh * d + f;
quad[4] = xw * a + yh * c + e;
quad[5] = xw * b + yh * d + f;
quad[6] = xw * a + y * c + e;
quad[7] = xw * b + y * d + f;
if (roundPixels) if (roundPixels)
{ {
quad.forEach(function (value, index) quad[0] = Math.round(x * a + y * c + e);
{ quad[1] = Math.round(x * b + y * d + f);
quad[index] = Math.round(value);
}); quad[2] = Math.round(x * a + yh * c + e);
quad[3] = Math.round(x * b + yh * d + f);
quad[4] = Math.round(xw * a + yh * c + e);
quad[5] = Math.round(xw * b + yh * d + f);
quad[6] = Math.round(xw * a + y * c + e);
quad[7] = Math.round(xw * b + y * d + f);
}
else
{
quad[0] = x * a + y * c + e;
quad[1] = x * b + y * d + f;
quad[2] = x * a + yh * c + e;
quad[3] = x * b + yh * d + f;
quad[4] = xw * a + yh * c + e;
quad[5] = xw * b + yh * d + f;
quad[6] = xw * a + y * c + e;
quad[7] = xw * b + y * d + f;
} }
return quad; return quad;
@ -31891,6 +31919,28 @@ var Line = new Class({
return this; return this;
}, },
/**
* Sets this Line to match the x/y coordinates of the two given Vector2Like objects.
*
* @method Phaser.Geom.Line#setFromObjects
* @since 3.70.0
*
* @param {Phaser.Types.Math.Vector2Like} start - Any object with public `x` and `y` properties, whose values will be assigned to the x1/y1 components of this Line.
* @param {Phaser.Types.Math.Vector2Like} end - Any object with public `x` and `y` properties, whose values will be assigned to the x2/y2 components of this Line.
*
* @return {this} This Line object.
*/
setFromObjects: function (start, end)
{
this.x1 = start.x;
this.y1 = start.y;
this.x2 = end.x;
this.y2 = end.y;
return this;
},
/** /**
* Returns a Vector2 object that corresponds to the start of this Line. * Returns a Vector2 object that corresponds to the start of this Line.
* *
@ -33784,6 +33834,13 @@ var MultiFile = new Class({
*/ */
this.key = key; this.key = key;
var loadKey = this.key;
if (loader.prefix && loader.prefix !== '')
{
this.key = loader.prefix + loadKey;
}
/** /**
* The current index being used by multi-file loaders to avoid key clashes. * The current index being used by multi-file loaders to avoid key clashes.
* *
@ -34901,8 +34958,11 @@ var ImageFile = new Class({
// We do, but has it loaded? // We do, but has it loaded?
if (linkFile.state >= CONST.FILE_COMPLETE) if (linkFile.state >= CONST.FILE_COMPLETE)
{ {
// Both files have loaded if (linkFile.type === 'spritesheet')
if (this.type === 'normalMap') {
linkFile.addToCache();
}
else if (this.type === 'normalMap')
{ {
// linkFile.data = Image // linkFile.data = Image
// this.data = Normal Map // this.data = Normal Map
@ -35013,7 +35073,7 @@ var ImageFile = new Class({
* It is available in the default build but can be excluded from custom builds. * It is available in the default build but can be excluded from custom builds.
* *
* @method Phaser.Loader.LoaderPlugin#image * @method Phaser.Loader.LoaderPlugin#image
* @fires Phaser.Loader.LoaderPlugin#ADD * @fires Phaser.Loader.Events#ADD
* @since 3.0.0 * @since 3.0.0
* *
* @param {(string|Phaser.Types.Loader.FileTypes.ImageFileConfig|Phaser.Types.Loader.FileTypes.ImageFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {(string|Phaser.Types.Loader.FileTypes.ImageFileConfig|Phaser.Types.Loader.FileTypes.ImageFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them.
@ -35252,7 +35312,7 @@ var JSONFile = new Class({
* It is available in the default build but can be excluded from custom builds. * It is available in the default build but can be excluded from custom builds.
* *
* @method Phaser.Loader.LoaderPlugin#json * @method Phaser.Loader.LoaderPlugin#json
* @fires Phaser.Loader.LoaderPlugin#ADD * @fires Phaser.Loader.Events#ADD
* @since 3.0.0 * @since 3.0.0
* *
* @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig|Phaser.Types.Loader.FileTypes.JSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig|Phaser.Types.Loader.FileTypes.JSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them.
@ -35433,7 +35493,7 @@ var TextFile = new Class({
* It is available in the default build but can be excluded from custom builds. * It is available in the default build but can be excluded from custom builds.
* *
* @method Phaser.Loader.LoaderPlugin#text * @method Phaser.Loader.LoaderPlugin#text
* @fires Phaser.Loader.LoaderPlugin#ADD * @fires Phaser.Loader.Events#ADD
* @since 3.0.0 * @since 3.0.0
* *
* @param {(string|Phaser.Types.Loader.FileTypes.TextFileConfig|Phaser.Types.Loader.FileTypes.TextFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {(string|Phaser.Types.Loader.FileTypes.TextFileConfig|Phaser.Types.Loader.FileTypes.TextFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them.
@ -43057,12 +43117,6 @@ module.exports = Within;
*/ */
var Wrap = function (value, min, max) var Wrap = function (value, min, max)
{ {
if (value >= min && value <= max)
{
// Skip modulo if already in range
return value;
}
var range = max - min; var range = max - min;
return (min + ((((value - min) % range) + range) % range)); return (min + ((((value - min) % range) + range) % range));
@ -46629,7 +46683,7 @@ var RandomDataGenerator = new Class({
*/ */
weightedPick: function (array) weightedPick: function (array)
{ {
return array[~~(Math.pow(this.frac(), 2) * (array.length - 1) + 0.5)]; return array[~~(Math.pow(this.frac(), 2) * array.length + 0.5)];
}, },
/** /**
@ -48934,6 +48988,14 @@ var Frame = new Class({
y: 0, y: 0,
width: 0, width: 0,
height: 0 height: 0
},
is3Slice: false,
scale9: false,
scale9Borders: {
x: 0,
y: 0,
w: 0,
h: 0
} }
}; };
@ -49053,6 +49115,38 @@ var Frame = new Class({
return this.updateUVs(); return this.updateUVs();
}, },
/**
* Sets the scale9 center rectangle values.
*
* Scale9 is a feature of Texture Packer, allowing you to define a nine-slice scaling grid.
*
* This is set automatically by the JSONArray and JSONHash parsers.
*
* @method Phaser.Textures.Frame#setScale9
* @since 3.70.0
*
* @param {number} x - The left coordinate of the center scale9 rectangle.
* @param {number} y - The top coordinate of the center scale9 rectangle.
* @param {number} width - The width of the center scale9 rectangle.
* @param {number} height - The height coordinate of the center scale9 rectangle.
*
* @return {this} This Frame object.
*/
setScale9: function (x, y, width, height)
{
var data = this.data;
data.scale9 = true;
data.is3Slice = (y === 0 && height === this.height);
data.scale9Borders.x = x;
data.scale9Borders.y = y;
data.scale9Borders.w = width;
data.scale9Borders.h = height;
return this;
},
/** /**
* Takes a crop data object and, based on the rectangular region given, calculates the * Takes a crop data object and, based on the rectangular region given, calculates the
* required UV coordinates in order to crop this Frame for WebGL and Canvas rendering. * required UV coordinates in order to crop this Frame for WebGL and Canvas rendering.
@ -49354,8 +49448,8 @@ var Frame = new Class({
*/ */
destroy: function () destroy: function ()
{ {
this.source = null;
this.texture = null; this.texture = null;
this.source = null;
this.glTexture = null; this.glTexture = null;
this.customData = null; this.customData = null;
this.data = null; this.data = null;
@ -49431,6 +49525,40 @@ var Frame = new Class({
}, },
/**
* Does the Frame have scale9 border data?
*
* @name Phaser.Textures.Frame#scale9
* @type {boolean}
* @readonly
* @since 3.70.0
*/
scale9: {
get: function ()
{
return this.data.scale9;
}
},
/**
* If the Frame has scale9 border data, is it 3-slice or 9-slice data?
*
* @name Phaser.Textures.Frame#is3Slice
* @type {boolean}
* @readonly
* @since 3.70.0
*/
is3Slice: {
get: function ()
{
return this.data.is3Slice;
}
},
/** /**
* The Canvas drawImage data object. * The Canvas drawImage data object.
* *
@ -50712,11 +50840,15 @@ module.exports = GetFirst;
* @function Phaser.Utils.Array.GetRandom * @function Phaser.Utils.Array.GetRandom
* @since 3.0.0 * @since 3.0.0
* *
* @param {array} array - The array to select the random entry from. * @generic T
* @genericUse {T[]} - [array]
* @genericUse {T} - [$return]
*
* @param {T[]} array - The array to select the random entry from.
* @param {number} [startIndex=0] - An optional start index. * @param {number} [startIndex=0] - An optional start index.
* @param {number} [length=array.length] - An optional length, the total number of elements (from the startIndex) to choose from. * @param {number} [length=array.length] - An optional length, the total number of elements (from the startIndex) to choose from.
* *
* @return {*} A random element from the array, or `null` if no element could be found in the range given. * @return {T} A random element from the array, or `null` if no element could be found in the range given.
*/ */
var GetRandom = function (array, startIndex, length) var GetRandom = function (array, startIndex, length)
{ {
@ -52711,12 +52843,20 @@ var RotateMatrix = __webpack_require__(7116);
* @genericUse {T[][]} - [matrix,$return] * @genericUse {T[][]} - [matrix,$return]
* *
* @param {T[][]} [matrix] - The array to rotate. * @param {T[][]} [matrix] - The array to rotate.
* @param {number} [amount=1] - The number of times to rotate the matrix.
* *
* @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix. * @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix.
*/ */
var RotateLeft = function (matrix) var RotateLeft = function (matrix, amount)
{ {
return RotateMatrix(matrix, 90); if (amount === undefined) { amount = 1; }
for (var i = 0; i < amount; i++)
{
matrix = RotateMatrix(matrix, 90);
}
return matrix;
}; };
module.exports = RotateLeft; module.exports = RotateLeft;
@ -52846,12 +52986,20 @@ var RotateMatrix = __webpack_require__(7116);
* @genericUse {T[][]} - [matrix,$return] * @genericUse {T[][]} - [matrix,$return]
* *
* @param {T[][]} [matrix] - The array to rotate. * @param {T[][]} [matrix] - The array to rotate.
* @param {number} [amount=1] - The number of times to rotate the matrix.
* *
* @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix. * @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix.
*/ */
var RotateRight = function (matrix) var RotateRight = function (matrix, amount)
{ {
return RotateMatrix(matrix, -90); if (amount === undefined) { amount = 1; }
for (var i = 0; i < amount; i++)
{
matrix = RotateMatrix(matrix, -90);
}
return matrix;
}; };
module.exports = RotateRight; module.exports = RotateRight;
@ -53212,7 +53360,7 @@ var GetValue = __webpack_require__(5851);
* *
* Allowed types: * Allowed types:
* *
* Implicit * Explicit:
* { * {
* x: 4 * x: 4
* } * }

File diff suppressed because one or more lines are too long

View file

@ -11839,7 +11839,7 @@ var SpinePlugin = new Class({
* Note: The ability to load this type of file will only be available if the Spine Plugin has been built or loaded into Phaser. * Note: The ability to load this type of file will only be available if the Spine Plugin has been built or loaded into Phaser.
* *
* @method Phaser.Loader.LoaderPlugin#spine * @method Phaser.Loader.LoaderPlugin#spine
* @fires Phaser.Loader.LoaderPlugin#ADD * @fires Phaser.Loader.Events#ADD
* @since 3.19.0 * @since 3.19.0
* *
* @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig|Phaser.Types.Loader.FileTypes.JSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig|Phaser.Types.Loader.FileTypes.JSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them.
@ -13351,7 +13351,7 @@ var SpineGameObject = new Class({
*/ */
setSkeletonFromJSON: function (atlasDataKey, skeletonJSON, animationName, loop) setSkeletonFromJSON: function (atlasDataKey, skeletonJSON, animationName, loop)
{ {
return this.setSkeleton(atlasDataKey, skeletonJSON, animationName, loop); return this.setSkeleton(atlasDataKey, animationName, loop, skeletonJSON);
}, },
/** /**
@ -14810,7 +14810,7 @@ var CONST = {
* @type {string} * @type {string}
* @since 3.0.0 * @since 3.0.0
*/ */
VERSION: '3.60.0', VERSION: '3.70.0',
BlendModes: __webpack_require__(8351), BlendModes: __webpack_require__(8351),
@ -15228,24 +15228,21 @@ var DataManager = new Class({
* @fires Phaser.Data.Events#CHANGE_DATA_KEY * @fires Phaser.Data.Events#CHANGE_DATA_KEY
* @since 3.23.0 * @since 3.23.0
* *
* @generic {any} T * @param {string} key - The key to change the value for.
* @genericUse {(string|T)} - [key] * @param {number} [amount=1] - The amount to increase the given key by. Pass a negative value to decrease the key.
*
* @param {(string|object)} key - The key to increase the value for.
* @param {number} [data=1] - The amount to increase the given key by. Pass a negative value to decrease the key.
* *
* @return {this} This Data Manager instance. * @return {this} This Data Manager instance.
*/ */
inc: function (key, data) inc: function (key, amount)
{ {
if (this._frozen) if (this._frozen)
{ {
return this; return this;
} }
if (data === undefined) if (amount === undefined)
{ {
data = 1; amount = 1;
} }
var value = this.get(key); var value = this.get(key);
@ -15255,7 +15252,7 @@ var DataManager = new Class({
value = 0; value = 0;
} }
this.set(key, (value + data)); this.set(key, (value + amount));
return this; return this;
}, },
@ -15271,10 +15268,7 @@ var DataManager = new Class({
* @fires Phaser.Data.Events#CHANGE_DATA_KEY * @fires Phaser.Data.Events#CHANGE_DATA_KEY
* @since 3.23.0 * @since 3.23.0
* *
* @generic {any} T * @param {string} key - The key to toggle the value for.
* @genericUse {(string|T)} - [key]
*
* @param {(string|object)} key - The key to toggle the value for.
* *
* @return {this} This Data Manager instance. * @return {this} This Data Manager instance.
*/ */
@ -16034,6 +16028,7 @@ function init ()
else if ((/AppleWebKit/).test(ua) && OS.iOS) else if ((/AppleWebKit/).test(ua) && OS.iOS)
{ {
Browser.mobileSafari = true; Browser.mobileSafari = true;
Browser.es2019 = true;
} }
else if ((/MSIE (\d+\.\d+);/).test(ua)) else if ((/MSIE (\d+\.\d+);/).test(ua))
{ {
@ -18941,7 +18936,7 @@ var Blur = new Class({
* @type {number} * @type {number}
* @since 3.60.0 * @since 3.60.0
*/ */
this.quality = 0; this.quality = quality;
/** /**
* The horizontal offset of the blur effect. * The horizontal offset of the blur effect.
@ -19367,8 +19362,28 @@ var Circle = new Class({
color[2] = (value & 0xFF) / 255; color[2] = (value & 0xFF) / 255;
} }
} },
/**
* The alpha of the background, behind the texture, given as a number value.
*
* @name Phaser.FX.Circle#backgroundAlpha
* @type {number}
* @since 3.70.0
*/
backgroundAlpha: {
get: function ()
{
return this.glcolor2[3];
},
set: function (value)
{
this.glcolor2[3] = value;
}
}
}); });
module.exports = Circle; module.exports = Circle;
@ -19871,10 +19886,10 @@ var FX_CONST = __webpack_require__(1571);
* @param {number} [color1=0xff0000] - The first gradient color, given as a number value. * @param {number} [color1=0xff0000] - The first gradient color, given as a number value.
* @param {number} [color2=0x00ff00] - The second gradient color, given as a number value. * @param {number} [color2=0x00ff00] - The second gradient color, given as a number value.
* @param {number} [alpha=0.2] - The alpha value of the gradient effect. * @param {number} [alpha=0.2] - The alpha value of the gradient effect.
* @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. * @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [fromY=0] - The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. * @param {number} [fromY=0] - The vertical position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toX=0] - The horizontal position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels. * @param {number} [toX=0] - The horizontal position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toY=1] - The vertical position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels. * @param {number} [toY=1] - The vertical position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [size=0] - How many 'chunks' the gradient is divided in to, as spread over the entire height of the texture. Leave this at zero for a smooth gradient, or set higher for a more retro chunky effect. * @param {number} [size=0] - How many 'chunks' the gradient is divided in to, as spread over the entire height of the texture. Leave this at zero for a smooth gradient, or set higher for a more retro chunky effect.
*/ */
var Gradient = new Class({ var Gradient = new Class({
@ -19916,7 +19931,7 @@ var Gradient = new Class({
this.size = size; this.size = size;
/** /**
* The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. * The horizontal position the gradient will start from. This value is normalized, between 0 and 1 and is not in pixels.
* *
* @name Phaser.FX.Gradient#fromX * @name Phaser.FX.Gradient#fromX
* @type {number} * @type {number}
@ -19925,7 +19940,7 @@ var Gradient = new Class({
this.fromX = fromX; this.fromX = fromX;
/** /**
* The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. * The vertical position the gradient will start from. This value is normalized, between 0 and 1 and is not in pixels.
* *
* @name Phaser.FX.Gradient#fromY * @name Phaser.FX.Gradient#fromY
* @type {number} * @type {number}
@ -19934,7 +19949,7 @@ var Gradient = new Class({
this.fromY = fromY; this.fromY = fromY;
/** /**
* The horizontal position the gradient will end. This value is noralized, between 0 and 1 and is not in pixels. * The horizontal position the gradient will end. This value is normalized, between 0 and 1 and is not in pixels.
* *
* @name Phaser.FX.Gradient#toX * @name Phaser.FX.Gradient#toX
* @type {number} * @type {number}
@ -19943,7 +19958,7 @@ var Gradient = new Class({
this.toX = toX; this.toX = toX;
/** /**
* The vertical position the gradient will end. This value is noralized, between 0 and 1 and is not in pixels. * The vertical position the gradient will end. This value is normalized, between 0 and 1 and is not in pixels.
* *
* @name Phaser.FX.Gradient#toY * @name Phaser.FX.Gradient#toY
* @type {number} * @type {number}
@ -21316,22 +21331,19 @@ var GameObject = new Class({
* @method Phaser.GameObjects.GameObject#incData * @method Phaser.GameObjects.GameObject#incData
* @since 3.23.0 * @since 3.23.0
* *
* @generic {any} T * @param {string} key - The key to change the value for.
* @genericUse {(string|T)} - [key] * @param {number} [amount=1] - The amount to increase the given key by. Pass a negative value to decrease the key.
*
* @param {(string|object)} key - The key to increase the value for.
* @param {*} [data] - The value to increase for the given key.
* *
* @return {this} This GameObject. * @return {this} This GameObject.
*/ */
incData: function (key, value) incData: function (key, amount)
{ {
if (!this.data) if (!this.data)
{ {
this.data = new DataManager(this); this.data = new DataManager(this);
} }
this.data.inc(key, value); this.data.inc(key, amount);
return this; return this;
}, },
@ -21349,10 +21361,7 @@ var GameObject = new Class({
* @method Phaser.GameObjects.GameObject#toggleData * @method Phaser.GameObjects.GameObject#toggleData
* @since 3.23.0 * @since 3.23.0
* *
* @generic {any} T * @param {string} key - The key to toggle the value for.
* @genericUse {(string|T)} - [key]
*
* @param {(string|object)} key - The key to toggle the value for.
* *
* @return {this} This GameObject. * @return {this} This GameObject.
*/ */
@ -23664,10 +23673,10 @@ var FX = new Class({
* @param {number} [color1=0xff0000] - The first gradient color, given as a number value. * @param {number} [color1=0xff0000] - The first gradient color, given as a number value.
* @param {number} [color2=0x00ff00] - The second gradient color, given as a number value. * @param {number} [color2=0x00ff00] - The second gradient color, given as a number value.
* @param {number} [alpha=0.2] - The alpha value of the gradient effect. * @param {number} [alpha=0.2] - The alpha value of the gradient effect.
* @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. * @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [fromY=0] - The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. * @param {number} [fromY=0] - The vertical position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toX=0] - The horizontal position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels. * @param {number} [toX=0] - The horizontal position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toY=1] - The vertical position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels. * @param {number} [toY=1] - The vertical position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [size=0] - How many 'chunks' the gradient is divided in to, as spread over the entire height of the texture. Leave this at zero for a smooth gradient, or set higher for a more retro chunky effect. * @param {number} [size=0] - How many 'chunks' the gradient is divided in to, as spread over the entire height of the texture. Leave this at zero for a smooth gradient, or set higher for a more retro chunky effect.
* *
* @return {Phaser.FX.Gradient} The Gradient FX Controller. * @return {Phaser.FX.Gradient} The Gradient FX Controller.
@ -25202,7 +25211,7 @@ var PathFollower = {
{ {
var tween = this.pathTween; var tween = this.pathTween;
if (tween) if (tween && tween.data)
{ {
var tweenData = tween.data[0]; var tweenData = tween.data[0];
var pathDelta = this.pathDelta; var pathDelta = this.pathDelta;
@ -26226,19 +26235,25 @@ var Texture = {
* *
* Textures are referenced by their string-based keys, as stored in the Texture Manager. * Textures are referenced by their string-based keys, as stored in the Texture Manager.
* *
* Calling this method will modify the `width` and `height` properties of your Game Object.
*
* It will also change the `origin` if the Frame has a custom pivot point, as exported from packages like Texture Packer.
*
* @method Phaser.GameObjects.Components.Texture#setTexture * @method Phaser.GameObjects.Components.Texture#setTexture
* @since 3.0.0 * @since 3.0.0
* *
* @param {(string|Phaser.Textures.Texture)} key - The key of the texture to be used, as stored in the Texture Manager, or a Texture instance. * @param {(string|Phaser.Textures.Texture)} key - The key of the texture to be used, as stored in the Texture Manager, or a Texture instance.
* @param {(string|number)} [frame] - The name or index of the frame within the Texture. * @param {(string|number)} [frame] - The name or index of the frame within the Texture.
* @param {boolean} [updateSize=true] - Should this call adjust the size of the Game Object?
* @param {boolean} [updateOrigin=true] - Should this call change the origin of the Game Object?
* *
* @return {this} This Game Object instance. * @return {this} This Game Object instance.
*/ */
setTexture: function (key, frame) setTexture: function (key, frame, updateSize, updateOrigin)
{ {
this.texture = this.scene.sys.textures.get(key); this.texture = this.scene.sys.textures.get(key);
return this.setFrame(frame); return this.setFrame(frame, updateSize, updateOrigin);
}, },
/** /**
@ -26723,7 +26738,7 @@ var Tint = {
/** /**
* The tint value being applied to the whole of the Game Object. * The tint value being applied to the whole of the Game Object.
* This property is a setter-only. Use the properties `tintTopLeft` etc to read the current tint value. * Return `tintTopLeft` when read this tint property.
* *
* @name Phaser.GameObjects.Components.Tint#tint * @name Phaser.GameObjects.Components.Tint#tint
* @type {number} * @type {number}
@ -26732,6 +26747,11 @@ var Tint = {
*/ */
tint: { tint: {
get: function ()
{
return this.tintTopLeft;
},
set: function (value) set: function (value)
{ {
this.setTint(value, value, value, value); this.setTint(value, value, value, value);
@ -28175,9 +28195,7 @@ var TransformMatrix = new Class({
*/ */
setToContext: function (ctx) setToContext: function (ctx)
{ {
var matrix = this.matrix; ctx.setTransform(this);
ctx.setTransform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
return ctx; return ctx;
}, },
@ -28387,13 +28405,14 @@ var TransformMatrix = new Class({
* @param {number} y - The y value. * @param {number} y - The y value.
* @param {number} xw - The xw value. * @param {number} xw - The xw value.
* @param {number} yh - The yh value. * @param {number} yh - The yh value.
* @param {boolean} roundPixels - Pass the results via Math.round? * @param {boolean} [roundPixels=false] - Pass the results via Math.round?
* @param {Float32Array} [quad] - Optional Float32Array to store the results in. Otherwises uses the local quad array. * @param {Float32Array} [quad] - Optional Float32Array to store the results in. Otherwises uses the local quad array.
* *
* @return {Float32Array} The quad Float32Array. * @return {Float32Array} The quad Float32Array.
*/ */
setQuad: function (x, y, xw, yh, roundPixels, quad) setQuad: function (x, y, xw, yh, roundPixels, quad)
{ {
if (roundPixels === undefined) { roundPixels = false; }
if (quad === undefined) { quad = this.quad; } if (quad === undefined) { quad = this.quad; }
var matrix = this.matrix; var matrix = this.matrix;
@ -28405,24 +28424,33 @@ var TransformMatrix = new Class({
var e = matrix[4]; var e = matrix[4];
var f = matrix[5]; var f = matrix[5];
quad[0] = x * a + y * c + e;
quad[1] = x * b + y * d + f;
quad[2] = x * a + yh * c + e;
quad[3] = x * b + yh * d + f;
quad[4] = xw * a + yh * c + e;
quad[5] = xw * b + yh * d + f;
quad[6] = xw * a + y * c + e;
quad[7] = xw * b + y * d + f;
if (roundPixels) if (roundPixels)
{ {
quad.forEach(function (value, index) quad[0] = Math.round(x * a + y * c + e);
{ quad[1] = Math.round(x * b + y * d + f);
quad[index] = Math.round(value);
}); quad[2] = Math.round(x * a + yh * c + e);
quad[3] = Math.round(x * b + yh * d + f);
quad[4] = Math.round(xw * a + yh * c + e);
quad[5] = Math.round(xw * b + yh * d + f);
quad[6] = Math.round(xw * a + y * c + e);
quad[7] = Math.round(xw * b + y * d + f);
}
else
{
quad[0] = x * a + y * c + e;
quad[1] = x * b + y * d + f;
quad[2] = x * a + yh * c + e;
quad[3] = x * b + yh * d + f;
quad[4] = xw * a + yh * c + e;
quad[5] = xw * b + yh * d + f;
quad[6] = xw * a + y * c + e;
quad[7] = xw * b + y * d + f;
} }
return quad; return quad;
@ -31281,6 +31309,28 @@ var Line = new Class({
return this; return this;
}, },
/**
* Sets this Line to match the x/y coordinates of the two given Vector2Like objects.
*
* @method Phaser.Geom.Line#setFromObjects
* @since 3.70.0
*
* @param {Phaser.Types.Math.Vector2Like} start - Any object with public `x` and `y` properties, whose values will be assigned to the x1/y1 components of this Line.
* @param {Phaser.Types.Math.Vector2Like} end - Any object with public `x` and `y` properties, whose values will be assigned to the x2/y2 components of this Line.
*
* @return {this} This Line object.
*/
setFromObjects: function (start, end)
{
this.x1 = start.x;
this.y1 = start.y;
this.x2 = end.x;
this.y2 = end.y;
return this;
},
/** /**
* Returns a Vector2 object that corresponds to the start of this Line. * Returns a Vector2 object that corresponds to the start of this Line.
* *
@ -33174,6 +33224,13 @@ var MultiFile = new Class({
*/ */
this.key = key; this.key = key;
var loadKey = this.key;
if (loader.prefix && loader.prefix !== '')
{
this.key = loader.prefix + loadKey;
}
/** /**
* The current index being used by multi-file loaders to avoid key clashes. * The current index being used by multi-file loaders to avoid key clashes.
* *
@ -34291,8 +34348,11 @@ var ImageFile = new Class({
// We do, but has it loaded? // We do, but has it loaded?
if (linkFile.state >= CONST.FILE_COMPLETE) if (linkFile.state >= CONST.FILE_COMPLETE)
{ {
// Both files have loaded if (linkFile.type === 'spritesheet')
if (this.type === 'normalMap') {
linkFile.addToCache();
}
else if (this.type === 'normalMap')
{ {
// linkFile.data = Image // linkFile.data = Image
// this.data = Normal Map // this.data = Normal Map
@ -34403,7 +34463,7 @@ var ImageFile = new Class({
* It is available in the default build but can be excluded from custom builds. * It is available in the default build but can be excluded from custom builds.
* *
* @method Phaser.Loader.LoaderPlugin#image * @method Phaser.Loader.LoaderPlugin#image
* @fires Phaser.Loader.LoaderPlugin#ADD * @fires Phaser.Loader.Events#ADD
* @since 3.0.0 * @since 3.0.0
* *
* @param {(string|Phaser.Types.Loader.FileTypes.ImageFileConfig|Phaser.Types.Loader.FileTypes.ImageFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {(string|Phaser.Types.Loader.FileTypes.ImageFileConfig|Phaser.Types.Loader.FileTypes.ImageFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them.
@ -34642,7 +34702,7 @@ var JSONFile = new Class({
* It is available in the default build but can be excluded from custom builds. * It is available in the default build but can be excluded from custom builds.
* *
* @method Phaser.Loader.LoaderPlugin#json * @method Phaser.Loader.LoaderPlugin#json
* @fires Phaser.Loader.LoaderPlugin#ADD * @fires Phaser.Loader.Events#ADD
* @since 3.0.0 * @since 3.0.0
* *
* @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig|Phaser.Types.Loader.FileTypes.JSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {(string|Phaser.Types.Loader.FileTypes.JSONFileConfig|Phaser.Types.Loader.FileTypes.JSONFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them.
@ -34823,7 +34883,7 @@ var TextFile = new Class({
* It is available in the default build but can be excluded from custom builds. * It is available in the default build but can be excluded from custom builds.
* *
* @method Phaser.Loader.LoaderPlugin#text * @method Phaser.Loader.LoaderPlugin#text
* @fires Phaser.Loader.LoaderPlugin#ADD * @fires Phaser.Loader.Events#ADD
* @since 3.0.0 * @since 3.0.0
* *
* @param {(string|Phaser.Types.Loader.FileTypes.TextFileConfig|Phaser.Types.Loader.FileTypes.TextFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them. * @param {(string|Phaser.Types.Loader.FileTypes.TextFileConfig|Phaser.Types.Loader.FileTypes.TextFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them.
@ -42447,12 +42507,6 @@ module.exports = Within;
*/ */
var Wrap = function (value, min, max) var Wrap = function (value, min, max)
{ {
if (value >= min && value <= max)
{
// Skip modulo if already in range
return value;
}
var range = max - min; var range = max - min;
return (min + ((((value - min) % range) + range) % range)); return (min + ((((value - min) % range) + range) % range));
@ -46019,7 +46073,7 @@ var RandomDataGenerator = new Class({
*/ */
weightedPick: function (array) weightedPick: function (array)
{ {
return array[~~(Math.pow(this.frac(), 2) * (array.length - 1) + 0.5)]; return array[~~(Math.pow(this.frac(), 2) * array.length + 0.5)];
}, },
/** /**
@ -48324,6 +48378,14 @@ var Frame = new Class({
y: 0, y: 0,
width: 0, width: 0,
height: 0 height: 0
},
is3Slice: false,
scale9: false,
scale9Borders: {
x: 0,
y: 0,
w: 0,
h: 0
} }
}; };
@ -48443,6 +48505,38 @@ var Frame = new Class({
return this.updateUVs(); return this.updateUVs();
}, },
/**
* Sets the scale9 center rectangle values.
*
* Scale9 is a feature of Texture Packer, allowing you to define a nine-slice scaling grid.
*
* This is set automatically by the JSONArray and JSONHash parsers.
*
* @method Phaser.Textures.Frame#setScale9
* @since 3.70.0
*
* @param {number} x - The left coordinate of the center scale9 rectangle.
* @param {number} y - The top coordinate of the center scale9 rectangle.
* @param {number} width - The width of the center scale9 rectangle.
* @param {number} height - The height coordinate of the center scale9 rectangle.
*
* @return {this} This Frame object.
*/
setScale9: function (x, y, width, height)
{
var data = this.data;
data.scale9 = true;
data.is3Slice = (y === 0 && height === this.height);
data.scale9Borders.x = x;
data.scale9Borders.y = y;
data.scale9Borders.w = width;
data.scale9Borders.h = height;
return this;
},
/** /**
* Takes a crop data object and, based on the rectangular region given, calculates the * Takes a crop data object and, based on the rectangular region given, calculates the
* required UV coordinates in order to crop this Frame for WebGL and Canvas rendering. * required UV coordinates in order to crop this Frame for WebGL and Canvas rendering.
@ -48744,8 +48838,8 @@ var Frame = new Class({
*/ */
destroy: function () destroy: function ()
{ {
this.source = null;
this.texture = null; this.texture = null;
this.source = null;
this.glTexture = null; this.glTexture = null;
this.customData = null; this.customData = null;
this.data = null; this.data = null;
@ -48821,6 +48915,40 @@ var Frame = new Class({
}, },
/**
* Does the Frame have scale9 border data?
*
* @name Phaser.Textures.Frame#scale9
* @type {boolean}
* @readonly
* @since 3.70.0
*/
scale9: {
get: function ()
{
return this.data.scale9;
}
},
/**
* If the Frame has scale9 border data, is it 3-slice or 9-slice data?
*
* @name Phaser.Textures.Frame#is3Slice
* @type {boolean}
* @readonly
* @since 3.70.0
*/
is3Slice: {
get: function ()
{
return this.data.is3Slice;
}
},
/** /**
* The Canvas drawImage data object. * The Canvas drawImage data object.
* *
@ -50102,11 +50230,15 @@ module.exports = GetFirst;
* @function Phaser.Utils.Array.GetRandom * @function Phaser.Utils.Array.GetRandom
* @since 3.0.0 * @since 3.0.0
* *
* @param {array} array - The array to select the random entry from. * @generic T
* @genericUse {T[]} - [array]
* @genericUse {T} - [$return]
*
* @param {T[]} array - The array to select the random entry from.
* @param {number} [startIndex=0] - An optional start index. * @param {number} [startIndex=0] - An optional start index.
* @param {number} [length=array.length] - An optional length, the total number of elements (from the startIndex) to choose from. * @param {number} [length=array.length] - An optional length, the total number of elements (from the startIndex) to choose from.
* *
* @return {*} A random element from the array, or `null` if no element could be found in the range given. * @return {T} A random element from the array, or `null` if no element could be found in the range given.
*/ */
var GetRandom = function (array, startIndex, length) var GetRandom = function (array, startIndex, length)
{ {
@ -52101,12 +52233,20 @@ var RotateMatrix = __webpack_require__(7116);
* @genericUse {T[][]} - [matrix,$return] * @genericUse {T[][]} - [matrix,$return]
* *
* @param {T[][]} [matrix] - The array to rotate. * @param {T[][]} [matrix] - The array to rotate.
* @param {number} [amount=1] - The number of times to rotate the matrix.
* *
* @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix. * @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix.
*/ */
var RotateLeft = function (matrix) var RotateLeft = function (matrix, amount)
{ {
return RotateMatrix(matrix, 90); if (amount === undefined) { amount = 1; }
for (var i = 0; i < amount; i++)
{
matrix = RotateMatrix(matrix, 90);
}
return matrix;
}; };
module.exports = RotateLeft; module.exports = RotateLeft;
@ -52236,12 +52376,20 @@ var RotateMatrix = __webpack_require__(7116);
* @genericUse {T[][]} - [matrix,$return] * @genericUse {T[][]} - [matrix,$return]
* *
* @param {T[][]} [matrix] - The array to rotate. * @param {T[][]} [matrix] - The array to rotate.
* @param {number} [amount=1] - The number of times to rotate the matrix.
* *
* @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix. * @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix.
*/ */
var RotateRight = function (matrix) var RotateRight = function (matrix, amount)
{ {
return RotateMatrix(matrix, -90); if (amount === undefined) { amount = 1; }
for (var i = 0; i < amount; i++)
{
matrix = RotateMatrix(matrix, -90);
}
return matrix;
}; };
module.exports = RotateRight; module.exports = RotateRight;
@ -52602,7 +52750,7 @@ var GetValue = __webpack_require__(5851);
* *
* Allowed types: * Allowed types:
* *
* Implicit * Explicit:
* { * {
* x: 4 * x: 4
* } * }

File diff suppressed because one or more lines are too long