void RenderCurUIHierarchy() { if (uiTree == null) { return; } Rect realRect = EditorGUILayout.BeginVertical(LayoutEditorGUIStyle.panelBox, GUILayout.Height(LayoutEditorGUI.panelLayoutTreeHeight)); if (realRect.height > LayoutEditorGUI.panelLayoutTreeHeight) { LayoutEditorGUI.panelLayoutTreeHeight = (int)realRect.height; } uiTree.Draw(realRect, this); EditorGUILayout.EndVertical(); }
void RenderLayoutList() { EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(true)); Rect treeRect = EditorGUILayout.BeginVertical(LayoutEditorGUIStyle.panelBox, GUILayout.ExpandHeight(true)); if (layoutTree != null) { layoutTree.Draw(treeRect, this); } EditorGUILayout.EndVertical(); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("导入")) { if (m_layout_mng.CurEditLayout == null) { EditorUtility.DisplayDialog("", "请先打开一个layout文件!", "确定"); return; } string layout = LayoutTool.OpenLayoutDialog(); if (!string.IsNullOrEmpty(layout)) { m_layout_mng.ImportLayout(layout); m_layout_mng.SetLayoutVisible(m_layout_mng.LayoutCount - 1, true); ResetLayoutTree(); RequestRepaint(); } } if (GUILayout.Button("移除")) { List <TreeNode> selList = layoutTree.GetSelectedNodes(); bool hasEdit = false; foreach (TreeNode node in selList) { if (node.ToggleList["编辑"]) { hasEdit = true; break; } } if (!hasEdit && EditorUtility.DisplayDialog("移除layout", "确认要移除选中的layout?", "确认", "取消")) { foreach (TreeNode node in selList) { layoutTree.RemoveRootNode(node); m_layout_mng.RemoveLayout((int)node.DataKey); } ResetLayoutTree(); RequestRepaint(); } } GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); }