Fix bug in StateManager where a state's update function might not get called if it has an empty preload function

This commit is contained in:
TheJare 2013-09-20 22:23:00 +01:00
parent 8452fa0fd4
commit 4b6147d3e3
4 changed files with 11 additions and 39 deletions

1
.gitignore vendored
View file

@ -4,3 +4,4 @@ Phaser OSX.sublime-project
Phaser OSX.sublime-workspace Phaser OSX.sublime-workspace
Phaser.sublime-project Phaser.sublime-project
Phaser.sublime-workspace Phaser.sublime-workspace
node_modules

View file

@ -1,7 +1,7 @@
/** /**
* Phaser - http://www.phaser.io * Phaser - http://www.phaser.io
* *
* v1.0.5 - Built at: Fri, 20 Sep 2013 12:59:22 +0000 * v1.0.5 - Built at: Fri, 20 Sep 2013 21:16:39 +0000
* *
* @author Richard Davey http://www.photonstorm.com @photonstorm * @author Richard Davey http://www.photonstorm.com @photonstorm
* *
@ -7864,13 +7864,6 @@ Phaser.StateManager.prototype = {
{ {
// console.log('Loader queue empty'); // console.log('Loader queue empty');
this.game.loadComplete(); this.game.loadComplete();
if (this.onCreateCallback)
{
this.onCreateCallback.call(this.callbackContext);
}
this._created = true;
} }
else else
{ {
@ -7883,14 +7876,6 @@ Phaser.StateManager.prototype = {
{ {
// console.log('Preload callback not found'); // console.log('Preload callback not found');
// No init? Then there was nothing to load either // No init? Then there was nothing to load either
if (this.onCreateCallback)
{
// console.log('Create callback found');
this.onCreateCallback.call(this.callbackContext);
}
this._created = true;
this.game.loadComplete(); this.game.loadComplete();
} }
@ -7988,9 +7973,9 @@ Phaser.StateManager.prototype = {
if (this._created == false && this.onCreateCallback) if (this._created == false && this.onCreateCallback)
{ {
// console.log('Create callback found'); // console.log('Create callback found');
this._created = true;
this.onCreateCallback.call(this.callbackContext); this.onCreateCallback.call(this.callbackContext);
} }
this._created = true;
}, },
@ -8061,6 +8046,7 @@ Phaser.StateManager.prototype = {
} }
}; };
Phaser.LinkedList = function () { Phaser.LinkedList = function () {
this.next = null; this.next = null;
@ -21681,12 +21667,12 @@ Phaser.Animation.FrameData.prototype = {
if (useNumericIndex) if (useNumericIndex)
{ {
// The actual frame // The actual frame
output.push(this.getFrame(input[i])); output.push(this.getFrame(frames[i]));
} }
else else
{ {
// The actual frame // The actual frame
output.push(this.getFrameByName(input[i])); output.push(this.getFrameByName(frames[i]));
} }
} }
} }
@ -21726,7 +21712,7 @@ Phaser.Animation.FrameData.prototype = {
// Does the frames array contain names or indexes? // Does the frames array contain names or indexes?
if (useNumericIndex) if (useNumericIndex)
{ {
output.push(frames[i].index); output.push(frames[i]);
} }
else else
{ {

2
build/phaser.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -259,13 +259,6 @@ Phaser.StateManager.prototype = {
{ {
// console.log('Loader queue empty'); // console.log('Loader queue empty');
this.game.loadComplete(); this.game.loadComplete();
if (this.onCreateCallback)
{
this.onCreateCallback.call(this.callbackContext);
}
this._created = true;
} }
else else
{ {
@ -278,14 +271,6 @@ Phaser.StateManager.prototype = {
{ {
// console.log('Preload callback not found'); // console.log('Preload callback not found');
// No init? Then there was nothing to load either // No init? Then there was nothing to load either
if (this.onCreateCallback)
{
// console.log('Create callback found');
this.onCreateCallback.call(this.callbackContext);
}
this._created = true;
this.game.loadComplete(); this.game.loadComplete();
} }
@ -383,9 +368,9 @@ Phaser.StateManager.prototype = {
if (this._created == false && this.onCreateCallback) if (this._created == false && this.onCreateCallback)
{ {
// console.log('Create callback found'); // console.log('Create callback found');
this._created = true;
this.onCreateCallback.call(this.callbackContext); this.onCreateCallback.call(this.callbackContext);
} }
this._created = true;
}, },