ResPathUtil.cs 14 KB

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