mirror of
https://github.com/wassname/phaser.git
synced 2026-06-27 16:10:15 +08:00
The StateManager now looks for a function called 'resumed' which is called when a game un-pauses (fixes #358)
This commit is contained in:
@@ -124,6 +124,7 @@ New features:
|
||||
* Tilemap.createCollisionObjects will parse Tiled data for objectgroups and convert polyline instances into physics objects you can collide with in the world.
|
||||
* Loader can now load JSON files specifically (game.load.json) and they are parsed and stored in the Game.Cache. Retrieve with game.cache.getJSON(key).
|
||||
* TileSprites can now receive full Input events, dragging, etc and be positioned in-world and fixed to cameras.
|
||||
* The StateManager now looks for a function called 'resumed' which is called when a game un-pauses.
|
||||
|
||||
|
||||
Updates:
|
||||
|
||||
@@ -93,6 +93,11 @@ Phaser.StateManager = function (game, pendingState) {
|
||||
*/
|
||||
this.onPausedCallback = null;
|
||||
|
||||
/**
|
||||
* @property {function} onResumedCallback - This will be called when the state is resumed from a paused state.
|
||||
*/
|
||||
this.onResumedCallback = null;
|
||||
|
||||
/**
|
||||
* @property {function} onShutDownCallback - This will be called when the state is shut down (i.e. swapped to another state).
|
||||
*/
|
||||
@@ -195,6 +200,7 @@ Phaser.StateManager.prototype = {
|
||||
this.onUpdateCallback = null;
|
||||
this.onRenderCallback = null;
|
||||
this.onPausedCallback = null;
|
||||
this.onResumedCallback = null;
|
||||
this.onDestroyCallback = null;
|
||||
}
|
||||
|
||||
@@ -370,6 +376,7 @@ Phaser.StateManager.prototype = {
|
||||
this.onPreRenderCallback = this.states[key]['preRender'] || null;
|
||||
this.onRenderCallback = this.states[key]['render'] || null;
|
||||
this.onPausedCallback = this.states[key]['paused'] || null;
|
||||
this.onResumedCallback = this.states[key]['resumed'] || null;
|
||||
|
||||
// Used when the state is no longer the current active state
|
||||
this.onShutDownCallback = this.states[key]['shutdown'] || this.dummy;
|
||||
@@ -418,7 +425,7 @@ Phaser.StateManager.prototype = {
|
||||
|
||||
if (this._created && this.onPausedCallback)
|
||||
{
|
||||
this.onPausedCallback.call(this.callbackContext, this.game, true);
|
||||
this.onPausedCallback.call(this.callbackContext, this.game);
|
||||
}
|
||||
|
||||
},
|
||||
@@ -429,9 +436,9 @@ Phaser.StateManager.prototype = {
|
||||
*/
|
||||
resume: function () {
|
||||
|
||||
if (this._created && this.onre)
|
||||
if (this._created && this.onResumedCallback)
|
||||
{
|
||||
this.onPausedCallback.call(this.callbackContext, this.game, false);
|
||||
this.onResumedCallback.call(this.callbackContext, this.game);
|
||||
}
|
||||
|
||||
},
|
||||
@@ -518,6 +525,7 @@ Phaser.StateManager.prototype = {
|
||||
this.onUpdateCallback = null;
|
||||
this.onRenderCallback = null;
|
||||
this.onPausedCallback = null;
|
||||
this.onResumedCallback = null;
|
||||
this.onDestroyCallback = null;
|
||||
|
||||
this.game = null;
|
||||
|
||||
Reference in New Issue
Block a user