r2mods/ilspy_dump/ror2_csproj/RoR2.UI/SettingsTextBox.cs

31 lines
570 B
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
using TMPro;
namespace RoR2.UI;
public class SettingsTextBox : BaseSettingsControl
{
public TMP_InputField textbox;
protected new void OnEnable()
{
base.OnEnable();
textbox?.onValueChanged?.AddListener(OnTextBoxValueChanged);
}
protected void OnDisable()
{
textbox?.onValueChanged?.RemoveListener(OnTextBoxValueChanged);
}
private void OnTextBoxValueChanged(string newValue)
{
SubmitSetting(newValue);
}
protected override void OnUpdateControls()
{
string currentValue = GetCurrentValue();
textbox?.SetTextWithoutNotify(currentValue);
}
}