added debug information when users join

This commit is contained in:
Jeena Paradies 2012-07-13 19:53:07 +02:00
parent bffb16e77c
commit e37d1eeb2e
2 changed files with 25 additions and 2 deletions

View file

@ -12,14 +12,27 @@ define(["Chuck/ServerGame"], function(ServerGame) {
Channel.prototype.addUser = function(user){
this.users[user.id] = user;
user.sendCommand('joinSuccess', this.name);
this.sendCommandToAllUsersBut('userJoined', user.id, user);
}
Channel.prototype.releaseUser = function(user){
delete this.users[user.id];
}
Channel.prototype.sendToAllUsers = function(package) {
console.log("not implemented sendToAllUsers: " + JSON.stringify(package))
Channel.prototype.sendCommandToAllUsers = function(command, options) {
for(var id in this.users) {
this.users[id].sendCommand(command, options);
}
}
Channel.prototype.sendCommandToAllUsersBut = function(command, options, user) {
for(var id in this.users) {
if (id != user.id) {
this.users[id].sendCommand(command, options);
}
}
}
return Channel;