-
Notifications
You must be signed in to change notification settings - Fork 0
/
CategorizedEnumAttribute.cs
48 lines (38 loc) · 1.47 KB
/
CategorizedEnumAttribute.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
using UnityEngine;
namespace CategorizedEnum {
[AttributeUsage(AttributeTargets.Field)]
public class CategorizedEnumAttribute : PropertyAttribute {
/// <summary>
/// The delimiter used to categorize the enum entries
/// </summary>
public readonly char delimiter = '_';
/// <summary>
/// The referenced enum type
/// </summary>
public readonly System.Type enumType = null;
/// <summary>
/// The referenced enum type
/// </summary>
public readonly bool displayInViewer = false;
/// <summary>
/// Show id on hover
/// </summary>
public readonly bool showFullPath = false;
/// <summary>
/// If we should categorize enum entries by camel case
/// </summary>
public bool categorizeByCamelCase = false;
/// <summary>
/// When the underlying property is simply an int instead of an enum, we notify the drawer that this is a FakeEnum
/// </summary>
public bool isFakeEnum = false;
public CategorizedEnumAttribute(char delimiter = '_', System.Type enumType = null, bool displayInViewer = false, bool showID = false, bool isFakeEnum = false) {
this.delimiter = delimiter;
this.enumType = enumType;
this.displayInViewer = displayInViewer;
this.showFullPath = showID;
this.isFakeEnum = isFakeEnum;
}
}
}