| | 1 | | using Cysharp.Threading.Tasks; |
| | 2 | | using DCL; |
| | 3 | | using MainScripts.DCL.Controllers.AssetManager; |
| | 4 | | using System.Collections.Generic; |
| | 5 | | using UnityEngine; |
| | 6 | |
|
| | 7 | | namespace MainScripts.DCL.AssetsEmbedment.Editor |
| | 8 | | { |
| | 9 | | public static class EditorTexturesDownloader |
| | 10 | | { |
| 0 | 11 | | private static readonly AssetTextureWebLoader WEB_LOADER = new (); |
| | 12 | |
|
| | 13 | | public static async UniTask DownloadTexture2DAsync(string baseUrl, string hash, Dictionary<string, Texture2D> re |
| | 14 | | { |
| 0 | 15 | | if (results.ContainsKey(hash)) |
| 0 | 16 | | return; |
| | 17 | |
|
| 0 | 18 | | var url = $"{baseUrl}{hash}"; |
| | 19 | |
|
| 0 | 20 | | var response = await WEB_LOADER.GetTextureAsync(url); |
| | 21 | |
|
| 0 | 22 | | if (response) |
| | 23 | | { |
| 0 | 24 | | results.Add(hash, response); |
| 0 | 25 | | return; |
| | 26 | | } |
| | 27 | |
|
| 0 | 28 | | throw new AssetNotFoundException(AssetSource.WEB, hash); |
| 0 | 29 | | } |
| | 30 | | } |
| | 31 | | } |