public override void Load() { //先尝试从SDCard加载 string bundleFilePath = ""; if (ResourceManagerUtil.ConstsStreamingLatest == false) { bundleFilePath = ToBundlePathSDCardPath(m_BundleName); if (DGMFile.Exist(bundleFilePath)) { using (DGMFile file = DGMFile.Open(bundleFilePath)) { byte[] data = file.Read(); Encrypt.Hanlde(ref data); m_Bundle = AssetBundle.LoadFromMemory(data); } if (m_Bundle != null) { return; } } } bundleFilePath = ToStreamingPath(m_BundleName); if (DGMFile.ExistStreamingFile(bundleFilePath)) { using (DGMFile file = DGMFile.OpenStreamingFile(bundleFilePath)) { byte[] data = file.Read(); Encrypt.Hanlde(ref data); m_Bundle = AssetBundle.LoadFromMemory(data); } } }
public static DGMFile OpenStreamingFile(string path) { Stream stream = new ApkAssetStream(path); DGMFile file = new DGMFile(stream); return(file); }
public static DGMFile Open(string path) { Stream stream = File.OpenRead(path); DGMFile file = new DGMFile(stream); return(file); }
public override IEnumerator LoadAsync() { string bundleFilePath = ""; if (ResourceManagerUtil.ConstsStreamingLatest == false) { bundleFilePath = ToBundlePathSDCardPath(m_BundleName); if (DGMFile.Exist(bundleFilePath)) { using (DGMFile file = DGMFile.Open(bundleFilePath)) { byte[] data = file.Read(); Encrypt.Hanlde(ref data); AssetBundleCreateRequest request = AssetBundle.LoadFromMemoryAsync(data); yield return(request); m_Bundle = request.assetBundle; } if (m_Bundle != null) { yield break; } } } bundleFilePath = ToStreamingPath(m_BundleName); if (DGMFile.ExistStreamingFile(bundleFilePath)) { using (DGMFile file = DGMFile.OpenStreamingFile(bundleFilePath)) { byte[] data = file.Read(); Encrypt.Hanlde(ref data); AssetBundleCreateRequest request = AssetBundle.LoadFromMemoryAsync(data); yield return(request); m_Bundle = request.assetBundle; } } }