PathDefine.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. using XGame.Framework.Asset;
  2. using System;
  3. using UnityEngine;
  4. namespace XGame.Editor.Asset
  5. {
  6. public static class PathDefine
  7. {
  8. #region 常量
  9. /// <summary>
  10. /// Packages相对路径前缀
  11. /// </summary>
  12. public const string PackageRelative = "Packages/";
  13. /// <summary>
  14. /// Packages全路径前缀
  15. /// </summary>
  16. public const string PackageReality = "Library/PackageCache/";
  17. /// <summary>
  18. /// 框架在Package里的bundleId
  19. /// </summary>
  20. public const string XGameBundleId = "com.xgame.framework"; //"com.unity.ui.builder";
  21. /// <summary>
  22. /// Assets相对路径前缀
  23. /// </summary>
  24. public const string AssetsRelative = "Assets/";
  25. /// <summary>
  26. /// Addressable资源
  27. /// </summary>
  28. public const string ResAddressableName = "Res/Addressable";
  29. /// <summary>
  30. /// 静态资源,不可动态加载
  31. /// </summary>
  32. public const string ResStaticName = "Res/Static";
  33. /// <summary>
  34. /// Resources
  35. /// </summary>
  36. public const string ResourcesName = "Resources";
  37. /// <summary>
  38. /// i18n文件夹
  39. /// </summary>
  40. public const string I18nName = "i18n";
  41. ///// <summary>
  42. ///// ResStatic资源对应的bundle名前缀
  43. ///// </summary>
  44. //public const string rawBundlePrefix = "raw_";
  45. /// <summary>
  46. /// Lod资源文件名后缀
  47. /// 高品质
  48. /// </summary>
  49. public const string LodHigh = "_high";
  50. /// <summary>
  51. /// lod资源文件名后缀
  52. /// 低品质
  53. /// </summary>
  54. public const string LodLow = "_low";
  55. #endregion
  56. #region Package
  57. /// <summary>
  58. /// 框架在Package里的相对路径
  59. /// </summary>
  60. public static string XGamePackageRelative => $"{PackageRelative}{XGameBundleId}";
  61. /// <summary>
  62. /// 内置资源相对路径
  63. /// AssetDatabase.Load不支持"/"结尾
  64. /// </summary>
  65. public static string BuiltInResourcesRelative => $"{PackageRelative}{XGameBundleId}/{ResourcesName}";
  66. /// <summary>
  67. /// 内置资源ResStatic相对路径
  68. /// </summary>
  69. public static string BuiltInResTests => $"{PackageRelative}{XGameBundleId}/{ResStaticName}/Tests";
  70. #endregion
  71. #region Asset
  72. private static readonly string AppDataPath = Application.dataPath;
  73. public static readonly string AssetsEditor = "Assets/Editor";
  74. /// <summary>
  75. /// Addressable资源相对路径
  76. /// AssetDatabase.Load不支持"/"结尾
  77. /// </summary>
  78. public static string ResAddressableRelative = $"{AssetsRelative}{ResAddressableName}";
  79. /// <summary>
  80. /// 静态资源相对路径
  81. /// </summary>
  82. public static string ResStaticRelative = $"{AssetsRelative}{ResStaticName}";
  83. /// <summary>
  84. /// Resources相对路径
  85. /// </summary>
  86. public static string ResourcesRelative = $"{AssetsRelative}{ResourcesName}";
  87. /// <summary>
  88. /// 国际化资源目录相对路径
  89. /// </summary>
  90. public static string I18nAssetsRelative = $"{AssetsRelative}{I18nName}/";
  91. /// <summary>
  92. /// 动态资源全路径
  93. /// </summary>
  94. public static string ResAddressablePath => $"{AppDataPath}/{ResAddressableName}";
  95. /// <summary>
  96. /// 静态资源全路径
  97. /// </summary>
  98. public static string ResStaticPath => $"{AppDataPath}/{ResStaticName}";
  99. /// <summary>
  100. /// Resources全路径
  101. /// </summary>
  102. public static string ResourcesPath => $"{AppDataPath}/{ResourcesName}";
  103. /// <summary>
  104. /// 国际化资源目录全路径
  105. /// </summary>
  106. public static string I18nAssetsPath => $"{AppDataPath}/{I18nName}/";
  107. #endregion
  108. #region Addressable | AssetBundle
  109. /// <summary>
  110. /// bundle数据相对路径
  111. /// </summary>
  112. public static readonly string ConfigsRelative = "Assets/AssetConfigs/";
  113. public static readonly string AddressableDataRelative = $"{ConfigsRelative}Addressable/";
  114. public static string BundleManifestPath => $"{ConfigsRelative}{Define.ASSET_BUNDLE_MANIFEST}.asset";
  115. public static string ReferenceManifestPath => $"{ConfigsRelative}{Define.ASSET_REFERENCE_MANIFEST}.asset";
  116. public static string SceneAssetBundleManifestPath => $"{ConfigsRelative}{Define.SCENE_BUNDLE_MANIFEST}.asset";
  117. /// <summary>
  118. /// 项目资源的Addressable配置文件
  119. /// </summary>
  120. public static string ProductAssetManifestPath => $"{AddressableDataRelative}{Define.PRODUCT_ASSET_MANIFEST}.asset";
  121. /// <summary>
  122. /// 内置资源的Addressable配置文件
  123. /// </summary>
  124. public static string BuiltInAssetManifestPath => $"{AddressableDataRelative}{Define.BUILTIN_ASSET_MANIFEST}.asset";
  125. /// <summary>
  126. /// 测试资源的Addressable配置文件
  127. /// </summary>
  128. public static string TestAssetsManifestPath => $"{AddressableDataRelative}TestAssetsManifest.asset";
  129. /// <summary>
  130. /// Addressable的备份文件,用于记录自定义名字的资源信息
  131. /// </summary>
  132. public static string AddressableBackupManifestPath => $"{AddressableDataRelative}BackupManifest.asset";
  133. /// <summary>
  134. /// 分包规则配置文件
  135. /// </summary>
  136. public static string ABPackerManifestPath => $"{ConfigsRelative}PackerInfoManifest.asset";
  137. /// <summary>
  138. /// AssetsConfig路径
  139. /// </summary>
  140. public static string AssetsConfigPath => $"{AssetsEditor}/AssetsConfig.asset";
  141. #endregion
  142. /// <summary>
  143. /// ExtAssets文件夹路径
  144. /// </summary>
  145. public static string ExtAssetsPath => $"{Environment.CurrentDirectory.Replace("\\", "/")}/ExtAssets";
  146. /// <summary>
  147. /// 打包默认输出路径
  148. /// </summary>
  149. public static string DefaultOutputPath => $"{ExtAssetsPath}/output";
  150. /// <summary>
  151. /// AssetBundle输出路径
  152. /// </summary>
  153. public static string AssetBundleOutputPath => $"{ExtAssetsPath}/StreamAssets/{PlatformUtil.ActivePlatform}/AssetBundles";
  154. public static string TestsToAddressable => $"{AssetsRelative}Res/Tests";
  155. }
  156. }