mirror of
https://github.com/wassname/phaser.git
synced 2026-07-28 11:23:50 +08:00
Updated documentation.
This commit is contained in:
+188
-145
@@ -54,6 +54,10 @@
|
||||
<a href="Phaser.AnimationParser.html">AnimationParser</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.BitmapData.html">BitmapData</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.BitmapText.html">BitmapText</a>
|
||||
</li>
|
||||
@@ -138,6 +142,10 @@
|
||||
<a href="Phaser.Events.html">Events</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Filter.html">Filter</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Frame.html">Frame</a>
|
||||
</li>
|
||||
@@ -302,6 +310,26 @@
|
||||
<a href="Phaser.Text.html">Text</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Tile.html">Tile</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Tilemap.html">Tilemap</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.TilemapParser.html">TilemapParser</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Tileset.html">Tileset</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.TileSprite.html">TileSprite</a>
|
||||
</li>
|
||||
@@ -310,6 +338,10 @@
|
||||
<a href="Phaser.Time.html">Time</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Timer.html">Timer</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="Phaser.Touch.html">Touch</a>
|
||||
</li>
|
||||
@@ -356,6 +388,14 @@
|
||||
<a href="global.html#HEXtoRGB">HEXtoRGB</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="global.html#render">render</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="global.html#renderXY">renderXY</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="global.html#right">right</a>
|
||||
</li>
|
||||
@@ -405,180 +445,183 @@
|
||||
*/
|
||||
Phaser.TweenManager = function (game) {
|
||||
|
||||
/**
|
||||
* @property {Phaser.Game} game - Local reference to game.
|
||||
*/
|
||||
this.game = game;
|
||||
|
||||
/**
|
||||
* @property {array} _tweens - Description.
|
||||
* @private
|
||||
*/
|
||||
this._tweens = [];
|
||||
|
||||
/**
|
||||
* @property {array} _add - Description.
|
||||
* @private
|
||||
*/
|
||||
this._add = [];
|
||||
/**
|
||||
* @property {Phaser.Game} game - Local reference to game.
|
||||
*/
|
||||
this.game = game;
|
||||
|
||||
/**
|
||||
* @property {array} _tweens - Description.
|
||||
* @private
|
||||
*/
|
||||
this._tweens = [];
|
||||
|
||||
/**
|
||||
* @property {array} _add - Description.
|
||||
* @private
|
||||
*/
|
||||
this._add = [];
|
||||
|
||||
this.game.onPause.add(this.pauseAll, this);
|
||||
this.game.onResume.add(this.resumeAll, this);
|
||||
this.game.onPause.add(this.pauseAll, this);
|
||||
this.game.onResume.add(this.resumeAll, this);
|
||||
|
||||
};
|
||||
|
||||
Phaser.TweenManager.prototype = {
|
||||
|
||||
/**
|
||||
* Version number of this library.
|
||||
* @property {string} REVISION
|
||||
* @default
|
||||
*/
|
||||
REVISION: '11dev',
|
||||
/**
|
||||
* Version number of this library.
|
||||
* @property {string} REVISION
|
||||
* @default
|
||||
*/
|
||||
REVISION: '11dev',
|
||||
|
||||
/**
|
||||
* Get all the tween objects in an array.
|
||||
* @method Phaser.TweenManager#getAll
|
||||
* @returns {Phaser.Tween[]} Array with all tween objects.
|
||||
*/
|
||||
getAll: function () {
|
||||
/**
|
||||
* Get all the tween objects in an array.
|
||||
* @method Phaser.TweenManager#getAll
|
||||
* @returns {Phaser.Tween[]} Array with all tween objects.
|
||||
*/
|
||||
getAll: function () {
|
||||
|
||||
return this._tweens;
|
||||
return this._tweens;
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove all tween objects.
|
||||
* @method Phaser.TweenManager#removeAll
|
||||
*/
|
||||
removeAll: function () {
|
||||
/**
|
||||
* Remove all tween objects.
|
||||
* @method Phaser.TweenManager#removeAll
|
||||
*/
|
||||
removeAll: function () {
|
||||
|
||||
this._tweens = [];
|
||||
this._tweens = [];
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* Add a new tween into the TweenManager.
|
||||
*
|
||||
* @method Phaser.TweenManager#add
|
||||
* @param {Phaser.Tween} tween - The tween object you want to add.
|
||||
* @returns {Phaser.Tween} The tween object you added to the manager.
|
||||
*/
|
||||
add: function ( tween ) {
|
||||
/**
|
||||
* Add a new tween into the TweenManager.
|
||||
*
|
||||
* @method Phaser.TweenManager#add
|
||||
* @param {Phaser.Tween} tween - The tween object you want to add.
|
||||
* @returns {Phaser.Tween} The tween object you added to the manager.
|
||||
*/
|
||||
add: function ( tween ) {
|
||||
|
||||
this._add.push( tween );
|
||||
this._add.push( tween );
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* Create a tween object for a specific object. The object can be any JavaScript object or Phaser object such as Sprite.
|
||||
*
|
||||
* @method Phaser.TweenManager#create
|
||||
* @param {Object} object - Object the tween will be run on.
|
||||
* @returns {Phaser.Tween} The newly created tween object.
|
||||
*/
|
||||
/**
|
||||
* Create a tween object for a specific object. The object can be any JavaScript object or Phaser object such as Sprite.
|
||||
*
|
||||
* @method Phaser.TweenManager#create
|
||||
* @param {Object} object - Object the tween will be run on.
|
||||
* @returns {Phaser.Tween} The newly created tween object.
|
||||
*/
|
||||
create: function (object) {
|
||||
|
||||
return new Phaser.Tween(object, this.game);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove a tween from this manager.
|
||||
*
|
||||
* @method Phaser.TweenManager#remove
|
||||
* @param {Phaser.Tween} tween - The tween object you want to remove.
|
||||
*/
|
||||
remove: function ( tween ) {
|
||||
/**
|
||||
* Remove a tween from this manager.
|
||||
*
|
||||
* @method Phaser.TweenManager#remove
|
||||
* @param {Phaser.Tween} tween - The tween object you want to remove.
|
||||
*/
|
||||
remove: function ( tween ) {
|
||||
|
||||
var i = this._tweens.indexOf( tween );
|
||||
var i = this._tweens.indexOf( tween );
|
||||
|
||||
if ( i !== -1 ) {
|
||||
if ( i !== -1 ) {
|
||||
|
||||
this._tweens[i].pendingDelete = true;
|
||||
this._tweens[i].pendingDelete = true;
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Update all the tween objects you added to this manager.
|
||||
*
|
||||
* @method Phaser.TweenManager#update
|
||||
* @returns {boolean} Return false if there's no tween to update, otherwise return true.
|
||||
*/
|
||||
update: function () {
|
||||
|
||||
if ( this._tweens.length === 0 && this._add.length === 0 ) return false;
|
||||
|
||||
var i = 0;
|
||||
var numTweens = this._tweens.length;
|
||||
|
||||
while ( i < numTweens ) {
|
||||
|
||||
if ( this._tweens[ i ].update( this.game.time.now ) ) {
|
||||
|
||||
i++;
|
||||
|
||||
} else {
|
||||
|
||||
this._tweens.splice( i, 1 );
|
||||
|
||||
numTweens--;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks to see if a particular Sprite is currently being tweened.
|
||||
*
|
||||
* @method Phaser.TweenManager#isTweening
|
||||
* @param {object} object - The object to check for tweens against.
|
||||
* @returns {boolean} Returns true if the object is currently being tweened, false if not.
|
||||
*/
|
||||
isTweening: function(object) {
|
||||
|
||||
return this._tweens.some(function(tween) {
|
||||
return tween._object === object;
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Pauses all currently running tweens.
|
||||
*
|
||||
* @method Phaser.TweenManager#update
|
||||
*/
|
||||
pauseAll: function () {
|
||||
|
||||
for (var i = this._tweens.length - 1; i >= 0; i--) {
|
||||
this._tweens[i].pause();
|
||||
};
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Pauses all currently paused tweens.
|
||||
*
|
||||
* @method Phaser.TweenManager#resumeAll
|
||||
*/
|
||||
resumeAll: function () {
|
||||
/**
|
||||
* Update all the tween objects you added to this manager.
|
||||
*
|
||||
* @method Phaser.TweenManager#update
|
||||
* @returns {boolean} Return false if there's no tween to update, otherwise return true.
|
||||
*/
|
||||
update: function () {
|
||||
|
||||
for (var i = this._tweens.length - 1; i >= 0; i--) {
|
||||
this._tweens[i].resume();
|
||||
};
|
||||
if ( this._tweens.length === 0 && this._add.length === 0 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var i = 0;
|
||||
var numTweens = this._tweens.length;
|
||||
|
||||
while ( i < numTweens ) {
|
||||
|
||||
if ( this._tweens[ i ].update( this.game.time.now ) ) {
|
||||
|
||||
i++;
|
||||
|
||||
} else {
|
||||
|
||||
this._tweens.splice( i, 1 );
|
||||
|
||||
numTweens--;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks to see if a particular Sprite is currently being tweened.
|
||||
*
|
||||
* @method Phaser.TweenManager#isTweening
|
||||
* @param {object} object - The object to check for tweens against.
|
||||
* @returns {boolean} Returns true if the object is currently being tweened, false if not.
|
||||
*/
|
||||
isTweening: function(object) {
|
||||
|
||||
return this._tweens.some(function(tween) {
|
||||
return tween._object === object;
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Pauses all currently running tweens.
|
||||
*
|
||||
* @method Phaser.TweenManager#update
|
||||
*/
|
||||
pauseAll: function () {
|
||||
|
||||
for (var i = this._tweens.length - 1; i >= 0; i--) {
|
||||
this._tweens[i].pause();
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Pauses all currently paused tweens.
|
||||
*
|
||||
* @method Phaser.TweenManager#resumeAll
|
||||
*/
|
||||
resumeAll: function () {
|
||||
|
||||
for (var i = this._tweens.length - 1; i >= 0; i--) {
|
||||
this._tweens[i].resume();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -603,7 +646,7 @@ Phaser.TweenManager.prototype = {
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||
on Thu Nov 07 2013 06:07:33 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user