mirror of
https://github.com/photonstorm/phaser
synced 2024-12-19 17:44:45 +00:00
49 lines
987 B
JavaScript
49 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;
|