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 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 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); } } }
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); } } } } }
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); } } } } }
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 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; } } }
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); } } } } }
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); }
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); }
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 bool LoadCategoryInfoList( string assetBundleName, string assetName, Dictionary <string, int> dictEnumSrc) { if (!AssetBundleCheck.IsFile(assetBundleName, assetName)) { Debug.LogError((object)("読み込みエラー\r\nassetBundleName:" + assetBundleName + "\tassetName:" + assetName)); return(false); } AssetBundleLoadAssetOperation loadAssetOperation = AssetBundleManager.LoadAsset(assetBundleName, assetName, typeof(TextAsset), (string)null); if (loadAssetOperation == null) { Debug.LogError((object)("読み込みエラー\r\nassetName:" + assetName)); return(false); } TextAsset asset = loadAssetOperation.GetAsset <TextAsset>(); if (Object.op_Equality((Object)null, (Object)asset)) { Debug.LogError((object)"ありえない"); return(false); } string[,] data; YS_Assist.GetListString(asset.get_text(), out data); int length1 = data.GetLength(0); int length2 = data.GetLength(1); this.dictCategory.Clear(); if (length1 != 0 && length2 != 0) { for (int index = 0; index < length1; ++index) { ShapeInfoBase.CategoryInfo categoryInfo = new ShapeInfoBase.CategoryInfo(); categoryInfo.Initialize(); int key = int.Parse(data[index, 0]); categoryInfo.name = data[index, 1]; int num = 0; if (!dictEnumSrc.TryGetValue(categoryInfo.name, out num)) { Debug.LogWarning((object)("SrcBone【" + categoryInfo.name + "】のIDが見つかりません")); } else { categoryInfo.id = num; categoryInfo.use[0][0] = !(data[index, 2] == "0"); categoryInfo.use[0][1] = !(data[index, 3] == "0"); categoryInfo.use[0][2] = !(data[index, 4] == "0"); if (categoryInfo.use[0][0] || categoryInfo.use[0][1] || categoryInfo.use[0][2]) { categoryInfo.getflag[0] = true; } categoryInfo.use[1][0] = !(data[index, 5] == "0"); categoryInfo.use[1][1] = !(data[index, 6] == "0"); categoryInfo.use[1][2] = !(data[index, 7] == "0"); if (categoryInfo.use[1][0] || categoryInfo.use[1][1] || categoryInfo.use[1][2]) { categoryInfo.getflag[1] = true; } categoryInfo.use[2][0] = !(data[index, 8] == "0"); categoryInfo.use[2][1] = !(data[index, 9] == "0"); categoryInfo.use[2][2] = !(data[index, 10] == "0"); if (categoryInfo.use[2][0] || categoryInfo.use[2][1] || categoryInfo.use[2][2]) { categoryInfo.getflag[2] = true; } List <ShapeInfoBase.CategoryInfo> categoryInfoList = (List <ShapeInfoBase.CategoryInfo>)null; if (!this.dictCategory.TryGetValue(key, out categoryInfoList)) { categoryInfoList = new List <ShapeInfoBase.CategoryInfo>(); this.dictCategory[key] = categoryInfoList; } categoryInfoList.Add(categoryInfo); } } } AssetBundleManager.UnloadAssetBundle(assetBundleName, true, (string)null, false); return(true); }
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; } }
public static bool IsManifestOrBundle(string bundle) { return(AssetBundleManager.ManifestBundlePack.ContainsKey(bundle) || AssetBundleCheck.IsFile(bundle, string.Empty)); }