Makes singleton variable name of NotificationCenter lowercase

When we require a singleton, its instance name should be named
by lowercase, since it is not a class.

Relates to #128
This commit is contained in:
logsol 2016-10-10 22:11:55 +02:00
parent ffc55a204a
commit 3cb2e39a18
57 changed files with 262 additions and 262 deletions

View file

@ -7,7 +7,7 @@
"Game/Config/Settings" "Game/Config/Settings"
], ],
function (GameController, Nc, User, ProtocolHelper, Options, Settings) { function (GameController, nc, User, ProtocolHelper, Options, Settings) {
"use strict"; "use strict";
@ -26,14 +26,14 @@
}); });
// Notification Center // Notification Center
Nc.on(Nc.ns.channel.events.round.end, this.onEndRound, this); nc.on(nc.ns.channel.events.round.end, this.onEndRound, this);
Nc.on(Nc.ns.channel.events.controlCommand.channel, function (message) { nc.on(nc.ns.channel.events.controlCommand.channel, function (message) {
ProtocolHelper.applyCommand(message.data, self); ProtocolHelper.applyCommand(message.data, self);
}); });
Nc.on(Nc.ns.channel.to.client.gameCommand.broadcast, this.broadcastGameCommand, this); nc.on(nc.ns.channel.to.client.gameCommand.broadcast, this.broadcastGameCommand, this);
Nc.on(Nc.ns.channel.to.client.controlCommand.broadcast, this.broadcastControlCommand, this); nc.on(nc.ns.channel.to.client.controlCommand.broadcast, this.broadcastControlCommand, this);
//Nc.on(Nc.ns.channel.to.client.gameCommand.broadcastExcept, this.broadcastGameCommandExcept, this); //nc.on(nc.ns.channel.to.client.gameCommand.broadcastExcept, this.broadcastGameCommandExcept, this);
//Nc.on(Nc.ns.channel.to.client.controlCommand.broadcastExcept, this.broadcastControlCommandExcept, this); //nc.on(nc.ns.channel.to.client.controlCommand.broadcastExcept, this.broadcastControlCommandExcept, this);
this.beginRound(); this.beginRound();
@ -103,10 +103,10 @@
}; };
if(!this.gameController.level || !this.gameController.level.isLoaded) { if(!this.gameController.level || !this.gameController.level.isLoaded) {
var token = Nc.on(Nc.ns.core.game.events.level.loaded, function() { var token = nc.on(nc.ns.core.game.events.level.loaded, function() {
self.sendJoinSuccess(options); self.sendJoinSuccess(options);
self.users[options.id].sendControlCommand("beginRound", clientGameControllerOptions); self.users[options.id].sendControlCommand("beginRound", clientGameControllerOptions);
Nc.off(token); nc.off(token);
}); });
} else { } else {
this.sendJoinSuccess(options); this.sendJoinSuccess(options);
@ -135,16 +135,16 @@
levelUid: levelUid levelUid: levelUid
}; };
//Nc.trigger("user/" + user.id + "/joinSuccess", options); //nc.trigger("user/" + user.id + "/joinSuccess", options);
user.sendControlCommand("joinSuccess", options); user.sendControlCommand("joinSuccess", options);
Nc.trigger(Nc.ns.channel.events.user.joined, user); nc.trigger(nc.ns.channel.events.user.joined, user);
this.broadcastControlCommandExcept("userJoined", user.options, user); this.broadcastControlCommandExcept("userJoined", user.options, user);
}; };
Channel.prototype.onReleaseUser = function (userId) { Channel.prototype.onReleaseUser = function (userId) {
var self = this; var self = this;
Nc.trigger(Nc.ns.channel.events.user.left, userId); nc.trigger(nc.ns.channel.events.user.left, userId);
delete this.users[userId]; delete this.users[userId];
this.broadcastControlCommand("userLeft", userId); this.broadcastControlCommand("userLeft", userId);

View file

@ -5,7 +5,7 @@ define([
"Game/Config/Settings" "Game/Config/Settings"
], ],
function(Parent, Nc, Parser, Settings) { function(Parent, nc, Parser, Settings) {
"use strict"; "use strict";
@ -71,7 +71,7 @@ function(Parent, Nc, Parser, Settings) {
lv: body.GetLinearVelocity() lv: body.GetLinearVelocity()
}; };
Nc.trigger(Nc.ns.channel.to.client.user.gameCommand.send + this.player.id, "positionStateReset", options); nc.trigger(nc.ns.channel.to.client.user.gameCommand.send + this.player.id, "positionStateReset", options);
} }
}; };

View file

@ -11,7 +11,7 @@ define([
"Game/Channel/GameObjects/Items/RubeDoll" "Game/Channel/GameObjects/Items/RubeDoll"
], ],
function (Parent, PhysicsEngine, Settings, requestAnimFrame, Nc, Box2D, Player, GameObject, Doll, RubeDoll) { function (Parent, PhysicsEngine, Settings, requestAnimFrame, nc, Box2D, Player, GameObject, Doll, RubeDoll) {
"use strict"; "use strict";
@ -25,12 +25,12 @@ function (Parent, PhysicsEngine, Settings, requestAnimFrame, Nc, Box2D, Player,
Parent.call(this, options); Parent.call(this, options);
this.ncTokens = this.ncTokens.concat([ this.ncTokens = this.ncTokens.concat([
Nc.on(Nc.ns.channel.events.user.joined, this.onUserJoined, this), nc.on(nc.ns.channel.events.user.joined, this.onUserJoined, this),
Nc.on(Nc.ns.channel.events.user.left, this.onUserLeft, this), nc.on(nc.ns.channel.events.user.left, this.onUserLeft, this),
Nc.on(Nc.ns.channel.events.user.level.reset, this.onResetLevel, this), nc.on(nc.ns.channel.events.user.level.reset, this.onResetLevel, this),
Nc.on(Nc.ns.channel.events.user.client.ready, this.onClientReady, this), nc.on(nc.ns.channel.events.user.client.ready, this.onClientReady, this),
Nc.on(Nc.ns.core.game.events.level.loaded, this.onLevelLoaded, this), nc.on(nc.ns.core.game.events.level.loaded, this.onLevelLoaded, this),
Nc.on(Nc.ns.channel.events.game.player.killed, this.onPlayerKilled, this), nc.on(nc.ns.channel.events.game.player.killed, this.onPlayerKilled, this),
]); ]);
console.checkpoint('starting game controller for channel (' + options.channelName + ')'); console.checkpoint('starting game controller for channel (' + options.channelName + ')');
@ -65,7 +65,7 @@ function (Parent, PhysicsEngine, Settings, requestAnimFrame, Nc, Box2D, Player,
}; };
GameController.prototype.clearItemsOfPlayerFingerPrints = function(player) { GameController.prototype.clearItemsOfPlayerFingerPrints = function(player) {
Nc.trigger(Nc.ns.channel.events.game.player.clearFingerPrints, player); nc.trigger(nc.ns.channel.events.game.player.clearFingerPrints, player);
}; };
GameController.prototype.createPlayer = function(user) { GameController.prototype.createPlayer = function(user) {
@ -79,7 +79,7 @@ function (Parent, PhysicsEngine, Settings, requestAnimFrame, Nc, Box2D, Player,
GameController.prototype.onPlayerKilled = function(player, killedByPlayer) { GameController.prototype.onPlayerKilled = function(player, killedByPlayer) {
if(killedByPlayer.stats.score >= this.options.scoreLimit) { if(killedByPlayer.stats.score >= this.options.scoreLimit) {
Nc.trigger(Nc.ns.channel.events.round.end); nc.trigger(nc.ns.channel.events.round.end);
} else { } else {
this.spawnPlayer(player, Settings.RESPAWN_TIME); this.spawnPlayer(player, Settings.RESPAWN_TIME);
} }
@ -102,7 +102,7 @@ function (Parent, PhysicsEngine, Settings, requestAnimFrame, Nc, Box2D, Player,
y: spawnPoint.y y: spawnPoint.y
}; };
Nc.trigger(Nc.ns.channel.to.client.gameCommand.broadcast, "spawnPlayer", options); nc.trigger(nc.ns.channel.to.client.gameCommand.broadcast, "spawnPlayer", options);
var i = self.spawnTimeouts.indexOf(spawnTimeout); var i = self.spawnTimeouts.indexOf(spawnTimeout);
self.spawnTimeouts.splice(i, 1); self.spawnTimeouts.splice(i, 1);
@ -117,7 +117,7 @@ function (Parent, PhysicsEngine, Settings, requestAnimFrame, Nc, Box2D, Player,
var update = this.getWorldUpdateObject(false); var update = this.getWorldUpdateObject(false);
if(Object.getOwnPropertyNames(update).length > 0) { if(Object.getOwnPropertyNames(update).length > 0) {
Nc.trigger(Nc.ns.channel.to.client.gameCommand.broadcast, "worldUpdate", update); nc.trigger(nc.ns.channel.to.client.gameCommand.broadcast, "worldUpdate", update);
} }
this.worldUpdateTimeout = setTimeout(this.updateWorld.bind(this), Settings.NETWORK_UPDATE_INTERVAL); this.worldUpdateTimeout = setTimeout(this.updateWorld.bind(this), Settings.NETWORK_UPDATE_INTERVAL);
@ -232,7 +232,7 @@ function (Parent, PhysicsEngine, Settings, requestAnimFrame, Nc, Box2D, Player,
userId: userId userId: userId
}; };
Nc.trigger(Nc.ns.channel.to.client.user.gameCommand.send + userId, "clientReadyResponse", options); nc.trigger(nc.ns.channel.to.client.user.gameCommand.send + userId, "clientReadyResponse", options);
this.spawnPlayer(player, 0); this.spawnPlayer(player, 0);
}; };
@ -255,7 +255,7 @@ function (Parent, PhysicsEngine, Settings, requestAnimFrame, Nc, Box2D, Player,
console.log('OH NO!!! ON RESET LEVEL IS CALLED AND RESPAWNES PLAYERS'); console.log('OH NO!!! ON RESET LEVEL IS CALLED AND RESPAWNES PLAYERS');
Parent.prototype.onResetLevel.call(this); Parent.prototype.onResetLevel.call(this);
Nc.trigger(Nc.ns.channel.to.client.gameCommand.broadcast, "resetLevel", true); nc.trigger(nc.ns.channel.to.client.gameCommand.broadcast, "resetLevel", true);
for (var key in this.players) { for (var key in this.players) {
this.spawnPlayer(this.players[key]); this.spawnPlayer(this.players[key]);
} }

View file

@ -6,7 +6,7 @@ define([
"Lib/Utilities/Assert" "Lib/Utilities/Assert"
], ],
function (Parent, Item, Box2D, Nc, Assert) { function (Parent, Item, Box2D, nc, Assert) {
"use strict"; "use strict";
@ -80,7 +80,7 @@ function (Parent, Item, Box2D, Nc, Assert) {
self.player.addDamage(damage, lastMovedPlayer, item); self.player.addDamage(damage, lastMovedPlayer, item);
}; };
Nc.trigger(Nc.ns.channel.engine.worldQueue.add, callback); nc.trigger(nc.ns.channel.engine.worldQueue.add, callback);
} }
} }

View file

@ -3,7 +3,7 @@ define([
"Lib/Utilities/NotificationCenter", "Lib/Utilities/NotificationCenter",
], ],
function (Parent, Nc) { function (Parent, nc) {
"use strict"; "use strict";
@ -13,7 +13,7 @@ function (Parent, Nc) {
this.lastMoved = null; this.lastMoved = null;
this.ncTokens = (this.ncTokens || []).concat([ this.ncTokens = (this.ncTokens || []).concat([
Nc.on(Nc.ns.channel.events.game.player.clearFingerPrints, this.clearOfPlayerFingerPrints, this) nc.on(nc.ns.channel.events.game.player.clearFingerPrints, this.clearOfPlayerFingerPrints, this)
]); ]);
} }

View file

@ -4,7 +4,7 @@ define([
"Lib/Utilities/NotificationCenter" "Lib/Utilities/NotificationCenter"
], ],
function (Parent, Settings, Nc) { function (Parent, Settings, nc) {
"use strict"; "use strict";
@ -35,7 +35,7 @@ function (Parent, Settings, Nc) {
var self = this; var self = this;
this.scheduledForDestruction = true; this.scheduledForDestruction = true;
this.destructionTimeout = setTimeout(function() { this.destructionTimeout = setTimeout(function() {
Nc.trigger(Nc.ns.channel.to.client.gameCommand.broadcast, 'removeGameObject', { nc.trigger(nc.ns.channel.to.client.gameCommand.broadcast, 'removeGameObject', {
type: 'animated', type: 'animated',
uid: self.uid uid: self.uid
}); });

View file

@ -4,7 +4,7 @@ define([
"Lib/Utilities/NotificationCenter" "Lib/Utilities/NotificationCenter"
], ],
function (Parent, Settings, Nc) { function (Parent, Settings, nc) {
"use strict"; "use strict";
@ -35,7 +35,7 @@ function (Parent, Settings, Nc) {
var self = this; var self = this;
this.scheduledForDestruction = true; this.scheduledForDestruction = true;
this.destructionTimeout = setTimeout(function() { this.destructionTimeout = setTimeout(function() {
Nc.trigger(Nc.ns.channel.to.client.gameCommand.broadcast, 'removeGameObject', { nc.trigger(nc.ns.channel.to.client.gameCommand.broadcast, 'removeGameObject', {
type: 'animated', type: 'animated',
uid: self.uid uid: self.uid
}); });

View file

@ -5,7 +5,7 @@ define([
"fs" "fs"
], ],
function (Nc, Channel, Settings, fs) { function (nc, Channel, Settings, fs) {
"use strict"; "use strict";
@ -14,7 +14,7 @@ function (Nc, Channel, Settings, fs) {
this.process = process; this.process = process;
this.recordingFileName = null; this.recordingFileName = null;
Nc.on(Nc.ns.channel.to.server.controlCommand.send, this.send, this); nc.on(nc.ns.channel.to.server.controlCommand.send, this.send, this);
process.on("message", this.onProcessMessage.bind(this)); process.on("message", this.onProcessMessage.bind(this));
} }
@ -82,10 +82,10 @@ function (Nc, Channel, Settings, fs) {
PipeToServer.prototype.onMessage = function (message) { PipeToServer.prototype.onMessage = function (message) {
switch(message.recipient) { switch(message.recipient) {
case "channel": case "channel":
Nc.trigger(Nc.ns.channel.events.controlCommand.channel, message); nc.trigger(nc.ns.channel.events.controlCommand.channel, message);
break; break;
default: default:
Nc.trigger(Nc.ns.channel.events.controlCommand.user + message.recipient, message); nc.trigger(nc.ns.channel.events.controlCommand.user + message.recipient, message);
break; break;
} }

View file

@ -4,7 +4,7 @@ define([
"Game/Channel/Control/PlayerController" "Game/Channel/Control/PlayerController"
], ],
function (Parent, Nc, PlayerController) { function (Parent, nc, PlayerController) {
"use strict"; "use strict";
@ -44,7 +44,7 @@ function (Parent, Nc, PlayerController) {
this.throw(options, item); this.throw(options, item);
options.action = "throw"; options.action = "throw";
Nc.trigger(Nc.ns.channel.to.client.gameCommand.broadcast, "handActionResponse", options); nc.trigger(nc.ns.channel.to.client.gameCommand.broadcast, "handActionResponse", options);
} }
} else { } else {
// grab // grab
@ -52,7 +52,7 @@ function (Parent, Nc, PlayerController) {
this.grab(item); this.grab(item);
options.action = "grab"; options.action = "grab";
Nc.trigger(Nc.ns.channel.to.client.gameCommand.broadcast, "handActionResponse", options); nc.trigger(nc.ns.channel.to.client.gameCommand.broadcast, "handActionResponse", options);
} }
} }
}; };
@ -93,14 +93,14 @@ function (Parent, Nc, PlayerController) {
var ragDollId = this.stats.deaths; var ragDollId = this.stats.deaths;
Parent.prototype.kill.call(this, killedByPlayer, ragDollId); Parent.prototype.kill.call(this, killedByPlayer, ragDollId);
Nc.trigger(Nc.ns.channel.to.client.gameCommand.broadcast, "playerKill", { nc.trigger(nc.ns.channel.to.client.gameCommand.broadcast, "playerKill", {
playerId: this.id, playerId: this.id,
killedByPlayerId: killedByPlayer.id, killedByPlayerId: killedByPlayer.id,
ragDollId: ragDollId, ragDollId: ragDollId,
item: byItem ? byItem.options.name : "Suicide" item: byItem ? byItem.options.name : "Suicide"
}); });
Nc.trigger(Nc.ns.channel.events.game.player.killed, this, killedByPlayer); // sends endround nc.trigger(nc.ns.channel.events.game.player.killed, this, killedByPlayer); // sends endround
if(this.ragDoll) { if(this.ragDoll) {
this.ragDoll.delayedDestroy(); this.ragDoll.delayedDestroy();
@ -112,13 +112,13 @@ function (Parent, Nc, PlayerController) {
}; };
Player.prototype.broadcastStats = function(enemy) { Player.prototype.broadcastStats = function(enemy) {
Nc.trigger(Nc.ns.channel.to.client.gameCommand.broadcast, "updateStats", { nc.trigger(nc.ns.channel.to.client.gameCommand.broadcast, "updateStats", {
playerId: this.id, playerId: this.id,
stats: this.stats stats: this.stats
}); });
if(enemy && enemy != this) { if(enemy && enemy != this) {
Nc.trigger(Nc.ns.channel.to.client.gameCommand.broadcast, "updateStats", { nc.trigger(nc.ns.channel.to.client.gameCommand.broadcast, "updateStats", {
playerId: enemy.id, playerId: enemy.id,
stats: enemy.stats stats: enemy.stats
}); });

View file

@ -5,7 +5,7 @@ define([
"Lib/Utilities/Protocol/Parser", "Lib/Utilities/Protocol/Parser",
], ],
function(Parent, Nc, ProtocolHelper, ProtocolParser) { function(Parent, nc, ProtocolHelper, ProtocolParser) {
function User(id, options) { function User(id, options) {
Parent.call(this, id, options); Parent.call(this, id, options);
@ -14,15 +14,15 @@ function(Parent, Nc, ProtocolHelper, ProtocolParser) {
this.isReady = false; this.isReady = false;
var self = this; var self = this;
Nc.on(Nc.ns.channel.to.client.user.controlCommand.joinSuccess + this.id, function(options) { nc.on(nc.ns.channel.to.client.user.controlCommand.joinSuccess + this.id, function(options) {
self.sendControlCommand("joinSuccess", options); self.sendControlCommand("joinSuccess", options);
}); });
Nc.on(Nc.ns.channel.events.controlCommand.user + this.id, function(message) { nc.on(nc.ns.channel.events.controlCommand.user + this.id, function(message) {
ProtocolHelper.applyCommand(message.data, self); ProtocolHelper.applyCommand(message.data, self);
}); });
Nc.on(Nc.ns.channel.to.client.user.gameCommand.send + this.id, function(command, options) { nc.on(nc.ns.channel.to.client.user.gameCommand.send + this.id, function(command, options) {
self.sendGameCommand(command, options); self.sendGameCommand(command, options);
}); });
@ -44,10 +44,10 @@ function(Parent, Nc, ProtocolHelper, ProtocolParser) {
} // FIXME: move this to Protocol helper as a function } // FIXME: move this to Protocol helper as a function
if(command.hasOwnProperty("resetLevel")) { if(command.hasOwnProperty("resetLevel")) {
Nc.trigger(Nc.ns.channel.events.user.level.reset, this.id); nc.trigger(nc.ns.channel.events.user.level.reset, this.id);
} else if(command.hasOwnProperty("clientReady")) { } else if(command.hasOwnProperty("clientReady")) {
this.isReady = true; this.isReady = true;
Nc.trigger(Nc.ns.channel.events.user.client.ready, this.id); nc.trigger(nc.ns.channel.events.user.client.ready, this.id);
} else { } else {
this.player.playerController.applyCommand(command); this.player.playerController.applyCommand(command);
} }
@ -71,7 +71,7 @@ function(Parent, Nc, ProtocolHelper, ProtocolParser) {
this.isReady = false; this.isReady = false;
} }
Nc.trigger(Nc.ns.channel.to.server.controlCommand.send, recipient, data); nc.trigger(nc.ns.channel.to.server.controlCommand.send, recipient, data);
}; };
User.prototype.sendGameCommand = function(command, options) { User.prototype.sendGameCommand = function(command, options) {

View file

@ -2,7 +2,7 @@ define([
"Lib/Utilities/NotificationCenter" "Lib/Utilities/NotificationCenter"
], ],
function (Nc) { function (nc) {
function Input(playerController) { function Input(playerController) {
this.playerController = playerController; this.playerController = playerController;

View file

@ -6,7 +6,7 @@ define([
"Game/Client/PointerLockManager" "Game/Client/PointerLockManager"
], ],
function (Parent, Nc, KeyboardAndMouse, Gamepad, PointerLockManager) { function (Parent, nc, KeyboardAndMouse, Gamepad, PointerLockManager) {
"use strict"; "use strict";
@ -29,85 +29,85 @@ function (Parent, Nc, KeyboardAndMouse, Gamepad, PointerLockManager) {
PlayerController.prototype.moveLeft = function () { PlayerController.prototype.moveLeft = function () {
if (!this.isPlayerInputAllowed()) return; if (!this.isPlayerInputAllowed()) return;
Parent.prototype.moveLeft.call(this); Parent.prototype.moveLeft.call(this);
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, 'moveLeft'); nc.trigger(nc.ns.client.to.server.gameCommand.send, 'moveLeft');
} }
PlayerController.prototype.moveRight = function () { PlayerController.prototype.moveRight = function () {
if (!this.isPlayerInputAllowed()) return; if (!this.isPlayerInputAllowed()) return;
Parent.prototype.moveRight.call(this); Parent.prototype.moveRight.call(this);
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, 'moveRight'); nc.trigger(nc.ns.client.to.server.gameCommand.send, 'moveRight');
} }
// always allow to stop, to prevent endless running // always allow to stop, to prevent endless running
PlayerController.prototype.stop = function () { PlayerController.prototype.stop = function () {
Parent.prototype.stop.call(this); Parent.prototype.stop.call(this);
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, 'stop'); nc.trigger(nc.ns.client.to.server.gameCommand.send, 'stop');
} }
PlayerController.prototype.jump = function () { PlayerController.prototype.jump = function () {
if (!this.isPlayerInputAllowed()) return; if (!this.isPlayerInputAllowed()) return;
Parent.prototype.jump.call(this); Parent.prototype.jump.call(this);
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, 'jump'); nc.trigger(nc.ns.client.to.server.gameCommand.send, 'jump');
} }
// always allow to stop. // always allow to stop.
PlayerController.prototype.jumpStop = function () { PlayerController.prototype.jumpStop = function () {
Parent.prototype.jumpStop.call(this); Parent.prototype.jumpStop.call(this);
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, 'jumpStop'); nc.trigger(nc.ns.client.to.server.gameCommand.send, 'jumpStop');
} }
PlayerController.prototype.setXY = function(x, y) { PlayerController.prototype.setXY = function(x, y) {
if (!this.isPlayerInputAllowed()) return; if (!this.isPlayerInputAllowed()) return;
var options = {x:x, y:y}; var options = {x:x, y:y};
Parent.prototype.lookAt.call(this, options); Parent.prototype.lookAt.call(this, options);
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, 'lookAt', options); nc.trigger(nc.ns.client.to.server.gameCommand.send, 'lookAt', options);
}; };
PlayerController.prototype.suicide = function() { PlayerController.prototype.suicide = function() {
if (!this.isPlayerInputAllowed()) return; if (!this.isPlayerInputAllowed()) return;
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, "suicide"); nc.trigger(nc.ns.client.to.server.gameCommand.send, "suicide");
}; };
PlayerController.prototype.handActionRequest = function(options) { PlayerController.prototype.handActionRequest = function(options) {
if (!this.isPlayerInputAllowed()) return; if (!this.isPlayerInputAllowed()) return;
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, "handActionRequest", options); nc.trigger(nc.ns.client.to.server.gameCommand.send, "handActionRequest", options);
}; };
PlayerController.prototype.showInfo = function() { PlayerController.prototype.showInfo = function() {
if (!this.isPlayerInputAllowed()) return; if (!this.isPlayerInputAllowed()) return;
Nc.trigger(Nc.ns.client.game.gameStats.toggle, true); nc.trigger(nc.ns.client.game.gameStats.toggle, true);
}; };
PlayerController.prototype.hideInfo = function() { PlayerController.prototype.hideInfo = function() {
if (!this.isPlayerInputAllowed()) return; if (!this.isPlayerInputAllowed()) return;
Nc.trigger(Nc.ns.client.game.gameStats.toggle, false); nc.trigger(nc.ns.client.game.gameStats.toggle, false);
}; };
PlayerController.prototype.zoomIn = function() { PlayerController.prototype.zoomIn = function() {
if (!this.isPlayerInputAllowed()) return; if (!this.isPlayerInputAllowed()) return;
Nc.trigger(Nc.ns.client.game.zoomIn, true); nc.trigger(nc.ns.client.game.zoomIn, true);
}; };
PlayerController.prototype.zoomOut = function() { PlayerController.prototype.zoomOut = function() {
if (!this.isPlayerInputAllowed()) return; if (!this.isPlayerInputAllowed()) return;
Nc.trigger(Nc.ns.client.game.zoomOut, false); nc.trigger(nc.ns.client.game.zoomOut, false);
}; };
PlayerController.prototype.zoomReset = function() { PlayerController.prototype.zoomReset = function() {
if (!this.isPlayerInputAllowed()) return; if (!this.isPlayerInputAllowed()) return;
Nc.trigger(Nc.ns.client.game.zoomReset, false); nc.trigger(nc.ns.client.game.zoomReset, false);
}; };
PlayerController.prototype.activateModifier = function() { PlayerController.prototype.activateModifier = function() {
if (!this.isPlayerInputAllowed()) return; if (!this.isPlayerInputAllowed()) return;
Parent.prototype.activateModifier.call(this); Parent.prototype.activateModifier.call(this);
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, "activateModifier"); nc.trigger(nc.ns.client.to.server.gameCommand.send, "activateModifier");
}; };
PlayerController.prototype.deactivateModifier = function() { PlayerController.prototype.deactivateModifier = function() {
if (!this.isPlayerInputAllowed()) return; if (!this.isPlayerInputAllowed()) return;
Parent.prototype.deactivateModifier.call(this); Parent.prototype.deactivateModifier.call(this);
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, "deactivateModifier"); nc.trigger(nc.ns.client.to.server.gameCommand.send, "deactivateModifier");
}; };
/* /*

View file

@ -2,7 +2,7 @@ define([
"Lib/Utilities/NotificationCenter", "Lib/Utilities/NotificationCenter",
], ],
function (Nc) { function (nc) {
var MAX_LENGTH = 200; var MAX_LENGTH = 200;
var MIN_LENGTH = 5; var MIN_LENGTH = 5;
@ -42,7 +42,7 @@ function (Nc) {
} }
var i = points.length - 1; var i = points.length - 1;
Nc.trigger(Nc.ns.client.view.swiper.swipe, points[i].x, points[i].y); nc.trigger(nc.ns.client.view.swiper.swipe, points[i].x, points[i].y);
} }
Swiper.prototype.updateLengthSum = function(currentLength) { Swiper.prototype.updateLengthSum = function(currentLength) {
@ -135,7 +135,7 @@ function (Nc) {
var sumx = 0; var sumx = 0;
var sumy = 0; var sumy = 0;
Nc.trigger(Nc.ns.client.view.swiper.end); nc.trigger(nc.ns.client.view.swiper.end);
for(var i=0, count = this.points.length; i < count; i++) { for(var i=0, count = this.points.length; i < count; i++) {
var p = this.points[i]; var p = this.points[i];
@ -166,7 +166,7 @@ function (Nc) {
Swiper.prototype.destroy = function() { Swiper.prototype.destroy = function() {
for (var i = 0; i < this.ncTokens.length; i++) { for (var i = 0; i < this.ncTokens.length; i++) {
Nc.off(this.ncTokens[i]); nc.off(this.ncTokens[i]);
}; };
}; };

View file

@ -18,7 +18,7 @@ define([
"Lib/Utilities/Exception" "Lib/Utilities/Exception"
], ],
function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Nc, requestAnimFrame, Settings, GameObject, Doll, domController, ProtocolHelper, Me, AudioPlayer, PointerLockManager, Assert, Exception) { function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, nc, requestAnimFrame, Settings, GameObject, Doll, domController, ProtocolHelper, Me, AudioPlayer, PointerLockManager, Assert, Exception) {
"use strict"; "use strict";
@ -33,7 +33,7 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Nc, reque
Parent.call(this, options); Parent.call(this, options);
this.ncTokens = this.ncTokens.concat([ this.ncTokens = this.ncTokens.concat([
Nc.on(Nc.ns.client.game.gameStats.toggle, this.toggleGameStats, this) nc.on(nc.ns.client.game.gameStats.toggle, this.toggleGameStats, this)
]); ]);
} }
@ -55,7 +55,7 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Nc, reque
this.mePositionStateOverride(); this.mePositionStateOverride();
} }
Nc.trigger(Nc.ns.client.game.events.render); nc.trigger(nc.ns.client.game.events.render);
this.view.render(); this.view.render();
domController.fpsStep(); domController.fpsStep();
@ -63,8 +63,8 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Nc, reque
GameController.prototype.mePositionStateOverride = function() { GameController.prototype.mePositionStateOverride = function() {
if(this.me.isPositionStateOverrideNeeded()) { if(this.me.isPositionStateOverrideNeeded()) {
Nc.trigger( nc.trigger(
Nc.ns.client.to.server.gameCommand.send, nc.ns.client.to.server.gameCommand.send,
"mePositionStateOverride", "mePositionStateOverride",
this.me.getPositionStateOverride() this.me.getPositionStateOverride()
); );
@ -214,7 +214,7 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Nc, reque
return 0; return 0;
}); });
Nc.trigger(Nc.ns.client.view.gameStats.update, sortedPlayers); nc.trigger(nc.ns.client.view.gameStats.update, sortedPlayers);
}; };
GameController.prototype.onPlayerKill = function(options) { GameController.prototype.onPlayerKill = function(options) {
@ -222,7 +222,7 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Nc, reque
var killedByPlayer = this.players[options.killedByPlayerId]; var killedByPlayer = this.players[options.killedByPlayerId];
player.kill(killedByPlayer, options.ragDollId); player.kill(killedByPlayer, options.ragDollId);
Nc.trigger(Nc.ns.client.view.gameStats.kill, { nc.trigger(nc.ns.client.view.gameStats.kill, {
victim: { victim: {
name: player.user.options.nickname, name: player.user.options.nickname,
isMe: player === this.me isMe: player === this.me
@ -248,7 +248,7 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Nc, reque
}; };
GameController.prototype.toggleGameStats = function(show) { GameController.prototype.toggleGameStats = function(show) {
Nc.trigger(Nc.ns.client.view.gameStats.toggle, show); nc.trigger(nc.ns.client.view.gameStats.toggle, show);
}; };
GameController.prototype.beginRound = function() { GameController.prototype.beginRound = function() {

View file

@ -7,7 +7,7 @@ define([
"Game/Client/View/Abstract/Layer", "Game/Client/View/Abstract/Layer",
], ],
function (Parent, Settings, Nc, Exception, ColorConverter, Layer) { function (Parent, Settings, nc, Exception, ColorConverter, Layer) {
"use strict"; "use strict";
@ -50,14 +50,14 @@ function (Parent, Settings, Nc, Exception, ColorConverter, Layer) {
if(!state) throw new Exception("action state is undefined"); if(!state) throw new Exception("action state is undefined");
if(this.animatedMeshes[this.actionState]) { if(this.animatedMeshes[this.actionState]) {
Nc.trigger( nc.trigger(
Nc.ns.client.view.mesh.update, nc.ns.client.view.mesh.update,
this.layerId, this.layerId,
this.animatedMeshesContainer.withArms[this.actionState], this.animatedMeshesContainer.withArms[this.actionState],
{ visible: false } { visible: false }
); );
Nc.trigger( nc.trigger(
Nc.ns.client.view.mesh.update, nc.ns.client.view.mesh.update,
this.layerId, this.layerId,
this.animatedMeshesContainer.withoutArms[this.actionState], this.animatedMeshesContainer.withoutArms[this.actionState],
{ visible: false } { visible: false }
@ -66,8 +66,8 @@ function (Parent, Settings, Nc, Exception, ColorConverter, Layer) {
Parent.prototype.setActionState.call(this, state); Parent.prototype.setActionState.call(this, state);
Nc.trigger( nc.trigger(
Nc.ns.client.view.mesh.update, nc.ns.client.view.mesh.update,
this.layerId, this.layerId,
this.animatedMeshes[this.actionState], this.animatedMeshes[this.actionState],
{ {
@ -82,7 +82,7 @@ function (Parent, Settings, Nc, Exception, ColorConverter, Layer) {
var self = this; var self = this;
var setShirtColor = function (mesh) { var setShirtColor = function (mesh) {
Nc.trigger(Nc.ns.client.view.mesh.addFilter, self.layerId, mesh, 'colorRangeReplace', { nc.trigger(nc.ns.client.view.mesh.addFilter, self.layerId, mesh, 'colorRangeReplace', {
minColor: 0x3b4a31, minColor: 0x3b4a31,
maxColor: 0x657f54, maxColor: 0x657f54,
newColor: self.primaryColor, newColor: self.primaryColor,
@ -131,12 +131,12 @@ function (Parent, Settings, Nc, Exception, ColorConverter, Layer) {
var callback = function(mesh) { var callback = function(mesh) {
self.animatedMeshesContainer[arm][key] = mesh; self.animatedMeshesContainer[arm][key] = mesh;
Nc.trigger(Nc.ns.client.view.mesh.add, self.layerId, mesh); nc.trigger(nc.ns.client.view.mesh.add, self.layerId, mesh);
setShirtColor(mesh); setShirtColor(mesh);
}; };
Nc.trigger(Nc.ns.client.view.animatedMesh.create, this.layerId, texturePaths, callback, { nc.trigger(nc.ns.client.view.animatedMesh.create, this.layerId, texturePaths, callback, {
visible: false, visible: false,
pivot: { pivot: {
x: 0, x: 0,
@ -159,9 +159,9 @@ function (Parent, Settings, Nc, Exception, ColorConverter, Layer) {
var texturePath = Settings.GRAPHICS_PATH + "Characters/Chuck/head.png"; var texturePath = Settings.GRAPHICS_PATH + "Characters/Chuck/head.png";
var callback = function (mesh) { var callback = function (mesh) {
self.headMesh = mesh; self.headMesh = mesh;
Nc.trigger(Nc.ns.client.view.mesh.add, self.layerId, mesh); nc.trigger(nc.ns.client.view.mesh.add, self.layerId, mesh);
} }
Nc.trigger(Nc.ns.client.view.mesh.create, this.layerId, texturePath, callback, { nc.trigger(nc.ns.client.view.mesh.create, this.layerId, texturePath, callback, {
pivot: { pivot: {
x: 5, x: 5,
y: 12 y: 12
@ -179,10 +179,10 @@ function (Parent, Settings, Nc, Exception, ColorConverter, Layer) {
texturePath = Settings.GRAPHICS_PATH + "Characters/Chuck/holdingArm.png"; texturePath = Settings.GRAPHICS_PATH + "Characters/Chuck/holdingArm.png";
var callback = function (mesh) { var callback = function (mesh) {
self.holdingArmMesh = mesh; self.holdingArmMesh = mesh;
Nc.trigger(Nc.ns.client.view.mesh.add, self.layerId, mesh); nc.trigger(nc.ns.client.view.mesh.add, self.layerId, mesh);
setShirtColor(mesh); setShirtColor(mesh);
} }
Nc.trigger(Nc.ns.client.view.mesh.create, this.layerId, texturePath, callback, { nc.trigger(nc.ns.client.view.mesh.create, this.layerId, texturePath, callback, {
visible: false, visible: false,
pivot: { pivot: {
//x: 35/2 * 4, //x: 35/2 * 4,
@ -206,7 +206,7 @@ function (Parent, Settings, Nc, Exception, ColorConverter, Layer) {
if(oldLookDirection != this.lookDirection) { if(oldLookDirection != this.lookDirection) {
for(var key in this.animatedMeshes) { for(var key in this.animatedMeshes) {
Nc.trigger(Nc.ns.client.view.mesh.update, nc.trigger(nc.ns.client.view.mesh.update,
this.layerId, this.layerId,
this.animatedMeshes[key], this.animatedMeshes[key],
{ {
@ -215,7 +215,7 @@ function (Parent, Settings, Nc, Exception, ColorConverter, Layer) {
); );
} }
Nc.trigger(Nc.ns.client.view.mesh.update, nc.trigger(nc.ns.client.view.mesh.update,
this.layerId, this.layerId,
this.holdingArmMesh, this.holdingArmMesh,
{ {
@ -226,7 +226,7 @@ function (Parent, Settings, Nc, Exception, ColorConverter, Layer) {
var angle = Math.atan2(this.lookAtXY.x, this.lookAtXY.y) / 2 - 0.7855 * this.lookDirection; // 0.7855 = 45° var angle = Math.atan2(this.lookAtXY.x, this.lookAtXY.y) / 2 - 0.7855 * this.lookDirection; // 0.7855 = 45°
Nc.trigger(Nc.ns.client.view.mesh.update, nc.trigger(nc.ns.client.view.mesh.update,
this.layerId, this.layerId,
this.headMesh, this.headMesh,
{ {
@ -240,22 +240,22 @@ function (Parent, Settings, Nc, Exception, ColorConverter, Layer) {
Parent.prototype.grab.call(this, item); Parent.prototype.grab.call(this, item);
this.animatedMeshes = this.animatedMeshesContainer.withoutArms; this.animatedMeshes = this.animatedMeshesContainer.withoutArms;
this.setActionState(this.actionState, true); this.setActionState(this.actionState, true);
Nc.trigger(Nc.ns.client.view.mesh.update, this.layerId, this.holdingArmMesh, { visible: true }); nc.trigger(nc.ns.client.view.mesh.update, this.layerId, this.holdingArmMesh, { visible: true });
}; };
Doll.prototype.throw = function(item, options) { Doll.prototype.throw = function(item, options) {
Parent.prototype.throw.call(this, item, options); Parent.prototype.throw.call(this, item, options);
this.animatedMeshes = this.animatedMeshesContainer.withArms; this.animatedMeshes = this.animatedMeshesContainer.withArms;
this.setActionState(this.actionState, true); this.setActionState(this.actionState, true);
Nc.trigger(Nc.ns.client.view.mesh.update, this.layerId, this.holdingArmMesh, { visible: false }); nc.trigger(nc.ns.client.view.mesh.update, this.layerId, this.holdingArmMesh, { visible: false });
}; };
Doll.prototype.destroy = function () { Doll.prototype.destroy = function () {
for (var key in this.animatedMeshes) { for (var key in this.animatedMeshes) {
Nc.trigger(Nc.ns.client.view.mesh.remove, this.layerId, this.animatedMeshes[key]); nc.trigger(nc.ns.client.view.mesh.remove, this.layerId, this.animatedMeshes[key]);
} }
Nc.trigger(Nc.ns.client.view.mesh.remove, this.layerId, this.headMesh); nc.trigger(nc.ns.client.view.mesh.remove, this.layerId, this.headMesh);
Parent.prototype.destroy.call(this); Parent.prototype.destroy.call(this);
} }
@ -272,7 +272,7 @@ function (Parent, Settings, Nc, Exception, ColorConverter, Layer) {
var factor = stepLength / 30; var factor = stepLength / 30;
Nc.trigger(Nc.ns.client.view.mesh.update, nc.trigger(nc.ns.client.view.mesh.update,
this.layerId, this.layerId,
this.animatedMeshes[this.actionState], this.animatedMeshes[this.actionState],
{ {
@ -283,7 +283,7 @@ function (Parent, Settings, Nc, Exception, ColorConverter, Layer) {
} }
); );
Nc.trigger(Nc.ns.client.view.mesh.update, nc.trigger(nc.ns.client.view.mesh.update,
this.layerId, this.layerId,
this.headMesh, this.headMesh,
{ {
@ -292,7 +292,7 @@ function (Parent, Settings, Nc, Exception, ColorConverter, Layer) {
} }
) )
Nc.trigger(Nc.ns.client.view.mesh.update, nc.trigger(nc.ns.client.view.mesh.update,
this.layerId, this.layerId,
this.holdingArmMesh, this.holdingArmMesh,
{ {

View file

@ -4,7 +4,7 @@ define([
"Lib/Utilities/NotificationCenter" "Lib/Utilities/NotificationCenter"
], ],
function (Parent, Exception, Nc) { function (Parent, Exception, nc) {
"use strict"; "use strict";

View file

@ -5,7 +5,7 @@ define([
"Game/Client/View/Abstract/Layer" "Game/Client/View/Abstract/Layer"
], ],
function (Parent, Settings, Nc, Layer) { function (Parent, Settings, nc, Layer) {
"use strict"; "use strict";
@ -14,7 +14,7 @@ function (Parent, Settings, Nc, Layer) {
Parent.call(this, physicsEngine, uid, options); Parent.call(this, physicsEngine, uid, options);
this.ncTokens = this.ncTokens.concat([ this.ncTokens = this.ncTokens.concat([
Nc.on(Nc.ns.client.game.events.render, this.render, this) nc.on(nc.ns.client.game.events.render, this.render, this)
]); ]);
} }
@ -30,10 +30,10 @@ function (Parent, Settings, Nc, Layer) {
var callback = function(mesh) { var callback = function(mesh) {
self.mesh = mesh; self.mesh = mesh;
Nc.trigger(Nc.ns.client.view.mesh.add, self.layerId, mesh); nc.trigger(nc.ns.client.view.mesh.add, self.layerId, mesh);
} }
Nc.trigger(Nc.ns.client.view.mesh.create, nc.trigger(nc.ns.client.view.mesh.create,
this.layerId, this.layerId,
texturePath, texturePath,
callback, callback,
@ -49,13 +49,13 @@ function (Parent, Settings, Nc, Layer) {
}; };
Item.prototype.destroy = function() { Item.prototype.destroy = function() {
Nc.trigger(Nc.ns.client.view.mesh.remove, this.layerId, this.mesh); nc.trigger(nc.ns.client.view.mesh.remove, this.layerId, this.mesh);
Parent.prototype.destroy.call(this); Parent.prototype.destroy.call(this);
}; };
Item.prototype.render = function() { Item.prototype.render = function() {
Nc.trigger(Nc.ns.client.view.mesh.update, nc.trigger(nc.ns.client.view.mesh.update,
this.layerId, this.layerId,
this.mesh, this.mesh,
{ {
@ -72,7 +72,7 @@ function (Parent, Settings, Nc, Layer) {
Parent.prototype.flip.call(this, direction); Parent.prototype.flip.call(this, direction);
if(oldFlipDirection != direction) { if(oldFlipDirection != direction) {
Nc.trigger(Nc.ns.client.view.mesh.update, nc.trigger(nc.ns.client.view.mesh.update,
this.layerId, this.layerId,
this.mesh, this.mesh,
{ {

View file

@ -6,7 +6,7 @@ define([
"Game/Client/View/Abstract/Layer" "Game/Client/View/Abstract/Layer"
], ],
function (Parent, CoreItem, Settings, Nc, Layer) { function (Parent, CoreItem, Settings, nc, Layer) {
"use strict"; "use strict";
@ -40,10 +40,10 @@ function (Parent, CoreItem, Settings, Nc, Layer) {
self.limbMeshes[name] = mesh; self.limbMeshes[name] = mesh;
} }
Nc.trigger(Nc.ns.client.view.mesh.add, self.layerId, mesh); nc.trigger(nc.ns.client.view.mesh.add, self.layerId, mesh);
} }
Nc.trigger(Nc.ns.client.view.mesh.create, nc.trigger(nc.ns.client.view.mesh.create,
this.layerId, this.layerId,
texturePath + name + ".png", texturePath + name + ".png",
callback, callback,
@ -64,7 +64,7 @@ function (Parent, CoreItem, Settings, Nc, Layer) {
if(this.limbs) { if(this.limbs) {
for(var name in this.limbMeshes) { for(var name in this.limbMeshes) {
if(this.limbs[name]) { if(this.limbs[name]) {
Nc.trigger(Nc.ns.client.view.mesh.update, nc.trigger(nc.ns.client.view.mesh.update,
this.layerId, this.layerId,
this.limbMeshes[name], this.limbMeshes[name],
{ {
@ -85,7 +85,7 @@ function (Parent, CoreItem, Settings, Nc, Layer) {
CoreItem.prototype.flip.call(this, direction); CoreItem.prototype.flip.call(this, direction);
if(oldFlipDirection != direction) { if(oldFlipDirection != direction) {
Nc.trigger(Nc.ns.client.view.mesh.update, nc.trigger(nc.ns.client.view.mesh.update,
this.layerId, this.layerId,
this.mesh, this.mesh,
{ {
@ -94,7 +94,7 @@ function (Parent, CoreItem, Settings, Nc, Layer) {
); );
for (var name in this.limbMeshes) { for (var name in this.limbMeshes) {
Nc.trigger(Nc.ns.client.view.mesh.update, nc.trigger(nc.ns.client.view.mesh.update,
this.layerId, this.layerId,
this.limbMeshes[name], this.limbMeshes[name],
{ {
@ -108,7 +108,7 @@ function (Parent, CoreItem, Settings, Nc, Layer) {
RagDoll.prototype.destroy = function() { RagDoll.prototype.destroy = function() {
for (var name in this.limbMeshes) { for (var name in this.limbMeshes) {
Nc.trigger(Nc.ns.client.view.mesh.remove, this.layerId, this.limbMeshes[name]); nc.trigger(nc.ns.client.view.mesh.remove, this.layerId, this.limbMeshes[name]);
}; };
Parent.prototype.destroy.call(this); Parent.prototype.destroy.call(this);

View file

@ -5,7 +5,7 @@ define([
"Lib/Utilities/NotificationCenter", "Lib/Utilities/NotificationCenter",
], ],
function (Parent, Layer, Settings, Nc) { function (Parent, Layer, Settings, nc) {
"use strict"; "use strict";
@ -131,10 +131,10 @@ function (Parent, Layer, Settings, Nc) {
self.limbMeshes[name] = mesh; self.limbMeshes[name] = mesh;
Nc.trigger(Nc.ns.client.view.mesh.add, self.layerId, mesh); nc.trigger(nc.ns.client.view.mesh.add, self.layerId, mesh);
// setting shirt color // setting shirt color
Nc.trigger(Nc.ns.client.view.mesh.addFilter, self.layerId, mesh, "colorRangeReplace", { nc.trigger(nc.ns.client.view.mesh.addFilter, self.layerId, mesh, "colorRangeReplace", {
minColor: 0x3b4a31, minColor: 0x3b4a31,
maxColor: 0x6d855d, maxColor: 0x6d855d,
newColor: self.primaryColor, newColor: self.primaryColor,
@ -142,7 +142,7 @@ function (Parent, Layer, Settings, Nc) {
}); });
}; };
Nc.trigger(Nc.ns.client.view.mesh.create, nc.trigger(nc.ns.client.view.mesh.create,
this.layerId, this.layerId,
texturePath + name + ".png", texturePath + name + ".png",
callback, callback,
@ -160,7 +160,7 @@ function (Parent, Layer, Settings, Nc) {
RubeDoll.prototype.destroy = function() { RubeDoll.prototype.destroy = function() {
for (var name in this.limbMeshes) { for (var name in this.limbMeshes) {
Nc.trigger(Nc.ns.client.view.mesh.remove, this.layerId, this.limbMeshes[name]); nc.trigger(nc.ns.client.view.mesh.remove, this.layerId, this.limbMeshes[name]);
}; };
Parent.prototype.destroy.call(this); Parent.prototype.destroy.call(this);
@ -169,7 +169,7 @@ function (Parent, Layer, Settings, Nc) {
RubeDoll.prototype.render = function() { RubeDoll.prototype.render = function() {
//Parent.prototype.render.call(this); //Parent.prototype.render.call(this);
Nc.trigger(Nc.ns.client.view.mesh.update, nc.trigger(nc.ns.client.view.mesh.update,
this.layerId, this.layerId,
this.mesh, this.mesh,
{ {
@ -182,7 +182,7 @@ function (Parent, Layer, Settings, Nc) {
if(this.limbs) { if(this.limbs) {
for(var name in this.limbMeshes) { for(var name in this.limbMeshes) {
if(this.limbs[name]) { if(this.limbs[name]) {
Nc.trigger(Nc.ns.client.view.mesh.update, nc.trigger(nc.ns.client.view.mesh.update,
this.layerId, this.layerId,
this.limbMeshes[name], this.limbMeshes[name],
{ {
@ -205,29 +205,29 @@ function (Parent, Layer, Settings, Nc) {
this.lastFlipDirection = direction; this.lastFlipDirection = direction;
Nc.trigger(Nc.ns.client.view.mesh.swapMeshIndexes, nc.trigger(nc.ns.client.view.mesh.swapMeshIndexes,
this.layerId, this.layerId,
this.limbMeshes["lowerRightLeg"], this.limbMeshes["lowerRightLeg"],
this.limbMeshes["lowerLeftLeg"] this.limbMeshes["lowerLeftLeg"]
); );
Nc.trigger(Nc.ns.client.view.mesh.swapMeshIndexes, nc.trigger(nc.ns.client.view.mesh.swapMeshIndexes,
this.layerId, this.layerId,
this.limbMeshes["upperRightLeg"], this.limbMeshes["upperRightLeg"],
this.limbMeshes["upperLeftLeg"] this.limbMeshes["upperLeftLeg"]
); );
Nc.trigger(Nc.ns.client.view.mesh.swapMeshIndexes, nc.trigger(nc.ns.client.view.mesh.swapMeshIndexes,
this.layerId, this.layerId,
this.limbMeshes["lowerRightArm"], this.limbMeshes["lowerRightArm"],
this.limbMeshes["lowerLeftArm"] this.limbMeshes["lowerLeftArm"]
); );
Nc.trigger(Nc.ns.client.view.mesh.swapMeshIndexes, nc.trigger(nc.ns.client.view.mesh.swapMeshIndexes,
this.layerId, this.layerId,
this.limbMeshes["upperRightArm"], this.limbMeshes["upperRightArm"],
this.limbMeshes["upperLeftArm"] this.limbMeshes["upperLeftArm"]
); );
// swap short images // swap short images
Nc.trigger(Nc.ns.client.view.mesh.swapMeshes, nc.trigger(nc.ns.client.view.mesh.swapMeshes,
this.layerId, this.layerId,
this.limbMeshes["upperRightLeg"], this.limbMeshes["upperRightLeg"],
this.limbMeshes["upperLeftLeg"] this.limbMeshes["upperLeftLeg"]
@ -238,7 +238,7 @@ function (Parent, Layer, Settings, Nc) {
if(this.limbs) { if(this.limbs) {
for(var name in this.limbMeshes) { for(var name in this.limbMeshes) {
if(this.limbs[name]) { if(this.limbs[name]) {
Nc.trigger(Nc.ns.client.view.mesh.update, nc.trigger(nc.ns.client.view.mesh.update,
this.layerId, this.layerId,
this.limbMeshes[name], this.limbMeshes[name],
{ {

View file

@ -5,7 +5,7 @@ define([
"Game/Client/View/Abstract/Layer" "Game/Client/View/Abstract/Layer"
], ],
function (Parent, Settings, Nc, Layer) { function (Parent, Settings, nc, Layer) {
"use strict"; "use strict";
@ -31,10 +31,10 @@ function (Parent, Settings, Nc, Layer) {
var callback = function(mesh) { var callback = function(mesh) {
self.mesh = mesh; self.mesh = mesh;
Nc.trigger(Nc.ns.client.view.mesh.add, self.layerId, mesh); nc.trigger(nc.ns.client.view.mesh.add, self.layerId, mesh);
} }
Nc.trigger(Nc.ns.client.view.mesh.create, nc.trigger(nc.ns.client.view.mesh.create,
this.layerId, this.layerId,
texturePath, texturePath,
callback, callback,
@ -50,13 +50,13 @@ function (Parent, Settings, Nc, Layer) {
}; };
Tile.prototype.destroy = function() { Tile.prototype.destroy = function() {
Nc.trigger(Nc.ns.client.view.mesh.remove, this.layerId, this.mesh); nc.trigger(nc.ns.client.view.mesh.remove, this.layerId, this.mesh);
Parent.prototype.destroy.call(this); Parent.prototype.destroy.call(this);
}; };
Tile.prototype.render = function() { Tile.prototype.render = function() {
Nc.trigger(Nc.ns.client.view.mesh.update, nc.trigger(nc.ns.client.view.mesh.update,
this.layerId, this.layerId,
this.mesh, this.mesh,
{ {

View file

@ -6,7 +6,7 @@ define([
"Game/Client/View/Abstract/Layer" "Game/Client/View/Abstract/Layer"
], ],
function (Parent, Settings, Nc, PIXI, AbstractLayer) { function (Parent, Settings, nc, PIXI, AbstractLayer) {
"use strict"; "use strict";
@ -46,7 +46,7 @@ function (Parent, Settings, Nc, PIXI, AbstractLayer) {
loader.onComplete = function() { callback(levelData); }; loader.onComplete = function() { callback(levelData); };
loader.onProgress = function() { loader.onProgress = function() {
var progress = parseInt(100 / numPaths * ++count, 10) + 1; var progress = parseInt(100 / numPaths * ++count, 10) + 1;
Nc.trigger(Nc.ns.client.view.preloadBar.update, progress); nc.trigger(nc.ns.client.view.preloadBar.update, progress);
} }
loader.load(); loader.load();
}; };
@ -116,8 +116,8 @@ function (Parent, Settings, Nc, PIXI, AbstractLayer) {
if (options.properties && options.properties.parallaxSpeed) { if (options.properties && options.properties.parallaxSpeed) {
parallaxSpeed = parseFloat(options.properties.parallaxSpeed); parallaxSpeed = parseFloat(options.properties.parallaxSpeed);
} }
Nc.trigger( nc.trigger(
Nc.ns.client.view.layer.createAndInsert, nc.ns.client.view.layer.createAndInsert,
options.layerId, options.layerId,
{ {
parallaxSpeed: parallaxSpeed, parallaxSpeed: parallaxSpeed,

View file

@ -4,7 +4,7 @@ define([
"Lib/Utilities/NotificationCenter", "Lib/Utilities/NotificationCenter",
], ],
function (Parent, Settings, Nc) { function (Parent, Settings, nc) {
"use strict"; "use strict";
@ -22,7 +22,7 @@ function (Parent, Settings, Nc) {
height: tilesLayerData.height * Settings.TILE_SIZE height: tilesLayerData.height * Settings.TILE_SIZE
}; };
Nc.trigger(Nc.ns.client.view.layer.levelSizeUpdate, this.levelSize); nc.trigger(nc.ns.client.view.layer.levelSizeUpdate, this.levelSize);
Parent.prototype.setup.call(this, levelData); Parent.prototype.setup.call(this, levelData);
}; };
@ -78,8 +78,8 @@ function (Parent, Settings, Nc) {
var texturePath = Settings.MAPS_PATH + options.image; var texturePath = Settings.MAPS_PATH + options.image;
var callback = function(mesh) { var callback = function(mesh) {
Nc.trigger(Nc.ns.client.view.mesh.add, options.layerId, mesh); nc.trigger(nc.ns.client.view.mesh.add, options.layerId, mesh);
Nc.trigger(Nc.ns.client.view.mesh.update, options.layerId, mesh, { nc.trigger(nc.ns.client.view.mesh.update, options.layerId, mesh, {
x: 0,//self.levelData.width * Settings.TILE_SIZE / 2, x: 0,//self.levelData.width * Settings.TILE_SIZE / 2,
y: 0,//self.levelData.height * Settings.TILE_SIZE / 2, y: 0,//self.levelData.height * Settings.TILE_SIZE / 2,
pivot: { pivot: {
@ -91,7 +91,7 @@ function (Parent, Settings, Nc) {
}); });
} }
Nc.trigger(Nc.ns.client.view.mesh.create, nc.trigger(nc.ns.client.view.mesh.create,
options.layerId, options.layerId,
texturePath, texturePath,
callback, callback,
@ -123,10 +123,10 @@ function (Parent, Settings, Nc) {
var tileType = parts[parts.length - 1].split(".")[0].split("") var tileType = parts[parts.length - 1].split(".")[0].split("")
var callback = function(mesh) { var callback = function(mesh) {
Nc.trigger(Nc.ns.client.view.mesh.add, options.layerId, mesh); nc.trigger(nc.ns.client.view.mesh.add, options.layerId, mesh);
} }
Nc.trigger(Nc.ns.client.view.mesh.create, nc.trigger(nc.ns.client.view.mesh.create,
options.layerId, options.layerId,
Settings.MAPS_PATH + imagePath, Settings.MAPS_PATH + imagePath,
callback, callback,

View file

@ -6,7 +6,7 @@ define([
"Game/Client/Control/PlayerController", "Game/Client/Control/PlayerController",
], ],
function (Parent, Settings, Nc, Assert, PlayerController) { function (Parent, Settings, nc, Assert, PlayerController) {
"use strict"; "use strict";
@ -108,7 +108,7 @@ function (Parent, Settings, Nc, Assert, PlayerController) {
var callback = function(arrowMesh) { var callback = function(arrowMesh) {
self.arrowMesh = arrowMesh; self.arrowMesh = arrowMesh;
}; };
Nc.trigger(Nc.ns.client.view.playerArrow.createAndAdd, callback, options); nc.trigger(nc.ns.client.view.playerArrow.createAndAdd, callback, options);
}; };
Me.prototype.render = function() { Me.prototype.render = function() {
@ -120,7 +120,7 @@ function (Parent, Settings, Nc, Assert, PlayerController) {
x: position.x * Settings.RATIO, x: position.x * Settings.RATIO,
y: position.y * Settings.RATIO, y: position.y * Settings.RATIO,
}; };
Nc.trigger(Nc.ns.client.view.playerArrow.update, this.arrowMesh, options); nc.trigger(nc.ns.client.view.playerArrow.update, this.arrowMesh, options);
}; };
return Me; return Me;

View file

@ -7,7 +7,7 @@ define([
"Game/Client/View/DomController" "Game/Client/View/DomController"
], ],
function (ProtocolHelper, GameController, User, Nc, Settings, domController) { function (ProtocolHelper, GameController, User, nc, Settings, domController) {
"use strict"; "use strict";
@ -47,8 +47,8 @@ function (ProtocolHelper, GameController, User, Nc, Settings, domController) {
ProtocolHelper.applyCommand(message, self); ProtocolHelper.applyCommand(message, self);
}); });
Nc.on(Nc.ns.client.to.server.gameCommand.send, this.sendGameCommand, this); nc.on(nc.ns.client.to.server.gameCommand.send, this.sendGameCommand, this);
Nc.on(Nc.ns.core.game.events.level.loaded, this.onLevelLoaded, this); nc.on(nc.ns.core.game.events.level.loaded, this.onLevelLoaded, this);
domController.setNick(nickname); domController.setNick(nickname);
} }

View file

@ -8,7 +8,7 @@ define([
"Game/Client/View/Pixi/Layers/Debug" "Game/Client/View/Pixi/Layers/Debug"
], ],
function (Parent, Settings, domController, Box2D, Nc, DebugDraw, debugLayer) { function (Parent, Settings, domController, Box2D, nc, DebugDraw, debugLayer) {
"use strict"; "use strict";
@ -17,7 +17,7 @@ function (Parent, Settings, domController, Box2D, Nc, DebugDraw, debugLayer) {
this.debugMode = false; this.debugMode = false;
Nc.on(Nc.ns.client.view.debugMode.toggle, this.onToggleDebugMode, this); nc.on(nc.ns.client.view.debugMode.toggle, this.onToggleDebugMode, this);
} }
Engine.prototype = Object.create(Parent.prototype); Engine.prototype = Object.create(Parent.prototype);

View file

@ -4,7 +4,7 @@ define([
"Game/Config/Settings" "Game/Config/Settings"
], ],
function (Parent, Nc, Settings) { function (Parent, nc, Settings) {
"use strict"; "use strict";
@ -17,7 +17,7 @@ function (Parent, Nc, Settings) {
this.initHealthBar(); this.initHealthBar();
this.ncTokens = (this.ncTokens || []).concat([ this.ncTokens = (this.ncTokens || []).concat([
Nc.on(Nc.ns.client.game.events.render, this.render, this) nc.on(nc.ns.client.game.events.render, this.render, this)
]); ]);
} }
@ -47,7 +47,7 @@ function (Parent, Nc, Settings) {
var callback = function(healthBarView) { var callback = function(healthBarView) {
self.healthBarView = healthBarView; self.healthBarView = healthBarView;
} }
Nc.trigger(Nc.ns.client.view.healthBar.createAndAdd, callback, options); nc.trigger(nc.ns.client.view.healthBar.createAndAdd, callback, options);
}; };
Player.prototype.onHealthChange = function() { Player.prototype.onHealthChange = function() {
@ -75,15 +75,15 @@ function (Parent, Nc, Settings) {
healthFactor: this.stats.health / 100, healthFactor: this.stats.health / 100,
visible: this.healthBarViewVisible visible: this.healthBarViewVisible
}; };
Nc.trigger(Nc.ns.client.view.healthBar.update, this.healthBarView, options); nc.trigger(nc.ns.client.view.healthBar.update, this.healthBarView, options);
this.healthBarViewVisibleTimeout = setTimeout(function() { this.healthBarViewVisibleTimeout = setTimeout(function() {
self.healthBarViewVisible = false; self.healthBarViewVisible = false;
Nc.trigger(Nc.ns.client.view.healthBar.update, self.healthBarView, {visible: self.healthBarViewVisible}); nc.trigger(nc.ns.client.view.healthBar.update, self.healthBarView, {visible: self.healthBarViewVisible});
}, Settings.HEALTH_DISPLAY_TIME * 1000); }, Settings.HEALTH_DISPLAY_TIME * 1000);
} else { } else {
Nc.trigger(Nc.ns.client.view.healthBar.update, this.healthBarView, {visible: this.healthBarViewVisible}); nc.trigger(nc.ns.client.view.healthBar.update, this.healthBarView, {visible: this.healthBarViewVisible});
} }
}; };
@ -100,7 +100,7 @@ function (Parent, Nc, Settings) {
x: position.x * Settings.RATIO, x: position.x * Settings.RATIO,
y: position.y * Settings.RATIO, y: position.y * Settings.RATIO,
} }
Nc.trigger(Nc.ns.client.view.healthBar.update, this.healthBarView, options); nc.trigger(nc.ns.client.view.healthBar.update, this.healthBarView, options);
} }
}; };
@ -110,8 +110,8 @@ function (Parent, Nc, Settings) {
Player.prototype.destroy = function() { Player.prototype.destroy = function() {
clearTimeout(this.healthBarViewVisibleTimeout); clearTimeout(this.healthBarViewVisibleTimeout);
Nc.trigger(Nc.ns.client.view.healthBar.remove, this.healthBarView); nc.trigger(nc.ns.client.view.healthBar.remove, this.healthBarView);
Nc.off(this.ncTokens); nc.off(this.ncTokens);
Parent.prototype.destroy.call(this); Parent.prototype.destroy.call(this);
}; };

View file

@ -3,7 +3,7 @@ define([
"Lib/Utilities/NotificationCenter" "Lib/Utilities/NotificationCenter"
], ],
function (Qs, Nc) { function (Qs, nc) {
"use strict"; "use strict";
@ -21,7 +21,7 @@ function (Qs, Nc) {
document.addEventListener('webkitpointerlockchange', this.update.bind(this), false); document.addEventListener('webkitpointerlockchange', this.update.bind(this), false);
this.ncTokens = [ this.ncTokens = [
Nc.on(Nc.ns.client.pointerLock.request, this.request, this) nc.on(nc.ns.client.pointerLock.request, this.request, this)
]; ];
} }
@ -40,7 +40,7 @@ function (Qs, Nc) {
// called by the browser event and others // called by the browser event and others
PointerLockManager.prototype.update = function(e, options) { PointerLockManager.prototype.update = function(e, options) {
options = options ? options : {}; options = options ? options : {};
Nc.trigger(Nc.ns.client.pointerLock.change, this.isLocked(), options); nc.trigger(nc.ns.client.pointerLock.change, this.isLocked(), options);
}; };
PointerLockManager.prototype.isLocked = function() { PointerLockManager.prototype.isLocked = function() {

View file

@ -3,7 +3,7 @@ define([
"Lib/Utilities/NotificationCenter" "Lib/Utilities/NotificationCenter"
], ],
function (Abstract, Nc) { function (Abstract, nc) {
"use strict"; "use strict";
@ -59,7 +59,7 @@ function (Abstract, Nc) {
Layer.prototype.destroy = function() { Layer.prototype.destroy = function() {
for (var i = 0; i < this.ncTokens.length; i++) { for (var i = 0; i < this.ncTokens.length; i++) {
Nc.off(this.ncTokens[i]); nc.off(this.ncTokens[i]);
}; };
}; };

View file

@ -6,7 +6,7 @@ define([
"Lib/Utilities/NotificationCenter" "Lib/Utilities/NotificationCenter"
], ],
function (Abstract, domController, Settings, Exception, Nc) { function (Abstract, domController, Settings, Exception, nc) {
"use strict"; "use strict";
@ -16,14 +16,14 @@ function (Abstract, domController, Settings, Exception, Nc) {
this.debugMode = false; this.debugMode = false;
this.ncTokens = [ this.ncTokens = [
Nc.on(Nc.ns.client.view.display.change, this.onDisplaySizeChange, this), nc.on(nc.ns.client.view.display.change, this.onDisplaySizeChange, this),
Nc.on(Nc.ns.client.view.debugMode.toggle, this.onToggleDebugMode, this), nc.on(nc.ns.client.view.debugMode.toggle, this.onToggleDebugMode, this),
Nc.on(Nc.ns.client.game.zoomIn, this.onZoomIn, this), nc.on(nc.ns.client.game.zoomIn, this.onZoomIn, this),
Nc.on(Nc.ns.client.game.zoomOut, this.onZoomOut, this), nc.on(nc.ns.client.game.zoomOut, this.onZoomOut, this),
Nc.on(Nc.ns.client.game.zoomReset, this.onZoomReset, this), nc.on(nc.ns.client.game.zoomReset, this.onZoomReset, this),
Nc.on(Nc.ns.client.view.preloadBar.update, this.onUpdateLoader, this), nc.on(nc.ns.client.view.preloadBar.update, this.onUpdateLoader, this),
]; ];
} }
@ -98,7 +98,7 @@ function (Abstract, domController, Settings, Exception, Nc) {
AbstractView.prototype.destroy = function() { AbstractView.prototype.destroy = function() {
for (var i = 0; i < this.ncTokens.length; i++) { for (var i = 0; i < this.ncTokens.length; i++) {
Nc.off(this.ncTokens[i]); nc.off(this.ncTokens[i]);
}; };
}; };

View file

@ -6,7 +6,7 @@ define([
"Game/Client/PointerLockManager" "Game/Client/PointerLockManager"
], ],
function (Settings, Nc, Screenfull, Graph, PointerLockManager) { function (Settings, nc, Screenfull, Graph, PointerLockManager) {
"use strict"; "use strict";
@ -122,7 +122,7 @@ function (Settings, Nc, Screenfull, Graph, PointerLockManager) {
var checkbox = document.createElement("input"); var checkbox = document.createElement("input");
checkbox.type = "checkbox"; checkbox.type = "checkbox";
checkbox.onclick = function(e) { checkbox.onclick = function(e) {
Nc.trigger(Nc.ns.client.view.debugMode.toggle, e.target.checked); nc.trigger(nc.ns.client.view.debugMode.toggle, e.target.checked);
}; };
label.appendChild(checkbox); label.appendChild(checkbox);
label.appendChild(document.createTextNode("Debug")); label.appendChild(document.createTextNode("Debug"));
@ -147,7 +147,7 @@ function (Settings, Nc, Screenfull, Graph, PointerLockManager) {
// FIXME : isn't this a weird place for this? // FIXME : isn't this a weird place for this?
window.onresize = function() { window.onresize = function() {
Nc.trigger(Nc.ns.client.view.display.change); nc.trigger(nc.ns.client.view.display.change);
}; };
}; };
@ -180,7 +180,7 @@ function (Settings, Nc, Screenfull, Graph, PointerLockManager) {
}; };
DomController.prototype.initCanvas = function (canvas) { DomController.prototype.initCanvas = function (canvas) {
Nc.trigger(Nc.ns.client.view.display.change, Screenfull.isFullscreen); nc.trigger(nc.ns.client.view.display.change, Screenfull.isFullscreen);
}; };
DomController.prototype.setConnected = function(connected) { DomController.prototype.setConnected = function(connected) {

View file

@ -4,7 +4,7 @@ define([
"Game/Client/View/Pixi/Layer" "Game/Client/View/Pixi/Layer"
], ],
function (Nc, Exception, Layer) { function (nc, Exception, Layer) {
"use strict"; "use strict";
@ -13,16 +13,16 @@ function (Nc, Exception, Layer) {
this.container = container; this.container = container;
this.ncTokens = [ this.ncTokens = [
Nc.on(Nc.ns.client.view.layer.createAndInsert, this.createAndInsert, this), nc.on(nc.ns.client.view.layer.createAndInsert, this.createAndInsert, this),
Nc.on(Nc.ns.client.view.mesh.create, this.createMesh, this), nc.on(nc.ns.client.view.mesh.create, this.createMesh, this),
Nc.on(Nc.ns.client.view.animatedMesh.create, this.createAnimatedMesh, this), nc.on(nc.ns.client.view.animatedMesh.create, this.createAnimatedMesh, this),
Nc.on(Nc.ns.client.view.mesh.add, this.addMesh, this), nc.on(nc.ns.client.view.mesh.add, this.addMesh, this),
Nc.on(Nc.ns.client.view.mesh.remove, this.removeMesh, this), nc.on(nc.ns.client.view.mesh.remove, this.removeMesh, this),
Nc.on(Nc.ns.client.view.mesh.update, this.updateMesh, this), nc.on(nc.ns.client.view.mesh.update, this.updateMesh, this),
Nc.on(Nc.ns.client.view.mesh.addFilter, this.addFilter, this), nc.on(nc.ns.client.view.mesh.addFilter, this.addFilter, this),
Nc.on(Nc.ns.client.view.mesh.removeFilter, this.removeFilter, this), nc.on(nc.ns.client.view.mesh.removeFilter, this.removeFilter, this),
Nc.on(Nc.ns.client.view.mesh.swapMeshIndexes, this.swapMeshIndexes, this), nc.on(nc.ns.client.view.mesh.swapMeshIndexes, this.swapMeshIndexes, this),
Nc.on(Nc.ns.client.view.mesh.swapMeshes, this.swapMeshes, this) nc.on(nc.ns.client.view.mesh.swapMeshes, this.swapMeshes, this)
]; ];
} }
@ -171,7 +171,7 @@ function (Nc, Exception, Layer) {
LayerManager.prototype.destroy = function() { LayerManager.prototype.destroy = function() {
for (var i = 0; i < this.ncTokens.length; i++) { for (var i = 0; i < this.ncTokens.length; i++) {
Nc.off(this.ncTokens[i]); nc.off(this.ncTokens[i]);
}; };
for (var i = this.layers.length - 1; i >= 0; i--) { for (var i = this.layers.length - 1; i >= 0; i--) {
var layer = this.layers[i]; var layer = this.layers[i];

View file

@ -5,7 +5,7 @@ define([
"Lib/Vendor/Screenfull" "Lib/Vendor/Screenfull"
], ],
function (Settings, Nc, Stats, Screenfull) { function (Settings, nc, Stats, Screenfull) {
"use strict"; "use strict";

View file

@ -5,7 +5,7 @@ define([
"Lib/Utilities/ColorConverter" "Lib/Utilities/ColorConverter"
], ],
function (PIXI, Nc, Settings, ColorConverter) { function (PIXI, nc, Settings, ColorConverter) {
"use strict"; "use strict";
@ -63,8 +63,8 @@ function (PIXI, Nc, Settings, ColorConverter) {
this.sortedPlayers = []; this.sortedPlayers = [];
this.ncTokens = [ this.ncTokens = [
Nc.on(Nc.ns.client.view.gameStats.toggle, this.toggle, this), nc.on(nc.ns.client.view.gameStats.toggle, this.toggle, this),
Nc.on(Nc.ns.client.view.gameStats.update, this.update, this) nc.on(nc.ns.client.view.gameStats.update, this.update, this)
]; ];
} }
@ -197,7 +197,7 @@ function (PIXI, Nc, Settings, ColorConverter) {
GameStats.prototype.destroy = function() { GameStats.prototype.destroy = function() {
for (var i = 0; i < this.ncTokens.length; i++) { for (var i = 0; i < this.ncTokens.length; i++) {
Nc.off(this.ncTokens[i]); nc.off(this.ncTokens[i]);
}; };
}; };

View file

@ -7,7 +7,7 @@ define([
"Lib/Utilities/NotificationCenter" "Lib/Utilities/NotificationCenter"
], ],
function (Parent, PIXI, ColorRangeReplaceFilter, Settings, ColorConverter, Nc) { function (Parent, PIXI, ColorRangeReplaceFilter, Settings, ColorConverter, nc) {
"use strict"; "use strict";
@ -23,7 +23,7 @@ function (Parent, PIXI, ColorRangeReplaceFilter, Settings, ColorConverter, Nc) {
} }
this.ncTokens = this.ncTokens.concat([ this.ncTokens = this.ncTokens.concat([
Nc.on(Nc.ns.client.view.layer.levelSizeUpdate, this.onLevelSizeUpdate, this) nc.on(nc.ns.client.view.layer.levelSizeUpdate, this.onLevelSizeUpdate, this)
]); ]);
if (Settings.SHOW_LAYER_INFO) { if (Settings.SHOW_LAYER_INFO) {

View file

@ -5,7 +5,7 @@ define([
"Game/Config/Settings" "Game/Config/Settings"
], ],
function (Parent, PIXI, Nc, Settings) { function (Parent, PIXI, nc, Settings) {
"use strict"; "use strict";
@ -13,12 +13,12 @@ function (Parent, PIXI, Nc, Settings) {
Parent.call(this, "ghost", {parallaxSpeed: 0}); Parent.call(this, "ghost", {parallaxSpeed: 0});
this.ncTokens = this.ncTokens.concat([ this.ncTokens = this.ncTokens.concat([
Nc.on(Nc.ns.client.view.layer.levelSizeUpdate, this.onLevelSizeUpdate, this), nc.on(nc.ns.client.view.layer.levelSizeUpdate, this.onLevelSizeUpdate, this),
Nc.on(Nc.ns.client.view.playerArrow.createAndAdd, this.onCreateAndAddPlayerArrow, this), nc.on(nc.ns.client.view.playerArrow.createAndAdd, this.onCreateAndAddPlayerArrow, this),
Nc.on(Nc.ns.client.view.playerArrow.update, this.onUpdatePlayerArrow, this), nc.on(nc.ns.client.view.playerArrow.update, this.onUpdatePlayerArrow, this),
Nc.on(Nc.ns.client.view.healthBar.createAndAdd, this.onCreateAndAddHealthBar, this), nc.on(nc.ns.client.view.healthBar.createAndAdd, this.onCreateAndAddHealthBar, this),
Nc.on(Nc.ns.client.view.healthBar.update, this.onUpdateHealthBar, this), nc.on(nc.ns.client.view.healthBar.update, this.onUpdateHealthBar, this),
Nc.on(Nc.ns.client.view.healthBar.remove, this.onRemoveHealthBar, this), nc.on(nc.ns.client.view.healthBar.remove, this.onRemoveHealthBar, this),
]); ]);
} }

View file

@ -5,7 +5,7 @@ define([
"Game/Config/Settings" "Game/Config/Settings"
], ],
function (Parent, PIXI, Nc, Settings) { function (Parent, PIXI, nc, Settings) {
"use strict"; "use strict";
@ -13,7 +13,7 @@ function (Parent, PIXI, Nc, Settings) {
Parent.call(this, "messages", {parallaxSpeed:-1}); Parent.call(this, "messages", {parallaxSpeed:-1});
this.ncTokens = this.ncTokens.concat([ this.ncTokens = this.ncTokens.concat([
Nc.on(Nc.ns.client.view.gameStats.kill, this.onKill, this) nc.on(nc.ns.client.view.gameStats.kill, this.onKill, this)
]); ]);
this.mainTextOptions = { this.mainTextOptions = {

View file

@ -5,7 +5,7 @@ define([
"Game/Config/Settings" "Game/Config/Settings"
], ],
function (Parent, PIXI, Nc, Settings) { function (Parent, PIXI, nc, Settings) {
function Swiper() { function Swiper() {
Parent.call(this, "swiper", {parallaxSpeed:0}); Parent.call(this, "swiper", {parallaxSpeed:0});
@ -13,8 +13,8 @@ function (Parent, PIXI, Nc, Settings) {
this.static = true; this.static = true;
this.ncTokens = this.ncTokens.concat([ this.ncTokens = this.ncTokens.concat([
Nc.on(Nc.ns.client.view.swiper.swipe, this.swipe, this), nc.on(nc.ns.client.view.swiper.swipe, this.swipe, this),
Nc.on(Nc.ns.client.view.swiper.end, this.end, this) nc.on(nc.ns.client.view.swiper.end, this.end, this)
]); ]);
this.sprite = new PIXI.Graphics(); this.sprite = new PIXI.Graphics();

View file

@ -14,7 +14,7 @@ define([
"Game/Client/View/Pixi/Layers/Messages" "Game/Client/View/Pixi/Layers/Messages"
], ],
function (Parent, domController, PIXI, Settings, Nc, Exception, GameStats, LayerManager, Ghost, Swiper, PointerLockManager, Debug, Messages) { function (Parent, domController, PIXI, Settings, nc, Exception, GameStats, LayerManager, Ghost, Swiper, PointerLockManager, Debug, Messages) {
"use strict"; "use strict";
@ -35,8 +35,8 @@ function (Parent, domController, PIXI, Settings, Nc, Exception, GameStats, Layer
this.init(); this.init();
this.ncTokens = this.ncTokens.concat([ this.ncTokens = this.ncTokens.concat([
Nc.on(Nc.ns.client.pointerLock.change, this.onPointerLockChange, this), nc.on(nc.ns.client.pointerLock.change, this.onPointerLockChange, this),
Nc.on(Nc.ns.core.game.events.level.loaded, this.showDefaultLayers, this) nc.on(nc.ns.core.game.events.level.loaded, this.showDefaultLayers, this)
]); ]);
PIXI.scaleModes.DEFAULT = PIXI.scaleModes.NEAREST; PIXI.scaleModes.DEFAULT = PIXI.scaleModes.NEAREST;

View file

@ -7,7 +7,7 @@ define([
"Lib/Utilities/NotificationCenter" "Lib/Utilities/NotificationCenter"
], ],
function (Settings, Exception, AbstractView, PixiView, Nc) { function (Settings, Exception, AbstractView, PixiView, nc) {
"use strict"; "use strict";

View file

@ -9,7 +9,7 @@ define([
"Lib/Utilities/Assert", "Lib/Utilities/Assert",
], ],
function (PhysicsEngine, TiledLevel, Player, Nc, Doll, GameObject, Item, Assert) { function (PhysicsEngine, TiledLevel, Player, nc, Doll, GameObject, Item, Assert) {
"use strict"; "use strict";
@ -24,8 +24,8 @@ function (PhysicsEngine, TiledLevel, Player, Nc, Doll, GameObject, Item, Assert)
this.physicsEngine.setCollisionDetector(); this.physicsEngine.setCollisionDetector();
this.ncTokens = [ this.ncTokens = [
Nc.on(Nc.ns.core.game.worldUpdateObjects.add, this.onWorldUpdateObjectAdd, this), nc.on(nc.ns.core.game.worldUpdateObjects.add, this.onWorldUpdateObjectAdd, this),
Nc.on(Nc.ns.core.game.worldUpdateObjects.remove, this.onWorldUpdateObjectRemove, this) nc.on(nc.ns.core.game.worldUpdateObjects.remove, this.onWorldUpdateObjectRemove, this)
]; ];
this.loadLevel(options.levelUid); this.loadLevel(options.levelUid);
@ -116,10 +116,10 @@ function (PhysicsEngine, TiledLevel, Player, Nc, Doll, GameObject, Item, Assert)
} }
// FIXME ns.client in core? // FIXME ns.client in core?
Nc.trigger(Nc.ns.client.game.events.destroy); nc.trigger(nc.ns.client.game.events.destroy);
// Testing after destroy if worldUpdateObjects is empty // Testing after destroy if worldUpdateObjects is empty
// events.game.destroy -> gameobjects.destroy() -> Nc.trigger(worldUpdateObjects.remove) // events.game.destroy -> gameobjects.destroy() -> nc.trigger(worldUpdateObjects.remove)
if(Object.keys(this.worldUpdateObjects).length > 0) { if(Object.keys(this.worldUpdateObjects).length > 0) {
console.warn('Not all worldUpdateObjects have been removed... ', Object.keys(this.worldUpdateObjects)); console.warn('Not all worldUpdateObjects have been removed... ', Object.keys(this.worldUpdateObjects));
} }
@ -127,7 +127,7 @@ function (PhysicsEngine, TiledLevel, Player, Nc, Doll, GameObject, Item, Assert)
this.physicsEngine.destroy(); this.physicsEngine.destroy();
this.worldUpdateObjects = null; this.worldUpdateObjects = null;
Nc.off(this.ncTokens); nc.off(this.ncTokens);
}; };
return GameController; return GameController;

View file

@ -9,7 +9,7 @@ define([
"Lib/Utilities/Assert" "Lib/Utilities/Assert"
], ],
function (Parent, Exception, Box2D, Settings, CollisionDetector, Item, Nc, Assert) { function (Parent, Exception, Box2D, Settings, CollisionDetector, Item, nc, Assert) {
"use strict"; "use strict";
@ -45,7 +45,7 @@ function (Parent, Exception, Box2D, Settings, CollisionDetector, Item, Nc, Asser
this.createFixtures(); this.createFixtures();
this.body.SetActive(false); this.body.SetActive(false);
Nc.trigger(Nc.ns.core.game.worldUpdateObjects.add, this); nc.trigger(nc.ns.core.game.worldUpdateObjects.add, this);
} }
Doll.prototype = Object.create(Parent.prototype); Doll.prototype = Object.create(Parent.prototype);
@ -481,7 +481,7 @@ function (Parent, Exception, Box2D, Settings, CollisionDetector, Item, Nc, Asser
}; };
Doll.prototype.destroy = function() { Doll.prototype.destroy = function() {
Nc.trigger(Nc.ns.core.game.worldUpdateObjects.remove, this); nc.trigger(nc.ns.core.game.worldUpdateObjects.remove, this);
Parent.prototype.destroy.call(this); Parent.prototype.destroy.call(this);
}; };

View file

@ -5,7 +5,7 @@ define([
"Lib/Utilities/NotificationCenter" "Lib/Utilities/NotificationCenter"
], ],
function (Box2D, Exception, Assert, Nc) { function (Box2D, Exception, Assert, nc) {
"use strict"; "use strict";
@ -17,7 +17,7 @@ function (Box2D, Exception, Assert, Nc) {
this.body = physicsEngine.createBody(def); this.body = physicsEngine.createBody(def);
this.ncTokens = (this.ncTokens || []).concat([ this.ncTokens = (this.ncTokens || []).concat([
Nc.on(Nc.ns.client.game.events.destroy, this.destroy, this) nc.on(nc.ns.client.game.events.destroy, this.destroy, this)
]); ]);
} }
@ -33,7 +33,7 @@ function (Box2D, Exception, Assert, Nc) {
throw new Exception("can not destroy body"); throw new Exception("can not destroy body");
} }
Nc.off(this.ncTokens); nc.off(this.ncTokens);
}; };
GameObject.prototype.getBody = function() { GameObject.prototype.getBody = function() {

View file

@ -8,7 +8,7 @@ define([
"Lib/Utilities/Assert" "Lib/Utilities/Assert"
], ],
function (Parent, Box2D, Options, Settings, Exception, Nc, Assert) { function (Parent, Box2D, Options, Settings, Exception, nc, Assert) {
"use strict"; "use strict";
@ -41,7 +41,7 @@ function (Parent, Box2D, Options, Settings, Exception, Nc, Assert) {
this.body.SetBullet(true); this.body.SetBullet(true);
} }
Nc.trigger(Nc.ns.core.game.worldUpdateObjects.add, this); nc.trigger(nc.ns.core.game.worldUpdateObjects.add, this);
} }
Item.prototype = Object.create(Parent.prototype); Item.prototype = Object.create(Parent.prototype);
@ -158,7 +158,7 @@ function (Parent, Box2D, Options, Settings, Exception, Nc, Assert) {
}; };
Item.prototype.destroy = function() { Item.prototype.destroy = function() {
Nc.trigger(Nc.ns.core.game.worldUpdateObjects.remove, this); nc.trigger(nc.ns.core.game.worldUpdateObjects.remove, this);
Parent.prototype.destroy.call(this); Parent.prototype.destroy.call(this);
}; };

View file

@ -8,7 +8,7 @@ define([
"Game/Config/ItemSettings", "Game/Config/ItemSettings",
], ],
function (Parent, Box2D, Settings, Nc, Assert, Options, ItemSettings) { function (Parent, Box2D, Settings, nc, Assert, Options, ItemSettings) {
"use strict"; "use strict";

View file

@ -9,7 +9,7 @@ define([
"json!Game/Asset/RubeDoll.json" // using requirejs json loader plugin "json!Game/Asset/RubeDoll.json" // using requirejs json loader plugin
], ],
function (Parent, RubeLoader, Box2D, Settings, Assert, Nc, Matrix, RubeDollJson) { function (Parent, RubeLoader, Box2D, Settings, Assert, nc, Matrix, RubeDollJson) {
"use strict"; "use strict";

View file

@ -7,7 +7,7 @@ define([
"Lib/Utilities/Assert" "Lib/Utilities/Assert"
], ],
function (Parent, Box2D, Settings, Exception, Nc, Assert) { function (Parent, Box2D, Settings, Exception, nc, Assert) {
"use strict"; "use strict";

View file

@ -10,7 +10,7 @@ define([
"Game/" + GLOBALS.context + "/GameObjects/Items/RagDoll", "Game/" + GLOBALS.context + "/GameObjects/Items/RagDoll",
"Game/" + GLOBALS.context + "/GameObjects/Items/RubeDoll" "Game/" + GLOBALS.context + "/GameObjects/Items/RubeDoll"
], function (Settings, Box2D, Nc, Abstract, CollisionDetector, Tile, Item, Skateboard, RagDoll, RubeDoll) { ], function (Settings, Box2D, nc, Abstract, CollisionDetector, Tile, Item, Skateboard, RagDoll, RubeDoll) {
"use strict"; "use strict";
@ -34,7 +34,7 @@ define([
Level.prototype.setup = function(levelData) { // jshint unused:false Level.prototype.setup = function(levelData) { // jshint unused:false
this.isLoaded = true; this.isLoaded = true;
Nc.trigger(Nc.ns.core.game.events.level.loaded); nc.trigger(nc.ns.core.game.events.level.loaded);
}; };
Level.prototype.createItems = function(options) { Level.prototype.createItems = function(options) {

View file

@ -13,7 +13,7 @@ define([
"Game/" + GLOBALS.context + "/GameObjects/Item", "Game/" + GLOBALS.context + "/GameObjects/Item",
"Game/" + GLOBALS.context + "/GameObjects/Items/Skateboard", "Game/" + GLOBALS.context + "/GameObjects/Items/Skateboard",
], function (Parent, Settings, ItemSettings, Box2D, Options, Exception, Nc, Assert, AbstractLayer, CollisionDetector, Tile, Item, Skateboard) { ], function (Parent, Settings, ItemSettings, Box2D, Options, Exception, nc, Assert, AbstractLayer, CollisionDetector, Tile, Item, Skateboard) {
"use strict"; "use strict";

View file

@ -5,7 +5,7 @@ define([
"Lib/Utilities/NotificationCenter" "Lib/Utilities/NotificationCenter"
], ],
function (Settings, Box2D, CollisionDetector, Nc) { function (Settings, Box2D, CollisionDetector, nc) {
"use strict"; "use strict";
@ -19,7 +19,7 @@ function (Settings, Box2D, CollisionDetector, Nc) {
this.worldQueue = []; this.worldQueue = [];
this.ncTokens = [ this.ncTokens = [
Nc.on(Nc.ns.channel.engine.worldQueue.add, this.addToWorldQueue, this) nc.on(nc.ns.channel.engine.worldQueue.add, this.addToWorldQueue, this)
]; ];
} }
@ -62,7 +62,7 @@ function (Settings, Box2D, CollisionDetector, Nc) {
} }
Engine.prototype.destroy = function() { Engine.prototype.destroy = function() {
Nc.offAll(this.ncTokens); nc.offAll(this.ncTokens);
delete this.world; delete this.world;
}; };

View file

@ -9,7 +9,7 @@ define([
"Game/" + GLOBALS.context + "/GameObjects/Items/RubeDoll" "Game/" + GLOBALS.context + "/GameObjects/Items/RubeDoll"
], ],
function (Doll, PlayerController, Settings, Nc, Exception, ColorConverter, SpectatorDoll, RubeDoll) { function (Doll, PlayerController, Settings, nc, Exception, ColorConverter, SpectatorDoll, RubeDoll) {
"use strict"; "use strict";

View file

@ -7,7 +7,7 @@ function (Exception) {
"use strict"; "use strict";
function populate(obj, path) { function populate(obj, path) {
path = path || "Nc.ns"; path = path || "nc.ns";
for(var key in obj) { for(var key in obj) {
if(!obj.hasOwnProperty(key)) continue; if(!obj.hasOwnProperty(key)) continue;
if(obj[key] === null) { if(obj[key] === null) {
@ -199,15 +199,15 @@ function (Exception) {
NotificationCenter.prototype.validate = function(topic) { NotificationCenter.prototype.validate = function(topic) {
if (topic === undefined) { if (topic === undefined) {
throw new Exception("Topic not registered in Nc. See stack trace."); throw new Exception("Topic not registered in nc. See stack trace.");
} }
if (typeof topic === 'object') { if (typeof topic === 'object') {
throw new Exception("Topic bad format " + JSON.stringify(topic)); throw new Exception("Topic bad format " + JSON.stringify(topic));
} }
if (topic.indexOf("Nc.ns") !== 0) { if (topic.indexOf("nc.ns") !== 0) {
throw new Exception("Topic bad format, does not begin with Nc.ns. : " + topic); throw new Exception("Topic bad format, does not begin with nc.ns. : " + topic);
} }
}; };
@ -266,7 +266,7 @@ function (Exception) {
} }
} }
// should be treated as a private function - use Nc.off(Array); // should be treated as a private function - use nc.off(Array);
NotificationCenter.prototype.offAll = function (tokens) { NotificationCenter.prototype.offAll = function (tokens) {
for (var i = 0; i < tokens.length; i++) { for (var i = 0; i < tokens.length; i++) {
this.off(tokens[i]); this.off(tokens[i]);

View file

@ -7,7 +7,7 @@ define([
"fs" "fs"
], ],
function (Nc, ProtocolHelper, validate, Options, Settings, FileSystem) { function (nc, ProtocolHelper, validate, Options, Settings, FileSystem) {
"use strict"; "use strict";

View file

@ -5,14 +5,14 @@ define([
"Game/Config/Settings" "Game/Config/Settings"
], ],
function (User, PipeToChannel, Nc, Settings) { function (User, PipeToChannel, nc, Settings) {
"use strict"; "use strict";
function Coordinator() { function Coordinator() {
this.channelPipes = {}; this.channelPipes = {};
Nc.on(Nc.ns.server.events.controlCommand.coordinator, this.onMessage, this); nc.on(nc.ns.server.events.controlCommand.coordinator, this.onMessage, this);
console.checkpoint('create Coordinator'); console.checkpoint('create Coordinator');
} }

View file

@ -3,7 +3,7 @@ define([
"child_process" "child_process"
], ],
function (Nc, childProcess) { function (nc, childProcess) {
"use strict"; "use strict";
@ -57,10 +57,10 @@ function (Nc, childProcess) {
PipeToChannel.prototype.onMessage = function (message) { PipeToChannel.prototype.onMessage = function (message) {
switch(message.recipient) { switch(message.recipient) {
case 'coordinator': case 'coordinator':
Nc.trigger(Nc.ns.server.events.controlCommand.coordinator, message.data); nc.trigger(nc.ns.server.events.controlCommand.coordinator, message.data);
break; break;
default: default:
Nc.trigger(Nc.ns.server.events.controlCommand.user + message.recipient, message.data); nc.trigger(nc.ns.server.events.controlCommand.user + message.recipient, message.data);
break; break;
} }

View file

@ -4,7 +4,7 @@ define([
"Lib/Utilities/NotificationCenter" "Lib/Utilities/NotificationCenter"
], ],
function (Parent, ProtocolHelper, Nc) { function (Parent, ProtocolHelper, nc) {
"use strict"; "use strict";
@ -19,7 +19,7 @@ function (Parent, ProtocolHelper, Nc) {
socketLink.on('message', this.onMessage.bind(this)); socketLink.on('message', this.onMessage.bind(this));
socketLink.on('disconnect', this.onDisconnect.bind(this)); socketLink.on('disconnect', this.onDisconnect.bind(this));
Nc.on(Nc.ns.server.events.controlCommand.user + this.id, this.socketLink.send, this.socketLink); nc.on(nc.ns.server.events.controlCommand.user + this.id, this.socketLink.send, this.socketLink);
} }
User.prototype = Object.create(Parent.prototype); User.prototype = Object.create(Parent.prototype);
@ -97,7 +97,7 @@ function (Parent, ProtocolHelper, Nc) {
User.prototype.onPing = function(timestamp) { User.prototype.onPing = function(timestamp) {
var message = ProtocolHelper.encodeCommand("pong", timestamp); var message = ProtocolHelper.encodeCommand("pong", timestamp);
Nc.trigger(Nc.ns.server.events.controlCommand.user + this.id, message); nc.trigger(nc.ns.server.events.controlCommand.user + this.id, message);
}; };
return User; return User;

View file

@ -27,7 +27,7 @@ requirejs([
"Menu/Menu" "Menu/Menu"
], ],
function (Networker, SocketIO, Settings, Exception, Nc, Menu) { function (Networker, SocketIO, Settings, Exception, nc, Menu) {
var menu = new Menu(); var menu = new Menu();
menu.onRun = function(channelName, nickname) { menu.onRun = function(channelName, nickname) {
@ -44,7 +44,7 @@ function (Networker, SocketIO, Settings, Exception, Nc, Menu) {
var networker = new Networker(socket, channelName, nickname); var networker = new Networker(socket, channelName, nickname);
Chuck.inspector.networker = networker; Chuck.inspector.networker = networker;
Chuck.inspector.settings = Settings; Chuck.inspector.settings = Settings;
Chuck.inspector.nc = Nc; Chuck.inspector.nc = nc;
Chuck.inspector.resetLevel = function() { networker.sendGameCommand("resetLevel"); } Chuck.inspector.resetLevel = function() { networker.sendGameCommand("resetLevel"); }
} }
menu.init(); menu.init();

View file

@ -6,7 +6,7 @@ define([
"Lib/Utilities/NotificationCenter" "Lib/Utilities/NotificationCenter"
], ],
function (Parent, ProtocolHelper, GameController, User, Nc) { function (Parent, ProtocolHelper, GameController, User) {
function Worker () { function Worker () {
//this.socketLink = socketLink; //this.socketLink = socketLink;
@ -40,7 +40,7 @@ function (Parent, ProtocolHelper, GameController, User, Nc) {
} }
}, this); }, this);
Nc.on(Nc.ns.client.to.server.gameCommand.send, this.sendGameCommand, this); nc.on(nc.ns.client.to.server.gameCommand.send, this.sendGameCommand, this);
} }
Worker.prototype.sendCommand = function (command, options) { Worker.prototype.sendCommand = function (command, options) {