mirror of
https://github.com/photonstorm/phaser
synced 2024-12-18 17:16:03 +00:00
48 lines
987 B
JavaScript
48 lines
987 B
JavaScript
var Class = require('../utils/Class');
|
|
var DisplayList = require('./DisplayList');
|
|
var PluginManager = require('../plugins/PluginManager');
|
|
|
|
var DisplayListPlugin = new Class({
|
|
|
|
Extends: DisplayList,
|
|
|
|
initialize:
|
|
|
|
function DisplayListPlugin (scene)
|
|
{
|
|
// The Scene that owns this plugin
|
|
this.scene = scene;
|
|
|
|
this.systems = scene.sys;
|
|
|
|
if (!scene.sys.settings.isBooted)
|
|
{
|
|
scene.sys.events.once('boot', this.boot, this);
|
|
}
|
|
|
|
DisplayList.call(this);
|
|
},
|
|
|
|
boot: function ()
|
|
{
|
|
var eventEmitter = this.systems.events;
|
|
|
|
eventEmitter.on('shutdown', this.shutdown, this);
|
|
eventEmitter.on('destroy', this.destroy, this);
|
|
},
|
|
|
|
shutdown: function ()
|
|
{
|
|
this.removeAll();
|
|
},
|
|
|
|
destroy: function ()
|
|
{
|
|
this.shutdown();
|
|
}
|
|
|
|
});
|
|
|
|
PluginManager.register('DisplayListPlugin', DisplayListPlugin, 'displayList');
|
|
|
|
module.exports = DisplayListPlugin;
|