183 lines
4.6 KiB
Plaintext
Executable File
183 lines
4.6 KiB
Plaintext
Executable File
// Profiles
|
|
new GuiControlProfile (NetGraphGhostsActiveProfile)
|
|
{
|
|
fontColor = "255 255 255";
|
|
};
|
|
new GuiControlProfile (NetGraphGhostUpdatesProfile)
|
|
{
|
|
fontColor = "255 0 0";
|
|
};
|
|
new GuiControlProfile (NetGraphBitsSentProfile)
|
|
{
|
|
fontColor = "0 255 0";
|
|
};
|
|
new GuiControlProfile (NetGraphBitsReceivedProfile)
|
|
{
|
|
fontColor = "0 0 255";
|
|
};
|
|
new GuiControlProfile (NetGraphLatencyProfile)
|
|
{
|
|
fontColor = "0 255 255";
|
|
};
|
|
new GuiControlProfile (NetGraphPacketLossProfile)
|
|
{
|
|
fontColor = "0 0 0";
|
|
};
|
|
|
|
//--- OBJECT WRITE BEGIN ---
|
|
new GuiControl(NetGraphGui) {
|
|
profile = "GuiDefaultProfile";
|
|
horizSizing = "left";
|
|
vertSizing = "bottom";
|
|
position = "0 0";
|
|
extent = "640 480";
|
|
minExtent = "8 2";
|
|
visible = "1";
|
|
noCursor = "1";
|
|
|
|
new GuiGraphCtrl(NetGraph) {
|
|
profile = "GuiDefaultProfile";
|
|
horizSizing = "left";
|
|
vertSizing = "bottom";
|
|
position = "432 5";
|
|
extent = "200 200";
|
|
minExtent = "8 2";
|
|
visible = "1";
|
|
};
|
|
|
|
new GuiTextCtrl(Latency) {
|
|
profile = "NetGraphLatencyProfile";
|
|
horizSizing = "left";
|
|
vertSizing = "bottom";
|
|
position = "436 184";
|
|
extent = "100 18";
|
|
minExtent = "8 2";
|
|
visible = "1";
|
|
text = "Latency";
|
|
maxLength = "255";
|
|
};
|
|
new GuiTextCtrl(PacketLoss) {
|
|
profile = "GuiTextProfile";
|
|
horizSizing = "left";
|
|
vertSizing = "bottom";
|
|
position = "536 184";
|
|
extent = "59 18";
|
|
minExtent = "8 2";
|
|
visible = "1";
|
|
text = "Packet Loss";
|
|
maxLength = "255";
|
|
};
|
|
new GuiTextCtrl(BitsReceived) {
|
|
profile = "NetGraphBitsReceivedProfile";
|
|
horizSizing = "left";
|
|
vertSizing = "bottom";
|
|
position = "536 170";
|
|
extent = "100 18";
|
|
minExtent = "8 2";
|
|
visible = "1";
|
|
text = "Bits Received";
|
|
maxLength = "255";
|
|
};
|
|
new GuiTextCtrl(GhostsActive) {
|
|
profile = "NetGraphGhostsActiveProfile";
|
|
horizSizing = "left";
|
|
vertSizing = "bottom";
|
|
position = "436 156";
|
|
extent = "100 18";
|
|
minExtent = "8 2";
|
|
visible = "1";
|
|
text = "Ghosts Active";
|
|
maxLength = "255";
|
|
};
|
|
new GuiTextCtrl(GhostUpdates) {
|
|
profile = "NetGraphGhostUpdatesProfile";
|
|
horizSizing = "left";
|
|
vertSizing = "bottom";
|
|
position = "536 156";
|
|
extent = "100 18";
|
|
minExtent = "8 2";
|
|
visible = "1";
|
|
text = "Ghost Updates";
|
|
maxLength = "255";
|
|
};
|
|
new GuiTextCtrl(BitsSent) {
|
|
profile = "NetGraphBitsSentProfile";
|
|
horizSizing = "left";
|
|
vertSizing = "bottom";
|
|
position = "436 170";
|
|
extent = "100 18";
|
|
minExtent = "8 2";
|
|
visible = "1";
|
|
text = "Bits Sent";
|
|
maxLength = "255";
|
|
};
|
|
};
|
|
//--- OBJECT WRITE END ---
|
|
|
|
// Functions
|
|
function NetGraph::toggleNetGraph()
|
|
{
|
|
if(!$NetGraph::isInitialized)
|
|
{
|
|
$Stats::netGhostUpdates = 0;
|
|
NetGraph::updateStats();
|
|
$NetGraph::isInitialized = true;
|
|
}
|
|
|
|
if(!Canvas.isMember(NetGraphGui))
|
|
{
|
|
Canvas.add(NetGraphGui);
|
|
}
|
|
else
|
|
Canvas.remove(NetGraphGui);
|
|
}
|
|
|
|
function NetGraph::updateStats()
|
|
{
|
|
$NetGraphThread = NetGraph.schedule(32, "updateStats");
|
|
|
|
if(!$Stats::netGhostUpdates)
|
|
return;
|
|
|
|
if(isobject(NetGraph))
|
|
{
|
|
if(isobject(ServerConnection))
|
|
NetGraph.addDatum(0,ServerConnection.getGhostsActive());
|
|
GhostsActive.setText("Ghosts Active: " @ ServerConnection.getGhostsActive());
|
|
NetGraph.addDatum(1,$Stats::netGhostUpdates);
|
|
GhostUpdates.setText("Ghost Updates: " @ $Stats::netGhostUpdates);
|
|
$Stats::netGhostUpdates = 0;
|
|
NetGraph.addDatum(2,$Stats::netBitsSent);
|
|
BitsSent.setText("Bits Sent: " @ $Stats::netBitsSent);
|
|
NetGraph.addDatum(3,$Stats::netBitsReceived);
|
|
BitsReceived.setText("Bits Received: " @ $Stats::netBitsReceived);
|
|
NetGraph.matchScale(2,3);
|
|
NetGraph.addDatum(4,ServerConnection.getPing());
|
|
Latency.setText("Latency: " @ ServerConnection.getPing());
|
|
NetGraph.addDatum(5,ServerConnection.getPacketLoss());
|
|
PacketLoss.setText("Packet Loss: " @ ServerConnection.getPacketLoss());
|
|
}
|
|
}
|
|
|
|
function NetGraph::toggleKey()
|
|
{
|
|
if(!GhostsActive.visible)
|
|
{
|
|
GhostsActive.visible = 1;
|
|
GhostUpdates.visible = 1;
|
|
BitsSent.visible = 1;
|
|
BitsReceived.visible = 1;
|
|
Latency.visible = 1;
|
|
PacketLoss.visible = 1;
|
|
}
|
|
else
|
|
{
|
|
GhostsActive.visible = 0;
|
|
GhostUpdates.visible = 0;
|
|
BitsSent.visible = 0;
|
|
BitsReceived.visible = 0;
|
|
Latency.visible = 0;
|
|
PacketLoss.visible = 0;
|
|
}
|
|
}
|