/// <summary> /// real load assetbundle /// </summary> /// <param name="req"></param> /// <returns></returns> static protected AssetBundleDownloadOperation LoadAssetBundleInternal(CRequest req) { AssetBundleDownloadOperation abDownloadOp = null; if (!downloadingBundles.TryGetValue(req.key, out abDownloadOp)) { req.url = GetAssetBundleDownloadingURL(req.vUrl); // set full url if (req.url.StartsWith(Common.HTTP_STRING)) //load assetbunlde { abDownloadOp = AssetBundleDownloadFromWebOperation.Get(); } else { abDownloadOp = AssetBundleDownloadFromDiskOperation.Get(); } abDownloadOp.SetRequest(req); downloadingBundles.Add(req.key, abDownloadOp); CacheData cached = null; CacheManager.CreateOrGetCache(req.keyHashCode, out cached);//cache data inProgressBundleOperations.Add(abDownloadOp); abDownloadOp.BeginDownload(); #if HUGULA_LOADER_DEBUG HugulaDebug.FilterLogFormat(req.key, "<color=#10f010>1.2 LoadAssetBundleInternal Request(key={0},isShared={1},assetname={2},dependencies.count={4})keyHashCode{3}, frameCount{5}</color>", req.key, req.isShared, req.assetName, req.keyHashCode, req.dependencies == null ? 0 : req.dependencies.Length, Time.frameCount); #endif } else if (req.isShared) { req.ReleaseToPool(); } return(abDownloadOp); }
/// <summary> /// real load assetbundle /// </summary> /// <param name="req"></param> /// <returns></returns> static protected AssetBundleDownloadOperation LoadAssetBundleInternal(CRequest req) { AssetBundleDownloadOperation abDownloadOp = null; if (!downloadingBundles.TryGetValue(req.key, out abDownloadOp)) { #if HUGULA_PROFILER_DEBUG Profiler.BeginSample(string.Format("LoadAssetBundleInternal ({0},{1},{2})", req.assetName, req.key, req.isShared)); #endif if (!UriGroup.CheckRequestCurrentIndexCrc(req)) //crc { abDownloadOp = new AssetBundleDownloadErrorOperation(); abDownloadOp.error = string.Format("assetbundle({0}) crc check wrong ", req.key); } else if (req.url.StartsWith(Common.HTTP_STRING)) //load assetbunlde { abDownloadOp = AssetBundleDownloadFromWebOperation.Get(); } else { abDownloadOp = AssetBundleDownloadFromDiskOperation.Get(); } abDownloadOp.SetRequest(req); downloadingBundles.Add(req.key, abDownloadOp); CacheData cached = null; CacheManager.CreateOrGetCache(req.keyHashCode, out cached);//cache data //load now if (bundleMax - inProgressBundleOperations.Count > 0) { inProgressBundleOperations.Add(abDownloadOp); abDownloadOp.BeginDownload(); } else { bundleQueue.Enqueue(abDownloadOp); } #if HUGULA_LOADER_DEBUG HugulaDebug.FilterLogFormat(req.key, "<color=#10f010>1.2 LoadAssetBundleInternal Request(key={0},isShared={1},assetname={2},dependencies.count={4})keyHashCode{3}, frameCount{5}</color>", req.key, req.isShared, req.assetName, req.keyHashCode, req.dependencies == null ? 0 : req.dependencies.Length, Time.frameCount); #endif #if HUGULA_PROFILER_DEBUG Profiler.EndSample(); #endif } else if (req.isShared) { req.ReleaseToPool(); } return(abDownloadOp); }
public static void Release(AssetBundleDownloadFromWebOperation toRelease) { webOperationPool.Release(toRelease); }
private static void m_ActionOnRelease(AssetBundleDownloadFromWebOperation op) { op.Reset(); }
private static void m_ActionOnGet(AssetBundleDownloadFromWebOperation op) { op.pool = true; }