ResPathUtil.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. using cfg.GfgCfg;
  2. using ET;
  3. using YooAsset;
  4. namespace GFGGame
  5. {
  6. public class ResPathUtil
  7. {
  8. public const string FONT_DIR_PATH = "Assets/ResIn/Font";
  9. public static readonly string UI_DIR_PATH = "Assets/ResIn/UI";
  10. public static readonly string UUI_DIR_PATH = "Assets/ResIn/UUI";
  11. public static readonly string PREFAB_DIR_PATH = "Assets/ResIn/Prefab";
  12. public static readonly string MATERIAL_DIR_PATH = "Assets/ResIn/Material";
  13. public static readonly string LoginRes_DIR_PATH = "Assets/ResIn/LoginRes";
  14. public static readonly string TEXTURE_FIGHT_DIR_PATH = "Assets/ResIn/Fight";
  15. public static readonly string CONFIG_DIR_PATH = "Assets/Game/CSShare/GFG/HotUpdate/LuBanConfig/LubanData";
  16. public static readonly string LiHuiPath = "Assets/ResIn/Illustrations";
  17. public const string RES_ROOT_DIR_PATH = "Assets/Res";
  18. public static readonly string MUSIC_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Music";
  19. public static readonly string SOUND_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Sound";
  20. public static readonly string Voice_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Voice";
  21. public static readonly string VIDEO_DIR_PATH = $"{RES_ROOT_DIR_PATH}/video";
  22. public static readonly string TEXTURE_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Texture";
  23. public static readonly string TEXTURE_DRESSUP_DIR_PATH = $"{TEXTURE_DIR_PATH}/DressUp";
  24. public static readonly string TEXTURE_SCENEBG_DIR_PATH = $"{TEXTURE_DIR_PATH}/SceneBg";
  25. public static readonly string TEXTURE_BGIMG_DIR_PATH = $"{TEXTURE_DIR_PATH}/BgImg";
  26. public static readonly string ANIMATION_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Animation";
  27. public static readonly string EFFECT_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Effect";
  28. public static readonly string Material_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Material";
  29. public static readonly string Shader_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Shader";
  30. public static readonly string Model_DIR_PATH = $"{RES_ROOT_DIR_PATH}/model";
  31. public static readonly string STUDIO_FILING_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Texture/Studios/CYJD/";
  32. public static readonly string MINIGAME_DIR_PATH = $"{TEXTURE_DIR_PATH}/MiniGame/";
  33. public static readonly string LUCKY_BOX_TITLE_PATH = $"{TEXTURE_DIR_PATH}/LuckyBoxTitleImg/";
  34. public static string GetUIPackagePath(string res)
  35. {
  36. return $"{UI_DIR_PATH}/{res}/{res}";
  37. }
  38. public static string GetUUIPrefabPath(string res)
  39. {
  40. return $"{UUI_DIR_PATH}/{res}.prefab";
  41. }
  42. public static string GetScorePath(int score)
  43. {
  44. return GetCommonGameResPath("kp_sx_" + score);
  45. }
  46. public static string GetCommonGameResPath(string res)
  47. {
  48. return "ui://CommonGame/" + res;
  49. }
  50. //===================================↑↑↑UI路径↑↑↑================================
  51. public static string GetIconPath(string res, string extName)
  52. {
  53. if (res.IndexOf("kp_") == 0)
  54. {
  55. return GetCardIconPath(res);
  56. }
  57. return $"{TEXTURE_DIR_PATH}/Icon/{res}.{extName}";
  58. }
  59. public static string GetIconPath(ItemCfg itemCfg)
  60. {
  61. return GetIconPath(itemCfg.Res, ItemUtil.GetItemResExt(itemCfg.ItemType, itemCfg.SubType, true));
  62. }
  63. public static string GetBgImgPath(string res, string extName = "png")
  64. {
  65. return $"{TEXTURE_BGIMG_DIR_PATH}/{res}.{extName}";
  66. }
  67. public static string GetFightBgImgPath(string res, string extName = "png")
  68. {
  69. return $"{TEXTURE_FIGHT_DIR_PATH}/{res}.{extName}";
  70. }
  71. public static string GetSceneBgPath(string res, string extName = "jpg")
  72. {
  73. return $"{TEXTURE_SCENEBG_DIR_PATH}/{res}.{extName}";
  74. }
  75. //获取配置路径
  76. public static string GetConfigPath(string cfgName)
  77. {
  78. string path = CONFIG_DIR_PATH + $"/{cfgName}.json";
  79. return path;
  80. }
  81. public static string GetDressUpLayerSpriteResPath(ItemCfg itemCfg, int layerId)
  82. {
  83. string res = GetDressUpLayerResName(itemCfg, layerId);
  84. if (itemCfg.SubType == ConstDressUpItemType.BEI_JING)
  85. {
  86. return GetSceneBgPath(res);
  87. }
  88. return GetDressUpPath(res);
  89. }
  90. public static string GetDressUpPath(string res, string extName = "png")
  91. {
  92. return $"{TEXTURE_DRESSUP_DIR_PATH}/{res}.{extName}";
  93. }
  94. public static string GetNpcPicSPath(string res, string extName = "png")
  95. {
  96. return $"{TEXTURE_DIR_PATH}/Npc/PicS/{res}.{extName}";
  97. }
  98. public static string GetNpcPicFPath(string res, string extName = "png")
  99. {
  100. return $"{TEXTURE_DIR_PATH}/Npc/PicF/{res}.{extName}";
  101. }
  102. public static string GetNpcPicFacePath(string res, string extName = "png")
  103. {
  104. return $"{TEXTURE_DIR_PATH}/Npc/Face/{res}.{extName}";
  105. }
  106. public static string GetPhotographBorderPath(string res, string extName = "png")
  107. {
  108. return $"{TEXTURE_DIR_PATH}/Photograph/border/{res}.{extName}";
  109. }
  110. public static string GetFieldGuideIconPath(string res, string extName = "png")
  111. {
  112. return $"{TEXTURE_DIR_PATH}/FieldGuide/SuitIcon/{res}.{extName}";
  113. }
  114. public static string GetChapterGuideIconPath(string res, string extName = "png")
  115. {
  116. return $"{TEXTURE_DIR_PATH}/FieldGuide/ChapterIcon/{res}.{extName}";
  117. }
  118. public static string GetNpcHeadPath(string res, string extName = "png")
  119. {
  120. return $"{TEXTURE_DIR_PATH}/Npc/Head/{res}.{extName}";
  121. }
  122. public static string GetCardPath(string res, string extName = "jpg")
  123. {
  124. return $"{TEXTURE_DIR_PATH}/Card/Bg/{res}.{extName}";
  125. }
  126. public static string GetCardIconPath(string res, string extName = "jpg")
  127. {
  128. return $"{TEXTURE_DIR_PATH}/Card/Card/{res}.{extName}";
  129. }
  130. public static string GetCardSkillPath(string res, string extName = "png")
  131. {
  132. return $"{TEXTURE_DIR_PATH}/Card/Skill/{res}.{extName}";
  133. }
  134. public static string GetCardSoundPath(string res, string extName = "mp3")
  135. {
  136. return $"{SOUND_DIR_PATH}/Card/{res}.{extName}";
  137. }
  138. public static string GetVoicePath(string res, string extName = "wav")
  139. {
  140. return $"{Voice_DIR_PATH}/{res}.{extName}";
  141. }
  142. public static string GetVideoPath(string res, string extName = "mp4")
  143. {
  144. return $"{VIDEO_DIR_PATH}/{res}.{extName}";
  145. }
  146. public static string GetMusicPath(string res, string extName = "mp3")
  147. {
  148. return $"{MUSIC_DIR_PATH}/{res}.{extName}";
  149. }
  150. public static string GetLiHuiPath(string res, string extName = "png")
  151. {
  152. return $"{LiHuiPath}/{res}.{extName}";
  153. }
  154. public static string GetFontPath2(string res, string extName = "TTF")
  155. {
  156. return $"{FONT_DIR_PATH}/GameFont2/{res}.{extName}";
  157. }
  158. public static string GetFontPath3(string res, string extName = "TTF")
  159. {
  160. return $"{FONT_DIR_PATH}/GameFont3/{res}.{extName}";
  161. }
  162. public static string GetFontPath4(string res, string extName = "TTF")
  163. {
  164. return $"{FONT_DIR_PATH}/GameFont4/{res}.{extName}";
  165. }
  166. public static string GetFontPath5(string res, string extName = "TTF")
  167. {
  168. return $"{FONT_DIR_PATH}/GameFont5/{res}.{extName}";
  169. }
  170. public static string GetPrefabPath(string res, string extName = "prefab")
  171. {
  172. return $"{PREFAB_DIR_PATH}/{res}.{extName}";
  173. }
  174. public static string GetMaterialPath(string res, string extName = "mat")
  175. {
  176. return $"{MATERIAL_DIR_PATH}/{res}.{extName}";
  177. }
  178. public static string GetLoginResPath(string res, string extName = "prefab")
  179. {
  180. return $"{LoginRes_DIR_PATH}/{res}.{extName}";
  181. }
  182. public static string GetDressUpAnimationDirPath(string res)
  183. {
  184. return $"{ANIMATION_DIR_PATH}/DressUp/{res}";
  185. }
  186. public static string GetDressUpLayerAnimationResPath(ItemCfg itemCfg, int layerId)
  187. {
  188. string res = GetDressUpLayerResName(itemCfg, layerId);
  189. return GetDressUpAnimationPath(res);
  190. }
  191. public static string GetDressUpAnimationPath(string res, string extName = "prefab")
  192. {
  193. return $"{GetDressUpAnimationDirPath(res)}/{res}.{extName}";
  194. }
  195. public static bool CheckDressUpAnimationResExist(string res, string extName = "prefab")
  196. {
  197. if (string.IsNullOrEmpty(res))
  198. {
  199. return false;
  200. }
  201. string resPath = ResPathUtil.GetDressUpAnimationPath(res, extName);
  202. return YooAssetsEx.CheckResExist(resPath);
  203. }
  204. public static string GetDressUpLayerEffectResPath(ItemCfg itemCfg, int layerId, bool inAniDir)
  205. {
  206. if (DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(itemCfg.Id))
  207. {
  208. //场景类型的物品特效都不分动画和静态
  209. inAniDir = false;
  210. }
  211. string res = GetDressUpLayerResName(itemCfg, layerId);
  212. return GetDressUpEffectPath(res, inAniDir);
  213. }
  214. public static string GetDressUpEffectDirPath(string res)
  215. {
  216. return $"{EFFECT_DIR_PATH}/DressUp/{res}";
  217. }
  218. public static string GetDressUpEffectPath(string res, bool inAniDir, string extName = "prefab")
  219. {
  220. if (inAniDir)
  221. {
  222. return $"{GetDressUpEffectDirPath(res)}/{res}_2.{extName}";
  223. }
  224. return $"{GetDressUpEffectDirPath(res)}/{res}.{extName}";
  225. }
  226. public static string GetViewEffectPath(string uiName, string resName, string extName = "prefab")
  227. {
  228. return $"{EFFECT_DIR_PATH}/UI/{uiName}/{resName}.{extName}";
  229. }
  230. public static string GetCardAnimationPath(string res, string extName = "prefab")
  231. {
  232. return $"{ANIMATION_DIR_PATH}/Card/{res}/{res}.{extName}";
  233. }
  234. public static string GetActivityPath(string res, string extName = "png")
  235. {
  236. return $"{TEXTURE_DIR_PATH}/Activity/Activity/{res}.{extName}";
  237. }
  238. public static string GetActivityShow1Path(string res, string extName = "jpg")
  239. {
  240. return $"{TEXTURE_DIR_PATH}/Activity/Show1/{res}.{extName}";
  241. }
  242. public static string GetActivityShow2Path(string res, string extName = "jpg")
  243. {
  244. return $"{TEXTURE_DIR_PATH}/Activity/Show1/{res}.{extName}";
  245. }
  246. public static string GetTravelBgPath(string res, string extName = "png")
  247. {
  248. return $"{TEXTURE_DIR_PATH}/Travel/Bg/{res}.{extName}";
  249. }
  250. public static string GetTravelRolePath(string res, string extName = "png")
  251. {
  252. return $"{TEXTURE_DIR_PATH}/Travel/Role/{res}.{extName}";
  253. }
  254. public static string GetHeadPath(string res, string extName = "png")
  255. {
  256. return $"{TEXTURE_DIR_PATH}/Head/Head/{res}.{extName}";
  257. }
  258. public static string GetHeadBorderPath(string res, string extName = "png")
  259. {
  260. if (string.IsNullOrEmpty(res)) return "";
  261. return $"{TEXTURE_DIR_PATH}/Head/HeadBorder/{res}.{extName}";
  262. }
  263. public static string GetShaderPath(string res)
  264. {
  265. return $"{Shader_DIR_PATH}/{res}.shader";
  266. }
  267. public static string GetLeagueIconPath(string res, string extName = "png")
  268. {
  269. return $"{TEXTURE_DIR_PATH}/LeagueIcon/{res}.{extName}";
  270. }
  271. public static string GetFontPath1(string res, string extName = "TTF")
  272. {
  273. return $"{FONT_DIR_PATH}/GameFont1/{res}.{extName}";
  274. }
  275. public static string GetDressUpLayerResName(ItemCfg itemCfg, int layerId)
  276. {
  277. string res = itemCfg.Res;
  278. switch (layerId)
  279. {
  280. case 1:
  281. res = itemCfg.ResLayer1 == "n" ? res : string.Format("{0}_{1}", res, itemCfg.ResLayer1);
  282. break;
  283. case 2:
  284. res = itemCfg.ResLayer2 == "n" ? res : string.Format("{0}_{1}", res, itemCfg.ResLayer2);
  285. break;
  286. case 3:
  287. res = itemCfg.ResLayer3 == "n" ? res : string.Format("{0}_{1}", res, itemCfg.ResLayer3);
  288. break;
  289. }
  290. return res;
  291. }
  292. public static string GetStudioChapterPicPath(string res, string extName = "png")
  293. {
  294. return $"{STUDIO_FILING_DIR_PATH}{"dangan_"}{res}.{extName}";
  295. }
  296. public static string GetStudioFilingPicPath(string res, string extName = "png")
  297. {
  298. return $"{STUDIO_FILING_DIR_PATH}{res}.{extName}";
  299. }
  300. public static string GetStoryDialogCGPath(string dir, string res, string extName = "prefab")
  301. {
  302. return $"{ANIMATION_DIR_PATH}/{dir}/{res}.{extName}";
  303. }
  304. public static string GetMiniGamePicPath(string res, string dir = null, string extName = "png")
  305. {
  306. return $"{MINIGAME_DIR_PATH}{dir}/{res}.{extName}";
  307. }
  308. public static string GetHUARONGDAOPicPath(string res, string extName = "png")
  309. {
  310. return $"{MINIGAME_DIR_PATH}HRDGame/{res}.{extName}";
  311. }
  312. public static string GetLuckyBoxTitlePath(string res, string extName = "png")
  313. {
  314. return $"{LUCKY_BOX_TITLE_PATH}{res}.{extName}";
  315. }
  316. public static string GetEmojiResPath(string dir, string res, string extName = "prefab")
  317. {
  318. return $"{ANIMATION_DIR_PATH}/{dir}/{res}.{extName}";
  319. }
  320. }
  321. }