ResPathUtil.cs 14 KB

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