mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
join success roundtrip added
This commit is contained in:
parent
e93dbf2f2a
commit
2183e70bd8
5 changed files with 48 additions and 53 deletions
|
|
@ -1,9 +1,10 @@
|
|||
define([
|
||||
"Game/Server/GameController",
|
||||
"Game/Core/NotificationCenter"
|
||||
"Game/Core/NotificationCenter",
|
||||
"Game/Server/User"
|
||||
],
|
||||
|
||||
function (GameController, NotificationCenter) {
|
||||
function (GameController, NotificationCenter, User) {
|
||||
|
||||
function Channel (pipeToLobby, name) {
|
||||
|
||||
|
|
@ -36,12 +37,12 @@
|
|||
|
||||
switch(message.recipient) {
|
||||
case 'user':
|
||||
self.forward(self.users[message.id], message.user);
|
||||
self.forward(self.users[message.id], message.data);
|
||||
break;
|
||||
case 'id': // Do nothing, it is needed by the user
|
||||
break;
|
||||
case 'channel':
|
||||
self.forward(self, message.channel);
|
||||
self.forward(self, message.data);
|
||||
break;
|
||||
default:
|
||||
throw 'unknown recipient';
|
||||
|
|
@ -67,16 +68,16 @@
|
|||
};
|
||||
|
||||
|
||||
Channel.prototype.addUser = function (user) {
|
||||
//var userIds = Object.keys(this.users);
|
||||
console.log('addUser', user);
|
||||
Channel.prototype.addUser = function (userId) {
|
||||
var user = new User(userId, this);
|
||||
this.users[user.id] = user;
|
||||
|
||||
//user.sendCommand('joinSuccess', {channelName: this.name, id: user.id, userIds: userIds});
|
||||
//this.sendCommandToAllUsersExcept('userJoined', user.id, user);
|
||||
|
||||
//NotificationCenter.trigger('user/joined', user);
|
||||
NotificationCenter.trigger('user/joined', user);
|
||||
}
|
||||
/*
|
||||
Channel.prototype.send = function(recipient, message) {
|
||||
|
||||
this.pipeToLobby.send(recipient, message);
|
||||
}*/
|
||||
/*
|
||||
Channel.prototype.releaseUser = function (user) {
|
||||
this.gameController.userIdLeft(user.id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue