32 lines
1,004 B
C#
32 lines
1,004 B
C#
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
namespace Module.Inspector.Editor
|
|
{
|
|
[CustomMethodDrawer(typeof(MethodHeader))]
|
|
public sealed class DrawerMethodHeader : DecoratorMethodDrawer
|
|
{
|
|
public override bool Draw(Rect position, DecoratorMethodAttribute attribute)
|
|
{
|
|
var att = (MethodHeader)attribute;
|
|
|
|
if (string.IsNullOrEmpty(att.title))
|
|
return false;
|
|
|
|
var style = new GUIStyle(GUI.skin.label)
|
|
{
|
|
fontStyle = FontStyle.Bold,
|
|
alignment = TextAnchor.LowerLeft
|
|
};
|
|
|
|
EditorGUI.LabelField(position, att.title, style);
|
|
return true;
|
|
}
|
|
|
|
public override float GetHeight(DecoratorMethodAttribute attribute)
|
|
{
|
|
var att = (MethodHeader)attribute;
|
|
return !string.IsNullOrEmpty(att.title) ? EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing : 0.0f;
|
|
}
|
|
}
|
|
} |