private bool TextChanged(GUITextBox textBox, string text) { switch (InputType) { case NumberType.Int: int newIntValue = IntValue; if (string.IsNullOrWhiteSpace(text) || text == "-") { intValue = 0; } else if (int.TryParse(text, out newIntValue)) { intValue = newIntValue; } ClampIntValue(); break; case NumberType.Float: float newFloatValue = FloatValue; if (string.IsNullOrWhiteSpace(text) || text == "-") { floatValue = 0; } else if (float.TryParse(text, NumberStyles.Any, CultureInfo.InvariantCulture, out newFloatValue)) { floatValue = newFloatValue; } ClampFloatValue(); break; } OnValueChanged?.Invoke(this); return(true); }