Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        private void UI(int id)
        {
            scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, true, GUILayout.Width(debugInfoBounds.width), GUILayout.Height(debugInfoBounds.height));
            {
                #region Do Magic

                var objects    = FindObjectsOfType(typeof(Object));
                var dictionary = new Dictionary <string, int>();

                foreach (var obj in objects)
                {
                    string key = obj.GetType().FullName;

                    if (dictionary.ContainsKey(key))
                    {
                        dictionary[key]++;
                    }
                    else
                    {
                        dictionary[key] = 1;
                    }
                }

                #endregion

                var entryies = new List <KeyValuePair <string, 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];

                    GUILayout.BeginHorizontal("box");
                    GUILayoutExtensions.LabelWithFlexibleSpace(entry.Key, entry.Value.ToString());
                    GUILayout.EndHorizontal();
                }

                GUILayout.Space(10);

                GUILayout.EndVertical();
            }

            GUILayout.EndScrollView();
        }
Esempio n. 3
0
        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);
            }
        }
Esempio n. 4
0
        protected override void UI(int id)
        {
            if (DebugSequenceManager.Instance == null)
            {
                return;
            }

            var sequence = DebugSequenceManager.Instance.Sequence;

            if (sequence == null)
            {
                return;
            }

            if (sequence.Count != 0)
            {
                ScrollPosition = GUILayout.BeginScrollView(ScrollPosition, false, true);
                {
                    GUILayout.BeginVertical();

                    for (int i = 0; i < sequence.Count; i++)
                    {
                        var entry = sequence[i];

                        GUILayout.BeginVertical(string.Format("{0}", entry.Name), GUISkin.box, GUILayout.Width(debugInfoBounds.width - 40));
                        {
                            GUILayout.Space(20);

                            if (true)
                            {
                                GUILayout.BeginVertical("", GUISkin.box, GUILayout.Width(debugInfoBounds.width - 45));
                                {
                                    GUILayoutExtensions.Vertical(() =>
                                    {
                                        GUILayoutExtensions.Horizontal(() =>
                                        {
                                            GUILayoutExtensions.LabelWithFlexibleSpace("Time: ", entry.Time);
                                        });

                                        GUILayoutExtensions.Horizontal(() =>
                                        {
                                            GUILayoutExtensions.LabelWithFlexibleSpace("Time Since Startup: ", entry.TimeSinceStartup);
                                        });

                                        GUILayoutExtensions.Horizontal(() =>
                                        {
                                            GUILayoutExtensions.LabelWithFlexibleSpace("Frame: ", entry.Frame);
                                        });
                                    });
                                }
                                GUILayout.EndVertical();
                            }
                        }
                        GUILayout.EndVertical();
                    }

                    GUILayout.Space(10);

                    GUILayout.EndVertical();
                }

                GUILayout.EndScrollView();
            }
            else
            {
                GUILayout.Label("No sequence!", BoldLabelStyle);
            }
        }