mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 23:24:41 +00:00
Merge branch 'Preview4_0_DevHead' into tsneo
This commit is contained in:
commit
ada1c5a021
521 changed files with 259 additions and 162 deletions
557
Templates/BaseGame/game/data/UI/guis/netGraphGui.gui
Normal file
557
Templates/BaseGame/game/data/UI/guis/netGraphGui.gui
Normal file
|
|
@ -0,0 +1,557 @@
|
|||
function execNetGraphGuiGUI()
|
||||
{
|
||||
if ( isObject( NetGraphGui ) )
|
||||
NetGraphGui.delete();
|
||||
|
||||
if ( isObject( NetGraphProfile ) )
|
||||
NetGraphProfile.delete();
|
||||
|
||||
if ( isObject( NetGraphGhostsActiveProfile ) )
|
||||
NetGraphGhostsActiveProfile.delete();
|
||||
|
||||
if ( isObject( NetGraphGhostUpdatesProfile ) )
|
||||
NetGraphGhostUpdatesProfile.delete();
|
||||
|
||||
if ( isObject( NetGraphBitsSentProfile ) )
|
||||
NetGraphBitsSentProfile.delete();
|
||||
|
||||
if ( isObject( NetGraphBitsReceivedProfile ) )
|
||||
NetGraphBitsReceivedProfile.delete();
|
||||
|
||||
if ( isObject( NetGraphLatencyProfile ) )
|
||||
NetGraphLatencyProfile.delete();
|
||||
|
||||
if ( isObject( NetGraphPacketLossProfile ) )
|
||||
NetGraphPacketLossProfile.delete();
|
||||
|
||||
exec( "./NetGraphGui.gui" );
|
||||
}
|
||||
|
||||
// Profiles
|
||||
new GuiControlProfile (NetGraphProfile)
|
||||
{
|
||||
modal = false;
|
||||
opaque = false;
|
||||
canKeyFocus = false;
|
||||
};
|
||||
|
||||
new GuiControlProfile (NetGraphKeyContainerProfile)
|
||||
{
|
||||
border = true;
|
||||
opaque = true;
|
||||
fillColor = "100 100 100 200";
|
||||
};
|
||||
new GuiControlProfile (NetGraphGhostsActiveProfile)
|
||||
{
|
||||
border = false;
|
||||
fontColor = "255 255 255";
|
||||
};
|
||||
new GuiControlProfile (NetGraphGhostUpdatesProfile)
|
||||
{
|
||||
border = false;
|
||||
fontColor = "255 0 0";
|
||||
};
|
||||
new GuiControlProfile (NetGraphBitsSentProfile)
|
||||
{
|
||||
border = false;
|
||||
fontColor = "0 255 0";
|
||||
};
|
||||
new GuiControlProfile (NetGraphBitsReceivedProfile)
|
||||
{
|
||||
border = false;
|
||||
fontColor = "0 0 255";
|
||||
};
|
||||
new GuiControlProfile (NetGraphLatencyProfile)
|
||||
{
|
||||
border = false;
|
||||
fontColor = "0 255 255";
|
||||
};
|
||||
new GuiControlProfile (NetGraphPacketLossProfile)
|
||||
{
|
||||
border = false;
|
||||
fontColor = "0 0 0";
|
||||
};
|
||||
|
||||
//--- OBJECT WRITE BEGIN ---
|
||||
$guiContent = new GuiControl(NetGraphGui) {
|
||||
position = "0 0";
|
||||
extent = "1024 768";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "left";
|
||||
vertSizing = "bottom";
|
||||
profile = "NetGraphProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "1";
|
||||
noCursor = "1";
|
||||
|
||||
new GuiGraphCtrl(NetGraph) {
|
||||
centerY = "1";
|
||||
plotColor[0] = "1 1 1 1";
|
||||
plotColor[1] = "1 0 0 1";
|
||||
plotColor[2] = "0 1 0 1";
|
||||
plotColor[3] = "0 0 1 1";
|
||||
plotColor[4] = "0 1 1 1";
|
||||
plotColor[5] = "0 0 0 1";
|
||||
plotType[0] = "PolyLine";
|
||||
plotType[1] = "PolyLine";
|
||||
plotType[2] = "PolyLine";
|
||||
plotType[3] = "PolyLine";
|
||||
plotType[4] = "PolyLine";
|
||||
plotType[5] = "PolyLine";
|
||||
plotInterval[0] = "0";
|
||||
plotInterval[1] = "0";
|
||||
plotInterval[2] = "0";
|
||||
plotInterval[3] = "0";
|
||||
plotInterval[4] = "0";
|
||||
plotInterval[5] = "0";
|
||||
position = "816 5";
|
||||
extent = "200 200";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "left";
|
||||
vertSizing = "bottom";
|
||||
profile = "NetGraphKeyContainerProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "0";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiControl() {
|
||||
position = "816 205";
|
||||
extent = "200 104";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "left";
|
||||
vertSizing = "bottom";
|
||||
profile = "NetGraphKeyContainerProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiTextCtrl(GhostsActive) {
|
||||
text = "Ghosts Active";
|
||||
maxLength = "255";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "0 0";
|
||||
extent = "100 18";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "left";
|
||||
vertSizing = "bottom";
|
||||
profile = "NetGraphGhostsActiveProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiTextCtrl(GhostUpdates) {
|
||||
text = "Ghost Updates";
|
||||
maxLength = "255";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "100 0";
|
||||
extent = "100 18";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "left";
|
||||
vertSizing = "bottom";
|
||||
profile = "NetGraphGhostUpdatesProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiTextCtrl(BitsSent) {
|
||||
text = "Bytes Sent";
|
||||
maxLength = "255";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "0 18";
|
||||
extent = "100 18";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "left";
|
||||
vertSizing = "bottom";
|
||||
profile = "NetGraphBitsSentProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiTextCtrl(BitsReceived) {
|
||||
text = "Bytes Received";
|
||||
maxLength = "255";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "100 18";
|
||||
extent = "100 18";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "left";
|
||||
vertSizing = "bottom";
|
||||
profile = "NetGraphBitsReceivedProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiTextCtrl(Latency) {
|
||||
text = "Latency";
|
||||
maxLength = "255";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "0 36";
|
||||
extent = "100 18";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "left";
|
||||
vertSizing = "bottom";
|
||||
profile = "NetGraphLatencyProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiTextCtrl(PacketLoss) {
|
||||
text = "Packet Loss";
|
||||
maxLength = "255";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "100 36";
|
||||
extent = "59 18";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "left";
|
||||
vertSizing = "bottom";
|
||||
profile = "NetGraphPacketLossProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
text = "Network Simulation:";
|
||||
maxLength = "255";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "0 52";
|
||||
extent = "97 18";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "left";
|
||||
vertSizing = "bottom";
|
||||
profile = "NetGraphPacketLossProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
text = "Simulated Latency:";
|
||||
maxLength = "255";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "0 68";
|
||||
extent = "91 18";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "left";
|
||||
vertSizing = "bottom";
|
||||
profile = "NetGraphPacketLossProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
text = "ms";
|
||||
maxLength = "255";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "179 68";
|
||||
extent = "20 18";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "left";
|
||||
vertSizing = "bottom";
|
||||
profile = "NetGraphPacketLossProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiTextEditCtrl(NetGraphSimLatency) {
|
||||
historySize = "0";
|
||||
tabComplete = "0";
|
||||
sinkAllKeyEvents = "0";
|
||||
password = "0";
|
||||
passwordMask = "*";
|
||||
text = "0";
|
||||
maxLength = "1024";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "112 67";
|
||||
extent = "64 18";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "GuiTextEditProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
text = "Simulated Packet Loss:";
|
||||
maxLength = "255";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "0 83";
|
||||
extent = "111 18";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "left";
|
||||
vertSizing = "bottom";
|
||||
profile = "NetGraphPacketLossProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
text = "%";
|
||||
maxLength = "255";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "179 84";
|
||||
extent = "20 18";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "left";
|
||||
vertSizing = "bottom";
|
||||
profile = "NetGraphPacketLossProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiTextEditCtrl(NetGraphSimPacket) {
|
||||
historySize = "0";
|
||||
tabComplete = "0";
|
||||
sinkAllKeyEvents = "0";
|
||||
password = "0";
|
||||
passwordMask = "*";
|
||||
text = "0";
|
||||
maxLength = "1024";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "112 85";
|
||||
extent = "64 18";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "GuiTextEditProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
command = "if(NetGraphSimLatency.text $= \"\" || NetGraphSimLatency.text < 0)\n{\n NetGraphSimLatency.text = 0;\n}\n\nif(NetGraphSimPacket.text $= \"\" || NetGraphSimPacket.text < 0)\n{\n NetGraphSimLatency.text = 0;\n}\nelse if(NetGraphSimPacket.text > 100)\n{\n NetGraphSimPacket.text = 100;\n}\n\nnetSimulateLag( NetGraphSimLatency.text, NetGraphSimPacket.text );";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
||||
// Functions
|
||||
function toggleNetGraph()
|
||||
{
|
||||
if(!$NetGraph::isInitialized)
|
||||
{
|
||||
NetGraph::updateStats();
|
||||
$NetGraph::isInitialized = true;
|
||||
}
|
||||
|
||||
if(!Canvas.isMember(NetGraphGui))
|
||||
{
|
||||
Canvas.add(NetGraphGui);
|
||||
}
|
||||
else
|
||||
{
|
||||
Canvas.remove(NetGraphGui);
|
||||
netSimulateLag( 0, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
NetGraph.addDatum(2,$Stats::netBitsSent);
|
||||
BitsSent.setText("Bytes Sent: " @ $Stats::netBitsSent);
|
||||
NetGraph.addDatum(3,$Stats::netBitsReceived);
|
||||
BitsReceived.setText("Bytes 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;
|
||||
}
|
||||
}
|
||||
|
||||
function NetGraphSimLatency::onReturn(%this)
|
||||
{
|
||||
NetGraph.updateNetworkSimulation();
|
||||
}
|
||||
|
||||
function NetGraphSimPacket::onReturn(%this)
|
||||
{
|
||||
NetGraph.updateNetworkSimulation();
|
||||
}
|
||||
|
||||
function NetGraph::updateNetworkSimulation(%this)
|
||||
{
|
||||
%latency = NetGraphSimLatency.getText();
|
||||
|
||||
if(%latency $= "" || %latency < 0)
|
||||
{
|
||||
NetGraphSimLatency.text = 0;
|
||||
%latency = 0;
|
||||
}
|
||||
|
||||
%packetLoss = NetGraphSimPacket.getText();
|
||||
|
||||
if(%packetLoss $= "" || %packetLoss < 0)
|
||||
{
|
||||
NetGraphSimLatency.text = 0;
|
||||
%packetLoss = 0;
|
||||
}
|
||||
else if(%packetLoss > 100)
|
||||
{
|
||||
NetGraphSimPacket.text = 100;
|
||||
%packetLoss = 100;
|
||||
}
|
||||
|
||||
netSimulateLag( %latency, %packetLoss );
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue