Example #1
0
        public void Draw(SpriteBatch spriteBatch)
        {
            int num1 = this._counterByMessageId.Length + this._counterByModuleId.Count;

            for (int index = 0; index <= num1 / 51; ++index)
            {
                Utils.DrawInvBG(spriteBatch, 190 + 400 * index, 110, 390, 683, new Color());
            }
            Vector2 position;

            for (int index = 0; index < this._counterByMessageId.Length; ++index)
            {
                int num2 = index / 51;
                int num3 = index - num2 * 51;
                position.X = (float)(200 + num2 * 400);
                position.Y = (float)(120 + num3 * 13);
                this.DrawCounter(spriteBatch, ref this._counterByMessageId[index], index.ToString(), position);
            }
            int num4 = this._counterByMessageId.Length + 1;

            foreach (KeyValuePair <int, NetDiagnosticsUI.CounterForMessage> keyValuePair in this._counterByModuleId)
            {
                int num2 = num4 / 51;
                int num3 = num4 - num2 * 51;
                position.X = (float)(200 + num2 * 400);
                position.Y = (float)(120 + num3 * 13);
                NetDiagnosticsUI.CounterForMessage counter = keyValuePair.Value;
                this.DrawCounter(spriteBatch, ref counter, ".." + keyValuePair.Key.ToString(), position);
                ++num4;
            }
        }
Example #2
0
        private void DrawCounter(
            SpriteBatch spriteBatch,
            ref NetDiagnosticsUI.CounterForMessage counter,
            string title,
            Vector2 position)
        {
            if (!counter.exemptFromBadScoreTest)
            {
                if (this._highestFoundReadCount < counter.timesReceived)
                {
                    this._highestFoundReadCount = counter.timesReceived;
                }
                if (this._highestFoundReadBytes < counter.bytesReceived)
                {
                    this._highestFoundReadBytes = counter.bytesReceived;
                }
            }
            Vector2 pos   = position;
            string  str   = title + ": ";
            Color   color = Main.hslToRgb((float)(0.300000011920929 * (1.0 - (double)Utils.Remap((float)counter.bytesReceived, 0.0f, (float)this._highestFoundReadBytes, 0.0f, 1f, true))), 1f, 0.5f);

            if (counter.exemptFromBadScoreTest)
            {
                color = Color.White;
            }
            string text1 = str;

            this.DrawText(spriteBatch, text1, pos, color);
            pos.X += 30f;
            string text2 = "rx:" + string.Format("{0,0}", (object)counter.timesReceived);

            this.DrawText(spriteBatch, text2, pos, color);
            pos.X += 70f;
            string text3 = string.Format("{0,0}", (object)counter.bytesReceived);

            this.DrawText(spriteBatch, text3, pos, color);
            pos.X += 70f;
            string text4 = str;

            this.DrawText(spriteBatch, text4, pos, color);
            pos.X += 30f;
            string text5 = "tx:" + string.Format("{0,0}", (object)counter.timesSent);

            this.DrawText(spriteBatch, text5, pos, color);
            pos.X += 70f;
            string text6 = string.Format("{0,0}", (object)counter.bytesSent);

            this.DrawText(spriteBatch, text6, pos, color);
        }