UnityWebRequestUtility.cs 660 B

1234567891011121314151617181920212223242526272829
  1. using Blue;
  2. using UnityEngine.Networking;
  3. public class UnityWebRequestUtility : IUtility
  4. {
  5. /// <summary>
  6. /// 获取下载进度
  7. /// </summary>
  8. public float GetProcess(UnityWebRequest webRequestPoint)
  9. {
  10. if (webRequestPoint != null)
  11. {
  12. return webRequestPoint.downloadProgress;
  13. }
  14. return 0;
  15. }
  16. /// <summary>
  17. /// 获取当前下载内容长度
  18. /// </summary>
  19. public long GetCurrentLength(UnityWebRequest webRequestPoint)
  20. {
  21. if (webRequestPoint != null)
  22. {
  23. return (long)webRequestPoint.downloadedBytes;
  24. }
  25. return 0;
  26. }
  27. }