diff --git a/app/Game/Client/Networker.js b/app/Game/Client/Networker.js index e13c05e..55e5380 100755 --- a/app/Game/Client/Networker.js +++ b/app/Game/Client/Networker.js @@ -2,10 +2,11 @@ define([ "Game/Core/Protocol/Helper", "Game/Client/GameController", "Game/Client/User", - "Game/Core/NotificationCenter" + "Game/Core/NotificationCenter", + "Game/Config/Settings" ], -function (ProtocolHelper, GameController, User, NotificationCenter) { +function (ProtocolHelper, GameController, User, NotificationCenter, Settings) { function Networker (socketLink) { this.socketLink = socketLink; @@ -22,6 +23,9 @@ function (ProtocolHelper, GameController, User, NotificationCenter) { var self = this; this.socketLink.on('message', function (message) { + if(Settings.NETWORK_LOG_INCOMING) { + console.log('INCOMING', message); + } ProtocolHelper.applyCommand(message, self); }); @@ -85,6 +89,9 @@ function (ProtocolHelper, GameController, User, NotificationCenter) { Networker.prototype.sendCommand = function (command, options) { var message = ProtocolHelper.encodeCommand(command, options); this.socketLink.send(message); + if(Settings.NETWORK_LOG_OUTGOING) { + console.log('OUTGOING', message); + } } Networker.prototype.sendGameCommand = function(command, options) { diff --git a/app/Game/Config/Settings.js b/app/Game/Config/Settings.js index 5737e14..c39e7cc 100755 --- a/app/Game/Config/Settings.js +++ b/app/Game/Config/Settings.js @@ -48,5 +48,7 @@ define({ DEBUG_MODE: false, // NETWORKING - WORLD_UPDATE_BROADCAST_INTERVAL: 70 + WORLD_UPDATE_BROADCAST_INTERVAL: 70, + NETWORK_LOG_INCOMING: false, + NETWORK_LOG_OUTGOING: false }) \ No newline at end of file