public void Draw(SpriteBatch spriteBatch) { int num = _counterByMessageId.Length + _counterByModuleId.Count; for (int i = 0; i <= num / 51; i++) { Utils.DrawInvBG(spriteBatch, 190 + 400 * i, 110, 390, 683); } Vector2 position = default(Vector2); for (int j = 0; j < _counterByMessageId.Length; j++) { int num2 = j / 51; int num3 = j - num2 * 51; position.X = 200 + num2 * 400; position.Y = 120 + num3 * 13; DrawCounter(spriteBatch, ref _counterByMessageId[j], j.ToString(), position); } int num4 = _counterByMessageId.Length + 1; foreach (KeyValuePair <int, CounterForMessage> item in _counterByModuleId) { int num5 = num4 / 51; int num6 = num4 - num5 * 51; position.X = 200 + num5 * 400; position.Y = 120 + num6 * 13; CounterForMessage counter = item.Value; DrawCounter(spriteBatch, ref counter, ".." + item.Key.ToString(), position); num4++; } }
private void DrawCounter(SpriteBatch spriteBatch, ref CounterForMessage counter, string title, Vector2 position) { if (!counter.exemptFromBadScoreTest) { if (_highestFoundReadCount < counter.timesReceived) { _highestFoundReadCount = counter.timesReceived; } if (_highestFoundReadBytes < counter.bytesReceived) { _highestFoundReadBytes = counter.bytesReceived; } } Vector2 pos = position; string text = title + ": "; float num = Utils.Remap(counter.bytesReceived, 0f, _highestFoundReadBytes, 0f, 1f); Color color = Main.hslToRgb(0.3f * (1f - num), 1f, 0.5f); if (counter.exemptFromBadScoreTest) { color = Color.White; } string text2 = ""; text2 = text; DrawText(spriteBatch, text2, pos, color); pos.X += 30f; text2 = "rx:" + string.Format("{0,0}", counter.timesReceived); DrawText(spriteBatch, text2, pos, color); pos.X += 70f; text2 = string.Format("{0,0}", counter.bytesReceived); DrawText(spriteBatch, text2, pos, color); pos.X += 70f; text2 = text; DrawText(spriteBatch, text2, pos, color); pos.X += 30f; text2 = "tx:" + string.Format("{0,0}", counter.timesSent); DrawText(spriteBatch, text2, pos, color); pos.X += 70f; text2 = string.Format("{0,0}", counter.bytesSent); DrawText(spriteBatch, text2, pos, color); }