diff options
author | chai <chaifix@163.com> | 2021-09-08 10:52:35 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-09-08 10:52:35 +0800 |
commit | 21e186f75b504d832d9c7bef0456edd7d5d3155e (patch) | |
tree | e73c43fc78d0326f32da5fadfda57fa8e23c1d90 /Assets/Art/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledInteractiveDrawer.cs | |
parent | 7bd7b4c6c3be6840cab06aa4d8a38619bce44705 (diff) |
+behavior design
Diffstat (limited to 'Assets/Art/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledInteractiveDrawer.cs')
-rw-r--r-- | Assets/Art/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledInteractiveDrawer.cs | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/Assets/Art/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledInteractiveDrawer.cs b/Assets/Art/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledInteractiveDrawer.cs new file mode 100644 index 00000000..1f31e352 --- /dev/null +++ b/Assets/Art/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledInteractiveDrawer.cs @@ -0,0 +1,55 @@ +// Cristian Pop - https://boxophobic.com/
+
+using UnityEngine;
+using UnityEditor;
+
+namespace Boxophobic.StyledGUI
+{
+ [CustomPropertyDrawer(typeof(StyledInteractive))]
+ public class StyledInteractiveAttributeDrawer : PropertyDrawer
+ {
+ StyledInteractive a;
+
+ private int Value;
+ private string Keywork;
+ public int Type;
+
+ public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
+ {
+ a = (StyledInteractive)attribute;
+
+ Value = a.value;
+ Keywork = a.keyword;
+ Type = a.type;
+
+ if (Type == 0)
+ {
+ if (property.intValue == Value)
+ {
+ GUI.enabled = true;
+ }
+ else
+ {
+ GUI.enabled = false;
+ }
+ }
+ else if (Type == 1)
+ {
+ if (Keywork == "ON")
+ {
+ GUI.enabled = true;
+ }
+ else if (Keywork == "OFF")
+ {
+ GUI.enabled = false;
+ }
+ }
+
+ }
+
+ public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
+ {
+ return -2;
+ }
+ }
+}
|