* Fixed small bug stopping Tween.pause / resume from resuming correctly when called directly.

* Fixed an issue where Tweens.removeAll wasn't clearing tweens in the addition queue.
* Change: When you swap State all active tweens are now purged.
This commit is contained in:
Richard Davey
2013-09-30 11:15:50 +01:00
parent 497d15b5bc
commit 31bbf05ace
10 changed files with 518 additions and 54 deletions
+16
View File
@@ -305,6 +305,22 @@ Object.defineProperty(Phaser.AnimationManager.prototype, "frameTotal", {
});
Object.defineProperty(Phaser.AnimationManager.prototype, "paused", {
get: function () {
return this.currentAnim.isPaused;
},
set: function (value) {
this.currentAnim.paused = value;
}
});
Object.defineProperty(Phaser.AnimationManager.prototype, "frame", {
/**
+3 -1
View File
@@ -235,7 +235,9 @@ Phaser.StateManager.prototype = {
this.onShutDownCallback.call(this.callbackContext);
}
if (clearWorld) {
if (clearWorld)
{
this.game.tweens.removeAll();
this.game.world.destroy();
+1
View File
@@ -151,6 +151,7 @@ Phaser.Button.prototype.onInputOutHandler = function (pointer) {
{
this.onInputOut.dispatch(this, pointer);
}
};
Phaser.Button.prototype.onInputDownHandler = function (pointer) {
+25 -3
View File
@@ -172,6 +172,7 @@ Phaser.Sound.prototype = {
// start and stop are in SECONDS.MS (2.5 = 2500ms, 0.5 = 500ms, etc)
// volume is between 0 and 1
/*
addMarker: function (name, start, stop, volume, loop) {
volume = volume || 1;
@@ -186,6 +187,25 @@ Phaser.Sound.prototype = {
loop: loop
};
},
*/
// start and stop are in SECONDS.MS (2.5 = 2500ms, 0.5 = 500ms, etc)
// volume is between 0 and 1
addMarker: function (name, start, duration, volume, loop) {
volume = volume || 1;
if (typeof loop == 'undefined') { loop = false; }
this.markers[name] = {
name: name,
start: start,
stop: start + duration,
volume: volume,
duration: duration,
loop: loop
};
},
removeMarker: function (name) {
@@ -266,9 +286,9 @@ Phaser.Sound.prototype = {
position = position || 0;
volume = volume || 1;
if (typeof loop == 'undefined') { loop = false; }
if (typeof forceRestart == 'undefined') { forceRestart = false; }
if (typeof forceRestart == 'undefined') { forceRestart = true; }
// console.log(this.name + ' play ' + marker + ' position ' + position + ' volume ' + volume + ' loop ' + loop);
console.log(this.name + ' play ' + marker + ' position ' + position + ' volume ' + volume + ' loop ' + loop, 'force', forceRestart);
if (this.isPlaying == true && forceRestart == false && this.override == false)
{
@@ -307,7 +327,7 @@ Phaser.Sound.prototype = {
this.loop = this.markers[marker].loop;
this.duration = this.markers[marker].duration * 1000;
// console.log('marker info loaded', this.loop, this.duration);
console.log('marker info loaded', this.loop, this.duration);
this._tempMarker = marker;
this._tempPosition = this.position;
this._tempVolume = this.volume;
@@ -315,6 +335,8 @@ Phaser.Sound.prototype = {
}
else
{
console.log('no marker info loaded');
this.position = position;
this.volume = volume;
this.loop = loop;
-2
View File
@@ -293,8 +293,6 @@ Phaser.SoundManager.prototype = {
volume = volume || 1;
if (typeof loop == 'undefined') { loop = false; }
var sound = new Phaser.Sound(this.game, key, volume, loop);
this._sounds.push(sound);
+5 -1
View File
@@ -246,11 +246,15 @@ Phaser.Tween.prototype = {
pause: function () {
this._paused = true;
this._pausedTime = this.game.time.now;
},
resume: function () {
this._paused = false;
this._startTime += this.game.time.pauseDuration;
this._startTime += (this.game.time.now - this._pausedTime);
},
update: function ( time ) {
+2 -1
View File
@@ -39,7 +39,8 @@ Phaser.TweenManager.prototype = {
*/
removeAll: function () {
this._tweens = [];
this._add.length = 0;
this._tweens.length = 0;
},