ResPathUtil.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. using YooAsset;
  2. namespace GFGGame
  3. {
  4. public class ResPathUtil
  5. {
  6. public const string FONT_DIR_PATH = "Assets/ResIn/Font";
  7. public static readonly string UI_DIR_PATH = "Assets/ResIn/UI";
  8. public static readonly string UUI_DIR_PATH = "Assets/ResIn/UUI";
  9. public static readonly string PREFAB_DIR_PATH = "Assets/ResIn/Prefab";
  10. public static readonly string LoginRes_DIR_PATH = "Assets/ResIn/LoginRes";
  11. public static readonly string TEXTURE_FIGHT_DIR_PATH = "Assets/ResIn/Fight";
  12. public static readonly string CONFIG_DIR_PATH = "Assets/Game/CSShare/Sqlite";
  13. public const string RES_ROOT_DIR_PATH = "Assets/Res";
  14. public static readonly string MUSIC_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Music";
  15. public static readonly string SOUND_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Sound";
  16. public static readonly string VIDEO_DIR_PATH = $"{RES_ROOT_DIR_PATH}/video";
  17. public static readonly string TEXTURE_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Texture";
  18. public static readonly string TEXTURE_DRESSUP_DIR_PATH = $"{TEXTURE_DIR_PATH}/DressUp";
  19. public static readonly string TEXTURE_SCENEBG_DIR_PATH = $"{TEXTURE_DIR_PATH}/SceneBg";
  20. public static readonly string TEXTURE_BGIMG_DIR_PATH = $"{TEXTURE_DIR_PATH}/BgImg";
  21. public static readonly string ANIMATION_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Animation";
  22. public static readonly string EFFECT_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Effect";
  23. public static readonly string Material_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Material";
  24. public static readonly string Shader_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Shader";
  25. public static readonly string Model_DIR_PATH = $"{RES_ROOT_DIR_PATH}/model";
  26. public static readonly string STUDIO_FILING_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Texture/Studios/CYJD/";
  27. public static readonly string SQLITE_FILE_PATH = CONFIG_DIR_PATH + "/" + LauncherConfig.SQL_FILE_NAME;
  28. public static string GetUIPackagePath(string res)
  29. {
  30. return $"{UI_DIR_PATH}/{res}/{res}";
  31. }
  32. public static string GetUUIPrefabPath(string res)
  33. {
  34. return $"{UUI_DIR_PATH}/{res}.prefab";
  35. }
  36. public static string GetScorePath(int score)
  37. {
  38. return GetCommonGameResPath("kp_sx_" + score);
  39. }
  40. public static string GetCommonGameResPath(string res)
  41. {
  42. return "ui://CommonGame/" + res;
  43. }
  44. //===================================↑↑↑UI路径↑↑↑================================
  45. public static string GetIconPath(string res, string extName)
  46. {
  47. if (res.IndexOf("kp_") == 0)
  48. {
  49. return GetCardIconPath(res);
  50. }
  51. return $"{TEXTURE_DIR_PATH}/Icon/{res}.{extName}";
  52. }
  53. public static string GetIconPath(ItemCfg itemCfg)
  54. {
  55. return GetIconPath(itemCfg.res, ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType, true));
  56. }
  57. public static string GetBgImgPath(string res, string extName = "png")
  58. {
  59. return $"{TEXTURE_BGIMG_DIR_PATH}/{res}.{extName}";
  60. }
  61. public static string GetFightBgImgPath(string res, string extName = "png")
  62. {
  63. return $"{TEXTURE_FIGHT_DIR_PATH}/{res}.{extName}";
  64. }
  65. public static string GetSceneBgPath(string res, string extName = "jpg")
  66. {
  67. return $"{TEXTURE_SCENEBG_DIR_PATH}/{res}.{extName}";
  68. }
  69. public static string GetDressUpLayerSpriteResPath(ItemCfg itemCfg, int layerId)
  70. {
  71. string res = GetDressUpLayerResName(itemCfg, layerId);
  72. if(itemCfg.subType == ConstDressUpItemType.BEI_JING)
  73. {
  74. return GetSceneBgPath(res);
  75. }
  76. return GetDressUpPath(res);
  77. }
  78. public static string GetDressUpPath(string res, string extName = "png")
  79. {
  80. return $"{TEXTURE_DRESSUP_DIR_PATH}/{res}.{extName}";
  81. }
  82. public static string GetNpcPicSPath(string res, string extName = "png")
  83. {
  84. return $"{TEXTURE_DIR_PATH}/Npc/PicS/{res}.{extName}";
  85. }
  86. public static string GetNpcPicFPath(string res, string extName = "png")
  87. {
  88. return $"{TEXTURE_DIR_PATH}/Npc/PicF/{res}.{extName}";
  89. }
  90. public static string GetPhotographBorderPath(string res, string extName = "png")
  91. {
  92. return $"{TEXTURE_DIR_PATH}/Photograph/border/{res}.{extName}";
  93. }
  94. public static string GetFieldGuideIconPath(string res, string extName = "png")
  95. {
  96. return $"{TEXTURE_DIR_PATH}/FieldGuide/SuitIcon/{res}.{extName}";
  97. }
  98. public static string GetChapterGuideIconPath(string res, string extName = "png")
  99. {
  100. return $"{TEXTURE_DIR_PATH}/FieldGuide/ChapterIcon/{res}.{extName}";
  101. }
  102. public static string GetNpcHeadPath(string res, string extName = "png")
  103. {
  104. return $"{TEXTURE_DIR_PATH}/Npc/Head/{res}.{extName}";
  105. }
  106. public static string GetCardPath(string res, string extName = "jpg")
  107. {
  108. return $"{TEXTURE_DIR_PATH}/Card/Bg/{res}.{extName}";
  109. }
  110. public static string GetCardIconPath(string res, string extName = "jpg")
  111. {
  112. return $"{TEXTURE_DIR_PATH}/Card/Card/{res}.{extName}";
  113. }
  114. public static string GetCardSkillPath(string res, string extName = "png")
  115. {
  116. return $"{TEXTURE_DIR_PATH}/Card/Skill/{res}.{extName}";
  117. }
  118. public static string GetCardSoundPath(string res, string extName = "mp3")
  119. {
  120. return $"{SOUND_DIR_PATH}/Card/{res}.{extName}";
  121. }
  122. public static string GetVideoPath(string res, string extName = "mp4")
  123. {
  124. return $"{VIDEO_DIR_PATH}/{res}.{extName}";
  125. }
  126. public static string GetMusicPath(string res, string extName = "mp3")
  127. {
  128. return $"{MUSIC_DIR_PATH}/{res}.{extName}";
  129. }
  130. public static string GetFontPath(string res, string extName = "TTF")
  131. {
  132. return $"{FONT_DIR_PATH}/{res}.{extName}";
  133. }
  134. public static string GetPrefabPath(string res, string extName = "prefab")
  135. {
  136. return $"{PREFAB_DIR_PATH}/{res}.{extName}";
  137. }
  138. public static string GetLoginResPath(string res, string extName = "prefab")
  139. {
  140. return $"{LoginRes_DIR_PATH}/{res}.{extName}";
  141. }
  142. public static string GetDressUpAnimationDirPath(string res)
  143. {
  144. return $"{ANIMATION_DIR_PATH}/DressUp/{res}";
  145. }
  146. public static string GetDressUpLayerAnimationResPath(ItemCfg itemCfg, int layerId)
  147. {
  148. string res = GetDressUpLayerResName(itemCfg, layerId);
  149. return GetDressUpAnimationPath(res);
  150. }
  151. public static string GetDressUpAnimationPath(string res, string extName = "prefab")
  152. {
  153. return $"{GetDressUpAnimationDirPath(res)}/{res}.{extName}";
  154. }
  155. public static bool CheckDressUpAnimationResExist(string res, string extName = "prefab")
  156. {
  157. if (string.IsNullOrEmpty(res))
  158. {
  159. return false;
  160. }
  161. string resPath = ResPathUtil.GetDressUpAnimationPath(res, extName);
  162. return YooAssets.CheckResExist(resPath);
  163. }
  164. public static string GetDressUpLayerEffectResPath(ItemCfg itemCfg, int layerId)
  165. {
  166. string res = GetDressUpLayerResName(itemCfg, layerId);
  167. return GetDressUpEffectPath(res);
  168. }
  169. public static string GetDressUpEffectDirPath(string res)
  170. {
  171. return $"{EFFECT_DIR_PATH}/DressUp/{res}";
  172. }
  173. public static string GetDressUpEffectPath(string res, bool inAniDir = false, string extName = "prefab")
  174. {
  175. if (inAniDir)
  176. {
  177. return $"{GetDressUpEffectDirPath(res)}/{res}_2.{extName}";
  178. }
  179. return $"{GetDressUpEffectDirPath(res)}/{res}.{extName}";
  180. }
  181. public static string GetViewEffectPath(string uiName, string resName, string extName = "prefab")
  182. {
  183. return $"{EFFECT_DIR_PATH}/UI/{uiName}/{resName}.{extName}";
  184. }
  185. public static string GetCardAnimationPath(string res, string extName = "prefab")
  186. {
  187. return $"{ANIMATION_DIR_PATH}/Card/{res}/{res}.{extName}";
  188. }
  189. public static string GetActivityPath(string res, string extName = "jpg")
  190. {
  191. return $"{TEXTURE_DIR_PATH}/Activity/Activity/{res}.{extName}";
  192. }
  193. public static string GetActivityShow1Path(string res, string extName = "jpg")
  194. {
  195. return $"{TEXTURE_DIR_PATH}/Activity/Show1/{res}.{extName}";
  196. }
  197. public static string GetActivityShow2Path(string res, string extName = "jpg")
  198. {
  199. return $"{TEXTURE_DIR_PATH}/Activity/Show1/{res}.{extName}";
  200. }
  201. public static string GetTravelBgPath(string res, string extName = "png")
  202. {
  203. return $"{TEXTURE_DIR_PATH}/Travel/Bg/{res}.{extName}";
  204. }
  205. public static string GetTravelRolePath(string res, string extName = "png")
  206. {
  207. return $"{TEXTURE_DIR_PATH}/Travel/Role/{res}.{extName}";
  208. }
  209. public static string GetHeadPath(string res, string extName = "png")
  210. {
  211. return $"{TEXTURE_DIR_PATH}/Head/Head/{res}.{extName}";
  212. }
  213. public static string GetHeadBorderPath(string res, string extName = "png")
  214. {
  215. if (string.IsNullOrEmpty(res)) return "";
  216. return $"{TEXTURE_DIR_PATH}/Head/HeadBorder/{res}.{extName}";
  217. }
  218. public static string GetShaderPath(string res)
  219. {
  220. return $"{Shader_DIR_PATH}/{res}.shader";
  221. }
  222. public static string GetLeagueIconPath(string res, string extName = "png")
  223. {
  224. return $"{TEXTURE_DIR_PATH}/LeagueIcon/{res}.{extName}";
  225. }
  226. public static string GetDressUpLayerResName(ItemCfg itemCfg, int layerId)
  227. {
  228. string res = itemCfg.res;
  229. switch (layerId)
  230. {
  231. case 1:
  232. res = itemCfg.resLayer1 == "n" ? res : string.Format("{0}_{1}", res, itemCfg.resLayer1);
  233. break;
  234. case 2:
  235. res = itemCfg.resLayer2 == "n" ? res : string.Format("{0}_{1}", res, itemCfg.resLayer2);
  236. break;
  237. case 3:
  238. res = itemCfg.resLayer3 == "n" ? res : string.Format("{0}_{1}", res, itemCfg.resLayer3);
  239. break;
  240. }
  241. return res;
  242. }
  243. public static string GetStudioChapterPicPath(string res, string extName = "png")
  244. {
  245. return $"{STUDIO_FILING_DIR_PATH}{"dangan_"}{res}.{extName}";
  246. }
  247. public static string GetStudioFilingPicPath(string res, string extName = "png")
  248. {
  249. return $"{STUDIO_FILING_DIR_PATH}{res}.{extName}";
  250. }
  251. }
  252. }