summaryrefslogtreecommitdiff
path: root/Assets/Thirdparty/Joystick Pack/Scripts/Editor
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2020-08-20 23:40:50 -0400
committerAndrew Lee <alee14498@protonmail.com>2020-08-20 23:40:50 -0400
commit3af4c218c0e70167db23a6303d2af30aff37d2fe (patch)
tree927f29edcf54ab562f40f3d1c6cb69287c7f5980 /Assets/Thirdparty/Joystick Pack/Scripts/Editor
parentb6daed0af784f4e9bc13329dd87c671b06ee1c65 (diff)
downloadProject-Sandbox-3af4c218c0e70167db23a6303d2af30aff37d2fe.tar.gz
Project-Sandbox-3af4c218c0e70167db23a6303d2af30aff37d2fe.tar.bz2
Project-Sandbox-3af4c218c0e70167db23a6303d2af30aff37d2fe.zip
Removed a bunch of stuff; Changes
Diffstat (limited to 'Assets/Thirdparty/Joystick Pack/Scripts/Editor')
-rw-r--r--Assets/Thirdparty/Joystick Pack/Scripts/Editor/DynamicJoystickEditor.cs35
-rw-r--r--Assets/Thirdparty/Joystick Pack/Scripts/Editor/DynamicJoystickEditor.cs.meta11
-rw-r--r--Assets/Thirdparty/Joystick Pack/Scripts/Editor/FloatingJoystickEditor.cs21
-rw-r--r--Assets/Thirdparty/Joystick Pack/Scripts/Editor/FloatingJoystickEditor.cs.meta11
-rw-r--r--Assets/Thirdparty/Joystick Pack/Scripts/Editor/JoystickEditor.cs64
-rw-r--r--Assets/Thirdparty/Joystick Pack/Scripts/Editor/JoystickEditor.cs.meta11
-rw-r--r--Assets/Thirdparty/Joystick Pack/Scripts/Editor/VariableJoystickEditor.cs37
-rw-r--r--Assets/Thirdparty/Joystick Pack/Scripts/Editor/VariableJoystickEditor.cs.meta11
8 files changed, 201 insertions, 0 deletions
diff --git a/Assets/Thirdparty/Joystick Pack/Scripts/Editor/DynamicJoystickEditor.cs b/Assets/Thirdparty/Joystick Pack/Scripts/Editor/DynamicJoystickEditor.cs
new file mode 100644
index 0000000..e562c3b
--- /dev/null
+++ b/Assets/Thirdparty/Joystick Pack/Scripts/Editor/DynamicJoystickEditor.cs
@@ -0,0 +1,35 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEditor;
+
+[CustomEditor(typeof(DynamicJoystick))]
+public class DynamicJoystickEditor : JoystickEditor
+{
+ private SerializedProperty moveThreshold;
+
+ protected override void OnEnable()
+ {
+ base.OnEnable();
+ moveThreshold = serializedObject.FindProperty("moveThreshold");
+ }
+
+ public override void OnInspectorGUI()
+ {
+ base.OnInspectorGUI();
+
+ if (background != null)
+ {
+ RectTransform backgroundRect = (RectTransform)background.objectReferenceValue;
+ backgroundRect.anchorMax = Vector2.zero;
+ backgroundRect.anchorMin = Vector2.zero;
+ backgroundRect.pivot = center;
+ }
+ }
+
+ protected override void DrawValues()
+ {
+ base.DrawValues();
+ EditorGUILayout.PropertyField(moveThreshold, new GUIContent("Move Threshold", "The distance away from the center input has to be before the joystick begins to move."));
+ }
+} \ No newline at end of file
diff --git a/Assets/Thirdparty/Joystick Pack/Scripts/Editor/DynamicJoystickEditor.cs.meta b/Assets/Thirdparty/Joystick Pack/Scripts/Editor/DynamicJoystickEditor.cs.meta
new file mode 100644
index 0000000..bb13db0
--- /dev/null
+++ b/Assets/Thirdparty/Joystick Pack/Scripts/Editor/DynamicJoystickEditor.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 52071c88a467b46438b3cbf159bf988b
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Joystick Pack/Scripts/Editor/FloatingJoystickEditor.cs b/Assets/Thirdparty/Joystick Pack/Scripts/Editor/FloatingJoystickEditor.cs
new file mode 100644
index 0000000..9ae160e
--- /dev/null
+++ b/Assets/Thirdparty/Joystick Pack/Scripts/Editor/FloatingJoystickEditor.cs
@@ -0,0 +1,21 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEditor;
+
+[CustomEditor(typeof(FloatingJoystick))]
+public class FloatingJoystickEditor : JoystickEditor
+{
+ public override void OnInspectorGUI()
+ {
+ base.OnInspectorGUI();
+
+ if (background != null)
+ {
+ RectTransform backgroundRect = (RectTransform)background.objectReferenceValue;
+ backgroundRect.anchorMax = Vector2.zero;
+ backgroundRect.anchorMin = Vector2.zero;
+ backgroundRect.pivot = center;
+ }
+ }
+} \ No newline at end of file
diff --git a/Assets/Thirdparty/Joystick Pack/Scripts/Editor/FloatingJoystickEditor.cs.meta b/Assets/Thirdparty/Joystick Pack/Scripts/Editor/FloatingJoystickEditor.cs.meta
new file mode 100644
index 0000000..1026f94
--- /dev/null
+++ b/Assets/Thirdparty/Joystick Pack/Scripts/Editor/FloatingJoystickEditor.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 614d06243900d764f9c50b4da2c950a3
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Joystick Pack/Scripts/Editor/JoystickEditor.cs b/Assets/Thirdparty/Joystick Pack/Scripts/Editor/JoystickEditor.cs
new file mode 100644
index 0000000..782c9f3
--- /dev/null
+++ b/Assets/Thirdparty/Joystick Pack/Scripts/Editor/JoystickEditor.cs
@@ -0,0 +1,64 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEditor;
+
+[CustomEditor(typeof(Joystick), true)]
+public class JoystickEditor : Editor
+{
+ private SerializedProperty handleRange;
+ private SerializedProperty deadZone;
+ private SerializedProperty axisOptions;
+ private SerializedProperty snapX;
+ private SerializedProperty snapY;
+ protected SerializedProperty background;
+ private SerializedProperty handle;
+
+ protected Vector2 center = new Vector2(0.5f, 0.5f);
+
+ protected virtual void OnEnable()
+ {
+ handleRange = serializedObject.FindProperty("handleRange");
+ deadZone = serializedObject.FindProperty("deadZone");
+ axisOptions = serializedObject.FindProperty("axisOptions");
+ snapX = serializedObject.FindProperty("snapX");
+ snapY = serializedObject.FindProperty("snapY");
+ background = serializedObject.FindProperty("background");
+ handle = serializedObject.FindProperty("handle");
+ }
+
+ public override void OnInspectorGUI()
+ {
+ serializedObject.Update();
+
+ DrawValues();
+ EditorGUILayout.Space();
+ DrawComponents();
+
+ serializedObject.ApplyModifiedProperties();
+
+ if(handle != null)
+ {
+ RectTransform handleRect = (RectTransform)handle.objectReferenceValue;
+ handleRect.anchorMax = center;
+ handleRect.anchorMin = center;
+ handleRect.pivot = center;
+ handleRect.anchoredPosition = Vector2.zero;
+ }
+ }
+
+ protected virtual void DrawValues()
+ {
+ EditorGUILayout.PropertyField(handleRange, new GUIContent("Handle Range", "The distance the visual handle can move from the center of the joystick."));
+ EditorGUILayout.PropertyField(deadZone, new GUIContent("Dead Zone", "The distance away from the center input has to be before registering."));
+ EditorGUILayout.PropertyField(axisOptions, new GUIContent("Axis Options", "Which axes the joystick uses."));
+ EditorGUILayout.PropertyField(snapX, new GUIContent("Snap X", "Snap the horizontal input to a whole value."));
+ EditorGUILayout.PropertyField(snapY, new GUIContent("Snap Y", "Snap the vertical input to a whole value."));
+ }
+
+ protected virtual void DrawComponents()
+ {
+ EditorGUILayout.ObjectField(background, new GUIContent("Background", "The background's RectTransform component."));
+ EditorGUILayout.ObjectField(handle, new GUIContent("Handle", "The handle's RectTransform component."));
+ }
+} \ No newline at end of file
diff --git a/Assets/Thirdparty/Joystick Pack/Scripts/Editor/JoystickEditor.cs.meta b/Assets/Thirdparty/Joystick Pack/Scripts/Editor/JoystickEditor.cs.meta
new file mode 100644
index 0000000..59d5e45
--- /dev/null
+++ b/Assets/Thirdparty/Joystick Pack/Scripts/Editor/JoystickEditor.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: d4b2b0d911a01a64ebfca9918e2b90b4
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Thirdparty/Joystick Pack/Scripts/Editor/VariableJoystickEditor.cs b/Assets/Thirdparty/Joystick Pack/Scripts/Editor/VariableJoystickEditor.cs
new file mode 100644
index 0000000..f2ba979
--- /dev/null
+++ b/Assets/Thirdparty/Joystick Pack/Scripts/Editor/VariableJoystickEditor.cs
@@ -0,0 +1,37 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+using UnityEditor;
+
+[CustomEditor(typeof(VariableJoystick))]
+public class VariableJoystickEditor : JoystickEditor
+{
+ private SerializedProperty moveThreshold;
+ private SerializedProperty joystickType;
+
+ protected override void OnEnable()
+ {
+ base.OnEnable();
+ moveThreshold = serializedObject.FindProperty("moveThreshold");
+ joystickType = serializedObject.FindProperty("joystickType");
+ }
+
+ public override void OnInspectorGUI()
+ {
+ base.OnInspectorGUI();
+
+ if (background != null)
+ {
+ RectTransform backgroundRect = (RectTransform)background.objectReferenceValue;
+ backgroundRect.pivot = center;
+ }
+ }
+
+ protected override void DrawValues()
+ {
+ base.DrawValues();
+ EditorGUILayout.PropertyField(moveThreshold, new GUIContent("Move Threshold", "The distance away from the center input has to be before the joystick begins to move."));
+ EditorGUILayout.PropertyField(joystickType, new GUIContent("Joystick Type", "The type of joystick the variable joystick is current using."));
+ }
+} \ No newline at end of file
diff --git a/Assets/Thirdparty/Joystick Pack/Scripts/Editor/VariableJoystickEditor.cs.meta b/Assets/Thirdparty/Joystick Pack/Scripts/Editor/VariableJoystickEditor.cs.meta
new file mode 100644
index 0000000..881d524
--- /dev/null
+++ b/Assets/Thirdparty/Joystick Pack/Scripts/Editor/VariableJoystickEditor.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 58b5a2db95af76c4c9d4116a09ec3697
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant: