Renamed all attributes and drawers to have postfix of either Attribute or AttributeDrawer
This commit is contained in:
parent
81bac32538
commit
dc15bfec81
161 changed files with 265 additions and 265 deletions
25
Editor/Drawers/MethodButtonAttributeDrawer.cs
Normal file
25
Editor/Drawers/MethodButtonAttributeDrawer.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Module.Inspector.Editor
|
||||
{
|
||||
[CustomMethodDrawer(typeof(MethodButtonAttribute))]
|
||||
internal sealed class MethodButtonAttributeDrawer : DrawerMethodDrawer
|
||||
{
|
||||
public override bool Draw(Rect position, DrawerMethodAttribute attribute, Object target, MethodInfo methodInfo)
|
||||
{
|
||||
var att = (MethodButtonAttribute)attribute;
|
||||
string name = string.IsNullOrEmpty(att.name) ? methodInfo.Name : att.name;
|
||||
|
||||
if (GUI.Button(position, name))
|
||||
methodInfo.Invoke(methodInfo.IsStatic ? null : target, null);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override string GetErrorMessage()
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue