BepInExConfigManager
BepInExConfigManager copied to clipboard
Float inputs don't allow typing a period after the number
When a float input has a current value like 7
, it's impossible to type a .
after it to eventually type something like 7.5
.
The reason is that it parses the intermediate 7.
as 7
and then immediately overrides the input value with that.
Once you know what the issue is, you can somewhat work around it by first typing 75
and then inserting the period but it's pretty confusing at first.
I guess one possible solution could be to not override the input if it's functionally identical, i.e. before setting the input value when the setting changed, parse the current input and check whether it's already the same value and if so, don't override it. This would also avoid the somewhat odd behavior of it automatically changing .7
to 0.7
and would also avoid it changing 7.0
to 7
if you want to type 7.05
.
I guess after finishing writing ^ I realized this should be pretty easy to implement. Simply add
try
{
var currVal = ParseMethod.Invoke(null, new object[] { valueInput.Text, CultureInfo.InvariantCulture });
if (Value.Equals(currVal)) return;
}
catch { }
to the top of InteractiveNumber.RefreshUIForValue
. And I guess probably move the part where it activates the game object above this.
I'd create a PR but this would conflict with #16 so just posting it here for now.