mirror of
https://github.com/wassname/phaser.git
synced 2026-09-11 12:31:29 +08:00
Fixed various issues in the TweenManager, added length property to Group and improved the build script.
This commit is contained in:
@@ -13,6 +13,7 @@ Phaser.TweenManager = function (game) {
|
||||
|
||||
this.game = game;
|
||||
this._tweens = [];
|
||||
this._add = [];
|
||||
|
||||
this.game.onPause.add(this.pauseAll, this);
|
||||
this.game.onResume.add(this.resumeAll, this);
|
||||
@@ -50,7 +51,7 @@ Phaser.TweenManager.prototype = {
|
||||
*/
|
||||
add: function ( tween ) {
|
||||
|
||||
this._tweens.push( tween );
|
||||
this._add.push( tween );
|
||||
|
||||
},
|
||||
|
||||
@@ -77,7 +78,7 @@ Phaser.TweenManager.prototype = {
|
||||
|
||||
if ( i !== -1 ) {
|
||||
|
||||
this._tweens.splice( i, 1 );
|
||||
this._tweens[i].pendingDelete = true;
|
||||
|
||||
}
|
||||
|
||||
@@ -90,9 +91,10 @@ Phaser.TweenManager.prototype = {
|
||||
*/
|
||||
update: function () {
|
||||
|
||||
if ( this._tweens.length === 0 ) return false;
|
||||
if ( this._tweens.length === 0 && this._add.length === 0 ) return false;
|
||||
|
||||
var i = 0, numTweens = this._tweens.length;
|
||||
var i = 0;
|
||||
var numTweens = this._tweens.length;
|
||||
|
||||
while ( i < numTweens ) {
|
||||
|
||||
@@ -110,6 +112,13 @@ 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)
|
||||
{
|
||||
this._tweens = this._tweens.concat(this._add);
|
||||
this._add.length = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user