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; }
void Update() { levelNumberText.text = "Level " + levelNumber.ToString(); likesNumberText.text = likesNumber.ToString(); var finalCounters = counters.Count > 0 ? counters : null; var total = P3dChangeCounter.GetTotal(finalCounters); var count = P3dChangeCounter.GetCount(finalCounters); count = total - count; var percent = P3dHelper.RatioToPercentage(P3dHelper.Divide(count, total), 0); //Debug.Log(percent.ToString()); }
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; }
/// <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))); }
/// <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))); }