FCameraShakeEventInspector.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using UnityEngine;
  2. using UnityEditor;
  3. using Flux;
  4. namespace FluxEditor
  5. {
  6. [CustomEditor(typeof(FCameraShakeEvent))]
  7. public class FCameraShakeEventInspector : FEventInspector
  8. {
  9. private FCameraShakeEvent _camShakeEvent = null;
  10. private SerializedProperty _leftRightValue = null;
  11. private SerializedProperty _upDownValue = null;
  12. private SerializedProperty _forwardbackward = null;
  13. private SerializedProperty _shakeTime = null;
  14. private SerializedProperty _cycle = null;
  15. protected override void OnEnable()
  16. {
  17. base.OnEnable();
  18. _camShakeEvent = (FCameraShakeEvent)target;
  19. _leftRightValue = serializedObject.FindProperty("_leftRightValue");
  20. _upDownValue = serializedObject.FindProperty("_upDownValue");
  21. _forwardbackward = serializedObject.FindProperty("_forwardbackward");
  22. _shakeTime = serializedObject.FindProperty("_shakeTime");
  23. _cycle = serializedObject.FindProperty("_cycle");
  24. }
  25. public override void OnInspectorGUI()
  26. {
  27. base.OnInspectorGUI();
  28. serializedObject.Update();
  29. EditorGUILayout.BeginHorizontal();
  30. GUILayout.Label("左右震动强度:", EditorStyles.label, GUILayout.Width(140));
  31. _leftRightValue.floatValue = EditorGUILayout.FloatField(_leftRightValue.floatValue, GUILayout.Width(300));
  32. EditorGUILayout.EndHorizontal();
  33. EditorGUILayout.BeginHorizontal();
  34. GUILayout.Label("上下震动强度:", EditorStyles.label, GUILayout.Width(140));
  35. _upDownValue.floatValue = EditorGUILayout.FloatField(_upDownValue.floatValue, GUILayout.Width(300));
  36. EditorGUILayout.EndHorizontal();
  37. EditorGUILayout.BeginHorizontal();
  38. GUILayout.Label("前后震动强度:", EditorStyles.label, GUILayout.Width(140));
  39. _forwardbackward.floatValue = EditorGUILayout.FloatField(_forwardbackward.floatValue, GUILayout.Width(300));
  40. EditorGUILayout.EndHorizontal();
  41. EditorGUILayout.BeginHorizontal();
  42. GUILayout.Label("震动时间:", EditorStyles.label, GUILayout.Width(140));
  43. _shakeTime.floatValue = EditorGUILayout.FloatField(_shakeTime.floatValue, GUILayout.Width(300));
  44. EditorGUILayout.EndHorizontal();
  45. EditorGUILayout.BeginHorizontal();
  46. GUILayout.Label("震动次数:", EditorStyles.label, GUILayout.Width(140));
  47. _cycle.intValue = EditorGUILayout.IntField(_cycle.intValue, GUILayout.Width(300));
  48. EditorGUILayout.EndHorizontal();
  49. serializedObject.ApplyModifiedProperties();
  50. }
  51. }
  52. }