mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-01-03 16:13:25 +08:00
InteracitveNumber update validation on potential type change
This commit is contained in:
parent
8e2e2abef4
commit
d379d6b129
@ -49,6 +49,18 @@ namespace UnityExplorer.Inspectors.Reflection
|
||||
m_baseLabel.text = UISyntaxHighlight.ParseFullSyntax(FallbackType, false);
|
||||
m_valueInput.text = Value.ToString();
|
||||
|
||||
var type = Value.GetType();
|
||||
if (type == typeof(float)
|
||||
|| type == typeof(double)
|
||||
|| type == typeof(decimal))
|
||||
{
|
||||
m_valueInput.characterValidation = InputField.CharacterValidation.Decimal;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_valueInput.characterValidation = InputField.CharacterValidation.Integer;
|
||||
}
|
||||
|
||||
if (Owner.CanWrite)
|
||||
{
|
||||
if (!m_applyBtn.gameObject.activeSelf)
|
||||
@ -96,17 +108,6 @@ namespace UnityExplorer.Inspectors.Reflection
|
||||
m_valueInput = inputObj.GetComponent<InputField>();
|
||||
m_valueInput.gameObject.SetActive(false);
|
||||
|
||||
if (this.FallbackType == typeof(float)
|
||||
|| this.FallbackType == typeof(double)
|
||||
|| this.FallbackType == typeof(decimal))
|
||||
{
|
||||
m_valueInput.characterValidation = InputField.CharacterValidation.Decimal;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_valueInput.characterValidation = InputField.CharacterValidation.Integer;
|
||||
}
|
||||
|
||||
if (Owner.CanWrite)
|
||||
{
|
||||
var applyBtnObj = UIFactory.CreateButton(m_valueContent, new Color(0.2f, 0.2f, 0.2f));
|
||||
|
Loading…
x
Reference in New Issue
Block a user