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
36
Editor/Drawers/UrlGoToAttributeDrawer.cs
Normal file
36
Editor/Drawers/UrlGoToAttributeDrawer.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using Module.Inspector.Editor.Utilities;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Module.Inspector.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(UrlGoToAttribute))]
|
||||
internal sealed class UrlGoToAttributeDrawer : DrawerPropertyDrawer
|
||||
{
|
||||
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
|
||||
{
|
||||
if (property.propertyType != SerializedPropertyType.String)
|
||||
return false;
|
||||
|
||||
EditorGUI.BeginProperty(position, label, property);
|
||||
{
|
||||
const float WIDTH = 80;
|
||||
|
||||
var r0 = new Rect(position.x, position.y, position.width - WIDTH, position.height);
|
||||
var r1 = new Rect(r0.xMax, r0.y, WIDTH, r0.height);
|
||||
|
||||
EditorGUI.PropertyField(r0, property, label);
|
||||
|
||||
if (GUI.Button(r1, "Go"))
|
||||
Application.OpenURL(property.stringValue);
|
||||
}
|
||||
EditorGUI.EndProperty();
|
||||
return true;
|
||||
}
|
||||
|
||||
public override string GetErrorMessage(SerializedProperty property)
|
||||
{
|
||||
return "Only supports strings";
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue