FSkillHitEventInspector.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. using UnityEngine;
  2. using UnityEditor;
  3. using Flux;
  4. namespace FluxEditor
  5. {
  6. [CustomEditor(typeof(FSkillHitEvent))]
  7. public class FSkillHitEventInspector : FEventInspector
  8. {
  9. private FSkillHitEvent _skillHitEvent = null;
  10. private SerializedProperty _moveType = null;
  11. private SerializedProperty _initSpeed = null;
  12. private SerializedProperty _acceleration = null;
  13. private SerializedProperty _moveDistance = null;
  14. private SerializedProperty _triggerBuffId = null;
  15. private SerializedProperty _triggerBuffRate = null;
  16. private SerializedProperty _hitEffectId = null;
  17. private SerializedProperty _hitEffectPrefab = null;
  18. private SerializedProperty _hitEffectLink = null;
  19. int[] moveTypes = new int[] { 0, 1, 5 };
  20. string[] moveTypeStrs = new string[] { "无", "击退", "击飞" };
  21. private int effectLinkIdx = -1;
  22. protected override void OnEnable()
  23. {
  24. base.OnEnable();
  25. _skillHitEvent = (FSkillHitEvent)target;
  26. _moveType = serializedObject.FindProperty("_moveType");
  27. _initSpeed = serializedObject.FindProperty("_initSpeed");
  28. _acceleration = serializedObject.FindProperty("_acceleration");
  29. _moveDistance = serializedObject.FindProperty("_moveDistance");
  30. _triggerBuffId = serializedObject.FindProperty("_triggerBuffId");
  31. _triggerBuffRate = serializedObject.FindProperty("_triggerBuffRate");
  32. _hitEffectId = serializedObject.FindProperty("_hitEffectId");
  33. _hitEffectPrefab = serializedObject.FindProperty("_hitEffectPrefab");
  34. _hitEffectLink = serializedObject.FindProperty("_hitEffectLink");
  35. for (int idx = 0; idx < linkPoints.Length; idx++)
  36. {
  37. if (linkPoints[idx] == _hitEffectLink.stringValue)
  38. {
  39. effectLinkIdx = idx;
  40. break;
  41. }
  42. }
  43. }
  44. public override void OnInspectorGUI()
  45. {
  46. base.OnInspectorGUI();
  47. serializedObject.Update();
  48. EditorGUILayout.BeginHorizontal();
  49. GUILayout.Label("命中特效id:", EditorStyles.label, GUILayout.Width(140));
  50. _hitEffectId.intValue = EditorGUILayout.IntField(_hitEffectId.intValue, GUILayout.Width(300));
  51. EditorGUILayout.EndHorizontal();
  52. EditorGUILayout.BeginHorizontal();
  53. GUILayout.Label("命中特效预设:", EditorStyles.label, GUILayout.Width(140));
  54. _hitEffectPrefab.objectReferenceValue = EditorGUILayout.ObjectField(_hitEffectPrefab.objectReferenceValue, typeof(GameObject), false, GUILayout.Width(300));
  55. EditorGUILayout.EndHorizontal();
  56. EditorGUILayout.BeginHorizontal();
  57. GUILayout.Label("挂载点:", EditorStyles.label, GUILayout.Width(140));
  58. effectLinkIdx = EditorGUILayout.Popup(effectLinkIdx, linkPoints, GUILayout.Width(300));
  59. if (effectLinkIdx >= 0)
  60. _hitEffectLink.stringValue = linkPoints[effectLinkIdx];
  61. EditorGUILayout.EndHorizontal();
  62. EditorGUILayout.BeginHorizontal();
  63. GUILayout.Label("击中目标效果:", EditorStyles.label, GUILayout.Width(140));
  64. _moveType.intValue = EditorGUILayout.IntPopup(_moveType.intValue, moveTypeStrs, moveTypes);
  65. EditorGUILayout.EndHorizontal();
  66. if (_moveType.intValue == (int)FighterMoveType.Beat_Back)
  67. {
  68. EditorGUILayout.BeginHorizontal();
  69. GUILayout.Label("击退初速度:", EditorStyles.label, GUILayout.Width(140));
  70. _initSpeed.floatValue = EditorGUILayout.FloatField(_initSpeed.floatValue);
  71. EditorGUILayout.EndHorizontal();
  72. EditorGUILayout.BeginHorizontal();
  73. GUILayout.Label("击退加速度:", EditorStyles.label, GUILayout.Width(140));
  74. _acceleration.floatValue = EditorGUILayout.FloatField(_acceleration.floatValue);
  75. EditorGUILayout.EndHorizontal();
  76. EditorGUILayout.BeginHorizontal();
  77. GUILayout.Label("击退距离:", EditorStyles.label, GUILayout.Width(140));
  78. _moveDistance.floatValue = EditorGUILayout.FloatField(_moveDistance.floatValue);
  79. EditorGUILayout.EndHorizontal();
  80. }
  81. else if (_moveType.intValue == (int)FighterMoveType.Beat_Fly)
  82. {
  83. EditorGUILayout.BeginHorizontal();
  84. GUILayout.Label("挑飞初速度:", EditorStyles.label, GUILayout.Width(140));
  85. _initSpeed.floatValue = EditorGUILayout.FloatField(_initSpeed.floatValue);
  86. EditorGUILayout.EndHorizontal();
  87. EditorGUILayout.BeginHorizontal();
  88. GUILayout.Label("挑飞加速度:", EditorStyles.label, GUILayout.Width(140));
  89. _acceleration.floatValue = EditorGUILayout.FloatField(_acceleration.floatValue);
  90. EditorGUILayout.EndHorizontal();
  91. EditorGUILayout.BeginHorizontal();
  92. GUILayout.Label("挑飞高度:", EditorStyles.label, GUILayout.Width(140));
  93. _moveDistance.floatValue = EditorGUILayout.FloatField(_moveDistance.floatValue);
  94. EditorGUILayout.EndHorizontal();
  95. }
  96. EditorGUILayout.BeginHorizontal();
  97. GUILayout.Label("触发buffID:", EditorStyles.label, GUILayout.Width(140));
  98. _triggerBuffId.intValue = EditorGUILayout.IntField(_triggerBuffId.intValue);
  99. EditorGUILayout.EndHorizontal();
  100. EditorGUILayout.BeginHorizontal();
  101. GUILayout.Label("触发buff概率:", EditorStyles.label, GUILayout.Width(140));
  102. _triggerBuffRate.intValue = EditorGUILayout.IntField(_triggerBuffRate.intValue);
  103. EditorGUILayout.EndHorizontal();
  104. serializedObject.ApplyModifiedProperties();
  105. }
  106. }
  107. }