public BottomRowPanel(ProfileInfoMode row, float xStart, float width) { type = row; this.width = width; this.xStart = xStart; dragging = false; if (row == ProfileInfoMode.Graph) { graph = new Panel_Graph(); } }
public static void Drawtab(Rect r, ProfileInfoMode i, string lab) { r.height += 1; r.width += 1; Widgets.DrawMenuSection(r); if (ProfileInfoTab == i) { var hang = r.ContractedBy(1f); hang.y += 2; Widgets.DrawBoxSolid(hang, Widgets.MenuSectionBGFillColor); } Widgets.Label(r, lab); if (Widgets.ButtonInvisible(r)) { ProfileInfoTab = i; Modbase.Settings.Write(); } }
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; } }