mirror of
https://github.com/wassname/phaser.git
synced 2026-07-28 11:23:50 +08:00
1.0.4 release
This commit is contained in:
+1
-20
@@ -31,25 +31,6 @@ Phaser.State = function () {
|
||||
|
||||
Phaser.State.prototype = {
|
||||
|
||||
link: function (game) {
|
||||
|
||||
this.game = game;
|
||||
this.add = game.add;
|
||||
this.camera = game.camera;
|
||||
this.cache = game.cache;
|
||||
this.input = game.input;
|
||||
this.load = game.load;
|
||||
this.math = game.math;
|
||||
this.sound = game.sound;
|
||||
this.stage = game.stage;
|
||||
this.time = game.time;
|
||||
this.tweens = game.tweens;
|
||||
this.world = game.world;
|
||||
this.particles = game.particles;
|
||||
this.physics = game.physics;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Override this method to add some load operations.
|
||||
* If you need to use the loader, you may need to use them here.
|
||||
@@ -59,7 +40,7 @@ Phaser.State.prototype = {
|
||||
|
||||
/**
|
||||
* This method is called after the game engine successfully switches states.
|
||||
* Feel free to add any setup code here.(Do not load anything here, override init() instead)
|
||||
* Feel free to add any setup code here.(Do not load anything here, override preload() instead)
|
||||
*/
|
||||
create: function () {
|
||||
},
|
||||
|
||||
@@ -145,7 +145,6 @@ Phaser.StateManager.prototype = {
|
||||
{
|
||||
// console.log('Phaser.StateManager.addState: Phaser.State given');
|
||||
newState = state;
|
||||
newState.link(this.game);
|
||||
}
|
||||
else if (typeof state === 'object')
|
||||
{
|
||||
@@ -326,12 +325,35 @@ Phaser.StateManager.prototype = {
|
||||
return false;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
link: function (key) {
|
||||
|
||||
// console.log('linked');
|
||||
this.states[key].game = this.game;
|
||||
this.states[key].add = this.game.add;
|
||||
this.states[key].camera = this.game.camera;
|
||||
this.states[key].cache = this.game.cache;
|
||||
this.states[key].input = this.game.input;
|
||||
this.states[key].load = this.game.load;
|
||||
this.states[key].math = this.game.math;
|
||||
this.states[key].sound = this.game.sound;
|
||||
this.states[key].stage = this.game.stage;
|
||||
this.states[key].time = this.game.time;
|
||||
this.states[key].tweens = this.game.tweens;
|
||||
this.states[key].world = this.game.world;
|
||||
this.states[key].particles = this.game.particles;
|
||||
this.states[key].physics = this.game.physics;
|
||||
this.states[key].rnd = this.game.rnd;
|
||||
|
||||
},
|
||||
|
||||
setCurrentState: function (key) {
|
||||
|
||||
this.callbackContext = this.states[key];
|
||||
|
||||
this.link(key);
|
||||
|
||||
// Used when the state is set as being the current active state
|
||||
this.onInitCallback = this.states[key]['init'] || this.dummy;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user