The Scene Manager.
The Scene Manager is a Game level system, responsible for creating, processing and updating all of the Scenes in a Game instance. ó *
new SceneManager(game, sceneConfig)
name | type | description |
---|---|---|
game | Phaser.Game |
The Phaser.Game instance this Scene Manager belongs to. |
sceneConfig | object |
Scene specific configuration settings. |
Do any of the Cameras in any of the Scenes require a custom viewport? If not we can skip scissor tests.
Has the Scene Manager properly started?
Is the Scene Manager actively processing the Scenes list?
An object that maps the keys to the scene so we can quickly get a scene from a key without iteration.
The array in which all of the scenes are kept.
Adds a new Scene into the SceneManager. You must give each Scene a unique key by which you'll identify it.
The sceneConfig
can be:
Phaser.Scene
object, or an object that extends it.Phaser.Scene
If a function is given then a new Scene will be created by calling it.
name | type | arguments | Default | description |
---|---|---|---|---|
key | string |
A unique key used to reference the Scene, i.e. |
||
sceneConfig | function | Phaser.Scene | Phaser.Types.Scenes.SettingsConfig | Phaser.Types.Scenes.CreateSceneFromObjectConfig |
The config for the Scene |
||
autoStart | boolean | <optional> | false |
If |
data | object | <optional> |
Optional data object. This will be set as |
The added Scene, if it was added immediately, otherwise null
.
Brings a Scene to the top of the Scenes list.
This means it will render above all other Scenes.
name | type | description |
---|---|---|
key | string | Phaser.Scene |
The Scene to move. |
This SceneManager.
Destroy the SceneManager and all of its Scene's systems.
Dumps debug information about each Scene to the developer console.
Retrieves a Scene by numeric index.
name | type | description |
---|---|---|
index | number |
The index of the Scene to retrieve. |
The Scene.
Retrieves the numeric index of a Scene.
name | type | description |
---|---|---|
key | string | Phaser.Scene |
The key of the Scene. |
The index of the Scene.
Retrieves a Scene.
name | type | description |
---|---|---|
key | string | Phaser.Scene |
The Scene to retrieve. |
The Scene.
Returns an array of all the current Scenes being managed by this Scene Manager.
You can filter the output by the active state of the Scene and choose to have the array returned in normal or reversed order.
name | type | arguments | Default | description |
---|---|---|---|---|
isActive | boolean | <optional> | true |
Only include Scene's that are currently active? |
inReverse | boolean | <optional> | false |
Return the array of Scenes in reverse? |
An array containing all of the Scenes in the Scene Manager.
Determines whether a Scene is running.
name | type | description |
---|---|---|
key | string |
The Scene to check. |
Whether the Scene is running.
Determines whether a Scene is paused.
name | type | description |
---|---|---|
key | string |
The Scene to check. |
Whether the Scene is paused.
Determines whether a Scene is sleeping.
name | type | description |
---|---|---|
key | string |
The Scene to check. |
Whether the Scene is sleeping.
Determines whether a Scene is visible.
name | type | description |
---|---|---|
key | string |
The Scene to check. |
Whether the Scene is visible.
Moves a Scene so it is immediately above another Scene in the Scenes list.
This means it will render over the top of the other Scene.
name | type | description |
---|---|---|
keyA | string | Phaser.Scene |
The Scene that Scene B will be moved above. |
keyB | string | Phaser.Scene |
The Scene to be moved. |
This SceneManager.
Moves a Scene so it is immediately below another Scene in the Scenes list.
This means it will render behind the other Scene.
name | type | description |
---|---|---|
keyA | string | Phaser.Scene |
The Scene that Scene B will be moved above. |
keyB | string | Phaser.Scene |
The Scene to be moved. |
This SceneManager.
Moves a Scene down one position in the Scenes list.
name | type | description |
---|---|---|
key | string | Phaser.Scene |
The Scene to move. |
This SceneManager.
Moves a Scene up one position in the Scenes list.
name | type | description |
---|---|---|
key | string | Phaser.Scene |
The Scene to move. |
This SceneManager.
Pauses the given Scene.
name | type | arguments | description |
---|---|---|---|
key | string |
The Scene to pause. |
|
data | object | <optional> |
An optional data object that will be passed to the Scene and emitted by its pause event. |
This SceneManager.
Process the Scene operations queue.
Removes a Scene from the SceneManager.
The Scene is removed from the local scenes array, it's key is cleared from the keys cache and Scene.Systems.destroy is then called on it.
If the SceneManager is processing the Scenes when this method is called it will queue the operation for the next update sequence.
name | type | description |
---|---|---|
key | string |
A unique key used to reference the Scene, i.e. |
This SceneManager.
Renders the Scenes.
name | type | description |
---|---|---|
renderer | Phaser.Renderer.Canvas.CanvasRenderer | Phaser.Renderer.WebGL.WebGLRenderer |
The renderer to use. |
Resumes the given Scene.
name | type | arguments | description |
---|---|---|---|
key | string |
The Scene to resume. |
|
data | object | <optional> |
An optional data object that will be passed to the Scene and emitted by its resume event. |
This SceneManager.
Runs the given Scene.
If the given Scene is paused, it will resume it. If sleeping, it will wake it. If not running at all, it will be started.
Use this if you wish to open a modal Scene by calling pause
on the current
Scene, then run
on the modal Scene.
name | type | arguments | description |
---|---|---|---|
key | string |
The Scene to run. |
|
data | object | <optional> |
A data object that will be passed to the Scene on start, wake, or resume. |
This Scene Manager.
Sends a Scene to the back of the Scenes list.
This means it will render below all other Scenes.
name | type | description |
---|---|---|
key | string | Phaser.Scene |
The Scene to move. |
This SceneManager.
Puts the given Scene to sleep.
name | type | arguments | description |
---|---|---|---|
key | string |
The Scene to put to sleep. |
|
data | object | <optional> |
An optional data object that will be passed to the Scene and emitted by its sleep event. |
This SceneManager.
Starts the given Scene.
name | type | arguments | description |
---|---|---|---|
key | string |
The Scene to start. |
|
data | object | <optional> |
Optional data object to pass to |
This SceneManager.
Stops the given Scene.
name | type | arguments | description |
---|---|---|---|
key | string |
The Scene to stop. |
|
data | object | <optional> |
Optional data object to pass to Scene.shutdown. |
This SceneManager.
Swaps the positions of two Scenes in the Scenes list.
name | type | description |
---|---|---|
keyA | string | Phaser.Scene |
The first Scene to swap. |
keyB | string | Phaser.Scene |
The second Scene to swap. |
This SceneManager.
Sleeps one one Scene and starts the other.
name | type | description |
---|---|---|
from | string |
The Scene to sleep. |
to | string |
The Scene to start. |
This SceneManager.
Updates the Scenes.
name | type | description |
---|---|---|
time | number |
Time elapsed. |
delta | number |
Delta time from the last update. |
Awakens the given Scene.
name | type | arguments | description |
---|---|---|---|
key | string |
The Scene to wake up. |
|
data | object | <optional> |
An optional data object that will be passed to the Scene and emitted by its wake event. |
This SceneManager.