Пример #1
0
        async UniTask DoDownloadImageCaching()
        {
            var cachePathGenerator = new CachePathGenerator($"test-{Guid.NewGuid():N}");
            var imageDownloader    = new CachedImageDownloader(cachePathGenerator);
            var imageUrl           = "https://sample-videos.com/img/Sample-jpg-image-50kb.jpg";

            var texture = await imageDownloader.Download(imageUrl);

            var textureCached = await imageDownloader.Download(imageUrl);

            Assert.IsFalse(texture.GetPixels().SequenceEqual(textureCached.GetPixels()));
        }
Пример #2
0
        async UniTask DoDownloadImageNoCaching()
        {
            var imageDownloader1 = new CachedImageDownloader(new CachePathGenerator($"test-{Guid.NewGuid():N}"));
            var imageDownloader2 = new CachedImageDownloader(new CachePathGenerator($"test-{Guid.NewGuid():N}"));
            var imageUrl         = "https://sample-videos.com/img/Sample-jpg-image-50kb.jpg";

            var texture1 = await imageDownloader1.Download(imageUrl);

            var texture2 = await imageDownloader2.Download(imageUrl);

            Assert.IsTrue(texture1.GetPixels().SequenceEqual(texture2.GetPixels()));
        }
Пример #3
0
 public UniTask <Texture2D> LoadImage(string url)
 {
     return(_downloader.Download(url));
 }