aboutsummaryrefslogtreecommitdiff
path: root/Assets/RTS_Camera/Scripts/Editor/RTS_CameraEditor.cs
diff options
context:
space:
mode:
authorAlee <Alee14498@gmail.com>2019-05-31 20:34:40 -0400
committerAlee <Alee14498@gmail.com>2019-05-31 20:34:40 -0400
commit1a218e49d6c23b0d1da5c30d81784ea9d8350016 (patch)
treec9470c471ea23e377fa69ad74fe4ef459ebc2a4a /Assets/RTS_Camera/Scripts/Editor/RTS_CameraEditor.cs
parent15c23e28f3bd5ac8015cb93df034a1196031d97b (diff)
downloadUnicity-1a218e49d6c23b0d1da5c30d81784ea9d8350016.tar.gz
Unicity-1a218e49d6c23b0d1da5c30d81784ea9d8350016.tar.bz2
Unicity-1a218e49d6c23b0d1da5c30d81784ea9d8350016.zip
UI changesexperimental-1
Diffstat (limited to 'Assets/RTS_Camera/Scripts/Editor/RTS_CameraEditor.cs')
-rw-r--r--Assets/RTS_Camera/Scripts/Editor/RTS_CameraEditor.cs158
1 files changed, 0 insertions, 158 deletions
diff --git a/Assets/RTS_Camera/Scripts/Editor/RTS_CameraEditor.cs b/Assets/RTS_Camera/Scripts/Editor/RTS_CameraEditor.cs
deleted file mode 100644
index d4a828f..0000000
--- a/Assets/RTS_Camera/Scripts/Editor/RTS_CameraEditor.cs
+++ /dev/null
@@ -1,158 +0,0 @@
-using UnityEngine;
-using System.Collections.Generic;
-using UnityEditor;
-
-namespace RTS_Cam
-{
- [CustomEditor(typeof(RTS_Camera))]
- public class RTS_CameraEditor : Editor
- {
- private RTS_Camera camera { get { return target as RTS_Camera; } }
-
- private TabsBlock tabs;
-
- private void OnEnable()
- {
- tabs = new TabsBlock(new Dictionary<string, System.Action>()
- {
- {"Movement", MovementTab},
- {"Rotation", RotationTab},
- {"Height", HeightTab}
- });
- tabs.SetCurrentMethod(camera.lastTab);
- }
-
- public override void OnInspectorGUI()
- {
- //base.OnInspectorGUI();
- Undo.RecordObject(camera, "RTS_CAmera");
- tabs.Draw();
- if (GUI.changed)
- camera.lastTab = tabs.curMethodIndex;
- EditorUtility.SetDirty(camera);
- }
-
- private void MovementTab()
- {
- using (new HorizontalBlock())
- {
- GUILayout.Label("Use keyboard input: ", EditorStyles.boldLabel, GUILayout.Width(170f));
- camera.useKeyboardInput = EditorGUILayout.Toggle( camera.useKeyboardInput);
- }
- if(camera.useKeyboardInput)
- {
- camera.horizontalAxis = EditorGUILayout.TextField("Horizontal axis name: ", camera.horizontalAxis);
- camera.verticalAxis = EditorGUILayout.TextField("Vertical axis name: ", camera.verticalAxis);
- camera.keyboardMovementSpeed = EditorGUILayout.FloatField("Movement speed: ", camera.keyboardMovementSpeed);
- }
-
- using (new HorizontalBlock())
- {
- GUILayout.Label("Screen edge input: ", EditorStyles.boldLabel, GUILayout.Width(170f));
- camera.useScreenEdgeInput = EditorGUILayout.Toggle( camera.useScreenEdgeInput);
- }
-
- if(camera.useScreenEdgeInput)
- {
- EditorGUILayout.FloatField("Screen edge border size: ", camera.screenEdgeBorder);
- camera.screenEdgeMovementSpeed = EditorGUILayout.FloatField("Screen edge movement speed: ", camera.screenEdgeMovementSpeed);
- }
-
- using (new HorizontalBlock())
- {
- GUILayout.Label("Panning with mouse: ", EditorStyles.boldLabel, GUILayout.Width(170f));
- camera.usePanning = EditorGUILayout.Toggle(camera.usePanning);
- }
- if(camera.usePanning)
- {
- camera.panningKey = (KeyCode)EditorGUILayout.EnumPopup("Panning when holding: ", camera.panningKey);
- camera.panningSpeed = EditorGUILayout.FloatField("Panning speed: ", camera.panningSpeed);
- }
-
- using (new HorizontalBlock())
- {
- GUILayout.Label("Limit movement: ", EditorStyles.boldLabel, GUILayout.Width(170f));
- camera.limitMap = EditorGUILayout.Toggle(camera.limitMap);
- }
- if (camera.limitMap)
- {
- camera.limitX = EditorGUILayout.FloatField("Limit X: ", camera.limitX);
- camera.limitY = EditorGUILayout.FloatField("Limit Y: ", camera.limitY);
- }
-
- GUILayout.Label("Follow target", EditorStyles.boldLabel);
- camera.targetFollow = EditorGUILayout.ObjectField("Target to follow: ", camera.targetFollow, typeof(Transform)) as Transform;
- camera.targetOffset = EditorGUILayout.Vector3Field("Target offset: ", camera.targetOffset);
- camera.followingSpeed = EditorGUILayout.FloatField("Following speed: ", camera.followingSpeed);
- }
-
- private void RotationTab()
- {
- using (new HorizontalBlock())
- {
- GUILayout.Label("Keyboard input: ", EditorStyles.boldLabel, GUILayout.Width(170f));
- camera.useKeyboardRotation = EditorGUILayout.Toggle(camera.useKeyboardRotation);
- }
- if(camera.useKeyboardRotation)
- {
- camera.rotateLeftKey = (KeyCode)EditorGUILayout.EnumPopup("Rotate left: ", camera.rotateLeftKey);
- camera.rotateRightKey = (KeyCode)EditorGUILayout.EnumPopup("Rotate right: ", camera.rotateRightKey);
- camera.rotationSped = EditorGUILayout.FloatField("Keyboard rotation speed", camera.rotationSped);
- }
-
- using (new HorizontalBlock())
- {
- GUILayout.Label("Mouse input: ", EditorStyles.boldLabel, GUILayout.Width(170f));
- camera.useMouseRotation = EditorGUILayout.Toggle(camera.useMouseRotation);
- }
- if(camera.useMouseRotation)
- {
- camera.mouseRotationKey = (KeyCode)EditorGUILayout.EnumPopup("Mouse rotation key: ", camera.mouseRotationKey);
- camera.mouseRotationSpeed = EditorGUILayout.FloatField("Mouse rotation speed: ", camera.mouseRotationSpeed);
- }
- }
-
- private void HeightTab()
- {
- using (new HorizontalBlock())
- {
- GUILayout.Label("Auto height: ", EditorStyles.boldLabel, GUILayout.Width(170f));
- camera.autoHeight = EditorGUILayout.Toggle(camera.autoHeight);
- }
- if (camera.autoHeight)
- {
- camera.heightDampening = EditorGUILayout.FloatField("Height dampening: ", camera.heightDampening);
- EditorGUILayout.PropertyField(serializedObject.FindProperty("groundMask"));
- }
-
- using (new HorizontalBlock())
- {
- GUILayout.Label("Keyboard zooming: ", EditorStyles.boldLabel, GUILayout.Width(170f));
- camera.useKeyboardZooming = EditorGUILayout.Toggle(camera.useKeyboardZooming);
- }
- if(camera.useKeyboardZooming)
- {
- camera.zoomInKey = (KeyCode)EditorGUILayout.EnumPopup("Zoom In: ", camera.zoomInKey);
- camera.zoomOutKey = (KeyCode)EditorGUILayout.EnumPopup("Zoom Out: ", camera.zoomOutKey);
- camera.keyboardZoomingSensitivity = EditorGUILayout.FloatField("Keyboard sensitivity: ", camera.keyboardZoomingSensitivity);
- }
-
- using (new HorizontalBlock())
- {
- GUILayout.Label("Scrollwheel zooming: ", EditorStyles.boldLabel, GUILayout.Width(170f));
- camera.useScrollwheelZooming = EditorGUILayout.Toggle(camera.useScrollwheelZooming);
- }
- if (camera.useScrollwheelZooming)
- camera.scrollWheelZoomingSensitivity = EditorGUILayout.FloatField("Scrollwheel sensitivity: ", camera.scrollWheelZoomingSensitivity);
-
- if (camera.useScrollwheelZooming || camera.useKeyboardZooming)
- {
- using (new HorizontalBlock())
- {
- camera.maxHeight = EditorGUILayout.FloatField("Max height: ", camera.maxHeight);
- camera.minHeight = EditorGUILayout.FloatField("Min height: ", camera.minHeight);
- }
- }
- }
- }
-} \ No newline at end of file