public void AssetDownloader_ReturnsTrueIfImageDoesNotExist() { var assetDownloader = new AssetDownloader(Path.GetTempPath(), "https://art.hearthstonejson.com/v1/256x", (string cardId) => $"{cardId}.jpg"); var awaiting = assetDownloader.DownloadAsset(""); Task.WaitAny(awaiting, Task.Delay(10000)); Assert.IsFalse(awaiting.Result); }
public void AssetDownloader_ReturnsTrueIfImageExists() { var assetDownloader = new AssetDownloader <string>(Path.GetTempPath(), key => $"https://art.hearthstonejson.com/v1/256x/{key}.jpg", key => $"{key}.jpg"); var awaiting = assetDownloader.DownloadAsset(WispCardId); Task.WaitAny(awaiting, Task.Delay(10000)); Assert.IsTrue(awaiting.Result); }
public void SetViewModel(Dropdown dropdown) { int index = dropdown.value + 1; if (!modelURI.ContainsKey(index)) { Debug.LogWarning("Model with key " + index.ToString() + " does not exist."); } var assetLoaderOptions = AssetLoaderOptions.CreateInstance(); assetLoaderOptions.DontLoadCameras = false; assetLoaderOptions.DontLoadLights = false; assetLoaderOptions.UseCutoutMaterials = true; assetLoaderOptions.AddAssetUnloader = true; assetDownloader.DownloadAsset(modelURI[index], ".zip", OnAssetDownloaded, null, assetLoaderOptions, m_platformPivot); }
/// <summary> /// /// </summary> /// <param name="asset"></param> private void DownloadAsset(AssetDownloader.AssetDescriptor asset) { assetDownloader.DownloadAsset(asset); }
public void AssetDownloader_DownloadAsset_Null_ThrowsException() { var assetDownloader = new AssetDownloader <string>(Path.GetTempPath(), key => "", key => $"{key}.jpg"); var awaiting = assetDownloader.DownloadAsset(null); }