Merge branch 'restructuring' of github.com:logsol/chuck.js into restructuring

This commit is contained in:
Jeena Paradies 2012-07-22 02:37:18 +02:00
commit 8da8ad2e82
2 changed files with 18 additions and 8 deletions

View file

@ -1,4 +1,9 @@
define(["Game/Server/GameController"], function(GameController) {
define([
"Game/Server/GameController",
"Game/Server/NotificationCenter"
],
function(GameController, NotificationCenter) {
function Channel(name) {
this.name = name;
@ -8,7 +13,7 @@ define(["Game/Server/GameController"], function(GameController) {
this.serverGame.loadLevel("default.json");
var self = this;
this.notificationCenter.on("processGameCommandFromUser", function(topic, args) {
NotificationCenter.on("processGameCommandFromUser", function(topic, args) {
self.processGameCommandFromUser.apply(self, args);
});
}

View file

@ -1,4 +1,9 @@
define(["Game/Core/Protocol/Helper"], function(ProtocolHelper) {
define([
"Game/Core/Protocol/Helper"
"Game/Server/NotificationCenter"
],
function(ProtocolHelper, NotificationCenter) {
function User(socketLink, coordinator) {
@ -24,18 +29,18 @@ define(["Game/Core/Protocol/Helper"], function(ProtocolHelper) {
}
User.prototype.setChannel = function(channel) {
if (this.notificationCenter) {
this.notificationCenter.off("updateClientsWorld");
if (NotificationCenter) {
NotificationCenter.off("updateClientsWorld");
}
this.channel = channel;
// Use the right factory and nc
this.notificationCenter = this.channel.notificationCenter;
NotificationCenter = this.channel.notificationCenter;
this.factory = this.channel.factory;
var self = this;
this.notificationCenter.on("sendCommandToAllUsers", function(topic, args) {
NotificationCenter.on("sendCommandToAllUsers", function(topic, args) {
self.sendCommand.apply(self, args);
});
}
@ -70,7 +75,7 @@ define(["Game/Core/Protocol/Helper"], function(ProtocolHelper) {
case 'gameCommand':
for(var gameCommand in options) {
this.notificationCenter.trigger("processGameCommandFromUser", [gameCommand, options[gameCommand], this]);
NotificationCenter.trigger("processGameCommandFromUser", [gameCommand, options[gameCommand], this]);
//this.channel.processGameCommandFromUser(gameCommand, options[gameCommand], this);
}
break;