mirror of
https://github.com/photonstorm/phaser
synced 2024-11-10 23:24:41 +00:00
New 2.0.7 build
This commit is contained in:
parent
24527eac3e
commit
94978a62d8
9 changed files with 749 additions and 260 deletions
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
* Phaser - http://phaser.io
|
||||
*
|
||||
* v2.0.7 "Amadicia" - Built: Wed Jul 16 2014 01:57:57
|
||||
* v2.0.7 "Amadicia" - Built: Fri Jul 18 2014 11:49:42
|
||||
*
|
||||
* By Richard Davey http://www.photonstorm.com @photonstorm
|
||||
*
|
||||
|
@ -116,7 +116,7 @@ PIXI.sayHello = function (type)
|
|||
if ( navigator.userAgent.toLowerCase().indexOf('chrome') > -1 )
|
||||
{
|
||||
var args = [
|
||||
'%c %c %c Pixi.js ' + PIXI.VERSION + ' - ' + type + ' %c ' + ' %c ' + ' http://pixijs.com %c %c ♥%c♥%c♥ ',
|
||||
'%c %c %c Pixi.js ' + PIXI.VERSION + ' - ' + type + ' %c ' + ' %c ' + ' http://www.pixijs.com/ %c %c ♥%c♥%c♥ ',
|
||||
'background: #ff66a5',
|
||||
'background: #ff66a5',
|
||||
'color: #ff66a5; background: #030307;',
|
||||
|
@ -134,7 +134,7 @@ PIXI.sayHello = function (type)
|
|||
}
|
||||
else if (window['console'])
|
||||
{
|
||||
console.log('Pixi.js ' + PIXI.VERSION + ' - http://pixjs.com');
|
||||
console.log('Pixi.js ' + PIXI.VERSION + ' - http://www.pixijs.com/');
|
||||
}
|
||||
|
||||
PIXI.dontSayHello = true;
|
||||
|
@ -1306,8 +1306,19 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'width', {
|
|||
return this.scale.x * this.getLocalBounds().width;
|
||||
},
|
||||
set: function(value) {
|
||||
|
||||
this.scale.x = value / (this.getLocalBounds().width/this.scale.x);
|
||||
|
||||
var width = this.getLocalBounds().width;
|
||||
|
||||
if(width !== 0)
|
||||
{
|
||||
this.scale.x = value / ( width/this.scale.x );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.scale.x = 1;
|
||||
}
|
||||
|
||||
|
||||
this._width = value;
|
||||
}
|
||||
});
|
||||
|
@ -1325,7 +1336,18 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'height', {
|
|||
return this.scale.y * this.getLocalBounds().height;
|
||||
},
|
||||
set: function(value) {
|
||||
this.scale.y = value / (this.getLocalBounds().height/this.scale.y);
|
||||
|
||||
var height = this.getLocalBounds().height;
|
||||
|
||||
if(height !== 0)
|
||||
{
|
||||
this.scale.y = value / ( height/this.scale.y );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.scale.y = 1;
|
||||
}
|
||||
|
||||
this._height = value;
|
||||
}
|
||||
});
|
||||
|
@ -4660,7 +4682,7 @@ PIXI.WebGLGraphics.updateGraphics = function(graphics, gl)
|
|||
}
|
||||
else if(data.type === PIXI.Graphics.RREC)
|
||||
{
|
||||
PIXI.WebGLGraphics.buildRoundedRectangle(data, webGL);
|
||||
PIXI.WebGLGraphics.buildRoundedRectangle(data, webGLData);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4784,53 +4806,6 @@ PIXI.WebGLGraphics.buildRectangle = function(graphicsData, webGLData)
|
|||
*/
|
||||
PIXI.WebGLGraphics.buildRoundedRectangle = function(graphicsData, webGLData)
|
||||
{
|
||||
/**
|
||||
* Calcul the points for a quadratic bezier curve.
|
||||
* Based on : https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c
|
||||
*
|
||||
* @param {number} fromX Origin point x
|
||||
* @param {number} fromY Origin point x
|
||||
* @param {number} cpX Control point x
|
||||
* @param {number} cpY Control point y
|
||||
* @param {number} toX Destination point x
|
||||
* @param {number} toY Destination point y
|
||||
* @return {number[]}
|
||||
*/
|
||||
function quadraticBezierCurve(fromX, fromY, cpX, cpY, toX, toY) {
|
||||
var xa,
|
||||
ya,
|
||||
xb,
|
||||
yb,
|
||||
x,
|
||||
y,
|
||||
n = 20,
|
||||
points = [];
|
||||
|
||||
function getPt(n1 , n2, perc) {
|
||||
var diff = n2 - n1;
|
||||
|
||||
return n1 + ( diff * perc );
|
||||
}
|
||||
|
||||
var j = 0;
|
||||
for (var i = 0; i <= n; i++ )
|
||||
{
|
||||
j = i / n;
|
||||
|
||||
// The Green Line
|
||||
xa = getPt( fromX , cpX , j );
|
||||
ya = getPt( fromY , cpY , j );
|
||||
xb = getPt( cpX , toX , j );
|
||||
yb = getPt( cpY , toY , j );
|
||||
|
||||
// The Black Dot
|
||||
x = getPt( xa , xb , j );
|
||||
y = getPt( ya , yb , j );
|
||||
|
||||
points.push(x, y);
|
||||
}
|
||||
return points;
|
||||
}
|
||||
|
||||
var points = graphicsData.points;
|
||||
var x = points[0];
|
||||
|
@ -4842,10 +4817,10 @@ PIXI.WebGLGraphics.buildRoundedRectangle = function(graphicsData, webGLData)
|
|||
|
||||
var recPoints = [];
|
||||
recPoints.push(x, y + radius);
|
||||
recPoints = recPoints.concat(quadraticBezierCurve(x, y + height - radius, x, y + height, x + radius, y + height));
|
||||
recPoints = recPoints.concat(quadraticBezierCurve(x + width - radius, y + height, x + width, y + height, x + width, y + height - radius));
|
||||
recPoints = recPoints.concat(quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y));
|
||||
recPoints = recPoints.concat(quadraticBezierCurve(x + radius, y, x, y, x, y + radius));
|
||||
recPoints = recPoints.concat(PIXI.WebGLGraphics.quadraticBezierCurve(x, y + height - radius, x, y + height, x + radius, y + height));
|
||||
recPoints = recPoints.concat(PIXI.WebGLGraphics.quadraticBezierCurve(x + width - radius, y + height, x + width, y + height, x + width, y + height - radius));
|
||||
recPoints = recPoints.concat(PIXI.WebGLGraphics.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y));
|
||||
recPoints = recPoints.concat(PIXI.WebGLGraphics.quadraticBezierCurve(x + radius, y, x, y, x, y + radius));
|
||||
|
||||
|
||||
if (graphicsData.fill) {
|
||||
|
@ -4890,6 +4865,53 @@ PIXI.WebGLGraphics.buildRoundedRectangle = function(graphicsData, webGLData)
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Calcul the points for a quadratic bezier curve. (helper function..)
|
||||
* Based on : https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c
|
||||
*
|
||||
* @param {number} fromX Origin point x
|
||||
* @param {number} fromY Origin point x
|
||||
* @param {number} cpX Control point x
|
||||
* @param {number} cpY Control point y
|
||||
* @param {number} toX Destination point x
|
||||
* @param {number} toY Destination point y
|
||||
* @return {number[]}
|
||||
*/
|
||||
PIXI.WebGLGraphics.quadraticBezierCurve = function(fromX, fromY, cpX, cpY, toX, toY) {
|
||||
var xa,
|
||||
ya,
|
||||
xb,
|
||||
yb,
|
||||
x,
|
||||
y,
|
||||
n = 20,
|
||||
points = [];
|
||||
|
||||
function getPt(n1 , n2, perc) {
|
||||
var diff = n2 - n1;
|
||||
|
||||
return n1 + ( diff * perc );
|
||||
}
|
||||
|
||||
var j = 0;
|
||||
for (var i = 0; i <= n; i++ )
|
||||
{
|
||||
j = i / n;
|
||||
|
||||
// The Green Line
|
||||
xa = getPt( fromX , cpX , j );
|
||||
ya = getPt( fromY , cpY , j );
|
||||
xb = getPt( cpX , toX , j );
|
||||
yb = getPt( cpY , toY , j );
|
||||
|
||||
// The Black Dot
|
||||
x = getPt( xa , xb , j );
|
||||
y = getPt( ya , yb , j );
|
||||
|
||||
points.push(x, y);
|
||||
}
|
||||
return points;
|
||||
};
|
||||
|
||||
/**
|
||||
* Builds a circle to draw
|
||||
|
@ -11554,7 +11576,7 @@ PIXI.RenderTexture.tempMatrix = new PIXI.Matrix();
|
|||
*
|
||||
* Phaser - http://phaser.io
|
||||
*
|
||||
* v2.0.7 "Amadicia" - Built: Wed Jul 16 2014 01:57:57
|
||||
* v2.0.7 "Amadicia" - Built: Fri Jul 18 2014 11:49:42
|
||||
*
|
||||
* By Richard Davey http://www.photonstorm.com @photonstorm
|
||||
*
|
||||
|
@ -11683,6 +11705,70 @@ PIXI.dontSayHello = true;
|
|||
*/
|
||||
Phaser.Utils = {
|
||||
|
||||
/**
|
||||
* Gets an objects property by string.
|
||||
*
|
||||
* @method Phaser.Utils.getProperty
|
||||
* @param {object} obj - The object to traverse.
|
||||
* @param {string} prop - The property whose value will be returned.
|
||||
* @return {*} the value of the property or null if property isn't found .
|
||||
*/
|
||||
getProperty: function(obj, prop) {
|
||||
|
||||
var parts = prop.split('.'),
|
||||
last = parts.pop(),
|
||||
l = parts.length,
|
||||
i = 1,
|
||||
current = parts[0];
|
||||
|
||||
while (i < l && (obj = obj[current]))
|
||||
{
|
||||
current = parts[i];
|
||||
i++;
|
||||
}
|
||||
|
||||
if (obj)
|
||||
{
|
||||
return obj[last];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets an objects property by string.
|
||||
*
|
||||
* @method Phaser.Utils.setProperty
|
||||
* @param {object} obj - The object to traverse
|
||||
* @param {string} prop - The property whose value will be changed
|
||||
* @return {object} The object on which the property was set.
|
||||
*/
|
||||
setProperty: function(obj, prop, value) {
|
||||
|
||||
var parts = prop.split('.'),
|
||||
last = parts.pop(),
|
||||
l = parts.length,
|
||||
i = 1,
|
||||
current = parts[0];
|
||||
|
||||
while (i < l && (obj = obj[current]))
|
||||
{
|
||||
current = parts[i];
|
||||
i++;
|
||||
}
|
||||
|
||||
if (obj)
|
||||
{
|
||||
obj[last] = value;
|
||||
}
|
||||
|
||||
return obj;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Transposes the elements of the given Array.
|
||||
*
|
||||
|
@ -19213,6 +19299,35 @@ Phaser.Group.prototype.setProperty = function (child, key, value, operation, for
|
|||
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks a property for the given value on the child.
|
||||
*
|
||||
* @method Phaser.Group#checkProperty
|
||||
* @param {*} child - The child to check the property value on.
|
||||
* @param {array} key - An array of strings that make up the property that will be set.
|
||||
* @param {*} value - The value that will be checked.
|
||||
* @param {boolean} [force=false] - If `force` is true then the property will be checked on the child regardless if it already exists or not. If true and the property doesn't exist, false will be returned.
|
||||
* @return {boolean} True if the property was was equal to value, false if not.
|
||||
*/
|
||||
Phaser.Group.prototype.checkProperty = function (child, key, value, force) {
|
||||
|
||||
if (typeof force === 'undefined') { force = false; }
|
||||
|
||||
// We can't force a property in and the child doesn't have it, so abort.
|
||||
if (!Phaser.Utils.getProperty(child, key) && force)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Phaser.Utils.getProperty(child, key) !== value)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* This function allows you to quickly set a property on a single child of this Group to a new value.
|
||||
* The operation parameter controls how the new value is assigned to the property, from simple replacement to addition and multiplication.
|
||||
|
@ -19318,6 +19433,38 @@ Phaser.Group.prototype.setAllChildren = function (key, value, checkAlive, checkV
|
|||
|
||||
};
|
||||
|
||||
/**
|
||||
* This function allows you to quickly check that the same property across all children of this Group is equal to the given value.
|
||||
* This call doesn't descend down children, so if you have a Group inside of this Group, the property will be checked on the Group but not its children.
|
||||
*
|
||||
* @method Phaser.Group#checkAll
|
||||
* @param {string} key - The property, as a string, to be set. For example: 'body.velocity.x'
|
||||
* @param {*} value - The value that will be checked.
|
||||
* @param {boolean} [checkAlive=false] - If set then only children with alive=true will be checked. This includes any Groups that are children.
|
||||
* @param {boolean} [checkVisible=false] - If set then only children with visible=true will be checked. This includes any Groups that are children.
|
||||
* @param {boolean} [force=false] - If `force` is true then the property will be checked on the child regardless if it already exists or not. If true and the property doesn't exist, false will be returned.
|
||||
*/
|
||||
Phaser.Group.prototype.checkAll = function (key, value, checkAlive, checkVisible, force) {
|
||||
|
||||
if (typeof checkAlive === 'undefined') { checkAlive = false; }
|
||||
if (typeof checkVisible === 'undefined') { checkVisible = false; }
|
||||
if (typeof force === 'undefined') { force = false; }
|
||||
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
if ((!checkAlive || (checkAlive && this.children[i].alive)) && (!checkVisible || (checkVisible && this.children[i].visible)))
|
||||
{
|
||||
if (!this.checkProperty(this.children[i], key, value, force))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds the amount to the given property on all children in this Group.
|
||||
* Group.addAll('x', 10) will add 10 to the child.x value.
|
||||
|
@ -20905,7 +21052,7 @@ Phaser.ScaleManager.prototype = {
|
|||
orientationImage = '__default';
|
||||
}
|
||||
|
||||
this.orientationSprite = new Phaser.Image(this.game, this.game.width / 2, this.game.height / 2, PIXI.TextureCache[orientationImage]);
|
||||
this.orientationSprite = new Phaser.Image(this.game, this.game.width / 2, this.game.height / 2, orientationImage);
|
||||
this.orientationSprite.anchor.set(0.5);
|
||||
|
||||
this.checkOrientationState();
|
||||
|
@ -29926,6 +30073,9 @@ Phaser.BitmapData.prototype = {
|
|||
this.texture.width = width;
|
||||
this.texture.height = height;
|
||||
|
||||
this.texture.crop.width = width;
|
||||
this.texture.crop.height = height;
|
||||
|
||||
this.refreshBuffer();
|
||||
this.dirty = true;
|
||||
}
|
||||
|
@ -40504,6 +40654,15 @@ Phaser.TweenManager.prototype = {
|
|||
{
|
||||
this._tweens[i].pendingDelete = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
i = this._add.indexOf(tween);
|
||||
|
||||
if (i !== -1)
|
||||
{
|
||||
this._add[i].pendingDelete = true;
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
@ -40515,13 +40674,15 @@ Phaser.TweenManager.prototype = {
|
|||
*/
|
||||
update: function () {
|
||||
|
||||
if (this._tweens.length === 0 && this._add.length === 0)
|
||||
var addTweens = this._add.length;
|
||||
var numTweens = this._tweens.length;
|
||||
|
||||
if (numTweens === 0 && addTweens === 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var i = 0;
|
||||
var numTweens = this._tweens.length;
|
||||
|
||||
while (i < numTweens)
|
||||
{
|
||||
|
@ -40538,7 +40699,7 @@ Phaser.TweenManager.prototype = {
|
|||
}
|
||||
|
||||
// If there are any new tweens to be added, do so now - otherwise they can be spliced out of the array before ever running
|
||||
if (this._add.length > 0)
|
||||
if (addTweens > 0)
|
||||
{
|
||||
this._tweens = this._tweens.concat(this._add);
|
||||
this._add.length = 0;
|
||||
|
@ -43442,6 +43603,7 @@ Phaser.AnimationManager.prototype = {
|
|||
|
||||
this.currentAnim = this._anims[name];
|
||||
this.currentAnim.paused = false;
|
||||
this.currentFrame = this.currentAnim.currentFrame;
|
||||
return this.currentAnim.play(frameRate, loop, killOnComplete);
|
||||
}
|
||||
}
|
||||
|
@ -44249,7 +44411,7 @@ Phaser.Animation.prototype = {
|
|||
updateFrameData: function (frameData) {
|
||||
|
||||
this._frameData = frameData;
|
||||
this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]);
|
||||
this.currentFrame = this._frameData ? this._frameData.getFrame(this._frames[this._frameIndex % this._frames.length]) : null;
|
||||
|
||||
},
|
||||
|
||||
|
@ -57324,17 +57486,18 @@ Phaser.Tilemap.prototype = {
|
|||
* @method Phaser.Tilemap#swapHandler
|
||||
* @private
|
||||
* @param {number} value
|
||||
* @param {number} index
|
||||
*/
|
||||
swapHandler: function (value, index) {
|
||||
swapHandler: function (value) {
|
||||
|
||||
if (value.index === this._tempA)
|
||||
{
|
||||
this._results[index].index = this._tempB;
|
||||
// Swap A with B
|
||||
value.index = this._tempB;
|
||||
}
|
||||
if (value.index === this._tempB)
|
||||
else if (value.index === this._tempB)
|
||||
{
|
||||
this._results[index].index = this._tempA;
|
||||
// Swap B with A
|
||||
value.index = this._tempA;
|
||||
}
|
||||
|
||||
},
|
||||
|
|
32
build/custom/phaser-arcade-physics.min.js
vendored
32
build/custom/phaser-arcade-physics.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
* Phaser - http://phaser.io
|
||||
*
|
||||
* v2.0.7 "Amadicia" - Built: Wed Jul 16 2014 01:57:57
|
||||
* v2.0.7 "Amadicia" - Built: Fri Jul 18 2014 11:49:42
|
||||
*
|
||||
* By Richard Davey http://www.photonstorm.com @photonstorm
|
||||
*
|
||||
|
@ -136,6 +136,70 @@ PIXI.dontSayHello = true;
|
|||
*/
|
||||
Phaser.Utils = {
|
||||
|
||||
/**
|
||||
* Gets an objects property by string.
|
||||
*
|
||||
* @method Phaser.Utils.getProperty
|
||||
* @param {object} obj - The object to traverse.
|
||||
* @param {string} prop - The property whose value will be returned.
|
||||
* @return {*} the value of the property or null if property isn't found .
|
||||
*/
|
||||
getProperty: function(obj, prop) {
|
||||
|
||||
var parts = prop.split('.'),
|
||||
last = parts.pop(),
|
||||
l = parts.length,
|
||||
i = 1,
|
||||
current = parts[0];
|
||||
|
||||
while (i < l && (obj = obj[current]))
|
||||
{
|
||||
current = parts[i];
|
||||
i++;
|
||||
}
|
||||
|
||||
if (obj)
|
||||
{
|
||||
return obj[last];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets an objects property by string.
|
||||
*
|
||||
* @method Phaser.Utils.setProperty
|
||||
* @param {object} obj - The object to traverse
|
||||
* @param {string} prop - The property whose value will be changed
|
||||
* @return {object} The object on which the property was set.
|
||||
*/
|
||||
setProperty: function(obj, prop, value) {
|
||||
|
||||
var parts = prop.split('.'),
|
||||
last = parts.pop(),
|
||||
l = parts.length,
|
||||
i = 1,
|
||||
current = parts[0];
|
||||
|
||||
while (i < l && (obj = obj[current]))
|
||||
{
|
||||
current = parts[i];
|
||||
i++;
|
||||
}
|
||||
|
||||
if (obj)
|
||||
{
|
||||
obj[last] = value;
|
||||
}
|
||||
|
||||
return obj;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Transposes the elements of the given Array.
|
||||
*
|
||||
|
@ -7666,6 +7730,35 @@ Phaser.Group.prototype.setProperty = function (child, key, value, operation, for
|
|||
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks a property for the given value on the child.
|
||||
*
|
||||
* @method Phaser.Group#checkProperty
|
||||
* @param {*} child - The child to check the property value on.
|
||||
* @param {array} key - An array of strings that make up the property that will be set.
|
||||
* @param {*} value - The value that will be checked.
|
||||
* @param {boolean} [force=false] - If `force` is true then the property will be checked on the child regardless if it already exists or not. If true and the property doesn't exist, false will be returned.
|
||||
* @return {boolean} True if the property was was equal to value, false if not.
|
||||
*/
|
||||
Phaser.Group.prototype.checkProperty = function (child, key, value, force) {
|
||||
|
||||
if (typeof force === 'undefined') { force = false; }
|
||||
|
||||
// We can't force a property in and the child doesn't have it, so abort.
|
||||
if (!Phaser.Utils.getProperty(child, key) && force)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Phaser.Utils.getProperty(child, key) !== value)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* This function allows you to quickly set a property on a single child of this Group to a new value.
|
||||
* The operation parameter controls how the new value is assigned to the property, from simple replacement to addition and multiplication.
|
||||
|
@ -7771,6 +7864,38 @@ Phaser.Group.prototype.setAllChildren = function (key, value, checkAlive, checkV
|
|||
|
||||
};
|
||||
|
||||
/**
|
||||
* This function allows you to quickly check that the same property across all children of this Group is equal to the given value.
|
||||
* This call doesn't descend down children, so if you have a Group inside of this Group, the property will be checked on the Group but not its children.
|
||||
*
|
||||
* @method Phaser.Group#checkAll
|
||||
* @param {string} key - The property, as a string, to be set. For example: 'body.velocity.x'
|
||||
* @param {*} value - The value that will be checked.
|
||||
* @param {boolean} [checkAlive=false] - If set then only children with alive=true will be checked. This includes any Groups that are children.
|
||||
* @param {boolean} [checkVisible=false] - If set then only children with visible=true will be checked. This includes any Groups that are children.
|
||||
* @param {boolean} [force=false] - If `force` is true then the property will be checked on the child regardless if it already exists or not. If true and the property doesn't exist, false will be returned.
|
||||
*/
|
||||
Phaser.Group.prototype.checkAll = function (key, value, checkAlive, checkVisible, force) {
|
||||
|
||||
if (typeof checkAlive === 'undefined') { checkAlive = false; }
|
||||
if (typeof checkVisible === 'undefined') { checkVisible = false; }
|
||||
if (typeof force === 'undefined') { force = false; }
|
||||
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
if ((!checkAlive || (checkAlive && this.children[i].alive)) && (!checkVisible || (checkVisible && this.children[i].visible)))
|
||||
{
|
||||
if (!this.checkProperty(this.children[i], key, value, force))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds the amount to the given property on all children in this Group.
|
||||
* Group.addAll('x', 10) will add 10 to the child.x value.
|
||||
|
@ -9358,7 +9483,7 @@ Phaser.ScaleManager.prototype = {
|
|||
orientationImage = '__default';
|
||||
}
|
||||
|
||||
this.orientationSprite = new Phaser.Image(this.game, this.game.width / 2, this.game.height / 2, PIXI.TextureCache[orientationImage]);
|
||||
this.orientationSprite = new Phaser.Image(this.game, this.game.width / 2, this.game.height / 2, orientationImage);
|
||||
this.orientationSprite.anchor.set(0.5);
|
||||
|
||||
this.checkOrientationState();
|
||||
|
@ -18379,6 +18504,9 @@ Phaser.BitmapData.prototype = {
|
|||
this.texture.width = width;
|
||||
this.texture.height = height;
|
||||
|
||||
this.texture.crop.width = width;
|
||||
this.texture.crop.height = height;
|
||||
|
||||
this.refreshBuffer();
|
||||
this.dirty = true;
|
||||
}
|
||||
|
@ -28957,6 +29085,15 @@ Phaser.TweenManager.prototype = {
|
|||
{
|
||||
this._tweens[i].pendingDelete = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
i = this._add.indexOf(tween);
|
||||
|
||||
if (i !== -1)
|
||||
{
|
||||
this._add[i].pendingDelete = true;
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
@ -28968,13 +29105,15 @@ Phaser.TweenManager.prototype = {
|
|||
*/
|
||||
update: function () {
|
||||
|
||||
if (this._tweens.length === 0 && this._add.length === 0)
|
||||
var addTweens = this._add.length;
|
||||
var numTweens = this._tweens.length;
|
||||
|
||||
if (numTweens === 0 && addTweens === 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var i = 0;
|
||||
var numTweens = this._tweens.length;
|
||||
|
||||
while (i < numTweens)
|
||||
{
|
||||
|
@ -28991,7 +29130,7 @@ Phaser.TweenManager.prototype = {
|
|||
}
|
||||
|
||||
// If there are any new tweens to be added, do so now - otherwise they can be spliced out of the array before ever running
|
||||
if (this._add.length > 0)
|
||||
if (addTweens > 0)
|
||||
{
|
||||
this._tweens = this._tweens.concat(this._add);
|
||||
this._add.length = 0;
|
||||
|
@ -31895,6 +32034,7 @@ Phaser.AnimationManager.prototype = {
|
|||
|
||||
this.currentAnim = this._anims[name];
|
||||
this.currentAnim.paused = false;
|
||||
this.currentFrame = this.currentAnim.currentFrame;
|
||||
return this.currentAnim.play(frameRate, loop, killOnComplete);
|
||||
}
|
||||
}
|
||||
|
@ -32702,7 +32842,7 @@ Phaser.Animation.prototype = {
|
|||
updateFrameData: function (frameData) {
|
||||
|
||||
this._frameData = frameData;
|
||||
this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]);
|
||||
this.currentFrame = this._frameData ? this._frameData.getFrame(this._frames[this._frameIndex % this._frames.length]) : null;
|
||||
|
||||
},
|
||||
|
||||
|
@ -45777,17 +45917,18 @@ Phaser.Tilemap.prototype = {
|
|||
* @method Phaser.Tilemap#swapHandler
|
||||
* @private
|
||||
* @param {number} value
|
||||
* @param {number} index
|
||||
*/
|
||||
swapHandler: function (value, index) {
|
||||
swapHandler: function (value) {
|
||||
|
||||
if (value.index === this._tempA)
|
||||
{
|
||||
this._results[index].index = this._tempB;
|
||||
// Swap A with B
|
||||
value.index = this._tempB;
|
||||
}
|
||||
if (value.index === this._tempB)
|
||||
else if (value.index === this._tempB)
|
||||
{
|
||||
this._results[index].index = this._tempA;
|
||||
// Swap B with A
|
||||
value.index = this._tempA;
|
||||
}
|
||||
|
||||
},
|
||||
|
|
24
build/custom/phaser-no-libs.min.js
vendored
24
build/custom/phaser-no-libs.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -86,7 +86,7 @@ PIXI.sayHello = function (type)
|
|||
if ( navigator.userAgent.toLowerCase().indexOf('chrome') > -1 )
|
||||
{
|
||||
var args = [
|
||||
'%c %c %c Pixi.js ' + PIXI.VERSION + ' - ' + type + ' %c ' + ' %c ' + ' http://pixijs.com %c %c ♥%c♥%c♥ ',
|
||||
'%c %c %c Pixi.js ' + PIXI.VERSION + ' - ' + type + ' %c ' + ' %c ' + ' http://www.pixijs.com/ %c %c ♥%c♥%c♥ ',
|
||||
'background: #ff66a5',
|
||||
'background: #ff66a5',
|
||||
'color: #ff66a5; background: #030307;',
|
||||
|
@ -104,7 +104,7 @@ PIXI.sayHello = function (type)
|
|||
}
|
||||
else if (window['console'])
|
||||
{
|
||||
console.log('Pixi.js ' + PIXI.VERSION + ' - http://pixjs.com');
|
||||
console.log('Pixi.js ' + PIXI.VERSION + ' - http://www.pixijs.com/');
|
||||
}
|
||||
|
||||
PIXI.dontSayHello = true;
|
||||
|
@ -1276,8 +1276,19 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'width', {
|
|||
return this.scale.x * this.getLocalBounds().width;
|
||||
},
|
||||
set: function(value) {
|
||||
|
||||
this.scale.x = value / (this.getLocalBounds().width/this.scale.x);
|
||||
|
||||
var width = this.getLocalBounds().width;
|
||||
|
||||
if(width !== 0)
|
||||
{
|
||||
this.scale.x = value / ( width/this.scale.x );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.scale.x = 1;
|
||||
}
|
||||
|
||||
|
||||
this._width = value;
|
||||
}
|
||||
});
|
||||
|
@ -1295,7 +1306,18 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'height', {
|
|||
return this.scale.y * this.getLocalBounds().height;
|
||||
},
|
||||
set: function(value) {
|
||||
this.scale.y = value / (this.getLocalBounds().height/this.scale.y);
|
||||
|
||||
var height = this.getLocalBounds().height;
|
||||
|
||||
if(height !== 0)
|
||||
{
|
||||
this.scale.y = value / ( height/this.scale.y );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.scale.y = 1;
|
||||
}
|
||||
|
||||
this._height = value;
|
||||
}
|
||||
});
|
||||
|
@ -4630,7 +4652,7 @@ PIXI.WebGLGraphics.updateGraphics = function(graphics, gl)
|
|||
}
|
||||
else if(data.type === PIXI.Graphics.RREC)
|
||||
{
|
||||
PIXI.WebGLGraphics.buildRoundedRectangle(data, webGL);
|
||||
PIXI.WebGLGraphics.buildRoundedRectangle(data, webGLData);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4754,53 +4776,6 @@ PIXI.WebGLGraphics.buildRectangle = function(graphicsData, webGLData)
|
|||
*/
|
||||
PIXI.WebGLGraphics.buildRoundedRectangle = function(graphicsData, webGLData)
|
||||
{
|
||||
/**
|
||||
* Calcul the points for a quadratic bezier curve.
|
||||
* Based on : https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c
|
||||
*
|
||||
* @param {number} fromX Origin point x
|
||||
* @param {number} fromY Origin point x
|
||||
* @param {number} cpX Control point x
|
||||
* @param {number} cpY Control point y
|
||||
* @param {number} toX Destination point x
|
||||
* @param {number} toY Destination point y
|
||||
* @return {number[]}
|
||||
*/
|
||||
function quadraticBezierCurve(fromX, fromY, cpX, cpY, toX, toY) {
|
||||
var xa,
|
||||
ya,
|
||||
xb,
|
||||
yb,
|
||||
x,
|
||||
y,
|
||||
n = 20,
|
||||
points = [];
|
||||
|
||||
function getPt(n1 , n2, perc) {
|
||||
var diff = n2 - n1;
|
||||
|
||||
return n1 + ( diff * perc );
|
||||
}
|
||||
|
||||
var j = 0;
|
||||
for (var i = 0; i <= n; i++ )
|
||||
{
|
||||
j = i / n;
|
||||
|
||||
// The Green Line
|
||||
xa = getPt( fromX , cpX , j );
|
||||
ya = getPt( fromY , cpY , j );
|
||||
xb = getPt( cpX , toX , j );
|
||||
yb = getPt( cpY , toY , j );
|
||||
|
||||
// The Black Dot
|
||||
x = getPt( xa , xb , j );
|
||||
y = getPt( ya , yb , j );
|
||||
|
||||
points.push(x, y);
|
||||
}
|
||||
return points;
|
||||
}
|
||||
|
||||
var points = graphicsData.points;
|
||||
var x = points[0];
|
||||
|
@ -4812,10 +4787,10 @@ PIXI.WebGLGraphics.buildRoundedRectangle = function(graphicsData, webGLData)
|
|||
|
||||
var recPoints = [];
|
||||
recPoints.push(x, y + radius);
|
||||
recPoints = recPoints.concat(quadraticBezierCurve(x, y + height - radius, x, y + height, x + radius, y + height));
|
||||
recPoints = recPoints.concat(quadraticBezierCurve(x + width - radius, y + height, x + width, y + height, x + width, y + height - radius));
|
||||
recPoints = recPoints.concat(quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y));
|
||||
recPoints = recPoints.concat(quadraticBezierCurve(x + radius, y, x, y, x, y + radius));
|
||||
recPoints = recPoints.concat(PIXI.WebGLGraphics.quadraticBezierCurve(x, y + height - radius, x, y + height, x + radius, y + height));
|
||||
recPoints = recPoints.concat(PIXI.WebGLGraphics.quadraticBezierCurve(x + width - radius, y + height, x + width, y + height, x + width, y + height - radius));
|
||||
recPoints = recPoints.concat(PIXI.WebGLGraphics.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y));
|
||||
recPoints = recPoints.concat(PIXI.WebGLGraphics.quadraticBezierCurve(x + radius, y, x, y, x, y + radius));
|
||||
|
||||
|
||||
if (graphicsData.fill) {
|
||||
|
@ -4860,6 +4835,53 @@ PIXI.WebGLGraphics.buildRoundedRectangle = function(graphicsData, webGLData)
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Calcul the points for a quadratic bezier curve. (helper function..)
|
||||
* Based on : https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c
|
||||
*
|
||||
* @param {number} fromX Origin point x
|
||||
* @param {number} fromY Origin point x
|
||||
* @param {number} cpX Control point x
|
||||
* @param {number} cpY Control point y
|
||||
* @param {number} toX Destination point x
|
||||
* @param {number} toY Destination point y
|
||||
* @return {number[]}
|
||||
*/
|
||||
PIXI.WebGLGraphics.quadraticBezierCurve = function(fromX, fromY, cpX, cpY, toX, toY) {
|
||||
var xa,
|
||||
ya,
|
||||
xb,
|
||||
yb,
|
||||
x,
|
||||
y,
|
||||
n = 20,
|
||||
points = [];
|
||||
|
||||
function getPt(n1 , n2, perc) {
|
||||
var diff = n2 - n1;
|
||||
|
||||
return n1 + ( diff * perc );
|
||||
}
|
||||
|
||||
var j = 0;
|
||||
for (var i = 0; i <= n; i++ )
|
||||
{
|
||||
j = i / n;
|
||||
|
||||
// The Green Line
|
||||
xa = getPt( fromX , cpX , j );
|
||||
ya = getPt( fromY , cpY , j );
|
||||
xb = getPt( cpX , toX , j );
|
||||
yb = getPt( cpY , toY , j );
|
||||
|
||||
// The Black Dot
|
||||
x = getPt( xa , xb , j );
|
||||
y = getPt( ya , yb , j );
|
||||
|
||||
points.push(x, y);
|
||||
}
|
||||
return points;
|
||||
};
|
||||
|
||||
/**
|
||||
* Builds a circle to draw
|
||||
|
|
6
build/custom/pixi.min.js
vendored
6
build/custom/pixi.min.js
vendored
File diff suppressed because one or more lines are too long
301
build/phaser.js
301
build/phaser.js
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
* Phaser - http://phaser.io
|
||||
*
|
||||
* v2.0.7 "Amadicia" - Built: Wed Jul 16 2014 01:57:57
|
||||
* v2.0.7 "Amadicia" - Built: Fri Jul 18 2014 11:49:42
|
||||
*
|
||||
* By Richard Davey http://www.photonstorm.com @photonstorm
|
||||
*
|
||||
|
@ -116,7 +116,7 @@ PIXI.sayHello = function (type)
|
|||
if ( navigator.userAgent.toLowerCase().indexOf('chrome') > -1 )
|
||||
{
|
||||
var args = [
|
||||
'%c %c %c Pixi.js ' + PIXI.VERSION + ' - ' + type + ' %c ' + ' %c ' + ' http://pixijs.com %c %c ♥%c♥%c♥ ',
|
||||
'%c %c %c Pixi.js ' + PIXI.VERSION + ' - ' + type + ' %c ' + ' %c ' + ' http://www.pixijs.com/ %c %c ♥%c♥%c♥ ',
|
||||
'background: #ff66a5',
|
||||
'background: #ff66a5',
|
||||
'color: #ff66a5; background: #030307;',
|
||||
|
@ -134,7 +134,7 @@ PIXI.sayHello = function (type)
|
|||
}
|
||||
else if (window['console'])
|
||||
{
|
||||
console.log('Pixi.js ' + PIXI.VERSION + ' - http://pixjs.com');
|
||||
console.log('Pixi.js ' + PIXI.VERSION + ' - http://www.pixijs.com/');
|
||||
}
|
||||
|
||||
PIXI.dontSayHello = true;
|
||||
|
@ -1306,8 +1306,19 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'width', {
|
|||
return this.scale.x * this.getLocalBounds().width;
|
||||
},
|
||||
set: function(value) {
|
||||
|
||||
this.scale.x = value / (this.getLocalBounds().width/this.scale.x);
|
||||
|
||||
var width = this.getLocalBounds().width;
|
||||
|
||||
if(width !== 0)
|
||||
{
|
||||
this.scale.x = value / ( width/this.scale.x );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.scale.x = 1;
|
||||
}
|
||||
|
||||
|
||||
this._width = value;
|
||||
}
|
||||
});
|
||||
|
@ -1325,7 +1336,18 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'height', {
|
|||
return this.scale.y * this.getLocalBounds().height;
|
||||
},
|
||||
set: function(value) {
|
||||
this.scale.y = value / (this.getLocalBounds().height/this.scale.y);
|
||||
|
||||
var height = this.getLocalBounds().height;
|
||||
|
||||
if(height !== 0)
|
||||
{
|
||||
this.scale.y = value / ( height/this.scale.y );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.scale.y = 1;
|
||||
}
|
||||
|
||||
this._height = value;
|
||||
}
|
||||
});
|
||||
|
@ -4660,7 +4682,7 @@ PIXI.WebGLGraphics.updateGraphics = function(graphics, gl)
|
|||
}
|
||||
else if(data.type === PIXI.Graphics.RREC)
|
||||
{
|
||||
PIXI.WebGLGraphics.buildRoundedRectangle(data, webGL);
|
||||
PIXI.WebGLGraphics.buildRoundedRectangle(data, webGLData);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4784,53 +4806,6 @@ PIXI.WebGLGraphics.buildRectangle = function(graphicsData, webGLData)
|
|||
*/
|
||||
PIXI.WebGLGraphics.buildRoundedRectangle = function(graphicsData, webGLData)
|
||||
{
|
||||
/**
|
||||
* Calcul the points for a quadratic bezier curve.
|
||||
* Based on : https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c
|
||||
*
|
||||
* @param {number} fromX Origin point x
|
||||
* @param {number} fromY Origin point x
|
||||
* @param {number} cpX Control point x
|
||||
* @param {number} cpY Control point y
|
||||
* @param {number} toX Destination point x
|
||||
* @param {number} toY Destination point y
|
||||
* @return {number[]}
|
||||
*/
|
||||
function quadraticBezierCurve(fromX, fromY, cpX, cpY, toX, toY) {
|
||||
var xa,
|
||||
ya,
|
||||
xb,
|
||||
yb,
|
||||
x,
|
||||
y,
|
||||
n = 20,
|
||||
points = [];
|
||||
|
||||
function getPt(n1 , n2, perc) {
|
||||
var diff = n2 - n1;
|
||||
|
||||
return n1 + ( diff * perc );
|
||||
}
|
||||
|
||||
var j = 0;
|
||||
for (var i = 0; i <= n; i++ )
|
||||
{
|
||||
j = i / n;
|
||||
|
||||
// The Green Line
|
||||
xa = getPt( fromX , cpX , j );
|
||||
ya = getPt( fromY , cpY , j );
|
||||
xb = getPt( cpX , toX , j );
|
||||
yb = getPt( cpY , toY , j );
|
||||
|
||||
// The Black Dot
|
||||
x = getPt( xa , xb , j );
|
||||
y = getPt( ya , yb , j );
|
||||
|
||||
points.push(x, y);
|
||||
}
|
||||
return points;
|
||||
}
|
||||
|
||||
var points = graphicsData.points;
|
||||
var x = points[0];
|
||||
|
@ -4842,10 +4817,10 @@ PIXI.WebGLGraphics.buildRoundedRectangle = function(graphicsData, webGLData)
|
|||
|
||||
var recPoints = [];
|
||||
recPoints.push(x, y + radius);
|
||||
recPoints = recPoints.concat(quadraticBezierCurve(x, y + height - radius, x, y + height, x + radius, y + height));
|
||||
recPoints = recPoints.concat(quadraticBezierCurve(x + width - radius, y + height, x + width, y + height, x + width, y + height - radius));
|
||||
recPoints = recPoints.concat(quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y));
|
||||
recPoints = recPoints.concat(quadraticBezierCurve(x + radius, y, x, y, x, y + radius));
|
||||
recPoints = recPoints.concat(PIXI.WebGLGraphics.quadraticBezierCurve(x, y + height - radius, x, y + height, x + radius, y + height));
|
||||
recPoints = recPoints.concat(PIXI.WebGLGraphics.quadraticBezierCurve(x + width - radius, y + height, x + width, y + height, x + width, y + height - radius));
|
||||
recPoints = recPoints.concat(PIXI.WebGLGraphics.quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y));
|
||||
recPoints = recPoints.concat(PIXI.WebGLGraphics.quadraticBezierCurve(x + radius, y, x, y, x, y + radius));
|
||||
|
||||
|
||||
if (graphicsData.fill) {
|
||||
|
@ -4890,6 +4865,53 @@ PIXI.WebGLGraphics.buildRoundedRectangle = function(graphicsData, webGLData)
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Calcul the points for a quadratic bezier curve. (helper function..)
|
||||
* Based on : https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c
|
||||
*
|
||||
* @param {number} fromX Origin point x
|
||||
* @param {number} fromY Origin point x
|
||||
* @param {number} cpX Control point x
|
||||
* @param {number} cpY Control point y
|
||||
* @param {number} toX Destination point x
|
||||
* @param {number} toY Destination point y
|
||||
* @return {number[]}
|
||||
*/
|
||||
PIXI.WebGLGraphics.quadraticBezierCurve = function(fromX, fromY, cpX, cpY, toX, toY) {
|
||||
var xa,
|
||||
ya,
|
||||
xb,
|
||||
yb,
|
||||
x,
|
||||
y,
|
||||
n = 20,
|
||||
points = [];
|
||||
|
||||
function getPt(n1 , n2, perc) {
|
||||
var diff = n2 - n1;
|
||||
|
||||
return n1 + ( diff * perc );
|
||||
}
|
||||
|
||||
var j = 0;
|
||||
for (var i = 0; i <= n; i++ )
|
||||
{
|
||||
j = i / n;
|
||||
|
||||
// The Green Line
|
||||
xa = getPt( fromX , cpX , j );
|
||||
ya = getPt( fromY , cpY , j );
|
||||
xb = getPt( cpX , toX , j );
|
||||
yb = getPt( cpY , toY , j );
|
||||
|
||||
// The Black Dot
|
||||
x = getPt( xa , xb , j );
|
||||
y = getPt( ya , yb , j );
|
||||
|
||||
points.push(x, y);
|
||||
}
|
||||
return points;
|
||||
};
|
||||
|
||||
/**
|
||||
* Builds a circle to draw
|
||||
|
@ -11554,7 +11576,7 @@ PIXI.RenderTexture.tempMatrix = new PIXI.Matrix();
|
|||
*
|
||||
* Phaser - http://phaser.io
|
||||
*
|
||||
* v2.0.7 "Amadicia" - Built: Wed Jul 16 2014 01:57:57
|
||||
* v2.0.7 "Amadicia" - Built: Fri Jul 18 2014 11:49:42
|
||||
*
|
||||
* By Richard Davey http://www.photonstorm.com @photonstorm
|
||||
*
|
||||
|
@ -11683,6 +11705,70 @@ PIXI.dontSayHello = true;
|
|||
*/
|
||||
Phaser.Utils = {
|
||||
|
||||
/**
|
||||
* Gets an objects property by string.
|
||||
*
|
||||
* @method Phaser.Utils.getProperty
|
||||
* @param {object} obj - The object to traverse.
|
||||
* @param {string} prop - The property whose value will be returned.
|
||||
* @return {*} the value of the property or null if property isn't found .
|
||||
*/
|
||||
getProperty: function(obj, prop) {
|
||||
|
||||
var parts = prop.split('.'),
|
||||
last = parts.pop(),
|
||||
l = parts.length,
|
||||
i = 1,
|
||||
current = parts[0];
|
||||
|
||||
while (i < l && (obj = obj[current]))
|
||||
{
|
||||
current = parts[i];
|
||||
i++;
|
||||
}
|
||||
|
||||
if (obj)
|
||||
{
|
||||
return obj[last];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets an objects property by string.
|
||||
*
|
||||
* @method Phaser.Utils.setProperty
|
||||
* @param {object} obj - The object to traverse
|
||||
* @param {string} prop - The property whose value will be changed
|
||||
* @return {object} The object on which the property was set.
|
||||
*/
|
||||
setProperty: function(obj, prop, value) {
|
||||
|
||||
var parts = prop.split('.'),
|
||||
last = parts.pop(),
|
||||
l = parts.length,
|
||||
i = 1,
|
||||
current = parts[0];
|
||||
|
||||
while (i < l && (obj = obj[current]))
|
||||
{
|
||||
current = parts[i];
|
||||
i++;
|
||||
}
|
||||
|
||||
if (obj)
|
||||
{
|
||||
obj[last] = value;
|
||||
}
|
||||
|
||||
return obj;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Transposes the elements of the given Array.
|
||||
*
|
||||
|
@ -19213,6 +19299,35 @@ Phaser.Group.prototype.setProperty = function (child, key, value, operation, for
|
|||
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks a property for the given value on the child.
|
||||
*
|
||||
* @method Phaser.Group#checkProperty
|
||||
* @param {*} child - The child to check the property value on.
|
||||
* @param {array} key - An array of strings that make up the property that will be set.
|
||||
* @param {*} value - The value that will be checked.
|
||||
* @param {boolean} [force=false] - If `force` is true then the property will be checked on the child regardless if it already exists or not. If true and the property doesn't exist, false will be returned.
|
||||
* @return {boolean} True if the property was was equal to value, false if not.
|
||||
*/
|
||||
Phaser.Group.prototype.checkProperty = function (child, key, value, force) {
|
||||
|
||||
if (typeof force === 'undefined') { force = false; }
|
||||
|
||||
// We can't force a property in and the child doesn't have it, so abort.
|
||||
if (!Phaser.Utils.getProperty(child, key) && force)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Phaser.Utils.getProperty(child, key) !== value)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* This function allows you to quickly set a property on a single child of this Group to a new value.
|
||||
* The operation parameter controls how the new value is assigned to the property, from simple replacement to addition and multiplication.
|
||||
|
@ -19318,6 +19433,38 @@ Phaser.Group.prototype.setAllChildren = function (key, value, checkAlive, checkV
|
|||
|
||||
};
|
||||
|
||||
/**
|
||||
* This function allows you to quickly check that the same property across all children of this Group is equal to the given value.
|
||||
* This call doesn't descend down children, so if you have a Group inside of this Group, the property will be checked on the Group but not its children.
|
||||
*
|
||||
* @method Phaser.Group#checkAll
|
||||
* @param {string} key - The property, as a string, to be set. For example: 'body.velocity.x'
|
||||
* @param {*} value - The value that will be checked.
|
||||
* @param {boolean} [checkAlive=false] - If set then only children with alive=true will be checked. This includes any Groups that are children.
|
||||
* @param {boolean} [checkVisible=false] - If set then only children with visible=true will be checked. This includes any Groups that are children.
|
||||
* @param {boolean} [force=false] - If `force` is true then the property will be checked on the child regardless if it already exists or not. If true and the property doesn't exist, false will be returned.
|
||||
*/
|
||||
Phaser.Group.prototype.checkAll = function (key, value, checkAlive, checkVisible, force) {
|
||||
|
||||
if (typeof checkAlive === 'undefined') { checkAlive = false; }
|
||||
if (typeof checkVisible === 'undefined') { checkVisible = false; }
|
||||
if (typeof force === 'undefined') { force = false; }
|
||||
|
||||
for (var i = 0, len = this.children.length; i < len; i++)
|
||||
{
|
||||
if ((!checkAlive || (checkAlive && this.children[i].alive)) && (!checkVisible || (checkVisible && this.children[i].visible)))
|
||||
{
|
||||
if (!this.checkProperty(this.children[i], key, value, force))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds the amount to the given property on all children in this Group.
|
||||
* Group.addAll('x', 10) will add 10 to the child.x value.
|
||||
|
@ -20905,7 +21052,7 @@ Phaser.ScaleManager.prototype = {
|
|||
orientationImage = '__default';
|
||||
}
|
||||
|
||||
this.orientationSprite = new Phaser.Image(this.game, this.game.width / 2, this.game.height / 2, PIXI.TextureCache[orientationImage]);
|
||||
this.orientationSprite = new Phaser.Image(this.game, this.game.width / 2, this.game.height / 2, orientationImage);
|
||||
this.orientationSprite.anchor.set(0.5);
|
||||
|
||||
this.checkOrientationState();
|
||||
|
@ -29926,6 +30073,9 @@ Phaser.BitmapData.prototype = {
|
|||
this.texture.width = width;
|
||||
this.texture.height = height;
|
||||
|
||||
this.texture.crop.width = width;
|
||||
this.texture.crop.height = height;
|
||||
|
||||
this.refreshBuffer();
|
||||
this.dirty = true;
|
||||
}
|
||||
|
@ -40504,6 +40654,15 @@ Phaser.TweenManager.prototype = {
|
|||
{
|
||||
this._tweens[i].pendingDelete = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
i = this._add.indexOf(tween);
|
||||
|
||||
if (i !== -1)
|
||||
{
|
||||
this._add[i].pendingDelete = true;
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
@ -40515,13 +40674,15 @@ Phaser.TweenManager.prototype = {
|
|||
*/
|
||||
update: function () {
|
||||
|
||||
if (this._tweens.length === 0 && this._add.length === 0)
|
||||
var addTweens = this._add.length;
|
||||
var numTweens = this._tweens.length;
|
||||
|
||||
if (numTweens === 0 && addTweens === 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var i = 0;
|
||||
var numTweens = this._tweens.length;
|
||||
|
||||
while (i < numTweens)
|
||||
{
|
||||
|
@ -40538,7 +40699,7 @@ Phaser.TweenManager.prototype = {
|
|||
}
|
||||
|
||||
// If there are any new tweens to be added, do so now - otherwise they can be spliced out of the array before ever running
|
||||
if (this._add.length > 0)
|
||||
if (addTweens > 0)
|
||||
{
|
||||
this._tweens = this._tweens.concat(this._add);
|
||||
this._add.length = 0;
|
||||
|
@ -43442,6 +43603,7 @@ Phaser.AnimationManager.prototype = {
|
|||
|
||||
this.currentAnim = this._anims[name];
|
||||
this.currentAnim.paused = false;
|
||||
this.currentFrame = this.currentAnim.currentFrame;
|
||||
return this.currentAnim.play(frameRate, loop, killOnComplete);
|
||||
}
|
||||
}
|
||||
|
@ -44249,7 +44411,7 @@ Phaser.Animation.prototype = {
|
|||
updateFrameData: function (frameData) {
|
||||
|
||||
this._frameData = frameData;
|
||||
this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]);
|
||||
this.currentFrame = this._frameData ? this._frameData.getFrame(this._frames[this._frameIndex % this._frames.length]) : null;
|
||||
|
||||
},
|
||||
|
||||
|
@ -57324,17 +57486,18 @@ Phaser.Tilemap.prototype = {
|
|||
* @method Phaser.Tilemap#swapHandler
|
||||
* @private
|
||||
* @param {number} value
|
||||
* @param {number} index
|
||||
*/
|
||||
swapHandler: function (value, index) {
|
||||
swapHandler: function (value) {
|
||||
|
||||
if (value.index === this._tempA)
|
||||
{
|
||||
this._results[index].index = this._tempB;
|
||||
// Swap A with B
|
||||
value.index = this._tempB;
|
||||
}
|
||||
if (value.index === this._tempB)
|
||||
else if (value.index === this._tempB)
|
||||
{
|
||||
this._results[index].index = this._tempA;
|
||||
// Swap B with A
|
||||
value.index = this._tempA;
|
||||
}
|
||||
|
||||
},
|
||||
|
|
File diff suppressed because one or more lines are too long
44
build/phaser.min.js
vendored
44
build/phaser.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue