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 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 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 bool LoadListInfoAll() { ChaListDefine.CategoryNo[] values = (ChaListDefine.CategoryNo[])Enum.GetValues(typeof(ChaListDefine.CategoryNo)); Dictionary <int, ListInfoBase> dictData = (Dictionary <int, ListInfoBase>)null; List <string> nameListFromPath = CommonLib.GetAssetBundleNameListFromPath("list/characustom/", false); for (int index = 0; index < nameListFromPath.Count; ++index) { AssetBundleLoadAssetOperation loadAssetOperation = AssetBundleManager.LoadAllAsset(nameListFromPath[index], typeof(TextAsset), (string)null); if (loadAssetOperation == null) { Debug.LogWarning((object)("読み込みエラー\r\nassetBundleName:" + nameListFromPath[index])); } else if (loadAssetOperation.IsEmpty()) { AssetBundleManager.UnloadAssetBundle(nameListFromPath[index], true, (string)null, false); } else { TextAsset[] allAssets = loadAssetOperation.GetAllAssets <TextAsset>(); if (allAssets == null || allAssets.Length == 0) { AssetBundleManager.UnloadAssetBundle(nameListFromPath[index], true, (string)null, false); } else { foreach (ChaListDefine.CategoryNo categoryNo in values) { if (!this.dictListInfo.TryGetValue((int)categoryNo, out dictData)) { Debug.LogWarning((object)"リストを読むための準備ができてない"); } else { foreach (TextAsset ta in allAssets) { if (!(YS_Assist.GetRemoveStringRight(((Object)ta).get_name(), "_", false) != categoryNo.ToString() + "_")) { this.LoadListInfo(dictData, ta); } } } } AssetBundleManager.UnloadAssetBundle(nameListFromPath[index], true, (string)null, false); } } } this.EntryClothesIsInit(); this.LoadItemID(); OutputLog.Log(nameof(LoadListInfoAll), false, "UnloadUnusedAssets"); Resources.UnloadUnusedAssets(); GC.Collect(); return(true); }
public IEnumerator GetAsset <T>(Action <T> act) where T : class { if (request == null) { request = this.LoadBundle <T>(); } if (request != null) { yield return((object)request); if (!request.IsEmpty()) { NullCheck.Call <T>(act, request.GetAsset <T>()); } } }
public static List <ExcelData.Param> LoadExcelData( string _strAssetPath, string _strFileName, int sCell, int sRow, int eCell, int eRow, bool _isWarning = true) { if (!GlobalMethod.AssetFileExist(_strAssetPath, _strFileName, string.Empty)) { if (_isWarning) { GlobalMethod.DebugLog("excel : [" + _strAssetPath + "][" + _strFileName + "]は見つかりません", 1); } return((List <ExcelData.Param>)null); } AssetBundleLoadAssetOperation loadAssetOperation = AssetBundleManager.LoadAsset(_strAssetPath, _strFileName, typeof(ExcelData), (string)null); AssetBundleManager.UnloadAssetBundle(_strAssetPath, true, (string)null, false); if (loadAssetOperation.IsEmpty()) { if (_isWarning) { GlobalMethod.DebugLog("excel : [" + _strFileName + "]は[" + _strAssetPath + "]の中に入っていません", 1); } return((List <ExcelData.Param>)null); } GlobalMethod.excelData = loadAssetOperation.GetAsset <ExcelData>(); GlobalMethod.cell.Clear(); foreach (ExcelData.Param obj in GlobalMethod.excelData.list) { GlobalMethod.cell.Add(obj.list[sCell]); } GlobalMethod.row.Clear(); foreach (string str in GlobalMethod.excelData.list[sRow].list) { GlobalMethod.row.Add(str); } List <string> cell1 = GlobalMethod.cell; List <string> row1 = GlobalMethod.row; ExcelData.Specify specify1 = new ExcelData.Specify(eCell, eRow); ExcelData.Specify specify2 = new ExcelData.Specify(cell1.Count, row1.Count); GlobalMethod.excelParams.Clear(); if ((long)(uint)specify1.cell > (long)specify2.cell || (long)(uint)specify1.row > (long)specify2.row) { return((List <ExcelData.Param>)null); } if (specify1.cell < GlobalMethod.excelData.list.Count) { for (int cell2 = specify1.cell; cell2 < GlobalMethod.excelData.list.Count && cell2 <= specify2.cell; ++cell2) { ExcelData.Param obj = new ExcelData.Param(); if (specify1.row < GlobalMethod.excelData.list[cell2].list.Count) { obj.list = new List <string>(); for (int row2 = specify1.row; row2 < GlobalMethod.excelData.list[cell2].list.Count && row2 <= specify2.row; ++row2) { obj.list.Add(GlobalMethod.excelData.list[cell2].list[row2]); } } GlobalMethod.excelParams.Add(obj); } } return(GlobalMethod.excelParams); }