ResPathUtil.cs 11 KB

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