Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ DrawCounter()

void Terraria.UI.NetDiagnosticsUI.DrawCounter ( SpriteBatch spriteBatch,
ref CounterForMessage counter,
string title,
Vector2 position )
inlineprivate

Definition at line 117 of file NetDiagnosticsUI.cs.

118 {
119 if (!counter.exemptFromBadScoreTest)
120 {
121 if (_highestFoundReadCount < counter.timesReceived)
122 {
123 _highestFoundReadCount = counter.timesReceived;
124 }
125 if (_highestFoundReadBytes < counter.bytesReceived)
126 {
127 _highestFoundReadBytes = counter.bytesReceived;
128 }
129 }
130 Vector2 pos = position;
131 string text = title + ": ";
132 float num = Utils.Remap(counter.bytesReceived, 0f, _highestFoundReadBytes, 0f, 1f);
133 Color color = Main.hslToRgb(0.3f * (1f - num), 1f, 0.5f);
134 if (counter.exemptFromBadScoreTest)
135 {
136 color = Color.White;
137 }
138 string text2 = "";
139 text2 = text;
140 DrawText(spriteBatch, text2, pos, color);
141 pos.X += 30f;
142 text2 = "rx:" + $"{counter.timesReceived}";
143 DrawText(spriteBatch, text2, pos, color);
144 pos.X += 70f;
145 text2 = $"{counter.bytesReceived}";
146 DrawText(spriteBatch, text2, pos, color);
147 pos.X += 70f;
148 text2 = text;
149 DrawText(spriteBatch, text2, pos, color);
150 pos.X += 30f;
151 text2 = "tx:" + $"{counter.timesSent}";
152 DrawText(spriteBatch, text2, pos, color);
153 pos.X += 70f;
154 text2 = $"{counter.bytesSent}";
155 DrawText(spriteBatch, text2, pos, color);
156 }
void DrawText(SpriteBatch spriteBatch, string text, Vector2 pos, Color color)

References Terraria.UI.NetDiagnosticsUI._highestFoundReadBytes, Terraria.UI.NetDiagnosticsUI._highestFoundReadCount, Terraria.UI.NetDiagnosticsUI.DrawText(), Terraria.Main.hslToRgb(), Terraria.Utils.Remap(), and Microsoft.Xna.Framework.Color.White.

Referenced by Terraria.UI.NetDiagnosticsUI.Draw().