public static void GenerateScriptVersionContent(out UpdateModuleMessage assetBundle) { assetBundle = new UpdateModuleMessage(); int assetSize = 0; string generate = "\tScripts = {\n"; List <string> fileList = new List <string>(); GetAllScriptFile(Application.dataPath + "/Resources" + SCRIPT_PATH, fileList); for (int i = 0; i < fileList.Count; ++i) { //TODO:加密每一个script文件,并拷贝到PersistentDataPath var file = fileList[i]; byte[] fileContent = null; FileManager.LoadFileWithBytes(file, out fileContent); var size = FileManager.GetFileSize(FileSizeUnitType.Type_Kb, fileContent.Length); generate += "\t\t{\n"; generate += "\t\t\tname=\"" + file.Replace(Application.dataPath + "/Resources/", "") + "\"" + ",\n"; generate += "\t\t\tsize=" + Mathf.Ceil(size) + ",\n"; generate += "\t\t},\n"; assetSize += (int)Mathf.Ceil(size); } generate += "\t},\n"; assetBundle.Content = generate; assetBundle.Size = assetSize; }
static public int LoadFileWithBytes_s(IntPtr l) { try { System.String a1; checkType(l, 1, out a1); System.Byte[] a2; FileManager.LoadFileWithBytes(a1, out a2); pushValue(l, true); pushValue(l, a2); return(2); } catch (Exception e) { return(error(l, e)); } }
byte[] LoaderDelegate(string filePath) { byte[] list = null; _sb.Remove(0, _sb.Length); _sb.Append(filePath); _sb = _sb.Replace('.', '/'); _sb.Append(".lua"); FileManager.LoadFileWithBytes(GetExternalDir() + _sb.ToString(), out list); if (list != null) { return(list); } return(null); }
byte[] LoaderDelegate(string filePath) { byte[] list = null; _sb.Remove(0, _sb.Length); //_sb.Append(GetScriptPath()); //_sb.Append("/"); _sb.Append(filePath); _sb = _sb.Replace('.', '/'); _sb.Append(".txt"); FileManager.LoadFileWithBytes(_sb.ToString(), out list); if (list != null) { return(list); } return(null); }
public void LoadFromAssetBundle() { var assetbundlePath = string.Format("{0}{1}/{2}{3}", LuaManager.GetExternalDir(), ResourceManager.PREFIX_ASSETBUNDLE_PATH , _resourceInfo.ResourcePath, ResourceManager.SUFFIX_ASSETBUNDLE_PATH); byte[] assetBundleContent = null; FileManager.LoadFileWithBytes(assetbundlePath, out assetBundleContent); var bundle = AssetBundle.LoadFromMemory(assetBundleContent); #if UNITY_5 _resource = bundle.LoadAsset <GameObject>(_resourceInfo.ResourceName); #else _resource = bundle.Load <GameObject>(_resourceInfo.ResourceName); #endif bundle.Unload(true); LoadFinished(); }
byte[] LoaderDelegate(string filePath) { byte[] list = null; _sb.Remove(0, _sb.Length); _sb.Append(filePath); _sb = _sb.Replace('.', '/'); var text = Resources.Load <TextAsset>(_sb.ToString()); if (text != null) { return(text.bytes); } _sb.Append(".txt"); FileManager.LoadFileWithBytes(_sb.ToString(), out list); if (list != null) { return(list); } return(null); }