ResPathUtil.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  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 GetFontPath(string res, string extName = "TTF")
  144. {
  145. return $"{FONT_DIR_PATH}/{res}.{extName}";
  146. }
  147. public static string GetPrefabPath(string res, string extName = "prefab")
  148. {
  149. return $"{PREFAB_DIR_PATH}/{res}.{extName}";
  150. }
  151. public static string GetMaterialPath(string res, string extName = "mat")
  152. {
  153. return $"{MATERIAL_DIR_PATH}/{res}.{extName}";
  154. }
  155. public static string GetLoginResPath(string res, string extName = "prefab")
  156. {
  157. return $"{LoginRes_DIR_PATH}/{res}.{extName}";
  158. }
  159. public static string GetDressUpAnimationDirPath(string res)
  160. {
  161. return $"{ANIMATION_DIR_PATH}/DressUp/{res}";
  162. }
  163. public static string GetDressUpLayerAnimationResPath(ItemCfg itemCfg, int layerId)
  164. {
  165. string res = GetDressUpLayerResName(itemCfg, layerId);
  166. return GetDressUpAnimationPath(res);
  167. }
  168. public static string GetDressUpAnimationPath(string res, string extName = "prefab")
  169. {
  170. return $"{GetDressUpAnimationDirPath(res)}/{res}.{extName}";
  171. }
  172. public static bool CheckDressUpAnimationResExist(string res, string extName = "prefab")
  173. {
  174. if (string.IsNullOrEmpty(res))
  175. {
  176. return false;
  177. }
  178. string resPath = ResPathUtil.GetDressUpAnimationPath(res, extName);
  179. return YooAssets.CheckResExist(resPath);
  180. }
  181. public static string GetDressUpLayerEffectResPath(ItemCfg itemCfg, int layerId, bool inAniDir)
  182. {
  183. if(DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(itemCfg.Id))
  184. {
  185. //场景类型的物品特效都不分动画和静态
  186. inAniDir = false;
  187. }
  188. string res = GetDressUpLayerResName(itemCfg, layerId);
  189. return GetDressUpEffectPath(res, inAniDir);
  190. }
  191. public static string GetDressUpEffectDirPath(string res)
  192. {
  193. return $"{EFFECT_DIR_PATH}/DressUp/{res}";
  194. }
  195. public static string GetDressUpEffectPath(string res, bool inAniDir, string extName = "prefab")
  196. {
  197. if (inAniDir)
  198. {
  199. return $"{GetDressUpEffectDirPath(res)}/{res}_2.{extName}";
  200. }
  201. return $"{GetDressUpEffectDirPath(res)}/{res}.{extName}";
  202. }
  203. public static string GetViewEffectPath(string uiName, string resName, string extName = "prefab")
  204. {
  205. return $"{EFFECT_DIR_PATH}/UI/{uiName}/{resName}.{extName}";
  206. }
  207. public static string GetCardAnimationPath(string res, string extName = "prefab")
  208. {
  209. return $"{ANIMATION_DIR_PATH}/Card/{res}/{res}.{extName}";
  210. }
  211. public static string GetActivityPath(string res, string extName = "png")
  212. {
  213. return $"{TEXTURE_DIR_PATH}/Activity/Activity/{res}.{extName}";
  214. }
  215. public static string GetActivityShow1Path(string res, string extName = "jpg")
  216. {
  217. return $"{TEXTURE_DIR_PATH}/Activity/Show1/{res}.{extName}";
  218. }
  219. public static string GetActivityShow2Path(string res, string extName = "jpg")
  220. {
  221. return $"{TEXTURE_DIR_PATH}/Activity/Show1/{res}.{extName}";
  222. }
  223. public static string GetTravelBgPath(string res, string extName = "png")
  224. {
  225. return $"{TEXTURE_DIR_PATH}/Travel/Bg/{res}.{extName}";
  226. }
  227. public static string GetTravelRolePath(string res, string extName = "png")
  228. {
  229. return $"{TEXTURE_DIR_PATH}/Travel/Role/{res}.{extName}";
  230. }
  231. public static string GetHeadPath(string res, string extName = "png")
  232. {
  233. return $"{TEXTURE_DIR_PATH}/Head/Head/{res}.{extName}";
  234. }
  235. public static string GetHeadBorderPath(string res, string extName = "png")
  236. {
  237. if (string.IsNullOrEmpty(res)) return "";
  238. return $"{TEXTURE_DIR_PATH}/Head/HeadBorder/{res}.{extName}";
  239. }
  240. public static string GetShaderPath(string res)
  241. {
  242. return $"{Shader_DIR_PATH}/{res}.shader";
  243. }
  244. public static string GetLeagueIconPath(string res, string extName = "png")
  245. {
  246. return $"{TEXTURE_DIR_PATH}/LeagueIcon/{res}.{extName}";
  247. }
  248. public static string GetDressUpLayerResName(ItemCfg itemCfg, int layerId)
  249. {
  250. string res = itemCfg.Res;
  251. switch (layerId)
  252. {
  253. case 1:
  254. res = itemCfg.ResLayer1 == "n" ? res : string.Format("{0}_{1}", res, itemCfg.ResLayer1);
  255. break;
  256. case 2:
  257. res = itemCfg.ResLayer2 == "n" ? res : string.Format("{0}_{1}", res, itemCfg.ResLayer2);
  258. break;
  259. case 3:
  260. res = itemCfg.ResLayer3 == "n" ? res : string.Format("{0}_{1}", res, itemCfg.ResLayer3);
  261. break;
  262. }
  263. return res;
  264. }
  265. public static string GetStudioChapterPicPath(string res, string extName = "png")
  266. {
  267. return $"{STUDIO_FILING_DIR_PATH}{"dangan_"}{res}.{extName}";
  268. }
  269. public static string GetStudioFilingPicPath(string res, string extName = "png")
  270. {
  271. return $"{STUDIO_FILING_DIR_PATH}{res}.{extName}";
  272. }
  273. public static string GetStoryDialogCGPath(string dir, string res, string extName = "prefab")
  274. {
  275. return $"{ANIMATION_DIR_PATH}/{dir}/{res}.{extName}";
  276. }
  277. public static string GetMiniGamePicPath(string res, string dir = null, string extName = "png")
  278. {
  279. return $"{MINIGAME_DIR_PATH}{dir}/{res}.{extName}";
  280. }
  281. public static string GetHUARONGDAOPicPath(string res, string extName = "png")
  282. {
  283. return $"{MINIGAME_DIR_PATH}HRDGame/{res}.{extName}";
  284. }
  285. public static string GetLuckyBoxTitlePath(string res, string extName = "png")
  286. {
  287. return $"{LUCKY_BOX_TITLE_PATH}{res}.{extName}";
  288. }
  289. public static string GetEmojiResPath(string dir, string res, string extName = "prefab")
  290. {
  291. return $"{ANIMATION_DIR_PATH}/{dir}/{res}.{extName}";
  292. }
  293. }
  294. }