TargetPrefabRenamer.cs 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text.RegularExpressions;
  6. using Excel4Unity;
  7. using SSTRGame;
  8. using UnityEditor;
  9. using UnityEngine;
  10. public class TargetPrefabRenamer
  11. {
  12. // 假设重命名表是一个字典,键是旧名称,值是新名称
  13. private static readonly Dictionary<string, string> PrefabRenameTable = new Dictionary<string, string>
  14. {
  15. {"airplane_yellow", "feiji_lan"},
  16. {"ammobox", "danyaoxiang"},
  17. {"anim_butterfly_backup", "hudie"},
  18. {"animnode", "animnode"},
  19. {"barrel", "youtong_huang"},
  20. {"bottle_rotate", "pingzi_xuanzhuan"},
  21. {"bottle1_rope1", "pingzi_shengzi_1"},
  22. {"bottle1_rope2", "pingzi_shengzi_2"},
  23. {"bottle1_rope3", "pingzi_shengzi_3"},
  24. {"bottle1", "jiuping_1"},
  25. {"bottlenb", "jiuping_wuli"},
  26. {"car_road", "jizhuangxiang_paodao"},
  27. {"car", "che_1"},
  28. {"cement_ducts", "shuiniguandao"},
  29. {"clayshoot_se", "feipan_0"},
  30. {"clayshoot", "feipan_se"},
  31. {"cmsdistancesign@30", "jvlixinhao_30"},
  32. {"cmsdistancesign@50", "jvlixinhao_50"},
  33. {"cmsdistancesign@70", "jvlixinhao_70"},
  34. {"cmsdistancesign@90", "jvlixinhao_90"},
  35. {"cmsdistancesign@110", "jvlixinhao_110"},
  36. {"cmsdistancesign@130", "jvlixinhao_130"},
  37. {"concrete_support", "hunningtuzhicheng"},
  38. {"container_lift", "jizhuangxiang_guandao"},
  39. {"container_wheel_1", "jizhuangxiang_xiangdui_1"},
  40. {"container_wheel", "jizhuangxiang_xiangdui_2"},
  41. {"container", "jizhuangxiang"},
  42. {"dummy_7", "heiyirenxingba_1"},
  43. {"dummy_plank", "renxingbazhi"},
  44. {"dummy_plank2_1", "heiyirenxingba_2"},
  45. {"dummy_plank2", "heiyirenxingba_3"},
  46. {"dummy", "dummy"},
  47. {"fruit_apple_falldown", "shuiguo_pingguo_wuli"},
  48. {"fruit_apple_rotate", "shuiguo_pingguo_xuanzhuan"},
  49. {"fruit_apple", "shuiguo_pingguo"},
  50. {"fruit_carambola", "shuiguo_hamigua"},
  51. {"fruit_dragon", "shuiguo_huolongguo"},
  52. {"fruit_pumpkin", "shuiguo_nangua"},
  53. {"fruit_watermelon", "shuiguo_xigua"},
  54. {"horsehoney_comb", "mafengwo"},
  55. {"iron_beam", "tiejia_1"},
  56. {"mengmianfeitu_01", "wushiba_peijian_1"},
  57. {"mengmianfeitu_02", "wushiba_peijian_2"},
  58. {"mengmianfeitu_03", "wushiba_peijian_3"},
  59. {"mengmianfeitu_04", "wushiba_peijian_4"},
  60. {"mengmianfeitu_circle", "wushiba"},
  61. {"mover2", "banyunzhijia_1"},
  62. {"mover3", "banyunzhijia_2"},
  63. {"obstacle_cardbord", "zhangai_zhixiang"},
  64. {"obstacle_wooden_f", "zhangai_0"},
  65. {"obstacle_wooden_f1", "zhangai_1"},
  66. {"obstacle_wooden_f2", "zhangai_2"},
  67. {"obstacle_wooden_f3", "zhangai_3"},
  68. {"obstacle_wooden", "zhangai_muxiang"},
  69. {"obstacle1", "zhangai_huowu"},
  70. {"oil_blast", "youtong_hong"},
  71. {"parachute_1", "jiangluosan"},
  72. {"ph_bottle", "jiuping_ph"},
  73. {"ph_bowling", "tieqiu_ph"},
  74. {"ph_canned_dao", "guantou_ph"},
  75. {"ph_rock03", "guandao_ph"},
  76. {"ph_targetbox", "muxiang_ph"},
  77. {"ph_zhuoban_2", "zhuoban_1_ph"},
  78. {"ph_zhuoban_3", "zhuoban_2_ph"},
  79. {"ph_zhuoban_narrow", "zhuoban_3_ph"},
  80. {"ph_zhuoban", "zhuoban_4_ph"},
  81. {"piggy_bank", "jinzhu"},
  82. {"plate_1", "yuanpan_1"},
  83. {"plate_2", "yuanpan_2"},
  84. {"plate_3", "yuanpan_3"},
  85. {"platform_rail3", "langan_1"},
  86. {"platform", "langan_2"},
  87. {"pole_balance", "langan_3"},
  88. {"pole_horizontal_1", "langan_4"},
  89. {"pole_horizontal", "langan_5"},
  90. {"pole_horizontal2", "langan_6"},
  91. {"pole_horizontal3", "langan_7"},
  92. {"pole_rack", "zhiwujia_1"},
  93. {"pole_rack2", "zhiwujia_2"},
  94. {"pole_rack3", "zhiwujia_3"},
  95. {"pole_rack4", "zhiwujia_4"},
  96. {"pole_rack5", "zhiwujia_5"},
  97. {"pole_rail3", "zhiwujia_6"},
  98. {"pole_rail3new", "langan_7"},
  99. {"pole_rectangle", "langan_8"},
  100. {"pole_rectangle2", "langan_9"},
  101. {"pole_single_1", "langan_10"},
  102. {"pole_single", "langan_11"},
  103. {"pole_snake", "langan_12"},
  104. {"pole_swing", "langan_13"},
  105. {"pole_t2", "langan_14"},
  106. {"pole_triangle", "langan_15"},
  107. {"pole_windmill_l", "langan_16"},
  108. {"pole_windmill", "langan_17"},
  109. {"purse", "qiandai"},
  110. {"quadcopter_circle_1", "wurenji_1"},
  111. {"quadcopter_circle_scale_1", "wurenji_yuanba_1"},
  112. {"quadcopter_dummy", "wurenji_yuanba_2"},
  113. {"quadcopter", "wurenji_heiyirenxingba"},
  114. {"railbeam", "ganggui_1"},
  115. {"railcar_endwise", "guidaoche_end"},
  116. {"railcar", "guidaoche_end"},
  117. {"railplatform", "ganggui_form"},
  118. {"railpole_endwise", "ganggui_end"},
  119. {"railpole", "ganggui_2"},
  120. {"railvan", "guidaochexiang_1"},
  121. {"railvannew", "guidaochexiang_2"},
  122. {"railway_endwise", "guidaochexiang_end_1"},
  123. {"railway_endwise2", "guidaochexiang_end_2"},
  124. {"railway_transverse", "ganggui_3"},
  125. {"remote_controller", "yaokongqi"},
  126. {"roadblock_1", "zhangai_xuegaotong_1"},
  127. {"roadblock_c", "zhangai_xuegaotong_2"},
  128. {"roadblock", "zhangai_xuegaotong_3"},
  129. {"shelf", "zhiwujia_7"},
  130. {"stand_circle_1", "mujia_yuanba_1"},
  131. {"stand_circle_broken_1", "mujia_yuanba_2"},
  132. {"stand_stop", "zhangai_8"},
  133. {"stone", "zhangai_9"},
  134. {"stoneroadblocks", "zhangai_10"},
  135. {"table", "zhuozi"},
  136. {"target_barrel_double_1", "youtong_zuhe_huang"},
  137. {"target_barrel_rope_1", "youtong_lan"},
  138. {"target_barrel_rope3_1", "youtong_zuhe_lan"},
  139. {"target_circle_1", "yuanba_jichu"},
  140. {"target_circle_mover3_1", "yuanba_yundong_1"},
  141. {"target_circle_rope_1", "yuanba_yundong_2"},
  142. {"target_circle_rope1_1", "yuanba_yundong_3"},
  143. {"target_circle_rope2_1", "yuanba_yundong_4"},
  144. {"target_circle_rope3_1", "yuanba_yundong_5"},
  145. {"target_dummy_base", "renxingba_dizuo"},
  146. {"target_dummy_head", "renxingba_shenti"},
  147. {"target_dummy", "renxingba_zhengti"},
  148. {"target_small_pole1", "hongxinba_1"},
  149. {"target_small_rope1", "hongxinba_2"},
  150. {"target_small", "hongxinba_3"},
  151. {"target_stop_plank", "zulanba_1"},
  152. {"target_stop_plank2", "zulanba_2"},
  153. {"target_stop_rope", "zulanba_3"},
  154. {"target_stop_rope2", "zulanba_4"},
  155. {"target_stop_small_pole1", "zulanba_5"},
  156. {"target_stop", "zulanba_6"},
  157. {"target_wellcover_rope1", "zulanba_7"},
  158. {"target_wheel", "chelunba"},
  159. {"telangpubazi_1", "xiaochouba"},
  160. {"trashcan", "lajitong_1"},
  161. {"trashcan2", "lajitong_2"},
  162. {"turntable", "dideng"},
  163. {"vase_1", "huaping_1"},
  164. {"vase_1nb", "huaping_1_wuli"},
  165. {"vase_2 1", "huaping2"},
  166. {"vase_2", "huaping_2_beifen"},
  167. {"vase_2nb 1", "huaping_2_wuli_beifen"},
  168. {"vase_2nb", "huaping_2_wuli_"},
  169. {"vase", "huaping_3"},
  170. {"vasenb", "huaping_3_wuli"},
  171. {"well_cover", "zulanba_8"},
  172. {"woman_warrior", "nvzhushou"},
  173. {"wood_shelf", "zhangai_muxiang_2"},
  174. {"wushifeitu_circle", "wushiba"},
  175. };
  176. // 假设重命名表是一个字典,键是旧名称,值是新名称
  177. private static readonly Dictionary<string, string> AnimRenameTable = new Dictionary<string, string>
  178. {
  179. {"2D_Bullets_Rotation", "2D_zidan_xuanzhuan"},
  180. {"2D_feidao_Rotation", "2D_feidao_xuanzhuan"},
  181. {"2D_Hit", "2D_hit"},
  182. {"38_targestopplank90", "bazizhuoban_90"},
  183. {"90railvanL", "guidao_L_90"},
  184. {"90railvanR", "guidao_R_91"},
  185. {"180", "180"},
  186. {"32712quadcopter_back1", "wurenji_B_1"},
  187. {"32712quadcopter_back2", "wurenji_B_2"},
  188. {"32712quadcopter_back3", "wurenji_B_3"},
  189. {"33001car_admission", "che_3001"},
  190. {"33001car_back1", "che_B_1_33001"},
  191. {"33001car_back2", "che_B_2_33001"},
  192. {"33001car_back3", "che_B_3_33001"},
  193. {"33034car_admission", "che_33034"},
  194. {"33034car_idle", "che_idle_33034"},
  195. {"33036car_admission", "che_33036"},
  196. {"33037_90du", "33037_90"},
  197. {"33079car_idle", "car_idle_33079"},
  198. {"33112car_admission", "car_33112"},
  199. {"33281car_admission", "car_33281"},
  200. {"aircraft_move_1", "feiji_move_1"},
  201. {"aircraft_move", "feiji_move_2"},
  202. {"airplanefly_cicle_E_1", "feiji_yuanba_1"},
  203. {"airplanefly_cicle_E_2", "feiji_yuanba_2"},
  204. {"airplanefly_cicle_E_3", "feiji_yuanba_3"},
  205. {"airplanefly_cicle_E_4", "feiji_yuanba_4"},
  206. {"airplanefly_cicle_E_5", "feiji_yuanba_5"},
  207. {"airplanefly_cicle_E_6", "feiji_yuanba_6"},
  208. {"airplanefly_cicle_L_1", "feiji_yuanba_L"},
  209. {"airplanefly_cicle_R_1", "feiji_yuanba_R"},
  210. {"airplanefly_cicle_S_1", "feiji_yuanba_S"},
  211. {"airplanefly_L_R_1", "feiji_L_R_1"},
  212. {"balance_rotate_z", "pingheng_uanzhuan_1"},
  213. {"balance_rotate_z2", "pingheng_uanzhuan_2"},
  214. {"balloon_G_fly", "qiqiu_fly"},
  215. {"balloon_time_up", "qiqiu_up"},
  216. {"balloon_X", "qiqiu_X"},
  217. {"barrels_rotate", "guntong_xuanzhuan"},
  218. {"bottle_30_x7_180", "pingzi_x7_180"},
  219. {"bottle_30_x7_270", "pingzi_x7_270"},
  220. {"bottle_30_x7_360", "pingzi_x7_360"},
  221. {"bottle_30_x7_720", "pingzi_x7_720"},
  222. {"bottle_30_x7_1080", "pingzi_x7_1080"},
  223. {"bottle_30_y10_180", "pingzi_y10_180"},
  224. {"bottle_30_y10_270", "pingzi_y10_270"},
  225. {"bottle_30_y10_360", "pingzi_y10_360"},
  226. {"bottle_30_y10_720", "pingzi_y10_720"},
  227. {"bottle_30_y10_1080", "pingzi_y10_1080"},
  228. {"bottle_jump360", "pingzi_tiao_1"},
  229. {"bottle_jump361", "pingzi_tiao_2"},
  230. {"bottle_rotate_360", "pingzi_xuanzhuan_360"},
  231. {"bottle_up", "pingzi_up"},
  232. {"bottle_y_10_1", "pingzi_y_10_1"},
  233. {"bottle_y_10_2", "pingzi_y_10_2"},
  234. {"bottle_y_10_3", "pingzi_y_10_3"},
  235. {"bottle_y_10_4", "pingzi_y_10_4"},
  236. {"bottle1_rope1_yidong_1", "pingzi_weiyi_1"},
  237. {"bottle1_rope1_yidong_2", "pingzi_weiyi_2"},
  238. {"bottle1_rope1_yidong", "pingzi_weiyi_3"},
  239. {"bottleNB_daoli", "pingzi_wuli_daoli"},
  240. {"bottleNB_qingxie_L", "pingzi_wuli_qingxie_L"},
  241. {"bottleNB_qingxie", "pingzi_wuli_qingxie"},
  242. {"Butterfly_fly", "hudie_fei_1"},
  243. {"Butterfly_fly2", "hudie_fei_2"},
  244. {"Butterfly_flygo", "hudie_fei_3"},
  245. {"Butterfly_high", "hudie_fei_4"},
  246. {"car_movetest", "che_yidong_ceshi"},
  247. {"car_movetestback", "che_yidong_B"},
  248. {"clayfly_L_E_slow1", "feiji_L_E_yidong_1"},
  249. {"clayfly_L_E_slow2", "feiji_L_E_yidong_2"},
  250. {"clayfly_L_E_slow3", "feiji_L_E_yidong_3"},
  251. {"clayfly_L_E_slow4", "feiji_L_E_yidong_4"},
  252. {"clayfly_L_E_slow5", "feiji_L_E_yidong_5"},
  253. {"clayfly_L_E_slow6", "feiji_L_E_yidong_6"},
  254. {"clayfly_L_R_slow1", "feiji_L_R_yidong_1"},
  255. {"clayfly_L_R_slow2", "feiji_L_R_yidong_2"},
  256. {"clayfly_L_R_slow3", "feiji_L_R_yidong_3"},
  257. {"clayfly_L_R_slow4", "feiji_L_R_yidong_4"},
  258. {"clayfly_L_R_slow5", "feiji_L_R_yidong_5"},
  259. {"clayfly_L_R_slow6", "feiji_L_R_yidong_6"},
  260. {"clayfly_L_S_slow1", "feiji_L_S_yidong_1"},
  261. {"clayfly_L_S_slow2", "feiji_L_S_yidong_2"},
  262. {"clayfly_L_S_slow3", "feiji_L_S_yidong_3"},
  263. {"clayfly_L_S_slow4", "feiji_L_S_yidong_4"},
  264. {"clayfly_L_S_slow5", "feiji_L_S_yidong_5"},
  265. {"clayfly_L_S_slow6", "feiji_L_S_yidong_6"},
  266. {"clayfly_R_E_slow1", "feiji_R_E_yidong_1"},
  267. {"clayfly_R_E_slow2", "feiji_R_E_yidong_2"},
  268. {"clayfly_R_E_slow3", "feiji_R_E_yidong_3"},
  269. {"clayfly_R_E_slow4", "feiji_R_E_yidong_4"},
  270. {"clayfly_R_E_slow5", "feiji_R_E_yidong_5"},
  271. {"clayfly_R_E_slow6", "feiji_R_E_yidong_6"},
  272. {"clayfly_R_L_slow1", "feiji_R_L_yidong_1"},
  273. {"clayfly_R_L_slow2", "feiji_R_L_yidong_2"},
  274. {"clayfly_R_L_slow3", "feiji_R_L_yidong_3"},
  275. {"clayfly_R_L_slow4", "feiji_R_L_yidong_4"},
  276. {"clayfly_R_L_slow5", "feiji_R_L_yidong_5"},
  277. {"clayfly_R_L_slow6", "feiji_R_L_yidong_6"},
  278. {"clayfly_R_S_slow1", "feiji_R_S_yidong_1"},
  279. {"clayfly_R_S_slow2", "feiji_R_S_yidong_2"},
  280. {"clayfly_R_S_slow3", "feiji_R_S_yidong_3"},
  281. {"clayfly_R_S_slow4", "feiji_R_S_yidong_4"},
  282. {"clayfly_R_S_slow5", "feiji_R_S_yidong_5"},
  283. {"clayfly_R_S_slow6", "feiji_R_S_yidong_6"},
  284. {"comb_01", "shuzi_01"},
  285. {"comb_02", "shuzi_02"},
  286. {"comb_03", "shuzi_03"},
  287. {"comb_04", "shuzi_04"},
  288. {"comb_05", "shuzi_05"},
  289. {"comb_06", "shuzi_06"},
  290. {"container_open1", "jizhuangxiang_kai_0"},
  291. {"container_open2", "jizhuangxiang_kai_1"},
  292. {"cover_open", "zhaozhu_dakai"},
  293. {"cup_cover", "beizi_zhaozhu"},
  294. {"death_flyer", "die_feiji"},
  295. {"death_stand", "die_bazi"},
  296. {"down_up_rotate_1", "down_up_xuanzhuan_1"},
  297. {"down_up_rotate_2", "down_up_xuanzhuan_2"},
  298. {"down_up_rotate_3", "down_up_xuanzhuan_3"},
  299. {"down_up_rotate_4", "down_up_xuanzhuan_4"},
  300. {"down_up", "down_up"},
  301. {"dummy_rotate", "bazi_xuanzhuan_33"},
  302. {"fallingdown", "jiangluosan_xia"},
  303. {"fallinghit", "jiangluosan_hit"},
  304. {"flipover_1", "fanye_0"},
  305. {"flipover_2", "fanye_1"},
  306. {"flipover_3", "fanye_2"},
  307. {"gambling_1", "laohuji_0"},
  308. {"gambling", "laohuji_1"},
  309. {"Gem_down", "baoshi_xia"},
  310. {"Gem_up", "baoshi_up"},
  311. {"Hangingtarget_go", "xuanguabazi_go"},
  312. {"Hangingtarget_xuanzhuan", "xuanguabazi_xuanzhuan"},
  313. {"Hangingtarget_zuoyou", "xuanguabazi_L_R"},
  314. {"hide_shelf", "jiazi_cang"},
  315. {"hit_base", "hit_jichu"},
  316. {"hit_dummy_body_wait", "hit_renxingba_shenti_wait"},
  317. {"hit_dummy_head_wait", "hit_renxingba_tou_wait"},
  318. {"hit_renxingba_shenti", "hit_renxingba_shenti_wait"},
  319. {"hit_renxingba_tou", "hit_renxingba_tou_wait"},
  320. {"hit_fixedcircle", "hit_guding_yuanba"},
  321. {"hit_flyer", "hit_feixing_0"},
  322. {"hit_flyernew", "hit_feixing_1"},
  323. {"hit_rope", "hit_shengsuo"},
  324. {"hit_stand", "hit_bazi"},
  325. {"jump_dummy_lr", "tiao_yidong_L_R"},
  326. {"jump_rotate_dummy", "tiao_xuanzhuan"},
  327. {"logo_hengyi", "logo_yidong_x"},
  328. {"logo_henzhuan", "logo_henzhuan"},
  329. {"logo_piaofu", "logo_piaofu"},
  330. {"logo_xuanzhuan", "logo_xuanzhuan"},
  331. {"move_x_rotateself_1", "yidong_x_R0"},
  332. {"move_x_rotateself_2", "yidong_x_R1"},
  333. {"move_x_rotateself_3", "yidong_x_R2"},
  334. {"move_x_rotateself_4", "yidong_x_R3"},
  335. {"move_x_rotateself", "yidong_x_R4"},
  336. {"move_x_rotateself1", "yidong_x_R5"},
  337. {"mover2_f_b_6", "banyun_F_B_6"},
  338. {"Oil_90", "youtong_90"},
  339. {"open_box", "kaixiang"},
  340. {"open_close_60", "dakai_guanbi_60"},
  341. {"pivot_show_hide", "xianshi_yincang"},
  342. {"plate_1_fly", "feipan_fly_1"},
  343. {"plate_2_fly", "feipan_fly_2"},
  344. {"plate_3_fly", "feipan_fly_3"},
  345. {"plate_4_fly", "feipan_fly_4"},
  346. {"plate_R_L", "feipan_R-L"},
  347. {"plate_rotate", "feipan_xuanzhuan"},
  348. {"pole_single_S", "langan_baidong_S"},
  349. {"pole_single_u_d", "langan_baidong_u_d"},
  350. {"pole_single_xuanzhuan", "langan_baiidong_xuanzhuan"},
  351. {"pole_windmill_Sxuanzhuan", "fengche_Sxuanzhuan"},
  352. {"pole_y_0_9", "lamgan_y_0-9"},
  353. {"pole_y_2", "lamgan_y_2"},
  354. {"pole_y_4", "lamgan_y_4"},
  355. {"pole_y_6", "lamgan_y_6"},
  356. {"pole_y_9_12", "lamgan_y_9-12"},
  357. {"pole_y_9", "lamgan_y_9"},
  358. {"propeller_rotate_1", "luoxuanjiang_xuanzhuan_0"},
  359. {"propeller_rotate", "luoxuanjiang_xuanzhuan_1"},
  360. {"quadcopter_around1", "wurenji_huanrao_1"},
  361. {"quadcopter_around2", "wurenji_huanrao_2"},
  362. {"quadcopter_around3", "wurenji_huanrao_3"},
  363. {"quadcopter_around4", "wurenji_huanrao_4"},
  364. {"quadcopter_around5", "wurenji_huanrao_5"},
  365. {"quadcopter_float1", "wurenji_piaofu1"},
  366. {"quadcopter_float2", "wurenji_piaofu2"},
  367. {"quadcopter_float3", "wurenji_piaofu3"},
  368. {"rail_swing_10", "guidao_baidong_10"},
  369. {"rectangle_1", "changfangxing_1"},
  370. {"rectangle_4", "changfangxing_2"},
  371. {"rollingdown_1", "baidong_down_1"},
  372. {"rollingdown_up", "baidong_up-down"},
  373. {"rollingdown", "baidong_down_0"},
  374. {"rollingup", "baidong_up"},
  375. {"root 1.controller", "kongzhiqi_1"},
  376. {"root 2.controller", "kongzhiqi_2"},
  377. {"root_f_b_15", "root_F-B_15"},
  378. {"root_l_r_2", "root_xuanzhuan_R_0"},
  379. {"root_l_r_3", "root_xuanzhuan_R_1"},
  380. {"root_l_r_5", "root_xuanzhuan_R_2"},
  381. {"root_l_r_6", "root_xuanzhuan_R_3"},
  382. {"root_r_l_5", "root_xuanzhuan_L_1"},
  383. {"root_r_l_6", "root_xuanzhuan_L_2"},
  384. {"root_rotate_x_360", "root_xuanzhuan_y_360"},
  385. {"root_rotate_y_20", "root_xuanzhuan_y_20"},
  386. {"root_rotate_y_1800", "root_xuanzhuan_y_1800"},
  387. {"root_stand_1", "root_1"},
  388. {"root_stand_2", "root_2"},
  389. {"root_stand_down", "root_down"},
  390. {"root_swing_5", "baidong_5"},
  391. {"root_swing_10", "baidong_10"},
  392. {"root_swing_15", "baidong_15"},
  393. {"root_swing_20", "baidong_20"},
  394. {"root_swing_35", "baidong_35"},
  395. {"root_swing_conical", "baidong_yuanzhui"},
  396. {"root_u_d_1", "root_d_1"},
  397. {"root_u_d_2", "root_d_2"},
  398. {"root_u_d_3", "root_d_3"},
  399. {"root_u_d_4", "root_d_4"},
  400. {"root_u_d_5", "root_d_5"},
  401. {"root_u_d_6", "root_d_6"},
  402. {"root_u_d_7", "root_d_7"},
  403. {"root.controller", "root.controller"},
  404. {"spider_go", "spider_go"},
  405. {"stand_circle_broken90du", "yuanba_posui_90du"},
  406. {"stand_move_up_1", "moren_yidong_y_1"},
  407. {"stand_move_x_2", "moren_yidong_x_0"},
  408. {"stand_move_x", "moren_yidong_x_1"},
  409. {"stand_stop_rotate", "zhangai_xuanzhuan"},
  410. {"stand_stop_u_d", "zhangai_u_d"},
  411. {"swing_newton_1", "bazi_baidong_4"},
  412. {"swing_newton_2", "bazi_baidong_3"},
  413. {"swing_newton_3", "bazi_baidong_2"},
  414. {"swing_newton_4", "bazi_baidong_1"},
  415. {"swing_newton_5", "bazi_baidong_0"},
  416. {"swing_rotate_y_u_d", "bazi_baidong_y_u_d"},
  417. {"swing_rotate_y", "bazi_baidong_y"},
  418. {"swing_target_l_r", "bazi_baidong_l_r"},
  419. {"t_rotate_x_slow", "bazi_xuanzhuan_x_huanman"},
  420. {"t_rotate_x", "bazi_xuanzhuan_x"},
  421. {"t_rotate_y", "bazi_xuanzhuan_y"},
  422. {"t_rotate_z", "bazi_xuanzhuan_z"},
  423. {"table90", "zuozhi_90"},
  424. {"target_move_snake", "bazi_yidong_shexing"},
  425. {"target_y_0_2", "bazi_y_1"},
  426. {"telangpu 1", "xiaochou_1"},
  427. {"telangpu_L_90", "xiaochou_L_90"},
  428. {"telangpu_qianhou_2_wait", "xiaochou_qianhou_0_wait"},
  429. {"telangpu_qianhou_wait", "xiaochou_qianhou_1_wait"},
  430. {"xiaochou_qianhou_0", "xiaochou_qianhou_0_wait"},
  431. {"xiaochou_qianhou_1", "xiaochou_qianhou_1_wait"},
  432. {"telangpu", "xiaochou_0"},
  433. {"Test_LALA", "test_lala"},
  434. {"top_y_2_5", "dingbu_y_3"},
  435. {"top_y_4", "dingbu_y_2"},
  436. {"top_y_5_2", "dingbu_y_1"},
  437. {"top_y_5", "dingbu_y_0"},
  438. {"top_y_6_10", "dingbu_y_1"},
  439. {"trashcan_jump", "lajitong_jump"},
  440. {"trashcan_open", "lajitong_open"},
  441. {"trashcan_opened", "lajitong_openend"},
  442. {"triangle_1", "zhuanpan_1"},
  443. {"turntable_turn", "zhuanpan_xuanzhuan"},
  444. {"vaseNB_daoli", "huaping_wuli_daoli"},
  445. {"vehicle_move", "chuizhi_move"},
  446. {"vertical_1", "chuizhi_1"},
  447. {"vertical_2", "chuizhi_2"},
  448. {"vertical_3", "chuizhi_3"},
  449. {"vertical_4", "chuizhi_4"},
  450. {"vertical", "chuizhi_0"},
  451. {"windmill_rotate_z", "fengcheng_xuanzhuan_z"},
  452. {"Woman_Warrior_Walk_Ellipse1", "nvzhushou_zoulu_raoquan_1"},
  453. {"Woman_Warrior_Walk_Ellipse2", "nvzhushou_zoulu_raoquan_2"},
  454. {"women_-180", "nvzhushou_-180"},
  455. {"women_45", "nvzhushou_45"},
  456. {"women_90", "nvzhushou_90"},
  457. {"women_150", "nvzhushou_150"},
  458. {"women_180", "nvzhushou_180"},
  459. {"women_181", "nvzhushou_181"},
  460. };
  461. // 假设重命名表是一个字典,键是旧名称,值是新名称
  462. private static readonly Dictionary<string, string> SoundRenameTable = new Dictionary<string, string>
  463. {
  464. {"BottleCrush", "Target_posui_jiuping"},
  465. {"PlateCrush", "Target_posui_panzi"},
  466. {"VaseCrush", "Target_posui_guanzi"},
  467. // {"break", "Target_posui_shuiguo"},
  468. {"Apple 1", "Target_posui_pingguo"},
  469. {"Pumpkin3", "Target_posui_nangua"},
  470. {"Watermelon3", "Target_posui_xigua"},
  471. {"crystal3", "Target_posui_taociping"},
  472. {"AMB_FACTORY", "BGM_Changjing_cangku"},
  473. {"BGM_LOBBY", "BGM_zhujiemian"},
  474. {"BOMB_IN_BARREL", "Target_baozha_youtong_01"},
  475. {"clip_sidefront", "Character_lashuan_01"},
  476. {"Gold_coin_explosion", "Target_baozha_jinbi"},
  477. {"ph_rockRoll", "ph_rockRoll"},
  478. {"robot_halal", "Target_jiqiren"},
  479. {"SE_BINGOLINE", "Character_shenhuxi_01"},
  480. {"SE_BINGOBOARD", "UI_jiesuan"},
  481. {"SE_CHANGEWEAPON", "UI_huanqiang_01"},
  482. {"SE_ClapBig", "guzhang_01"},
  483. {"SE_CLASSIC_RESULT_WIN", "UI_shengli"},
  484. {"SE_COUNT_DOWN", "feipan_daojishi"},
  485. {"SE_FINALLOSE", "UI_shibai"},
  486. {"SE_GAMEOVER", "UI_youxijieshu"},
  487. {"SE_GAUGE", "Character_miaozhunjing"},
  488. {"SE_GETCURRENCY", "UI_huode_jinbi"},
  489. {"SE_GIRL_LAUGH", "Assistant_huanhu"},
  490. {"SE_GO", "feipan_GO_01"},
  491. {"SE_GOLDMEDALCLEAR", "UI_jiesuan_GOLD"},
  492. {"SE_GOLDMEDALCROWD", "UI_guzhang_GOLD"},
  493. {"SE_HEART_BROKEN", "UI_posui_Assistantxin"},
  494. {"SE_HIT_1", "HIT_gongjian"},
  495. {"SE_MISSIONCLEAR", "SE_RenWuWanCheng"},
  496. {"SE_HIT_BODY", "HIT_shenti"},
  497. {"SE_HIT_HEAD", "HIT_toubu"},
  498. {"SE_HIT_METAL", "HIT_jinshu"},
  499. {"SE_HIT_PLATE", "HIT_panzi"},
  500. {"SE_HIT_STEEL", "HIT_gangtie"},
  501. {"SE_LIPAO", "Assistant_lipao"},
  502. {"SE_MISS_CLOTH", "MISS_yifu"},
  503. {"SE_MISS_METAL", "MISS_jinshu"},
  504. {"SE_MISS_ROCKS", "MISS_ShiTou"},
  505. {"SE_MISS_WALL", "MISS_qiangbi"},
  506. {"SE_MISS_WOOD", "MISS_mutou"},
  507. {"SE_MISSGRASS", "MISS_caodi"},
  508. {"SE_MISSION_BRONZE", "UI_jiesuan_qingtong"},
  509. {"SE_TITLE", "SE_QiDong"},
  510. {"SE_OPEN_BOX", "UI_kaixiangzi"},
  511. {"SE_READY", "Character_taiqiang"},
  512. {"SE_READYBREATH", "Character_shenhuxi_02"},
  513. {"SE_RESET", "UI_huanqiang_02"},
  514. {"UI_TIMERACE_ENTRYFEE", "UI_jishisai_baomingfei"},
  515. {"SE_ROLL_STOP", "UI_laohuji_tingzhi"},
  516. {"SE_ROLL", "UI_laohuji_choujiang"},
  517. {"SE_SCORE_SHOW", "UI_xingxing_01"},
  518. {"SE_SET_CROWD_DRAW", "guzhang_02"},
  519. {"SE_SILVERMEDALCLEAR", "UI_jiesuan_SILVER"},
  520. {"SE_SILVERMEDALCROWD", "UI_guzhang_SILVER"},
  521. {"SE_STAR", "UI_xingxing_02"},
  522. {"SE_START", "guzhang_03"},
  523. {"SE_Wood damage", "HIT_mutou"},
  524. {"VO_GO", "feipan_GO_02"},
  525. {"UI_BUTTON", "UI_AnNiu"},
  526. {"VO_X10POINT_00", "Score_GREAT"},
  527. {"VO_X10POINT_01", "Score_PERFECT"},
  528. {"VO_X10POINT_02", "Score_WONDERFUL"},
  529. {"wep_insert_bul", "Character_shangtang_01"},
  530. {"airplane_boom", "Target_baozha_feiji"},
  531. {"airplane", "Target_feiji"},
  532. {"bee_flying", "Target_mifeng"},
  533. {"brid_jizhong", "Target_niao"},
  534. {"casing_45mm", "Character_danke"},
  535. {"clip_sideback", "clip_sideback"},
  536. // {"clip_sidefront", "Character_lashuan_02"},
  537. {"Crossbow_PSE_Fire", "Weapon_bow"},
  538. {"Crossbow_PSE_Reload", "Weapon_bow_lagong"},
  539. {"gun_Awm_shoot", "Weapon_AWM"},
  540. {"gun_Gm6_shoot", "Weapon_GM6"},
  541. {"gun_M24sws_shoot", "Weapon_M24sws"},
  542. {"gun_M82a3_shoot", "Weapon_M82a3"},
  543. {"gun_MosinNagant_shoot", "Weapon_MosinNagant"},
  544. {"gun_VssVintorez_shoot", "Weapon_VssVintorez"},
  545. {"oil_boom", "Target_baozha_youtong_02"},
  546. {"woman_death", "Assistant_death"},
  547. {"woman_happy", "Assistant_happy"},
  548. {"woman_happy2", "Assistant_happy2"},
  549. {"woman_hit", "Assistant_hit"},
  550. {"UI_LEVELUP", "UI_ShengJi"},
  551. {"UI_STAGE_INFO", "UI_GuanQiaXinXi"},
  552. };
  553. [MenuItem("Tools/Target Utils/声音资源重命名")]
  554. public static void RenameSoundResource()
  555. {
  556. // 资源改名
  557. string folderPath = GetSelectedFolderPath();
  558. string[] guids = AssetDatabase.FindAssets("t:AudioClip", new string[] {folderPath});
  559. foreach (string guid in guids)
  560. {
  561. string assetPath = AssetDatabase.GUIDToAssetPath(guid);
  562. string oldName = Path.GetFileNameWithoutExtension(assetPath);
  563. if (SoundRenameTable.TryGetValue(oldName, out var newName))
  564. {
  565. AssetDatabase.RenameAsset(assetPath, newName);
  566. }
  567. else
  568. {
  569. Debug.LogError($"声音资源改名未找到SoundRenameTable:{oldName}");
  570. }
  571. }
  572. }
  573. [MenuItem("Tools/Target Utils/声音配表重命名")]
  574. public static void RenameSoundConfig(){
  575. // 改配表
  576. DataManager.Instance.InitData();
  577. ConfigEditor.ClearCacheData();
  578. foreach (var soundData in DataManager.Instance.csvData.Sound)
  579. {
  580. if (SoundRenameTable.TryGetValue(soundData.name, out var newName))
  581. {
  582. soundData.name = newName;
  583. }
  584. else
  585. {
  586. Debug.LogError($"声音配表改名未找到SoundRenameTable:{soundData.name}");
  587. }
  588. }
  589. SaveSoundData(ConfigEditor.GAME_DATA_DIR, "Sound", DataManager.Instance.csvData.Sound);
  590. }
  591. [MenuItem("Tools/Target Utils/声音代码重命名")]
  592. public static void RenameSoundScript(){
  593. // 改代码
  594. string assetsPath = GetSelectedFolderPath();
  595. string[] scriptFiles = Directory.GetFiles(assetsPath, "*.cs", SearchOption.AllDirectories);
  596. foreach (string scriptFile in scriptFiles)
  597. {
  598. if (Path.GetFileName(scriptFile) == "TargetPrefabRenamer.cs") continue;
  599. string originalContent = File.ReadAllText(scriptFile);
  600. string newContent = originalContent;
  601. foreach (KeyValuePair<string, string> pair in SoundRenameTable)
  602. {
  603. // 使用正则表达式进行完整单词匹配替换
  604. newContent = Regex.Replace(newContent, @"\b" + pair.Key + @"\b", pair.Value);
  605. }
  606. if (newContent != originalContent)
  607. {
  608. File.WriteAllText(scriptFile, newContent);
  609. }
  610. }
  611. AssetDatabase.Refresh();
  612. }
  613. [MenuItem("Tools/Target Utils/声音动画重命名")]
  614. public static void RenameSoundAnim(){
  615. // 改代码
  616. string assetsPath = GetSelectedFolderPath();
  617. string[] scriptFiles = Directory.GetFiles(assetsPath, "*.anim", SearchOption.AllDirectories);
  618. foreach (string scriptFile in scriptFiles)
  619. {
  620. // if (Path.GetFileName(scriptFile) == "TargetPrefabRenamer.cs") continue;
  621. string originalContent = File.ReadAllText(scriptFile);
  622. string newContent = originalContent;
  623. foreach (KeyValuePair<string, string> pair in SoundRenameTable)
  624. {
  625. // 使用正则表达式进行完整单词匹配替换
  626. newContent = Regex.Replace(newContent, @"\b" + pair.Key + @"\b", pair.Value);
  627. }
  628. if (newContent != originalContent)
  629. {
  630. File.WriteAllText(scriptFile, newContent);
  631. }
  632. }
  633. AssetDatabase.Refresh();
  634. }
  635. public static void SaveSoundData(string xlsPath, string xlsName, List<SoundDefine> configs)
  636. {
  637. const int StartRow = 4;
  638. const string dirPath = "{0}tables/{1}.xlsx";
  639. string outputPath = string.Format(dirPath, xlsPath, xlsName);
  640. Excel xls = new Excel();
  641. xls.AddTable(xlsName);
  642. xls.Tables[0].SetValue(1, 1, "ID");
  643. xls.Tables[0].SetValue(1, 2, "name");
  644. xls.Tables[0].SetValue(1, 3, "vol");
  645. xls.Tables[0].SetValue(2, 1, "int32");
  646. xls.Tables[0].SetValue(2, 2, "string");
  647. xls.Tables[0].SetValue(2, 3, "int32");
  648. xls.Tables[0].SetValue(3, 1, "RepeatCheck:true MakeIndex:true");
  649. xls.Tables[0].SetValue(4, 1, "音乐ID");
  650. xls.Tables[0].SetValue(4, 2, "名称");
  651. xls.Tables[0].SetValue(4, 3, "音量");
  652. int i = StartRow;
  653. foreach (var data in configs)
  654. {
  655. ++i;
  656. xls.Tables[0].SetValue(i, 1, data.ID);
  657. xls.Tables[0].SetValue(i, 2, data.name);
  658. xls.Tables[0].SetValue(i, 3, data.vol);
  659. }
  660. DataWriter.AddTypeSheet(xls, xlsName);
  661. ExcelHelper.SaveExcel(xls, outputPath);
  662. }
  663. [MenuItem("Tools/Target Utils/Rename Prefabs")]
  664. public static void RenamePrefabs()
  665. {
  666. string folderPath = GetSelectedFolderPath();
  667. Debug.Log(folderPath);
  668. string[] prefabFiles = Directory.GetFiles(folderPath, "*.prefab", SearchOption.AllDirectories);
  669. // foreach (string prefabPath in prefabFiles)
  670. // {
  671. // string prefabName = Path.GetFileNameWithoutExtension(prefabPath);
  672. //
  673. // if (renameTable.ContainsKey(prefabName))
  674. // {
  675. // string newName = renameTable[prefabName];
  676. // string newPath = Path.Combine(Path.GetDirectoryName(prefabPath), newName + ".prefab");
  677. //
  678. // File.Move(prefabPath, newPath);
  679. // }
  680. // }
  681. string[] guids = AssetDatabase.FindAssets("t:Prefab", new string[] { folderPath });
  682. foreach (string guid in guids)
  683. {
  684. string assetPath = AssetDatabase.GUIDToAssetPath(guid);
  685. string prefabName = Path.GetFileNameWithoutExtension(assetPath);
  686. if (PrefabRenameTable.ContainsKey(prefabName))
  687. {
  688. string newName = PrefabRenameTable[prefabName];
  689. string newPath = Path.Combine(Path.GetDirectoryName(assetPath), newName + ".prefab");
  690. AssetDatabase.RenameAsset(assetPath, newName);
  691. }
  692. }
  693. }
  694. [MenuItem("Tools/Target Utils/移除prefab不存在的靶子配表")]
  695. public static void RemoveTargetConfigNoPrefab()
  696. {
  697. DataManager.Instance.InitData();
  698. ConfigEditor.ClearCacheData();
  699. var keysToRemove = new List<int>();
  700. foreach (var targetDataPair in ConfigEditor.targetDataCfgs)
  701. {
  702. var names = targetDataPair.Value.ResourceName.Split("#");
  703. if (!names.Any(name => PrefabRenameTable.ContainsValue(name)))
  704. {
  705. keysToRemove.Add(targetDataPair.Key);
  706. }
  707. }
  708. foreach (var key in keysToRemove)
  709. {
  710. ConfigEditor.targetDataCfgs.Remove(key);
  711. }
  712. DataWriter.SaveTargetData(ConfigEditor.GAME_DATA_DIR, "TargetData", ConfigEditor.targetDataCfgs);
  713. }
  714. [MenuItem("Tools/Target Utils/靶子配表动画重命名")]
  715. public static void RenameTargetConfigAnimName()
  716. {
  717. DataManager.Instance.InitData();
  718. ConfigEditor.ClearCacheData();
  719. foreach (var targetData in ConfigEditor.targetDataCfgs.Values)
  720. {
  721. if (!string.IsNullOrEmpty(targetData.CtrlAniFileName))
  722. {
  723. if (AnimRenameTable.TryGetValue(targetData.CtrlAniFileName, out var newName))
  724. {
  725. targetData.CtrlAniFileName = newName;
  726. }
  727. else
  728. {
  729. Debug.LogError($"AnimRenameTable 不存在 CtrlAniFileName:{targetData.CtrlAniFileName}");
  730. }
  731. }
  732. if (!string.IsNullOrEmpty(targetData.Hit))
  733. {
  734. if (AnimRenameTable.TryGetValue(targetData.Hit, out var newName))
  735. {
  736. targetData.Hit = newName;
  737. }
  738. else
  739. {
  740. Debug.LogError($"AnimRenameTable 不存在 Hit:{targetData.Hit}");
  741. }
  742. }
  743. if (!string.IsNullOrEmpty(targetData.Death))
  744. {
  745. if (AnimRenameTable.TryGetValue(targetData.Death, out var newName))
  746. {
  747. targetData.Death = newName;
  748. }
  749. else
  750. {
  751. Debug.LogError($"AnimRenameTable 不存在 Death:{targetData.Death}");
  752. }
  753. }
  754. }
  755. DataWriter.SaveTargetData(ConfigEditor.GAME_DATA_DIR, "TargetData", ConfigEditor.targetDataCfgs);
  756. }
  757. [MenuItem("Tools/Target Utils/靶子动画文件重命名")]
  758. public static void RenameTargetAnimFileName()
  759. {
  760. string folderPath = GetSelectedFolderPath();
  761. string[] guids = AssetDatabase.FindAssets("t:AnimationClip", new string[] { folderPath });
  762. foreach (string guid in guids)
  763. {
  764. string assetPath = AssetDatabase.GUIDToAssetPath(guid);
  765. string oldName = Path.GetFileNameWithoutExtension(assetPath);
  766. if (AnimRenameTable.TryGetValue(oldName, out var newName))
  767. {
  768. AssetDatabase.RenameAsset(assetPath, newName);
  769. }
  770. else
  771. {
  772. Debug.LogError($"AnimRenameTable不存在:{oldName}");
  773. }
  774. }
  775. }
  776. [MenuItem("Tools/Target Utils/Rename Prefabs Config")]
  777. private static void RemovePrefabsConfig()
  778. {
  779. using StreamReader reader = new StreamReader(Application.dataPath + "../TargerNames.txt");
  780. using StreamWriter writer = new StreamWriter(Application.dataPath + "../TargerExportNames.txt");
  781. string line;
  782. while ((line = reader.ReadLine())!= null)
  783. {
  784. var names = line.Split("#");
  785. if (names.Length == 1)
  786. {
  787. if (PrefabRenameTable.ContainsKey(line))
  788. {
  789. writer.WriteLine(PrefabRenameTable[line]);
  790. }
  791. else
  792. {
  793. writer.WriteLine(line);
  794. // Debug.LogError($"未找到重命名: {line}");
  795. }
  796. }
  797. else
  798. {
  799. bool found = false;
  800. for (var i = 0; i < names.Length; i++)
  801. {
  802. var name = names[i];
  803. if (PrefabRenameTable.ContainsKey(name))
  804. {
  805. names[i] = PrefabRenameTable[name];
  806. found = true;
  807. }
  808. }
  809. if (found)
  810. {
  811. writer.WriteLine(string.Join('#', names));
  812. }
  813. else
  814. {
  815. writer.WriteLine(line);
  816. Debug.LogError($"未找到重命名: {line}");
  817. }
  818. }
  819. }
  820. }
  821. public static string GetSelectedFolderPath()
  822. {
  823. var selectedObject = Selection.activeObject;
  824. if (selectedObject!= null && AssetDatabase.IsValidFolder(AssetDatabase.GetAssetPath(selectedObject)))
  825. {
  826. string folderPath = AssetDatabase.GetAssetPath(selectedObject);
  827. // Debug.Log("Selected Folder Path: " + folderPath);
  828. return folderPath;
  829. }
  830. else
  831. {
  832. // Debug.Log("No valid folder selected.");
  833. }
  834. return null;
  835. }
  836. }