AssetBundleData.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. namespace XGame.Editor.Build.AssetBundles
  2. {
  3. /// <summary>
  4. /// AssetBundle分类
  5. /// </summary>
  6. public enum AssetBundleType
  7. {
  8. Addressable = 0x01,
  9. Raw = 0x02,
  10. Dependency = 0x04,
  11. }
  12. /// <summary>
  13. /// <para>AssetBundle building map entry.</para>
  14. /// </summary>
  15. public struct AssetBundleData
  16. {
  17. /// <summary>
  18. /// <para>AssetBundle name.</para>
  19. /// </summary>
  20. public string assetBundleName;
  21. /// <summary>
  22. /// <para>AssetBundle variant.</para>
  23. /// </summary>
  24. public string assetBundleVariant;
  25. /// <summary>
  26. /// <para>Asset names which belong to the given AssetBundle.</para>
  27. /// </summary>
  28. public string[] assetNames;
  29. /// <summary>
  30. /// <para>Addressable name used to load an asset.</para>
  31. /// </summary>
  32. public string[] addressableNames;
  33. public uint bundleId;
  34. public string originBundleName;
  35. /// <summary>
  36. /// assetNames全部为贴图为true
  37. /// </summary>
  38. public bool isTextureBundle;
  39. /// <summary>
  40. /// AB类型
  41. /// </summary>
  42. public AssetBundleType bundleType;
  43. public string FullName
  44. {
  45. get
  46. {
  47. if (string.IsNullOrEmpty(assetBundleName))
  48. {
  49. return string.Empty;
  50. }
  51. return string.IsNullOrEmpty(assetBundleVariant) ? assetBundleName : $"{assetBundleName}.{assetBundleVariant}";
  52. }
  53. }
  54. public UnityEditor.AssetBundleBuild ToUniBuild()
  55. {
  56. var build = new UnityEditor.AssetBundleBuild()
  57. {
  58. assetBundleName = assetBundleName,
  59. assetBundleVariant = assetBundleVariant,
  60. assetNames = assetNames,
  61. addressableNames = addressableNames,
  62. };
  63. return build;
  64. }
  65. }
  66. }