public static List <ExcelData.Param> LoadExcelData( string assetBunndlePath, string assetName, int cellS, int rowS) { if (!AssetBundleCheck.IsFile(assetBunndlePath, assetName)) { OutputLog.Error(string.Format("ExcelData:{0}がない", (object)assetName), false, "Log"); return((List <ExcelData.Param>)null); } AssetBundleLoadAssetOperation loadAssetOperation = AssetBundleManager.LoadAsset(assetBunndlePath, assetName, typeof(ExcelData), (string)null); AssetBundleManager.UnloadAssetBundle(assetBunndlePath, true, (string)null, false); if (loadAssetOperation.IsEmpty()) { OutputLog.Error(string.Format("ExcelData:{0}がない?", (object)assetName), false, "Log"); return((List <ExcelData.Param>)null); } ExcelData asset = loadAssetOperation.GetAsset <ExcelData>(); int cell = asset.MaxCell - 1; int row = asset.list[cell].list.Count - 1; return(asset.Get(new ExcelData.Specify(cellS, rowS), new ExcelData.Specify(cell, row))); }
public static T ManualLoadAsset <T>(AssetBundleInfo assetBundleInfo) where T : UnityEngine.Object { if (!AssetBundleCheck.IsFile(assetBundleInfo.assetbundle)) { Logger.LogWarning($"AssetLoader: No such asset bundle: {assetBundleInfo.assetbundle}"); return(null); } var loaders = new Loader <T> .AssetBundleInfoLoader[] { #if AI Loader <T> .AssetUtilityLoader, #endif Loader <T> .DefaultLoader }; foreach (var forceUnload in new[] { false, true }) { foreach (var loader in loaders) { if (TryLoader <T>(() => loader(assetBundleInfo), loader.Method.Name, assetBundleInfo.assetbundle, assetBundleInfo.asset, forceUnload, out var result)) { return(result); } } } return(null); }
public static Sprite LoadSpriteAsset( string assetBundleName, string assetName, string manifestName) { manifestName = !manifestName.IsNullOrEmpty() ? manifestName : (string)null; if (AssetBundleCheck.IsSimulation) { manifestName = string.Empty; } if (!AssetBundleCheck.IsFile(assetBundleName, assetName)) { Debug.LogWarning((object)string.Format("読み込みエラー\r\nassetBundleName:{0}\tassetName:{1}", (object)assetBundleName, (object)assetName)); return((Sprite)null); } AssetBundleLoadAssetOperation loadAssetOperation = AssetBundleManager.LoadAsset(assetBundleName, assetName, typeof(Sprite), !manifestName.IsNullOrEmpty() ? manifestName : (string)null); Sprite asset1 = loadAssetOperation.GetAsset <Sprite>(); if (Object.op_Equality((Object)asset1, (Object)null)) { Texture2D asset2 = loadAssetOperation.GetAsset <Texture2D>(); if (Object.op_Equality((Object)asset2, (Object)null)) { return((Sprite)null); } asset1 = Sprite.Create(asset2, new Rect(0.0f, 0.0f, (float)((Texture)asset2).get_width(), (float)((Texture)asset2).get_height()), Vector2.get_zero()); } return(asset1); }
public static void IsFileHook2(ref bool __result, AssetBundleData __instance) { if (ResourceRedirector.EmulationEnabled && __result == false) { string dir = Path.Combine(ResourceRedirector.EmulatedDir, __instance.bundle.Replace('/', '\\').Replace(".unity3d", "")); if (Directory.Exists(dir)) { __result = true; } } //Redirect KK vanilla assets to EC vanilla assets if (__result == false && __instance.bundle.EndsWith(".unity3d") && __instance.bundle.StartsWith("chara/")) { string temp = __instance.bundle.Replace(".unity3d", ""); if (temp.Length >= 2) { temp = temp.Substring(temp.Length - 2, 2); if (int.TryParse(temp, out _)) { if (__instance.bundle.StartsWith("chara/thumb/") && !__instance.bundle.StartsWith($"chara/thumb/{temp}/")) { temp = __instance.bundle.Replace("chara/thumb/", $"chara/thumb/{temp}/"); __result = AssetBundleCheck.IsFile(temp); } else if (!__instance.bundle.StartsWith($"chara/{temp}/") && !__instance.bundle.StartsWith($"chara/{temp}/")) { temp = __instance.bundle.Replace("chara/", $"chara/{temp}/"); __result = AssetBundleCheck.IsFile(temp); } } } } }
public static T LoadAsset <T>( string assetBundleName, string assetName, bool clone = false, string manifestName = "") where T : Object { if (AssetBundleCheck.IsSimulation) { manifestName = string.Empty; } if (!AssetBundleCheck.IsFile(assetBundleName, assetName)) { Debug.LogWarning((object)("読み込みエラー\r\nassetBundleName:" + assetBundleName + "\tassetName:" + assetName)); return((T)null); } AssetBundleLoadAssetOperation loadAssetOperation = AssetBundleManager.LoadAsset(assetBundleName, assetName, typeof(T), !manifestName.IsNullOrEmpty() ? manifestName : (string)null); if (loadAssetOperation.IsEmpty()) { Debug.LogError((object)("読み込みエラー\r\nassetName:" + assetName)); return((T)null); } T obj1 = loadAssetOperation.GetAsset <T>(); if (Object.op_Inequality((Object)null, (Object)(object)obj1) && clone) { T obj2 = Object.Instantiate <T>(obj1); obj2.set_name(obj1.get_name()); obj1 = obj2; } return(obj1); }
public static string LoadAllListText(List <string> _lstAssetBundleNames, string _strLoadFile) { StringBuilder stringBuilder = new StringBuilder(); for (int index1 = 0; index1 < _lstAssetBundleNames.Count; ++index1) { string[] allAssetName = AssetBundleCheck.GetAllAssetName(_lstAssetBundleNames[index1], false, (string)null, false); bool flag = false; for (int index2 = 0; index2 < allAssetName.Length; ++index2) { if (allAssetName[index2].Compare(_strLoadFile, true)) { flag = true; break; } } if (!flag) { GlobalMethod.DebugLog("[" + _lstAssetBundleNames[index1] + "][" + _strLoadFile + "]は見つかりません", 1); } else { TextAsset textAsset = CommonLib.LoadAsset <TextAsset>(_lstAssetBundleNames[index1], _strLoadFile, false, string.Empty); AssetBundleManager.UnloadAssetBundle(_lstAssetBundleNames[index1], true, (string)null, false); if (!Object.op_Equality((Object)textAsset, (Object)null)) { stringBuilder.Append(textAsset.get_text()); } } } return(stringBuilder.ToString()); }
private static void CheckPersonalityAndOverride(ChaFileControl chaFileControl) { switch (chaFileControl.parameter.personality) { case 30: //0727 Free DLC if (!AssetBundleCheck.IsFile("etcetra/list/config/14.unity3d")) { chaFileControl.parameter.personality = DefaultPersonality; } break; case 31: //0727 Paid DLC #1 if (!AssetBundleCheck.IsFile("etcetra/list/config/15.unity3d")) { chaFileControl.parameter.personality = DefaultPersonality; } break; case 32: //0727 Paid DLC #1 if (!AssetBundleCheck.IsFile("etcetra/list/config/16.unity3d")) { chaFileControl.parameter.personality = DefaultPersonality; } break; case 33: //0727 Paid DLC #1 if (!AssetBundleCheck.IsFile("etcetra/list/config/17.unity3d")) { chaFileControl.parameter.personality = DefaultPersonality; } break; case 34: case 35: case 36: case 37: //1221 Paid DLC #2 if (!AssetBundleCheck.IsFile("etcetra/list/config/20.unity3d")) { chaFileControl.parameter.personality = DefaultPersonality; } break; case 38: //EmotionCreators preorder bonus personality if (!AssetBundleCheck.IsFile("etcetra/list/config/50.unity3d")) { chaFileControl.parameter.personality = DefaultPersonality; } break; case 80: case 81: case 82: case 83: case 84: case 85: case 86: //Story character personalities added by a mod chaFileControl.parameter.personality = DefaultPersonality; break; } }
internal static void IsFileHookEC(string assetBundleName, string fileName, ref bool __result) { //Redirect KK vanilla assets to EC vanilla assets if (__result == false && assetBundleName.EndsWith(".unity3d") && assetBundleName.StartsWith("chara/")) { string temp = assetBundleName.Replace(".unity3d", ""); if (temp.Length >= 2) { temp = temp.Substring(temp.Length - 2, 2); if (int.TryParse(temp, out _)) { if (assetBundleName.StartsWith("chara/thumb/") && !assetBundleName.StartsWith($"chara/thumb/{temp}/")) { temp = assetBundleName.Replace("chara/thumb/", $"chara/thumb/{temp}/"); __result = AssetBundleCheck.IsFile(temp, fileName); } else if (!assetBundleName.StartsWith($"chara/{temp}/") && !assetBundleName.StartsWith($"chara/{temp}/")) { temp = assetBundleName.Replace("chara/", $"chara/{temp}/"); __result = AssetBundleCheck.IsFile(temp, fileName); } } } } }
internal static void IsFileHookEC2(ref bool __result, AssetBundleData __instance) { //Redirect KK vanilla assets to EC vanilla assets if (__result == false && __instance.bundle.EndsWith(".unity3d") && __instance.bundle.StartsWith("chara/")) { string temp = __instance.bundle.Replace(".unity3d", ""); if (temp.Length >= 2) { temp = temp.Substring(temp.Length - 2, 2); if (int.TryParse(temp, out _)) { if (__instance.bundle.StartsWith("chara/thumb/") && !__instance.bundle.StartsWith($"chara/thumb/{temp}/")) { temp = __instance.bundle.Replace("chara/thumb/", $"chara/thumb/{temp}/"); __result = AssetBundleCheck.IsFile(temp); } else if (!__instance.bundle.StartsWith($"chara/{temp}/") && !__instance.bundle.StartsWith($"chara/{temp}/")) { temp = __instance.bundle.Replace("chara/", $"chara/{temp}/"); __result = AssetBundleCheck.IsFile(temp); } } } } }
public static T ManualLoadAsset <T>(AssetBundleAddress assetBundleAddress) where T : UnityEngine.Object { T result = default; if (!AssetBundleCheck.IsFile(assetBundleAddress.AssetBundle)) { Logger.LogWarning($"AssetLoader: No such asset bundle: {assetBundleAddress.AssetBundle}"); return(result); } var loaders = new Loader <T> .AssetBundleAddressLoader[] { #if AI || HS2 Loader <T> .AddressAsInfoLoader, #else Loader <T> .DefaultLoader #endif }; foreach (var forceUnload in new[] { false, true }) { foreach (var loader in loaders) { if (TryLoader <T>(() => loader(assetBundleAddress), loader.Method.Name, assetBundleAddress.AssetBundle, assetBundleAddress.Asset, forceUnload, out result)) { return(result); } } } return(result); }
public void CreateBoneList(GameObject obj, string assetBundleName, string assetName) { this.dictBone.Clear(); if (!AssetBundleCheck.IsFile(assetBundleName, assetName)) { Debug.LogWarning((object)("読み込みエラー\r\nassetBundleName:" + assetBundleName + "\tassetName:" + assetName)); } else { AssetBundleLoadAssetOperation loadAssetOperation = AssetBundleManager.LoadAsset(assetBundleName, assetName, typeof(TextAsset), (string)null); if (loadAssetOperation.IsEmpty()) { Debug.LogError((object)("読み込みエラー\r\nassetName:" + assetName)); } else { string[,] data; YS_Assist.GetListString(loadAssetOperation.GetAsset <TextAsset>().get_text(), out data); int length1 = data.GetLength(0); int length2 = data.GetLength(1); if (length1 != 0 && length2 != 0) { for (int index = 0; index < length1; ++index) { GameObject loop = obj.get_transform().FindLoop(data[index, 0]); if (Object.op_Implicit((Object)loop)) { this.dictBone[data[index, 0]] = loop; } } } AssetBundleManager.UnloadAssetBundle(assetBundleName, true, (string)null, false); } } }
public static void InitializeList(ActionGame.ClassRoomCharaFile __instance) { Dictionary <int, ChaFileControl> chaFileDic = Traverse.Create(__instance).Field("chaFileDic").GetValue <Dictionary <int, ChaFileControl> >(); foreach (var x in chaFileDic) { switch (x.Value.parameter.personality) { case 30: //0727 Free DLC if (!AssetBundleCheck.IsFile("etcetra/list/config/14.unity3d")) { x.Value.parameter.personality = DefaultPersonality; } break; case 31: //0727 Paid DLC #1 if (!AssetBundleCheck.IsFile("etcetra/list/config/15.unity3d")) { x.Value.parameter.personality = DefaultPersonality; } break; case 32: //0727 Paid DLC #1 if (!AssetBundleCheck.IsFile("etcetra/list/config/16.unity3d")) { x.Value.parameter.personality = DefaultPersonality; } break; case 33: //0727 Paid DLC #1 if (!AssetBundleCheck.IsFile("etcetra/list/config/17.unity3d")) { x.Value.parameter.personality = DefaultPersonality; } break; case 34: case 35: case 36: case 37: //1221 Paid DLC #2 if (!AssetBundleCheck.IsFile("etcetra/list/config/20.unity3d")) { x.Value.parameter.personality = DefaultPersonality; } break; case 80: case 81: case 82: case 83: case 84: case 85: case 86: //Story character personalities added by a mod x.Value.parameter.personality = DefaultPersonality; break; } } }
int DumpCommunicationText() { HashSet <string> AllJPText = new HashSet <string>(); foreach (var AssetBundleName in CommonLib.GetAssetBundleNameListFromPath("communication")) { if (AssetBundleName.Contains("hit_")) { continue; } foreach (var AssetName in AssetBundleCheck.GetAllAssetName(AssetBundleName)) { var Asset = ManualLoadAsset <ExcelData>(AssetBundleName, AssetName, "abdata"); HashSet <string> JPText = new HashSet <string>(); foreach (var param in Asset.list) { if (15 <= param.list.Count && !param.list[15].IsNullOrEmpty() && param.list[15] != "テキスト") { AllJPText.Add($"//{param.list[15]}="); JPText.Add($"//{param.list[15]}="); } } if (JPText.Count > 0) { string FolderPath = Path.Combine(Paths.GameRootPath, "TextDump"); FolderPath = Path.Combine(FolderPath, AssetBundleName.Replace(".unity3d", "")); FolderPath = Path.Combine(FolderPath, AssetName.Replace(".asset", "")); FolderPath = FolderPath.Replace('/', '\\'); if (!Directory.Exists(FolderPath)) { Directory.CreateDirectory(FolderPath); } string FilePath = Path.Combine(FolderPath, "translation.txt"); if (File.Exists(FilePath)) { File.Delete(FilePath); } File.WriteAllLines(FilePath, JPText.ToArray()); } } } Logger.Log(LogLevel.Info, $"Total Communication unique lines:{AllJPText.Count}"); return(AllJPText.Count); }
public void LoadInfo( string manifest, string assetBundleName, string assetName, Action <string, string> funcAssetBundleEntry = null) { if (AssetBundleCheck.IsSimulation) { manifest = string.Empty; } if (!AssetBundleCheck.IsFile(assetBundleName, assetName)) { Debug.LogError((object)("読み込みエラー\r\nassetBundleName:" + assetBundleName + "\tassetName:" + assetName)); } else { AssetBundleLoadAssetOperation loadAssetOperation = AssetBundleManager.LoadAsset(assetBundleName, assetName, typeof(TextAsset), manifest); if (loadAssetOperation == null) { Debug.LogError((object)("読み込みエラー\r\nassetName:" + assetName)); } else { TextAsset asset = loadAssetOperation.GetAsset <TextAsset>(); if (Object.op_Equality((Object)null, (Object)asset)) { Debug.LogError((object)"ありえない"); } else { using (MemoryStream memoryStream = new MemoryStream()) { memoryStream.Write(asset.get_bytes(), 0, asset.get_bytes().Length); memoryStream.Seek(0L, SeekOrigin.Begin); this.LoadInfo((Stream)memoryStream); } if (funcAssetBundleEntry == null) { AssetBundleManager.UnloadAssetBundle(assetBundleName, true, (string)null, false); } else { funcAssetBundleEntry(assetBundleName, string.Empty); } } } } }
int DumpScenarioText() { HashSet <string> AllJPText = new HashSet <string>(); foreach (var AssetBundleName in CommonLib.GetAssetBundleNameListFromPath("adv/scenario", true)) { foreach (var AssetName in AssetBundleCheck.GetAllAssetName(AssetBundleName)) //.Where(x => x.StartsWith("personality_voice_")) { var Asset = ManualLoadAsset <ADV.ScenarioData>(AssetBundleName, AssetName, "abdata"); HashSet <string> JPText = new HashSet <string>(); foreach (var param in Asset.list) { if (param.Command == ADV.Command.Text) { if (1 <= param.Args.Length && !param.Args[1].IsNullOrEmpty()) { AllJPText.Add($"//{param.Args[1]}="); JPText.Add($"//{param.Args[1]}="); } } } if (JPText.Count > 0) { string FolderPath = Path.Combine(Paths.GameRootPath, "TextDump"); FolderPath = Path.Combine(FolderPath, AssetBundleName.Replace(".unity3d", "")); FolderPath = Path.Combine(FolderPath, AssetName.Replace(".asset", "")); FolderPath = FolderPath.Replace('/', '\\'); if (!Directory.Exists(FolderPath)) { Directory.CreateDirectory(FolderPath); } string FilePath = Path.Combine(FolderPath, "translation.txt"); if (File.Exists(FilePath)) { File.Delete(FilePath); } File.WriteAllLines(FilePath, JPText.ToArray()); } } } Logger.Log(LogLevel.Info, $"Total Scenario unique lines:{AllJPText.Count}"); return(AllJPText.Count); }
public static List <ExcelData.Param> LoadExcelDataAlFindlFile( string _strAssetPath, string _strFileName, int sCell, int sRow, int eCell, int eRow, List <string> _OmitFolderName = null, bool _isWarning = true) { GlobalMethod.lstABName.Clear(); GlobalMethod.lstABName = GlobalMethod.GetAssetBundleNameListFromPath(_strAssetPath, false); GlobalMethod.lstABName.Sort(); for (int index1 = 0; index1 < GlobalMethod.lstABName.Count; ++index1) { GlobalMethod.strNo.Clear(); GlobalMethod.strNo.Append(Path.GetFileNameWithoutExtension(GlobalMethod.lstABName[index1])); GlobalMethod.strNo.Replace(GlobalMethod.strNo.ToString(), YS_Assist.GetStringRight(GlobalMethod.strNo.ToString(), 2)); if (_OmitFolderName == null || !_OmitFolderName.Contains(GlobalMethod.strNo.ToString())) { string[] allAssetName = AssetBundleCheck.GetAllAssetName(GlobalMethod.lstABName[index1], false, (string)null, false); bool flag = false; for (int index2 = 0; index2 < allAssetName.Length; ++index2) { if (allAssetName[index2].Compare(_strFileName, true)) { flag = true; break; } } if (!flag) { GlobalMethod.DebugLog("[" + GlobalMethod.lstABName[index1] + "][" + _strFileName + "]は見つかりません", 1); } else { List <ExcelData.Param> objList = GlobalMethod.LoadExcelData(GlobalMethod.lstABName[index1], _strFileName, sCell, sRow, eCell, eRow, _isWarning); if (objList != null) { return(objList); } } } } return((List <ExcelData.Param>)null); }
public override void Do() { base.Do(); int num1 = 0; string[] args1 = this.args; int index1 = num1; int num2 = index1 + 1; string index2 = args1[index1]; string[] args2 = this.args; int index3 = num2; int num3 = index3 + 1; string bundle = args2[index3]; this.scenario.Vars[index2] = new ValData((object)AssetBundleCheck.IsManifestOrBundle(bundle)); }
public static T ManualLoadAsset <T>(string assetBundle, string assetName, string manifest = null) where T : UnityEngine.Object { T result = default; if (!AssetBundleCheck.IsFile(assetBundle)) { Logger.LogWarning($"AssetLoader: No such asset bundle: {assetBundle}"); return(result); } manifest = string.IsNullOrEmpty(manifest) ? null : manifest; var loaders = new Loader <T> .AssetBundleLoader[] { #if AI Loader <T> .AssetUtilityLoader, #endif #if HS2 Loader <T> .AddObjectAssistLoader, #endif Loader <T> .CommonLibLoader, #if AI || HS2 Loader <T> .AssetBundleManagerLoadAssetLoader, #endif Loader <T> .AssetBundleManagerLoader, #if HS2 Loader <T> .AssetBundleDataLoader, #endif Loader <T> .DefaultLoader }; foreach (var forceUnload in new[] { false /*, true*/ }) { foreach (var loader in loaders) { if (TryLoader <T>(() => loader(assetBundle, assetName, manifest), loader.Method.Name, assetBundle, assetName, forceUnload, out result)) { return(result); } } } return(result); }
public static bool AssetFileExist(string path, string targetName, string manifest = "") { bool flag = false; if (path.IsNullOrEmpty() || !AssetBundleCheck.IsFile(path, targetName)) { return(flag); } foreach (string self in AssetBundleCheck.GetAllAssetName(path, false, manifest, false)) { if (self.Compare(targetName, true)) { flag = true; break; } } return(flag); }
private Dictionary <string, string> BuildReplacementDictionary() { Dictionary <string, string> result = new Dictionary <string, string>(); List <string> assetBundleNames = CommonLib.GetAssetBundleNameListFromPath("adv/scenario", true); assetBundleNames.Sort(); foreach (var AssetBundleName in assetBundleNames) { List <string> AssetNameList = new List <string>(AssetBundleCheck.GetAllAssetName(AssetBundleName)); AssetNameList.Sort(); foreach (var AssetName in AssetNameList) { var Asset = ManualLoadAsset <ADV.ScenarioData>(AssetBundleName, AssetName, "abdata"); textResourceHelper.BuildReplacements(Asset.list).ToList().ForEach(x => result[BuildReplacementKey(AssetBundleName, x.Key)] = x.Value); } } return(result); }
public static List <T> LoadAllFolder <T>( string _findFolder, string _strLoadFile, List <string> _OmitFolderName = null) where T : Object { List <T> objList = new List <T>(); GlobalMethod.lstABName.Clear(); GlobalMethod.lstABName = GlobalMethod.GetAssetBundleNameListFromPath(_findFolder, false); GlobalMethod.lstABName.Sort(); for (int index1 = 0; index1 < GlobalMethod.lstABName.Count; ++index1) { string stringRight = YS_Assist.GetStringRight(Path.GetFileNameWithoutExtension(GlobalMethod.lstABName[index1]), 2); if (_OmitFolderName == null || !_OmitFolderName.Contains(stringRight)) { string[] allAssetName = AssetBundleCheck.GetAllAssetName(GlobalMethod.lstABName[index1], false, (string)null, false); bool flag = false; for (int index2 = 0; index2 < allAssetName.Length; ++index2) { if (allAssetName[index2].Compare(_strLoadFile, true)) { flag = true; break; } } if (!flag) { GlobalMethod.DebugLog("[" + GlobalMethod.lstABName[index1] + "][" + _strLoadFile + "]は見つかりません", 1); } else { T obj = CommonLib.LoadAsset <T>(GlobalMethod.lstABName[index1], _strLoadFile, false, string.Empty); AssetBundleManager.UnloadAssetBundle(GlobalMethod.lstABName[index1], true, (string)null, false); if (Object.op_Implicit((Object)(object)obj)) { objList.Add(obj); } } } } return(objList); }
public static AssetBundleLoadAssetOperation LoadFile <Type>( string _assetBundleName, string _assetName, string _manifest = "") { if (!AssetBundleCheck.IsFile(_assetBundleName, _assetName)) { Debug.LogError((object)("読み込みエラー\r\nassetBundleName:" + _assetBundleName + "\tassetName:" + _assetName)); return((AssetBundleLoadAssetOperation)null); } AssetBundleLoadAssetOperation loadAssetOperation = AssetBundleManager.LoadAsset(_assetBundleName, _assetName, typeof(Type), !_manifest.IsNullOrEmpty() ? _manifest : (string)null); if (loadAssetOperation != null) { return(loadAssetOperation); } Debug.LogError((object)string.Format("読み込みエラー\r\nassetName:{0}", (object)_assetName)); return((AssetBundleLoadAssetOperation)null); }
public override void Do() { base.Do(); int num1 = 0; string[] args1 = this.args; int index1 = num1; int num2 = index1 + 1; string str = args1[index1]; string[] args2 = this.args; int index2 = num2; int num3 = index2 + 1; string asset = args2[index2]; string[] args3 = this.args; int index3 = num3; int num4 = index3 + 1; bool flag = bool.Parse(args3[index3]); string[] args4 = this.args; int index4 = num4; int num5 = index4 + 1; bool isClearCheck = bool.Parse(args4[index4]); string[] args5 = this.args; int index5 = num5; int num6 = index5 + 1; bool isNext = bool.Parse(args5[index5]); if (str.IsNullOrEmpty()) { str = this.scenario.LoadBundleName; } if (!AssetBundleCheck.IsFile(str, string.Empty)) { str = Program.ScenarioBundle(str); } this.scenario.Vars["BundleFile"] = new ValData((object)str); this.scenario.Vars["AssetFile"] = new ValData((object)asset); this.scenario.LoadFile(str, asset, !flag, isClearCheck, isNext); }
public static string LoadAllListText( string _assetbundleFolder, string _strLoadFile, List <string> _OmitFolderName = null) { StringBuilder stringBuilder = new StringBuilder(); GlobalMethod.lstABName.Clear(); GlobalMethod.lstABName = GlobalMethod.GetAssetBundleNameListFromPath(_assetbundleFolder, false); GlobalMethod.lstABName.Sort(); for (int index1 = 0; index1 < GlobalMethod.lstABName.Count; ++index1) { string stringRight = YS_Assist.GetStringRight(Path.GetFileNameWithoutExtension(GlobalMethod.lstABName[index1]), 2); if (_OmitFolderName == null || !_OmitFolderName.Contains(stringRight)) { string[] allAssetName = AssetBundleCheck.GetAllAssetName(GlobalMethod.lstABName[index1], false, (string)null, false); bool flag = false; for (int index2 = 0; index2 < allAssetName.Length; ++index2) { if (allAssetName[index2].Compare(_strLoadFile, true)) { flag = true; break; } } if (!flag) { GlobalMethod.DebugLog("[" + GlobalMethod.lstABName[index1] + "][" + _strLoadFile + "]は見つかりません", 1); } else { TextAsset textAsset = CommonLib.LoadAsset <TextAsset>(GlobalMethod.lstABName[index1], _strLoadFile, false, string.Empty); AssetBundleManager.UnloadAssetBundle(GlobalMethod.lstABName[index1], true, (string)null, false); if (!Object.op_Equality((Object)textAsset, (Object)null)) { stringBuilder.Append(textAsset.get_text()); } } } } return(stringBuilder.ToString()); }
private static string SetOOBase() { //Characters will always use the uncensor assigned to them if it exists if (UncensorList.TryGetValue(CharacterName, out string Uncensor) && AssetBundleCheck.IsFile(Uncensor)) { return(Uncensor); } //Characters will use the uncensor assigned for their sex if one has been set if (UncensorList.TryGetValue(CharacterSex.ToString(), out Uncensor) && AssetBundleCheck.IsFile(Uncensor)) { return(Uncensor); } //Characters will use the wildcard uncensor if one is set if (UncensorList.TryGetValue("*", out Uncensor) && AssetBundleCheck.IsFile(Uncensor)) { return(Uncensor); } //If no other uncensor is defined, the default oo_base is used return("chara/oo_base.unity3d"); }
private int DumpScenarioText() { HashSet <string> AllJPText = new HashSet <string>(); foreach (var AssetBundleName in CommonLib.GetAssetBundleNameListFromPath("adv/scenario", true)) { foreach (var AssetName in AssetBundleCheck.GetAllAssetName(AssetBundleName)) //.Where(x => x.StartsWith("personality_voice_")) { var Asset = ManualLoadAsset <ADV.ScenarioData>(AssetBundleName, AssetName, "abdata"); Dictionary <string, string> Translations = new Dictionary <string, string>(); foreach (var param in Asset.list) { if (!textResourceHelper.IsSupportedCommand(param.Command)) { continue; } if (param.Command == ADV.Command.Text) { if (param.Args.Length >= 2 && !param.Args[1].IsNullOrEmpty()) { AllJPText.Add(param.Args[1]); Translations[param.Args[1]] = ""; if (param.Args.Length >= 3 && !param.Args[2].IsNullOrEmpty()) { Translations[param.Args[1]] = param.Args[2]; } } } else if (param.Command == ADV.Command.Calc) { if (param.Args.Length >= 3 && textResourceHelper.CalcKeys.Contains(param.Args[0])) { var key = textResourceHelper.GetSpecializedKey(param, 2, out string value); AllJPText.Add(key); Translations[key] = value; } } else if (param.Command == ADV.Command.Format) { if (param.Args.Length >= 2 && textResourceHelper.FormatKeys.Contains(param.Args[0])) { AllJPText.Add(param.Args[1]); Translations[param.Args[1]] = ""; } } else if (param.Command == ADV.Command.Choice) { for (int i = 0; i < param.Args.Length; i++) { var key = textResourceHelper.GetSpecializedKey(param, i, out string value); if (!key.IsNullOrEmpty()) { AllJPText.Add(key); Translations[key] = value; } } } #if false else if (param.Command == ADV.Command.Switch) { for (int i = 0; i < param.Args.Length; i++) { var key = textResourceHelper.GetSpecializedKey(param, i, out string value); AllJPText.Add(key); Translations[key] = value; } } #endif #if false else if (param.Command == ADV.Command.InfoText) { for (int i = 2; i < param.Args.Length; i += 2) { AllJPText.Add(param.Args[i]); Translations[param.Args[i]] = ""; } } #endif #if false else if (param.Command == ADV.Command.Jump) { if (param.Args.Length >= 1 && !AllAscii.IsMatch(param.Args[0])) { AllJPText.Add(param.Args[0]); Translations[param.Args[0]] = "Jump"; } } #endif else { Logger.LogDebug($"[TextDump] Unsupported command: {param.Command}: {string.Join(",", param.Args.Select((a) => a?.ToString() ?? string.Empty).ToArray())}"); } } if (Translations.Count > 0) { string FolderPath = Path.Combine(Paths.GameRootPath, "TextDump"); FolderPath = Path.Combine(FolderPath, AssetBundleName.Replace(".unity3d", "")); FolderPath = Path.Combine(FolderPath, AssetName.Replace(".asset", "")); FolderPath = FolderPath.Replace('/', '\\'); if (!Directory.Exists(FolderPath)) { Directory.CreateDirectory(FolderPath); } string FilePath = Path.Combine(FolderPath, "translation.txt"); if (File.Exists(FilePath)) { File.Delete(FilePath); } List <string> Lines = new List <string>(); foreach (var tl in Translations) { string JP = tl.Key.Trim(); string ENG = tl.Value.Trim(); if (JP.Contains("\n")) { JP = $"\"{JP.Replace("\n", @"\n").Trim()}\""; } if (ENG.Contains("\n")) { ENG = $"\"{ENG.Replace("\n", @"\n").Trim()}\""; } ENG = ENG.Replace(";", ","); if (ENG.IsNullOrEmpty()) { Lines.Add($"{JP}="); } else { Lines.Add($"{JP}={ENG}"); } } File.WriteAllLines(FilePath, Lines.ToArray()); } } } Logger.LogInfo($"[TextDump] Total Scenario unique lines:{AllJPText.Count}"); return(AllJPText.Count); }
public static void CheckPersonalityAndOverride(ChaFileControl chaFileControl) { switch (chaFileControl.parameter.personality) { case 30: //0727 Free DLC if (!AssetBundleCheck.IsFile("etcetra/list/config/14.unity3d")) { ShowPersonalityMissingMessage(chaFileControl, "0727 Free DLC"); chaFileControl.parameter.personality = DefaultPersonality; } break; case 31: //0727 Paid DLC #1 if (!AssetBundleCheck.IsFile("etcetra/list/config/15.unity3d")) { ShowPersonalityMissingMessage(chaFileControl, "0727 Summer Expansion"); chaFileControl.parameter.personality = DefaultPersonality; } break; case 32: //0727 Paid DLC #1 if (!AssetBundleCheck.IsFile("etcetra/list/config/16.unity3d")) { ShowPersonalityMissingMessage(chaFileControl, "0727 Summer Expansion"); chaFileControl.parameter.personality = DefaultPersonality; } break; case 33: //0727 Paid DLC #1 if (!AssetBundleCheck.IsFile("etcetra/list/config/17.unity3d")) { ShowPersonalityMissingMessage(chaFileControl, "0727 Summer Expansion"); chaFileControl.parameter.personality = DefaultPersonality; } break; case 34: case 35: case 36: case 37: //1221 Paid DLC #2 if (!AssetBundleCheck.IsFile("etcetra/list/config/20.unity3d")) { ShowPersonalityMissingMessage(chaFileControl, "1221 AfterSchool Expansion"); chaFileControl.parameter.personality = DefaultPersonality; } break; case 38: //EmotionCreators preorder bonus personality if (!AssetBundleCheck.IsFile("etcetra/list/config/50.unity3d")) { ShowPersonalityMissingMessage(chaFileControl, "EmotionCreators preorder bonus"); chaFileControl.parameter.personality = DefaultPersonality; } break; case 80: case 81: case 82: case 83: case 84: case 85: case 86: //Story character personalities added by a mod ShowInvalidModdedPersonality(chaFileControl); chaFileControl.parameter.personality = DefaultPersonality; break; } }
private int DumpScenarioText() { HashSet <string> AllJPText = new HashSet <string>(); foreach (var AssetBundleName in CommonLib.GetAssetBundleNameListFromPath("adv/scenario", true)) { foreach (var AssetName in AssetBundleCheck.GetAllAssetName(AssetBundleName)) //.Where(x => x.StartsWith("personality_voice_")) { var Asset = ManualLoadAsset <ADV.ScenarioData>(AssetBundleName, AssetName, "abdata"); Dictionary <string, string> Translations = new Dictionary <string, string>(); foreach (var param in Asset.list) { if (param.Command == ADV.Command.Text) { if (param.Args.Length >= 2 && !param.Args[1].IsNullOrEmpty()) { AllJPText.Add(param.Args[1]); Translations[param.Args[1]] = ""; if (param.Args.Length >= 3 && !param.Args[2].IsNullOrEmpty()) { Translations[param.Args[1]] = param.Args[2]; } } } } if (Translations.Count > 0) { string FolderPath = Path.Combine(Paths.GameRootPath, "TextDump"); FolderPath = Path.Combine(FolderPath, AssetBundleName.Replace(".unity3d", "")); FolderPath = Path.Combine(FolderPath, AssetName.Replace(".asset", "")); FolderPath = FolderPath.Replace('/', '\\'); if (!Directory.Exists(FolderPath)) { Directory.CreateDirectory(FolderPath); } string FilePath = Path.Combine(FolderPath, "translation.txt"); if (File.Exists(FilePath)) { File.Delete(FilePath); } List <string> Lines = new List <string>(); foreach (var tl in Translations) { string JP = tl.Key.Trim(); string ENG = tl.Value.Trim(); if (JP.Contains("\n")) { JP = $"\"{JP.Replace("\n", @"\n").Trim()}\""; } if (ENG.Contains("\n")) { ENG = $"\"{ENG.Replace("\n", @"\n").Trim()}\""; } if (ENG.IsNullOrEmpty()) { Lines.Add($"//{JP}="); } else { Lines.Add($"{JP}={ENG}"); } } File.WriteAllLines(FilePath, Lines.ToArray()); } } } Logger.Log(LogLevel.Info, $"[TextDump] Total Scenario unique lines:{AllJPText.Count}"); return(AllJPText.Count); }
private int DumpCommunicationText() { HashSet <string> AllJPText = new HashSet <string>(); foreach (var AssetBundleName in CommonLib.GetAssetBundleNameListFromPath("communication")) { if (AssetBundleName.Contains("hit_")) { continue; } foreach (var AssetName in AssetBundleCheck.GetAllAssetName(AssetBundleName)) { if (AssetName.Contains("speed_")) { continue; } var Asset = ManualLoadAsset <ExcelData>(AssetBundleName, AssetName, "abdata"); Dictionary <string, string> Translations = new Dictionary <string, string>(); foreach (var param in Asset.list) { if (15 <= param.list.Count && !param.list[15].IsNullOrEmpty() && param.list[15] != "テキスト") { AllJPText.Add(param.list[15]); Translations[param.list[15]] = ""; try { Translations[param.list[15]] = param.list[20]; } catch { } } } if (Translations.Count > 0) { string FolderPath = Path.Combine(Paths.GameRootPath, "TextDump"); FolderPath = Path.Combine(FolderPath, AssetBundleName.Replace(".unity3d", "")); FolderPath = Path.Combine(FolderPath, AssetName.Replace(".asset", "")); FolderPath = FolderPath.Replace('/', '\\'); if (!Directory.Exists(FolderPath)) { Directory.CreateDirectory(FolderPath); } string FilePath = Path.Combine(FolderPath, "translation.txt"); if (File.Exists(FilePath)) { File.Delete(FilePath); } List <string> Lines = new List <string>(); foreach (var tl in Translations) { string JP = tl.Key.Trim(); string ENG = tl.Value.Trim(); if (JP.Contains("\n")) { JP = $"\"{JP.Replace("\n", @"\n").Trim()}\""; } if (ENG.Contains("\n")) { ENG = $"\"{ENG.Replace("\n", @"\n").Trim()}\""; } ENG = ENG.Replace(";", ","); if (ENG.IsNullOrEmpty()) { Lines.Add($"//{JP}="); } else { Lines.Add($"{JP}={ENG}"); } } File.WriteAllLines(FilePath, Lines.ToArray()); } } } Logger.Log(LogLevel.Info, $"[TextDump] Total Communication unique lines:{AllJPText.Count}"); return(AllJPText.Count); }
int DumpHText() { HashSet <string> AllJPText = new HashSet <string>(); foreach (var AssetBundleName in CommonLib.GetAssetBundleNameListFromPath("h/list/")) { foreach (var AssetName in AssetBundleCheck.GetAllAssetName(AssetBundleName).Where(x => x.StartsWith("personality_voice_"))) { if (AssetName.EndsWith(".txt")) { var Asset = ManualLoadAsset <TextAsset>(AssetBundleName, AssetName, "abdata"); HashSet <string> JPText = new HashSet <string>(); string[] Rows = Asset.text.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); for (int i = 0; i < Rows.Count(); i++) { string[] Cells = Rows[i].Split('\t'); if (4 < Cells.Length && !Cells[4].IsNullOrEmpty()) { AllJPText.Add($"//{Cells[4]}="); JPText.Add($"//{Cells[4]}="); } if (27 < Cells.Length && !Cells[27].IsNullOrEmpty()) { AllJPText.Add($"//{Cells[27]}="); JPText.Add($"//{Cells[27]}="); } if (50 < Cells.Length && !Cells[50].IsNullOrEmpty()) { AllJPText.Add($"//{Cells[50]}="); JPText.Add($"//{Cells[50]}="); } if (73 < Cells.Length && !Cells[73].IsNullOrEmpty()) { AllJPText.Add($"//{Cells[73]}="); JPText.Add($"//{Cells[73]}="); } } if (JPText.Count > 0) { string FolderPath = Path.Combine(Paths.GameRootPath, "TextDump"); FolderPath = Path.Combine(FolderPath, AssetBundleName.Replace(".unity3d", "")); FolderPath = Path.Combine(FolderPath, AssetName.Replace(".txt", "")); FolderPath = FolderPath.Replace('/', '\\'); if (!Directory.Exists(FolderPath)) { Directory.CreateDirectory(FolderPath); } string FilePath = Path.Combine(FolderPath, "translation.txt"); if (File.Exists(FilePath)) { File.Delete(FilePath); } File.WriteAllLines(FilePath, JPText.ToArray()); } } } } Logger.Log(LogLevel.Info, $"Total H-Scene unique lines:{AllJPText.Count}"); return(AllJPText.Count); }