FSummonEventInspector.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using UnityEngine;
  2. using UnityEditor;
  3. using Flux;
  4. namespace FluxEditor
  5. {
  6. [CustomEditor(typeof(FSummonEvent))]
  7. public class FSummonEventInspector : FEventInspector
  8. {
  9. private FSummonEvent _summonEvent = null;
  10. private SerializedProperty _npcId = null;
  11. private SerializedProperty _npcPos = null;
  12. string[] posStrs = new string[] { "0", "1", "2", "3", "4", "5", "6" };
  13. protected override void OnEnable()
  14. {
  15. base.OnEnable();
  16. _summonEvent = (FSummonEvent)target;
  17. _npcId = serializedObject.FindProperty("_npcId");
  18. _npcPos = serializedObject.FindProperty("_npcPos");
  19. }
  20. public override void OnInspectorGUI()
  21. {
  22. base.OnInspectorGUI();
  23. serializedObject.Update();
  24. EditorGUILayout.BeginHorizontal();
  25. GUILayout.Label("召唤的怪物ID:", EditorStyles.label, GUILayout.Width(140));
  26. _npcId.intValue = EditorGUILayout.IntField(_npcId.intValue, GUILayout.Width(300));
  27. EditorGUILayout.EndHorizontal();
  28. EditorGUILayout.BeginHorizontal();
  29. GUILayout.Label("怪物的站位:", EditorStyles.label, GUILayout.Width(140));
  30. _npcPos.intValue = EditorGUILayout.Popup(_npcPos.intValue, posStrs, GUILayout.Width(300));
  31. EditorGUILayout.EndHorizontal();
  32. serializedObject.ApplyModifiedProperties();
  33. }
  34. }
  35. }