protected virtual void Clear() { if (m_WindowTree != null) { m_WindowTree.Destroy(); m_WindowTree = null; } if (m_ToolbarTree != null) { m_ToolbarTree.Destroy(); m_ToolbarTree = null; } if (m_MsgBox != null) { m_MsgBox.Destroy(); m_MsgBox = null; } }
protected virtual void Init() { LoadHandle(); if (m_WindowTree == null) { if (Handle != null) { m_WindowTree = new SubWindowTree(Repaint, GetType().Name, Handle.GetType().Name); } else { m_WindowTree = new SubWindowTree(Repaint, GetType().Name, null); } } if (m_ToolbarTree == null) { m_ToolbarTree = new ToolBarTree(); } if (m_MsgBox == null) { m_MsgBox = new EditorWindowMsgBox(); } Type[] handleTypes = null; System.Object[] handles = null; if (Handle != null) { handleTypes = new Type[] { Handle.GetType(), GetType() }; handles = new object[] { Handle, this }; } else { handleTypes = new Type[] { GetType() }; handles = new object[] { this }; } EditorWindowComponentsInitializer.InitComponents(this, handleTypes, handles, m_WindowTree, m_ToolbarTree, m_MsgBox); }
private void SubWinInit() { tmpLayoutPath = EditorEnv.frameworkPath.CombinePath("AssetBundle/Editor/Layout.xml"); if (File.Exists(tmpLayoutPath)) { tmpLayout = File.ReadAllText(tmpLayoutPath); } WinTree = new SubWinTree(); WinTree.repaintEve += Repaint; WinTree.drawCursorEve += (rect, sp) => { if (sp == SplitType.Vertical) { EditorGUIUtility.AddCursorRect(rect, MouseCursor.ResizeHorizontal); } else { EditorGUIUtility.AddCursorRect(rect, MouseCursor.ResizeVertical); } }; if (!string.IsNullOrEmpty(tmpLayout)) { WinTree.DeSerialize(tmpLayout); } else { for (int i = 1; i <= 3; i++) { string userdata = i == 1 ? ToolWin : i == 2 ? DirCollectWin : ABBuildInfoWin; SubWinTree.TreeLeaf L = WinTree.CreateLeaf(new GUIContent(userdata)); L.userData = userdata; WinTree.DockLeaf(L, SubWinTree.DockType.Left); } } WinTree[ToolWin].titleContent = new GUIContent(ToolWin); WinTree[DirCollectWin].titleContent = new GUIContent(DirCollectWin); WinTree[ABBuildInfoWin].titleContent = new GUIContent(ABBuildInfoWin); WinTree[ToolWin].minSize = new Vector2(200, 250); WinTree[DirCollectWin].minSize = new Vector2(350, 250); //WinTree[ABBuildInfoWin].minSize = new Vector2(600, 500); WinTree[ToolWin].paintDelegate += toolWindow.OnGUI; WinTree[DirCollectWin].paintDelegate += dirCollectWindow.OnGUI; WinTree[ABBuildInfoWin].paintDelegate += abBulidWindow.OnGUI; ToolBarTree = new ToolBarTree(); ToolBarTree.DropDownButton(new GUIContent("Views"), (rect) => { GenericMenu menu = new GenericMenu(); for (int i = 0; i < WinTree.allLeafCount; i++) { SubWinTree.TreeLeaf leaf = WinTree.allLeafs[i]; menu.AddItem(leaf.titleContent, !WinTree.closedLeafs.Contains(leaf), () => { if (WinTree.closedLeafs.Contains(leaf)) { WinTree.DockLeaf(leaf, SubWinTree.DockType.Left); } else { WinTree.CloseLeaf(leaf); } }); } menu.DropDown(rect); Event.current.Use(); }, 60) .Toggle(new GUIContent("Title"), (bo) => { WinTree.isShowTitle = bo; }, WinTree.isShowTitle, 60) .Toggle(new GUIContent("Lock"), (bo) => { WinTree.isLocked = bo; }, WinTree.isLocked, 60) .Button(new GUIContent("Fresh"), (rect) => { ReFreashValue(); }) //.Button(new GUIContent(), (rect) => //{ // File.WriteAllText(tmpLayout_ABBuildInfoPath, abBulidWindow.abBuildInfoTree.Serialize()); //}) ; }