var Class = require('../utils/Class'); var DataManager = require('./DataManager'); var PluginManager = require('../boot/PluginManager'); var DataManagerPlugin = new Class({ Extends: DataManager, initialize: function DataManagerPlugin(scene){ DataManager.call(this, scene, scene.sys.events); this.scene = scene; this.systems = scene.sys; scene.sys.events.once('boot', this.boot, this); scene.sys.events.on('start', this.start, this); } , boot: function (){ this.events = this.systems.events; this.events.once('destroy', this.destroy, this); } , start: function (){ this.events.once('shutdown', this.shutdown, this); } , shutdown: function (){ this.systems.events.off('shutdown', this.shutdown, this); } , destroy: function (){ DataManager.prototype.destroy.call(this); this.events.off('start', this.start, this); this.scene = null ; this.systems = null ; } } ); PluginManager.register('DataManagerPlugin', DataManagerPlugin, 'data'); module.exports = DataManagerPlugin;