/// <summary> /// DownloadLoadOperation对象下载完成 /// 1.将创建LoadedAssetBundle对象; /// 2.将LoadedAssetBundle对象加入到已经下载完毕的AssetBundle字典中; /// 3.从mDownloadingBundles中移除AssetBundle的key; /// </summary> /// <param name="operation">DownloadLoadOperation</param> void ProcessFinishedOperation(LoadOperation operation) { DownloadLoadOperation download = operation as DownloadLoadOperation; if (download == null) { return; } mLoadedAssetBundles.Add(download.assetBundleName, download.assetBundle); mDownloadingBundles.Remove(download.assetBundleName); }
/// <summary> /// 下载level的接口 /// </summary> /// <param name="assetBundleName"></param> /// <param name="levelName"></param> /// <param name="isAdditive"></param> /// <returns></returns> public LoadOperation LoadLevelAsync(string assetBundleName, string levelName, bool isAdditive) { LoadOperation operation = null; #if UNITY_EDITOR if (mSimulateInEditor) { operation = new LoadLevelSimulationOperation(assetBundleName, levelName, isAdditive); } else #endif { assetBundleName = RemapVariantName(assetBundleName); LoadAssetBundle(assetBundleName); operation = new LoadLevelOperation(assetBundleName, levelName, isAdditive); mInProgressOperations.Add(operation); } return(operation); }