GameUpdateAsset.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using UnityEngine;
  2. using Utility;
  3. using WeChatWASM;
  4. namespace Fort23.Mono.UpdateAsset
  5. {
  6. public class GameUpdateAsset : Singleton<GameUpdateAsset>
  7. {
  8. private string urlRoot;
  9. public void Init(string urlRoot)
  10. {
  11. this.urlRoot = urlRoot;
  12. LoadMD5();
  13. }
  14. private void LoadMD5()
  15. {
  16. string md5 = urlRoot + "MD5.txt";
  17. string loadMd5 = WX.PluginCachePath + "Bundle/MD5.txt";
  18. string str = WXDownload.Instance.GetCachePath(loadMd5);
  19. if (!string.IsNullOrEmpty(str))
  20. {
  21. Debug.Log("本地有缓存" + str);
  22. //本地有缓存
  23. }
  24. WXDownload.Instance.DownLoad(md5, "Bundle/MD5.txt", (bool isSuccess) =>
  25. {
  26. if (isSuccess)
  27. {
  28. Debug.Log("MD5下载成功");
  29. }
  30. else
  31. {
  32. Debug.Log("MD5下载失败");
  33. }
  34. });
  35. }
  36. }
  37. }