refactored Server and Lobby

This commit is contained in:
Jeena 2014-03-01 14:07:03 +01:00
parent 42475c9b38
commit d83376d5c7
26 changed files with 29 additions and 29 deletions

View file

@ -1,7 +1,7 @@
define([ define([
'http', 'http',
'node-static', 'node-static',
'Lobby/Api' 'Server/Api'
], ],
function (http, nodeStatic, Api) { function (http, nodeStatic, Api) {

View file

@ -1,7 +1,7 @@
define([ define([
"Game/Server/GameController", "Game/Channel/GameController",
"Lib/Utilities/NotificationCenter", "Lib/Utilities/NotificationCenter",
"Game/Server/User", "Game/Channel/User",
"Lib/Utilities/Protocol/Helper", "Lib/Utilities/Protocol/Helper",
"Lib/Utilities/Options", "Lib/Utilities/Options",
"Game/Config/Settings" "Game/Config/Settings"
@ -9,7 +9,7 @@
function (GameController, Nc, User, ProtocolHelper, Options, Settings) { function (GameController, Nc, User, ProtocolHelper, Options, Settings) {
function Channel (pipeToLobby, name, options) { function Channel (pipeToServer, name, options) {
var self = this; var self = this;
@ -20,7 +20,7 @@
this.name = name; this.name = name;
this.users = {}; this.users = {};
this.pipeToLobby = pipeToLobby; this.pipeToServer = pipeToServer;
this.gameController = new GameController(this); this.gameController = new GameController(this);

View file

@ -1,15 +1,15 @@
define([ define([
"Game/Core/GameController", "Game/Core/GameController",
"Game/Server/Physics/Engine", "Game/Channel/Physics/Engine",
"Game/Config/Settings", "Game/Config/Settings",
"Game/Server/Control/PlayerController", "Game/Channel/Control/PlayerController",
"Lib/Utilities/RequestAnimFrame", "Lib/Utilities/RequestAnimFrame",
"Lib/Utilities/NotificationCenter", "Lib/Utilities/NotificationCenter",
"Lib/Vendor/Box2D", "Lib/Vendor/Box2D",
"Game/Server/Player", "Game/Channel/Player",
"Game/Server/GameObjects/GameObject", "Game/Channel/GameObjects/GameObject",
"Game/Server/GameObjects/Doll", "Game/Channel/GameObjects/Doll",
"Game/Server/GameObjects/Items/RagDoll" "Game/Channel/GameObjects/Items/RagDoll"
], ],
function (Parent, PhysicsEngine, Settings, PlayerController, requestAnimFrame, Nc, Box2D, Player, GameObject, Doll, RagDoll) { function (Parent, PhysicsEngine, Settings, PlayerController, requestAnimFrame, Nc, Box2D, Player, GameObject, Doll, RagDoll) {

View file

@ -1,6 +1,6 @@
define([ define([
"Game/Core/GameObjects/Doll", "Game/Core/GameObjects/Doll",
"Game/Server/GameObjects/Item", "Game/Channel/GameObjects/Item",
"Lib/Vendor/Box2D", "Lib/Vendor/Box2D",
"Lib/Utilities/NotificationCenter" "Lib/Utilities/NotificationCenter"
], ],

View file

@ -1,11 +1,11 @@
define([ define([
"Lib/Utilities/NotificationCenter", "Lib/Utilities/NotificationCenter",
"Game/Server/Channel" "Game/Channel/Channel"
], ],
function (Nc, Channel) { function (Nc, Channel) {
function PipeToLobby (process) { function PipeToServer (process) {
var self = this; var self = this;
@ -28,7 +28,7 @@ function (Nc, Channel) {
}); });
} }
PipeToLobby.prototype.send = function (recipient, data) { PipeToServer.prototype.send = function (recipient, data) {
var message = { var message = {
recipient: recipient, recipient: recipient,
data: data data: data
@ -37,10 +37,10 @@ function (Nc, Channel) {
this.process.send(message); this.process.send(message);
}; };
PipeToLobby.prototype.onMessage = function (message) { PipeToServer.prototype.onMessage = function (message) {
Nc.trigger(message.recipient + '/controlCommand', message); Nc.trigger(message.recipient + '/controlCommand', message);
} }
return PipeToLobby; return PipeToServer;
}); });

View file

@ -8,7 +8,7 @@ function() {
return f + this.substr(1); return f + this.substr(1);
} }
if(GLOBALS.context == "Server") { if(GLOBALS.context == "Channel") {
console.checkpoint = function (s) { console.checkpoint = function (s) {
console.log(' \033[32mbeep - \033[0m' + s); console.log(' \033[32mbeep - \033[0m' + s);

View file

@ -66,7 +66,7 @@ function () {
} }
}, },
server: { server: {
pipeToLobby: function(v) { return v + "-ns.server.pipeToLobby")} pipeToServer: function(v) { return v + "-ns.server.pipeToServer")}
}, },
lobby: { lobby: {

View file

@ -1,7 +1,7 @@
define([ define([
"Lobby/User", "Server/User",
"Game/Server/Channel", "Game/Channel/Channel",
"Lobby/PipeToChannel", "Server/PipeToChannel",
"Lib/Utilities/NotificationCenter" "Lib/Utilities/NotificationCenter"
], ],

View file

@ -1,4 +1,4 @@
GLOBALS = { context: "Server" }; GLOBALS = { context: "Channel" };
var requirejs = require('requirejs'); var requirejs = require('requirejs');
requirejs.config({ requirejs.config({
@ -10,11 +10,11 @@ requirejs.config({
var inspector = {}; var inspector = {};
requirejs([ requirejs([
"Game/Server/PipeToLobby" "Game/Channel/PipeToServer"
], ],
function (PipeToLobby) { function (PipeToServer) {
var PipeToLobby = new PipeToLobby(process); var PipeToServer = new PipeToServer(process);
inspector.PipeToLobby = PipeToLobby; inspector.PipeToServer = PipeToServer;
}); });

View file

@ -1,4 +1,4 @@
GLOBALS = { context: "Server" }; GLOBALS = { context: "Channel" };
var requirejs = require('requirejs'); var requirejs = require('requirejs');
var inspector; var inspector;
@ -23,7 +23,7 @@ var options = {
requirejs([ requirejs([
"Bootstrap/HttpServer", "Bootstrap/HttpServer",
"Bootstrap/Socket", "Bootstrap/Socket",
"Lobby/Coordinator" "Server/Coordinator"
], ],
function (HttpServer, Socket, Coordinator) { function (HttpServer, Socket, Coordinator) {