Spine 4 Plugin dist for v3.70.0

This commit is contained in:
Richard Davey 2023-11-10 15:34:27 +00:00
parent 2aeaa4d0f2
commit 9d6f5af89c
6 changed files with 699 additions and 255 deletions

View file

@ -10790,7 +10790,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.
@ -13599,7 +13599,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),
@ -14017,24 +14017,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);
@ -14044,7 +14041,7 @@ var DataManager = new Class({
value = 0; value = 0;
} }
this.set(key, (value + data)); this.set(key, (value + amount));
return this; return this;
}, },
@ -14060,10 +14057,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.
*/ */
@ -14823,6 +14817,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))
{ {
@ -17730,7 +17725,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.
@ -18156,8 +18151,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;
@ -18660,10 +18675,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({
@ -18705,7 +18720,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}
@ -18714,7 +18729,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}
@ -18723,7 +18738,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}
@ -18732,7 +18747,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}
@ -20105,22 +20120,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;
}, },
@ -20138,10 +20150,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.
*/ */
@ -22381,10 +22390,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.
@ -23919,7 +23928,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;
@ -24943,19 +24952,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);
}, },
/** /**
@ -25440,7 +25455,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}
@ -25449,6 +25464,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);
@ -26892,9 +26912,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;
}, },
@ -27104,13 +27122,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;
@ -27122,24 +27141,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;
@ -29954,6 +29982,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.
* *
@ -31847,6 +31897,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.
* *
@ -32964,8 +33021,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
@ -33076,7 +33136,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.
@ -33315,7 +33375,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.
@ -33496,7 +33556,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.
@ -41120,12 +41180,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));
@ -44692,7 +44746,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)];
}, },
/** /**
@ -46997,6 +47051,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
} }
}; };
@ -47116,6 +47178,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.
@ -47417,8 +47511,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;
@ -47494,6 +47588,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.
* *
@ -48775,11 +48903,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)
{ {
@ -50774,12 +50906,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;
@ -50909,12 +51049,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;
@ -51275,7 +51423,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

@ -22828,7 +22828,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.
@ -26055,7 +26055,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),
@ -26473,24 +26473,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);
@ -26500,7 +26497,7 @@ var DataManager = new Class({
value = 0; value = 0;
} }
this.set(key, (value + data)); this.set(key, (value + amount));
return this; return this;
}, },
@ -26516,10 +26513,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.
*/ */
@ -27279,6 +27273,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))
{ {
@ -30186,7 +30181,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.
@ -30612,8 +30607,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;
@ -31116,10 +31131,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({
@ -31161,7 +31176,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}
@ -31170,7 +31185,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}
@ -31179,7 +31194,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}
@ -31188,7 +31203,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}
@ -32561,22 +32576,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;
}, },
@ -32594,10 +32606,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.
*/ */
@ -34909,10 +34918,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.
@ -36447,7 +36456,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;
@ -37471,19 +37480,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);
}, },
/** /**
@ -37968,7 +37983,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}
@ -37977,6 +37992,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);
@ -39420,9 +39440,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;
}, },
@ -39632,13 +39650,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;
@ -39650,24 +39669,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;
@ -42637,6 +42665,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.
* *
@ -44530,6 +44580,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.
* *
@ -45647,8 +45704,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
@ -45759,7 +45819,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.
@ -45998,7 +46058,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.
@ -46179,7 +46239,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.
@ -53803,12 +53863,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));
@ -57375,7 +57429,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)];
}, },
/** /**
@ -59680,6 +59734,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
} }
}; };
@ -59799,6 +59861,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.
@ -60100,8 +60194,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;
@ -60177,6 +60271,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.
* *
@ -61458,11 +61586,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)
{ {
@ -63457,12 +63589,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;
@ -63592,12 +63732,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;
@ -63958,7 +64106,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

@ -13277,7 +13277,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.
@ -16269,7 +16269,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),
@ -16687,24 +16687,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);
@ -16714,7 +16711,7 @@ var DataManager = new Class({
value = 0; value = 0;
} }
this.set(key, (value + data)); this.set(key, (value + amount));
return this; return this;
}, },
@ -16730,10 +16727,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.
*/ */
@ -17493,6 +17487,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))
{ {
@ -20400,7 +20395,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.
@ -20826,8 +20821,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;
@ -21330,10 +21345,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({
@ -21375,7 +21390,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}
@ -21384,7 +21399,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}
@ -21393,7 +21408,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}
@ -21402,7 +21417,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}
@ -22775,22 +22790,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;
}, },
@ -22808,10 +22820,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.
*/ */
@ -25123,10 +25132,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.
@ -26661,7 +26670,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;
@ -27685,19 +27694,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);
}, },
/** /**
@ -28182,7 +28197,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}
@ -28191,6 +28206,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);
@ -29634,9 +29654,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;
}, },
@ -29846,13 +29864,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;
@ -29864,24 +29883,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;
@ -32740,6 +32768,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.
* *
@ -34633,6 +34683,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.
* *
@ -35750,8 +35807,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
@ -35862,7 +35922,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.
@ -36101,7 +36161,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.
@ -36282,7 +36342,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.
@ -43906,12 +43966,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));
@ -47478,7 +47532,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)];
}, },
/** /**
@ -49783,6 +49837,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
} }
}; };
@ -49902,6 +49964,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.
@ -50203,8 +50297,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;
@ -50280,6 +50374,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.
* *
@ -51561,11 +51689,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)
{ {
@ -53560,12 +53692,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;
@ -53695,12 +53835,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;
@ -54061,7 +54209,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