using System.Collections; using System.Collections.Generic; using System.IO; using UnityEngine; using UnityEngine.Networking; using static DownLoadXRManager; public class DownLoadURLXRItem : MonoBehaviour { public static Dictionary> downLoadingList = new Dictionary>(); public void startDownload(DownLoadConfig config) { StartCoroutine(ReadStreamingAssetsFile(config)); } IEnumerator ReadStreamingAssetsFile(DownLoadConfig config) { if (DownLoadXRManager.downLoadCache.ContainsKey(config.data.path)) { config.bytes?.Invoke(DownLoadXRManager.downLoadCache[config.data.path]); yield return null; } else { if(downLoadingList.ContainsKey(config.data.path)) { downLoadingList[config.data.path].Add(config); } else { downLoadingList.Add(config.data.path, new List()); downLoadingList[config.data.path].Add(config); string filePath = config.data.path; Debug.Log("准备下载" + filePath); UnityWebRequest www = UnityWebRequest.Get(filePath); www.SendWebRequest(); while (!www.isDone) { for (int i = 0; i