Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions app/Game/Core/GameController.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
define([
"Game/" + GLOBALS.context + "/Physics/Engine",
"Game/" + GLOBALS.context + "/Loader/TiledLevel",
"Game/" + GLOBALS.context + "/Player",
"Game/" + App.context + "/Physics/Engine",
"Game/" + App.context + "/Loader/TiledLevel",
"Game/" + App.context + "/Player",
"Lib/Utilities/NotificationCenter",
"Game/" + GLOBALS.context + "/GameObjects/Doll",
"Game/" + GLOBALS.context + "/GameObjects/GameObject",
"Game/" + GLOBALS.context + "/GameObjects/Item",
"Game/" + App.context + "/GameObjects/Doll",
"Game/" + App.context + "/GameObjects/GameObject",
"Game/" + App.context + "/GameObjects/Item",
"Lib/Utilities/Assert",
],

Expand Down
6 changes: 3 additions & 3 deletions app/Game/Core/GameObjects/Doll.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
define([
"Game/" + GLOBALS.context + "/GameObjects/GameObject",
"Game/" + App.context + "/GameObjects/GameObject",
"Lib/Utilities/Exception",
"Lib/Vendor/Box2D",
"Game/Config/Settings",
"Game/" + GLOBALS.context + "/Collision/Detector",
"Game/" + GLOBALS.context + "/GameObjects/Item",
"Game/" + App.context + "/Collision/Detector",
"Game/" + App.context + "/GameObjects/Item",
"Lib/Utilities/NotificationCenter",
"Lib/Utilities/Assert"
],
Expand Down
2 changes: 1 addition & 1 deletion app/Game/Core/GameObjects/Item.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
define([
"Game/" + GLOBALS.context + "/GameObjects/GameObject",
"Game/" + App.context + "/GameObjects/GameObject",
"Lib/Vendor/Box2D",
"Lib/Utilities/OptionsHelper",
"Game/Config/Settings",
Expand Down
2 changes: 1 addition & 1 deletion app/Game/Core/GameObjects/Items/RagDoll.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
define([
"Game/" + GLOBALS.context + "/GameObjects/Item",
"Game/" + App.context + "/GameObjects/Item",
"Lib/Vendor/Box2D",
"Game/Config/Settings",
"Lib/Utilities/NotificationCenter",
Expand Down
2 changes: 1 addition & 1 deletion app/Game/Core/GameObjects/Items/RagDoll2.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
define([
"Game/" + GLOBALS.context + "/GameObjects/Item",
"Game/" + App.context + "/GameObjects/Item",
"Lib/Vendor/Box2D",
"Game/Config/Settings"
],
Expand Down
2 changes: 1 addition & 1 deletion app/Game/Core/GameObjects/Items/RubeDoll.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
define([
"Game/" + GLOBALS.context + "/GameObjects/Item",
"Game/" + App.context + "/GameObjects/Item",
"Lib/Vendor/RubeLoader",
"Lib/Vendor/Box2D",
"Game/Config/Settings",
Expand Down
4 changes: 2 additions & 2 deletions app/Game/Core/GameObjects/Items/Skateboard.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
define([
"Game/" + GLOBALS.context + "/GameObjects/Item",
"Game/" + App.context + "/GameObjects/Item",
"Lib/Vendor/Box2D",
"Game/Config/Settings",
"Lib/Utilities/Assert"
Expand Down Expand Up @@ -89,7 +89,7 @@ function (Parent, Box2D, Settings, Assert) {

/*
define([
"Game/" + GLOBALS.context + "/GameObjects/Item",
"Game/" + App.context + "/GameObjects/Item",
"Lib/Vendor/Box2D",
"Game/Config/Settings",
"Lib/Utilities/Assert"
Expand Down
2 changes: 1 addition & 1 deletion app/Game/Core/GameObjects/SpectatorDoll.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
define([
"Game/" + GLOBALS.context + "/GameObjects/GameObject",
"Game/" + App.context + "/GameObjects/GameObject",
"Lib/Vendor/Box2D"
],

Expand Down
2 changes: 1 addition & 1 deletion app/Game/Core/GameObjects/Tile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
define([
"Game/" + GLOBALS.context + "/GameObjects/GameObject",
"Game/" + App.context + "/GameObjects/GameObject",
"Lib/Vendor/Box2D",
"Game/Config/Settings",
"Lib/Utilities/Exception",
Expand Down
12 changes: 6 additions & 6 deletions app/Game/Core/Loader/Level.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ define([
"Lib/Vendor/Box2D",
"Lib/Utilities/NotificationCenter",
"Lib/Utilities/Abstract",
"Game/" + GLOBALS.context + "/Collision/Detector",
"Game/" + GLOBALS.context + "/GameObjects/Tile",
"Game/" + GLOBALS.context + "/GameObjects/Item",
"Game/" + GLOBALS.context + "/GameObjects/Items/Skateboard",
"Game/" + GLOBALS.context + "/GameObjects/Items/RagDoll",
"Game/" + GLOBALS.context + "/GameObjects/Items/RubeDoll"
"Game/" + App.context + "/Collision/Detector",
"Game/" + App.context + "/GameObjects/Tile",
"Game/" + App.context + "/GameObjects/Item",
"Game/" + App.context + "/GameObjects/Items/Skateboard",
"Game/" + App.context + "/GameObjects/Items/RagDoll",
"Game/" + App.context + "/GameObjects/Items/RubeDoll"

], function (Settings, Box2D, nc, Abstract, CollisionDetector, Tile, Item, Skateboard, RagDoll, RubeDoll) {

Expand Down
10 changes: 5 additions & 5 deletions app/Game/Core/Loader/TiledLevel.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
define([
"Game/" + GLOBALS.context + "/Loader/Level",
"Game/" + App.context + "/Loader/Level",
"Game/Config/Settings",
"Game/Config/ItemSettings",
"Lib/Vendor/Box2D",
Expand All @@ -8,10 +8,10 @@ define([
"Lib/Utilities/NotificationCenter",
"Lib/Utilities/Assert",
"Game/Client/View/Abstract/Layer",
"Game/" + GLOBALS.context + "/Collision/Detector",
"Game/" + GLOBALS.context + "/GameObjects/Tile",
"Game/" + GLOBALS.context + "/GameObjects/Item",
"Game/" + GLOBALS.context + "/GameObjects/Items/Skateboard",
"Game/" + App.context + "/Collision/Detector",
"Game/" + App.context + "/GameObjects/Tile",
"Game/" + App.context + "/GameObjects/Item",
"Game/" + App.context + "/GameObjects/Items/Skateboard",

], function (Parent, Settings, ItemSettings, Box2D, optionsHelper, Exception, nc, Assert, AbstractLayer, CollisionDetector, Tile, Item, Skateboard) {

Expand Down
2 changes: 1 addition & 1 deletion app/Game/Core/Physics/Engine.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
define([
"Game/Config/Settings",
"Lib/Vendor/Box2D",
"Game/" + GLOBALS.context + "/Collision/Detector",
"Game/" + App.context + "/Collision/Detector",
"Lib/Utilities/NotificationCenter"
],

Expand Down
8 changes: 4 additions & 4 deletions app/Game/Core/Player.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
define([
"Game/" + GLOBALS.context + "/GameObjects/Doll",
"Game/" + GLOBALS.context + "/Control/PlayerController",
"Game/" + App.context + "/GameObjects/Doll",
"Game/" + App.context + "/Control/PlayerController",
"Game/Config/Settings",
"Lib/Utilities/NotificationCenter",
"Lib/Utilities/Exception",
"Lib/Utilities/ColorConverter",
"Game/" + GLOBALS.context + "/GameObjects/SpectatorDoll",
"Game/" + GLOBALS.context + "/GameObjects/Items/RubeDoll"
"Game/" + App.context + "/GameObjects/SpectatorDoll",
"Game/" + App.context + "/GameObjects/Items/RubeDoll"
],

function (Doll, PlayerController, Settings, nc, Exception, ColorConverter, SpectatorDoll, RubeDoll) {
Expand Down
14 changes: 10 additions & 4 deletions channel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
GLOBALS = { context: "Channel" };
// "use strict"; intentionally omitted as App scope workaround

Error.stackTraceLimit = Infinity;

var requirejs = require('requirejs');

requirejs.config({
Expand All @@ -11,14 +14,17 @@ requirejs.config({
},
});

var inspector = {};

App = {};
App.inspector = {};
App.context = "Channel";

requirejs([
"Game/Channel/PipeToServer"
],
],

function (PipeToServer) {
var PipeToServer = new PipeToServer(process);

inspector.PipeToServer = PipeToServer;
App.inspector.PipeToServer = PipeToServer;
});
15 changes: 8 additions & 7 deletions client.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var GLOBALS = { context: "Client" };
Error.stackTraceLimit = Infinity;

requirejs.config({
baseUrl: 'app',
Expand All @@ -15,8 +15,9 @@ requirejs.config({
},
});

if(!Chuck) var Chuck = {};
Chuck.inspector = {};
var App = App || {};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we ever expect App to be pre-populated? When?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it was thought of as a kind of module extension pattern. But regarding my comment below it might make sense to actually get rid of this, provide the context as a require.js configuration and actually use the replace plugin.

App.inspector = {};
App.context = "Client";

requirejs([
"Game/Client/Networker",
Expand All @@ -42,10 +43,10 @@ function (Networker, SocketIO, Settings, Exception, nc, Menu) {
};
var socket = SocketIO.connect("/", options);
var networker = new Networker(socket, channelName, nickname);
Chuck.inspector.networker = networker;
Chuck.inspector.settings = Settings;
Chuck.inspector.nc = nc;
Chuck.inspector.resetLevel = function() { networker.sendGameCommand("resetLevel"); }
App.inspector.networker = networker;
App.inspector.settings = Settings;
App.inspector.nc = nc;
App.inspector.resetLevel = function() { networker.sendGameCommand("resetLevel"); }
}
menu.init();
});
2 changes: 1 addition & 1 deletion config/build-profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
name: "../client",
out: "../build/client.min.js",
onBuildRead: function (moduleName, path, contents) {
var contents = contents.replace(/\" \+ GLOBALS.context \+ \"/g, "Client");
var contents = contents.replace(/\" \+ App.context \+ \"/g, "Client");
return contents;
}
})
11 changes: 7 additions & 4 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
"use strict"

var GLOBALS = { context: "Channel" };
Error.stackTraceLimit = Infinity;

var requirejs = require('requirejs');
var fs = require('fs');

var inspector;
var App = App || {};
App.inspector = {};
App.context = "Channel";

requirejs.config({
nodeRequire: require,
Expand Down Expand Up @@ -41,11 +44,11 @@ function (HttpServer, Socket, Coordinator, Settings) {
var httpServer = new HttpServer(options, coordinator);
var socket = new Socket(httpServer.getServer(), options, coordinator);

inspector = {
App.inspector = {
coordinator: coordinator,
httpServer: httpServer,
socket: socket
}
});

exports = module.exports = inspector;
exports = module.exports = App;