mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
Merge branch 'restructuring' of github.com:logsol/chuck.js into restructuring
This commit is contained in:
commit
e5395dcd4a
2 changed files with 9 additions and 11 deletions
|
|
@ -38,10 +38,6 @@ function(Parent, PhysicsEngine, ViewController, KeyboardController, requestAnimF
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GameController.prototype.destroy = function() {
|
|
||||||
Parent.prototype.destroy.call(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
GameController.prototype.meJoined = function(user) {
|
GameController.prototype.meJoined = function(user) {
|
||||||
this.me = this.userJoined(user);
|
this.me = this.userJoined(user);
|
||||||
this.keyboardController = new KeyboardController(this.me, this);
|
this.keyboardController = new KeyboardController(this.me, this);
|
||||||
|
|
|
||||||
16
app/Game/Server/NotificationCenter.js
Normal file → Executable file
16
app/Game/Server/NotificationCenter.js
Normal file → Executable file
|
|
@ -1,11 +1,15 @@
|
||||||
define(function() {
|
define([
|
||||||
|
],
|
||||||
|
|
||||||
function NotificationCenter() {
|
function() {
|
||||||
|
|
||||||
|
function NotificationCenter() {
|
||||||
this.topics = {};
|
this.topics = {};
|
||||||
this.subUid = -1;
|
this.subUid = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
NotificationCenter.prototype.trigger = function(topic, args) {
|
NotificationCenter.prototype.trigger = function(topic, args) {
|
||||||
|
|
||||||
if (!this.topics[topic]) {
|
if (!this.topics[topic]) {
|
||||||
throw "No such topic " + topic + ". Could not trigger.";
|
throw "No such topic " + topic + ". Could not trigger.";
|
||||||
}
|
}
|
||||||
|
|
@ -16,11 +20,10 @@ define(function() {
|
||||||
while (len--) {
|
while (len--) {
|
||||||
subscribers[len].func(topic, args);
|
subscribers[len].func(topic, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NotificationCenter.prototype.on = function(topic, func) {
|
NotificationCenter.prototype.on = function(topic, func) {
|
||||||
|
|
||||||
if (!this.topics[topic]) {
|
if (!this.topics[topic]) {
|
||||||
this.topics[topic] = [];
|
this.topics[topic] = [];
|
||||||
}
|
}
|
||||||
|
|
@ -46,8 +49,7 @@ define(function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NotificationCenter;
|
return new NotificationCenter(); // making it singletone
|
||||||
});
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue