ResPathUtil.cs 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. namespace GFGGame
  2. {
  3. public class ResPathUtil
  4. {
  5. public const string FONT_DIR_PATH = "Assets/ResIn/Font";
  6. public static readonly string UI_DIR_PATH = "Assets/ResIn/UI";
  7. public static readonly string PREFAB_DIR_PATH = "Assets/ResIn/Prefab";
  8. public static readonly string TEXTURE_FIGHT_DIR_PATH = "Assets/ResIn/Fight";
  9. public static readonly string CONFIG_DIR_PATH = "Assets/Game/CSShare/Sqlite";
  10. public const string RES_ROOT_DIR_PATH = "Assets/Res";
  11. public static readonly string MUSIC_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Music";
  12. public static readonly string SOUND_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Sound";
  13. public static readonly string TEXTURE_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Texture";
  14. public static readonly string ANIMATION_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Animation";
  15. public static readonly string EFFECT_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Effect";
  16. public static readonly string Material_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Material";
  17. public static readonly string Shader_DIR_PATH = $"{RES_ROOT_DIR_PATH}/Shader";
  18. public static readonly string Model_DIR_PATH = $"{RES_ROOT_DIR_PATH}/model";
  19. public static readonly string SQLITE_FILE_PATH = CONFIG_DIR_PATH + "/" + LauncherConfig.SQL_FILE_NAME;
  20. public static string GetUIPackagePath(string res)
  21. {
  22. return $"{UI_DIR_PATH}/{res}/{res}";
  23. }
  24. public static string GetScorePath(int score)
  25. {
  26. return GetCommonGameResPath("kp_sx_" + score);
  27. }
  28. public static string GetCommonGameResPath(string res)
  29. {
  30. return "ui://CommonGame/" + res;
  31. }
  32. //===================================↑↑↑UI路径↑↑↑================================
  33. public static string GetIconPath(string res, string extName)
  34. {
  35. if (res.IndexOf("kp_") == 0)
  36. {
  37. return GetCardIconPath(res);
  38. }
  39. return $"{TEXTURE_DIR_PATH}/Icon/{res}.{extName}";
  40. }
  41. public static string GetIconPath(ItemCfg itemCfg)
  42. {
  43. return GetIconPath(itemCfg.res, ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType, true));
  44. }
  45. public static string GetBgImgPath(string res, string extName = "png")
  46. {
  47. return $"{TEXTURE_DIR_PATH}/BgImg/{res}.{extName}";
  48. }
  49. public static string GetFightBgImgPath(string res, string extName = "png")
  50. {
  51. return $"{TEXTURE_FIGHT_DIR_PATH}/{res}.{extName}";
  52. }
  53. public static string GetDressUpPath(string res, string extName = "png")
  54. {
  55. return $"{TEXTURE_DIR_PATH}/DressUp/{res}.{extName}";
  56. }
  57. public static string GetNpcPicSPath(string res, string extName = "png")
  58. {
  59. return $"{TEXTURE_DIR_PATH}/Npc/PicS/{res}.{extName}";
  60. }
  61. public static string GetNpcPicFPath(string res, string extName = "png")
  62. {
  63. return $"{TEXTURE_DIR_PATH}/Npc/PicF/{res}.{extName}";
  64. }
  65. public static string GetPhotographBorderPath(string res, string extName = "png")
  66. {
  67. return $"{TEXTURE_DIR_PATH}/Photograph/border/{res}.{extName}";
  68. }
  69. public static string GetFieldGuideIconPath(string res, string extName = "png")
  70. {
  71. return $"{TEXTURE_DIR_PATH}/FieldGuide/SuitIcon/{res}.{extName}";
  72. }
  73. public static string GetChapterGuideIconPath(string res, string extName = "png")
  74. {
  75. return $"{TEXTURE_DIR_PATH}/FieldGuide/ChapterIcon/{res}.{extName}";
  76. }
  77. public static string GetNpcHeadPath(string res, string extName = "png")
  78. {
  79. return $"{TEXTURE_DIR_PATH}/Npc/Head/{res}.{extName}";
  80. }
  81. public static string GetCardPath(string res, string extName = "jpg")
  82. {
  83. return $"{TEXTURE_DIR_PATH}/Card/Bg/{res}.{extName}";
  84. }
  85. public static string GetCardIconPath(string res, string extName = "jpg")
  86. {
  87. return $"{TEXTURE_DIR_PATH}/Card/Card/{res}.{extName}";
  88. }
  89. public static string GetCardSkillPath(string res, string extName = "png")
  90. {
  91. return $"{TEXTURE_DIR_PATH}/Card/Skill/{res}.{extName}";
  92. }
  93. public static string GetCardSoundPath(string res, string extName = "mp3")
  94. {
  95. return $"{SOUND_DIR_PATH}/Card/{res}.{extName}";
  96. }
  97. public static string GetMusicPath(string res, string extName = "mp3")
  98. {
  99. return $"{MUSIC_DIR_PATH}/{res}.{extName}";
  100. }
  101. public static string GetFontPath(string res, string extName = "TTF")
  102. {
  103. return $"{FONT_DIR_PATH}/{res}.{extName}";
  104. }
  105. public static string GetPrefabPath(string res, string extName = "prefab")
  106. {
  107. return $"{PREFAB_DIR_PATH}/{res}.{extName}";
  108. }
  109. public static string GetDressUpAnimationDirPath(string res)
  110. {
  111. return $"{ANIMATION_DIR_PATH}/DressUp/{res}";
  112. }
  113. public static string GetDressUpAnimationPath(string res, string extName = "prefab")
  114. {
  115. return $"{GetDressUpAnimationDirPath(res)}/{res}.{extName}";
  116. }
  117. public static bool CheckDressUpAnimationResExist(string res, string extName = "prefab")
  118. {
  119. if (string.IsNullOrEmpty(res))
  120. {
  121. return false;
  122. }
  123. string resPath = ResPathUtil.GetDressUpAnimationPath(res, extName);
  124. return VEngine.Versions.Contains(resPath);
  125. }
  126. public static string GetDressUpEffectDirPath(string res)
  127. {
  128. return $"{EFFECT_DIR_PATH}/DressUp/{res}";
  129. }
  130. public static string GetDressUpEffectPath(string res, bool inAniDir = false, string extName = "prefab")
  131. {
  132. if (inAniDir)
  133. {
  134. return $"{GetDressUpEffectDirPath(res)}/{res}_2.{extName}";
  135. }
  136. return $"{GetDressUpEffectDirPath(res)}/{res}.{extName}";
  137. }
  138. public static string GetViewEffectPath(string uiName, string resName, string extName = "prefab")
  139. {
  140. return $"{EFFECT_DIR_PATH}/UI/{uiName}/{resName}.{extName}";
  141. }
  142. public static string GetCardAnimationPath(string res, string extName = "prefab")
  143. {
  144. return $"{ANIMATION_DIR_PATH}/Card/{res}/{res}.{extName}";
  145. }
  146. public static string GetActivityPath(string res, string extName = "jpg")
  147. {
  148. return $"{TEXTURE_DIR_PATH}/Activity/Activity/{res}.{extName}";
  149. }
  150. public static string GetActivityShow1Path(string res, string extName = "jpg")
  151. {
  152. return $"{TEXTURE_DIR_PATH}/Activity/Show1/{res}.{extName}";
  153. }
  154. public static string GetActivityShow2Path(string res, string extName = "jpg")
  155. {
  156. return $"{TEXTURE_DIR_PATH}/Activity/Show1/{res}.{extName}";
  157. }
  158. public static string GetTravelBgPath(string res, string extName = "png")
  159. {
  160. return $"{TEXTURE_DIR_PATH}/Travel/Bg/{res}.{extName}";
  161. }
  162. public static string GetTravelRolePath(string res, string extName = "png")
  163. {
  164. return $"{TEXTURE_DIR_PATH}/Travel/Role/{res}.{extName}";
  165. }
  166. public static string GetHeadPath(string res, string extName = "png")
  167. {
  168. return $"{TEXTURE_DIR_PATH}/Head/Head/{res}.{extName}";
  169. }
  170. public static string GetHeadBorderPath(string res, string extName = "png")
  171. {
  172. if (string.IsNullOrEmpty(res)) return "";
  173. return $"{TEXTURE_DIR_PATH}/Head/HeadBorder/{res}.{extName}";
  174. }
  175. public static string GetShaderPath(string res)
  176. {
  177. return $"{Shader_DIR_PATH}/{res}.shader";
  178. }
  179. public static string GetLeagueIconPath(string res, string extName = "png")
  180. {
  181. return $"{TEXTURE_DIR_PATH}/LeagueIcon/{res}.{extName}";
  182. }
  183. }
  184. }