SpatialButtonNormalInspector.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEditor;
  5. namespace EZXR.Glass.UI
  6. {
  7. [CustomEditor(typeof(SpatialButton_Normal))]
  8. [CanEditMultipleObjects]
  9. public class SpatialButtonNormalInspector : SpatialButtonInspector
  10. {
  11. private SpatialButton_Normal _target_SpatialButtonNormal;
  12. SerializedProperty transition;
  13. //SerializedProperty normalTexture;
  14. SerializedProperty hoverTexture;
  15. SerializedProperty pressedTexture;
  16. SerializedProperty disabledTexture;
  17. //SerializedProperty normalColor;
  18. SerializedProperty hoverColor;
  19. SerializedProperty pressedColor;
  20. SerializedProperty disabledColor;
  21. //SerializedProperty positionType;
  22. //SerializedProperty size;
  23. //SerializedProperty text;
  24. //SerializedProperty pressed;
  25. ////SerializedProperty defaultMaterial;
  26. ////SerializedProperty sharedMaterial;
  27. //SerializedProperty color;
  28. //SerializedProperty texture;
  29. //SerializedProperty preTriggerZoneThickness;
  30. //SerializedProperty rearTriggerZoneThickness;
  31. //SerializedProperty states;
  32. //SerializedProperty clicked;
  33. //SerializedProperty sortingOrder;
  34. protected override void OnEnable()
  35. {
  36. base.OnEnable();
  37. _target_SpatialButtonNormal = target as SpatialButton_Normal;
  38. transition = serializedObject.FindProperty("transition");
  39. //normalTexture = serializedObject.FindProperty("normalTexture");
  40. hoverTexture = serializedObject.FindProperty("hoverTexture");
  41. pressedTexture = serializedObject.FindProperty("pressedTexture");
  42. disabledTexture = serializedObject.FindProperty("disabledTexture");
  43. //normalColor = serializedObject.FindProperty("normalColor");
  44. hoverColor = serializedObject.FindProperty("hoverColor");
  45. pressedColor = serializedObject.FindProperty("pressedColor");
  46. disabledColor = serializedObject.FindProperty("disabledColor");
  47. }
  48. public override void OnInspectorGUI()
  49. {
  50. base.OnInspectorGUI();
  51. serializedObject.Update();
  52. EditorGUILayout.PropertyField(transition);
  53. switch (_target_SpatialButtonNormal.transition)
  54. {
  55. case SpatialButton_Normal.Transition.TextureSwap:
  56. EditorGUILayout.BeginHorizontal();
  57. {
  58. EditorGUILayout.Space(10, false);
  59. EditorGUILayout.BeginVertical();
  60. {
  61. //EditorGUILayout.PropertyField(normalTexture);
  62. EditorGUILayout.PropertyField(hoverTexture);
  63. EditorGUILayout.PropertyField(pressedTexture);
  64. EditorGUILayout.PropertyField(disabledTexture);
  65. }
  66. EditorGUILayout.EndVertical();
  67. }
  68. EditorGUILayout.EndHorizontal();
  69. break;
  70. case SpatialButton_Normal.Transition.ColorTint:
  71. EditorGUILayout.BeginHorizontal();
  72. {
  73. EditorGUILayout.Space(10, false);
  74. EditorGUILayout.BeginVertical();
  75. {
  76. //EditorGUILayout.PropertyField(normalColor);
  77. EditorGUILayout.PropertyField(hoverColor);
  78. EditorGUILayout.PropertyField(pressedColor);
  79. EditorGUILayout.PropertyField(disabledColor);
  80. }
  81. EditorGUILayout.EndVertical();
  82. }
  83. EditorGUILayout.EndHorizontal();
  84. break;
  85. }
  86. serializedObject.ApplyModifiedProperties();
  87. SceneView.RepaintAll();
  88. }
  89. }
  90. }