All Projects → BepInEx → BepInEx.ConfigurationManager

BepInEx / BepInEx.ConfigurationManager

Licence: LGPL-3.0 license
Plugin configuration manager for BepInEx

Programming Languages

C#
18002 projects
powershell
5483 projects

Projects that are alternatives of or similar to BepInEx.ConfigurationManager

agollo
🚀Go client for ctrip/apollo (https://github.com/apolloconfig/apollo)
Stars: ✭ 563 (+389.57%)
Mutual labels:  configuration-management
envkey-python
EnvKey's python library. Protect API keys and credentials. Keep configuration in sync.
Stars: ✭ 24 (-79.13%)
Mutual labels:  configuration-management
ctrip-apollo-client
This is a client library for Apollo(A reliable configuration management system) written in Node.js.
Stars: ✭ 49 (-57.39%)
Mutual labels:  configuration-management
irsync
rsync on interval, via command line binary or docker container. Server and IOT builds for pull or push based device content management.
Stars: ✭ 19 (-83.48%)
Mutual labels:  configuration-management
climatecontrol
Python library for loading settings and config data from files and environment variables
Stars: ✭ 20 (-82.61%)
Mutual labels:  configuration-management
i3configger
i3 config manipulation tool
Stars: ✭ 23 (-80%)
Mutual labels:  configuration-management
opensvc
The OpenSVC node agent
Stars: ✭ 27 (-76.52%)
Mutual labels:  configuration-management
puppet-jboss
Installs JBoss EAP and WildFly application servers and manage their resources and applications in either a domain or a stand-alone mode
Stars: ✭ 15 (-86.96%)
Mutual labels:  configuration-management
Illusion HeightBar
Plugin for measuring character height in Koikatu! and AI-Syoujyo chara maker
Stars: ✭ 15 (-86.96%)
Mutual labels:  bepinex
ansible-sshjail
An Ansible connection plugin for provisioning FreeBSD jails remotely
Stars: ✭ 57 (-50.43%)
Mutual labels:  configuration-management
hier config
Hierarchical Configuration
Stars: ✭ 86 (-25.22%)
Mutual labels:  configuration-management
dynamic-config
A dynamic config library for Node.js implemented in TypeScript
Stars: ✭ 29 (-74.78%)
Mutual labels:  configuration-management
CoSky
High-performance, low-cost microservice governance platform. Service Discovery and Configuration Service | 高性能、低成本微服务治理平台
Stars: ✭ 57 (-50.43%)
Mutual labels:  configuration-management
configi.old
Bloat-free configuration management
Stars: ✭ 35 (-69.57%)
Mutual labels:  configuration-management
envkey-node
EnvKey's official Node.js client library
Stars: ✭ 46 (-60%)
Mutual labels:  configuration-management
holo
Minimalistic configuration management
Stars: ✭ 88 (-23.48%)
Mutual labels:  configuration-management
Pokedex
Pokedex is a robust Discord bot that mimics the iconic Pokedex from the Pokemon games and show. It's loaded with features to help players of all skill levels to learn and better enjoy Pokemon! The goal of Pokedex is to provide users with as much data about the Pokemon games as they desire conveniently and with minimal effort.
Stars: ✭ 18 (-84.35%)
Mutual labels:  configuration-management
stavka
Stavka manages configuration from various sources, for your Clojure application.
Stars: ✭ 40 (-65.22%)
Mutual labels:  configuration-management
efs2
A dead-simple configuration management tool powered by stupid shell scripts.
Stars: ✭ 82 (-28.7%)
Mutual labels:  configuration-management
zbx2git
Zabbix Configuration Versioning Manager
Stars: ✭ 23 (-80%)
Mutual labels:  configuration-management

Plugin / mod configuration manager for BepInEx 5

An easy way to let user configure how a plugin behaves without the need to make your own GUI. The user can change any of the settings you expose, even keyboard shortcuts.

The configuration manager can be accessed in-game by pressing the hotkey (by default F1). Hover over the setting names to see their descriptions, if any.

Configuration manager

How to use

  • Install a build of BepInEx 5 from at least 26/09/2019 (older won't work).
  • Download latest release from the Releases tab above.
  • Place the .dll inside your BepInEx\Plugins folder.
  • Start the game and press F1.

Note: The .xml file is useful for plugin developers when referencing ConfigurationManager.dll in your plugin, it will provide descriptions for types and methods to your IDE. Users can ignore it.

How to make my mod compatible?

ConfigurationManager will automatically display all settings from your plugin's Config. All metadata (e.g. description, value range) will be used by ConfigurationManager to display the settings to the user.

In most cases you don't have to reference ConfigurationManager.dll or do anything special with your settings. Simply make sure to add as much metadata as possible (doing so will help all users, even if they use the config files directly). Always add descriptive section and key names, descriptions, and acceptable value lists or ranges (wherever applicable).

How to make my setting into a slider?

Specify AcceptableValueRange when creating your setting. If the range is 0f - 1f or 0 - 100 the slider will be shown as % (this can be overridden below).

CaptureWidth = Config.AddSetting("Section", "Key", 1, new ConfigDescription("Description", new AcceptableValueRange<int>(0, 100)));

How to make my setting into a drop-down list?

Specify AcceptableValueList when creating your setting. If you use an enum you don't need to specify AcceptableValueList, all of the enum values will be shown. If you want to hide some values, you will have to use the attribute.

Note: You can add System.ComponentModel.DescriptionAttribute to your enum's items to override their displayed names. For example:

public enum MyEnum
{
    // Entry1 will be shown in the combo box as Entry1
    Entry1,
    [Description("Entry2 will be shown in the combo box as this string")]
    Entry2
}

How to allow user to change my keyboard shorcuts / How to easily check for key presses?

Add a setting of type KeyboardShortcut. Use the value of this setting to check for inputs (recommend using IsDown) inside of your Update method.

The KeyboardShortcut class supports modifier keys - Shift, Control and Alt. They are properly handled, preventing common problems like K+Shift+Control triggering K+Shift when it shouldn't have.

private ConfigEntry<KeyboardShortcut> ShowCounter { get; set; }

public Constructor()
{
    ShowCounter = Config.AddSetting("Hotkeys", "Show FPS counter", new KeyboardShortcut(KeyCode.U, KeyCode.LeftShift));
}

private void Update()
{
    if (ShowCounter.Value.IsDown())
    {
        // Handle the key press
    }
}

Overriding default Configuration Manager behavior

You can change how a setting is shown inside the configuration manager window by passing an instance of a special class as a tag of the setting. The special class code can be downloaded here. Simply download the .cs file and drag it into your project.

  • You do not have to reference ConfigurationManager.dll for this to work.
  • The class will work as long as name of the class and declarations of its fields remain unchanged.
  • Avoid making the class public to prevent conflicts with other plugins. If you want to share it between your plugins either give each a copy, or move it to your custom namespace.
  • If the ConfigurationManager plugin is not installed in the game, this class will be safely ignored and your plugin will work as normal.

Here's an example of overriding order of settings and marking one of the settings as advanced:

// 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 }));

How to make a custom editor for my setting?

If you are using a setting type that is not supported by ConfigurationManager, you can add a drawer Action for it. The Action will be executed inside OnGUI, use GUILayout to draw your setting as shown in the example below.

To use a custom seting drawer for an individual setting, use the CustomDrawer field in the attribute class. See above for more info on the attribute class.

void Start()
{
    // Add the drawer as a tag to this setting.
    Config.AddSetting("Section", "Key", "Some value" 
        new ConfigDescription("Desc", null, new ConfigurationManagerAttributes{ CustomDrawer = MyDrawer });
}

static void MyDrawer(BepInEx.Configuration.ConfigEntryBase entry)
{
    // Make sure to use GUILayout.ExpandWidth(true) to use all available space
    GUILayout.Label(entry.BoxedValue, GUILayout.ExpandWidth(true));
}

Add a custom editor globally

You can specify a drawer for all settings of a setting type. Do this by using ConfigurationManager.RegisterCustomSettingDrawer(Type, Action<SettingEntryBase>).

Warning: This requires you to reference ConfigurationManager.dll in your project and is not recommended unless you are sure all users will have it installed. It's usually better to use the above method to add the custom drawer to each setting individually instead.

void Start()
{
    ConfigurationManager.RegisterCustomSettingDrawer(typeof(MyType), CustomDrawer);
}

static void CustomDrawer(SettingEntryBase entry)
{
    GUILayout.Label((MyType)entry.Get(), GUILayout.ExpandWidth(true));
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].