mirror of
https://github.com/photonstorm/phaser
synced 2024-11-16 01:38:23 +00:00
Can only sleep a running scene
This commit is contained in:
parent
fa8a25f6a8
commit
31cbacbe20
1 changed files with 16 additions and 14 deletions
|
@ -435,18 +435,13 @@ var Systems = new Class({
|
||||||
{
|
{
|
||||||
console.warn('Cannot pause non-running Scene', settings.key);
|
console.warn('Cannot pause non-running Scene', settings.key);
|
||||||
}
|
}
|
||||||
else
|
else if (this.settings.active)
|
||||||
{
|
{
|
||||||
var events = this.events;
|
settings.status = CONST.PAUSED;
|
||||||
|
|
||||||
if (this.settings.active)
|
settings.active = false;
|
||||||
{
|
|
||||||
settings.status = CONST.PAUSED;
|
|
||||||
|
|
||||||
settings.active = false;
|
this.events.emit(Events.PAUSE, this, data);
|
||||||
|
|
||||||
events.emit(Events.PAUSE, this, data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
@ -498,15 +493,22 @@ var Systems = new Class({
|
||||||
*/
|
*/
|
||||||
sleep: function (data)
|
sleep: function (data)
|
||||||
{
|
{
|
||||||
var events = this.events;
|
|
||||||
var settings = this.settings;
|
var settings = this.settings;
|
||||||
|
var status = this.getStatus();
|
||||||
|
|
||||||
settings.status = CONST.SLEEPING;
|
if (status !== CONST.CREATING || status !== CONST.RUNNING)
|
||||||
|
{
|
||||||
|
console.warn('Cannot sleep non-running Scene', settings.key);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
settings.status = CONST.SLEEPING;
|
||||||
|
|
||||||
settings.active = false;
|
settings.active = false;
|
||||||
settings.visible = false;
|
settings.visible = false;
|
||||||
|
|
||||||
events.emit(Events.SLEEP, this, data);
|
this.events.emit(Events.SLEEP, this, data);
|
||||||
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue