public static void Draw(Listing_Standard listing, float winHeight) { DubGUI.CenterText(() => listing.Label("devoptions.heading".TranslateSimple())); listing.GapLine(6f); DrawButtons(listing); var inputBarOffset = DisplayInputField(listing, winHeight); DisplaySelectionOptions(listing); var x = listing.curX + inputBarOffset; var y = listing.curY - Text.LineHeight; var width = listing.ColumnWidth - inputBarOffset; var height = (winHeight - listing.curY) - 18f; var uiPoint = GUIUtility.GUIToScreenPoint(new Vector2(x, y)); var rect = new Rect(uiPoint, new Vector2(width, height)); Window_SearchBar.SetCurrentInput(input); Window_SearchBar.UpdateSearchString(currentInput); bool shouldExit; lock (Window_SearchBar.sync) { shouldExit = Window_SearchBar.CheckShouldClose(new Rect(x, y, width, height)) || Window_SearchBar.cachedEntries.Count == 1 && Window_SearchBar.cachedEntries.First() == currentInput; } if (shouldExit) { return; } // 0x7FFFFFFF is 011111 ... in binary, in effect takes only the positive component of the hash Find.WindowStack.ImmediateWindow(currentInput.GetHashCode() & 0x7FFFFFFF, rect, WindowLayer.Super, () => { GUI.color = Window_SearchBar.windowTransparency; Window_SearchBar.DoWindowContents(rect.AtZero()); GUI.color = Color.white; }, false); }
public static void Draw(Listing_Standard listing, Rect win) { listing.Label(Strings.settings_dnspy); Settings.PathToDnspy = listing.TextEntry(Settings.PathToDnspy); listing.Gap(); DubGUI.LabeledSliderFloat(listing, Strings.settings_updates_per_second, ref Settings.updatesPerSecond, 1.0f, 20.0f); DubGUI.Checkbox(Strings.settings_logging, listing, ref Settings.verboseLogging); DubGUI.Checkbox(Strings.settings_disable_tps_counter, listing, ref Settings.disableTPSCounter); DubGUI.Checkbox("settings.debuglog".Tr(), listing, ref Settings.enableLog); var s = Strings.settings_disable_cleanup; var rect = listing.GetRect(Text.LineHeight); DubGUI.Checkbox(rect, s, ref Settings.disableCleanup); TooltipHandler.TipRegion(rect, Strings.settings_disable_cleanup_desc); listing.GapLine(); DubGUI.CenterText(() => listing.Label("devoptions.heading".Tr())); listing.GapLine(); var tabs = listing.GetRect(tabRect.height); tabs.width = tabRect.width; Drawtab(tabs, 0, "Patch Tools"); tabs.x = tabs.xMax; Drawtab(tabs, 1, $"Saved Patches ({Settings.SavedPatches_Tick.Count + Settings.SavedPatches_Update.Count})"); listing.Gap(4); if (PatchTab == 0) { if (listing.ButtonTextLabeled("Logging cycle", patchType.ToString())) { if (patchType == Category.Tick) { patchType = Category.Update; } else { patchType = Category.Tick; } //For if onGui gets added //var list = new List<FloatMenuOption> //{ // new FloatMenuOption("devoptions.patchtype.tick".Tr(), () => patchType = Category.Tick), // new FloatMenuOption("devoptions.patchtype.update".Tr(), () => patchType = Category.Update) // new FloatMenuOption("devoptions.patchtype.ongui".Tr(), () => patchType = Category.OnGui) //}; //Find.WindowStack.Add(new FloatMenu(list)); } if (showSearchbox) { Window_SearchBar.Control(); } var inputR = DisplayInputField(listing); Window_SearchBar.SetCurrentInput(input); Window_SearchBar.UpdateSearchString(currentInput); var searchRect = listing.GetRect(Mathf.Min(listing.curY, win.height - listing.curY)); lock (Window_SearchBar.sync) { if (showSearchbox && !Mouse.IsOver(searchRect) && Event.current.type != EventType.MouseDown) { showSearchbox = false; } if (GUI.GetNameOfFocusedControl() == "profileinput") { showSearchbox = true; } else if (Mouse.IsOver(inputR)) { showSearchbox = true; } } if (showSearchbox) { Window_SearchBar.DoWindowContents(searchRect); } } else { foreach (var patch in Settings.SavedPatches_Tick.ToList()) { var row = listing.GetRect(Text.LineHeight); if (Widgets.CloseButtonFor(row.LeftPartPixels(30f))) { Settings.SavedPatches_Tick.Remove(patch); } Widgets.Label(row.RightPartPixels(row.width - 30f), patch + " Tick"); listing.GapLine(); } foreach (var patch in Settings.SavedPatches_Update.ToList()) { var row = listing.GetRect(Text.LineHeight); if (Widgets.CloseButtonFor(row.LeftPartPixels(30f))) { Settings.SavedPatches_Update.Remove(patch); } Widgets.Label(row.RightPartPixels(row.width - 30f), patch + " Update"); listing.GapLine(); } } }