public static T LoadPBData(string name, bool useZip = false) { MLResourceManager resMgr = MLResourceManager.Instance; TextAsset textAsset = resMgr.LoadResource(name, ResourceType.RES_META_DATAS) as TextAsset; if (textAsset == null) { Debug.LogError("load prototype data error!!!"); return(default(T)); } T t = default(T); byte[] datas = textAsset.bytes; if (useZip) { t = DeserializePBClassWithGZip(datas); } else { t = DeserializePBClass(datas); } resMgr.UnloadResource(name); return(t); }
byte[] ReadDownLoadFile(string fileName) { if (!fileName.EndsWith(".lua")) { fileName = string.Format("{0}.lua", fileName); } MLResourceManager resMgr = MLResourceManager.Instance; TextAsset asset = resMgr.LoadResource(fileName, ResourceType.RES_LUA) as TextAsset; byte[] ret = asset.bytes; resMgr.UnloadResource(fileName, true); // byte[] ret = null; // resMgr.LoadResourceAsync(fileName, (_obj) => // { // TextAsset asset = _obj as TextAsset; // ret = asset.bytes; // // }, ResourceType.RES_LUA); // // resMgr.UnloadResource(fileName, true); return(ret); }