using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text.RegularExpressions; using Excel4Unity; using SSTRGame; using UnityEditor; using UnityEngine; public class TargetPrefabRenamer { // 假设重命名表是一个字典,键是旧名称,值是新名称 private static readonly Dictionary PrefabRenameTable = new Dictionary { {"airplane_yellow", "feiji_lan"}, {"ammobox", "danyaoxiang"}, {"anim_butterfly_backup", "hudie"}, {"animnode", "animnode"}, {"barrel", "youtong_huang"}, {"bottle_rotate", "pingzi_xuanzhuan"}, {"bottle1_rope1", "pingzi_shengzi_1"}, {"bottle1_rope2", "pingzi_shengzi_2"}, {"bottle1_rope3", "pingzi_shengzi_3"}, {"bottle1", "jiuping_1"}, {"bottlenb", "jiuping_wuli"}, {"car_road", "jizhuangxiang_paodao"}, {"car", "che_1"}, {"cement_ducts", "shuiniguandao"}, {"clayshoot_se", "feipan_0"}, {"clayshoot", "feipan_se"}, {"cmsdistancesign@30", "jvlixinhao_30"}, {"cmsdistancesign@50", "jvlixinhao_50"}, {"cmsdistancesign@70", "jvlixinhao_70"}, {"cmsdistancesign@90", "jvlixinhao_90"}, {"cmsdistancesign@110", "jvlixinhao_110"}, {"cmsdistancesign@130", "jvlixinhao_130"}, {"concrete_support", "hunningtuzhicheng"}, {"container_lift", "jizhuangxiang_guandao"}, {"container_wheel_1", "jizhuangxiang_xiangdui_1"}, {"container_wheel", "jizhuangxiang_xiangdui_2"}, {"container", "jizhuangxiang"}, {"dummy_7", "heiyirenxingba_1"}, {"dummy_plank", "renxingbazhi"}, {"dummy_plank2_1", "heiyirenxingba_2"}, {"dummy_plank2", "heiyirenxingba_3"}, {"dummy", "dummy"}, {"fruit_apple_falldown", "shuiguo_pingguo_wuli"}, {"fruit_apple_rotate", "shuiguo_pingguo_xuanzhuan"}, {"fruit_apple", "shuiguo_pingguo"}, {"fruit_carambola", "shuiguo_hamigua"}, {"fruit_dragon", "shuiguo_huolongguo"}, {"fruit_pumpkin", "shuiguo_nangua"}, {"fruit_watermelon", "shuiguo_xigua"}, {"horsehoney_comb", "mafengwo"}, {"iron_beam", "tiejia_1"}, {"mengmianfeitu_01", "wushiba_peijian_1"}, {"mengmianfeitu_02", "wushiba_peijian_2"}, {"mengmianfeitu_03", "wushiba_peijian_3"}, {"mengmianfeitu_04", "wushiba_peijian_4"}, {"mengmianfeitu_circle", "wushiba"}, {"mover2", "banyunzhijia_1"}, {"mover3", "banyunzhijia_2"}, {"obstacle_cardbord", "zhangai_zhixiang"}, {"obstacle_wooden_f", "zhangai_0"}, {"obstacle_wooden_f1", "zhangai_1"}, {"obstacle_wooden_f2", "zhangai_2"}, {"obstacle_wooden_f3", "zhangai_3"}, {"obstacle_wooden", "zhangai_muxiang"}, {"obstacle1", "zhangai_huowu"}, {"oil_blast", "youtong_hong"}, {"parachute_1", "jiangluosan"}, {"ph_bottle", "jiuping_ph"}, {"ph_bowling", "tieqiu_ph"}, {"ph_canned_dao", "guantou_ph"}, {"ph_rock03", "guandao_ph"}, {"ph_targetbox", "muxiang_ph"}, {"ph_zhuoban_2", "zhuoban_1_ph"}, {"ph_zhuoban_3", "zhuoban_2_ph"}, {"ph_zhuoban_narrow", "zhuoban_3_ph"}, {"ph_zhuoban", "zhuoban_4_ph"}, {"piggy_bank", "jinzhu"}, {"plate_1", "yuanpan_1"}, {"plate_2", "yuanpan_2"}, {"plate_3", "yuanpan_3"}, {"platform_rail3", "langan_1"}, {"platform", "langan_2"}, {"pole_balance", "langan_3"}, {"pole_horizontal_1", "langan_4"}, {"pole_horizontal", "langan_5"}, {"pole_horizontal2", "langan_6"}, {"pole_horizontal3", "langan_7"}, {"pole_rack", "zhiwujia_1"}, {"pole_rack2", "zhiwujia_2"}, {"pole_rack3", "zhiwujia_3"}, {"pole_rack4", "zhiwujia_4"}, {"pole_rack5", "zhiwujia_5"}, {"pole_rail3", "zhiwujia_6"}, {"pole_rail3new", "langan_7"}, {"pole_rectangle", "langan_8"}, {"pole_rectangle2", "langan_9"}, {"pole_single_1", "langan_10"}, {"pole_single", "langan_11"}, {"pole_snake", "langan_12"}, {"pole_swing", "langan_13"}, {"pole_t2", "langan_14"}, {"pole_triangle", "langan_15"}, {"pole_windmill_l", "langan_16"}, {"pole_windmill", "langan_17"}, {"purse", "qiandai"}, {"quadcopter_circle_1", "wurenji_1"}, {"quadcopter_circle_scale_1", "wurenji_yuanba_1"}, {"quadcopter_dummy", "wurenji_yuanba_2"}, {"quadcopter", "wurenji_heiyirenxingba"}, {"railbeam", "ganggui_1"}, {"railcar_endwise", "guidaoche_end"}, {"railcar", "guidaoche_end"}, {"railplatform", "ganggui_form"}, {"railpole_endwise", "ganggui_end"}, {"railpole", "ganggui_2"}, {"railvan", "guidaochexiang_1"}, {"railvannew", "guidaochexiang_2"}, {"railway_endwise", "guidaochexiang_end_1"}, {"railway_endwise2", "guidaochexiang_end_2"}, {"railway_transverse", "ganggui_3"}, {"remote_controller", "yaokongqi"}, {"roadblock_1", "zhangai_xuegaotong_1"}, {"roadblock_c", "zhangai_xuegaotong_2"}, {"roadblock", "zhangai_xuegaotong_3"}, {"shelf", "zhiwujia_7"}, {"stand_circle_1", "mujia_yuanba_1"}, {"stand_circle_broken_1", "mujia_yuanba_2"}, {"stand_stop", "zhangai_8"}, {"stone", "zhangai_9"}, {"stoneroadblocks", "zhangai_10"}, {"table", "zhuozi"}, {"target_barrel_double_1", "youtong_zuhe_huang"}, {"target_barrel_rope_1", "youtong_lan"}, {"target_barrel_rope3_1", "youtong_zuhe_lan"}, {"target_circle_1", "yuanba_jichu"}, {"target_circle_mover3_1", "yuanba_yundong_1"}, {"target_circle_rope_1", "yuanba_yundong_2"}, {"target_circle_rope1_1", "yuanba_yundong_3"}, {"target_circle_rope2_1", "yuanba_yundong_4"}, {"target_circle_rope3_1", "yuanba_yundong_5"}, {"target_dummy_base", "renxingba_dizuo"}, {"target_dummy_head", "renxingba_shenti"}, {"target_dummy", "renxingba_zhengti"}, {"target_small_pole1", "hongxinba_1"}, {"target_small_rope1", "hongxinba_2"}, {"target_small", "hongxinba_3"}, {"target_stop_plank", "zulanba_1"}, {"target_stop_plank2", "zulanba_2"}, {"target_stop_rope", "zulanba_3"}, {"target_stop_rope2", "zulanba_4"}, {"target_stop_small_pole1", "zulanba_5"}, {"target_stop", "zulanba_6"}, {"target_wellcover_rope1", "zulanba_7"}, {"target_wheel", "chelunba"}, {"telangpubazi_1", "xiaochouba"}, {"trashcan", "lajitong_1"}, {"trashcan2", "lajitong_2"}, {"turntable", "dideng"}, {"vase_1", "huaping_1"}, {"vase_1nb", "huaping_1_wuli"}, {"vase_2 1", "huaping2"}, {"vase_2", "huaping_2_beifen"}, {"vase_2nb 1", "huaping_2_wuli_beifen"}, {"vase_2nb", "huaping_2_wuli_"}, {"vase", "huaping_3"}, {"vasenb", "huaping_3_wuli"}, {"well_cover", "zulanba_8"}, {"woman_warrior", "nvzhushou"}, {"wood_shelf", "zhangai_muxiang_2"}, {"wushifeitu_circle", "wushiba"}, }; // 假设重命名表是一个字典,键是旧名称,值是新名称 private static readonly Dictionary AnimRenameTable = new Dictionary { {"2D_Bullets_Rotation", "2D_zidan_xuanzhuan"}, {"2D_feidao_Rotation", "2D_feidao_xuanzhuan"}, {"2D_Hit", "2D_hit"}, {"38_targestopplank90", "bazizhuoban_90"}, {"90railvanL", "guidao_L_90"}, {"90railvanR", "guidao_R_91"}, {"180", "180"}, {"32712quadcopter_back1", "wurenji_B_1"}, {"32712quadcopter_back2", "wurenji_B_2"}, {"32712quadcopter_back3", "wurenji_B_3"}, {"33001car_admission", "che_3001"}, {"33001car_back1", "che_B_1_33001"}, {"33001car_back2", "che_B_2_33001"}, {"33001car_back3", "che_B_3_33001"}, {"33034car_admission", "che_33034"}, {"33034car_idle", "che_idle_33034"}, {"33036car_admission", "che_33036"}, {"33037_90du", "33037_90"}, {"33079car_idle", "car_idle_33079"}, {"33112car_admission", "car_33112"}, {"33281car_admission", "car_33281"}, {"aircraft_move_1", "feiji_move_1"}, {"aircraft_move", "feiji_move_2"}, {"airplanefly_cicle_E_1", "feiji_yuanba_1"}, {"airplanefly_cicle_E_2", "feiji_yuanba_2"}, {"airplanefly_cicle_E_3", "feiji_yuanba_3"}, {"airplanefly_cicle_E_4", "feiji_yuanba_4"}, {"airplanefly_cicle_E_5", "feiji_yuanba_5"}, {"airplanefly_cicle_E_6", "feiji_yuanba_6"}, {"airplanefly_cicle_L_1", "feiji_yuanba_L"}, {"airplanefly_cicle_R_1", "feiji_yuanba_R"}, {"airplanefly_cicle_S_1", "feiji_yuanba_S"}, {"airplanefly_L_R_1", "feiji_L_R_1"}, {"balance_rotate_z", "pingheng_uanzhuan_1"}, {"balance_rotate_z2", "pingheng_uanzhuan_2"}, {"balloon_G_fly", "qiqiu_fly"}, {"balloon_time_up", "qiqiu_up"}, {"balloon_X", "qiqiu_X"}, {"barrels_rotate", "guntong_xuanzhuan"}, {"bottle_30_x7_180", "pingzi_x7_180"}, {"bottle_30_x7_270", "pingzi_x7_270"}, {"bottle_30_x7_360", "pingzi_x7_360"}, {"bottle_30_x7_720", "pingzi_x7_720"}, {"bottle_30_x7_1080", "pingzi_x7_1080"}, {"bottle_30_y10_180", "pingzi_y10_180"}, {"bottle_30_y10_270", "pingzi_y10_270"}, {"bottle_30_y10_360", "pingzi_y10_360"}, {"bottle_30_y10_720", "pingzi_y10_720"}, {"bottle_30_y10_1080", "pingzi_y10_1080"}, {"bottle_jump360", "pingzi_tiao_1"}, {"bottle_jump361", "pingzi_tiao_2"}, {"bottle_rotate_360", "pingzi_xuanzhuan_360"}, {"bottle_up", "pingzi_up"}, {"bottle_y_10_1", "pingzi_y_10_1"}, {"bottle_y_10_2", "pingzi_y_10_2"}, {"bottle_y_10_3", "pingzi_y_10_3"}, {"bottle_y_10_4", "pingzi_y_10_4"}, {"bottle1_rope1_yidong_1", "pingzi_weiyi_1"}, {"bottle1_rope1_yidong_2", "pingzi_weiyi_2"}, {"bottle1_rope1_yidong", "pingzi_weiyi_3"}, {"bottleNB_daoli", "pingzi_wuli_daoli"}, {"bottleNB_qingxie_L", "pingzi_wuli_qingxie_L"}, {"bottleNB_qingxie", "pingzi_wuli_qingxie"}, {"Butterfly_fly", "hudie_fei_1"}, {"Butterfly_fly2", "hudie_fei_2"}, {"Butterfly_flygo", "hudie_fei_3"}, {"Butterfly_high", "hudie_fei_4"}, {"car_movetest", "che_yidong_ceshi"}, {"car_movetestback", "che_yidong_B"}, {"clayfly_L_E_slow1", "feiji_L_E_yidong_1"}, {"clayfly_L_E_slow2", "feiji_L_E_yidong_2"}, {"clayfly_L_E_slow3", "feiji_L_E_yidong_3"}, {"clayfly_L_E_slow4", "feiji_L_E_yidong_4"}, {"clayfly_L_E_slow5", "feiji_L_E_yidong_5"}, {"clayfly_L_E_slow6", "feiji_L_E_yidong_6"}, {"clayfly_L_R_slow1", "feiji_L_R_yidong_1"}, {"clayfly_L_R_slow2", "feiji_L_R_yidong_2"}, {"clayfly_L_R_slow3", "feiji_L_R_yidong_3"}, {"clayfly_L_R_slow4", "feiji_L_R_yidong_4"}, {"clayfly_L_R_slow5", "feiji_L_R_yidong_5"}, {"clayfly_L_R_slow6", "feiji_L_R_yidong_6"}, {"clayfly_L_S_slow1", "feiji_L_S_yidong_1"}, {"clayfly_L_S_slow2", "feiji_L_S_yidong_2"}, {"clayfly_L_S_slow3", "feiji_L_S_yidong_3"}, {"clayfly_L_S_slow4", "feiji_L_S_yidong_4"}, {"clayfly_L_S_slow5", "feiji_L_S_yidong_5"}, {"clayfly_L_S_slow6", "feiji_L_S_yidong_6"}, {"clayfly_R_E_slow1", "feiji_R_E_yidong_1"}, {"clayfly_R_E_slow2", "feiji_R_E_yidong_2"}, {"clayfly_R_E_slow3", "feiji_R_E_yidong_3"}, {"clayfly_R_E_slow4", "feiji_R_E_yidong_4"}, {"clayfly_R_E_slow5", "feiji_R_E_yidong_5"}, {"clayfly_R_E_slow6", "feiji_R_E_yidong_6"}, {"clayfly_R_L_slow1", "feiji_R_L_yidong_1"}, {"clayfly_R_L_slow2", "feiji_R_L_yidong_2"}, {"clayfly_R_L_slow3", "feiji_R_L_yidong_3"}, {"clayfly_R_L_slow4", "feiji_R_L_yidong_4"}, {"clayfly_R_L_slow5", "feiji_R_L_yidong_5"}, {"clayfly_R_L_slow6", "feiji_R_L_yidong_6"}, {"clayfly_R_S_slow1", "feiji_R_S_yidong_1"}, {"clayfly_R_S_slow2", "feiji_R_S_yidong_2"}, {"clayfly_R_S_slow3", "feiji_R_S_yidong_3"}, {"clayfly_R_S_slow4", "feiji_R_S_yidong_4"}, {"clayfly_R_S_slow5", "feiji_R_S_yidong_5"}, {"clayfly_R_S_slow6", "feiji_R_S_yidong_6"}, {"comb_01", "shuzi_01"}, {"comb_02", "shuzi_02"}, {"comb_03", "shuzi_03"}, {"comb_04", "shuzi_04"}, {"comb_05", "shuzi_05"}, {"comb_06", "shuzi_06"}, {"container_open1", "jizhuangxiang_kai_0"}, {"container_open2", "jizhuangxiang_kai_1"}, {"cover_open", "zhaozhu_dakai"}, {"cup_cover", "beizi_zhaozhu"}, {"death_flyer", "die_feiji"}, {"death_stand", "die_bazi"}, {"down_up_rotate_1", "down_up_xuanzhuan_1"}, {"down_up_rotate_2", "down_up_xuanzhuan_2"}, {"down_up_rotate_3", "down_up_xuanzhuan_3"}, {"down_up_rotate_4", "down_up_xuanzhuan_4"}, {"down_up", "down_up"}, {"dummy_rotate", "bazi_xuanzhuan_33"}, {"fallingdown", "jiangluosan_xia"}, {"fallinghit", "jiangluosan_hit"}, {"flipover_1", "fanye_0"}, {"flipover_2", "fanye_1"}, {"flipover_3", "fanye_2"}, {"gambling_1", "laohuji_0"}, {"gambling", "laohuji_1"}, {"Gem_down", "baoshi_xia"}, {"Gem_up", "baoshi_up"}, {"Hangingtarget_go", "xuanguabazi_go"}, {"Hangingtarget_xuanzhuan", "xuanguabazi_xuanzhuan"}, {"Hangingtarget_zuoyou", "xuanguabazi_L_R"}, {"hide_shelf", "jiazi_cang"}, {"hit_base", "hit_jichu"}, {"hit_dummy_body_wait", "hit_renxingba_shenti_wait"}, {"hit_dummy_head_wait", "hit_renxingba_tou_wait"}, {"hit_renxingba_shenti", "hit_renxingba_shenti_wait"}, {"hit_renxingba_tou", "hit_renxingba_tou_wait"}, {"hit_fixedcircle", "hit_guding_yuanba"}, {"hit_flyer", "hit_feixing_0"}, {"hit_flyernew", "hit_feixing_1"}, {"hit_rope", "hit_shengsuo"}, {"hit_stand", "hit_bazi"}, {"jump_dummy_lr", "tiao_yidong_L_R"}, {"jump_rotate_dummy", "tiao_xuanzhuan"}, {"logo_hengyi", "logo_yidong_x"}, {"logo_henzhuan", "logo_henzhuan"}, {"logo_piaofu", "logo_piaofu"}, {"logo_xuanzhuan", "logo_xuanzhuan"}, {"move_x_rotateself_1", "yidong_x_R0"}, {"move_x_rotateself_2", "yidong_x_R1"}, {"move_x_rotateself_3", "yidong_x_R2"}, {"move_x_rotateself_4", "yidong_x_R3"}, {"move_x_rotateself", "yidong_x_R4"}, {"move_x_rotateself1", "yidong_x_R5"}, {"mover2_f_b_6", "banyun_F_B_6"}, {"Oil_90", "youtong_90"}, {"open_box", "kaixiang"}, {"open_close_60", "dakai_guanbi_60"}, {"pivot_show_hide", "xianshi_yincang"}, {"plate_1_fly", "feipan_fly_1"}, {"plate_2_fly", "feipan_fly_2"}, {"plate_3_fly", "feipan_fly_3"}, {"plate_4_fly", "feipan_fly_4"}, {"plate_R_L", "feipan_R-L"}, {"plate_rotate", "feipan_xuanzhuan"}, {"pole_single_S", "langan_baidong_S"}, {"pole_single_u_d", "langan_baidong_u_d"}, {"pole_single_xuanzhuan", "langan_baiidong_xuanzhuan"}, {"pole_windmill_Sxuanzhuan", "fengche_Sxuanzhuan"}, {"pole_y_0_9", "lamgan_y_0-9"}, {"pole_y_2", "lamgan_y_2"}, {"pole_y_4", "lamgan_y_4"}, {"pole_y_6", "lamgan_y_6"}, {"pole_y_9_12", "lamgan_y_9-12"}, {"pole_y_9", "lamgan_y_9"}, {"propeller_rotate_1", "luoxuanjiang_xuanzhuan_0"}, {"propeller_rotate", "luoxuanjiang_xuanzhuan_1"}, {"quadcopter_around1", "wurenji_huanrao_1"}, {"quadcopter_around2", "wurenji_huanrao_2"}, {"quadcopter_around3", "wurenji_huanrao_3"}, {"quadcopter_around4", "wurenji_huanrao_4"}, {"quadcopter_around5", "wurenji_huanrao_5"}, {"quadcopter_float1", "wurenji_piaofu1"}, {"quadcopter_float2", "wurenji_piaofu2"}, {"quadcopter_float3", "wurenji_piaofu3"}, {"rail_swing_10", "guidao_baidong_10"}, {"rectangle_1", "changfangxing_1"}, {"rectangle_4", "changfangxing_2"}, {"rollingdown_1", "baidong_down_1"}, {"rollingdown_up", "baidong_up-down"}, {"rollingdown", "baidong_down_0"}, {"rollingup", "baidong_up"}, {"root 1.controller", "kongzhiqi_1"}, {"root 2.controller", "kongzhiqi_2"}, {"root_f_b_15", "root_F-B_15"}, {"root_l_r_2", "root_xuanzhuan_R_0"}, {"root_l_r_3", "root_xuanzhuan_R_1"}, {"root_l_r_5", "root_xuanzhuan_R_2"}, {"root_l_r_6", "root_xuanzhuan_R_3"}, {"root_r_l_5", "root_xuanzhuan_L_1"}, {"root_r_l_6", "root_xuanzhuan_L_2"}, {"root_rotate_x_360", "root_xuanzhuan_y_360"}, {"root_rotate_y_20", "root_xuanzhuan_y_20"}, {"root_rotate_y_1800", "root_xuanzhuan_y_1800"}, {"root_stand_1", "root_1"}, {"root_stand_2", "root_2"}, {"root_stand_down", "root_down"}, {"root_swing_5", "baidong_5"}, {"root_swing_10", "baidong_10"}, {"root_swing_15", "baidong_15"}, {"root_swing_20", "baidong_20"}, {"root_swing_35", "baidong_35"}, {"root_swing_conical", "baidong_yuanzhui"}, {"root_u_d_1", "root_d_1"}, {"root_u_d_2", "root_d_2"}, {"root_u_d_3", "root_d_3"}, {"root_u_d_4", "root_d_4"}, {"root_u_d_5", "root_d_5"}, {"root_u_d_6", "root_d_6"}, {"root_u_d_7", "root_d_7"}, {"root.controller", "root.controller"}, {"spider_go", "spider_go"}, {"stand_circle_broken90du", "yuanba_posui_90du"}, {"stand_move_up_1", "moren_yidong_y_1"}, {"stand_move_x_2", "moren_yidong_x_0"}, {"stand_move_x", "moren_yidong_x_1"}, {"stand_stop_rotate", "zhangai_xuanzhuan"}, {"stand_stop_u_d", "zhangai_u_d"}, {"swing_newton_1", "bazi_baidong_4"}, {"swing_newton_2", "bazi_baidong_3"}, {"swing_newton_3", "bazi_baidong_2"}, {"swing_newton_4", "bazi_baidong_1"}, {"swing_newton_5", "bazi_baidong_0"}, {"swing_rotate_y_u_d", "bazi_baidong_y_u_d"}, {"swing_rotate_y", "bazi_baidong_y"}, {"swing_target_l_r", "bazi_baidong_l_r"}, {"t_rotate_x_slow", "bazi_xuanzhuan_x_huanman"}, {"t_rotate_x", "bazi_xuanzhuan_x"}, {"t_rotate_y", "bazi_xuanzhuan_y"}, {"t_rotate_z", "bazi_xuanzhuan_z"}, {"table90", "zuozhi_90"}, {"target_move_snake", "bazi_yidong_shexing"}, {"target_y_0_2", "bazi_y_1"}, {"telangpu 1", "xiaochou_1"}, {"telangpu_L_90", "xiaochou_L_90"}, {"telangpu_qianhou_2_wait", "xiaochou_qianhou_0_wait"}, {"telangpu_qianhou_wait", "xiaochou_qianhou_1_wait"}, {"xiaochou_qianhou_0", "xiaochou_qianhou_0_wait"}, {"xiaochou_qianhou_1", "xiaochou_qianhou_1_wait"}, {"telangpu", "xiaochou_0"}, {"Test_LALA", "test_lala"}, {"top_y_2_5", "dingbu_y_3"}, {"top_y_4", "dingbu_y_2"}, {"top_y_5_2", "dingbu_y_1"}, {"top_y_5", "dingbu_y_0"}, {"top_y_6_10", "dingbu_y_1"}, {"trashcan_jump", "lajitong_jump"}, {"trashcan_open", "lajitong_open"}, {"trashcan_opened", "lajitong_openend"}, {"triangle_1", "zhuanpan_1"}, {"turntable_turn", "zhuanpan_xuanzhuan"}, {"vaseNB_daoli", "huaping_wuli_daoli"}, {"vehicle_move", "chuizhi_move"}, {"vertical_1", "chuizhi_1"}, {"vertical_2", "chuizhi_2"}, {"vertical_3", "chuizhi_3"}, {"vertical_4", "chuizhi_4"}, {"vertical", "chuizhi_0"}, {"windmill_rotate_z", "fengcheng_xuanzhuan_z"}, {"Woman_Warrior_Walk_Ellipse1", "nvzhushou_zoulu_raoquan_1"}, {"Woman_Warrior_Walk_Ellipse2", "nvzhushou_zoulu_raoquan_2"}, {"women_-180", "nvzhushou_-180"}, {"women_45", "nvzhushou_45"}, {"women_90", "nvzhushou_90"}, {"women_150", "nvzhushou_150"}, {"women_180", "nvzhushou_180"}, {"women_181", "nvzhushou_181"}, }; // 假设重命名表是一个字典,键是旧名称,值是新名称 private static readonly Dictionary SoundRenameTable = new Dictionary { {"BottleCrush", "Target_posui_jiuping"}, {"PlateCrush", "Target_posui_panzi"}, {"VaseCrush", "Target_posui_guanzi"}, // {"break", "Target_posui_shuiguo"}, {"Apple 1", "Target_posui_pingguo"}, {"Pumpkin3", "Target_posui_nangua"}, {"Watermelon3", "Target_posui_xigua"}, {"crystal3", "Target_posui_taociping"}, {"AMB_FACTORY", "BGM_Changjing_cangku"}, {"BGM_LOBBY", "BGM_zhujiemian"}, {"BOMB_IN_BARREL", "Target_baozha_youtong_01"}, {"clip_sidefront", "Character_lashuan_01"}, {"Gold_coin_explosion", "Target_baozha_jinbi"}, {"ph_rockRoll", "ph_rockRoll"}, {"robot_halal", "Target_jiqiren"}, {"SE_BINGOLINE", "Character_shenhuxi_01"}, {"SE_BINGOBOARD", "UI_jiesuan"}, {"SE_CHANGEWEAPON", "UI_huanqiang_01"}, {"SE_ClapBig", "guzhang_01"}, {"SE_CLASSIC_RESULT_WIN", "UI_shengli"}, {"SE_COUNT_DOWN", "feipan_daojishi"}, {"SE_FINALLOSE", "UI_shibai"}, {"SE_GAMEOVER", "UI_youxijieshu"}, {"SE_GAUGE", "Character_miaozhunjing"}, {"SE_GETCURRENCY", "UI_huode_jinbi"}, {"SE_GIRL_LAUGH", "Assistant_huanhu"}, {"SE_GO", "feipan_GO_01"}, {"SE_GOLDMEDALCLEAR", "UI_jiesuan_GOLD"}, {"SE_GOLDMEDALCROWD", "UI_guzhang_GOLD"}, {"SE_HEART_BROKEN", "UI_posui_Assistantxin"}, {"SE_HIT_1", "HIT_gongjian"}, {"SE_MISSIONCLEAR", "SE_RenWuWanCheng"}, {"SE_HIT_BODY", "HIT_shenti"}, {"SE_HIT_HEAD", "HIT_toubu"}, {"SE_HIT_METAL", "HIT_jinshu"}, {"SE_HIT_PLATE", "HIT_panzi"}, {"SE_HIT_STEEL", "HIT_gangtie"}, {"SE_LIPAO", "Assistant_lipao"}, {"SE_MISS_CLOTH", "MISS_yifu"}, {"SE_MISS_METAL", "MISS_jinshu"}, {"SE_MISS_ROCKS", "MISS_ShiTou"}, {"SE_MISS_WALL", "MISS_qiangbi"}, {"SE_MISS_WOOD", "MISS_mutou"}, {"SE_MISSGRASS", "MISS_caodi"}, {"SE_MISSION_BRONZE", "UI_jiesuan_qingtong"}, {"SE_TITLE", "SE_QiDong"}, {"SE_OPEN_BOX", "UI_kaixiangzi"}, {"SE_READY", "Character_taiqiang"}, {"SE_READYBREATH", "Character_shenhuxi_02"}, {"SE_RESET", "UI_huanqiang_02"}, {"UI_TIMERACE_ENTRYFEE", "UI_jishisai_baomingfei"}, {"SE_ROLL_STOP", "UI_laohuji_tingzhi"}, {"SE_ROLL", "UI_laohuji_choujiang"}, {"SE_SCORE_SHOW", "UI_xingxing_01"}, {"SE_SET_CROWD_DRAW", "guzhang_02"}, {"SE_SILVERMEDALCLEAR", "UI_jiesuan_SILVER"}, {"SE_SILVERMEDALCROWD", "UI_guzhang_SILVER"}, {"SE_STAR", "UI_xingxing_02"}, {"SE_START", "guzhang_03"}, {"SE_Wood damage", "HIT_mutou"}, {"VO_GO", "feipan_GO_02"}, {"UI_BUTTON", "UI_AnNiu"}, {"VO_X10POINT_00", "Score_GREAT"}, {"VO_X10POINT_01", "Score_PERFECT"}, {"VO_X10POINT_02", "Score_WONDERFUL"}, {"wep_insert_bul", "Character_shangtang_01"}, {"airplane_boom", "Target_baozha_feiji"}, {"airplane", "Target_feiji"}, {"bee_flying", "Target_mifeng"}, {"brid_jizhong", "Target_niao"}, {"casing_45mm", "Character_danke"}, {"clip_sideback", "clip_sideback"}, // {"clip_sidefront", "Character_lashuan_02"}, {"Crossbow_PSE_Fire", "Weapon_bow"}, {"Crossbow_PSE_Reload", "Weapon_bow_lagong"}, {"gun_Awm_shoot", "Weapon_AWM"}, {"gun_Gm6_shoot", "Weapon_GM6"}, {"gun_M24sws_shoot", "Weapon_M24sws"}, {"gun_M82a3_shoot", "Weapon_M82a3"}, {"gun_MosinNagant_shoot", "Weapon_MosinNagant"}, {"gun_VssVintorez_shoot", "Weapon_VssVintorez"}, {"oil_boom", "Target_baozha_youtong_02"}, {"woman_death", "Assistant_death"}, {"woman_happy", "Assistant_happy"}, {"woman_happy2", "Assistant_happy2"}, {"woman_hit", "Assistant_hit"}, {"UI_LEVELUP", "UI_ShengJi"}, {"UI_STAGE_INFO", "UI_GuanQiaXinXi"}, }; [MenuItem("Tools/Target Utils/声音资源重命名")] public static void RenameSoundResource() { // 资源改名 string folderPath = GetSelectedFolderPath(); string[] guids = AssetDatabase.FindAssets("t:AudioClip", new string[] {folderPath}); foreach (string guid in guids) { string assetPath = AssetDatabase.GUIDToAssetPath(guid); string oldName = Path.GetFileNameWithoutExtension(assetPath); if (SoundRenameTable.TryGetValue(oldName, out var newName)) { AssetDatabase.RenameAsset(assetPath, newName); } else { Debug.LogError($"声音资源改名未找到SoundRenameTable:{oldName}"); } } } [MenuItem("Tools/Target Utils/声音配表重命名")] public static void RenameSoundConfig(){ // 改配表 DataManager.Instance.InitData(); ConfigEditor.ClearCacheData(); foreach (var soundData in DataManager.Instance.csvData.Sound) { if (SoundRenameTable.TryGetValue(soundData.name, out var newName)) { soundData.name = newName; } else { Debug.LogError($"声音配表改名未找到SoundRenameTable:{soundData.name}"); } } SaveSoundData(ConfigEditor.GAME_DATA_DIR, "Sound", DataManager.Instance.csvData.Sound); } [MenuItem("Tools/Target Utils/声音代码重命名")] public static void RenameSoundScript(){ // 改代码 string assetsPath = GetSelectedFolderPath(); string[] scriptFiles = Directory.GetFiles(assetsPath, "*.cs", SearchOption.AllDirectories); foreach (string scriptFile in scriptFiles) { if (Path.GetFileName(scriptFile) == "TargetPrefabRenamer.cs") continue; string originalContent = File.ReadAllText(scriptFile); string newContent = originalContent; foreach (KeyValuePair pair in SoundRenameTable) { // 使用正则表达式进行完整单词匹配替换 newContent = Regex.Replace(newContent, @"\b" + pair.Key + @"\b", pair.Value); } if (newContent != originalContent) { File.WriteAllText(scriptFile, newContent); } } AssetDatabase.Refresh(); } [MenuItem("Tools/Target Utils/声音动画重命名")] public static void RenameSoundAnim(){ // 改代码 string assetsPath = GetSelectedFolderPath(); string[] scriptFiles = Directory.GetFiles(assetsPath, "*.anim", SearchOption.AllDirectories); foreach (string scriptFile in scriptFiles) { // if (Path.GetFileName(scriptFile) == "TargetPrefabRenamer.cs") continue; string originalContent = File.ReadAllText(scriptFile); string newContent = originalContent; foreach (KeyValuePair pair in SoundRenameTable) { // 使用正则表达式进行完整单词匹配替换 newContent = Regex.Replace(newContent, @"\b" + pair.Key + @"\b", pair.Value); } if (newContent != originalContent) { File.WriteAllText(scriptFile, newContent); } } AssetDatabase.Refresh(); } public static void SaveSoundData(string xlsPath, string xlsName, List configs) { const int StartRow = 4; const string dirPath = "{0}tables/{1}.xlsx"; string outputPath = string.Format(dirPath, xlsPath, xlsName); Excel xls = new Excel(); xls.AddTable(xlsName); xls.Tables[0].SetValue(1, 1, "ID"); xls.Tables[0].SetValue(1, 2, "name"); xls.Tables[0].SetValue(1, 3, "vol"); xls.Tables[0].SetValue(2, 1, "int32"); xls.Tables[0].SetValue(2, 2, "string"); xls.Tables[0].SetValue(2, 3, "int32"); xls.Tables[0].SetValue(3, 1, "RepeatCheck:true MakeIndex:true"); xls.Tables[0].SetValue(4, 1, "音乐ID"); xls.Tables[0].SetValue(4, 2, "名称"); xls.Tables[0].SetValue(4, 3, "音量"); int i = StartRow; foreach (var data in configs) { ++i; xls.Tables[0].SetValue(i, 1, data.ID); xls.Tables[0].SetValue(i, 2, data.name); xls.Tables[0].SetValue(i, 3, data.vol); } DataWriter.AddTypeSheet(xls, xlsName); ExcelHelper.SaveExcel(xls, outputPath); } [MenuItem("Tools/Target Utils/Rename Prefabs")] public static void RenamePrefabs() { string folderPath = GetSelectedFolderPath(); Debug.Log(folderPath); string[] prefabFiles = Directory.GetFiles(folderPath, "*.prefab", SearchOption.AllDirectories); // foreach (string prefabPath in prefabFiles) // { // string prefabName = Path.GetFileNameWithoutExtension(prefabPath); // // if (renameTable.ContainsKey(prefabName)) // { // string newName = renameTable[prefabName]; // string newPath = Path.Combine(Path.GetDirectoryName(prefabPath), newName + ".prefab"); // // File.Move(prefabPath, newPath); // } // } string[] guids = AssetDatabase.FindAssets("t:Prefab", new string[] { folderPath }); foreach (string guid in guids) { string assetPath = AssetDatabase.GUIDToAssetPath(guid); string prefabName = Path.GetFileNameWithoutExtension(assetPath); if (PrefabRenameTable.ContainsKey(prefabName)) { string newName = PrefabRenameTable[prefabName]; string newPath = Path.Combine(Path.GetDirectoryName(assetPath), newName + ".prefab"); AssetDatabase.RenameAsset(assetPath, newName); } } } [MenuItem("Tools/Target Utils/移除prefab不存在的靶子配表")] public static void RemoveTargetConfigNoPrefab() { DataManager.Instance.InitData(); ConfigEditor.ClearCacheData(); var keysToRemove = new List(); foreach (var targetDataPair in ConfigEditor.targetDataCfgs) { var names = targetDataPair.Value.ResourceName.Split("#"); if (!names.Any(name => PrefabRenameTable.ContainsValue(name))) { keysToRemove.Add(targetDataPair.Key); } } foreach (var key in keysToRemove) { ConfigEditor.targetDataCfgs.Remove(key); } DataWriter.SaveTargetData(ConfigEditor.GAME_DATA_DIR, "TargetData", ConfigEditor.targetDataCfgs); } [MenuItem("Tools/Target Utils/靶子配表动画重命名")] public static void RenameTargetConfigAnimName() { DataManager.Instance.InitData(); ConfigEditor.ClearCacheData(); foreach (var targetData in ConfigEditor.targetDataCfgs.Values) { if (!string.IsNullOrEmpty(targetData.CtrlAniFileName)) { if (AnimRenameTable.TryGetValue(targetData.CtrlAniFileName, out var newName)) { targetData.CtrlAniFileName = newName; } else { Debug.LogError($"AnimRenameTable 不存在 CtrlAniFileName:{targetData.CtrlAniFileName}"); } } if (!string.IsNullOrEmpty(targetData.Hit)) { if (AnimRenameTable.TryGetValue(targetData.Hit, out var newName)) { targetData.Hit = newName; } else { Debug.LogError($"AnimRenameTable 不存在 Hit:{targetData.Hit}"); } } if (!string.IsNullOrEmpty(targetData.Death)) { if (AnimRenameTable.TryGetValue(targetData.Death, out var newName)) { targetData.Death = newName; } else { Debug.LogError($"AnimRenameTable 不存在 Death:{targetData.Death}"); } } } DataWriter.SaveTargetData(ConfigEditor.GAME_DATA_DIR, "TargetData", ConfigEditor.targetDataCfgs); } [MenuItem("Tools/Target Utils/靶子动画文件重命名")] public static void RenameTargetAnimFileName() { string folderPath = GetSelectedFolderPath(); string[] guids = AssetDatabase.FindAssets("t:AnimationClip", new string[] { folderPath }); foreach (string guid in guids) { string assetPath = AssetDatabase.GUIDToAssetPath(guid); string oldName = Path.GetFileNameWithoutExtension(assetPath); if (AnimRenameTable.TryGetValue(oldName, out var newName)) { AssetDatabase.RenameAsset(assetPath, newName); } else { Debug.LogError($"AnimRenameTable不存在:{oldName}"); } } } [MenuItem("Tools/Target Utils/Rename Prefabs Config")] private static void RemovePrefabsConfig() { using StreamReader reader = new StreamReader(Application.dataPath + "../TargerNames.txt"); using StreamWriter writer = new StreamWriter(Application.dataPath + "../TargerExportNames.txt"); string line; while ((line = reader.ReadLine())!= null) { var names = line.Split("#"); if (names.Length == 1) { if (PrefabRenameTable.ContainsKey(line)) { writer.WriteLine(PrefabRenameTable[line]); } else { writer.WriteLine(line); // Debug.LogError($"未找到重命名: {line}"); } } else { bool found = false; for (var i = 0; i < names.Length; i++) { var name = names[i]; if (PrefabRenameTable.ContainsKey(name)) { names[i] = PrefabRenameTable[name]; found = true; } } if (found) { writer.WriteLine(string.Join('#', names)); } else { writer.WriteLine(line); Debug.LogError($"未找到重命名: {line}"); } } } } public static string GetSelectedFolderPath() { var selectedObject = Selection.activeObject; if (selectedObject!= null && AssetDatabase.IsValidFolder(AssetDatabase.GetAssetPath(selectedObject))) { string folderPath = AssetDatabase.GetAssetPath(selectedObject); // Debug.Log("Selected Folder Path: " + folderPath); return folderPath; } else { // Debug.Log("No valid folder selected."); } return null; } }