From e846c64d6f927879cb8a095e62d773a8d7b3c9f4 Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 15 Oct 2020 07:24:10 +0800 Subject: *ability system --- .../AdvancedInspector/Attributes/Expandable.cs | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Assets/Plugins/AdvancedInspector/Attributes/Expandable.cs (limited to 'Assets/Plugins/AdvancedInspector/Attributes/Expandable.cs') diff --git a/Assets/Plugins/AdvancedInspector/Attributes/Expandable.cs b/Assets/Plugins/AdvancedInspector/Attributes/Expandable.cs new file mode 100644 index 00000000..b63d5c38 --- /dev/null +++ b/Assets/Plugins/AdvancedInspector/Attributes/Expandable.cs @@ -0,0 +1,46 @@ +using System; + +namespace AdvancedInspector +{ + /// + /// Redefine if a field/property can be expanded or not. + /// + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, Inherited = true)] + public class ExpandableAttribute : Attribute, IListAttribute + { + private bool expanded = false; + + /// + /// Makes the item expanded by default. + /// + public bool Expanded + { + get { return expanded; } + set { expanded = value; } + } + + private bool expandable = true; + + /// + /// Default true, can force a field to not be expandable. + /// + public bool Expandable + { + get { return expandable; } + set { expandable = value; } + } + + public ExpandableAttribute() { } + + public ExpandableAttribute(bool expandable) + { + this.expandable = expandable; + } + + public ExpandableAttribute(bool expandable, bool expanded) + { + this.expanded = expanded; + this.expandable = expandable; + } + } +} \ No newline at end of file -- cgit v1.1-26-g67d0