QuickPinchInspector.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEditor;
  4. using HedgehogTeam.EasyTouch;
  5. #if UNITY_5_3
  6. using UnityEditor.SceneManagement;
  7. #endif
  8. [CustomEditor(typeof(QuickPinch))]
  9. public class QuickPinchInspector : Editor {
  10. public override void OnInspectorGUI(){
  11. QuickPinch t = (QuickPinch)target;
  12. EditorGUILayout.Space();
  13. t.quickActionName = EditorGUILayout.TextField("Quick name",t.quickActionName);
  14. EditorGUILayout.Space();
  15. t.isGestureOnMe = EditorGUILayout.ToggleLeft("Gesture over me", t.isGestureOnMe);
  16. t.enablePickOverUI = EditorGUILayout.ToggleLeft("Allow over UI Element",t.enablePickOverUI);
  17. EditorGUILayout.Space();
  18. t.actionTriggering = (QuickPinch.ActionTiggering)EditorGUILayout.EnumPopup("Triggering",t.actionTriggering);
  19. t.pinchDirection = (QuickPinch.ActionPinchDirection)EditorGUILayout.EnumPopup("Pinch direction",t.pinchDirection);
  20. //t.rotationDirection = (QuickTwist.ActionRotationDirection)EditorGUILayout.EnumPopup("Twist direction",t.rotationDirection);
  21. EditorGUILayout.Space();
  22. if (t.actionTriggering == QuickPinch.ActionTiggering.InProgress){
  23. t.enableSimpleAction = EditorGUILayout.Toggle("Enable simple action",t.enableSimpleAction);
  24. if (t.enableSimpleAction){
  25. EditorGUI.indentLevel++;
  26. t.directAction = (QuickSwipe.DirectAction) EditorGUILayout.EnumPopup("Action",t.directAction);
  27. t.axesAction = (QuickSwipe.AffectedAxesAction)EditorGUILayout.EnumPopup("Affected axes",t.axesAction);
  28. t.sensibility = EditorGUILayout.FloatField("Sensibility",t.sensibility);
  29. t.inverseAxisValue = EditorGUILayout.Toggle("Inverse axis",t.inverseAxisValue);
  30. EditorGUI.indentLevel--;
  31. }
  32. }
  33. EditorGUILayout.Space();
  34. serializedObject.Update();
  35. SerializedProperty pinchAction = serializedObject.FindProperty("onPinchAction");
  36. EditorGUILayout.PropertyField(pinchAction, true, null);
  37. serializedObject.ApplyModifiedProperties();
  38. if (GUI.changed){
  39. EditorUtility.SetDirty(t);
  40. #if UNITY_5_3
  41. EditorSceneManager.MarkSceneDirty( EditorSceneManager.GetActiveScene());
  42. #endif
  43. }
  44. }
  45. }