#if UNITY_EDITOR using UnityEditor; using UnityEngine; namespace TyphoonEvent { public class EventKitMonitorWindow : EditorWindow { [MenuItem("Typhoon/EventKit/监视窗口")] public static void Open() { var win = GetWindow(); win.minSize = new Vector2(800, 600); win.titleContent = new GUIContent("EventKit 监视窗口"); win.Show(); } private EventKitImpl Target { get { if (EventKit.HasInstance()) { return EventKit.Impl; } return null; } } private EventKitImplEditor _implEditor; private EventKitImplEditor ImplEditor { get { if (Target == null) { return null; } if (_implEditor != null && _implEditor.target != Target) { DestroyImmediate(_implEditor); } if (_implEditor == null) { _implEditor = (EventKitImplEditor)Editor.CreateEditor(Target, typeof(EventKitImplEditor)); } return _implEditor; } } private void OnGUI() { var widowRect = new Rect(Vector2.zero, position.size); var center = widowRect.center; widowRect.width -= 8; widowRect.height -= 8; widowRect.center = center; GUILayout.BeginArea(widowRect); if (!EventKit.HasInstance()) { GUILayout.Label("Event Kit 未构建"); } else { var optionBarHeight = EventKitImplEditor.OPTION_BAR_HEIGHT; var tableHeaderHeight = EventKitImplEditor.TABLE_HEADER_HEIGHT; var contentHeight = widowRect.height - tableHeaderHeight - optionBarHeight; ImplEditor.DrawGUI(optionBarHeight, tableHeaderHeight, contentHeight); } GUILayout.EndArea(); Repaint(); } } } #endif