added lobby, nickname fixes #44, channel name

This commit is contained in:
Jeena 2014-02-25 00:55:16 +01:00
parent aa4535cb0c
commit da913c4709
10 changed files with 285 additions and 68 deletions

View file

@ -34,7 +34,12 @@ function (ProtocolHelper, GameController, User, NotificationCenter, Settings, Do
Networker.prototype.onConnect = function () {
console.log('connected.')
this.sendCommand('join', 'dungeon');
var channel = JSON.parse(localStorage["channel"]);
if(channel.name) {
this.sendCommand('join', channel.name);
} else {
window.location.href = "/";
}
}
Networker.prototype.onDisconnect = function () {
@ -45,6 +50,7 @@ function (ProtocolHelper, GameController, User, NotificationCenter, Settings, Do
}
Networker.prototype.onJoinSuccess = function (options) {
console.log("join success")
this.userId = options.userId;
this.gameController = new GameController();