From d2e79723628d05056da03c5087f9a35bfc66fd59 Mon Sep 17 00:00:00 2001 From: logsol Date: Sun, 22 Jul 2012 02:08:51 +0200 Subject: [PATCH] changed notification center calling --- app/Game/Server/User.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/app/Game/Server/User.js b/app/Game/Server/User.js index 7c8818c..043fdb1 100755 --- a/app/Game/Server/User.js +++ b/app/Game/Server/User.js @@ -1,4 +1,9 @@ -define(["Game/Core/Protocol/Helper"], function(ProtocolHelper) { +define([ + "Game/Core/Protocol/Helper" + "Game/Server/NotificationCenter" +], + +function(ProtocolHelper, NotificationCenter) { function User(socketLink, coordinator) { @@ -24,18 +29,18 @@ define(["Game/Core/Protocol/Helper"], function(ProtocolHelper) { } User.prototype.setChannel = function(channel) { - if (this.notificationCenter) { - this.notificationCenter.off("updateClientsWorld"); + if (NotificationCenter) { + NotificationCenter.off("updateClientsWorld"); } this.channel = channel; // Use the right factory and nc - this.notificationCenter = this.channel.notificationCenter; + NotificationCenter = this.channel.notificationCenter; this.factory = this.channel.factory; var self = this; - this.notificationCenter.on("sendCommandToAllUsers", function(topic, args) { + NotificationCenter.on("sendCommandToAllUsers", function(topic, args) { self.sendCommand.apply(self, args); }); } @@ -70,7 +75,7 @@ define(["Game/Core/Protocol/Helper"], function(ProtocolHelper) { case 'gameCommand': for(var gameCommand in options) { - this.notificationCenter.trigger("processGameCommandFromUser", [gameCommand, options[gameCommand], this]); + NotificationCenter.trigger("processGameCommandFromUser", [gameCommand, options[gameCommand], this]); //this.channel.processGameCommandFromUser(gameCommand, options[gameCommand], this); } break;