public override void Update() { if (!m_IsComponentInvalidated) { return; } if (values == null) { return; } int totalCount = 0; int hiddenCount = 0; List <KeyValuePair <string, int> > listValues = new List <KeyValuePair <string, int> >(); List <KeyValuePair <string, int> > chartValues = new List <KeyValuePair <string, int> >(); foreach (KeyValuePair <String, int> kv in values) { if (Config.instance.IsTypeVisible(kv.Key)) { totalCount += kv.Value; if (kv.Value > 0) { chartValues.Add(kv); } } else { hiddenCount += kv.Value; } if (kv.Value > 0) { listValues.Add(kv); } } listValues.Sort(compare); chartValues.Sort(compare); chartValues.Reverse(); for (int i = 0; i < breakdown.Length; i++) { if (i > listValues.Count - 1) { breakdown[i].isVisible = false; } else { breakdown[i].isVisible = true; breakdown[i].SetVehicleDisplay(listValues[i].Key, listValues[i].Value, totalCount); } } if (totalCount == 0) { chart.enabled = false; if (hiddenCount > 0) { total.text = "Hidden: " + hiddenCount; } else { total.text = "No Traffic"; } } else { chart.enabled = true; chart.SetValues(chartValues, totalCount); total.text = "Total: " + totalCount; if (hiddenCount > 0) { total.text += " Hidden: " + hiddenCount; } } base.Update(); }