diff options
Diffstat (limited to 'Client/Assets/Behavior Designer/Editor/Object Drawers')
4 files changed, 60 insertions, 0 deletions
diff --git a/Client/Assets/Behavior Designer/Editor/Object Drawers/FloatSliderDrawer.cs b/Client/Assets/Behavior Designer/Editor/Object Drawers/FloatSliderDrawer.cs new file mode 100644 index 00000000..ada9607b --- /dev/null +++ b/Client/Assets/Behavior Designer/Editor/Object Drawers/FloatSliderDrawer.cs @@ -0,0 +1,22 @@ +using UnityEngine;
+using UnityEditor;
+using BehaviorDesigner.Runtime;
+using BehaviorDesigner.Runtime.ObjectDrawers;
+
+namespace BehaviorDesigner.Editor.ObjectDrawers
+{
+ [CustomObjectDrawer(typeof(FloatSliderAttribute))]
+ public class FloatSliderDrawer : ObjectDrawer
+ {
+ public override void OnGUI(GUIContent label)
+ {
+ var floatSliderAttribute = (FloatSliderAttribute)attribute;
+ if (value is SharedFloat) {
+ var sharedFloat = value as SharedFloat;
+ sharedFloat.Value = EditorGUILayout.Slider(label, sharedFloat.Value, floatSliderAttribute.min, floatSliderAttribute.max);
+ } else {
+ value = EditorGUILayout.Slider(label, (float)value, floatSliderAttribute.min, floatSliderAttribute.max);
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Editor/Object Drawers/FloatSliderDrawer.cs.meta b/Client/Assets/Behavior Designer/Editor/Object Drawers/FloatSliderDrawer.cs.meta new file mode 100644 index 00000000..9fd520f8 --- /dev/null +++ b/Client/Assets/Behavior Designer/Editor/Object Drawers/FloatSliderDrawer.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2
+guid: 5f0987c6ff37141458ff776277e2b65a
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Client/Assets/Behavior Designer/Editor/Object Drawers/IntSliderDrawer.cs b/Client/Assets/Behavior Designer/Editor/Object Drawers/IntSliderDrawer.cs new file mode 100644 index 00000000..53a532ff --- /dev/null +++ b/Client/Assets/Behavior Designer/Editor/Object Drawers/IntSliderDrawer.cs @@ -0,0 +1,22 @@ +using UnityEngine;
+using UnityEditor;
+using BehaviorDesigner.Runtime;
+using BehaviorDesigner.Runtime.ObjectDrawers;
+
+namespace BehaviorDesigner.Editor.ObjectDrawers
+{
+ [CustomObjectDrawer(typeof(IntSliderAttribute))]
+ public class IntSliderDrawer : ObjectDrawer
+ {
+ public override void OnGUI(GUIContent label)
+ {
+ var intSliderAttribute = (IntSliderAttribute)attribute;
+ if (value is SharedInt) {
+ var sharedFloat = value as SharedInt;
+ sharedFloat.Value = EditorGUILayout.IntSlider(label, sharedFloat.Value, intSliderAttribute.min, intSliderAttribute.max);
+ } else {
+ value = EditorGUILayout.IntSlider(label, (int)value, intSliderAttribute.min, intSliderAttribute.max);
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Editor/Object Drawers/IntSliderDrawer.cs.meta b/Client/Assets/Behavior Designer/Editor/Object Drawers/IntSliderDrawer.cs.meta new file mode 100644 index 00000000..8c3203a0 --- /dev/null +++ b/Client/Assets/Behavior Designer/Editor/Object Drawers/IntSliderDrawer.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2
+guid: ed5dac524fa5f61468bb6ca49a556b3b
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
|