internal PlayAsyncOperation <long, AssetDeliveryErrorCode> GetDownloadSizeInternal(string assetBundleName) { var operation = new AssetDeliveryAsyncOperation <long>(); if (IsInstallTimeAssetBundle(assetBundleName)) { operation.SetResult(0L); return(operation); } var task = _assetPackManager.GetPackStates(assetBundleName); task.RegisterOnSuccessCallback(javaPackState => { var assetPacks = new AssetPackStates(javaPackState); operation.SetResult(assetPacks.TotalBytes); task.Dispose(); }); task.RegisterOnFailureCallback((message, errorCode) => { operation.SetError(PlayCoreTranslator.TranslatePlayCoreErrorCode(errorCode)); task.Dispose(); }); return(operation); }
/// <summary> /// Asks <see cref="AssetPackManager"/> for the current pack states and routes them to /// <see cref="OnForcedStateUpdate"/>. /// </summary> private void ForcePackStatesUpdate() { if (_gettingPackStates) { Debug.LogWarning( "ForceStateUpdate attempt ignored because the latest states are still being retrieved."); return; } var activeRequestBundleNames = _requestRepository.GetActiveAssetBundleNames(); if (activeRequestBundleNames.Length == 0) { // No requests to update. return; } BeginGetPackStates(); var getPackStateTask = _assetPackManager.GetPackStates(activeRequestBundleNames); getPackStateTask.RegisterOnSuccessCallback(ProcessPackStates); }