/// <summary>
    /// 获取输出资源信息。
    /// </summary>
    /// <returns></returns>
    public static List <BuildResourcesInfo> LoadBuildResourcesInfo()
    {
        var path = string.Concat(GetFolderPath("ResourceDef"), "\\ForBuild.xml");
        //LogDebug(path);
        var xml = XMLParser.LoadXML(Utils.LoadFile(path));

        if (xml == null)
        {
            //EditorUtility.DisplayDialog("Error", "Load Build Resources Info Error.", "ok");
            return(null);
        }
        var result = new List <BuildResourcesInfo>();

        foreach (SecurityElement item in xml.Children)
        {
            var info = new BuildResourcesInfo();
            info.check        = true;
            info.name         = (item.Children[0] as SecurityElement).Text;
            info.type         = (item.Children[1] as SecurityElement).Text;
            info.copyOrder    = (item.Children[2] as SecurityElement).Text;
            info.isPopInBuild = bool.Parse((item.Children[3] as SecurityElement).Text);
            info.extentions   = (item.Children[4] as SecurityElement).Text.Split(' ');
            var folders = item.Children[5] as SecurityElement;
            info.folders = new List <BuildResourcesSubInfo>();
            foreach (SecurityElement folder in folders.Children)
            {
                var sub = new BuildResourcesSubInfo()
                {
                    path  = (folder.Children[0] as SecurityElement).Text,
                    deep  = bool.Parse((folder.Children[1] as SecurityElement).Text),
                    check = true
                };
                info.folders.Add(sub);
            }
            result.Add(info);
        }

        return(result);
    }
Пример #2
0
    /// <summary>
    /// 获取输出资源信息。
    /// </summary>
    /// <returns></returns>
    public static List<BuildResourcesInfo> LoadBuildResourcesInfo()
    {
        var path = string.Concat(GetFolderPath("ResourceDef"), "\\ForBuild.xml");
        //LogDebug(path);
        var xml = XMLParser.LoadXML(Utils.LoadFile(path));
        if (xml == null)
        {
            //EditorUtility.DisplayDialog("Error", "Load Build Resources Info Error.", "ok");
            return null;
        }
        var result = new List<BuildResourcesInfo>();

        foreach (SecurityElement item in xml.Children)
        {
            var info = new BuildResourcesInfo();
            info.check = true;
            info.name = (item.Children[0] as SecurityElement).Text;
            info.type = (item.Children[1] as SecurityElement).Text;
            info.copyOrder = (item.Children[2] as SecurityElement).Text;
            info.isPopInBuild = bool.Parse((item.Children[3] as SecurityElement).Text);
            info.extentions = (item.Children[4] as SecurityElement).Text.Split(' ');
            var folders = item.Children[5] as SecurityElement;
            info.folders = new List<BuildResourcesSubInfo>();
            foreach (SecurityElement folder in folders.Children)
            {
                var sub = new BuildResourcesSubInfo()
                {
                    path = (folder.Children[0] as SecurityElement).Text,
                    deep = bool.Parse((folder.Children[1] as SecurityElement).Text),
                    check = true
                };
                info.folders.Add(sub);
            }
            result.Add(info);
        }

        return result;
    }