mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
added live network console.logging feature for incoming and outgoing data on client
This commit is contained in:
parent
5f7917c5cc
commit
efc5bc23b7
2 changed files with 12 additions and 3 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue