mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
first notificationCenter replacement tests, seem to work
This commit is contained in:
parent
043f2dbfda
commit
4ac86c69b4
3 changed files with 11 additions and 1 deletions
|
|
@ -4,7 +4,13 @@ define(["Chuck/ServerGame"], function(ServerGame) {
|
|||
this.name = name;
|
||||
this.users = {};
|
||||
this.serverGame = this.factory.new(ServerGame, this);
|
||||
console.log("server game " + this.serverGame);
|
||||
this.serverGame.loadLevel("default.json");
|
||||
|
||||
var self = this;
|
||||
this.notificationCenter.on("processGameCommandFromUser", function(topic, args) {
|
||||
self.processGameCommandFromUser.apply(self, args);
|
||||
});
|
||||
}
|
||||
|
||||
Channel.validateName = function(name){
|
||||
|
|
|
|||
|
|
@ -35,6 +35,9 @@ define(["Server/User", "Server/Channel", "Server/Factory"], function(User, Chann
|
|||
this.channels[channelName] = channel;
|
||||
}
|
||||
|
||||
user.notificationCenter = channel.notificationCenter;
|
||||
user.factory = channel.factory;
|
||||
|
||||
channel.addUser(user);
|
||||
user.setChannel(channel);
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ define(["Protocol/Helper"], function(ProtocolHelper) {
|
|||
|
||||
case 'gameCommand':
|
||||
for(var gameCommand in options) {
|
||||
this.channel.processGameCommandFromUser(gameCommand, options[gameCommand], this);
|
||||
this.notificationCenter.trigger("processGameCommandFromUser", [gameCommand, options[gameCommand], this]);
|
||||
//this.channel.processGameCommandFromUser(gameCommand, options[gameCommand], this);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue