FSkillDelayHurtEventInspector.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using UnityEngine;
  2. using UnityEditor;
  3. using Flux;
  4. namespace FluxEditor
  5. {
  6. [CustomEditor(typeof(FSkillDelayHurtEvent))]
  7. public class FSkillDelayHurtEventInspector : FEventInspector
  8. {
  9. private FSkillDelayHurtEvent _delayHurtEvent = null;
  10. private SerializedProperty _hitEffectId = null;
  11. private SerializedProperty _hitEffectPrefab = null;
  12. private SerializedProperty _hitEffectLink = null;
  13. private SerializedProperty _hurtDelayFrame = null;
  14. private SerializedProperty _delayHurtInterval = null;
  15. private SerializedProperty _delayHurtCount = null;
  16. private int hitEffectLinkIdx = -1;
  17. protected override void OnEnable()
  18. {
  19. base.OnEnable();
  20. _delayHurtEvent = (FSkillDelayHurtEvent)target;
  21. _hitEffectId = serializedObject.FindProperty("_hitEffectId");
  22. _hitEffectPrefab = serializedObject.FindProperty("_hitEffectPrefab");
  23. _hitEffectLink = serializedObject.FindProperty("_hitEffectLink");
  24. _hurtDelayFrame = serializedObject.FindProperty("_hurtDelayFrame");
  25. _delayHurtInterval = serializedObject.FindProperty("_delayHurtInterval");
  26. _delayHurtCount = serializedObject.FindProperty("_delayHurtCount");
  27. for (int idx = 0; idx < linkPoints.Length; idx++)
  28. {
  29. if (linkPoints[idx] == _hitEffectLink.stringValue)
  30. {
  31. hitEffectLinkIdx = idx;
  32. break;
  33. }
  34. }
  35. }
  36. public override void OnInspectorGUI()
  37. {
  38. base.OnInspectorGUI();
  39. serializedObject.Update();
  40. EditorGUILayout.BeginHorizontal();
  41. GUILayout.Label("特效ID:", EditorStyles.label, GUILayout.Width(140));
  42. _hitEffectId.intValue = EditorGUILayout.IntField(_hitEffectId.intValue, GUILayout.Width(300));
  43. EditorGUILayout.EndHorizontal();
  44. EditorGUILayout.BeginHorizontal();
  45. GUILayout.Label("特效预设:", EditorStyles.label, GUILayout.Width(140));
  46. _hitEffectPrefab.objectReferenceValue = EditorGUILayout.ObjectField(_hitEffectPrefab.objectReferenceValue, typeof(GameObject), false, GUILayout.Width(300));
  47. GUILayout.Label("挂载点:", EditorStyles.label, GUILayout.Width(140));
  48. hitEffectLinkIdx = EditorGUILayout.Popup(hitEffectLinkIdx, linkPoints, GUILayout.Width(300));
  49. if (hitEffectLinkIdx >= 0)
  50. _hitEffectLink.stringValue = linkPoints[hitEffectLinkIdx];
  51. EditorGUILayout.EndHorizontal();
  52. EditorGUILayout.BeginHorizontal();
  53. GUILayout.Label("延迟帧数:", EditorStyles.label, GUILayout.Width(140));
  54. _hurtDelayFrame.intValue = EditorGUILayout.IntField(_hurtDelayFrame.intValue, GUILayout.Width(300));
  55. EditorGUILayout.EndHorizontal();
  56. EditorGUILayout.BeginHorizontal();
  57. GUILayout.Label("伤害次数:", EditorStyles.label, GUILayout.Width(140));
  58. _delayHurtCount.intValue = EditorGUILayout.IntField(_delayHurtCount.intValue, GUILayout.Width(300));
  59. EditorGUILayout.EndHorizontal();
  60. EditorGUILayout.BeginHorizontal();
  61. GUILayout.Label("伤害间隔:", EditorStyles.label, GUILayout.Width(140));
  62. _delayHurtInterval.intValue = EditorGUILayout.IntField(_delayHurtInterval.intValue, GUILayout.Width(300));
  63. EditorGUILayout.EndHorizontal();
  64. serializedObject.ApplyModifiedProperties();
  65. }
  66. }
  67. }