I know it's not very clear. You'd think "just use ConfigEntry.OnChanged" but it will work in some cases.
I couldn't find any better name for the suggestion to be honest.
Here is an example use case.
class Config
{
public enum ExampleEnum
{
ChoiceOne,
ChoiceTwo,
ChoiceThree,
}
public static ConfigEntry<ExampleEnum> ExEnumValue;
public static ConfigEntry<int> ExEnumValueChild;
public Config(ConfigFile cfg)
{
ExEnumValue = cfg.Bind("general", "testEnum", ExampleEnum.ChoiceOne, "eeee");
ExEnumValueChild = cfg.Bind("general", "testValue", 0, "aaaa");
var enumOption = new EnumDropDownConfigItem<ExampleEnum>(ExEnumValue, new EnumDropDownOptions
{
RequiresRestart = false
});
var intOption = new IntSliderConfigItem(ExEnumValueChild, new IntSliderOptions
{
Min = 0,
Max = 12,
OnValueChanged += (changedOption, thisOption) =>
{
if(changedOption is not ConfigEntry<ExampleEnum>)
return;
var enumChangedOpt = changedOption as ConfigEntry<ExampleEnum>;
switch(enumChangedOpt.Value)
{
case ExampleEnum.ChoiceTwo:
thisOption.Max = 6;
break;
case ExampleEnum.ChoiceThree:
thisOption.Max = 1;
break;
default:
thisOption.Max = 12;
break;
}
},
RequiresRestart = false
});
}
}
That's quite complex but basically it would allow to change other options limits and datas when another option of the menu is triggered.
I'm not good at all to explain, but if you want more precise explanations, I'm always open.
I know it's not very clear. You'd think "just use ConfigEntry.OnChanged" but it will work in some cases.
I couldn't find any better name for the suggestion to be honest.
Here is an example use case.
That's quite complex but basically it would allow to change other options limits and datas when another option of the menu is triggered.
I'm not good at all to explain, but if you want more precise explanations, I'm always open.