private void UpdateRequest(PlayAssetPackRequestImpl request, AssetPackState newState, int errorCode) { if (request.IsDone) { // Ignore pack state updates associated with completed requests. return; } var assetDeliveryErrorCode = PlayCoreTranslator.TranslatePlayCoreErrorCode(errorCode); if (assetDeliveryErrorCode != AssetDeliveryErrorCode.NoError) { request.OnErrorOccured(assetDeliveryErrorCode); return; } if (newState.Status == PlayCoreTranslator.AssetPackStatus.Canceled) { request.OnErrorOccured(AssetDeliveryErrorCode.Canceled); return; } request.UpdateState(PlayCoreTranslator.TranslatePlayCorePackStatus(newState.Status), newState.BytesDownloaded, newState.TotalBytesToDownload); }
public PlayAssetBundleRequestImpl(PlayAssetPackRequestImpl packRequest, AssetDeliveryUpdateHandler updateHandler) { PackRequest = packRequest; _updateHandler = updateHandler; _loadingStatus = AssetDeliveryStatus.Pending; _loadingError = AssetDeliveryErrorCode.NoError; PackRequest.Completed += OnPackRequestCompleted; }
private void InitiateRequest(PlayAssetPackRequestImpl request) { if (IsDownloaded(request.AssetPackName)) { request.OnPackAvailable(); } else { var fetchTask = _assetPackManager.Fetch(request.AssetPackName); fetchTask.RegisterOnSuccessCallback(javaPackStates => { request.OnInitializedInPlayCore(); fetchTask.Dispose(); }); fetchTask.RegisterOnFailureCallback((reason, errorCode) => { Debug.LogErrorFormat("Failed to retrieve asset pack: {0}", reason); request.OnErrorOccured(PlayCoreTranslator.TranslatePlayCoreErrorCode(errorCode)); fetchTask.Dispose(); }); } }
public bool TryGetRequest(string name, out PlayAssetPackRequestImpl request) { return(_requestsByName.TryGetValue(name, out request)); }
public void AddRequest(PlayAssetPackRequestImpl request) { _requestsByName.Add(request.AssetPackName, request); }