mirror of
https://github.com/BepInEx/BepInEx.GraphicsSettings.git
synced 2026-11-22 04:29:25 -10:00
99 lines
4.0 KiB
C#
99 lines
4.0 KiB
C#
#pragma warning disable 0649
|
|
|
|
namespace GraphicsSettings
|
|
{
|
|
/// <summary>
|
|
/// Special class that controls how a setting is displayed inside ConfigurationManager.
|
|
/// To use, make a new instance, assign any fields that you want to override, and pass it as a setting tag.
|
|
///
|
|
/// If a field is null (default), it will be ignored and won't change how the setting is displayed.
|
|
/// If a field is non-null (you assigned a value to it), it will override default behavior.
|
|
/// </summary>
|
|
///
|
|
/// <example>
|
|
/// Here's an example of overriding order of settings and marking one of the settings as advanced:
|
|
/// <code>
|
|
/// // Override IsAdvanced and Order
|
|
/// Config.AddSetting("X", "1", 1, new ConfigDescription("", null, new ConfigurationManagerAttributes { IsAdvanced = true, Order = 3 }));
|
|
/// // Override only Order, IsAdvanced stays as the default value assigned by ConfigManager
|
|
/// Config.AddSetting("X", "2", 2, new ConfigDescription("", null, new ConfigurationManagerAttributes { Order = 1 }));
|
|
/// Config.AddSetting("X", "3", 3, new ConfigDescription("", null, new ConfigurationManagerAttributes { Order = 2 }));
|
|
/// </code>
|
|
/// </example>
|
|
///
|
|
/// <remarks>
|
|
/// You can read more and see examples in the readme at https://github.com/BepInEx/BepInEx.ConfigurationManager
|
|
/// You can optionally remove fields that you won't use from this class, it's the same as leaving them null.
|
|
/// </remarks>
|
|
internal sealed class ConfigurationManagerAttributes
|
|
{
|
|
/// <summary>
|
|
/// Should the setting be shown as a percentage (only use with value range settings).
|
|
/// </summary>
|
|
public bool? ShowRangeAsPercent;
|
|
|
|
/// <summary>
|
|
/// Custom setting editor (OnGUI code that replaces the default editor provided by ConfigurationManager).
|
|
/// See below for a deeper explanation. Using a custom drawer will cause many of the other fields to do nothing.
|
|
/// </summary>
|
|
public System.Action<BepInEx.Configuration.ConfigEntryBase> CustomDrawer;
|
|
|
|
/// <summary>
|
|
/// Show this setting in the settings screen at all? If false, don't show.
|
|
/// </summary>
|
|
public bool? Browsable;
|
|
|
|
/// <summary>
|
|
/// Category the setting is under. Null to be directly under the plugin.
|
|
/// </summary>
|
|
public string Category;
|
|
|
|
/// <summary>
|
|
/// If set, a "Default" button will be shown next to the setting to allow resetting to default.
|
|
/// </summary>
|
|
public object DefaultValue;
|
|
|
|
/// <summary>
|
|
/// Force the "Reset" button to not be displayed, even if a valid DefaultValue is available.
|
|
/// </summary>
|
|
public bool? HideDefaultButton;
|
|
|
|
/// <summary>
|
|
/// Optional description shown when hovering over the setting.
|
|
/// Not recommended, provide the description when creating the setting instead.
|
|
/// </summary>
|
|
public string Description;
|
|
|
|
/// <summary>
|
|
/// Name of the setting.
|
|
/// </summary>
|
|
public string DispName;
|
|
|
|
/// <summary>
|
|
/// Order of the setting on the settings list relative to other settings in a category.
|
|
/// 0 by default, higher number is higher on the list.
|
|
/// </summary>
|
|
public int? Order;
|
|
|
|
/// <summary>
|
|
/// Only show the value, don't allow editing it.
|
|
/// </summary>
|
|
public bool? ReadOnly;
|
|
|
|
/// <summary>
|
|
/// If true, don't show the setting by default. User has to turn on showing advanced settings or search for it.
|
|
/// </summary>
|
|
public bool? IsAdvanced;
|
|
|
|
/// <summary>
|
|
/// Custom converter from setting type to string for the built-in editor textboxes.
|
|
/// </summary>
|
|
public System.Func<object, string> ObjToStr;
|
|
|
|
/// <summary>
|
|
/// Custom converter from string to setting type for the built-in editor textboxes.
|
|
/// </summary>
|
|
public System.Func<string, object> StrToObj;
|
|
}
|
|
}
|