DebugPackageData.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using System.Text;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. namespace YooAsset
  6. {
  7. [Serializable]
  8. internal class DebugPackageData
  9. {
  10. /// <summary>
  11. /// 包裹名称
  12. /// </summary>
  13. public string PackageName;
  14. public List<DebugProviderInfo> ProviderInfos = new List<DebugProviderInfo>(1000);
  15. public List<DebugBundleInfo> BundleInfos = new List<DebugBundleInfo>(1000);
  16. public List<DebugOperationInfo> OperationInfos = new List<DebugOperationInfo>(1000);
  17. [NonSerialized]
  18. public Dictionary<string, DebugBundleInfo> BundleInfoDic = new Dictionary<string, DebugBundleInfo>();
  19. private bool _isParse = false;
  20. /// <summary>
  21. /// 获取调试资源包信息类
  22. /// </summary>
  23. public DebugBundleInfo GetBundleInfo(string bundleName)
  24. {
  25. // 解析数据
  26. if (_isParse == false)
  27. {
  28. _isParse = true;
  29. foreach (var bundleInfo in BundleInfos)
  30. {
  31. if (BundleInfoDic.ContainsKey(bundleInfo.BundleName) == false)
  32. {
  33. BundleInfoDic.Add(bundleInfo.BundleName, bundleInfo);
  34. }
  35. }
  36. }
  37. if (BundleInfoDic.TryGetValue(bundleName, out DebugBundleInfo value))
  38. {
  39. return value;
  40. }
  41. else
  42. {
  43. UnityEngine.Debug.LogError($"Can not found {nameof(DebugBundleInfo)} : {bundleName}");
  44. return default;
  45. }
  46. }
  47. }
  48. }