Example #1
0
        private void DrawGlobalInfo(ref int posBaseY, string statsKey)
        {
            GUI.get_skin().get_label().set_alignment(3);
            GUI.set_contentColor(this.statsUI[statsKey].color);
            CountInfo countInfo = null;
            bool      flag      = statsKey == "players";

            if (flag)
            {
                countInfo       = new CountInfo();
                countInfo.count = 0L;
                foreach (TSPlayer current in this.lockstep.Players.Values)
                {
                    bool flag2 = !current.dropped;
                    if (flag2)
                    {
                        countInfo.count += 1L;
                    }
                }
            }
            else
            {
                countInfo = this.lockstep.compoundStats.globalStats.GetInfo(statsKey);
            }
            string arg = this.statsUI[statsKey].isAvg ? countInfo.averageFormatted() : string.Concat(countInfo.count);

            GUI.Label(new Rect((float)(this.width + this.marginRight), (float)posBaseY, (float)this.globalTextWidth, 20f), string.Format("{0}: {1}", this.statsUI[statsKey].description, arg));
            posBaseY += 20;
        }
Example #2
0
 public void Increment(string key)
 {
     if (!counts.ContainsKey(key))
     {
         counts[key] = new CountInfo();
     }
     counts[key].count += 1L;
 }
Example #3
0
        private void DrawLine(string statsKey)
        {
            GUI.get_skin().get_label().set_alignment(4);
            Color     color    = this.statsUI[statsKey].color;
            float     maxValue = this.statsUI[statsKey].maxValue;
            int       num      = (this.lockstep.compoundStats.bufferStats.currentIndex + 1) % this.lockstep.compoundStats.bufferStats.size;
            CountInfo info     = this.lockstep.compoundStats.bufferStats.buffer[num].GetInfo(statsKey);
            float     num2     = this.statsUI[statsKey].isAvg ? info.average() : ((float)info.count);
            Vector2   pointA   = new Vector2((float)this.marginLeft, (float)this.height * (1f - Mathf.Min(num2 / maxValue, 1f)));

            for (int i = 2; i <= this.lockstep.compoundStats.bufferStats.size - 1; i++)
            {
                int       num3  = (this.lockstep.compoundStats.bufferStats.currentIndex + i) % this.lockstep.compoundStats.bufferStats.size;
                CountInfo info2 = this.lockstep.compoundStats.bufferStats.buffer[num3].GetInfo(statsKey);
                num2 = (this.statsUI[statsKey].isAvg ? info2.average() : ((float)info2.count));
                Vector2 vector = new Vector2((float)this.marginLeft + this.barWidth * (float)(i - 1), (float)this.height * (1f - Mathf.Min(num2 / maxValue, 1f)));
                Drawing.DrawLine(pointA, vector, color);
                pointA = vector;
            }
        }
        private void DrawLine(string statsKey)
        {
            GUI.skin.label.alignment = TextAnchor.MiddleCenter;
            Color     color    = this.statsUI[statsKey].color;
            float     maxValue = this.statsUI[statsKey].maxValue;
            int       num      = (this.lockstep.compoundStats.bufferStats.currentIndex + 1) % this.lockstep.compoundStats.bufferStats.size;
            CountInfo info     = this.lockstep.compoundStats.bufferStats.buffer[num].GetInfo(statsKey);
            float     num2     = this.statsUI[statsKey].isAvg ? info.average() : ((float)info.count);

            this.baseVector.x = (float)this.marginLeft;
            this.baseVector.y = (float)this.height * (1f - Mathf.Min(num2 / maxValue, 1f));
            for (int i = 2; i <= this.lockstep.compoundStats.bufferStats.size - 1; i++)
            {
                int       num3  = (this.lockstep.compoundStats.bufferStats.currentIndex + i) % this.lockstep.compoundStats.bufferStats.size;
                CountInfo info2 = this.lockstep.compoundStats.bufferStats.buffer[num3].GetInfo(statsKey);
                num2          = (this.statsUI[statsKey].isAvg ? info2.average() : ((float)info2.count));
                this.newPos.x = (float)this.marginLeft + this.barWidth * (float)(i - 1);
                this.newPos.y = (float)this.height * (1f - Mathf.Min(num2 / maxValue, 1f));
                Drawing.DrawLine(this.baseVector, this.newPos, color);
                this.baseVector = this.newPos;
            }
        }