update of client data by server

This commit is contained in:
Jeena Paradies 2012-07-13 22:49:15 +02:00
parent 2cb401bbd3
commit c8d0a48489
11 changed files with 239 additions and 120 deletions

View file

@ -13,7 +13,7 @@ define(["Chuck/ServerGame"], function(ServerGame) {
Channel.prototype.addUser = function(user){
this.users[user.id] = user;
user.sendCommand('joinSuccess', {chanelName: this.name, id: user.id});
user.sendCommand('joinSuccess', {channelName: this.name, id: user.id});
this.sendCommandToAllUsersExcept('userJoined', user.id, user);
this.serverGame.createPlayerForUser(user)
@ -37,8 +37,8 @@ define(["Chuck/ServerGame"], function(ServerGame) {
}
}
Channel.prototype.processGameCommandFromUser = function(command, user) {
console.log("not implemented processGameCommandFromUser: " + command + user);
Channel.prototype.processGameCommandFromUser = function(command, options, user) {
this.serverGame.progressGameCommandFromUser(command, options, user);
}
return Channel;

View file

@ -55,7 +55,9 @@ define(["Protocol/Helper"], function(ProtocolHelper) {
break;
case 'gameCommand':
this.channel.processGameCommandFromUser(options, this);
for(var c in options) {
this.channel.processGameCommandFromUser(c, options[c], this);
}
break;
default:
@ -63,6 +65,10 @@ define(["Protocol/Helper"], function(ProtocolHelper) {
}
}
User.prototype.toString = function() {
return "[User " + this.id + "]";
};
return User;
});