forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataManagerPlugin.js
More file actions
51 lines (36 loc) · 1.09 KB
/
Copy pathDataManagerPlugin.js
File metadata and controls
51 lines (36 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
var Class = require('../utils/Class');
var DataManager = require('./DataManager');
var PluginManager = require('../plugins/PluginManager');
var DataManagerPlugin = new Class({
Extends: DataManager,
initialize:
function DataManagerPlugin (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);
}
DataManager.call(this, this.scene, scene.sys.events);
},
boot: function ()
{
var eventEmitter = this.systems.events;
eventEmitter.on('shutdown', this.shutdownPlugin, this);
eventEmitter.on('destroy', this.destroyPlugin, this);
},
shutdownPlugin: function ()
{
// Should we reset the events?
},
destroyPlugin: function ()
{
this.destroy();
this.scene = undefined;
this.systems = undefined;
}
});
PluginManager.register('DataManagerPlugin', DataManagerPlugin, 'data');
module.exports = DataManagerPlugin;