| | 1 | | using UnityEngine; |
| | 2 | | using UnityEngine.Networking; |
| | 3 | |
|
| | 4 | | namespace DCL |
| | 5 | | { |
| | 6 | | /// <summary> |
| | 7 | | /// Our custom implementation of the UnityWebRequestAssetBundle. |
| | 8 | | /// </summary> |
| | 9 | | public class WebRequestAssetBundleFactory : IWebRequestAssetBundleFactory |
| | 10 | | { |
| | 11 | | private bool useHash = false; |
| | 12 | | private Hash128 hash; |
| | 13 | |
|
| | 14 | | public void SetHash(Hash128 hash) |
| | 15 | | { |
| 0 | 16 | | useHash = true; |
| 0 | 17 | | this.hash = hash; |
| 0 | 18 | | } |
| | 19 | |
|
| | 20 | | public UnityWebRequest CreateWebRequest(string url) => |
| 29 | 21 | | useHash |
| | 22 | | ? UnityWebRequestAssetBundle.GetAssetBundle(url, hash) |
| | 23 | | : UnityWebRequestAssetBundle.GetAssetBundle(url); |
| | 24 | | } |
| | 25 | | } |