static void _BuildReferencedTreeView(TreeViewCtrl referencedTreeView, TreeViewNode parent, List <U3DAssetInfo> assets)
    {
        if (assets.Count == 0)
        {
            return;
        }

        foreach (var a in assets)
        {
            TreeViewNode newNode = referencedTreeView.CreateNode(Path.GetFileName(a.path));
            newNode.image          = a.icon;
            newNode.tooptip        = a.path;
            newNode.state.IsExpand = false;
            if (parent == null)
            {
                referencedTreeView.Roots.Add(newNode);
            }
            else
            {
                parent.Add(newNode);
            }

            List <U3DAssetInfo> nextLevelAssets = new List <U3DAssetInfo>();
            ResourceManageToolModel.GetInstance().GetAssetReferenced(a.guid, out nextLevelAssets);
            _BuildReferencedTreeView(referencedTreeView, newNode, nextLevelAssets);
        }
    }
Пример #2
0
    private void CustomDragStart(EditorControl c)
    {
        TreeViewCtrl tree = c as TreeViewCtrl;

        if (null == tree)
        {
            return;
        }

        if ((Event.current.type != EventType.MouseDown) &&
            (Event.current.type != EventType.MouseDrag))
        {
            return;
        }

        if (m_IsCusDragPrepare)
        {
            DragAndDrop.StartDrag(tree.DragStartType);
            DragAndDrop.visualMode = DragAndDropVisualMode.Rejected;

            m_DragBegionCtrl = tree;

            m_IsCusDragStart = true;

            m_IsCusDragPrepare = false;
        }
    }
    static void _BuildResourceRefTreeView(TreeViewCtrl resRefTreeView, TreeViewNode parent, List <U3DAssetInfo> deps)
    {
        if (deps.Count == 0)
        {
            return;
        }



        foreach (var asset in deps)
        {
            TreeViewNode newNode = resRefTreeView.CreateNode(Path.GetFileName(asset.path));
            newNode.image          = asset.icon;
            newNode.tooptip        = asset.path;
            newNode.state.IsExpand = false;
            if (parent == null)
            {
                resRefTreeView.Roots.Add(newNode);
            }
            else
            {
                parent.Add(newNode);
            }

            //只构建第一层直接引用
            //List<U3DAssetInfo> nextLevelDeps = new List<U3DAssetInfo>();
            //ResourceManageToolModel.GetInstance().GetAssetDependencies(asset.guid, out nextLevelDeps);
            //_BuildResourceRefTreeView(resRefTreeView, newNode, nextLevelDeps);
        }
    }
    /*
     * 资源反向引用树视图
     */
    static void ClearReferencedTreeView()
    {
        TreeViewCtrl referencedTreeView = s_root.FindControl("_ResReverseRefTreeView") as TreeViewCtrl;

        if (referencedTreeView == null)
        {
            return;
        }
        referencedTreeView.Clear();
    }
    public static void InitControls(EditorRoot editorRoot)
    {
        s_root = editorRoot;

        //s_root.position = new Rect(100f, 100f, 1024, 768f);

        {
            s_root.onDestroy = OnDestroy;
            s_root.onEnable  = OnEnable;
        }

        HSpliterCtrl hspliter = new HSpliterCtrl();

        hspliter.layoutConstraint = LayoutConstraint.GetSpliterConstraint(30f, true);

        s_root.RootCtrl = hspliter;

        //上方树状视图
        VBoxCtrl vb0 = new VBoxCtrl();

        hspliter.Add(vb0);

        //下方工具条
        HBoxCtrl hb0 = new HBoxCtrl();

        hspliter.Add(hb0);


        TreeViewCtrl treeView = new TreeViewCtrl();

        treeView.Name          = "_MainTreeView";
        treeView.onValueChange = OnTreeViewNodeToggle;
        vb0.Add(treeView);

        Rect       btnRect = new Rect(0, 0, 60, 20);
        ButtonCtrl okBtn   = new ButtonCtrl();

        okBtn.Caption = "确定";
        okBtn.Name    = "_OkButton";
        okBtn.Size    = btnRect;
        okBtn.onClick = OnOkButtonClick;

        ButtonCtrl cancelBtn = new ButtonCtrl();

        cancelBtn.Caption = "取消";
        cancelBtn.Name    = "_CancelButton";
        cancelBtn.Size    = btnRect;
        cancelBtn.onClick = OnCancelButtonClick;


        hb0.Add(okBtn);
        hb0.Add(cancelBtn);
    }
Пример #6
0
    //Modify by lteng for 追加共通控件 At 2015/2/26
    static void OnTreeViewNodeToggle(EditorControl c, object value)
    {
        TreeViewCtrl treeView = s_root.FindControl("_MainTreeView") as TreeViewCtrl;

        if (treeView == null)
        {
            return;
        }

        RecalcTreeNodes();
        RequestRepaint();
    }
    static void RebuildResourcesTreeView()
    {
        TreeViewCtrl resTreeList = s_root.FindControl("_ResTreeList") as TreeViewCtrl;

        resTreeList.Clear();

        foreach (var assetInfo in ResourceManageToolModel.GetInstance().AssetList)
        {
            AddAssetToResourceTreeView(assetInfo);
        }
        GC.Collect();
        RequestRepaint();
    }
Пример #8
0
    static void RecalcTreeNodes()
    {
        TreeViewCtrl treeView = s_root.FindControl("_MainTreeView") as TreeViewCtrl;

        if (treeView == null)
        {
            return;
        }

        foreach (var root in treeView.Roots)
        {
            TreeViewCtrl.PreorderTraverse(root, RecalcTreeNodeVisitCallback);
        }
    }
    static void RebuildReferencedTreeView(Guid resID)
    {
        TreeViewCtrl referencedTreeView = s_root.FindControl("_ResReverseRefTreeView") as TreeViewCtrl;

        if (referencedTreeView == null)
        {
            return;
        }
        referencedTreeView.Clear();

        List <U3DAssetInfo> referencedAssets = new List <U3DAssetInfo>();

        ResourceManageToolModel.GetInstance().GetAssetReferenced(resID, out referencedAssets);
        _BuildReferencedTreeView(referencedTreeView, null, referencedAssets);
    }
    static void RebuildResourceRefTreeView(Guid resID)
    {
        TreeViewCtrl resRefTreeView = s_root.FindControl("_ResRefTreeView") as TreeViewCtrl;

        if (resRefTreeView == null)
        {
            return;
        }
        resRefTreeView.Clear();

        List <U3DAssetInfo> depAssets = new List <U3DAssetInfo>();

        ResourceManageToolModel.GetInstance().GetAssetDependencies(resID, out depAssets);
        _BuildResourceRefTreeView(resRefTreeView, null, depAssets);
    }
    /*
     *  资源树相关函数
     */

    static void OnResourcesTreeViewSelectChanged(EditorControl c, int i)
    {
        TreeViewCtrl resTreeList = c as TreeViewCtrl;

        if (resTreeList == null)
        {
            return;
        }

        if (resTreeList.currSelectNode != null)
        {
            RebuildResourceRefTreeView((Guid)resTreeList.currSelectNode.userObject);
            RebuildReferencedTreeView((Guid)resTreeList.currSelectNode.userObject);
            RequestRepaint();
        }
    }
Пример #12
0
    static void CollectAllPaths()
    {
        TreeViewCtrl treeView = s_root.FindControl("_MainTreeView") as TreeViewCtrl;

        if (treeView == null)
        {
            return;
        }

        ResourceManageConfig.GetInstance().Paths.Clear();

        foreach (var root in treeView.Roots)
        {
            TreeViewCtrl.PreorderTraverse(root, CollectAllPathsTreeNodeVisitCallback);
        }
    }
Пример #13
0
    static void CollectAllPaths()
    {
        //Modify by liteng for 发布工具改善
        PackageExportToolModel.GetInstance().GetPackageInfo().ExportAssets.Clear();

        TreeViewCtrl treeView = s_root.FindControl("_MainTreeView") as TreeViewCtrl;

        if (treeView == null)
        {
            return;
        }

        foreach (var root in treeView.Roots)
        {
            TreeViewCtrl.PreorderTraverse(root, CollectAllPathsTreeNodeVisitCallback);
        }
    }
Пример #14
0
    static void UpdateTreeView()
    {
        TreeViewCtrl treeView = s_root.FindControl("_MainTreeView") as TreeViewCtrl;

        if (treeView == null)
        {
            return;
        }

        treeView.Clear();

        string[] allAssetPaths = ResourceManageToolUtility.GetAllAssetPaths();

        foreach (var path in allAssetPaths)
        {
            if (ResourceManageToolUtility.PathIsFolder(path))
            {
                AddAssetToResourceTreeView(path);
            }
        }
    }
Пример #15
0
    public override void Visit(EditorControl c)
    {
        currCtrl = c as TreeViewCtrl;

        if (
            (null == currCtrl)
            )
        {
            return;
        }


        PreDrawTree();

        foreach (var root in currCtrl.Roots)
        {
            TreeViewCtrl.PreorderTraverse(root, DrawTreeNode);
        }

        AfterDrawTree();
    }
Пример #16
0
    private void CustomDragPrepare(EditorControl c)
    {
        object       dragObject = null;
        TreeViewCtrl tree       = c as TreeViewCtrl;

        if (null == tree)
        {
            return;
        }

        if (tree.onPrepareCustomDrag != null)
        {
            dragObject = tree.onPrepareCustomDrag(tree);

            if (dragObject != null)
            {
                DragAndDrop.PrepareStartDrag();
                DragAndDrop.objectReferences = new Object[] { null };   // 必须在这里初始化objectReferences,否则会遇到Unity drag & drop的bug
                DragAndDrop.SetGenericData(tree.DragStartType, dragObject);
                m_IsCusDragPrepare = true;
            }
        }
    }
        /// <summary>
        /// 지정된 정보와 매핑된 TreeNode를 찾습니다.
        /// </summary>
        public virtual RadTreeNode FindNodeByItem(T item)
        {
            if (IsDebugEnabled)
            {
                log.Debug(@"지정된 요소와 매핑된 TreeNode를 찾습니다. item=[{0}]", item);
            }

            var node = TreeViewCtrl.FindNodeByValue(CreateNodeValue(item), true);

            if (IsDebugEnabled)
            {
                if (node != null)
                {
                    log.Debug(@"검색된 TreeNode Text=[{0}], Value=[{1}]", node.Text, node.Value);
                }
                else
                {
                    log.Debug(@"일치하는 노드를 찾지 못했습니다. null을 반환합니다.");
                }
            }

            return(node);
        }
    static void AddAssetToResourceTreeView(U3DAssetInfo assetInfo)
    {
        TreeViewCtrl resTreeList = s_root.FindControl("_ResTreeList") as TreeViewCtrl;

        if (resTreeList == null)
        {
            return;
        }

        bool expandTreeNode = false;

        if ((ResourceManageToolModel.GetInstance().CurrFilter as NullTypeFilter) == null)
        {//非过滤器为全部文件则节点都展开
            expandTreeNode = true;
        }

        string assetPath = assetInfo.path;
        string currPath  = assetPath;
        List <TreeViewNode> currLevelNodeList = resTreeList.Roots;
        TreeViewNode        parentNode        = null;
        int len = 0;

        while (currPath != "")
        {
            int i = currPath.IndexOf('/');
            if (i < 0)
            {
                i = currPath.Length;
            }
            len += i + 1;
            string pathNodeName     = currPath.Substring(0, i);
            string currNodeFullPath = assetPath.Substring(0, len - 1);
            if (i + 1 < currPath.Length)
            {
                currPath = currPath.Substring(i + 1);
            }
            else
            {
                currPath = "";
            }


            bool findNode = false;
            foreach (var treeNode in currLevelNodeList)
            {
                if (treeNode.name == pathNodeName)
                {
                    findNode          = true;
                    parentNode        = treeNode;
                    currLevelNodeList = treeNode.children;
                    break;
                }
            }

            if (!findNode)
            {
                U3DAssetInfo info    = null;
                TreeViewNode newNode = new TreeViewNode();
                newNode.name = pathNodeName;
                ResourceManageToolModel.GetInstance().Find(currNodeFullPath, out info);
                newNode.image          = info.icon;
                newNode.userObject     = info.guid;
                newNode.state.IsExpand = expandTreeNode;

                if (parentNode == null)
                {//说明需要作为根节点插入树视图中
                    currLevelNodeList.Add(newNode);
                }
                else
                {
                    parentNode.Add(newNode);
                }

                parentNode        = newNode;
                currLevelNodeList = newNode.children;
            }
        }
    }
    //这个方法就是利用EditorManager回调回来的一个EditorRoot实例;
    //构建了一个树形结构;
    public static void InitControls(EditorRoot editorRoot)
    {
        //将之前实例化的那个EditorWindow赋值给s_root
        s_root = editorRoot;

        //s_root.position = new Rect(100f, 100f, 1024, 768f);

        {//对编辑器全局消息响应;
            EditorApplication.projectWindowItemOnGUI += OnProjectWindowItem;
            EditorApplication.projectWindowChanged   += OnProjectWindowChanged;
        }

        {//协程回调
            s_root.onCoroutineMessage      = OnCoroutineMessage;
            s_root.onCoroutineTaskFinished = OnCoroutineTaskFinished;
            s_root.onDestroy = OnDestroy;
            s_root.onEnable  = OnEnable;
        }

        {//注册数据库变化回调
            ResourceManageToolModel.GetInstance().onResourceDBUpdate      = OnAssetDatabaseUpdate;
            ResourceManageToolModel.GetInstance().onResrouceDBStateChange = OnAssetDatabaseStateChange;
        }

        HSpliterCtrl hspliter = new HSpliterCtrl();

        s_root.RootCtrl           = hspliter;
        hspliter.layoutConstraint = LayoutConstraint.GetSpliterConstraint(30f);

        //用来放置上方菜单
        HBoxCtrl     hb0      = new HBoxCtrl();
        VSpliterCtrl vspliter = new VSpliterCtrl();

        vspliter.layoutConstraint = LayoutConstraint.GetSpliterConstraint(300f);
        vspliter.Dragable         = true;

        hspliter.Add(hb0);
        hspliter.Add(vspliter);

        //用来存放 资源列表、无引用资源列表
        VBoxCtrl vb0 = new VBoxCtrl();
        //用来存放 资源依赖项、反向引用
        VBoxCtrl vb1 = new VBoxCtrl();

        vspliter.Add(vb0);
        vspliter.Add(vb1);

        //左侧TabView
        TabViewCtrl leftTabView = new TabViewCtrl();
        //右侧TabView
        TabViewCtrl rightTabView = new TabViewCtrl();

        vb0.Add(leftTabView);
        vb1.Add(rightTabView);

        //资源列表
        TreeViewCtrl resTreeList = new TreeViewCtrl();

        resTreeList.Caption        = "资源列表";
        resTreeList.Name           = "_ResTreeList";
        resTreeList.onItemSelected = OnResourcesTreeViewSelectChanged;

        //无引用资源列表
        ListViewCtrl unUsedList = new ListViewCtrl();

        unUsedList.Caption        = "无引用资源";
        unUsedList.Name           = "_UnUsedResList";
        unUsedList.onItemSelected = OnUnUsedResourcesListViewSelectChanged;

        leftTabView.Add(resTreeList);
        leftTabView.Add(unUsedList);

        //资源依赖项
        TreeViewCtrl resRefTreeView = new TreeViewCtrl();

        resRefTreeView.Caption = "资源依赖项";
        resRefTreeView.Name    = "_ResRefTreeView";


        //反向引用
        TreeViewCtrl resReverseRefTreeView = new TreeViewCtrl();

        resReverseRefTreeView.Caption = "反向引用";
        resReverseRefTreeView.Name    = "_ResReverseRefTreeView";

        rightTabView.Add(resRefTreeView);
        rightTabView.Add(resReverseRefTreeView);


        Rect       btnRect   = new Rect(0, 0, 120, 20);
        ButtonCtrl searchBtn = new ButtonCtrl();

        searchBtn.Name     = "_SearchAllResources";
        searchBtn.Caption  = "扫描资源!";
        searchBtn.Size     = btnRect;
        searchBtn.onClick += OnSearchAllAssets;
        searchBtn.BtnColor = Color.green;
        searchBtn.Visiable = true;

        Rect comboBoxRect = new Rect(0, 0, 100, 20);
        ComboBoxCtrl <int> assetTypeCombo = new ComboBoxCtrl <int>(0);

        assetTypeCombo.Size          = comboBoxRect;
        assetTypeCombo.Name          = "_AssetTypeCombo";
        assetTypeCombo.onValueChange = OnFilterComboSelectChanged;

        List <IAssetFilter> assetFilters = ResourceManageToolModel.GetInstance().AssetFilterList;

        foreach (var filter in assetFilters)
        {
            AssetTypeFilter f = filter as AssetTypeFilter;
            assetTypeCombo.AddItem(new ComboItem(f.DisplayTypeName, f.TypeIndex));
        }

        assetTypeCombo.CurrValue = 0;

        TextBoxCtrl searchTextBox = new TextBoxCtrl();

        searchTextBox.Size          = comboBoxRect;
        searchTextBox.Icon          = UnityInternalIconCache.GetInstance().GetCacheIcon("d_ViewToolZoom");
        searchTextBox.Name          = "_SearchBox";
        searchTextBox.Caption       = "搜索";
        searchTextBox.Visiable      = true;
        searchTextBox.onValueChange = OnSearchTextBoxChange;

        ButtonCtrl helpBtn = new ButtonCtrl();

        helpBtn.Name     = "_HelpButton";
        helpBtn.Caption  = "帮助文档";
        helpBtn.onClick  = OnHelp;
        helpBtn.Size     = btnRect;
        helpBtn.Visiable = true;

        LabelCtrl stateLabel = new LabelCtrl();

        stateLabel.Name             = "_StateLabel";
        stateLabel.textColor        = Color.red;
        stateLabel.Caption          = "数据库没有更新,无法查看无用资源列表与反向引用!";
        stateLabel.layoutConstraint = LayoutConstraint.GetExtensibleViewConstraint();

        hb0.Add(searchBtn);
        hb0.Add(assetTypeCombo);
        hb0.Add(searchTextBox);
        hb0.Add(helpBtn);
        hb0.Add(stateLabel);
    }
Пример #20
0
    public static void InitControls(EditorRoot root)
    {
        /*将编辑器分为上下两个区域*/
        HSpliterCtrl Upanddown = new HSpliterCtrl();

        root.RootCtrl = Upanddown;
        Upanddown.layoutConstraint = LayoutConstraint.GetSpliterConstraint(30f);

        #region 编辑器事件回调
        /*编辑器初始化事件*/
        root.onEnable += EditorWindowOnEnable;
        /*编辑器关闭事件*/
        root.onDestroy += EditorWindowOnDestroy;
        #endregion

        #region 编辑器的上边
        /*存放上方资源的容器*/
        HBoxCtrl upspliter = new HBoxCtrl();
        Upanddown.Add(upspliter);

        /*扫描资源按钮*/
        Rect       SearchBtnRect = new Rect(0, 0, 160, 20);
        ButtonCtrl SearchBtn     = new ButtonCtrl();
        SearchBtn.onClick  = SearchBtnClickEvent;
        SearchBtn.Size     = SearchBtnRect;
        SearchBtn.Visiable = true;
        SearchBtn.Caption  = "扫描资源";
        SearchBtn.Name     = "_SearchButton";

        /*下拉菜单,过滤器*/
        Rect ComboxFliterRect         = new Rect(0, 0, 120, 20);
        ComboBoxCtrl <int> TypeFliter = new ComboBoxCtrl <int>(0);
        TypeFliter.Size           = ComboxFliterRect;
        TypeFliter.Name           = "_TypeFliter";
        TypeFliter.onValueChange += FilterOnchange;

        for (int i = 0; i <= 3; i++)
        {
            TypeFliter.AddItem(new ComboItem("选项0", 0));
            TypeFliter.AddItem(new ComboItem("选项1", 1));
            TypeFliter.AddItem(new ComboItem("选项2", 2));
            TypeFliter.AddItem(new ComboItem("选项3", 3));
        }

        TypeFliter.CurrValue = 0;

        /*数据库状态显示*/
        LabelCtrl StateLabel = new LabelCtrl();
        StateLabel.Caption = "数据库没有更新,请点击刷新资源数据库";
        StateLabel.Name    = "_StateLabel";

        /*将控件放入上方资源*/
        upspliter.Add(SearchBtn);
        upspliter.Add(TypeFliter);
        upspliter.Add(StateLabel);
        #endregion

        #region 编辑器的下边
        /*将下放资源分为左右两个区域*/
        VSpliterCtrl downspliter = new VSpliterCtrl();
        Upanddown.Add(downspliter);
        downspliter.layoutConstraint = LayoutConstraint.GetSpliterConstraint(300f);
        downspliter.Dragable         = true;

        /*存放左侧资源列表和无引用资源的容器*/
        VBoxCtrl LeftAssetContainer = new VBoxCtrl();
        downspliter.Add(LeftAssetContainer);

        /*左侧两枚选项卡*/
        TabViewCtrl leftTabView = new TabViewCtrl();
        LeftAssetContainer.Add(leftTabView);

        /*资源列表*/
        TreeViewCtrl AssetsTreeView = new TreeViewCtrl();
        AssetsTreeView.Caption = "资源列表";
        AssetsTreeView.Name    = "_AssetList";
        leftTabView.Add(AssetsTreeView);

        /*无用资源列表*/
        ListViewCtrl UseLessAssetsList = new ListViewCtrl();
        UseLessAssetsList.Caption = "无用资源";
        UseLessAssetsList.Name    = "_UseLessAssetsList";
        leftTabView.Add(UseLessAssetsList);

        /*存放正向反向资源依赖关系的容器*/
        VBoxCtrl RightAssetDependceContainer = new VBoxCtrl();
        downspliter.Add(RightAssetDependceContainer);

        /*右侧两枚选项卡*/
        TabViewCtrl rightTabView = new TabViewCtrl();
        RightAssetDependceContainer.Add(rightTabView);

        /*资源正向依赖关系列表*/
        ListViewCtrl DependcyAssetsList = new ListViewCtrl();
        DependcyAssetsList.Caption = "正向依赖关系";
        DependcyAssetsList.Name    = "_DependAssetsList";
        rightTabView.Add(DependcyAssetsList);

        /*资源反向依赖关系列表*/
        ListViewCtrl DedependcyAssetsList = new ListViewCtrl();
        DedependcyAssetsList.Caption = "反向依赖关系";
        DedependcyAssetsList.Name    = "_DedependcyAssetsList";
        rightTabView.Add(DedependcyAssetsList);
        #endregion
    }
Пример #21
0
    static void AddAssetToResourceTreeView(string path)
    {
        TreeViewCtrl treeView = s_root.FindControl("_MainTreeView") as TreeViewCtrl;

        if (treeView == null)
        {
            return;
        }

        string totalPath = path;
        string currPath  = path;
        List <TreeViewNode> currLevelNodeList = treeView.Roots;
        TreeViewNode        parentNode        = null;
        int len = 0;

        while (currPath != "")
        {
            int i = currPath.IndexOf('/');
            if (i < 0)
            {
                i = currPath.Length;
            }
            len += i + 1;
            string pathNodeName     = currPath.Substring(0, i);
            string currNodeFullPath = totalPath.Substring(0, len - 1);
            if (i + 1 < currPath.Length)
            {
                currPath = currPath.Substring(i + 1);
            }
            else
            {
                currPath = "";
            }


            bool findNode = false;
            foreach (var treeNode in currLevelNodeList)
            {
                if (treeNode.name == pathNodeName)
                {
                    findNode          = true;
                    parentNode        = treeNode;
                    currLevelNodeList = treeNode.children;
                    break;
                }
            }

            if (!findNode)
            {
                TreeViewNode newNode = new TreeViewNode();
                newNode.name  = pathNodeName;
                newNode.image = ResourceManageToolUtility.GetCachedIcon(path);
                if (string.Equals(pathNodeName.ToLower(), "assets"))
                {
                    newNode.state.IsExpand = true;
                }
                else
                {
                    newNode.state.IsExpand = false;
                }

                TreeViewNodeUserParam userParam = new TreeViewNodeUserParam();

                bool toggleState = false;
                //Modify by liteng for 发布工具改善
                foreach (string p in PackageExportToolModel.GetInstance().GetPackageInfo().ExportAssets)
                {
                    if (p.Equals(currNodeFullPath))
                    {
                        toggleState = true;
                    }
                }
                userParam.param = toggleState;
                newNode.state.userParams.Add(userParam);


                if (parentNode == null)
                {//说明需要作为根节点插入树视图中
                    currLevelNodeList.Add(newNode);
                }
                else
                {
                    parentNode.Add(newNode);
                    //Add by liteng for 发布工具改善 start
                    if (true == toggleState)
                    {
                        parentNode.state.IsExpand = true;
                    }
                    //Add by liteng for 发布工具改善 end
                }
                parentNode        = newNode;
                currLevelNodeList = newNode.children;
            }
        }
    }
Пример #22
0
    public static void InitControls(EditorRoot editorRoot)
    {
        s_root = editorRoot;

        //s_root.position = new Rect(100f, 100f, 1024, 768f);
        s_root.onDestroy = OnDestroy;
        s_root.onEnable  = OnEnable;

        Rect btnRect      = new Rect(0, 0, 80, 20);
        Rect comboBoxRect = new Rect(0, 0, 100, 20);

        //Modify by liteng for 发布工具改善Start
        #region 创建布置窗口元素
        #region 第一级
        HSpliterCtrl hs1 = new HSpliterCtrl();
        hs1.layoutConstraint = LayoutConstraint.GetSpliterConstraint(30f);
        HSpliterCtrl hs2 = new HSpliterCtrl();
        hs2.layoutConstraint = LayoutConstraint.GetSpliterConstraint(30f, true);

        HBoxCtrl hb1 = new HBoxCtrl();      //布置上方菜单条
        HBoxCtrl hb2 = new HBoxCtrl();      //布置主窗口
        HBoxCtrl hb3 = new HBoxCtrl();      //布置下方状态栏
        #endregion

        #region 第二级
        VSpliterCtrl vs2_1 = new VSpliterCtrl();
        vs2_1.layoutConstraint = LayoutConstraint.GetSpliterConstraint(300f);
        vs2_1.Dragable         = true;

        VBoxCtrl vb2_1 = new VBoxCtrl();               //资源视图
        VBoxCtrl vb2_2 = new VBoxCtrl();               //发布信息视图
        #endregion
        #endregion

        #region 布置窗口(由高至低布置)
        #region 第二级
        TreeViewCtrl m_treeView = new TreeViewCtrl();   //资源列表
        m_treeView.Name          = "_MainTreeView";
        m_treeView.onValueChange = OnTreeViewNodeToggle;

        InspectorViewCtrl m_inspector = new InspectorViewCtrl();  //发布信息视图
        m_inspector.Name        = "_Inspector";
        m_inspector.onInspector = OnInspector;

        vb2_1.Add(m_treeView);
        vb2_2.Add(m_inspector);
        vs2_1.Add(vb2_1);
        vs2_1.Add(vb2_2);

        hb2.Add(vs2_1);
        #endregion

        #region 第一级
        //[导出]按钮
        ButtonCtrl exportBtn = new ButtonCtrl();
        exportBtn.Caption = "导出";
        exportBtn.Name    = "_ExportButton";
        exportBtn.Size    = btnRect;
        exportBtn.onClick = OnExportBtnClick;

        //[发布]按钮
        //ButtonCtrl publishBtn = new ButtonCtrl();
        //publishBtn.Caption = "发布";
        //publishBtn.Name = "_PublishButton";
        //publishBtn.Size = btnRect;
        //publishBtn.onClick = OnPublishBtnClick;


        //[配置AB路径]按钮
        //ButtonCtrl configPublishBtn = new ButtonCtrl();
        //configPublishBtn.Caption = "配置AB路径";
        //configPublishBtn.Name = "_ConfigPublishButton";
        //configPublishBtn.Size = btnRect;
        //configPublishBtn.onClick = OnConfigPublishPathBtnClick;

        //版本下拉菜单
        ComboBoxCtrl <int> debugCombo = new ComboBoxCtrl <int>(0);
        debugCombo.Size          = comboBoxRect;
        debugCombo.Name          = "_DebugCombo";
        debugCombo.onValueChange = OnDebugComboSelect;
        debugCombo.AddItem(new ComboItem("Debug", 0));
        debugCombo.AddItem(new ComboItem("Release", 1));

        hb1.Add(exportBtn);
        //hb1.Add(publishBtn);
        //hb1.Add(configPublishBtn);
        hb1.Add(debugCombo);

        hs1.Add(hb1);
        hs1.Add(hs2);
        hs2.Add(hb2);
        hs2.Add(hb3);
        #endregion


        #endregion
        s_root.RootCtrl = hs1;

        UpdateDebugCombobox();
        PackageExportToolModel.GetInstance().onExportComplete = OnExportComplete;
        //Modify by liteng for 发布工具改善 end

        #region 原有代码
        //HSpliterCtrl hspliter = new HSpliterCtrl();
        //hspliter.layoutConstraint = LayoutConstraint.GetSpliterConstraint(30f, true);

        //上方树状视图
        //VBoxCtrl vb0 = new VBoxCtrl();
        //hspliter.Add(vb0);

        ////下方工具条
        //HBoxCtrl hb0 = new HBoxCtrl();
        //hspliter.Add(hb0);

        //TreeViewCtrl treeView = new TreeViewCtrl();
        //treeView.Name = "_MainTreeView";
        //vb0.Add(treeView);

        //TextBoxCtrl tbVersion = new TextBoxCtrl();
        //tbVersion.Size = new Rect(0, 0, 30, 20);
        //tbVersion.Name = "_VersionBox";
        //tbVersion.Caption = "版本号";
        //tbVersion.Enable = true;
        //tbVersion.layoutConstraint = LayoutConstraint.GetInspectorViewConstraint(10, 50);

        //TextBoxCtrl tbFileName = new TextBoxCtrl();
        //tbFileName.Size = new Rect(0, 0, 60, 20);
        //tbFileName.Name = "_SaveFileName";
        //tbFileName.Caption = "输出文件";
        //tbFileName.Enable = true;
        //tbFileName.layoutConstraint = LayoutConstraint.GetInspectorViewConstraint(10, 50);

        //Rect btnRect = new Rect(0, 0, 60, 20);

        //ButtonCtrl ChooseFileBtn = new ButtonCtrl();
        //ChooseFileBtn.Caption = "选择";
        //ChooseFileBtn.Name = "_ChooseFileName";
        //ChooseFileBtn.Size = btnRect;
        //ChooseFileBtn.onClick = OnChooseFileNameButtonClick;

        //ButtonCtrl okBtn = new ButtonCtrl();
        //okBtn.Caption = "确定";
        //okBtn.Name = "_OkButton";
        //okBtn.Size = btnRect;
        //okBtn.onClick = OnOkButtonClick;

        //ButtonCtrl cancelBtn = new ButtonCtrl();
        //cancelBtn.Caption = "取消";
        //cancelBtn.Name = "_CancelButton";
        //cancelBtn.Size = btnRect;
        //cancelBtn.onClick = OnCancelButtonClick;

        //hb0.Add(tbVersion);
        //hb0.Add(tbFileName);
        //hb0.Add(ChooseFileBtn);
        //hb0.Add(okBtn);
        //hb0.Add(cancelBtn);
        #endregion
    }