mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
This commit is contained in:
parent
039213cf50
commit
55256ada95
23 changed files with 409 additions and 110 deletions
|
|
@ -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;
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue