using System; using UnityEngine; public class AssetUty { public AssetUty(AFileSystemBase f_FileSys) { this.m_FileSys = f_FileSys; } public AssetBundle LoadAssetBundle(string f_strFileName) { NDebug.Assert(this.m_FileSys != null, "LoadAssetBundle を呼び出す前に、ファイルシステムを登録して下さい。"); byte[] binary; using (AFileBase afileBase = this.m_FileSys.FileOpen(f_strFileName)) { binary = afileBase.ReadAll(); } AssetBundle assetBundle = AssetBundle.LoadFromMemory(binary); NDebug.Assert(assetBundle != null && assetBundle.mainAsset != null, "メモリからアセットが読み出せません。\n" + f_strFileName); return assetBundle; } public string LoadAssetBundleToString(string f_strFileName) { AssetBundle assetBundle = this.LoadAssetBundle(f_strFileName); TextAsset textAsset = assetBundle.mainAsset as TextAsset; return NUty.ConvByteToString(NUty.ENCO.SHIFT_JIS, textAsset.bytes); } private AFileSystemBase m_FileSys; }