DownloadDataEntity.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. using Game.Config;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using UnityEngine;
  6. using UnityEngine.Networking;
  7. public class DownloadDataEntity : GameData<DownloadDataEntity>
  8. {
  9. public string FullName;
  10. public string MD5;
  11. public ulong Size;
  12. //public string Version;
  13. public DownloadTaskState State;
  14. public Action<DownloadTask> Callback;
  15. public Action<DownloadTask> UpDateCallback;
  16. public override string FlieName()
  17. {
  18. return "mainfest";
  19. }
  20. public override bool SetFields(string fieldname, string value)
  21. {
  22. bool ret = base.SetFields(fieldname, value);
  23. if (!ret)
  24. {
  25. switch (fieldname)
  26. {
  27. case "FullName":
  28. {
  29. FullName = value;
  30. ret = true;
  31. }
  32. ; break;
  33. case "MD5":
  34. {
  35. MD5 = value;
  36. ret = true;
  37. }
  38. ; break;
  39. case "Size":
  40. {
  41. Size = ulong.Parse(value);
  42. ret = true;
  43. }
  44. ; break;
  45. }
  46. }
  47. return ret;
  48. }
  49. public override string GetFieldValue(string fieldname)
  50. {
  51. string ret = "";
  52. switch (fieldname)
  53. {
  54. case "ID":
  55. {
  56. ret = ID.ToString();
  57. }
  58. ; break;
  59. case "FullName":
  60. {
  61. ret = FullName;
  62. }
  63. ; break;
  64. case "MD5":
  65. {
  66. ret = MD5;
  67. }
  68. ; break;
  69. case "Size":
  70. {
  71. ret = Size.ToString();
  72. }
  73. ; break;
  74. }
  75. return ret;
  76. }
  77. public DownloadDataEntity()
  78. {
  79. FullName = "";
  80. MD5 = "";
  81. Size = 0;
  82. // Version = "";
  83. State = DownloadTaskState.None;
  84. }
  85. public static void OnCsvLoad(CsvReader csvReader)
  86. {
  87. DownloadDataEntity.Onload_SetField(csvReader);
  88. }
  89. }