FCloneEventInspector.cs 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using UnityEngine;
  2. using UnityEditor;
  3. using Flux;
  4. namespace FluxEditor
  5. {
  6. [CustomEditor(typeof(FCloneEvent))]
  7. public class FCloneEventInspector : FEventInspector
  8. {
  9. private FCloneEvent _cloneEvent = null;
  10. private SerializedProperty _npcId = null;
  11. private SerializedProperty _npcPos = null;
  12. private SerializedProperty _bornEffectId = null;
  13. private SerializedProperty _bornEffectPrefab = null;
  14. private SerializedProperty _bornPos = null;
  15. private SerializedProperty _bornRot = null;
  16. string[] posStrs = new string[] { "0", "1", "2", "3", "4", "5", "6" };
  17. protected override void OnEnable()
  18. {
  19. base.OnEnable();
  20. _cloneEvent = (FCloneEvent)target;
  21. _npcId = serializedObject.FindProperty("_npcId");
  22. _npcPos = serializedObject.FindProperty("_npcPos");
  23. _bornEffectId = serializedObject.FindProperty("_bornEffectId");
  24. _bornEffectPrefab = serializedObject.FindProperty("_bornEffectPrefab");
  25. _bornPos = serializedObject.FindProperty("_bornPos");
  26. _bornRot = serializedObject.FindProperty("_bornRot");
  27. }
  28. public override void OnInspectorGUI()
  29. {
  30. base.OnInspectorGUI();
  31. serializedObject.Update();
  32. EditorGUILayout.BeginHorizontal();
  33. GUILayout.Label("NPC ID:", EditorStyles.label, GUILayout.Width(140));
  34. _npcId.intValue = EditorGUILayout.IntField(_npcId.intValue, GUILayout.Width(300));
  35. EditorGUILayout.EndHorizontal();
  36. EditorGUILayout.BeginHorizontal();
  37. GUILayout.Label("怪物的站位:", EditorStyles.label, GUILayout.Width(140));
  38. _npcPos.intValue = EditorGUILayout.Popup(_npcPos.intValue, posStrs, GUILayout.Width(300));
  39. EditorGUILayout.EndHorizontal();
  40. EditorGUILayout.BeginHorizontal();
  41. GUILayout.Label("出生特效ID:", EditorStyles.label, GUILayout.Width(140));
  42. _bornEffectId.intValue = EditorGUILayout.IntField(_bornEffectId.intValue, GUILayout.Width(300));
  43. EditorGUILayout.EndHorizontal();
  44. EditorGUILayout.BeginHorizontal();
  45. GUILayout.Label("出生特效:", EditorStyles.label, GUILayout.Width(140));
  46. _bornEffectPrefab.objectReferenceValue = EditorGUILayout.ObjectField(_bornEffectPrefab.objectReferenceValue, typeof(GameObject), false, GUILayout.Width(300));
  47. EditorGUILayout.EndHorizontal();
  48. EditorGUILayout.BeginHorizontal();
  49. GUILayout.Label("出生位置:", EditorStyles.label, GUILayout.Width(140));
  50. _bornPos.vector3Value = EditorGUILayout.Vector3Field("",_bornPos.vector3Value, GUILayout.Width(300));
  51. EditorGUILayout.EndHorizontal();
  52. EditorGUILayout.BeginHorizontal();
  53. GUILayout.Label("出生时旋转值:", EditorStyles.label, GUILayout.Width(140));
  54. _bornRot.vector3Value = EditorGUILayout.Vector3Field("", _bornRot.vector3Value, GUILayout.Width(300));
  55. EditorGUILayout.EndHorizontal();
  56. serializedObject.ApplyModifiedProperties();
  57. }
  58. }
  59. }