2021-12-07 18:20:36 +03:00
|
|
|
|
using TriInspector.Utilities;
|
|
|
|
|
using UnityEditor;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace TriInspector.Elements
|
|
|
|
|
{
|
|
|
|
|
internal class TriBuiltInPropertyElement : TriElement
|
|
|
|
|
{
|
|
|
|
|
private readonly TriProperty _property;
|
|
|
|
|
private readonly PropertyHandlerProxy _propertyHandler;
|
|
|
|
|
private readonly SerializedProperty _serializedProperty;
|
|
|
|
|
|
|
|
|
|
public TriBuiltInPropertyElement(
|
|
|
|
|
TriProperty property,
|
|
|
|
|
SerializedProperty serializedProperty,
|
|
|
|
|
PropertyHandlerProxy propertyHandler)
|
|
|
|
|
{
|
|
|
|
|
_property = property;
|
|
|
|
|
_serializedProperty = serializedProperty;
|
|
|
|
|
_propertyHandler = propertyHandler;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override float GetHeight(float width)
|
|
|
|
|
{
|
|
|
|
|
return _propertyHandler.GetHeight(_serializedProperty, _property.DisplayNameContent, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnGUI(Rect position)
|
|
|
|
|
{
|
2022-05-11 11:54:19 +03:00
|
|
|
|
EditorGUI.BeginChangeCheck();
|
|
|
|
|
|
2021-12-07 18:20:36 +03:00
|
|
|
|
_propertyHandler.OnGUI(position, _serializedProperty, _property.DisplayNameContent, true);
|
2022-05-11 11:54:19 +03:00
|
|
|
|
|
|
|
|
|
if (EditorGUI.EndChangeCheck())
|
|
|
|
|
{
|
|
|
|
|
_property.NotifyValueChanged();
|
|
|
|
|
}
|
2021-12-07 18:20:36 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|