summaryrefslogtreecommitdiff
path: root/Assets/Plugins/AdvancedInspector/Attributes/AdvancedInspector.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2020-10-15 07:24:10 +0800
committerchai <chaifix@163.com>2020-10-15 07:24:10 +0800
commite846c64d6f927879cb8a095e62d773a8d7b3c9f4 (patch)
tree7882744bbf2b6c7096ec15fb300f088c5a0807c5 /Assets/Plugins/AdvancedInspector/Attributes/AdvancedInspector.cs
parentcd12e74241678ee3c0752484d310b202187ba24c (diff)
*ability system
Diffstat (limited to 'Assets/Plugins/AdvancedInspector/Attributes/AdvancedInspector.cs')
-rw-r--r--Assets/Plugins/AdvancedInspector/Attributes/AdvancedInspector.cs60
1 files changed, 60 insertions, 0 deletions
diff --git a/Assets/Plugins/AdvancedInspector/Attributes/AdvancedInspector.cs b/Assets/Plugins/AdvancedInspector/Attributes/AdvancedInspector.cs
new file mode 100644
index 00000000..047710d5
--- /dev/null
+++ b/Assets/Plugins/AdvancedInspector/Attributes/AdvancedInspector.cs
@@ -0,0 +1,60 @@
+using System;
+
+namespace AdvancedInspector
+{
+ /// <summary>
+ /// Turn off the default Inspector in favor or the Advanced one.
+ /// If false, both may be draw if some members are flagged "Inspect", one after the other...
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = true)]
+ public class AdvancedInspectorAttribute : Attribute
+ {
+ private bool inspectDefaultItems = false;
+
+ /// <summary>
+ /// If true, the Advanced Inspector inspect all the item the default Inspector does without adding the [Inspect] attribute.
+ /// You can still add item that Unity would not display by adding the [Inspect] attribute.
+ /// </summary>
+ public bool InspectDefaultItems
+ {
+ get { return inspectDefaultItems; }
+ set { inspectDefaultItems = value; }
+ }
+
+ private bool showScript = true;
+
+ /// <summary>
+ /// Show or hide the script field at the top of the inspector.
+ /// The script field allow to change the type of the object.
+ /// </summary>
+ public bool ShowScript
+ {
+ get { return showScript; }
+ set { showScript = value; }
+ }
+
+ private bool expandable = true;
+
+ /// <summary>
+ /// Is this object expandable in a in-lined context?
+ /// </summary>
+ public bool Expandable
+ {
+ get { return expandable; }
+ set { expandable = value; }
+ }
+
+ public AdvancedInspectorAttribute() { }
+
+ public AdvancedInspectorAttribute(bool inspectDefaultItems)
+ {
+ this.inspectDefaultItems = inspectDefaultItems;
+ }
+
+ public AdvancedInspectorAttribute(bool inspectDefaultItems, bool showScript)
+ {
+ this.showScript = showScript;
+ this.inspectDefaultItems = inspectDefaultItems;
+ }
+ }
+}