public void AddNewResourceCatalog(string _Path) { ResourceCatalog mCatalog = new ResourceCatalog { Name = PathTools.GetPathFolderName(_Path), Path = _Path }; Config.ResourceCatalog.Add(mCatalog); RetrievalModelResourceDirectory(mCatalog, mCatalog.Path); EditorUtility.SetDirty(Config); }
/// <summary> /// 移除关联的模块配置信息 /// </summary> /// <param name="_Catalog"></param> private void RemoveResourceModelBuildConfig(ResourceCatalog _Catalog) { List <ResourceModelConfig> Temp = new List <ResourceModelConfig>(); foreach (var item in Config.ModelBuildConfig) { item.SplitConfig(_Catalog.Path); if (item.NodelType == ResourceBuildNodelType.UselessNodel) { Temp.Add(item); } } foreach (var item in Temp) { Config.ModelBuildConfig.Remove(item); } }
/// <summary> /// 检索模块资源目录 /// </summary> /// <param name="_Path"></param> private void RetrievalModelResourceDirectory(ResourceCatalog _Catalog, string _Path) { string[] fileList = Directory.GetFileSystemEntries(_Path); foreach (string file in fileList) { if (Directory.Exists(file)) { if (file.EndsWith("Module")) { ResourceModelConfig ModelConfig = new ResourceModelConfig(_Catalog.Path, file); if (ModelConfig.NodelType != ResourceBuildNodelType.UselessNodel) { AddResourceModelBuildConfig(ModelConfig); } } else { RetrievalModelResourceDirectory(_Catalog, file); } } } }