Esempio n. 1
0
        protected virtual void Update()
        {
            var finalCounters = counters.Count > 0 ? counters : null;
            var total         = P3dChannelCounter.GetTotal(finalCounters);
            var count         = default(long);

            switch (channel)
            {
            case ChannelType.Red:   count = P3dChannelCounter.GetCountR(finalCounters); break;

            case ChannelType.Green: count = P3dChannelCounter.GetCountG(finalCounters); break;

            case ChannelType.Blue:  count = P3dChannelCounter.GetCountB(finalCounters); break;

            case ChannelType.Alpha: count = P3dChannelCounter.GetCountA(finalCounters); break;
            }

            if (inverse == true)
            {
                count = total - count;
            }

            var final   = format;
            var percent = P3dHelper.RatioToPercentage(P3dHelper.Divide(count, total), decimalPlaces);

            final = final.Replace("{TOTAL}", total.ToString());
            final = final.Replace("{COUNT}", count.ToString());
            final = final.Replace("{PERCENT}", percent.ToString());

            cachedText.text = final;
        }
        protected virtual void Update()
        {
            var finalCounters = counters.Count > 0 ? counters : null;
            var total         = P3dChangeCounter.GetTotal(finalCounters);
            var count         = P3dChangeCounter.GetCount(finalCounters);

            if (inverse == true)
            {
                count = total - count;
            }

            var final   = format;
            var percent = P3dHelper.RatioToPercentage(P3dHelper.Divide(count, total), decimalPlaces);

            final = final.Replace("{TOTAL}", total.ToString());
            final = final.Replace("{COUNT}", count.ToString());
            final = final.Replace("{PERCENT}", percent.ToString());

            cachedText.text = final;
        }
Esempio n. 3
0
 /// <summary>The <b>Ratio</b> of the specified counters.</summary>
 public static float GetRatio(P3dColor color, ICollection <P3dColorCounter> counters = null)
 {
     return(P3dHelper.Divide(GetCount(color, counters), GetTotal(counters)));
 }
Esempio n. 4
0
 /// <summary>The <b>CountA / Total</b> of the specified counters.</summary>
 public static float GetRatioA(ICollection <P3dChannelCounter> counters = null)
 {
     return(P3dHelper.Divide(GetCountA(counters), GetTotal(counters)));
 }