HttpDownloadBasic.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Networking;
  5. public class HttpDownloadBasic
  6. {
  7. public int maxCount = 2;
  8. public DownloadHander DownloadHander;
  9. protected DownloadFileData downloadFileData;
  10. public bool isFinish;
  11. protected int timeOut = 120;
  12. public void Init(DownloadFileData downloadFileData, DownloadHander downloadHander)
  13. {
  14. DownloadHander = downloadHander;
  15. if (downloadFileData.maxCount > 0)
  16. {
  17. maxCount = downloadFileData.maxCount;
  18. }
  19. if (downloadFileData.timeOut > 0)
  20. {
  21. timeOut = downloadFileData.timeOut;
  22. }
  23. this.downloadFileData = downloadFileData;
  24. }
  25. public void StartDown()
  26. {
  27. ProStartDown();
  28. }
  29. protected virtual void ProStartDown()
  30. {
  31. }
  32. public bool IsFinish()
  33. {
  34. return ProFinish();
  35. }
  36. public virtual bool AllFinish()
  37. {
  38. return true;
  39. }
  40. public virtual UnityWebRequest.Result Result()
  41. {
  42. return UnityWebRequest.Result.InProgress;
  43. }
  44. protected virtual bool ProFinish()
  45. {
  46. return true;
  47. }
  48. public virtual void Update()
  49. {
  50. }
  51. }