2018-02-12 16:01:20 +00:00
|
|
|
/**
|
|
|
|
* @author Richard Davey <rich@photonstorm.com>
|
|
|
|
* @copyright 2018 Photon Storm Ltd.
|
|
|
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
|
|
|
*/
|
|
|
|
|
2018-01-16 19:49:13 +00:00
|
|
|
var Class = require('../utils/Class');
|
2018-01-20 04:47:03 +00:00
|
|
|
var CONST = require('./const');
|
2018-01-26 05:21:45 +00:00
|
|
|
var CoreScenePlugins = require('../plugins/CoreScenePlugins');
|
2018-01-18 05:20:57 +00:00
|
|
|
var GetPhysicsPlugins = require('./GetPhysicsPlugins');
|
|
|
|
var GetScenePlugins = require('./GetScenePlugins');
|
2018-01-26 05:21:45 +00:00
|
|
|
var GlobalPlugins = require('../plugins/GlobalPlugins');
|
2018-01-17 03:41:58 +00:00
|
|
|
var Settings = require('./Settings');
|
2018-01-10 16:29:37 +00:00
|
|
|
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* @classdesc
|
|
|
|
* The Scene Systems class.
|
|
|
|
*
|
|
|
|
* This class is available from within a Scene under the property `sys`.
|
|
|
|
* It is responsible for managing all of the plugins a Scene has running, including the display list, and
|
|
|
|
* handling the update step and renderer. It also contains references to global systems belonging to Game.
|
|
|
|
*
|
|
|
|
* @class Systems
|
|
|
|
* @memberOf Phaser.Scenes
|
|
|
|
* @constructor
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {Phaser.Scene} scene - The Scene that owns this Systems instance.
|
|
|
|
* @param {object} config - Scene specific configuration settings.
|
|
|
|
*/
|
2017-07-04 12:58:45 +00:00
|
|
|
var Systems = new Class({
|
2016-11-29 15:25:14 +00:00
|
|
|
|
2017-07-04 12:58:45 +00:00
|
|
|
initialize:
|
2016-12-06 16:49:29 +00:00
|
|
|
|
2017-07-14 13:30:20 +00:00
|
|
|
function Systems (scene, config)
|
2017-07-04 12:58:45 +00:00
|
|
|
{
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Scenes.Systems#scene
|
|
|
|
* @type {Phaser.Scene}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-07-14 13:30:20 +00:00
|
|
|
this.scene = scene;
|
2017-07-04 12:58:45 +00:00
|
|
|
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Scenes.Systems#game
|
|
|
|
* @type {Phaser.Game}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2018-01-12 17:09:09 +00:00
|
|
|
this.game;
|
|
|
|
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Scenes.Systems#config
|
|
|
|
* @type {object}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-07-04 12:58:45 +00:00
|
|
|
this.config = config;
|
2018-01-12 17:09:09 +00:00
|
|
|
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Scenes.Systems#settings
|
|
|
|
* @type {[type]}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-07-04 12:58:45 +00:00
|
|
|
this.settings = Settings.create(config);
|
2017-04-04 22:59:02 +00:00
|
|
|
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* A handy reference to the Scene canvas / context.
|
|
|
|
*
|
|
|
|
* @name Phaser.Scenes.Systems#canvas
|
|
|
|
* @type {HTMLCanvasElement}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-07-04 12:58:45 +00:00
|
|
|
this.canvas;
|
2018-02-12 15:18:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Scenes.Systems#context
|
|
|
|
* @type {CanvasRenderingContext2D}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-07-04 12:58:45 +00:00
|
|
|
this.context;
|
2017-04-04 22:59:02 +00:00
|
|
|
|
2018-01-18 05:20:57 +00:00
|
|
|
// Global Systems - these are single-instance global managers that belong to Game
|
2017-01-26 04:06:10 +00:00
|
|
|
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Scenes.Systems#anims
|
|
|
|
* @type {Phaser.Animations.AnimationManager}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-07-04 12:58:45 +00:00
|
|
|
this.anims;
|
2018-02-12 15:18:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Scenes.Systems#cache
|
|
|
|
* @type {Phaser.Cache.CacheManager}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-07-04 12:58:45 +00:00
|
|
|
this.cache;
|
2018-02-12 15:18:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Scenes.Systems#plugins
|
|
|
|
* @type {Phaser.Plugins.PluginManager}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2018-01-18 16:48:25 +00:00
|
|
|
this.plugins;
|
2018-02-12 15:18:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Scenes.Systems#registry
|
|
|
|
* @type {[type]}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-07-04 12:58:45 +00:00
|
|
|
this.registry;
|
2018-02-12 15:18:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Scenes.Systems#sound
|
|
|
|
* @type {Phaser.Sound.BaseSoundManager}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2018-01-11 14:48:43 +00:00
|
|
|
this.sound;
|
2018-02-12 15:18:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Scenes.Systems#textures
|
|
|
|
* @type {Phaser.Textures.TextureManager}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-07-04 12:58:45 +00:00
|
|
|
this.textures;
|
2016-11-29 15:25:14 +00:00
|
|
|
|
2018-01-18 05:20:57 +00:00
|
|
|
// Core Plugins - these are non-optional Scene plugins, needed by lots of the other systems
|
2018-01-12 17:09:09 +00:00
|
|
|
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Scenes.Systems#add
|
|
|
|
* @type {Phaser.GameObjects.GameObjectFactory}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2018-01-16 02:08:22 +00:00
|
|
|
this.add;
|
2018-02-12 15:18:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Scenes.Systems#cameras
|
|
|
|
* @type {Phaser.Cameras.Scene2D.CameraManager}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-07-04 12:58:45 +00:00
|
|
|
this.cameras;
|
2018-02-12 15:18:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Scenes.Systems#displayList
|
|
|
|
* @type {null}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-08-15 22:36:46 +00:00
|
|
|
this.displayList;
|
2018-02-12 15:18:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Scenes.Systems#events
|
|
|
|
* @type {EventEmitter3}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-07-04 12:58:45 +00:00
|
|
|
this.events;
|
2018-02-12 15:18:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Scenes.Systems#make
|
|
|
|
* @type {Phaser.GameObjects.GameObjectCreator}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2018-01-16 02:08:22 +00:00
|
|
|
this.make;
|
2018-02-12 15:18:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Scenes.Systems#scenePlugin
|
|
|
|
* @type {Phaser.Scenes.ScenePlugin}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2018-01-18 05:20:57 +00:00
|
|
|
this.scenePlugin;
|
2018-02-12 15:18:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Scenes.Systems#updateList
|
|
|
|
* @type {[type]}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2018-01-12 17:09:09 +00:00
|
|
|
this.updateList;
|
2017-07-04 12:58:45 +00:00
|
|
|
},
|
2016-11-29 15:25:14 +00:00
|
|
|
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Scenes.Systems#init
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {Phaser.Game} game - A reference to the Phaser Game
|
|
|
|
*/
|
2017-01-25 17:10:19 +00:00
|
|
|
init: function (game)
|
2016-11-29 15:25:14 +00:00
|
|
|
{
|
2018-01-20 16:22:40 +00:00
|
|
|
this.settings.status = CONST.INIT;
|
|
|
|
|
2017-01-25 17:10:19 +00:00
|
|
|
this.game = game;
|
2016-11-29 15:25:14 +00:00
|
|
|
|
2018-01-20 04:47:03 +00:00
|
|
|
this.canvas = game.canvas;
|
|
|
|
this.context = game.context;
|
|
|
|
|
2018-01-18 16:48:25 +00:00
|
|
|
var pluginManager = game.plugins;
|
2017-02-12 13:19:55 +00:00
|
|
|
|
2018-01-18 16:48:25 +00:00
|
|
|
this.plugins = pluginManager;
|
2017-01-26 04:06:10 +00:00
|
|
|
|
2018-01-18 16:48:25 +00:00
|
|
|
pluginManager.installGlobal(this, GlobalPlugins);
|
2018-01-10 16:29:37 +00:00
|
|
|
|
2018-01-18 16:48:25 +00:00
|
|
|
pluginManager.installLocal(this, CoreScenePlugins);
|
|
|
|
|
|
|
|
pluginManager.installLocal(this, GetScenePlugins(this));
|
|
|
|
|
|
|
|
pluginManager.installLocal(this, GetPhysicsPlugins(this));
|
2018-01-16 02:08:22 +00:00
|
|
|
|
|
|
|
this.events.emit('boot', this);
|
2018-01-18 13:59:32 +00:00
|
|
|
|
|
|
|
this.settings.isBooted = true;
|
|
|
|
},
|
|
|
|
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Scenes.Systems#install
|
|
|
|
* @private
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {array} plugin - An array of plugins to install into this Scene.
|
|
|
|
*/
|
2018-01-18 13:59:32 +00:00
|
|
|
install: function (plugin)
|
|
|
|
{
|
|
|
|
if (!Array.isArray(plugin))
|
|
|
|
{
|
|
|
|
plugin = [ plugin ];
|
|
|
|
}
|
|
|
|
|
2018-01-18 16:48:25 +00:00
|
|
|
this.plugins.installLocal(this, plugin);
|
2018-01-16 02:08:22 +00:00
|
|
|
},
|
|
|
|
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Scenes.Systems#step
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {number} time - [description]
|
|
|
|
* @param {number} delta - [description]
|
|
|
|
*/
|
2017-04-27 16:03:19 +00:00
|
|
|
step: function (time, delta)
|
2017-04-27 02:11:56 +00:00
|
|
|
{
|
2018-01-16 22:28:29 +00:00
|
|
|
this.events.emit('preupdate', time, delta);
|
2017-06-30 03:09:19 +00:00
|
|
|
|
2018-01-16 02:08:22 +00:00
|
|
|
this.events.emit('update', time, delta);
|
|
|
|
|
2017-07-14 13:30:20 +00:00
|
|
|
this.scene.update.call(this.scene, time, delta);
|
2017-11-08 17:18:10 +00:00
|
|
|
|
2018-01-16 02:08:22 +00:00
|
|
|
this.events.emit('postupdate', time, delta);
|
2017-04-27 02:11:56 +00:00
|
|
|
},
|
|
|
|
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Scenes.Systems#render
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer} renderer - [description]
|
|
|
|
*/
|
2018-01-20 04:47:03 +00:00
|
|
|
render: function (renderer)
|
2017-01-30 23:58:29 +00:00
|
|
|
{
|
2018-01-11 13:59:06 +00:00
|
|
|
var displayList = this.displayList;
|
2017-12-15 04:07:32 +00:00
|
|
|
|
2018-02-12 16:59:57 +00:00
|
|
|
displayList.depthSort();
|
2017-04-04 22:59:02 +00:00
|
|
|
|
2018-01-20 04:47:03 +00:00
|
|
|
this.cameras.render(renderer, displayList);
|
|
|
|
|
|
|
|
this.events.emit('render', renderer);
|
2017-04-04 22:59:02 +00:00
|
|
|
},
|
|
|
|
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* Force a sort of the display list on the next render.
|
|
|
|
*
|
|
|
|
* @method Phaser.Scenes.Systems#queueDepthSort
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-07-20 11:48:35 +00:00
|
|
|
queueDepthSort: function ()
|
2017-07-07 17:13:26 +00:00
|
|
|
{
|
2018-01-11 13:59:06 +00:00
|
|
|
this.displayList.queueDepthSort();
|
2017-07-07 17:13:26 +00:00
|
|
|
},
|
|
|
|
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* Immediately sorts the display list if the flag is set.
|
|
|
|
*
|
|
|
|
* @method Phaser.Scenes.Systems#depthSort
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-07-20 11:48:35 +00:00
|
|
|
depthSort: function ()
|
|
|
|
{
|
2018-01-11 13:59:06 +00:00
|
|
|
this.displayList.depthSort();
|
2017-06-30 02:31:31 +00:00
|
|
|
},
|
|
|
|
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* Pause this Scene.
|
|
|
|
* A paused Scene still renders, it just doesn't run ANY of its update handlers or systems.
|
|
|
|
*
|
|
|
|
* @method Phaser.Scenes.Systems#pause
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @return {Phaser.Scenes.Systems} This Systems object.
|
|
|
|
*/
|
2017-06-30 02:31:31 +00:00
|
|
|
pause: function ()
|
|
|
|
{
|
2018-01-20 04:47:03 +00:00
|
|
|
if (this.settings.active)
|
|
|
|
{
|
2018-01-20 16:22:40 +00:00
|
|
|
this.settings.status = CONST.PAUSED;
|
|
|
|
|
2018-01-20 04:47:03 +00:00
|
|
|
this.settings.active = false;
|
2017-06-30 02:31:31 +00:00
|
|
|
|
2018-01-20 04:47:03 +00:00
|
|
|
this.events.emit('pause', this);
|
|
|
|
}
|
2018-02-12 15:18:31 +00:00
|
|
|
|
|
|
|
return this;
|
2017-06-30 02:31:31 +00:00
|
|
|
},
|
|
|
|
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* Resume this Scene.
|
|
|
|
*
|
|
|
|
* @method Phaser.Scenes.Systems#resume
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @return {Phaser.Scenes.Systems} This Systems object.
|
|
|
|
*/
|
2017-06-30 02:31:31 +00:00
|
|
|
resume: function ()
|
|
|
|
{
|
2018-01-20 04:47:03 +00:00
|
|
|
if (!this.settings.active)
|
|
|
|
{
|
2018-01-20 16:22:40 +00:00
|
|
|
this.settings.status = CONST.RUNNING;
|
|
|
|
|
2018-01-20 04:47:03 +00:00
|
|
|
this.settings.active = true;
|
2017-06-30 02:31:31 +00:00
|
|
|
|
2018-01-20 04:47:03 +00:00
|
|
|
this.events.emit('resume', this);
|
|
|
|
}
|
2018-02-12 15:18:31 +00:00
|
|
|
|
|
|
|
return this;
|
2017-06-30 02:31:31 +00:00
|
|
|
},
|
|
|
|
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* Send this Scene to sleep.
|
|
|
|
*
|
|
|
|
* A sleeping Scene doesn't run it's update step or render anything, but it also isn't destroyed,
|
|
|
|
* or have any of its systems or children removed, meaning it can be re-activated at any point.
|
|
|
|
*
|
|
|
|
* @method Phaser.Scenes.Systems#sleep
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @return {Phaser.Scenes.Systems} This Systems object.
|
|
|
|
*/
|
2017-06-30 02:31:31 +00:00
|
|
|
sleep: function ()
|
|
|
|
{
|
2018-01-20 16:22:40 +00:00
|
|
|
this.settings.status = CONST.SLEEPING;
|
|
|
|
|
2017-06-30 02:31:31 +00:00
|
|
|
this.settings.active = false;
|
|
|
|
this.settings.visible = false;
|
|
|
|
|
2018-01-17 03:41:58 +00:00
|
|
|
this.events.emit('sleep', this);
|
2018-02-12 15:18:31 +00:00
|
|
|
|
|
|
|
return this;
|
2017-06-30 02:31:31 +00:00
|
|
|
},
|
|
|
|
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* Wake-up this Scene if it was previously asleep.
|
|
|
|
*
|
|
|
|
* @method Phaser.Scenes.Systems#wake
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @return {Phaser.Scenes.Systems} This Systems object.
|
|
|
|
*/
|
2017-06-30 02:31:31 +00:00
|
|
|
wake: function ()
|
|
|
|
{
|
2018-01-20 16:22:40 +00:00
|
|
|
this.settings.status = CONST.RUNNING;
|
|
|
|
|
2017-06-30 02:31:31 +00:00
|
|
|
this.settings.active = true;
|
|
|
|
this.settings.visible = true;
|
|
|
|
|
2018-01-17 03:41:58 +00:00
|
|
|
this.events.emit('wake', this);
|
2018-02-12 15:18:31 +00:00
|
|
|
|
|
|
|
return this;
|
2017-06-30 03:06:53 +00:00
|
|
|
},
|
|
|
|
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* Is this Scene sleeping?
|
|
|
|
*
|
|
|
|
* @method Phaser.Scenes.Systems#isSleeping
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @return {boolean} [description]
|
|
|
|
*/
|
2018-01-20 04:47:03 +00:00
|
|
|
isSleeping: function ()
|
|
|
|
{
|
2018-01-20 16:22:40 +00:00
|
|
|
return (this.settings.status === CONST.SLEEPING);
|
2018-01-20 04:47:03 +00:00
|
|
|
},
|
|
|
|
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* Is this Scene active?
|
|
|
|
*
|
|
|
|
* @method Phaser.Scenes.Systems#isActive
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @return {boolean} [description]
|
|
|
|
*/
|
2018-01-20 04:47:03 +00:00
|
|
|
isActive: function ()
|
|
|
|
{
|
2018-01-20 16:22:40 +00:00
|
|
|
return (this.settings.status === CONST.RUNNING);
|
2018-01-20 04:47:03 +00:00
|
|
|
},
|
|
|
|
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* Is this Scene visible and rendering?
|
|
|
|
*
|
|
|
|
* @method Phaser.Scenes.Systems#isVisible
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @return {boolean} [description]
|
|
|
|
*/
|
2018-01-20 04:47:03 +00:00
|
|
|
isVisible: function ()
|
|
|
|
{
|
|
|
|
return this.settings.visible;
|
|
|
|
},
|
|
|
|
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Scenes.Systems#setVisible
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {boolean} value - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.Scenes.Systems} This Systems object.
|
|
|
|
*/
|
2018-01-20 04:47:03 +00:00
|
|
|
setVisible: function (value)
|
|
|
|
{
|
|
|
|
this.settings.visible = value;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Scenes.Systems#setActive
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {boolean} value - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.Scenes.Systems} This Systems object.
|
|
|
|
*/
|
2018-01-20 04:47:03 +00:00
|
|
|
setActive: function (value)
|
2017-06-30 03:06:53 +00:00
|
|
|
{
|
2018-01-20 16:22:40 +00:00
|
|
|
if (value)
|
|
|
|
{
|
|
|
|
return this.resume();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return this.pause();
|
|
|
|
}
|
2018-01-20 04:47:03 +00:00
|
|
|
},
|
|
|
|
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* Start this Scene running and rendering.
|
|
|
|
*
|
|
|
|
* @method Phaser.Scenes.Systems#start
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {object} data - [description]
|
|
|
|
*/
|
2018-01-20 04:47:03 +00:00
|
|
|
start: function (data)
|
|
|
|
{
|
2018-01-20 16:22:40 +00:00
|
|
|
this.settings.status = CONST.START;
|
|
|
|
|
2017-06-30 03:06:53 +00:00
|
|
|
this.settings.data = data;
|
|
|
|
|
|
|
|
this.settings.active = true;
|
|
|
|
this.settings.visible = true;
|
2018-01-17 03:41:58 +00:00
|
|
|
|
|
|
|
this.events.emit('start', this);
|
2017-06-30 02:31:31 +00:00
|
|
|
},
|
|
|
|
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* Shutdown this Scene and send a shutdown event to all of its systems.
|
|
|
|
*
|
|
|
|
* @method Phaser.Scenes.Systems#shutdown
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-06-30 02:31:31 +00:00
|
|
|
shutdown: function ()
|
|
|
|
{
|
2018-01-20 16:22:40 +00:00
|
|
|
this.settings.status = CONST.SHUTDOWN;
|
|
|
|
|
2017-06-30 02:31:31 +00:00
|
|
|
this.settings.active = false;
|
2017-06-30 03:06:53 +00:00
|
|
|
this.settings.visible = false;
|
2017-06-30 02:31:31 +00:00
|
|
|
|
2018-01-16 02:08:22 +00:00
|
|
|
this.events.emit('shutdown', this);
|
2017-06-30 02:31:31 +00:00
|
|
|
},
|
|
|
|
|
2018-02-12 15:18:31 +00:00
|
|
|
/**
|
|
|
|
* Destroy this Scene and send a destroy event all of its systems.
|
|
|
|
*
|
|
|
|
* @method Phaser.Scenes.Systems#destroy
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-06-30 02:31:31 +00:00
|
|
|
destroy: function ()
|
|
|
|
{
|
2018-01-20 16:22:40 +00:00
|
|
|
this.settings.status = CONST.DESTROYED;
|
|
|
|
|
2018-01-31 03:38:10 +00:00
|
|
|
this.settings.active = false;
|
|
|
|
this.settings.visible = false;
|
|
|
|
|
2018-01-16 02:08:22 +00:00
|
|
|
this.events.emit('destroy', this);
|
2017-02-08 00:08:09 +00:00
|
|
|
}
|
2016-11-29 15:25:14 +00:00
|
|
|
|
2017-07-04 12:58:45 +00:00
|
|
|
});
|
2017-06-30 02:31:31 +00:00
|
|
|
|
2016-11-29 15:25:14 +00:00
|
|
|
module.exports = Systems;
|