资源删除工具修改提交

dev_chengFeng
jiaoyangna 2021-07-28 17:26:13 +08:00
parent b98fd71d35
commit 0d16b1511a
1 changed files with 10 additions and 6 deletions

View File

@ -40,7 +40,7 @@ namespace GameEditor.Util
} }
static void InitData() static void InitData()
{ {
FileStream fs = new FileStream(tag + "/deleteFile1.csv", FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite); FileStream fs = new FileStream(tag + "/deleteFile.csv", FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
StreamReader sr = new StreamReader(fs, System.Text.Encoding.UTF8); StreamReader sr = new StreamReader(fs, System.Text.Encoding.UTF8);
string str = ""; string str = "";
int index = 0; int index = 0;
@ -89,11 +89,14 @@ namespace GameEditor.Util
{ {
if(dependDic.ContainsKey(resPath)) if(dependDic.ContainsKey(resPath))
{ {
if (!dependUnUsedDic.ContainsKey(keyValue.Key)) for (int j = 0; j < dependDic[resPath].Count; j++)
{ {
dependUnUsedDic[keyValue.Key] = new List<string>(); if (!dependUnUsedDic.ContainsKey(dependDic[resPath][j]))
{
dependUnUsedDic[dependDic[resPath][j]] = new List<string>();
}
dependUnUsedDic[dependDic[resPath][j]].Add(dependDic[resPath][j]);
} }
dependUnUsedDic[keyValue.Key].AddRange(dependDic[resPath]);
} }
} }
} }
@ -105,7 +108,6 @@ namespace GameEditor.Util
int num = 0; int num = 0;
foreach (KeyValuePair<string, List<string>> keyValue in dependUnUsedDic) foreach (KeyValuePair<string, List<string>> keyValue in dependUnUsedDic)
{ {
resName = keyValue.Key;
num = num + 1; num = num + 1;
EditorUtility.DisplayProgressBar("寻找依赖资源", resName, num*1.0f/ dependUnUsedDic.Count); EditorUtility.DisplayProgressBar("寻找依赖资源", resName, num*1.0f/ dependUnUsedDic.Count);
for (int i = 0; i < keyValue.Value.Count;i++ ) for (int i = 0; i < keyValue.Value.Count;i++ )
@ -128,9 +130,11 @@ namespace GameEditor.Util
break; break;
} }
} }
if (!dic.ContainsKey(resPath))
dic[resPath] = new List<string>();
if (isDelete) if (isDelete)
{ {
dic[resName].Add(resPath); dic[resPath].Add(resPath);
} }
} }
} }