mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
new system for synchronizing game objects. fixes #74
This commit is contained in:
parent
3ef3a6abf9
commit
07dad646cf
19 changed files with 194 additions and 162 deletions
|
|
@ -85,6 +85,10 @@ function (Exception) {
|
|||
}
|
||||
},
|
||||
game: {
|
||||
events: {
|
||||
render: null,
|
||||
destroy: null
|
||||
},
|
||||
gameStats: {
|
||||
toggle: null
|
||||
},
|
||||
|
|
@ -102,9 +106,9 @@ function (Exception) {
|
|||
},
|
||||
core: {
|
||||
game: {
|
||||
gameObject: {
|
||||
worldUpdateObjects: {
|
||||
add: null,
|
||||
remove: null
|
||||
remove: null,
|
||||
},
|
||||
events: {
|
||||
level: {
|
||||
|
|
@ -241,18 +245,24 @@ function (Exception) {
|
|||
|
||||
NotificationCenter.prototype.off = function (token) {
|
||||
|
||||
if(token && token.constructor === Array) {
|
||||
this.offAll(token);
|
||||
return;
|
||||
}
|
||||
|
||||
for(var m in this.topics) {
|
||||
if (this.topics[m]) {
|
||||
for(var i = 0, j = this.topics[m].length; i < j; i++) {
|
||||
if (this.topics[m][i].token === token) {
|
||||
this.topics[m].splice(i, 1);
|
||||
return token;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// should be treated as a private function - use Nc.off(Array);
|
||||
NotificationCenter.prototype.offAll = function (tokens) {
|
||||
for (var i = 0; i < tokens.length; i++) {
|
||||
this.off(tokens[i]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue