void RefreshAllChildre() { int activeIndex = 0; for (int i = 0; i < transform.childCount; i++) { Transform tf = transform.GetChild(i); if (tf.gameObject.activeSelf) { VC_LogItem instance = tf.GetComponent <VC_LogItem>(); instance.BackgroundColor = activeIndex % 2 != 0 ? logDefaultColor : logAlternateColor; activeIndex++; } } }
void RemoveCache(VC_LogItem instance) { logDictionary.Remove(instance.Log); if (instance.Log.Type == LogTypes.Log) { activeLogs.Remove(instance); } else if (instance.Log.Type == LogTypes.Warning) { activeWarning.Remove(instance); } else if (instance.Log.Type == LogTypes.Error) { activeError.Remove(instance); } }
//private IEnumerator MoveScrollbarNextFrame() //{ // // Updating all canvases can produce frame drops if there is too much to draw. If you remove this, the scrollbar won't snap at the bottom when a new log is added. // Canvas.ForceUpdateCanvases(); // yield return null; // _scrollbar.value = 0; //} void CacheLogItem(VC_Log log, VC_LogItem instance) { logDictionary.Add(log, instance); if (log.Type == LogTypes.Error) { instance.Icon = new Color(0.9607843f, 0.2538381f, 0.0588235f); instance.typeText.text = "Error"; activeError.Add(instance); } else if (log.Type == LogTypes.Warning) { instance.Icon = new Color(0.9622642f, 0.7508726f, 0.05900679f); instance.typeText.text = "Warning"; activeWarning.Add(instance); } else if (log.Type == LogTypes.Log) { instance.Icon = new Color(0.6911268f, 0.8204549f, 0.8773585f); instance.typeText.text = "Log"; activeLogs.Add(instance); } }