work in progress... worked on channel attributes and game goal. fixes #45 and references #48

This commit is contained in:
logsol 2014-03-30 00:12:04 +01:00
parent 039213cf50
commit 55256ada95
23 changed files with 409 additions and 110 deletions

View file

@ -48,8 +48,8 @@ function (ProtocolHelper, GameController, User, Nc, Settings, DomController) {
}
Networker.prototype.onDisconnect = function () {
if(this.gameController) this.gameController.destruct();
this.gameController = null;
//if(this.gameController) this.gameController.destruct();
//this.gameController = null;
console.log('disconnected. game destroyed. no auto-reconnect');
document.body.style.backgroundColor = '#aaaaaa';
}
@ -57,9 +57,6 @@ function (ProtocolHelper, GameController, User, Nc, Settings, DomController) {
Networker.prototype.onJoinSuccess = function (options) {
console.log("join success")
this.gameController = new GameController();
this.gameController.loadLevel(options.levelUid);
this.onUserJoined(options.user);
if (options.joinedUsers) {
@ -140,6 +137,21 @@ function (ProtocolHelper, GameController, User, Nc, Settings, DomController) {
setTimeout(this.ping.bind(this), 1000);
};
Networker.prototype.onBeginRound = function(options) {
if(this.gameController) {
this.gameController.destroy();
delete this.gameController;
}
console.log('GameController')
this.gameController = new GameController(options);
};
Networker.prototype.onEndRound = function() {
this.gameController.toggleInfo(true);
};
return Networker;
});