mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-01-05 17:13:43 +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_baseLabel.text = UISyntaxHighlight.ParseFullSyntax(FallbackType, false);
|
||||||
m_valueInput.text = Value.ToString();
|
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 (Owner.CanWrite)
|
||||||
{
|
{
|
||||||
if (!m_applyBtn.gameObject.activeSelf)
|
if (!m_applyBtn.gameObject.activeSelf)
|
||||||
@ -96,17 +108,6 @@ namespace UnityExplorer.Inspectors.Reflection
|
|||||||
m_valueInput = inputObj.GetComponent<InputField>();
|
m_valueInput = inputObj.GetComponent<InputField>();
|
||||||
m_valueInput.gameObject.SetActive(false);
|
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)
|
if (Owner.CanWrite)
|
||||||
{
|
{
|
||||||
var applyBtnObj = UIFactory.CreateButton(m_valueContent, new Color(0.2f, 0.2f, 0.2f));
|
var applyBtnObj = UIFactory.CreateButton(m_valueContent, new Color(0.2f, 0.2f, 0.2f));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user