Пример #1
0
            public AssetBundleBulidWindow(AssetBundleWindow window, string layout) : base(window)
            {
                ABBListViewCalc             = new ListViewCalculator();
                abBuildInfoTree             = new SubWinTree();
                abBuildInfoTree.repaintEve += window.Repaint;
                if (!string.IsNullOrEmpty(layout))
                {
                    abBuildInfoTree.DeSerialize(layout);
                }
                else
                {
                    for (int i = 0; i <= 3; i++)
                    {
                        string userdata       = i == 1 ? ABBContentItemWin : i == 2 ? ABBItemWin : i == 3 ? ABBContentWin : ABBWin;
                        SubWinTree.TreeLeaf L = abBuildInfoTree.CreateLeaf(new GUIContent(userdata));
                        L.userData = userdata;
                        abBuildInfoTree.DockLeaf(L, (SubWinTree.DockType)i);
                    }
                }
                abBuildInfoTree.isShowTitle    = false;
                abBuildInfoTree.drawCursorEve += (rect, sp) =>
                {
                    if (sp == SplitType.Vertical)
                    {
                        EditorGUIUtility.AddCursorRect(rect, MouseCursor.ResizeHorizontal);
                    }
                    else
                    {
                        EditorGUIUtility.AddCursorRect(rect, MouseCursor.ResizeVertical);
                    }
                };

                abBuildInfoTree[ABBWin].titleContent   = new GUIContent(ABBWin);
                abBuildInfoTree[ABBWin].minSize        = new Vector2(200, 300);
                abBuildInfoTree[ABBWin].paintDelegate += ABBWinGUI;

                abBuildInfoTree[ABBItemWin].titleContent   = new GUIContent(ABBItemWin);
                abBuildInfoTree[ABBItemWin].minSize        = new Vector2(200, 150);
                abBuildInfoTree[ABBItemWin].paintDelegate += ABBItemWinGUI;

                abBuildInfoTree[ABBContentWin].titleContent   = new GUIContent(ABBContentWin);
                abBuildInfoTree[ABBContentWin].minSize        = new Vector2(400, 300);
                abBuildInfoTree[ABBContentWin].paintDelegate += ABBContentWinGUI;

                abBuildInfoTree[ABBContentItemWin].titleContent   = new GUIContent(ABBContentItemWin);
                abBuildInfoTree[ABBContentItemWin].minSize        = new Vector2(400, 150);
                abBuildInfoTree[ABBContentItemWin].paintDelegate += ABBContentItemWinGUI;
            }
Пример #2
0
        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());
            //})
            ;
        }