Trying to fix State order.

This commit is contained in:
Richard Davey 2017-02-07 19:53:04 +00:00
parent e0f0b3541b
commit 00ac45137d
3 changed files with 12 additions and 10 deletions

View file

@ -80,6 +80,8 @@ var CreateRenderer = function (game)
{
game.renderer = new CanvasRenderer(game);
game.context = game.renderer.gameContext;
// debug
game.canvas.id = 'game';
}
};

View file

@ -1,4 +1,4 @@
var CHECKSUM = {
build: 'd9e54760-ed4f-11e6-a917-0f5f0c1052e9'
build: 'ec84a400-ed6e-11e6-b72e-61e1cba6b1dc'
};
module.exports = CHECKSUM;

View file

@ -463,14 +463,6 @@ StateManager.prototype = {
console.log('loadComplete', state.sys.settings.key);
// Make sure to do load-update one last time before state is set to _created
// Stop doing this ...
if (state.hasOwnProperty('loadUpdate'))
{
state.loadUpdate.call(state);
}
this.startCreate(state);
},
@ -492,8 +484,14 @@ StateManager.prototype = {
this.active.push({ index: i, state: state });
// console.log('a1');
// console.dir(this.active);
// Sort the 'active' array based on the index property
this.active.sort(this.sortStates.bind(this));
this.active.sort(this.sortStates);
// console.log('a2');
// console.dir(this.active);
state.sys.updates.running = true;
},
@ -516,6 +514,8 @@ StateManager.prototype = {
sortStates: function (stateA, stateB)
{
// console.log('sortStates', stateA.state.sys.settings.key, stateA.index, stateB.state.sys.settings.key, stateB.index);
// Sort descending
if (stateA.index < stateB.index)
{