@@ -359,6 +359,7 @@ GlobalStateManager.prototype = {
359359 if ( data === undefined ) { data = { } ; }
360360
361361 // console.log('start:', key);
362+ // console.dir(data);
362363
363364 // if not booted, then put state into a holding pattern
364365 if ( ! this . game . isBooted )
@@ -391,6 +392,8 @@ GlobalStateManager.prototype = {
391392
392393 state . settings . active = true ;
393394
395+ state . settings . data = data ;
396+
394397 var loader = state . sys . load ;
395398
396399 // Files payload?
@@ -400,39 +403,38 @@ GlobalStateManager.prototype = {
400403
401404 if ( loader . loadArray ( state . sys . settings . files ) )
402405 {
403- loader . events . once ( 'LOADER_COMPLETE_EVENT' , this . payloadComplete . bind ( this , data ) ) ;
406+ loader . events . once ( 'LOADER_COMPLETE_EVENT' , this . payloadComplete . bind ( this ) ) ;
404407
405408 loader . start ( ) ;
406409 }
407410 else
408411 {
409- this . bootState ( state , data ) ;
412+ this . bootState ( state ) ;
410413 }
411414 }
412415 else
413416 {
414- this . bootState ( state , data ) ;
417+ this . bootState ( state ) ;
415418 }
416419 }
417420 } ,
418421
419- payloadComplete : function ( event , data )
422+ payloadComplete : function ( event )
420423 {
421424 var state = event . loader . state ;
422425
423426 // console.log('payloadComplete', state.sys.settings.key);
424427
425- this . bootState ( state , data ) ;
428+ this . bootState ( state ) ;
426429 } ,
427430
428- bootState : function ( state , data )
431+ bootState : function ( state )
429432 {
430- console . log ( 'bootState' , state . sys . settings . key ) ;
431- console . dir ( data ) ;
433+ // console.log('bootState', state.sys.settings.key);
432434
433435 if ( state . init )
434436 {
435- state . init . call ( state , data ) ;
437+ state . init . call ( state , state . sys . settings . data ) ;
436438 }
437439
438440 var loader = state . sys . load ;
@@ -446,36 +448,36 @@ GlobalStateManager.prototype = {
446448 // Is the loader empty?
447449 if ( loader . list . size === 0 )
448450 {
449- this . create ( state , data ) ;
451+ this . create ( state ) ;
450452 }
451453 else
452454 {
453455 // Start the loader going as we have something in the queue
454456
455- loader . events . once ( 'LOADER_COMPLETE_EVENT' , this . loadComplete . bind ( this , { } , data ) ) ;
457+ loader . events . once ( 'LOADER_COMPLETE_EVENT' , this . loadComplete . bind ( this ) ) ;
456458
457459 loader . start ( ) ;
458460 }
459461 }
460462 else
461463 {
462464 // No preload? Then there was nothing to load either
463- this . create ( state , data ) ;
465+ this . create ( state ) ;
464466 }
465467 } ,
466468
467- loadComplete : function ( event , data )
469+ loadComplete : function ( event )
468470 {
469471 var state = event . loader . state ;
470472
471473 // console.log('loadComplete', state.sys.settings.key);
472474
473- this . create ( state , data ) ;
475+ this . create ( state ) ;
474476 } ,
475477
476- create : function ( state , data )
478+ create : function ( state )
477479 {
478- console . log ( 'create' , state . sys . settings . key ) ;
480+ // console.log('create', state.sys.settings.key);
479481
480482 // Insert at the correct index, or it just all goes wrong :)
481483
@@ -492,7 +494,7 @@ GlobalStateManager.prototype = {
492494
493495 if ( state . create )
494496 {
495- state . create ( data ) ;
497+ state . create ( state . sys . settings . data ) ;
496498 }
497499 } ,
498500
0 commit comments