mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
working towards usable new structure
This commit is contained in:
parent
3afc2fa66e
commit
815c63009f
15 changed files with 223 additions and 84 deletions
|
|
@ -3,24 +3,28 @@ define([
|
|||
"Game/Client/Physics/Engine",
|
||||
"Game/Client/View/ViewController",
|
||||
"Game/Client/Control/KeyboardController",
|
||||
"Game/Core/NotificationCenter",
|
||||
"Lib/Utilities/RequestAnimFrame"
|
||||
],
|
||||
|
||||
function(Parent, PhysicsEngine, ViewController, KeyboardController, requestAnimFrame) {
|
||||
function(Parent, PhysicsEngine, ViewController, KeyboardController, NotificationCenter, requestAnimFrame) {
|
||||
|
||||
function GameController () {
|
||||
this.viewController = new ViewController();
|
||||
|
||||
Parent.call(this, new PhysicsEngine());
|
||||
|
||||
this.me = null;
|
||||
this.keyboardController = null;
|
||||
|
||||
this.viewController = new ViewController();
|
||||
this.update();
|
||||
//NotificationCenter.on('me/joined', this.meJoined, this)
|
||||
|
||||
//this.update();
|
||||
}
|
||||
|
||||
GameController.prototype = Object.create(Parent.prototype);
|
||||
|
||||
|
||||
/*
|
||||
GameController.prototype.getMe = function() {
|
||||
return this.me;
|
||||
}
|
||||
|
|
@ -40,6 +44,7 @@ function(Parent, PhysicsEngine, ViewController, KeyboardController, requestAnimF
|
|||
|
||||
GameController.prototype.meJoined = function(user) {
|
||||
this.me = this.userJoined(user);
|
||||
|
||||
this.keyboardController = new KeyboardController(this.me, this);
|
||||
}
|
||||
|
||||
|
|
@ -66,6 +71,6 @@ function(Parent, PhysicsEngine, ViewController, KeyboardController, requestAnimF
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
return GameController;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ function(ProtocolHelper, GameController) {
|
|||
this.socketLink.on('connect', function() {
|
||||
self.onConnect();
|
||||
});
|
||||
|
||||
/*
|
||||
this.socketLink.on('message', function(message) {
|
||||
self.onMessage(message);
|
||||
});
|
||||
|
|
@ -27,12 +27,13 @@ function(ProtocolHelper, GameController) {
|
|||
this.socketLink.on('disconnect', function() {
|
||||
self.onDisconnect();
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
Networker.prototype.onConnect = function() {
|
||||
this.join('dungeon');
|
||||
}
|
||||
|
||||
/*
|
||||
Networker.prototype.onMessage = function(message) {
|
||||
var self = this;
|
||||
ProtocolHelper.runCommands(message, function(command, options) {
|
||||
|
|
@ -44,7 +45,7 @@ function(ProtocolHelper, GameController) {
|
|||
if(this.gameController) this.gameController.destruct();
|
||||
this.gameController = null;
|
||||
}
|
||||
|
||||
*/
|
||||
Networker.prototype.join = function(channelName){
|
||||
this.sendCommand('join', channelName);
|
||||
}
|
||||
|
|
@ -53,9 +54,9 @@ function(ProtocolHelper, GameController) {
|
|||
var message = ProtocolHelper.encodeCommand(command, options);
|
||||
this.socketLink.send(message);
|
||||
}
|
||||
|
||||
/*
|
||||
Networker.prototype.onJoinSuccess = function(options) {
|
||||
this.gameController = new GameController(this, options.id);
|
||||
this.gameController = new GameController(options.id);
|
||||
this.gameController.loadLevel("default.json")
|
||||
console.log("Joined " + options.channelName);
|
||||
|
||||
|
|
@ -103,7 +104,7 @@ function(ProtocolHelper, GameController) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
return Networker;
|
||||
|
||||
});
|
||||
2
app/Game/Client/Physics/Engine.js
Normal file → Executable file
2
app/Game/Client/Physics/Engine.js
Normal file → Executable file
|
|
@ -17,7 +17,7 @@ function(Parent, Settings, DomController, Box2D) {
|
|||
|
||||
Engine.prototype.setupDebugDraw = function() {
|
||||
//var debugSprite = Settings.DEBUG_DRAW_CANVAS_SPRITE;
|
||||
var debugSprite = Dom.getDebugCanvas().getContext("2d");
|
||||
var debugSprite = DomController.getDebugCanvas().getContext("2d");
|
||||
|
||||
// set debug draw
|
||||
var debugDraw = new Box2D.Dynamics.b2DebugDraw();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue