protected override void UI(int id) { ScrollPosition = GUILayout.BeginScrollView(ScrollPosition, false, true, GUILayout.Width(debugInfoBounds.width), GUILayout.Height(debugInfoBounds.height)); { #region Do Magic if (Objects == null) { return; } var dictionary = new Dictionary <Type, int>(); for (var i = 0; i < Objects.Length; i++) { var obj = Objects[i]; var key = obj.GetType(); if (dictionary.ContainsKey(key)) { dictionary[key]++; } else { dictionary[key] = 1; } } #endregion var entryies = new List <KeyValuePair <Type, int> >(dictionary); entryies.Sort((firstPair, nextPair) => nextPair.Value.CompareTo((firstPair.Value))); GUILayout.BeginVertical(); for (int i = 0; i < entryies.Count; i++) { var entry = entryies[i]; GUILayoutExtensions.HorizontalBoxed("", GUISkin, () => { GUILayoutExtensions.LabelWithFlexibleSpace(entry.Key.FullName, entry.Value.ToString()); }); } GUILayout.Space(10); GUILayout.EndVertical(); } GUILayout.EndScrollView(); }
private void DrawSupportedFormats <TFormatType>(Dictionary <TFormatType, HardwareInfo.SupportState> formats, string prefix = "null") where TFormatType : struct, IConvertible { if (!typeof(TFormatType).IsEnum) { throw new ArgumentException("Only 'enum' types as T allowed!"); } if (formats == null || formats.Count == 0) { GUILayoutExtensions.HorizontalBoxed("", GUISkin, () => { GUILayoutExtensions.LabelWithFlexibleSpace("No Data!", "No Info!"); }); return; } foreach (var kvp in formats) { var format = kvp.Key; var supportState = kvp.Value; var tempColor = GUI.color; var actualColor = HardwareInfo.SupportStateToColor(supportState); GUILayoutExtensions.DrawWithColor(() => { GUILayoutExtensions.HorizontalBoxed("", GUISkin, () => { GUILayoutExtensions.DrawWithColor(() => { GUILayoutExtensions.LabelWithFlexibleSpace(string.Format("{0}.{1}", prefix, format), supportState.ToString()); }, tempColor); }); }, actualColor); } }