public static void Draw(Rect rect)
        {
            if (currentProfilerInformation == null || GUIController.CurrentProfiler != null && currentProfilerInformation.Value.method != GUIController.CurrentProfiler.meth)
            {
                GetGeneralSidePanelInformation();
            }

            var statbox = rect;

            statbox.width = Panel_Tabs.width - 10;


            var pRect = rect;

            pRect.x      = statbox.xMax + 10;
            pRect.width -= statbox.xMax;
            pRect.AdjustVerticallyBy(tabRect.height);

            Widgets.DrawMenuSection(statbox);

            Panel_Stats.DrawStats(statbox, currentProfilerInformation);

            Widgets.DrawMenuSection(pRect);

            Text.Font   = GameFont.Tiny;
            Text.Anchor = TextAnchor.MiddleCenter;

            tabRect.width = Mathf.Min(100f, pRect.width / 3f);

            tabRect.x = pRect.x;
            tabRect.y = pRect.y - tabRect.height;
            Drawtab(tabRect, ProfileInfoMode.Graph, "Graph");
            tabRect.x = tabRect.xMax;
            Drawtab(tabRect, ProfileInfoMode.Patches, "Patches");
            tabRect.x = tabRect.xMax;
            Drawtab(tabRect, ProfileInfoMode.StackTrace, "Stacktrace");
            tabRect.x = tabRect.xMax;

            DubGUI.ResetFont();

            switch (ProfileInfoTab)
            {
            case ProfileInfoMode.Graph: graph.Draw(pRect.ContractedBy(1)); break;

            case ProfileInfoMode.Stats: Panel_Stats.DrawStats(pRect, currentProfilerInformation); break;

            case ProfileInfoMode.Patches: Panel_Patches.Draw(pRect, currentProfilerInformation); break;

            case ProfileInfoMode.StackTrace: Panel_StackTraces.Draw(pRect, currentProfilerInformation); break;
            }
        }
Example #2
0
        public static void Draw(Rect rect)
        {
            if (GUIController.CurrentProfiler == null)
            {
                return;
            }

            if (currentProfilerInformation == null || currentProfilerInformation.Value.method != GUIController.CurrentProfiler.meth)
            {
                ResetCurrentPanel();
                GetGeneralSidePanelInformation();

                // are we in the patches category, but the method has no patches?
                if (ProfileInfoTab == ProfileInfoMode.Patches && (currentProfilerInformation?.patches.Any() ?? false))
                {
                    ProfileInfoTab = ProfileInfoMode.Graph;
                }

                // are we in the stack trace category, but the profiler has no method?
                if (ProfileInfoTab == ProfileInfoMode.StackTrace && currentProfilerInformation?.method != null)
                {
                    ProfileInfoTab = ProfileInfoMode.Graph;
                }
            }

            var statbox = rect;

            statbox.width = Panel_Tabs.width - 10;

            var pRect = rect;

            pRect.x      = statbox.xMax + 10;
            pRect.width -= statbox.xMax;
            pRect.AdjustVerticallyBy(tabRect.height);

            Widgets.DrawMenuSection(statbox);

            Panel_Stats.DrawStats(statbox, currentProfilerInformation);

            Widgets.DrawMenuSection(pRect);

            Text.Font   = GameFont.Tiny;
            Text.Anchor = TextAnchor.MiddleCenter;

            tabRect.width = Mathf.Min(150f, pRect.width / 3f);

            tabRect.x = pRect.x;
            tabRect.y = pRect.y - tabRect.height;
            DrawTab(tabRect, ProfileInfoMode.Graph, "Graph");
            tabRect.x = tabRect.xMax;
            if (currentProfilerInformation?.patches.Any() ?? false)
            {
                DrawTab(tabRect, ProfileInfoMode.Patches, "Patches");
                tabRect.x = tabRect.xMax;
            }
            if (currentProfilerInformation?.method != null)
            {
                DrawTab(tabRect, ProfileInfoMode.StackTrace, "Stacktrace");
                tabRect.x = tabRect.xMax;
            }
            DrawTab(tabRect, ProfileInfoMode.Save, "Save and Compare");
            tabRect.x = tabRect.xMax;

            DubGUI.ResetFont();

            switch (ProfileInfoTab)
            {
            case ProfileInfoMode.Graph: graph.Draw(pRect.ContractedBy(1)); break;

            case ProfileInfoMode.Patches: patches.Draw(pRect, currentProfilerInformation); break;

            case ProfileInfoMode.StackTrace: stacktraces.Draw(pRect, currentProfilerInformation); break;

            case ProfileInfoMode.Save: save.Draw(pRect, currentProfilerInformation); break;
            }
        }