ResPathUtil.cs 7.8 KB

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