Commit 0a9ffec6 authored by SherryChaos's avatar SherryChaos

update AssetBundle export

parent a6596322
...@@ -82,7 +82,6 @@ public class AssetBundleRobber : MonoBehaviour ...@@ -82,7 +82,6 @@ public class AssetBundleRobber : MonoBehaviour
//Copy("531fb6fa"); //Copy("531fb6fa");
} }
public void CopyAB() public void CopyAB()
{ {
Copy(input.text); Copy(input.text);
...@@ -99,7 +98,6 @@ public class AssetBundleRobber : MonoBehaviour ...@@ -99,7 +98,6 @@ public class AssetBundleRobber : MonoBehaviour
foreach (var dep in file.dependencies) foreach (var dep in file.dependencies)
{ {
File.Copy(GetFullPath(dep), pathStore + path + "/" + dep); File.Copy(GetFullPath(dep), pathStore + path + "/" + dep);
} }
} }
...@@ -107,7 +105,7 @@ public class AssetBundleRobber : MonoBehaviour ...@@ -107,7 +105,7 @@ public class AssetBundleRobber : MonoBehaviour
Debug.Log(path + ": Copy Done!"); Debug.Log(path + ": Copy Done!");
} }
void Initialize() private void Initialize()
{ {
if (!Directory.Exists(pathStore)) if (!Directory.Exists(pathStore))
Directory.CreateDirectory(pathStore); Directory.CreateDirectory(pathStore);
...@@ -150,7 +148,7 @@ public class AssetBundleRobber : MonoBehaviour ...@@ -150,7 +148,7 @@ public class AssetBundleRobber : MonoBehaviour
} }
} }
void AddLog(int i) private void AddLog(int i)
{ {
var file = assetManager.assetsFileList[i]; var file = assetManager.assetsFileList[i];
count++; count++;
...@@ -165,26 +163,26 @@ public class AssetBundleRobber : MonoBehaviour ...@@ -165,26 +163,26 @@ public class AssetBundleRobber : MonoBehaviour
break; break;
} }
var filestruct = new AssetbundleInfo(); var fileStruct = new AssetbundleInfo();
filestruct.path = filePath; fileStruct.path = filePath;
filestruct.name = fileName; fileStruct.name = fileName;
filestruct.dependencies = GetDependencies(filePath); fileStruct.dependencies = GetDependencies(filePath);
lock (_lock) lock (_lock)
{ {
files.Add(filestruct); files.Add(fileStruct);
newFiles.Add(filestruct); newFiles.Add(fileStruct);
} }
var content = string.Empty; var content = string.Empty;
content += filestruct.path + "\r\n"; content += fileStruct.path + "\r\n";
content += "-" + filestruct.name + "\r\n"; content += "-" + fileStruct.name + "\r\n";
foreach (var depend in filestruct.dependencies) foreach (var depend in fileStruct.dependencies)
content += "--" + depend + "\r\n"; content += "--" + depend + "\r\n";
logQueue.Enqueue(content); logQueue.Enqueue(content);
} }
IEnumerator RefreshFileResources() private IEnumerator RefreshFileResources()
{ {
var ie = assetManager.LoadFolderAsync(pathAB); var ie = assetManager.LoadFolderAsync(pathAB);
StartCoroutine(ie); StartCoroutine(ie);
...@@ -283,7 +281,8 @@ public class AssetBundleRobber : MonoBehaviour ...@@ -283,7 +281,8 @@ public class AssetBundleRobber : MonoBehaviour
{ {
StopProcessingLogs(); StopProcessingLogs();
} }
IEnumerator CopyBundles()
private IEnumerator CopyBundles()
{ {
fileCount = files.Count; fileCount = files.Count;
currentFileCount = 0; currentFileCount = 0;
...@@ -297,27 +296,32 @@ public class AssetBundleRobber : MonoBehaviour ...@@ -297,27 +296,32 @@ public class AssetBundleRobber : MonoBehaviour
{ {
currentFileCount++; currentFileCount++;
var type = GetAssetType(file.name); var type = GetAssetType(file.name);
if (!pathStore.Contains("Windows") && AssetIsIcon(type))
continue;
if (type == AssetType.AvatarStand) if (type == AssetType.AvatarStand)
{ {
if (!Directory.Exists(pathStore + "AvatarStand")) if (!Directory.Exists(pathStore + "AvatarStand"))
Directory.CreateDirectory(pathStore + "AvatarStand"); Directory.CreateDirectory(pathStore + "AvatarStand");
var targetName = pathStore + "AvatarStand/" + Path.GetFileName(file.name).Replace(".prefab", "").Replace("avatarstand_", "AvatarStand_"); var targetName = pathStore + "AvatarStand/" + Path.GetFileName(file.name).Replace(EXTENSION_PREFAB, string.Empty).Replace("avatarstand_", "AvatarStand_");
if (!File.Exists(targetName)) if (!File.Exists(targetName))
File.Copy(GetFullPath(file.path), targetName); File.Copy(GetFullPath(file.path), targetName);
} }
else if (type == AssetType.Frame) else if (type == AssetType.FrameMat)
{ {
if (!Directory.Exists(pathStore + "Frame")) if (!Directory.Exists(pathStore + "Frame"))
Directory.CreateDirectory(pathStore + "Frame"); Directory.CreateDirectory(pathStore + "Frame");
var targetName = pathStore + "Frame/" + Path.GetFileName(file.name).Replace(".mat", "").Replace("profileframemat", "ProfileFrameMat"); var targetName = pathStore + "Frame/" + Path.GetFileName(file.name).Replace(EXTENSION_MAT, string.Empty).Replace("profileframemat", "ProfileFrameMat");
if(!File.Exists(targetName))
File.Copy(GetFullPath(file.path), targetName); File.Copy(GetFullPath(file.path), targetName);
} }
else if (type == AssetType.Grave) else if (type == AssetType.Grave)
{ {
if (!Directory.Exists(pathStore + "Grave")) if (!Directory.Exists(pathStore + "Grave"))
Directory.CreateDirectory(pathStore + "Grave"); Directory.CreateDirectory(pathStore + "Grave");
var targetName = pathStore + "Grave/" + Path.GetFileName(file.name).Replace(".prefab", "").Replace("grave_", "Grave_"); var targetName = pathStore + "Grave/" + Path.GetFileName(file.name).Replace(EXTENSION_PREFAB, string.Empty).Replace("grave_", "Grave_");
if (!File.Exists(targetName)) if (!File.Exists(targetName))
File.Copy(GetFullPath(file.path), targetName); File.Copy(GetFullPath(file.path), targetName);
} }
...@@ -325,7 +329,7 @@ public class AssetBundleRobber : MonoBehaviour ...@@ -325,7 +329,7 @@ public class AssetBundleRobber : MonoBehaviour
{ {
if (!Directory.Exists(pathStore + "Mat")) if (!Directory.Exists(pathStore + "Mat"))
Directory.CreateDirectory(pathStore + "Mat"); Directory.CreateDirectory(pathStore + "Mat");
var targetName = pathStore + "Mat/" + Path.GetFileName(file.name).Replace(".prefab", "").Replace("mat_", "Mat_"); var targetName = pathStore + "Mat/" + Path.GetFileName(file.name).Replace(EXTENSION_PREFAB, string.Empty).Replace("mat_", "Mat_");
if (!File.Exists(targetName)) if (!File.Exists(targetName))
File.Copy(GetFullPath(file.path), targetName); File.Copy(GetFullPath(file.path), targetName);
} }
...@@ -334,7 +338,8 @@ public class AssetBundleRobber : MonoBehaviour ...@@ -334,7 +338,8 @@ public class AssetBundleRobber : MonoBehaviour
if (!Directory.Exists(pathStore + "Mate")) if (!Directory.Exists(pathStore + "Mate"))
Directory.CreateDirectory(pathStore + "Mate"); Directory.CreateDirectory(pathStore + "Mate");
var targetName = pathStore + "Mate/" + Path.GetFileName(file.name).Replace(".prefab", "").Replace("_model", "_Model").Replace("_sd_", "_SD_").Replace("m", "M").Replace("v", "V"); var targetName = pathStore + "Mate/" + Path.GetFileName(file.name).Replace(EXTENSION_PREFAB, string.Empty)
.Replace("_model", "_Model").Replace("_sd_", "_SD_").Replace("m", "M").Replace("v", "V");
if (file.dependencies.Count == 0) if (file.dependencies.Count == 0)
{ {
...@@ -365,21 +370,24 @@ public class AssetBundleRobber : MonoBehaviour ...@@ -365,21 +370,24 @@ public class AssetBundleRobber : MonoBehaviour
Directory.CreateDirectory(pathStore + "Protector"); Directory.CreateDirectory(pathStore + "Protector");
string subDir = "107" + Regex.Split(file.name, "/")[4]; string subDir = "107" + Regex.Split(file.name, "/")[4];
var targetFolder = pathStore + "Protector/" + subDir; var targetFolder = pathStore + "Protector/" + subDir;
var targetName = targetFolder + "/" + Path.GetFileName(file.name).Replace("pmat.mat", subDir).Replace("protectoricon", "ProtectorIcon").Replace(".png", ""); var targetName = targetFolder + "/" + Path.GetFileName(file.name).Replace("pmat.mat", subDir)
.Replace("protectoricon", "ProtectorIcon").Replace(EXTENSION_PNG, string.Empty);
if (!Directory.Exists(targetFolder)) if (!Directory.Exists(targetFolder))
Directory.CreateDirectory(targetFolder); Directory.CreateDirectory(targetFolder);
if (!File.Exists(targetName))
File.Copy(GetFullPath(file.path), targetName); File.Copy(GetFullPath(file.path), targetName);
} }
else if (type == AssetType.Wallpaper) else if (type == AssetType.Wallpaper)
{ {
if (!Directory.Exists(pathStore + "Wallpaper")) if (!Directory.Exists(pathStore + "Wallpaper"))
Directory.CreateDirectory(pathStore + "Wallpaper"); Directory.CreateDirectory(pathStore + "Wallpaper");
var subDir = Path.GetFileName(file.name).Replace(".prefab", "").Replace("front", "Front"); var subDir = Path.GetFileName(file.name).Replace(EXTENSION_PREFAB, string.Empty).Replace("front", "Front");
var targetFolder = pathStore + "Wallpaper/" + subDir; var targetFolder = pathStore + "Wallpaper/" + subDir;
if (!Directory.Exists(targetFolder)) if (!Directory.Exists(targetFolder))
Directory.CreateDirectory(targetFolder); Directory.CreateDirectory(targetFolder);
File.Copy(GetFullPath(file.path), targetFolder + "/" + subDir);
File.Copy(GetFullPath(file.path), Path.Combine(targetFolder, file.path));
var depens = new List<string>(file.dependencies); var depens = new List<string>(file.dependencies);
foreach (string depen in depens) foreach (string depen in depens)
{ {
...@@ -393,37 +401,38 @@ public class AssetBundleRobber : MonoBehaviour ...@@ -393,37 +401,38 @@ public class AssetBundleRobber : MonoBehaviour
{ {
if (!Directory.Exists(pathStore + "Background")) if (!Directory.Exists(pathStore + "Background"))
Directory.CreateDirectory(pathStore + "Background"); Directory.CreateDirectory(pathStore + "Background");
string subDir = Path.GetFileName(file.name).Replace("back", "Back").Replace(".prefab", ""); string subDir = Path.GetFileName(file.name).Replace("back", "Back").Replace(EXTENSION_PREFAB, "");
var targetFolder = pathStore + "Background/" + subDir; var targetFolder = pathStore + "Background/" + subDir;
if (!Directory.Exists(targetFolder)) if (!Directory.Exists(targetFolder))
Directory.CreateDirectory(targetFolder); Directory.CreateDirectory(targetFolder);
if (!File.Exists(targetFolder + "/" + subDir)) if (!File.Exists(targetFolder + "/" + subDir))
File.Copy(GetFullPath(file.path), targetFolder + "/" + subDir); File.Copy(GetFullPath(file.path), Path.Combine(targetFolder, file.path));
else else
File.Copy(GetFullPath(file.path), targetFolder + "/" + subDir + "---------"); Debug.LogError($"Background File {file.path} already exist.");
var depens = new List<string>(file.dependencies); var depens = new List<string>(file.dependencies);
foreach (string depen in depens) foreach (string depen in depens)
{ {
if (File.Exists(GetFullPath(depen))) if (File.Exists(GetFullPath(depen)))
File.Copy(GetFullPath(depen), targetFolder + "/" + depen); File.Copy(GetFullPath(depen), targetFolder + "/" + depen);
else else
Debug.Log("未找到" + file.path + "的依赖:" + depen); Debug.LogError("未找到" + file.path + "的依赖:" + depen);
} }
} }
else if (type == AssetType.Card) else if (type == AssetType.Card)
{ {
if (!Directory.Exists(pathStore + "Card")) if (!Directory.Exists(pathStore + "Card"))
Directory.CreateDirectory(pathStore + "Card"); Directory.CreateDirectory(pathStore + "Card");
string subDir = int.Parse(Regex.Split(file.name, "/")[6].Replace("ef", "")).ToString(); string subDir = int.Parse(Regex.Split(file.name, "/")[6].Replace("ef", string.Empty)).ToString();
subDir = GetYdkID(subDir); subDir = GetYdkID(subDir);
if (file.name.Contains("/highend_hd/")) if (file.name.Contains(LABEL_HD))
subDir = "HD" + subDir; subDir = "HD" + subDir;
else if (file.name.Contains("/sd/")) else if (file.name.Contains(LABEL_SD))
subDir = "SD" + subDir; subDir = "SD" + subDir;
var targetFolder = pathStore + "Card/" + subDir; var targetFolder = pathStore + "Card/" + subDir;
if (!Directory.Exists(targetFolder)) if (!Directory.Exists(targetFolder))
Directory.CreateDirectory(targetFolder); Directory.CreateDirectory(targetFolder);
File.Copy(GetFullPath(file.path), targetFolder + "/" + Path.GetFileName(file.name).Replace(".prefab", "").Replace("ef", "Ef")); File.Copy(GetFullPath(file.path), Path.Combine(targetFolder, file.path));
var depens = new List<string>(file.dependencies); var depens = new List<string>(file.dependencies);
foreach (string depen in depens) foreach (string depen in depens)
{ {
...@@ -433,12 +442,12 @@ public class AssetBundleRobber : MonoBehaviour ...@@ -433,12 +442,12 @@ public class AssetBundleRobber : MonoBehaviour
File.Copy(GetFullPath(depen), targetFolder + "/" + depen); File.Copy(GetFullPath(depen), targetFolder + "/" + depen);
} }
else else
Debug.Log("未找到" + file.path + "的依赖:" + depen); Debug.LogError($"未找到 {file.path} 的依赖:{depen}");
} }
} }
else if (type == AssetType.MonsterCutin) else if (type == AssetType.MonsterCutin)
{ {
if (file.name.Contains("/sd/")) if (file.name.Contains(LABEL_SD))
if (pathStore.Contains("Windows")) if (pathStore.Contains("Windows"))
continue; continue;
if (!Directory.Exists(pathStore + "MonsterCutin")) if (!Directory.Exists(pathStore + "MonsterCutin"))
...@@ -448,7 +457,7 @@ public class AssetBundleRobber : MonoBehaviour ...@@ -448,7 +457,7 @@ public class AssetBundleRobber : MonoBehaviour
var targetFolder = pathStore + "MonsterCutin/" + subDir; var targetFolder = pathStore + "MonsterCutin/" + subDir;
if (!Directory.Exists(targetFolder)) if (!Directory.Exists(targetFolder))
Directory.CreateDirectory(targetFolder); Directory.CreateDirectory(targetFolder);
File.Copy(GetFullPath(file.path), targetFolder + "/" + file.path); File.Copy(GetFullPath(file.path), Path.Combine(targetFolder, file.path));
var depens = new List<string>(file.dependencies); var depens = new List<string>(file.dependencies);
foreach (string depen in depens) foreach (string depen in depens)
{ {
...@@ -458,28 +467,28 @@ public class AssetBundleRobber : MonoBehaviour ...@@ -458,28 +467,28 @@ public class AssetBundleRobber : MonoBehaviour
File.Copy(GetFullPath(depen), targetFolder + "/" + depen); File.Copy(GetFullPath(depen), targetFolder + "/" + depen);
} }
else else
Debug.Log("未找到" + file.path + "的依赖:" + depen + ": " + GetFullPath(depen)); Debug.LogError($"未找到 {file.path} 的依赖:{depen}");
} }
} }
else if (type == AssetType.SpecialWin) else if (type == AssetType.SpecialWin)
{ {
if (file.name.Contains("/sd/")) if (file.name.Contains(LABEL_SD))
if (pathStore.Contains("Windows")) if (pathStore.Contains("Windows"))
continue; continue;
if (!Directory.Exists(pathStore + "SpecialWin")) if (!Directory.Exists(pathStore + "SpecialWin"))
Directory.CreateDirectory(pathStore + "SpecialWin"); Directory.CreateDirectory(pathStore + "SpecialWin");
string subDir = Regex.Split(file.name, "/")[8]; string subDir = Regex.Split(file.name, "/")[8];
if (subDir.Contains(".prefab"))//4027 艾克佐迪亚 if (subDir.Contains(EXTENSION_PREFAB))//4027 艾克佐迪亚
{ {
subDir = subDir.Replace(".prefab", "").Replace("summonspecialwin", ""); subDir = subDir.Replace(EXTENSION_PREFAB, string.Empty).Replace("summonspecialwin", string.Empty);
} }
else else
subDir = subDir.Replace("p", ""); subDir = subDir.Replace("p", string.Empty);
subDir = GetYdkID(subDir); subDir = GetYdkID(subDir);
var targetFolder = pathStore + "SpecialWin/" + subDir; var targetFolder = pathStore + "SpecialWin/" + subDir;
if (!Directory.Exists(targetFolder)) if (!Directory.Exists(targetFolder))
Directory.CreateDirectory(targetFolder); Directory.CreateDirectory(targetFolder);
File.Copy(GetFullPath(file.path), targetFolder + "/" + subDir); File.Copy(GetFullPath(file.path), Path.Combine(targetFolder, file.path));
var depens = new List<string>(file.dependencies); var depens = new List<string>(file.dependencies);
foreach (string depen in depens) foreach (string depen in depens)
{ {
...@@ -489,42 +498,42 @@ public class AssetBundleRobber : MonoBehaviour ...@@ -489,42 +498,42 @@ public class AssetBundleRobber : MonoBehaviour
File.Copy(GetFullPath(depen), targetFolder + "/" + depen); File.Copy(GetFullPath(depen), targetFolder + "/" + depen);
} }
else else
Debug.Log("未找到" + file.path + "的依赖:" + depen + ": " + GetFullPath(depen)); Debug.LogError($"未找到 {file.path} 的依赖:{depen}");
} }
} }
else if (type == AssetType.BGM) else if (type == AssetType.BGM)
{ {
if (!Directory.Exists(pathStore + "Sound/BGM")) if (!Directory.Exists(pathStore + "Sound/BGM"))
Directory.CreateDirectory(pathStore + "Sound/BGM"); Directory.CreateDirectory(pathStore + "Sound/BGM");
var targetName = pathStore + "Sound/BGM/" + Path.GetFileName(file.name).Replace(".wav", ""); var targetName = pathStore + "Sound/BGM/" + Path.GetFileName(file.name).Replace(EXTENSION_WAV, string.Empty);
File.Copy(GetFullPath(file.path), targetName); File.Copy(GetFullPath(file.path), targetName);
} }
else if (type == AssetType.SE_DUEL) else if (type == AssetType.SE_DUEL)
{ {
if (!Directory.Exists(pathStore + "Sound/SE_DUEL")) if (!Directory.Exists(pathStore + "Sound/SE_DUEL"))
Directory.CreateDirectory(pathStore + "Sound/SE_DUEL"); Directory.CreateDirectory(pathStore + "Sound/SE_DUEL");
var targetName = pathStore + "Sound/SE_DUEL/" + Path.GetFileName(file.name).Replace(".wav", ""); var targetName = pathStore + "Sound/SE_DUEL/" + Path.GetFileName(file.name).Replace(EXTENSION_WAV, string.Empty);
File.Copy(GetFullPath(file.path), targetName); File.Copy(GetFullPath(file.path), targetName);
} }
else if (type == AssetType.SE_FIELD) else if (type == AssetType.SE_FIELD)
{ {
if (!Directory.Exists(pathStore + "Sound/SE_FIELD")) if (!Directory.Exists(pathStore + "Sound/SE_FIELD"))
Directory.CreateDirectory(pathStore + "Sound/SE_FIELD"); Directory.CreateDirectory(pathStore + "Sound/SE_FIELD");
var targetName = pathStore + "Sound/SE_FIELD/" + Path.GetFileName(file.name).Replace(".wav", ""); var targetName = pathStore + "Sound/SE_FIELD/" + Path.GetFileName(file.name).Replace(EXTENSION_WAV, string.Empty);
File.Copy(GetFullPath(file.path), targetName); File.Copy(GetFullPath(file.path), targetName);
} }
else if (type == AssetType.SE_MATE) else if (type == AssetType.SE_MATE)
{ {
if (!Directory.Exists(pathStore + "Sound/SE_MATE")) if (!Directory.Exists(pathStore + "Sound/SE_MATE"))
Directory.CreateDirectory(pathStore + "Sound/SE_MATE"); Directory.CreateDirectory(pathStore + "Sound/SE_MATE");
var targetName = pathStore + "Sound/SE_MATE/" + Path.GetFileName(file.name).Replace(".wav", ""); var targetName = pathStore + "Sound/SE_MATE/" + Path.GetFileName(file.name).Replace(EXTENSION_WAV, string.Empty);
File.Copy(GetFullPath(file.path), targetName); File.Copy(GetFullPath(file.path), targetName);
} }
else if (type == AssetType.SE_SYS) else if (type == AssetType.SE_SYS)
{ {
if (!Directory.Exists(pathStore + "Sound/SE_SYS")) if (!Directory.Exists(pathStore + "Sound/SE_SYS"))
Directory.CreateDirectory(pathStore + "Sound/SE_SYS"); Directory.CreateDirectory(pathStore + "Sound/SE_SYS");
var targetName = pathStore + "Sound/SE_SYS/" + Path.GetFileName(file.name).Replace(".wav", ""); var targetName = pathStore + "Sound/SE_SYS/" + Path.GetFileName(file.name).Replace(EXTENSION_WAV, string.Empty);
try try
{ {
File.Copy(GetFullPath(file.path), targetName); File.Copy(GetFullPath(file.path), targetName);
...@@ -535,42 +544,251 @@ public class AssetBundleRobber : MonoBehaviour ...@@ -535,42 +544,251 @@ public class AssetBundleRobber : MonoBehaviour
} }
} }
//Icons
else if(type == AssetType.AvatarStandIcon)
{
if (!Directory.Exists(pathStore + "Icon/AvatarBase/SD"))
Directory.CreateDirectory(pathStore + "Icon/AvatarBase/SD");
var targetName = pathStore + "Icon/AvatarBase/SD/"
+ Path.GetFileName(file.name).Replace(EXTENSION_PNG, string.Empty).Replace("fieldavatarbaseicon", "FieldAvatarBaseIcon");
if (!File.Exists(targetName))
File.Copy(GetFullPath(file.path), targetName);
}
else if (type == AssetType.AvatarStandIconHD)
{
if (!Directory.Exists(pathStore + "Icon/AvatarBase/HD"))
Directory.CreateDirectory(pathStore + "Icon/AvatarBase/HD");
var targetName = pathStore + "Icon/AvatarBase/HD/"
+ Path.GetFileName(file.name).Replace(EXTENSION_PNG, string.Empty).Replace("fieldavatarbaseicon", "FieldAvatarBaseIcon");
if (!File.Exists(targetName))
File.Copy(GetFullPath(file.path), targetName);
}
else if(type == AssetType.DeckCaseIcon)
{
if (!Directory.Exists(pathStore + "Icon/DeckCase"))
Directory.CreateDirectory(pathStore + "Icon/DeckCase");
var targetName = pathStore + "Icon/DeckCase/"
+ Path.GetFileName(file.name).Replace(EXTENSION_PNG, string.Empty).Replace("deckcase", "DeckCase");
if (!File.Exists(targetName))
File.Copy(GetFullPath(file.path), targetName);
}
else if(type == AssetType.DeckCaseL
|| type == AssetType.DeckCaseOpen
|| type == AssetType.DeckCaseReverse)
{
if (!Directory.Exists(pathStore + "Icon/DeckCase/SD"))
Directory.CreateDirectory(pathStore + "Icon/DeckCase/SD");
var targetName = pathStore + "Icon/DeckCase/SD/"
+ Path.GetFileName(file.name)
.Replace(EXTENSION_PNG, string.Empty)
.Replace("deckcase", "DeckCase")
.Replace("_open", "_Open")
.Replace("_l", "_L");
if (!File.Exists(targetName))
File.Copy(GetFullPath(file.path), targetName);
}
else if (type == AssetType.DeckCaseLHD
|| type == AssetType.DeckCaseOpenHD
|| type == AssetType.DeckCaseReverseHD)
{
if (!Directory.Exists(pathStore + "Icon/DeckCase/HD"))
Directory.CreateDirectory(pathStore + "Icon/DeckCase/HD");
var targetName = pathStore + "Icon/DeckCase/HD/"
+ Path.GetFileName(file.name)
.Replace(EXTENSION_PNG, string.Empty)
.Replace("deckcase", "DeckCase")
.Replace("_open", "_Open")
.Replace("_l", "_L");
if (!File.Exists(targetName))
File.Copy(GetFullPath(file.path), targetName);
}
else if(type == AssetType.MatIcon)
{
if (!Directory.Exists(pathStore + "Icon/Field/SD"))
Directory.CreateDirectory(pathStore + "Icon/Field/SD");
var targetName = pathStore + "Icon/Field/SD/"
+ Path.GetFileName(file.name)
.Replace(EXTENSION_PNG, string.Empty)
.Replace("fieldicon", "FieldIcon");
if (!File.Exists(targetName))
File.Copy(GetFullPath(file.path), targetName);
}
else if (type == AssetType.MatIconHD)
{
if (!Directory.Exists(pathStore + "Icon/Field/HD"))
Directory.CreateDirectory(pathStore + "Icon/Field/HD");
var targetName = pathStore + "Icon/Field/HD/"
+ Path.GetFileName(file.name)
.Replace(EXTENSION_PNG, string.Empty)
.Replace("fieldicon", "FieldIcon");
if (!File.Exists(targetName))
File.Copy(GetFullPath(file.path), targetName);
}
else if (type == AssetType.GraveIcon)
{
if (!Directory.Exists(pathStore + "Icon/Grave/SD"))
Directory.CreateDirectory(pathStore + "Icon/Grave/SD");
var targetName = pathStore + "Icon/Grave/SD/"
+ Path.GetFileName(file.name)
.Replace(EXTENSION_PNG, string.Empty)
.Replace("fieldobjicon", "FieldObjIcon");
if (!File.Exists(targetName))
File.Copy(GetFullPath(file.path), targetName);
}
else if (type == AssetType.GraveIconHD)
{
if (!Directory.Exists(pathStore + "Icon/Grave/HD"))
Directory.CreateDirectory(pathStore + "Icon/Grave/HD");
var targetName = pathStore + "Icon/Grave/HD/"
+ Path.GetFileName(file.name)
.Replace(EXTENSION_PNG, string.Empty)
.Replace("fieldobjicon", "FieldObjIcon");
if (!File.Exists(targetName))
File.Copy(GetFullPath(file.path), targetName);
}
else if(type == AssetType.MateIcon)
{
if (!Directory.Exists(pathStore + "Icon/Mate"))
Directory.CreateDirectory(pathStore + "Icon/Mate");
var targetName = pathStore + "Icon/Mate/"
+ Path.GetFileName(file.name)
.Replace(EXTENSION_PNG, string.Empty);
if (!File.Exists(targetName))
File.Copy(GetFullPath(file.path), targetName);
}
else if(type == AssetType.ProfileIcon)
{
if (!Directory.Exists(pathStore + "Icon/ProfileIcon"))
Directory.CreateDirectory(pathStore + "Icon/ProfileIcon");
var targetName = pathStore + "Icon/ProfileIcon/"
+ Path.GetFileName(file.name)
.Replace(EXTENSION_PNG, string.Empty)
.Replace("profileicon", "ProfileIcon");
if (!File.Exists(targetName))
File.Copy(GetFullPath(file.path), targetName);
}
else if (type == AssetType.ProfileIconL)
{
if (!Directory.Exists(pathStore + "Icon/ProfileIcon/SD"))
Directory.CreateDirectory(pathStore + "Icon/ProfileIcon/SD");
var targetName = pathStore + "Icon/ProfileIcon/SD/"
+ Path.GetFileName(file.name)
.Replace(EXTENSION_PNG, string.Empty)
.Replace("profileicon", "ProfileIcon")
.Replace("_l", "_L");
if (!File.Exists(targetName))
File.Copy(GetFullPath(file.path), targetName);
}
else if (type == AssetType.ProfileIconLHD)
{
if (!Directory.Exists(pathStore + "Icon/ProfileIcon/HD"))
Directory.CreateDirectory(pathStore + "Icon/ProfileIcon/HD");
var targetName = pathStore + "Icon/ProfileIcon/HD/"
+ Path.GetFileName(file.name)
.Replace(EXTENSION_PNG, string.Empty)
.Replace("profileicon", "ProfileIcon")
.Replace("_l", "_L");
if (!File.Exists(targetName))
File.Copy(GetFullPath(file.path), targetName);
}
else if(type == AssetType.WallpaperIcon)
{
if (!Directory.Exists(pathStore + "Icon/Wallpaper"))
Directory.CreateDirectory(pathStore + "Icon/Wallpaper");
var targetName = pathStore + "Icon/Wallpaper/"
+ Path.GetFileName(file.name)
.Replace(EXTENSION_PNG, string.Empty)
.Replace("wallpapericon", "WallPaperIcon");
if (!File.Exists(targetName))
File.Copy(GetFullPath(file.path), targetName);
}
else if(type == AssetType.FrameIcon)
{
if (!Directory.Exists(pathStore + "Icon/ProfileFrame"))
Directory.CreateDirectory(pathStore + "Icon/ProfileFrame");
var targetName = pathStore + "Icon/ProfileFrame/"
+ Path.GetFileName(file.name)
.Replace(EXTENSION_PNG, string.Empty)
.Replace("profileframe", "ProfileFrame");
if (!File.Exists(targetName))
File.Copy(GetFullPath(file.path), targetName);
}
else if (type == AssetType.FrameL)
{
if (!Directory.Exists(pathStore + "Icon/ProfileFrame/SD"))
Directory.CreateDirectory(pathStore + "Icon/ProfileFrame/SD");
var targetName = pathStore + "Icon/ProfileFrame/SD/"
+ Path.GetFileName(file.name)
.Replace(EXTENSION_PNG, string.Empty)
.Replace("profileframe", "ProfileFrame")
.Replace("_l", "_L");
if (!File.Exists(targetName))
File.Copy(GetFullPath(file.path), targetName);
}
else if (type == AssetType.FrameLHD)
{
if (!Directory.Exists(pathStore + "Icon/ProfileFrame/HD"))
Directory.CreateDirectory(pathStore + "Icon/ProfileFrame/HD");
var targetName = pathStore + "Icon/ProfileFrame/HD/"
+ Path.GetFileName(file.name)
.Replace(EXTENSION_PNG, string.Empty)
.Replace("profileframe", "ProfileFrame")
.Replace("_l", "_L");
if (!File.Exists(targetName))
File.Copy(GetFullPath(file.path), targetName);
}
text.text = "Copying: " + currentFileCount + "/" + fileCount; text.text = "Copying: " + currentFileCount + "/" + fileCount;
yield return null; yield return null;
} }
text.text = "Copy Complete."; text.text = "Copy Complete.";
} }
string prefix = "assets/resourcesassetbundle"; private const string prefix = "assets/resourcesassetbundle";
private const string LABEL_SD = "/sd/";
private const string LABEL_HD = "/highend_hd/";
private const string EXTENSION_PNG = ".png";
private const string EXTENSION_PREFAB = ".prefab";
private const string EXTENSION_WAV = ".wav";
private const string EXTENSION_MAT = ".mat";
AssetType GetAssetType(string name) private AssetType GetAssetType(string name)
{ {
if (!name.StartsWith(prefix)) if (!name.StartsWith(prefix))
return AssetType.None; return AssetType.None;
if (name.Contains("/duel/bg/avatarstand/")) if (name.Contains("/duel/bg/avatarstand/"))
{ {
if (name.EndsWith(".prefab")) if (name.EndsWith(EXTENSION_PREFAB))
return AssetType.AvatarStand; return AssetType.AvatarStand;
} }
else if (name.Contains("/images/profileframe/")) else if (name.Contains("/images/profileframe/"))
{ {
if (name.EndsWith(".mat")) if (name.EndsWith(EXTENSION_MAT))
return AssetType.Frame; return AssetType.FrameMat;
else if (name.EndsWith(EXTENSION_PNG))
{
if (name.Contains(LABEL_HD))
return AssetType.FrameLHD;
else if (name.Contains(LABEL_SD))
return AssetType.FrameL;
else
return AssetType.FrameIcon;
}
} }
else if (name.Contains("/duel/bg/grave/")) else if (name.Contains("/duel/bg/grave/"))
{ {
if (name.EndsWith(".prefab")) if (name.EndsWith(EXTENSION_PREFAB))
return AssetType.Grave; return AssetType.Grave;
} }
else if (name.Contains("/duel/bg/mat/")) else if (name.Contains("/duel/bg/mat/"))
{ {
if (name.EndsWith(".prefab")) if (name.EndsWith(EXTENSION_PREFAB))
return AssetType.Mat; return AssetType.Mat;
} }
else if (name.Contains("/mate/")) else if (name.Contains("/mate/"))
{ {
if (name.EndsWith(".prefab")) if (name.EndsWith(EXTENSION_PREFAB))
return AssetType.Mate; return AssetType.Mate;
} }
else if (name.Contains("/protector/")) else if (name.Contains("/protector/"))
...@@ -580,70 +798,170 @@ public class AssetBundleRobber : MonoBehaviour ...@@ -580,70 +798,170 @@ public class AssetBundleRobber : MonoBehaviour
} }
else if (name.Contains("/wallpaper/")) else if (name.Contains("/wallpaper/"))
{ {
if (name.EndsWith(".prefab")) if (name.EndsWith(EXTENSION_PREFAB))
return AssetType.Wallpaper; return AssetType.Wallpaper;
else if (name.EndsWith(EXTENSION_PNG) && name.Contains("wallpapericon"))
return AssetType.WallpaperIcon;
} }
else if (name.Contains("/prefabs/outgamebg/back/")) else if (name.Contains("/prefabs/outgamebg/back/"))
{ {
if (name.EndsWith(".prefab")) if (name.EndsWith(EXTENSION_PREFAB))
return AssetType.Background; return AssetType.Background;
} }
else if (name.Contains("/duel/timeline/card/")) else if (name.Contains("/duel/timeline/card/"))
{ {
if (name.EndsWith(".prefab")) if (name.EndsWith(EXTENSION_PREFAB))
return AssetType.Card; return AssetType.Card;
} }
else if (name.Contains("/duel/timeline/duel/monstercutin/")) else if (name.Contains("/duel/timeline/duel/monstercutin/"))
{ {
if (name.EndsWith(".prefab")) if (name.EndsWith(EXTENSION_PREFAB))
return AssetType.MonsterCutin; return AssetType.MonsterCutin;
} }
else if (name.Contains("/duel/timeline/duel/universal/summon/summonspecialwin/")) else if (name.Contains("/duel/timeline/duel/universal/summon/summonspecialwin/"))
{ {
if (name.EndsWith(".prefab")) if (name.EndsWith(EXTENSION_PREFAB))
if (Path.GetFileName(name).Contains("summonspecialwin")) if (Path.GetFileName(name).Contains("summonspecialwin"))
return AssetType.SpecialWin; return AssetType.SpecialWin;
} }
else if (name.Contains("/bgm/")) else if (name.Contains("/bgm/"))
{ {
if (name.EndsWith(".wav")) if (name.EndsWith(EXTENSION_WAV))
return AssetType.BGM; return AssetType.BGM;
} }
else if (name.Contains("/se_duel/")) else if (name.Contains("/se_duel/"))
{ {
if (name.EndsWith(".wav")) if (name.EndsWith(EXTENSION_WAV))
return AssetType.SE_DUEL; return AssetType.SE_DUEL;
} }
else if (name.Contains("/se_field/")) else if (name.Contains("/se_field/"))
{ {
if (name.EndsWith(".wav")) if (name.EndsWith(EXTENSION_WAV))
return AssetType.SE_FIELD; return AssetType.SE_FIELD;
} }
else if (name.Contains("/se_mate/")) else if (name.Contains("/se_mate/"))
{ {
if (name.EndsWith(".wav")) if (name.EndsWith(EXTENSION_WAV))
return AssetType.SE_MATE; return AssetType.SE_MATE;
} }
else if (name.Contains("/se_sys/")) else if (name.Contains("/se_sys/"))
{ {
if (name.EndsWith(".wav")) if (name.EndsWith(EXTENSION_WAV))
return AssetType.SE_SYS; return AssetType.SE_SYS;
} }
//Icons
else if (name.StartsWith("assets/resourcesassetbundle/images/fieldavatarbase/"))
{
if (name.EndsWith(EXTENSION_PNG))
{
if (name.Contains(LABEL_HD))
return AssetType.AvatarStandIconHD;
else if (name.Contains(LABEL_SD))
return AssetType.AvatarStandIcon;
}
}
else if (name.StartsWith("assets/resourcesassetbundle/images/deckcase/"))
{
if (name.EndsWith(EXTENSION_PNG))
{
if (name.Contains(LABEL_HD))
{
if (name.EndsWith("_l_reverse.png"))
return AssetType.DeckCaseReverseHD;
else if (name.EndsWith("_open_l.png"))
return AssetType.DeckCaseOpenHD;
else if (name.EndsWith("_l.png"))
return AssetType.DeckCaseLHD;
}
else if (name.Contains(LABEL_SD))
{
if (name.EndsWith("_l_reverse.png"))
return AssetType.DeckCaseReverse;
else if (name.EndsWith("_open_l.png"))
return AssetType.DeckCaseOpen;
else if (name.EndsWith("_l.png"))
return AssetType.DeckCaseL;
}
else
return AssetType.DeckCaseIcon;
}
}
else if (name.StartsWith("assets/resourcesassetbundle/images/field/"))
{
if (name.EndsWith(EXTENSION_PNG))
{
if (name.Contains(LABEL_HD))
return AssetType.MatIconHD;
else if (name.Contains(LABEL_SD))
return AssetType.MatIcon;
}
}
else if (name.StartsWith("assets/resourcesassetbundle/images/fieldobj/"))
{
if (name.EndsWith(EXTENSION_PNG))
{
if (name.Contains(LABEL_HD))
return AssetType.GraveIconHD;
else if (name.Contains(LABEL_SD))
return AssetType.GraveIcon;
}
}
else if (name.StartsWith("assets/resourcesassetbundle/mate/"))
{
if (name.EndsWith(EXTENSION_PNG))
{
return AssetType.MateIcon;
}
}
else if (name.StartsWith("assets/resourcesassetbundle/images/profileicon/"))
{
if (name.EndsWith(EXTENSION_PNG))
{
if (name.EndsWith("_l.png") && name.Contains(LABEL_HD))
return AssetType.ProfileIconLHD;
else if (name.EndsWith("_l.png") && name.Contains(LABEL_SD))
return AssetType.ProfileIconL;
else
return AssetType.ProfileIcon;
}
}
return AssetType.None; return AssetType.None;
} }
public enum AssetType public enum AssetType
{ {
None, None,
AvatarStand, AvatarStand,
AvatarStandIcon,
AvatarStandIconHD,
Card, Card,
Frame, DeckCaseIcon,
DeckCaseL,
DeckCaseLHD,
DeckCaseReverse,
DeckCaseReverseHD,
DeckCaseOpen,
DeckCaseOpenHD,
FrameIcon,
FrameL,
FrameLHD,
FrameMat,
Grave, Grave,
GraveIcon,
GraveIconHD,
Mat, Mat,
MatIcon,
MatIconHD,
Mate, Mate,
MateIcon,
ProfileIcon,
ProfileIconL,
ProfileIconLHD,
MonsterCutin, MonsterCutin,
Protector, Protector,
Wallpaper, Wallpaper,
WallpaperIcon,
Background, Background,
SpecialWin, SpecialWin,
BGM, BGM,
...@@ -653,7 +971,36 @@ public class AssetBundleRobber : MonoBehaviour ...@@ -653,7 +971,36 @@ public class AssetBundleRobber : MonoBehaviour
SE_SYS SE_SYS
} }
List<string> GetDependencies(string fileName, List<string> parentDepends = null) private bool AssetIsIcon(AssetType type)
{
return type switch
{
AssetType.AvatarStandIcon => true,
AssetType.AvatarStandIconHD => true,
AssetType.DeckCaseIcon => true,
AssetType.DeckCaseL => true,
AssetType.DeckCaseLHD => true,
AssetType.DeckCaseReverse => true,
AssetType.DeckCaseReverseHD => true,
AssetType.DeckCaseOpen => true,
AssetType.DeckCaseOpenHD => true,
AssetType.FrameIcon => true,
AssetType.FrameL => true,
AssetType.FrameLHD => true,
AssetType.GraveIcon => true,
AssetType.GraveIconHD => true,
AssetType.MatIcon => true,
AssetType.MatIconHD => true,
AssetType.MateIcon => true,
AssetType.ProfileIcon => true,
AssetType.ProfileIconL => true,
AssetType.ProfileIconLHD => true,
AssetType.WallpaperIcon => true,
_ => false,
};
}
private List<string> GetDependencies(string fileName, List<string> parentDepends = null)
{ {
byte[] bytes = Decompress(fileName); byte[] bytes = Decompress(fileName);
List<int> dependencyPositions = new List<int>(); List<int> dependencyPositions = new List<int>();
...@@ -727,7 +1074,7 @@ public class AssetBundleRobber : MonoBehaviour ...@@ -727,7 +1074,7 @@ public class AssetBundleRobber : MonoBehaviour
return dependencies; return dependencies;
} }
byte[] Decompress(string path) private byte[] Decompress(string path)
{ {
var manager = new AssetsTools.NET.Extra.AssetsManager(); var manager = new AssetsTools.NET.Extra.AssetsManager();
if (!File.Exists(GetFullPath(path))) if (!File.Exists(GetFullPath(path)))
...@@ -742,12 +1089,12 @@ public class AssetBundleRobber : MonoBehaviour ...@@ -742,12 +1089,12 @@ public class AssetBundleRobber : MonoBehaviour
return bundleStream.GetBuffer(); return bundleStream.GetBuffer();
} }
string GetYdkID(string mdID) private string GetYdkID(string mdID)
{ {
return MDPro3.Cid2Ydk.GetYDK(int.Parse(mdID)).ToString(); return MDPro3.Cid2Ydk.GetYDK(int.Parse(mdID)).ToString();
} }
string GetFullPath(string path) private string GetFullPath(string path)
{ {
if (path.Length <= 2) if (path.Length <= 2)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment