public void SetUp(BaseGraph graph, BaseGraphWindow window, CommandDispatcher commandDispacter) { Model = graph; GraphWindow = window; CommandDispacter = commandDispacter; EditorCoroutine coroutine = GraphWindow.StartCoroutine(Initialize()); RegisterCallback <DetachFromPanelEvent>(evt => { GraphWindow.StopCoroutine(coroutine); }); }
/// <summary> 从Graph类型获取对应的GraphWindow </summary> public static BaseGraphWindow GetGraphWindow(Type graphType) { var windowType = GraphProcessorEditorUtility.GetGraphWindowType(graphType); UnityObject[] objs = Resources.FindObjectsOfTypeAll(windowType); BaseGraphWindow window = null; foreach (var obj in objs) { if (obj.GetType() == windowType) { window = obj as BaseGraphWindow; break; } } if (window == null) { window = GetWindow(windowType) as BaseGraphWindow; } window.Focus(); return(window); }