NC refactoring

This commit is contained in:
Jeena 2014-03-17 21:45:40 +01:00
parent 28f71f49e1
commit 96bf9bffbd
24 changed files with 69 additions and 69 deletions

View file

@ -50,7 +50,7 @@
var self = this;
if(!this.gameController.level || !this.gameController.level.isLoaded) {
var token = Nc.on("game/level/loaded", function() {
var token = Nc.on(Nc.ns.core.game.events.level.loaded, function() {
self.sendJoinSuccess(options);
Nc.off(token);
});
@ -82,14 +82,14 @@
//Nc.trigger('user/' + user.id + "/joinSuccess", options);
user.sendControlCommand("joinSuccess", options);
Nc.trigger('user/joined', user);
Nc.trigger(Nc.ns.channel.events.user.joined, user);
this.broadcastControlCommandExcept("userJoined", user.options, user);
};
Channel.prototype.onReleaseUser = function (userId) {
var user = this.users[userId];
Nc.trigger('user/left', userId);
Nc.trigger(Nc.ns.channel.events.user.left, userId);
delete this.users[userId];
this.broadcastControlCommand("userLeft", userId);

View file

@ -20,8 +20,8 @@ function (Parent, PhysicsEngine, Settings, PlayerController, requestAnimFrame, N
Parent.call(this);
Nc.on('user/joined', this.onUserJoined, this);
Nc.on('user/left', this.onUserLeft, 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('user/resetLevel', this.onResetLevel, this);
Nc.on('user/clientReady', this.onClientReady, this);
Nc.on('player/killed', this.onPlayerKilled, this);

View file

@ -37,7 +37,7 @@ function (Nc, Channel) {
};
PipeToServer.prototype.onMessage = function (message) {
Nc.trigger(message.recipient + '/controlCommand', message);
Nc.trigger(Nc.ns.channel.events.controlCommand + recipient, message);
}
PipeToServer.prototype.destroy = function() {