using System; using BepInEx.Configuration; using UnityEngine; namespace BepInEx.Configuration; /// /// Fluent procedural builder scope provided to /// callbacks for rendering modern uGUI controls inside BepInEx.ConfigDrawers. /// public interface IUguiDrawerScope { /// The parent RectTransform container for the current row or layout block. Transform Container { get; } /// True if the setting is locked by ServerSync or configured as ReadOnly. bool IsReadOnly { get; } /// Begins a horizontal row layout. Dispose at end of row. IDisposable Horizontal(float spacing = 4f); /// Begins a vertical layout. Dispose at end of block. IDisposable Vertical(float spacing = 4f); /// Begins an enclosed padded box container with optional background tint. IDisposable Box(Color? backgroundColor = null, float padding = 4f, float spacing = 4f); /// Begins a full-width row container with optional alternating background tint. IDisposable Row(Color? backgroundColor = null, float padding = 4f, float spacing = 4f); /// Renders a styled label. void Label(string text, float width = -1f); /// Renders an editable input text field. void TextField(string value, Action onCommit, float width = -1f); /// Renders a styled button. void Button(string text, Action onClick, float width = 50f); /// Renders a styled button with an interactive hover tooltip. void Button(string text, Action onClick, float width, string? tooltip); /// Renders a slider with linked manual text input for high precision. void Slider(float value, float min, float max, Action onChanged, float width = 120f, string? format = null); /// Renders an interactive toggle checkbox. void Toggle(bool value, string label, Action onChanged); /// Inserts horizontal or vertical spacing. void Space(float pixels); /// Renders a subtle horizontal divider line. void Separator(float height = 1f, Color? color = null); } /// /// Metadata attributes attached to a configuration setting to customize its appearance and behavior. /// Add an instance to the array. /// public class ConfigurationManagerAttributes { /// Legacy IMGUI custom drawer action. public Action? CustomDrawer; /// Modern uGUI custom drawer action using procedural UI scope. public Action? CustomUguiDrawer; /// Show this setting in the settings window. Default true. public bool? Browsable; /// Category the setting belongs to. public string? Category; /// Default value for the setting used when resetting. public object? DefaultValue; /// Setting description tooltip. public string? Description; /// Display name overriding the configuration key. public string? DispName; /// Sort order within the category (higher numbers appear first). public int? Order; /// If true, value cannot be edited. public bool? ReadOnly; /// If true, only visible when advanced settings are toggled on. public bool? IsAdvanced; /// If true, setting is synchronized from server and writable only by admins. public bool? IsAdminOnly; /// If true, the Reset button is hidden. public bool? HideDefaultButton; /// If true, setting name label is omitted. public bool? HideSettingName; /// Display numerical ranges as percentages. public bool? ShowRangeAsPercent; /// Color of the entry text. public Color? EntryColor; /// Color of the description text. public Color? DescriptionColor; /// Custom setting editor that allows polling keyboard input. public Delegate? CustomHotkeyDrawer; /// Custom converter from setting type to string for built-in editor textboxes. public Func? ObjToStr; /// Custom converter from string to setting type for built-in editor textboxes. public Func? StrToObj; }