public void Init(string assetPackageFile, string assetPackagePackage, string assetWeigthFile, string assetWeightPackage, GameObject resourceLoader, Manifest manifest) { /* * public void Init (ResourceLoader resourceLoader, Manifest manifest) * { */ Debug.Log("AssetPriManager Init"); _initialzed = InializedState.Initializing; isStartCoroutine = false; this._resourceLoaderObj = resourceLoader; this._manifest = manifest; this._assetPackageFile = ToAssetPriPath(assetPackageFile); this._assetPackagePackage = assetPackagePackage; this._assetWeightFile = ToAssetPriPath(assetWeigthFile); this._assetWeightPackage = assetWeightPackage; ResourceLoader resDl = _resourceLoaderObj.AddComponent <ResourceLoader> (); _assetPackageLoader = AssetLoaderManager.CreateLoader(_assetPackageFile, _assetPackagePackage); _assetWeightLoader = AssetLoaderManager.CreateLoader(_assetWeightFile, _assetWeightPackage); resDl.AddAssetLoader(_assetPackageLoader); resDl.AddAssetLoader(_assetWeightLoader); resDl.SetProgressDelegate(InitCallBack, null, true); }
/// <summary> /// Download the specified assets. /// </summary> /// <param name='dlObject'> /// The download object which affact the downloading task. /// The task can be canceled by destroying this download object. /// </param> /// <param name='prgDelegate'> /// Prgogress delegate to be callback after downloaded. /// </param> /// <param name='prgUserData'> /// Prgogress delegate user data. /// </param> /// <param name='assetFiles'> /// Asset files. /// </param> public static void Download(GameObject dlObject, DownloadDelegate prgDelegate, System.Object prgUserData, bool isReturnPerFrame, params string [] assetFiles) { if (assetFiles.Length == 0) { return; } if (_initialzed != EInializedState.Initialized) { DownloadTask dlTask = new DownloadTask(); dlTask.DownloadObect = dlObject; dlTask.ProgressFunction = prgDelegate; dlTask.ProgressUserData = prgUserData; foreach (string assetFile in assetFiles) { dlTask.AssetFiles.Add(assetFile); } _pendingTask.Add(dlTask); return; } if (dlObject == null) { dlObject = _downloadObject; } ResourceLoader resDl = dlObject.AddComponent <ResourceLoader> (); resDl.SetProgressDelegate(prgDelegate, prgUserData, isReturnPerFrame); foreach (string assetFile in assetFiles) { resDl.AddAssetLoader(AssetLoaderManager.CreateLoader(ToManifestPath(assetFile), _manifest)); } }