ResPathUtil.cs 12 KB

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