forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataProxy.js
More file actions
106 lines (81 loc) · 2.09 KB
/
Copy pathDataProxy.js
File metadata and controls
106 lines (81 loc) · 2.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
var Class = require('../../utils/Class');
var DataProxy = new Class({
initialize:
function DataProxy (scene, gameObject)
{
this.manager = scene.sys.dataStore;
this.gameObject = gameObject;
},
set: function (key, value)
{
return this.manager.set(this.gameObject, key, value);
},
get: function (key)
{
return this.manager.get(this.gameObject, key);
},
getAll: function ()
{
return this.manager.getAll(this.gameObject);
},
query: function (search)
{
return this.manager.query(this.gameObject, search);
},
before: function (key, callback, scope)
{
return this.manager.before(this.gameObject, key, callback, scope);
},
after: function (key, callback, scope)
{
return this.manager.after(this.gameObject, key, callback, scope);
},
each: function (callback, scope)
{
var args = [ this.gameObject, null, undefined ];
for (var i = 2; i < arguments.length; i++)
{
args.push(arguments[i]);
}
return this.manager.each(this.gameObject, callback, scope, args);
},
merge: function (data, overwrite)
{
return this.manager.merge(this.gameObject, data, overwrite);
},
remove: function (key)
{
return this.manager.remove(this.gameObject, key);
},
removeListeners: function (key)
{
return this.manager.removeListeners(this.gameObject, key);
},
pop: function (key)
{
return this.manager.pop(this.gameObject, key);
},
has: function (key)
{
return this.manager.has(this.gameObject, key);
},
reset: function ()
{
return this.manager.reset(this.gameObject);
},
freeze: function ()
{
this.manager.freeze(this.gameObject);
},
unfreeze: function ()
{
this.manager.unfreeze(this.gameObject);
},
destroy: function ()
{
this.manager.kill(this.gameObject);
this.manager = null;
this.gameObject = null;
}
});
module.exports = DataProxy;