join success roundtrip added

This commit is contained in:
Logsol 2013-01-03 21:32:24 +01:00
parent e93dbf2f2a
commit 2183e70bd8
5 changed files with 48 additions and 53 deletions

54
app/Game/Server/User.js Executable file → Normal file
View file

@ -1,45 +1,31 @@
define([
"Game/Core/User",
"Game/Core/Protocol/Helper",
"Game/Core/NotificationCenter"
],
"Game/Core/User",
"Game/Core/NotificationCenter",
"Game/Core/Protocol/Helper"
],
function(Parent, NotificationCenter, ProtocolHelper) {
function User(id, channel) {
Parent.call(this, id);
function (Parent, ProtocolHelper, NotificationCenter) {
this.channel = channel;
var self = this;
function User (socketLink, coordinator) {
Parent.call(this, socketLink.id);
this.id = socketLink.id;
this.socketLink = socketLink;
this.coordinator = coordinator;
this.channel = null;
this.init(socketLink);
NotificationCenter.on('user/joined', function(user) {
self.sendCommand("joined", true);
});
}
User.prototype = Object.create(Parent.prototype);
User.prototype.init = function (socketLink) {
User.prototype.sendCommand = function(command, options) {
var recipient = "user/" + this.id;
var data = ProtocolHelper.encodeCommand(command, options);
var self = this;
}
/*
User.prototype.setChannel = function (channel) {
this.channel = channel;
}
User.prototype.sendCommand = function (command, options) {
var message = ProtocolHelper.encodeCommand(command, options);
this.socketLink.send(message);
}
User.prototype.toString = function () {
return "[User " + this.id + "]";
NotificationCenter.trigger("net/send", recipient, data);
};
*/
return User;
});