LocalBundleLoadTask.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Reflection;
  5. using Core.AssetLoadTool.Asset;
  6. using Core.Utility;
  7. using Fort23.Core;
  8. using Fort23.UTool;
  9. using UnityEngine;
  10. using Utility;
  11. public class LocalBundleLoadTask : BundleLoadBasic
  12. {
  13. protected override void StartLoad()
  14. {
  15. LoadBudnel();
  16. }
  17. private void LoadBudnel()
  18. {
  19. string url = AssetBundleLoadManager.Instance.RootPersistentBundleURL + bundleName;
  20. bool isOk = true;
  21. if (!File.Exists(url))
  22. {
  23. url = AssetBundleLoadManager.Instance.RootStreamingBundleURL + bundleName;
  24. isOk = false;
  25. /*1.0 iOS的代码,先注释了*/
  26. // url= Application.streamingAssetsPath + "/Bundle/" + bundleName;
  27. }
  28. this.url = url;
  29. AssetBundleCreateRequest bundleReq = AssetBundle.LoadFromFileAsync(url);
  30. bundleReq.completed += delegate(AsyncOperation operation)
  31. {
  32. if (bundleReq.assetBundle == null)
  33. {
  34. LogTool.Error(isOk+" budnle空的" + url + "__" + bundleName);
  35. }
  36. LoadFinish(bundleReq.assetBundle);
  37. };
  38. }
  39. }