void GenerateFiles(string[] files, CacheFileRefType refType) { for (int i = 0; i < files.Length; i++) { CaheFile file = new CaheFile(); file.filename = files[i]; file.guid = AssetDatabase.AssetPathToGUID(file.filename); file.type = GetType(Path.GetExtension(file.filename)); if (CacheFileAssetType.IsScriptOrConfig(file.type) && refType == CacheFileRefType.NoUse) { } else { file.refType = refType; } if (dict.ContainsKey(file.guid)) { Debug.Log(refType + " " + file.filename); continue; } dict.Add(file.guid, file); } }
void GenerateDependencies(CaheFile file, CacheFileRefType refType) { string[] dependencies = AssetDatabase.GetDependencies(file.filename, false); for (int i = 0; i < dependencies.Length; i++) { string guid = AssetDatabase.AssetPathToGUID(dependencies[i]); bool has = dict.ContainsKey(guid); CaheFile def; if (has) { def = dict[guid]; } else { def = new CaheFile(); def.filename = dependencies[i]; def.guid = guid; def.type = GetType(Path.GetExtension(def.filename)); if (def.refType == CacheFileRefType.None) { if (CacheFileAssetType.IsScriptOrConfig(def.type) && refType == CacheFileRefType.NoUse) { } else { def.refType = refType; } } dict.Add(def.guid, def); } file.AddDep(def); def.AddRef(file); if (!has) { GenerateDependencies(def, refType); } } }