This commit is contained in:
Richard Davey 2021-09-20 11:59:30 +01:00
commit cb6347d3b6
3 changed files with 52 additions and 47 deletions

View file

@ -1151,54 +1151,57 @@ var SceneManager = new Class({
var scene = this.getScene(key);
if (scene)
if (!scene)
{
var sys = scene.sys;
// If the Scene is already running (perhaps they called start from a launched sub-Scene?)
// then we close it down before starting it again.
if (sys.isActive() || sys.isPaused())
{
sys.shutdown();
sys.sceneUpdate = NOOP;
sys.start(data);
}
else
{
sys.sceneUpdate = NOOP;
sys.start(data);
var loader;
if (sys.load)
{
loader = sys.load;
}
// Files payload?
if (loader && sys.settings.hasOwnProperty('pack'))
{
loader.reset();
if (loader.addPack({ payload: sys.settings.pack }))
{
sys.settings.status = CONST.LOADING;
loader.once(LoaderEvents.COMPLETE, this.payloadComplete, this);
loader.start();
return this;
}
}
}
this.bootScene(scene);
console.warn('Scene not found for key: ' + key);
return this;
}
var sys = scene.sys;
// If the Scene is already running (perhaps they called start from a launched sub-Scene?)
// then we close it down before starting it again.
if (sys.isActive() || sys.isPaused())
{
sys.shutdown();
sys.sceneUpdate = NOOP;
sys.start(data);
}
else
{
sys.sceneUpdate = NOOP;
sys.start(data);
var loader;
if (sys.load)
{
loader = sys.load;
}
// Files payload?
if (loader && sys.settings.hasOwnProperty('pack'))
{
loader.reset();
if (loader.addPack({ payload: sys.settings.pack }))
{
sys.settings.status = CONST.LOADING;
loader.once(LoaderEvents.COMPLETE, this.payloadComplete, this);
loader.start();
return this;
}
}
}
this.bootScene(scene);
return this;
},

View file

@ -683,7 +683,9 @@ var Tilemap = new Class({
* This will convert all Objects with a gid of 26 into your custom `Coin` class. You can pass
* any class type here, but it _must_ extend `Phaser.GameObjects.GameObject` as its base class.
* Your class will always be passed 1 parameter: `scene`, which is a reference to either the Scene
* specified in the config object or, if not given, the Scene to which this Tilemap belongs.
* specified in the config object or, if not given, the Scene to which this Tilemap belongs. The
* class must have {@link Phaser.GameObjects.Components.Transform#setPosition} and
* {@link Phaser.GameObjects.Components.Texture#setTexture} methods.
*
* All properties from object are copied into the Game Object, so you can use this as an easy
* way to configure properties from within the map editor. For example giving an object a

View file

@ -5,7 +5,7 @@
* @property {number} [id] - A unique Object ID to convert.
* @property {number} [gid] - An Object GID to convert.
* @property {string} [name] - An Object Name to convert.
* @property {Phaser.GameObjects.GameObject} [classType=Phaser.GameObjects.Sprite] - A custom class type to convert the objects in to.
* @property {function} [classType] - A custom class type to convert the objects into. The default is {@link Phaser.GameObjects.Sprite}.
* @property {Phaser.Scene} [scene] - A Scene reference, passed to the Game Objects constructors.
* @property {Phaser.GameObjects.Container} [container] - Optional Container to which the Game Objects are added.
* @property {(string|Phaser.Textures.Texture)} [key] - Optional key of a Texture to be used, as stored in the Texture Manager, or a Texture instance.