mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
added Server and Client Game
This commit is contained in:
parent
e959c8e7a2
commit
bffb16e77c
5 changed files with 57 additions and 10 deletions
|
|
@ -1,8 +1,8 @@
|
|||
define(["Protocol/Helper", "Chuck/Game"], function(ProtocolHelper, Game) {
|
||||
define(["Protocol/Helper", "Chuck/ClientGame"], function(ProtocolHelper, ClientGame) {
|
||||
|
||||
function Networker(socketLink) {
|
||||
this.socketLink = socketLink;
|
||||
this.game = null;
|
||||
this.clientGame = null;
|
||||
|
||||
this.init();
|
||||
}
|
||||
|
|
@ -36,8 +36,8 @@ define(["Protocol/Helper", "Chuck/Game"], function(ProtocolHelper, Game) {
|
|||
}
|
||||
|
||||
Networker.prototype.onDisconnect = function() {
|
||||
this.game.destruct();
|
||||
this.game = null;
|
||||
this.clientGame.destruct();
|
||||
this.clientGame = null;
|
||||
}
|
||||
|
||||
Networker.prototype.join = function(channelName){
|
||||
|
|
@ -50,7 +50,8 @@ define(["Protocol/Helper", "Chuck/Game"], function(ProtocolHelper, Game) {
|
|||
}
|
||||
|
||||
Networker.prototype.onJoinSuccess = function(channelName) {
|
||||
this.game = new Game(this);
|
||||
this.clientGame = new ClientGame(this);
|
||||
this.clientGame.loadLevel("default.json")
|
||||
}
|
||||
|
||||
Networker.prototype.processControlCommand = function(command, options){
|
||||
|
|
@ -60,7 +61,7 @@ define(["Protocol/Helper", "Chuck/Game"], function(ProtocolHelper, Game) {
|
|||
break;
|
||||
|
||||
case 'gameCommand':
|
||||
this.game.processGameCommand(options);
|
||||
this.clientGame.processGameCommand(options);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue