mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 20:53:39 +00:00
Merged source.
This commit is contained in:
parent
570cbde7da
commit
9a2eb0eb58
13 changed files with 268 additions and 294 deletions
|
@ -195,20 +195,275 @@ var TweenManager = new Class({
|
|||
return this;
|
||||
},
|
||||
|
||||
setGlobalTimeScale: require('./inc/SetGlobalTimeScale'),
|
||||
getGlobalTimeScale: require('./inc/GetGlobalTimeScale'),
|
||||
getAllTweens: require('./inc/GetAllTweens'),
|
||||
getTweensOf: require('./inc/GetTweensOf'),
|
||||
isTweening: require('./inc/IsTweening'),
|
||||
killAll: require('./inc/KillAll'),
|
||||
killTweensOf: require('./inc/KillTweensOf'),
|
||||
pauseAll: require('./inc/PauseAll'),
|
||||
resumeAll: require('./inc/ResumeAll'),
|
||||
each: require('./inc/Each'),
|
||||
shutdown: require('./inc/Shutdown'),
|
||||
destroy: require('./inc/Destroy')
|
||||
// Passes all Tweens to the given callback.
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.Tweens.TweenManager#each
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {function} callback - [description]
|
||||
* @param {object} [thisArg] - [description]
|
||||
* @param {...*} [arguments] - [description]
|
||||
*/
|
||||
each: function (callback, thisArg)
|
||||
{
|
||||
var args = [ null ];
|
||||
|
||||
for (var i = 1; i < arguments.length; i++)
|
||||
{
|
||||
args.push(arguments[i]);
|
||||
}
|
||||
|
||||
for (var texture in this.list)
|
||||
{
|
||||
args[0] = this.list[texture];
|
||||
|
||||
callback.apply(thisArg, args);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.Tweens.TweenManager#getAllTweens
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tweens.Tween[]} [description]
|
||||
*/
|
||||
getAllTweens: function ()
|
||||
{
|
||||
var list = this._active;
|
||||
var output = [];
|
||||
|
||||
for (var i = 0; i < list.length; i++)
|
||||
{
|
||||
output.push(list[i]);
|
||||
}
|
||||
|
||||
return output;
|
||||
},
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.Tweens.TweenManager#getGlobalTimeScale
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {number} [description]
|
||||
*/
|
||||
getGlobalTimeScale: function ()
|
||||
{
|
||||
return this.timeScale;
|
||||
},
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.Tweens.TweenManager#getTweensOf
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {object|array} target - [description]
|
||||
*
|
||||
* @return {Phaser.Tweens.Tween[]} [description]
|
||||
*/
|
||||
getTweensOf: function (target)
|
||||
{
|
||||
var list = this._active;
|
||||
var tween;
|
||||
var output = [];
|
||||
var i;
|
||||
|
||||
if (Array.isArray(target))
|
||||
{
|
||||
for (i = 0; i < list.length; i++)
|
||||
{
|
||||
tween = list[i];
|
||||
|
||||
for (var t = 0; t < target.length; i++)
|
||||
{
|
||||
if (tween.hasTarget(target[t]))
|
||||
{
|
||||
output.push(tween);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < list.length; i++)
|
||||
{
|
||||
tween = list[i];
|
||||
|
||||
if (tween.hasTarget(target))
|
||||
{
|
||||
output.push(tween);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
},
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.Tweens.TweenManager#isTweening
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {any} target - [description]
|
||||
*
|
||||
* @return {boolean} [description]
|
||||
*/
|
||||
isTweening: function (target)
|
||||
{
|
||||
var list = this._active;
|
||||
var tween;
|
||||
|
||||
for (var i = 0; i < list.length; i++)
|
||||
{
|
||||
tween = list[i];
|
||||
|
||||
if (tween.hasTarget(target) && tween.isPlaying())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.Tweens.TweenManager#killAll
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tweens.TweenManager} [description]
|
||||
*/
|
||||
killAll: function ()
|
||||
{
|
||||
var tweens = this.getAllTweens();
|
||||
|
||||
for (var i = 0; i < tweens.length; i++)
|
||||
{
|
||||
tweens[i].stop();
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.Tweens.TweenManager#killTweensOf
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {object|array} target - [description]
|
||||
*
|
||||
* @return {Phaser.Tweens.TweenManager} [description]
|
||||
*/
|
||||
killTweensOf: function (target)
|
||||
{
|
||||
var tweens = this.getTweensOf(target);
|
||||
|
||||
for (var i = 0; i < tweens.length; i++)
|
||||
{
|
||||
tweens[i].stop();
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.Tweens.TweenManager#pauseAll
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tweens.TweenManager} [description]
|
||||
*/
|
||||
pauseAll: function ()
|
||||
{
|
||||
var list = this._active;
|
||||
|
||||
for (var i = 0; i < list.length; i++)
|
||||
{
|
||||
list[i].pause();
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.Tweens.TweenManager#resumeAll
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tweens.TweenManager} [description]
|
||||
*/
|
||||
resumeAll: function ()
|
||||
{
|
||||
var list = this._active;
|
||||
|
||||
for (var i = 0; i < list.length; i++)
|
||||
{
|
||||
list[i].resume();
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.Tweens.TweenManager#setGlobalTimeScale
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {float} value - [description]
|
||||
*
|
||||
* @return {Phaser.Tweens.TweenManager} [description]
|
||||
*/
|
||||
setGlobalTimeScale: function (value)
|
||||
{
|
||||
this.timeScale = value;
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
// Scene that owns this manager is shutting down
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.Tweens.TweenManager#shutdown
|
||||
* @since 3.0.0
|
||||
*/
|
||||
shutdown: function ()
|
||||
{
|
||||
this.killAll();
|
||||
|
||||
this._add = [];
|
||||
this._pending = [];
|
||||
this._active = [];
|
||||
this._destroy = [];
|
||||
|
||||
this._toProcess = 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.Tweens.TweenManager#destroy
|
||||
* @since 3.0.0
|
||||
*/
|
||||
destroy: function ()
|
||||
{
|
||||
this.shutdown();
|
||||
}
|
||||
|
||||
// TODO: kill: function (vars, target)
|
||||
});
|
||||
|
||||
module.exports = TweenManager;
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.Tweens.TweenManager#destroy
|
||||
* @since 3.0.0
|
||||
*/
|
||||
var Destroy = function ()
|
||||
{
|
||||
this.shutdown();
|
||||
};
|
||||
|
||||
module.exports = Destroy;
|
|
@ -1,30 +0,0 @@
|
|||
// Passes all Tweens to the given callback.
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.Tweens.TweenManager#each
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {function} callback - [description]
|
||||
* @param {object} [thisArg] - [description]
|
||||
* @param {...*} [arguments] - [description]
|
||||
*/
|
||||
var Each = function (callback, thisArg)
|
||||
{
|
||||
var args = [ null ];
|
||||
|
||||
for (var i = 1; i < arguments.length; i++)
|
||||
{
|
||||
args.push(arguments[i]);
|
||||
}
|
||||
|
||||
for (var texture in this.list)
|
||||
{
|
||||
args[0] = this.list[texture];
|
||||
|
||||
callback.apply(thisArg, args);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = Each;
|
|
@ -1,22 +0,0 @@
|
|||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.Tweens.TweenManager#getAllTweens
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tweens.Tween[]} [description]
|
||||
*/
|
||||
var GetAllTweens = function ()
|
||||
{
|
||||
var list = this._active;
|
||||
var output = [];
|
||||
|
||||
for (var i = 0; i < list.length; i++)
|
||||
{
|
||||
output.push(list[i]);
|
||||
}
|
||||
|
||||
return output;
|
||||
};
|
||||
|
||||
module.exports = GetAllTweens;
|
|
@ -1,14 +0,0 @@
|
|||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.Tweens.TweenManager#getGlobalTimeScale
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {number} [description]
|
||||
*/
|
||||
var GetGlobalTimeScale = function ()
|
||||
{
|
||||
return this.timeScale;
|
||||
};
|
||||
|
||||
module.exports = GetGlobalTimeScale;
|
|
@ -1,49 +0,0 @@
|
|||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.Tweens.TweenManager#getTweensOf
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {object|array} target - [description]
|
||||
*
|
||||
* @return {Phaser.Tweens.Tween[]} [description]
|
||||
*/
|
||||
var GetTweensOf = function (target)
|
||||
{
|
||||
var list = this._active;
|
||||
var tween;
|
||||
var output = [];
|
||||
var i;
|
||||
|
||||
if (Array.isArray(target))
|
||||
{
|
||||
for (i = 0; i < list.length; i++)
|
||||
{
|
||||
tween = list[i];
|
||||
|
||||
for (var t = 0; t < target.length; i++)
|
||||
{
|
||||
if (tween.hasTarget(target[t]))
|
||||
{
|
||||
output.push(tween);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < list.length; i++)
|
||||
{
|
||||
tween = list[i];
|
||||
|
||||
if (tween.hasTarget(target))
|
||||
{
|
||||
output.push(tween);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
};
|
||||
|
||||
module.exports = GetTweensOf;
|
|
@ -1,29 +0,0 @@
|
|||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.Tweens.TweenManager#isTweening
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {any} target - [description]
|
||||
*
|
||||
* @return {boolean} [description]
|
||||
*/
|
||||
var IsTweening = function (target)
|
||||
{
|
||||
var list = this._active;
|
||||
var tween;
|
||||
|
||||
for (var i = 0; i < list.length; i++)
|
||||
{
|
||||
tween = list[i];
|
||||
|
||||
if (tween.hasTarget(target) && tween.isPlaying())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
module.exports = IsTweening;
|
|
@ -1,21 +0,0 @@
|
|||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.Tweens.TweenManager#killAll
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tweens.TweenManager} [description]
|
||||
*/
|
||||
var KillAll = function ()
|
||||
{
|
||||
var tweens = this.getAllTweens();
|
||||
|
||||
for (var i = 0; i < tweens.length; i++)
|
||||
{
|
||||
tweens[i].stop();
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
module.exports = KillAll;
|
|
@ -1,23 +0,0 @@
|
|||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.Tweens.TweenManager#killTweensOf
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {object|array} target - [description]
|
||||
*
|
||||
* @return {Phaser.Tweens.TweenManager} [description]
|
||||
*/
|
||||
var KillTweensOf = function (target)
|
||||
{
|
||||
var tweens = this.getTweensOf(target);
|
||||
|
||||
for (var i = 0; i < tweens.length; i++)
|
||||
{
|
||||
tweens[i].stop();
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
module.exports = KillTweensOf;
|
|
@ -1,21 +0,0 @@
|
|||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.Tweens.TweenManager#pauseAll
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tweens.TweenManager} [description]
|
||||
*/
|
||||
var PauseAll = function ()
|
||||
{
|
||||
var list = this._active;
|
||||
|
||||
for (var i = 0; i < list.length; i++)
|
||||
{
|
||||
list[i].pause();
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
module.exports = PauseAll;
|
|
@ -1,21 +0,0 @@
|
|||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.Tweens.TweenManager#resumeAll
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tweens.TweenManager} [description]
|
||||
*/
|
||||
var ResumeAll = function ()
|
||||
{
|
||||
var list = this._active;
|
||||
|
||||
for (var i = 0; i < list.length; i++)
|
||||
{
|
||||
list[i].resume();
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
module.exports = ResumeAll;
|
|
@ -1,18 +0,0 @@
|
|||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.Tweens.TweenManager#setGlobalTimeScale
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {float} value - [description]
|
||||
*
|
||||
* @return {Phaser.Tweens.TweenManager} [description]
|
||||
*/
|
||||
var SetGlobalTimeScale = function (value)
|
||||
{
|
||||
this.timeScale = value;
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
module.exports = SetGlobalTimeScale;
|
|
@ -1,21 +0,0 @@
|
|||
// Scene that owns this manager is shutting down
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @method Phaser.Tweens.TweenManager#shutdown
|
||||
* @since 3.0.0
|
||||
*/
|
||||
var Shutdown = function ()
|
||||
{
|
||||
this.killAll();
|
||||
|
||||
this._add = [];
|
||||
this._pending = [];
|
||||
this._active = [];
|
||||
this._destroy = [];
|
||||
|
||||
this._toProcess = 0;
|
||||
};
|
||||
|
||||
module.exports = Shutdown;
|
Loading…
Reference in a new issue