Exemplo n.º 1
0
    public AssetBundle FinishBundleDownload()
    {
        AssetBundle assetBundle = assetBundleRequest.AssetBundle;

        assetBundleRequest = null;
        return(assetBundle);
    }
Exemplo n.º 2
0
 private void Awake()
 {
     assetPackSize                = 0;
     isAssetPackSizeValid         = false;
     isCellularConfirmationActive = false;
     didApproveCellularData       = false;
     assetBundleRequest           = null;
     assetPackRequest             = null;
 }
Exemplo n.º 3
0
 public void StartDownload()
 {
     if (isSingleAssetBundlePack && assetBundleRequest == null)
     {
         assetBundleRequest = PlayAssetDelivery.RetrieveAssetBundleAsync(
             assetPackName);
     }
     else if (!isSingleAssetBundlePack && assetPackRequest == null)
     {
         assetPackRequest = PlayAssetDelivery.RetrieveAssetPackAsync(
             assetPackName);
     }
 }
Exemplo n.º 4
0
        private IEnumerator DownloadAssetBundleCo()
        {
            _request = PlayAssetDelivery.RetrieveAssetBundleAsync(AssetBundleName);

            while (!_request.IsDone)
            {
                if (_request.Status == AssetDeliveryStatus.WaitingForWifi)
                {
                    var asyncOperation = PlayAssetDelivery.ShowCellularDataConfirmation();
                    yield return(asyncOperation); // Wait until user has confirmed or cancelled the dialog.

                    if (asyncOperation.Error != AssetDeliveryErrorCode.NoError ||
                        asyncOperation.GetResult() != ConfirmationDialogResult.Accepted)
                    {
                        // Provide a button to re-show the dialog in case user changes their mind.
                        Display.SetStatus(_request.Status, _request.Error);
                    }

                    yield return(new WaitUntil(() => _request.Status != AssetDeliveryStatus.WaitingForWifi));
                }

                Display.SetProgress(_request.DownloadProgress);
                Display.SetStatus(_request.Status, _request.Error);

                yield return(null);
            }

            Display.SetStatus(_request.Status, _request.Error);

            if (_request.Error != AssetDeliveryErrorCode.NoError)
            {
                Debug.LogErrorFormat("Couldn't load AssetBundles: {0}", _request.Error);
                _request = null;
                yield break;
            }

            _assetBundle = _request.AssetBundle;
            _request     = null;
        }