KingEnderBrine-InLobbyConfig icon

InLobbyConfig

Adds an ability to edit configs for mods (that support this) inside a lobby

Last updated 5 days ago
Total downloads 645
Total rating 1 
Dependency string KingEnderBrine-InLobbyConfig-1.0.1
Dependants 3 other mods depend on this mod

This mod requires the following mods to function

tristanmcpherson-R2API-2.5.28 icon
tristanmcpherson-R2API

A modding API for Risk of Rain 2

Preferred version: 2.5.28
bbepis-BepInExPack-5.3.1 icon
bbepis-BepInExPack

Unified BepInEx all-in-one modding pack - plugin framework, detour library

Preferred version: 5.3.1
README

Description

This library adds an ability to edit configs for mods (that support this) inside a lobby.

For developers

Dependency attribute [BepInDependency("com.KingEnderBrine.InLobbyConfig")]

TL;DR

Easiest (but limited) way to add config based on BepInEx config is to use helper method

var configEntry = InLobbyConfig.Fields.ConfigFieldUtilities.CreateFromBepInExConfigFile(Config, "Display name");
InLobbyConfig.ModConfigCatalog.Add(configEntry);

There is a special field. If your config has a bool field called Enabled (ignored case) it will be shown next to the mod name like so:

This behavior can be disabled if you add false to parameters for CreateFromBepInExConfigFile.

Or you can create InLobbyConfig.ModConfigEntry and add fields and section manually

var configEntry = new InLobbyConfig.ModConfigEntry();
configEntry.DisplayName = "Display name";
//configEntry.EnableField = new BooleanConfigField(...);
configEntry.SectionFields.Add("Section name", new List<IConfigField>
{
    new InLobbyConfig.Fields.BooleanConfigField("display name", () => ConfigField.Value, (newValue) => ConfigField.Value = newValue),
    InLobbyConfig.Fields.ConfigFieldUtilities.CreateFromBepInExConfigEntry<int>(ConfigField)
});
InLobbyConfig.ModConfigCatalog.Add(configEntry);

Documentation

Supported field types

Type Field class
bool BooleanConfigField
enum EnumConfigField
int IntConfigField
float FloatConfigField
string StringConfigField
UnityEngine.Color ColorConfigField

Or you can create your own ConfigField with your own prefab, for example:

Field constructor parameters description

BaseConfigField (BooleanConfigField, EnumConfigField)
  • displayName - name of a field
  • tooltip - text to display when hover over field name.
  • valueAccessor - function which will be used to retrieve actual value of config.
BaseInputConfigField (ColorConfigField, StringConfgiField)

Same as BaseConfigFiled +

  • onValueChanged - a function which will be called when the value of a field is changed. Value in config doesn't automatically change, this is up to you what you want to do with the changed value.
  • onEndEdit - a function which will be called when a user ended changing field. Unlike onValueChange which called with every change. Value in config doesn't automatically change, this is up to you what you want to do with the changed value.
BaseNumberInputConfigField (IntConfigField, FloatConfigField)

Same as BaseInputConfigField +

  • minimum - minimum for a field value.
  • maximum - maximum for a filed value.

Custom config field

Mandatory things that you need to create a custom config field:

  • Create a class that implements InLobbyConfig.Fields.IConfigField (or inherits form InLobbyConfig.Fields.BaseConfigField<T>)
  • Create a class that inherites InLobbyConfig.FieldControllers.ConfigFieldController
  • Create a prefab that has your ConfigFieldController in a root object

From this point, you can do whatever you want. For examples of how I set up fields, you can go to InLobbyConfig GitHub or ArtifactsRandomize GitHub.

Changelog

1.0.1

  • Readme update

1.0.0

  • Mod release.

Available versions

Please note that the install buttons only work if you have compatible client software installed. Otherwise use the zip download links instead.

Upload date Version number Downloads Download link  
2020-11-20 1.0.1 609 KingEnderBrine-InLobbyConfig-1.0.1.zip Install
2020-11-20 1.0.0 36 KingEnderBrine-InLobbyConfig-1.0.0.zip Install