private static void DrawColumns(Rect rect) { Text.Anchor = TextAnchor.MiddleCenter; Text.Font = GameFont.Tiny; GUI.color = Color.grey; Widgets.DrawLineHorizontal(rect.x, rect.yMax, rect.width); GUI.color = Color.white; // [ Max ] [ Average ] [ Percent ] [ Total ] [ Calls ] [ Name ] DrawColumnHeader(ref rect, Strings.logs_max, Strings.logs_max_desc, SortBy.Max, NUMERIC_WIDTH, $"{totals.Max:0.000}ms"); DrawColumnHeader(ref rect, Strings.logs_av, Strings.logs_av_desc, SortBy.Average, NUMERIC_WIDTH, $"{totals.Average:0.000}ms"); DrawColumnHeader(ref rect, Strings.logs_percent, Strings.logs_percent_desc, SortBy.Percent, NUMERIC_WIDTH, $"{totals.Percent * 100:0.0}%"); DrawColumnHeader(ref rect, Strings.logs_total, Strings.logs_total_desc, SortBy.Total, NUMERIC_WIDTH, $"{totals.Total:0.000}ms"); if (GUIController.CurrentEntry.type != typeof(H_HarmonyTranspilersInternalMethods)) { DrawColumnHeader(ref rect, Strings.logs_calls, Strings.logs_calls_desc, SortBy.Calls, NUMERIC_WIDTH, $"{totals.Calls.ToString("N0", CultureInfo.InvariantCulture)}"); } // give the name 'infinite' width so there is no wrapping // Set text anchor to middle left so we can see our text // offset by four chars to make it look offset Text.Anchor = TextAnchor.MiddleLeft; DrawColumnHeader(ref rect, " " + Strings.logs_name, Strings.logs_name_desc, SortBy.Name, 10000); DubGUI.ResetFont(); }
public static void DrawLogs(Rect rect) { Widgets.DrawMenuSection(rect); if (!GUIController.CurrentEntry?.isPatched ?? true) { DubGUI.Heading(rect, $"Loading{GenText.MarchingEllipsis(0f)}"); return; } var columnsR = rect.TopPartPixels(50f); DrawColumns(columnsR); columns[(int)SortBy.Average].total = 0; rect.AdjustVerticallyBy(columnsR.height + 4); rect.height -= 2f; rect.width -= 2; Rect innerRect = rect.AtZero(); innerRect.height = listing.curY; if (innerRect.height > rect.height) { innerRect.width -= 17f; } viewFrustum = rect.AtZero(); // Our view frustum starts at 0,0 from the rect we are given viewFrustum.y += ScrollPosition.y; // adjust our view frustum vertically based on the scroll position { // Begin scope for Scroll View Widgets.BeginScrollView(rect, ref ScrollPosition, innerRect); GUI.BeginGroup(innerRect); listing.Begin(innerRect); Text.Anchor = TextAnchor.MiddleCenter; Text.Font = GameFont.Tiny; float currentListHeight = BOX_HEIGHT; Text.Anchor = TextAnchor.MiddleLeft; lock (Analyzer.LogicLock) { foreach (ProfileLog log in Analyzer.Logs) { DrawLog(log, ref currentListHeight); } } listing.End(); GUI.EndGroup(); Widgets.EndScrollView(); } DubGUI.ResetFont(); }
public static void Draw(Rect rect) { var innerRect = rect.AtZero(); innerRect.height = yHeigthCache; viewFrustum = rect.AtZero(); viewFrustum.y += scrollOffset.y; Widgets.BeginScrollView(rect, ref scrollOffset, innerRect, false); GUI.BeginGroup(innerRect); listing.Begin(innerRect); float yHeight = 0; Text.Anchor = TextAnchor.MiddleLeft; Text.Font = GameFont.Tiny; lock (sync) { if (!(cachedEntries.Count == 1 && cachedEntries.First() == searchText)) { foreach (var entry in cachedEntries) { var r = listing.GetRect(Text.LineHeight); yHeight += r.height; if (!r.Overlaps(viewFrustum)) { continue; } if (Widgets.ButtonInvisible(r)) { Panel_DevOptions.currentInput = entry; } Widgets.DrawBoxSolid(r, Modbase.Settings.GraphCol); if (Mouse.IsOver(r)) { Widgets.DrawHighlight(r); } r.width = 2000; Widgets.Label(r, " " + entry); } } } yHeigthCache = yHeight; listing.End(); GUI.EndGroup(); Widgets.EndScrollView(); DubGUI.ResetFont(); }
public static void Draw(Rect inrect, GeneralInformation?currentInformation) { if (currentInformation == null || currentInformation.Value.patches.NullOrEmpty()) { return; } Text.Font = GameFont.Tiny; Text.Anchor = TextAnchor.MiddleLeft; foreach (var patch in currentInformation?.patches) { var left = $" {patch.patchType}"; var right = $" {patch.modName}"; var textHeight = Mathf.Max(Text.CalcHeight(left, inrect.width / 2), Text.CalcHeight(right, inrect.width / 2 - 5f)); var rect = inrect.TopPartPixels(textHeight); inrect.y += textHeight; var anchor = Text.Anchor; Text.Anchor = TextAnchor.MiddleCenter; var leftRect = rect.LeftPart(.5f); Widgets.Label(leftRect, left); var rightRect = rect.RightPart(.5f); rightRect.x += 5; Widgets.Label(rightRect, right); Text.Anchor = anchor; Widgets.DrawHighlightIfMouseover(rect); if (Mouse.IsOver(rect)) { // todo cache tip TooltipHandler.TipRegion(rect, $"Mod Name: {patch.modName}\nPatch Type: {patch.patchType}\nPatch Method: {patch.typeName}:{patch.methodName}"); } if (Input.GetMouseButtonDown(1) && rect.Contains(Event.current.mousePosition)) // mouse button right { List <FloatMenuOption> options = new List <FloatMenuOption>() { new FloatMenuOption("Open In Github", () => Panel_BottomRow.OpenGithub($"{patch.typeName}.{patch.methodName}")), new FloatMenuOption("Open In Dnspy (requires local path)", () => Panel_BottomRow.OpenDnspy(patch.method)) }; Find.WindowStack.Add(new FloatMenu(options)); } } DubGUI.ResetFont(); }
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; } }
internal static void DrawAxis(Rect rect, float yAxis, string suffix) { var yIncrement = rect.height / 4f; Text.Font = GameFont.Tiny; Text.Anchor = TextAnchor.UpperLeft; Widgets.Label(rect, suffix); for (var i = 1; i < 5; i++) { var box = new Rect(0, 0, 25f, Text.LineHeight); box.y = (i * yIncrement) - (box.height / 2f); Widgets.Label(box, Mathf.Round((4 - i) * (yAxis / 4f) * 100) / 100 + ""); } DubGUI.ResetFont(); }
private static void DrawTabs(Tab tab) { DubGUI.ResetFont(); yOffset += 40f; var row = listing.GetRect(30f); if (tab.category == Category.Settings) { if (GUIController.GetCurrentTab == tab) { Widgets.DrawHighlightSelected(row); } Widgets.DrawHighlightIfMouseover(row); if (Widgets.ButtonInvisible(row)) { tab.onClick(); } } else { Widgets.DrawHighlightIfMouseover(row); Widgets.DrawTextureFitted(row.RightPartPixels(row.height), tab.collapsed ? DubGUI.DropDown : DubGUI.FoldUp, 1f); if (Widgets.ButtonInvisible(row)) { tab.collapsed = !tab.collapsed; } } row.x += 5f; Widgets.Label(row, tab.Label); TooltipHandler.TipRegion(row, tab.Tip); Text.Anchor = TextAnchor.MiddleLeft; Text.Font = GameFont.Tiny; if (tab.collapsed) { return; } foreach (var entry in tab.entries) { DrawEntry(ref row, entry); } }
public static void DrawLogs(Rect rect) { Widgets.DrawMenuSection(rect); if (!GUIController.CurrentEntry?.isPatched ?? true) { DubGUI.Heading(rect, $"Loading{GenText.MarchingEllipsis(0f)}"); return; } Rect innerRect = rect.AtZero(); innerRect.height = cachedListHeight; viewFrustum = rect.AtZero(); // Our view frustum starts at 0,0 from the rect we are given viewFrustum.y += ScrollPosition.y; // adjust our view frustum vertically based on the scroll position { // Begin scope for Scroll View Widgets.BeginScrollView(rect, ref ScrollPosition, innerRect, true); GUI.BeginGroup(innerRect); listing.Begin(innerRect); Text.Anchor = TextAnchor.MiddleCenter; Text.Font = GameFont.Tiny; DrawColumns(listing.GetRect(BOX_HEIGHT)); float currentListHeight = BOX_HEIGHT; Text.Anchor = TextAnchor.MiddleLeft; lock (Analyzer.LogicLock) { foreach (ProfileLog log in Analyzer.Logs) { DrawLog(log, ref currentListHeight); } } cachedListHeight = currentListHeight; listing.End(); GUI.EndGroup(); Widgets.EndScrollView(); } DubGUI.ResetFont(); }
public static void Draw(Rect rect, IEnumerable <Tab> tabs) { Rect ListerBox = rect.LeftPartPixels(width); ListerBox.width -= 10f; Widgets.DrawMenuSection(ListerBox); ListerBox = ListerBox.ContractedBy(4f); Rect baseRect = ListerBox.AtZero(); baseRect.width -= 16f; baseRect.height = ListHeight; Text.Anchor = TextAnchor.MiddleLeft; Text.Font = GameFont.Tiny; yOffset = 0f; { // Begin Scope for Scroll & GUI Group/View Widgets.BeginScrollView(ListerBox, ref ScrollPosition, baseRect); GUI.BeginGroup(baseRect); listing.Begin(baseRect); foreach (Tab tab in tabs) { if (tab.category == Category.Modder && tab.entries.Count == 0) // if the modder tab is empty, no need to draw it { continue; } DrawTabs(tab); } listing.End(); GUI.EndGroup(); Widgets.EndScrollView(); } DubGUI.ResetFont(); ListHeight = yOffset; }
public static void Drawtab(Rect r, int i, string lab) { r.height += 1; r.width += 1; Widgets.DrawMenuSection(r); if (PatchTab == i) { var hang = r.ContractedBy(1f); hang.y += 2; Widgets.DrawBoxSolid(hang, Widgets.MenuSectionBGFillColor); } Text.Anchor = TextAnchor.MiddleCenter; Text.Font = GameFont.Tiny; Widgets.Label(r, lab); DubGUI.ResetFont(); if (Widgets.ButtonInvisible(r)) { PatchTab = i; } }
private static void DrawTabs(Tab tab) { DubGUI.ResetFont(); yOffset += 40f; Rect row = listing.GetRect(30f); if (tab.category == Category.Settings) { if (Widgets.ButtonInvisible(row)) { tab.onClick(); } } else { if (Widgets.ButtonImage(row.RightPartPixels(row.height), tab.collapsed ? DubGUI.DropDown : DubGUI.FoldUp)) { tab.collapsed = !tab.collapsed; } } row.x += 5f; Widgets.Label(row, tab.Label); TooltipHandler.TipRegion(row, tab.Tip); Text.Anchor = TextAnchor.MiddleLeft; Text.Font = GameFont.Tiny; if (tab.collapsed) { return; } foreach (KeyValuePair <Entry, Type> entry in tab.entries) { DrawEntry(ref row, entry); } }
private static void DrawColumns(Rect rect) { Text.Anchor = TextAnchor.MiddleCenter; Text.Font = GameFont.Tiny; GUI.color = Color.grey; Widgets.DrawLineHorizontal(rect.x, rect.yMax, rect.width); GUI.color = Color.white; var rhs = rect.RightPartPixels(30); rhs.x += 5; rhs.width -= 10; rhs.y = rhs.center.y - 10; rhs.height = 20; foreach (var column in columns.Where(c => c.Active(GUIController.CurrentEntry.type)).OrderBy(c => c.order)) { if (column.sortBy == SortBy.Name) { Text.Anchor = TextAnchor.MiddleLeft; } DrawColumnHeader(ref rect, column); } TooltipHandler.TipRegion(rhs, "Change what columns are visible"); if (Widgets.ButtonImage(rhs, Textures.Gear)) { var opts = new List <FloatMenuOption>(); foreach (var col in columns) { opts.Add(new FloatMenuOption(col.Name, () => col.active = !col.active, col.active ? Widgets.CheckboxOnTex : Widgets.CheckboxOffTex, Color.gray)); } Find.WindowStack.Add(new FloatMenu(opts)); } DubGUI.ResetFont(); }
public static void Draw(Rect rect, IEnumerable <Tab> tabs) { var ListerBox = rect.LeftPartPixels(width); ListerBox.width -= 10f; Widgets.DrawMenuSection(ListerBox); ListerBox = ListerBox.ContractedBy(4f); var baseRect = ListerBox.AtZero(); baseRect.width -= 16f; baseRect.height = ListHeight; Text.Anchor = TextAnchor.MiddleLeft; Text.Font = GameFont.Tiny; yOffset = 0f; Widgets.BeginScrollView(ListerBox, ref ScrollPosition, baseRect); GUI.BeginGroup(baseRect); listing.Begin(baseRect); foreach (var tab in tabs) { if (tab.category == Category.Settings || tab.entries.Count > 0) { DrawTabs(tab); } } listing.End(); GUI.EndGroup(); Widgets.EndScrollView(); DubGUI.ResetFont(); ListHeight = yOffset; }
public static void Draw(Rect rect) { rect.height = Mathf.Min(listing.curY + 8, rect.height); Widgets.DrawBoxSolid(rect, Widgets.WindowBGFillColor); rect = rect.ContractedBy(4); viewFrustum = rect.AtZero(); viewFrustum.y = scrollOffset.y; var innerRect = rect.AtZero(); innerRect.height = listing.curY; innerRect.width -= 24f; innerRect.x += 6; Widgets.BeginScrollView(rect, ref scrollOffset, innerRect); GUI.BeginGroup(innerRect); listing.Begin(innerRect); Text.Anchor = TextAnchor.MiddleLeft; Text.Font = GameFont.Tiny; lock (sync) { if (HighlightedEntry > cachedEntries.Count - 1) { HighlightedEntry = 0; } if (HighlightedEntry < 0) { HighlightedEntry = cachedEntries.Count - 1; } if (!(cachedEntries.Count == 1 && cachedEntries.First() == searchText)) { int L = -1; foreach (var entry in cachedEntries) { L++; var r = listing.GetRect(Text.LineHeight); if (arrowPressed) { if (L == HighlightedEntry) { if (r.y < viewFrustum.y) { scrollOffset.y = r.y; } if (r.yMax + r.height > viewFrustum.yMax) { scrollOffset.y = r.yMax + r.height - viewFrustum.height; } } } if (!r.Overlaps(viewFrustum)) { continue; } if (Widgets.ButtonInvisible(r) || L == HighlightedEntry && returned) { Panel_DevOptions.currentInput = entry; GUI.FocusControl("profileinput"); } if (Mouse.IsOver(r) || L == HighlightedEntry) { Widgets.DrawHighlight(r); } r.width = 2000; Widgets.Label(r, entry); } } } listing.End(); GUI.EndGroup(); Widgets.EndScrollView(); DubGUI.ResetFont(); returned = false; arrowPressed = false; }
public static void Draw(Rect inrect, GeneralInformation?currentInformation) { inrect = inrect.ContractedBy(4); if (currentInformation == null || currentInformation.Value.patches.NullOrEmpty()) { return; } Text.Font = GameFont.Tiny; Text.Anchor = TextAnchor.MiddleLeft; x = 0; var viewrect = inrect; viewrect.x += 10; viewrect.width -= 28; viewrect.height = y; var row = viewrect; row.height = 40; row.width = Mathf.Max(x, viewrect.width); Widgets.BeginScrollView(inrect, ref scroller, viewrect); foreach (var patch in currentInformation?.patches) { var meth = $"{patch.typeName} : {patch.methodName}"; row.width = meth.GetWidthCached(); if (row.width > x) { x = row.width; } Widgets.Label(row, meth); Widgets.DrawHighlightIfMouseover(row); if (Mouse.IsOver(row)) { TooltipHandler.TipRegion(row, $"Mod Name: {patch.modName}\nPatch Type: {patch.patchType}"); } if (Input.GetMouseButtonDown(1) && row.Contains(Event.current.mousePosition)) // mouse button right { List <FloatMenuOption> options = new List <FloatMenuOption>() { new FloatMenuOption("Open In Github", () => Panel_BottomRow.OpenGithub($"{patch.typeName}.{patch.methodName}")), new FloatMenuOption("Open In Dnspy (requires local path)", () => Panel_BottomRow.OpenDnspy(patch.method)) }; Find.WindowStack.Add(new FloatMenu(options)); } row.y = row.yMax; y = row.yMax; } Widgets.EndScrollView(); DubGUI.ResetFont(); }
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; } }
public static void DrawStats(Rect inrect, GeneralInformation?currentInformation) { var stats = new LogStats(); stats.GenerateStats(); stats = null; lock (CurrentLogStats.sync) { stats = CurrentLogStats.stats; } if (stats == null) { return; } inrect = inrect.ContractedBy(4f); var r = inrect; r.height = listing.CurHeight; r.width = 18; Widgets.BeginScrollView(inrect, ref scrolls, r); listing.Begin(inrect); Text.Font = GameFont.Tiny; var sb = new StringBuilder(); if (currentInformation.HasValue) { sb.AppendLine( $"Method: {currentInformation.Value.methodName}, Mod: {currentInformation.Value.modName}"); sb.AppendLine( $"Assembly: {currentInformation.Value.assname}, Patches: {currentInformation.Value.patches.Count}"); var modLabel = sb.ToString().TrimEndNewlines(); var rect = listing.GetRect(Text.CalcHeight(modLabel, listing.ColumnWidth)); Widgets.Label(rect, modLabel); Widgets.DrawHighlightIfMouseover(rect); if (Input.GetMouseButtonDown(1) && rect.Contains(Event.current.mousePosition)) // mouse button right { var options = new List <FloatMenuOption> { new FloatMenuOption("Open In Github", () => Panel_BottomRow.OpenGithub( $"{currentInformation.Value.typeName}.{currentInformation.Value.methodName}")), new FloatMenuOption("Open In Dnspy (requires local path)", () => Panel_BottomRow.OpenDnspy(currentInformation.Value.method)) }; Find.WindowStack.Add(new FloatMenu(options)); } listing.GapLine(2f); sb.Clear(); } sb.AppendLine($"Total Entries:".Colorize(Color.grey) + $" { stats.Entries}"); sb.AppendLine($"Total Calls:".Colorize(Color.grey) + $" {stats.TotalCalls}"); sb.AppendLine($"Total Time:".Colorize(Color.grey) + $" {stats.TotalTime:0.000}ms"); sb.AppendLine($"Avg Time/Call:".Colorize(Color.grey) + $" {stats.MeanTimePerCall:0.000}ms"); sb.AppendLine($"Avg Calls/Update:".Colorize(Color.grey) + $" {stats.MeanCallsPerUpdateCycle:0.00}"); sb.AppendLine($"Avg Time/Update:".Colorize(Color.grey) + $" {stats.MeanTimePerUpdateCycle:0.000}ms"); sb.AppendLine($"Median Calls:".Colorize(Color.grey) + $" {stats.MedianCalls}"); sb.AppendLine($"Median Time:".Colorize(Color.grey) + $" {stats.MedianTime}"); sb.AppendLine($"Max Time:".Colorize(Color.grey) + $" {stats.HighestTime:0.000}ms"); sb.AppendLine($"Max Calls/Update:".Colorize(Color.grey) + $" {stats.HighestCalls}"); listing.Label(sb.ToTaggedString().Trim()); DubGUI.ResetFont(); listing.End(); Widgets.EndScrollView(); }
private static void DrawSettings(Panel_Graph instance, ref Rect position) { void CheckNewRow(ref Rect box, ref Rect position) { if (box.xMax > position.xMax) { position.AdjustVerticallyBy(box.height); box.y += box.height; box.x = position.x; } } var currentHeight = 32; var box = position.TopPartPixels(currentHeight).LeftPartPixels(20f); position.AdjustVerticallyBy(currentHeight); Text.Anchor = TextAnchor.MiddleCenter; if (Widgets.ButtonImageFitted(box, Textures.Menu)) { doSettings = !doSettings; } box.ShiftX(5); if (Widgets.ButtonImageFitted(box, TexButton.SpeedButtonTextures[Analyzer.CurrentlyPaused ? 1 : 0])) { Analyzer.CurrentlyPaused = !Analyzer.CurrentlyPaused; GUIController.CurrentEntry.SetActive(!Analyzer.CurrentlyPaused); } box.ShiftX(5); var str = "Times"; box.width = 20 + str.GetWidthCached(); instance.times.visible = ToggleColCombo(box, str, instance.times.visible, Settings.timeColour, () => Settings.timeColour = colourPicker.CurrentCol); box.ShiftX(5); str = "Calls"; box.width = 20 + str.GetWidthCached(); instance.calls.visible = ToggleColCombo(box, str, instance.calls.visible, Settings.callsColour, () => Settings.callsColour = colourPicker.CurrentCol); box.ShiftX(5); str = "Background"; box.width = 20 + str.GetWidthCached(); ToggleColCombo(box, str, true, Settings.GraphCol, () => Settings.GraphCol = colourPicker.CurrentCol); box.ShiftX(5); void jammydodger(ref Rect p, string s, ref bool r) { box.width = 20 + s.GetWidthCached(); CheckNewRow(ref box, ref p); r = DrawButton(box, s, r); box.ShiftX(5); } jammydodger(ref position, "Axis", ref GraphSettings.showAxis); jammydodger(ref position, "Grid", ref GraphSettings.showGrid); jammydodger(ref position, "Max", ref GraphSettings.showMax); Text.Anchor = TextAnchor.UpperLeft; box.width = 100; CheckNewRow(ref box, ref position); instance.entryCount = (int)Widgets.HorizontalSlider(box.BottomPartPixels(30f), instance.entryCount, 10, 2000, true, string.Intern($"{instance.entryCount} Entries")); box.ShiftX(5); Text.Anchor = TextAnchor.MiddleCenter; Text.Font = GameFont.Tiny; str = $"Aliasing:{(GraphSettings.lineAliasing == 0 ? "none" : GraphSettings.lineAliasing.ToString())}"; box.width = str.GetWidthCached() + 10; CheckNewRow(ref box, ref position); if (Widgets.ButtonText(box, str, false)) { GraphSettings.lineAliasing = GraphSettings.lineAliasing switch { 7.5f => 12.5f, 12.5f => 0.0f, 0.0f => 5.0f, 5.0f => 7.5f, _ => 0.0f }; } box.ShiftX(5); DubGUI.ResetFont(); }