public void TreeModelControllerTestListSimplePasses()
    {
        // Use the Assert class to test conditions.
        string[] paths = PathUtils.GetDirectoryFilePath("Assets/Resources");
        paths = PathUtils.RemovePathWithEnds(paths, new string[] { ".meta" });
        TreeModelController <TreeNodeBase> control = new TreeModelController <TreeNodeBase>();

        foreach (var i in paths)
        {
            TreeNodeBase node = control.GetNewNode(i);
            control.AddNode(node);
        }

        control.ListForeachNode((n) =>
        {
            string c = "[";
            foreach (var item in n.childs)
            {
                c += item + ",";
            }
            c += "]";
            Debug.Log(n.Id + " " + c + "  Path: " + n.relativeRootPath);
            return(true);
        });
    }
Пример #2
0
 void UpdateChooseFileData(TreeModelController <FileData> data)
 {
     data.ListForeachNode((n) =>
     {
         if (settingData.packageOnePaths.Contains(n.relativeRootPath))
         {
             n.isChoose = true;
         }
         return(true);
     });
 }
Пример #3
0
    /// <summary>
    /// 获取文件目录信息
    /// </summary>
    /// <param name="assetPath">资源文件夹路径</param>
    /// <param name="isAllOpen">是否展开所有目录</param>
    /// <param name="iconName">当为空字符时使用文件夹目录图标,不为空时强制使用此图标</param>
    /// <returns></returns>
    public static TreeModelController <FileData> GetFileDirectoryInfo(string[] paths, bool isAllOpen = false, string iconName = "", CallBack <FileData> initParamsCallBack = null)
    {
        TreeModelController <FileData> control = new TreeModelController <FileData>();

        control.AddPathsToCreateNode(paths);
        control.ListForeachNode((node) =>
        {
            node.isSelected = isAllOpen;
            node.content    = GetPathGUIContent(node.relativeRootPath, iconName);
            if (initParamsCallBack != null)
            {
                initParamsCallBack(node);
            }
            return(true);
        });

        return(control);
    }