mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
debug draw overlay, fullscreen
This commit is contained in:
parent
383eaa93bf
commit
4afc39081d
13 changed files with 247 additions and 93 deletions
|
|
@ -3,10 +3,11 @@ define([
|
|||
"Game/Client/GameController",
|
||||
"Game/Client/User",
|
||||
"Lib/Utilities/NotificationCenter",
|
||||
"Game/Config/Settings"
|
||||
"Game/Config/Settings",
|
||||
"Game/Client/View/DomController"
|
||||
],
|
||||
|
||||
function (ProtocolHelper, GameController, User, NotificationCenter, Settings) {
|
||||
function (ProtocolHelper, GameController, User, NotificationCenter, Settings, DomController) {
|
||||
|
||||
function Networker (socketLink) {
|
||||
this.socketLink = socketLink;
|
||||
|
|
@ -74,10 +75,7 @@ function (ProtocolHelper, GameController, User, NotificationCenter, Settings) {
|
|||
}
|
||||
|
||||
Networker.prototype.initPing = function() {
|
||||
this.pingDOMElement = document.createElement("span");
|
||||
this.pingDOMElement.style.color = "white";
|
||||
this.pingDOMElement.style.fontFamily = "monospace";
|
||||
document.body.appendChild(this.pingDOMElement);
|
||||
|
||||
this.ping();
|
||||
};
|
||||
|
||||
|
|
@ -121,7 +119,8 @@ function (ProtocolHelper, GameController, User, NotificationCenter, Settings) {
|
|||
}
|
||||
|
||||
Networker.prototype.onPong = function(timestamp) {
|
||||
this.pingDOMElement.innerHTML = "Ping: " + (Date.now() - parseInt(timestamp, 10));
|
||||
var ping = (Date.now() - parseInt(timestamp, 10));
|
||||
DomController.setPing(ping);
|
||||
setTimeout(this.ping.bind(this), 1000);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue