mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
Merge branch 'restructuring' of github.com:logsol/chuck.js into restructuring
This commit is contained in:
commit
8da8ad2e82
2 changed files with 18 additions and 8 deletions
|
|
@ -1,4 +1,9 @@
|
||||||
define(["Game/Server/GameController"], function(GameController) {
|
define([
|
||||||
|
"Game/Server/GameController",
|
||||||
|
"Game/Server/NotificationCenter"
|
||||||
|
],
|
||||||
|
|
||||||
|
function(GameController, NotificationCenter) {
|
||||||
|
|
||||||
function Channel(name) {
|
function Channel(name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
@ -8,7 +13,7 @@ define(["Game/Server/GameController"], function(GameController) {
|
||||||
this.serverGame.loadLevel("default.json");
|
this.serverGame.loadLevel("default.json");
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
this.notificationCenter.on("processGameCommandFromUser", function(topic, args) {
|
NotificationCenter.on("processGameCommandFromUser", function(topic, args) {
|
||||||
self.processGameCommandFromUser.apply(self, args);
|
self.processGameCommandFromUser.apply(self, args);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
function User(socketLink, coordinator) {
|
||||||
|
|
||||||
|
|
@ -24,18 +29,18 @@ define(["Game/Core/Protocol/Helper"], function(ProtocolHelper) {
|
||||||
}
|
}
|
||||||
|
|
||||||
User.prototype.setChannel = function(channel) {
|
User.prototype.setChannel = function(channel) {
|
||||||
if (this.notificationCenter) {
|
if (NotificationCenter) {
|
||||||
this.notificationCenter.off("updateClientsWorld");
|
NotificationCenter.off("updateClientsWorld");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
|
|
||||||
// Use the right factory and nc
|
// Use the right factory and nc
|
||||||
this.notificationCenter = this.channel.notificationCenter;
|
NotificationCenter = this.channel.notificationCenter;
|
||||||
this.factory = this.channel.factory;
|
this.factory = this.channel.factory;
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
this.notificationCenter.on("sendCommandToAllUsers", function(topic, args) {
|
NotificationCenter.on("sendCommandToAllUsers", function(topic, args) {
|
||||||
self.sendCommand.apply(self, args);
|
self.sendCommand.apply(self, args);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -70,7 +75,7 @@ define(["Game/Core/Protocol/Helper"], function(ProtocolHelper) {
|
||||||
|
|
||||||
case 'gameCommand':
|
case 'gameCommand':
|
||||||
for(var gameCommand in options) {
|
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);
|
//this.channel.processGameCommandFromUser(gameCommand, options[gameCommand], this);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue