Ejemplo n.º 1
0
        void CheckDownloadStatus(AndroidAssetPackInfo info)
        {
            string message = "";

            if (info.status == AndroidAssetPackStatus.Failed)
            {
                message = $"Failed to retrieve the state of asset pack '{info.name}'.";
            }
            else if (info.status == AndroidAssetPackStatus.Unknown)
            {
                message = $"Asset pack '{info.name}' is unavailable for this application. This can occur if the app was not installed through Google Play.";
            }
            else if (info.status == AndroidAssetPackStatus.Canceled)
            {
                message = $"Cancelled asset pack download request '{info.name}'.";
            }
            else if (info.status == AndroidAssetPackStatus.WaitingForWifi)
            {
                AndroidAssetPacks.RequestToUseMobileDataAsync(OnRequestToUseMobileDataComplete);
            }
            else if (info.status == AndroidAssetPackStatus.Completed)
            {
                string assetPackPath = AndroidAssetPacks.GetAssetPackPath(info.name);

                if (!string.IsNullOrEmpty(assetPackPath))
                {
                    // Asset pack was located on device. Proceed with loading the bundle.
                    PlayAssetDeliveryRuntimeData.Instance.AssetPackNameToDownloadPath.Add(info.name, assetPackPath);
                    base.Provide(m_ProviderInterface);
                }
                else
                {
                    message = $"Downloaded asset pack '{info.name}' but cannot locate it on device.";
                }
            }

            if (!string.IsNullOrEmpty(message))
            {
                Debug.LogError(message);
                m_ProviderInterface.Complete(this, false, new Exception("exception"));
            }
        }
Ejemplo n.º 2
0
 void CheckDownloadStatus(AndroidAssetPackInfo info)
 {
     if (info.status == AndroidAssetPackStatus.Failed)
     {
         CompleteOverride($"Failed to retrieve the state of asset pack '{info.name}'.");
     }
     else if (info.status == AndroidAssetPackStatus.Unknown)
     {
         CompleteOverride($"Asset pack '{info.name}' is unavailable for this application. This can occur if the app was not installed through Google Play.");
     }
     else if (info.status == AndroidAssetPackStatus.Canceled)
     {
         CompleteOverride($"Cancelled asset pack download request '{info.name}'.");
     }
     else if (info.status == AndroidAssetPackStatus.WaitingForWifi)
     {
         AndroidAssetPacks.RequestToUseMobileDataAsync(result =>
         {
             if (!result.allowed)
             {
                 CompleteOverride("Request to use mobile data was denied.");
             }
         });
     }
     else if (info.status == AndroidAssetPackStatus.Completed)
     {
         string assetPackPath = AndroidAssetPacks.GetAssetPackPath(info.name);
         if (string.IsNullOrEmpty(assetPackPath))
         {
             CompleteOverride($"Downloaded asset pack '{info.name}' but cannot locate it on device.");
         }
         else if (AndroidAssetPacks.coreUnityAssetPacksDownloaded)
         {
             DownloadCustomAssetPacksData();
         }
     }
 }