| using System.Collections;  | 
| using System.Collections.Generic;  | 
| using UnityEngine;  | 
| using UnityEditor;  | 
| using System.IO;  | 
|   | 
| public class UpdateAllSetting  | 
| {  | 
|   | 
|     [MenuItem("程序/设置资源包名/更新全部ABLabel(不包括lua)")]  | 
|     public static void SetAllAssetBundleName()  | 
|     {  | 
|         UpdateSpriteSetting.SetAllSpriteAssetBundleName();  | 
|         UpdateUIWindowSetting.SetAllUIWindowAssetBundleName();  | 
|         UpdateUIPrefabSetting.SetAllUIPrefabAssetBundleName();  | 
|         UpdateEffectPrefabSetting.SetAllEffectPrefabAssetBundleName();  | 
|         UpdateMobSetting.SetAllMobAssetBundleName();  | 
|         UpdateShaderSetting.SetAllShaderAssetBundleName();  | 
|         UpdateScriptableObjectsSetting.SetAllScriptableObjectAssetBundleName();  | 
|         UpdateLevelSetting.SetAllLevelAssetBundleName();  | 
|         UpdateAudioSetting.SetAllAudioAssetBundleName();  | 
|         UpdateVideoSetting.SetAllVideoAssetBundleName();  | 
|         UpdateBuiltInSetting.SetBuiltinAssetBundleName();  | 
|         AssetDatabase.Refresh();  | 
|         Debug.Log("资源包名全部更新完成!");  | 
|     }  | 
| }  | 
|   | 
| public class UpdateSpriteSetting  | 
| {  | 
|   | 
|     static string rootPath = Application.dataPath + "/ResourcesOut/Sprite";  | 
|     static string spriteRelativePath = "Assets/ResourcesOut/Sprite";  | 
|   | 
|     public static void SetRechargeSkin(int pattern)  | 
|     {  | 
|         var toDirectory = Application.dataPath + "/ResourcesOut/Sprite/Recharge";  | 
|         var oldFiles = new DirectoryInfo(toDirectory).GetFiles("*.png", SearchOption.AllDirectories);  | 
|         foreach (var item in oldFiles)  | 
|         {  | 
|             File.Delete(item.FullName);  | 
|         }  | 
|   | 
|         var fromDirectory = Application.dataPath + "/Editor/RechargeSprites/Pattern_" + pattern;  | 
|         FileExtersion.DirectoryCopy(fromDirectory, toDirectory);  | 
|     }  | 
|   | 
|     [MenuItem("程序/设置资源包名/更新Sprite(All) AssetBundleName")]  | 
|     public static void SetAllSpriteAssetBundleName()  | 
|     {  | 
|         //改成设置atlas的assetBundleName  | 
|         var allFiles = new DirectoryInfo(rootPath).GetFiles("*.spriteatlasv2", SearchOption.AllDirectories);  | 
|   | 
|         foreach (var file in allFiles)  | 
|         {  | 
|             var importerPath = spriteRelativePath + Path.DirectorySeparatorChar + file.Name;  | 
|             var importer = AssetImporter.GetAtPath(importerPath);  | 
|             importer.assetBundleName = "sprite/" + file.Name.Split(".")[0].ToLower();  | 
|             // EditorUtility.SetDirty(importer);  | 
|         }  | 
|   | 
|         allFiles = new DirectoryInfo(rootPath).GetFiles("*.png", SearchOption.AllDirectories);  | 
|   | 
|         foreach (var file in allFiles)  | 
|         {  | 
|             var pathStringArray = file.DirectoryName.Split(Path.DirectorySeparatorChar);  | 
|             var importerPath = spriteRelativePath + Path.DirectorySeparatorChar + pathStringArray[pathStringArray.Length - 1] + Path.DirectorySeparatorChar + file.Name;  | 
|             var importer = AssetImporter.GetAtPath(importerPath);  | 
|             importer.assetBundleName = "sprite/" + pathStringArray[pathStringArray.Length - 1].ToLower();  | 
|             // EditorUtility.SetDirty(importer);  | 
|         }  | 
|   | 
|   | 
|         Debug.Log("Sprite资源包名更新完成!");  | 
|         // AssetDatabase.SaveAssets();  | 
|         // AssetDatabase.Refresh();  | 
|     }  | 
|   | 
| }  | 
|   | 
|   | 
| public class UpdateUIWindowSetting  | 
| {  | 
|     static string assetRelativePath = "Assets/ResourcesOut/UI";  | 
|   | 
|     [MenuItem("程序/设置资源包名/更新Window(All) AssetBundleName")]  | 
|     public static void SetAllUIWindowAssetBundleName()  | 
|     {  | 
|         var guids = AssetDatabase.FindAssets("t:prefab", new string[] { assetRelativePath });  | 
|         foreach (var guid in guids)  | 
|         {  | 
|             var path = AssetDatabase.GUIDToAssetPath(guid);  | 
|             var importer = AssetImporter.GetAtPath(path);  | 
|             importer.assetBundleName = "ui";  | 
|   | 
|             // EditorUtility.SetDirty(importer);  | 
|         }  | 
|   | 
|         Debug.Log("Window资源包名更新完成!");  | 
|         // AssetDatabase.SaveAssets();  | 
|         // AssetDatabase.Refresh();  | 
|     }  | 
| }  | 
|   | 
| public class UpdateUIPrefabSetting  | 
| {  | 
|     static string prefabRootPath = Application.dataPath + "/ResourcesOut/UIComp";  | 
|     static string prefabAssetRelativePath = "Assets/ResourcesOut/UIComp";  | 
|   | 
|   | 
|     [MenuItem("程序/设置资源包名/更新Prefab(All) AssetBundleName")]  | 
|     public static void SetAllUIPrefabAssetBundleName()  | 
|     {  | 
|         var allFiles = new DirectoryInfo(prefabRootPath).GetFiles("*.prefab", SearchOption.TopDirectoryOnly);  | 
|         foreach (var file in allFiles)  | 
|         {  | 
|             var importerPath = prefabAssetRelativePath + Path.DirectorySeparatorChar + file.Name;  | 
|             var importer = AssetImporter.GetAtPath(importerPath);  | 
|             importer.assetBundleName = "uicomp";  | 
|             // EditorUtility.SetDirty(importer);  | 
|         }  | 
|   | 
|           | 
|         Debug.Log("UIComp资源包名更新完成!");  | 
|         // AssetDatabase.SaveAssets();  | 
|         // AssetDatabase.Refresh();  | 
|     }  | 
|   | 
|   | 
| }  | 
|   | 
| public class UpdateEffectPrefabSetting  | 
| {  | 
|     static string rootPath = Application.dataPath + "/ResourcesOut/Effect/";  | 
|     static string assetPath = "Assets/ResourcesOut/Effect/";  | 
|   | 
|     [MenuItem("程序/设置资源包名/更新Effect(All) AssetBundleName")]  | 
|     public static void SetAllEffectPrefabAssetBundleName()  | 
|     {  | 
|         var allFiles = new DirectoryInfo(rootPath).GetFiles("*.prefab", SearchOption.AllDirectories);  | 
|   | 
|         foreach (var file in allFiles)  | 
|         {  | 
|             var pathStringArray = file.DirectoryName.Split(Path.DirectorySeparatorChar);  | 
|             var importerPath = assetPath + pathStringArray[pathStringArray.Length - 1] + Path.DirectorySeparatorChar + file.Name;  | 
|             var importer = AssetImporter.GetAtPath(importerPath);  | 
|             importer.assetBundleName = "effect/" + pathStringArray[pathStringArray.Length - 1].ToLower();  | 
|             // EditorUtility.SetDirty(importer);  | 
|         }  | 
|         Debug.Log("Effect资源包名更新完成!");  | 
|         // AssetDatabase.SaveAssets();  | 
|         // AssetDatabase.Refresh();  | 
|     }  | 
| }  | 
|   | 
| public class UpdateMobSetting  | 
| {  | 
|     static string rootPath = Application.dataPath + "/ResourcesOut/Gmodels";  | 
|     static string assetPath = "Assets/ResourcesOut/Gmodels";  | 
|     static string createroleRoot = Application.dataPath + "/ResourcesOut/Gmodels/CreateRole";  | 
|     static string createroleAssetPath = "Assets/ResourcesOut/Gmodels/CreateRole";  | 
|   | 
|     static string zsMaterialPath_Origin = Application.dataPath + "/Art/Role/A_Zs/Materials";  | 
|     static string fsMaterialPath_Origin = Application.dataPath + "/Art/Role/A_Fs/Materials";  | 
|   | 
|     static string zsMaterialPath_OutPut = Application.dataPath + "/ResourcesOut/Gmodels/A_Zs/Materials";  | 
|     static string fsMaterialPath_OutPut = Application.dataPath + "/ResourcesOut/Gmodels/A_Fs/Materials";  | 
|   | 
|     [MenuItem("程序/设置资源包名/更新Mob(All) AssetBundleName")]  | 
|     public static void SetAllMobAssetBundleName()  | 
|     {  | 
|         var allFiles = new DirectoryInfo(rootPath).GetFiles("*.prefab", SearchOption.TopDirectoryOnly);  | 
|         foreach (var file in allFiles)  | 
|         {  | 
|             var importerPath = assetPath + Path.DirectorySeparatorChar + file.Name;  | 
|             var extersion = Path.GetExtension(file.FullName);  | 
|             var importer = AssetImporter.GetAtPath(importerPath);  | 
|             var hostfix = file.Name.Replace("Prefab_Secondary", "")  | 
|                                                  .Replace("Prefab_Weapon", "")  | 
|                                                  .Replace("Prefab_Wing", "")  | 
|                                                  .Replace("Prefab_Race", "")  | 
|                                                  .Replace("Prefab_Horse", "")  | 
|                                                  .Replace("_UI", "")  | 
|                                                  .Replace(".prefab", "")  | 
|                                                  .Replace("Prefab_Hand", "");  | 
|   | 
|             importer.assetBundleName = StringUtility.Contact("gmodels/prefab_race", hostfix);  | 
|             // EditorUtility.SetDirty(importer);  | 
|         }  | 
|   | 
|         allFiles = new DirectoryInfo(createroleRoot).GetFiles("*.prefab", SearchOption.TopDirectoryOnly);  | 
|         foreach (var file in allFiles)  | 
|         {  | 
|             var importerPath = createroleAssetPath + Path.DirectorySeparatorChar + file.Name;  | 
|             var extersion = Path.GetExtension(file.FullName);  | 
|             var importer = AssetImporter.GetAtPath(importerPath);  | 
|             importer.assetBundleName = "gmodels/createrole";  | 
|             // EditorUtility.SetDirty(importer);  | 
|         }  | 
|   | 
|         //var zsMaterialFiles = new DirectoryInfo(zsMaterialPath_Origin).GetFiles("*.mat", SearchOption.TopDirectoryOnly);  | 
|         //if (!Directory.Exists(zsMaterialPath_OutPut))  | 
|         //{  | 
|         //    Directory.CreateDirectory(zsMaterialPath_OutPut);  | 
|         //}  | 
|   | 
|         //foreach (var file in zsMaterialFiles)  | 
|         //{  | 
|         //    var fileName = Path.GetFileName(file.FullName);  | 
|         //    File.Copy(file.FullName, StringUtility.Contact(zsMaterialPath_OutPut, "/", fileName), true);  | 
|         //}  | 
|   | 
|         //var fsMaterialFiles = new DirectoryInfo(fsMaterialPath_Origin).GetFiles("*.mat", SearchOption.TopDirectoryOnly);  | 
|         //if (!Directory.Exists(fsMaterialPath_OutPut))  | 
|         //{  | 
|         //    Directory.CreateDirectory(fsMaterialPath_OutPut);  | 
|         //}  | 
|   | 
|         //foreach (var file in fsMaterialFiles)  | 
|         //{  | 
|         //    var fileName = Path.GetFileName(file.FullName);  | 
|         //    File.Copy(file.FullName, StringUtility.Contact(fsMaterialPath_OutPut, "/", fileName), true);  | 
|         //}  | 
|   | 
|         var zsMaterialPathOutFiles = new DirectoryInfo(zsMaterialPath_OutPut).GetFiles("*.mat", SearchOption.TopDirectoryOnly);  | 
|         foreach (var _file in zsMaterialPathOutFiles)  | 
|         {  | 
|             var _fileName = Path.GetFileName(_file.FullName);  | 
|             var _importerPath = assetPath + "/A_Zs/Materials/" + _file.Name;  | 
|             var _importer = AssetImporter.GetAtPath(_importerPath);  | 
|             if (_file.Name.StartsWith("A_Zs_Sz"))  | 
|             {  | 
|                 string _abName = Path.GetFileNameWithoutExtension(_file.Name).Replace("_Dm", "");  | 
|                 _importer.assetBundleName = "gmodels/prefab_race_" + _abName;  | 
|             }  | 
|             else  | 
|             {  | 
|                 string _abName = Path.GetFileNameWithoutExtension(_file.Name).Replace("_02", "").Replace("_Dm", "").Replace("_Dm_02", "");  | 
|                 _importer.assetBundleName = "gmodels/prefab_race_" + _abName;  | 
|             }  | 
|             // EditorUtility.SetDirty(_importer);  | 
|         }  | 
|   | 
|         var fsMaterialPathOutFiles = new DirectoryInfo(fsMaterialPath_OutPut).GetFiles("*.mat", SearchOption.TopDirectoryOnly);  | 
|         foreach (var _file in fsMaterialPathOutFiles)  | 
|         {  | 
|             var _fileName = Path.GetFileName(_file.FullName);  | 
|             var _importerPath = assetPath + "/A_Fs/Materials/" + _file.Name;  | 
|             var _importer = AssetImporter.GetAtPath(_importerPath);  | 
|             if (_file.Name.StartsWith("A_Fs_Sz"))  | 
|             {  | 
|                 string _abName = Path.GetFileNameWithoutExtension(_file.Name).Replace("_Dm", "");  | 
|                 _importer.assetBundleName = "gmodels/prefab_race_" + _abName;  | 
|             }  | 
|             else  | 
|             {  | 
|                 string _abName = Path.GetFileNameWithoutExtension(_file.Name).Replace("_02", "").Replace("_Dm", "").Replace("_Dm_02", "");  | 
|                 _importer.assetBundleName = "gmodels/prefab_race_" + _abName;  | 
|             }  | 
|             // EditorUtility.SetDirty(_importer);  | 
|         }  | 
|   | 
|         // AssetDatabase.SaveAssets();  | 
|         // AssetDatabase.Refresh();  | 
|   | 
|         //foreach (var file in zsMaterialFiles)  | 
|         //{  | 
|         //    var fileName = Path.GetFileName(file.FullName);  | 
|         //    var importerPath = assetPath + "/A_Zs/Materials/" + file.Name;  | 
|         //    var importer = AssetImporter.GetAtPath(importerPath);  | 
|   | 
|         //    importer.assetBundleName = "gmodels/a_zs_materials";  | 
|         //    EditorUtility.SetDirty(importer);  | 
|         //}  | 
|   | 
|         //foreach (var file in fsMaterialFiles)  | 
|         //{  | 
|         //    var fileName = Path.GetFileName(file.FullName);  | 
|         //    var importerPath = assetPath + "/A_Fs/Materials/" + file.Name;  | 
|         //    var importer = AssetImporter.GetAtPath(importerPath);  | 
|   | 
|         //    importer.assetBundleName = "gmodels/a_fs_materials";  | 
|         //    EditorUtility.SetDirty(importer);  | 
|         //}  | 
|         Debug.Log("Gmodels资源包名更新完成!");  | 
|         //AssetDatabase.SaveAssets();  | 
|         //AssetDatabase.Refresh();  | 
|     }  | 
| }  | 
|   | 
| public class UpdateShaderSetting  | 
| {  | 
|     static string rootPath = Application.dataPath + "/ResourcesOut/Shader";  | 
|     static string assetPath = "Assets/ResourcesOut/Shader";  | 
|   | 
|     [MenuItem("程序/设置资源包名/更新Shader(All) AssetBundleName")]  | 
|     public static void SetAllShaderAssetBundleName()  | 
|     {  | 
|         var allFiles = new DirectoryInfo(rootPath).GetFiles("*.shader", SearchOption.TopDirectoryOnly);  | 
|         foreach (var file in allFiles)  | 
|         {  | 
|             var importerPath = assetPath + Path.DirectorySeparatorChar + file.Name;  | 
|             var importer = AssetImporter.GetAtPath(importerPath);  | 
|             importer.assetBundleName = "graphic/shader";  | 
|             // EditorUtility.SetDirty(importer);  | 
|         }  | 
|         Debug.Log("Shader资源包名更新完成!");  | 
|         // AssetDatabase.SaveAssets();  | 
|         // AssetDatabase.Refresh();  | 
|     }  | 
| }  | 
|   | 
| public class UpdateScriptableObjectsSetting  | 
| {  | 
|     static string rootPath = Application.dataPath + "/ResourcesOut/Refdata/ScriptableObject/";  | 
|     static string assetPath = "Assets/ResourcesOut/Refdata/ScriptableObject/";  | 
|     static string[] relativePaths = new string[] { "SoTreasure3D", "SoTreasureMeridian", "SoActor", "SoDeadFly", "SoBodyControl",  | 
|         "SoCameraSFX", "SoFlyObject", "SoSkill", "SoSweepHit", "SoGhostShadow", "SoNewBieGuide", "SoMapObjectGenerate","SoDemonDungeon",  | 
|         "SoHazyMapNpc","SoProcessNode"};  | 
|   | 
|     [MenuItem("程序/设置资源包名/更新ScriptableObject(All) AssetBundleName")]  | 
|     public static void SetAllScriptableObjectAssetBundleName()  | 
|     {  | 
|         for (int i = 0; i < relativePaths.Length; i++)  | 
|         {  | 
|             var relativePath = relativePaths[i];  | 
|             var allFiles = new DirectoryInfo(rootPath + relativePath).GetFiles("*.asset", SearchOption.TopDirectoryOnly);  | 
|   | 
|             foreach (var file in allFiles)  | 
|             {  | 
|                 var importerPath = assetPath + relativePath + Path.DirectorySeparatorChar + file.Name;  | 
|                 var importer = AssetImporter.GetAtPath(importerPath);  | 
|                 importer.assetBundleName = "config/scriptableobjects";  | 
|                 // EditorUtility.SetDirty(importer);  | 
|             }  | 
|         }  | 
|         Debug.Log("ScriptableObject资源包名更新完成!");  | 
|         // AssetDatabase.SaveAssets();  | 
|         // AssetDatabase.Refresh();  | 
|     }  | 
| }  | 
|   | 
| public class UpdateLevelSetting  | 
| {  | 
|     static string exportMapsPath = Application.dataPath + "/Editor/Config/ExportMaps.txt";  | 
|     static string rootPath = Application.dataPath + "/Art/Maps/Scenes";  | 
|     static string assetPath = "Assets/Art/Maps/Scenes";  | 
|     static HashSet<string> exportMaps;//去除的地图列表  | 
|   | 
|     public static void SetCreateRoleLevel(string pattern)  | 
|     {  | 
|         var root = Application.dataPath + "/Art/Maps/Scenes/Map_CreateRole";  | 
|         var from = Application.dataPath + "/Art/Maps/Scenes/Map_CreateRole/" + "CreateRole_" + pattern + ".unity";  | 
|         var to = Application.dataPath + "/Art/Maps/Scenes/" + "CreateRole_001.unity";  | 
|   | 
|         if (File.Exists(from))  | 
|         {  | 
|             if (File.Exists(to))  | 
|             {  | 
|                 File.Delete(to);  | 
|             }  | 
|             File.Copy(from, to);  | 
|         }  | 
|     }  | 
|   | 
|     [MenuItem("程序/设置资源包名/更新Level(All) AssetBundleName")]  | 
|     public static void SetAllLevelAssetBundleName()  | 
|     {  | 
|         ReadExportConfig();  | 
|   | 
|         var allFiles = new DirectoryInfo(rootPath).GetFiles("*.unity", SearchOption.TopDirectoryOnly);  | 
|         foreach (var file in allFiles)  | 
|         {  | 
|             var importerPath = assetPath + Path.DirectorySeparatorChar + file.Name;  | 
|             var importer = AssetImporter.GetAtPath(importerPath);  | 
|             var name = Path.GetFileNameWithoutExtension(file.FullName);  | 
|             if (exportMaps.Contains(name)) //判断这个地图是否被排除,被排除不打包  | 
|                 importer.assetBundleName = "";  | 
|             else  | 
|                 importer.assetBundleName = "maps/" + name.ToLower();  | 
|   | 
|             // EditorUtility.SetDirty(importer);  | 
|         }  | 
|   | 
|         var createRoleAssets = AssetDatabase.FindAssets("t:prefab", new string[] { "Assets/ResourcesOut/Scene/CreateRole" });  | 
|         foreach (var item in createRoleAssets)  | 
|         {  | 
|             var importer = AssetImporter.GetAtPath(AssetDatabase.GUIDToAssetPath(item));  | 
|             importer.assetBundleName = "maps/createrole";  | 
|             // EditorUtility.SetDirty(importer);  | 
|         }  | 
|   | 
|         var textures = AssetDatabase.FindAssets("t:Texture2D", new string[] { "Assets/ResourcesOut/Scene/Textures" });  | 
|         foreach (var item in textures)  | 
|         {  | 
|             var importer = AssetImporter.GetAtPath(AssetDatabase.GUIDToAssetPath(item));  | 
|             importer.assetBundleName = "maps/textures";  | 
|             // EditorUtility.SetDirty(importer);  | 
|         }  | 
|         exportMaps?.Clear();  | 
|         exportMaps = null;  | 
|         Debug.Log("map资源包名更新完成!");  | 
|         // AssetDatabase.SaveAssets();  | 
|         // AssetDatabase.Refresh();  | 
|     }  | 
|   | 
|     //读取排除地图的配置  | 
|     private static void ReadExportConfig()  | 
|     {  | 
|         if (File.Exists(exportMapsPath))  | 
|         {  | 
|             var lines = File.ReadAllLines(exportMapsPath);  | 
|             exportMaps = new HashSet<string>(lines);  | 
|         }  | 
|     }  | 
|   | 
| }  | 
|   | 
| public class UpdateAudioSetting  | 
| {  | 
|     static string rootPath = Application.dataPath + "/ResourcesOut/Audio/";  | 
|     static string assetPath = "Assets/ResourcesOut/Audio/";  | 
|   | 
|     [MenuItem("程序/设置资源包名/更新Audio(All) AssetBundleName")]  | 
|     public static void SetAllAudioAssetBundleName()  | 
|     {  | 
|         var allFiles = new DirectoryInfo(rootPath).GetFiles("*.wav", SearchOption.AllDirectories);  | 
|   | 
|         foreach (var file in allFiles)  | 
|         {  | 
|             var pathStringArray = file.DirectoryName.Split(Path.DirectorySeparatorChar);  | 
|             var importerPath = assetPath + pathStringArray[pathStringArray.Length - 1] + Path.DirectorySeparatorChar + file.Name;  | 
|             var importer = AssetImporter.GetAtPath(importerPath);  | 
|             importer.assetBundleName = "audio/" + pathStringArray[pathStringArray.Length - 1].ToLower();  | 
|             // EditorUtility.SetDirty(importer);  | 
|         }  | 
|         Debug.Log("Audio资源包名更新完成!");  | 
|         // AssetDatabase.SaveAssets();  | 
|         // AssetDatabase.Refresh();  | 
|     }  | 
| }  | 
|   | 
| public class UpdateVideoSetting  | 
| {  | 
|     static string rootPath = Application.dataPath + "/ResourcesOut/Video/";  | 
|     static string assetPath = "Assets/ResourcesOut/Video/";  | 
|   | 
|     [MenuItem("程序/设置资源包名/更新Video(All) AssetBundleName")]  | 
|     public static void SetAllVideoAssetBundleName()  | 
|     {  | 
|         if (!Directory.Exists(rootPath))  | 
|             return;  | 
|         var allFiles = new DirectoryInfo(rootPath).GetFiles("*.mp4", SearchOption.AllDirectories);  | 
|         foreach (var file in allFiles)  | 
|         {  | 
|             var importerPath = assetPath + file.Name;  | 
|             var importer = AssetImporter.GetAtPath(importerPath);  | 
|             importer.assetBundleName = "video/"+Path.GetFileNameWithoutExtension(file.FullName);  | 
|             // EditorUtility.SetDirty(importer);  | 
|         }  | 
|         Debug.Log("Video资源包名更新完成!");  | 
|         // AssetDatabase.SaveAssets();  | 
|         // AssetDatabase.Refresh();  | 
|     }  | 
| }  | 
|   | 
| public class UpdateBuiltInSetting  | 
| {  | 
|     static string rootPath = Application.dataPath + "/ResourcesOut/BuiltIn/";  | 
|     static string assetPath = "Assets/ResourcesOut/BuiltIn/";  | 
|   | 
|     [MenuItem("程序/设置资源包名/更新BuiltIn(All) AssetBundleName")]  | 
|     public static void SetBuiltinAssetBundleName()  | 
|     {  | 
|         var allFiles = new List<FileInfo>();  | 
|         FileExtersion.GetAllDirectoryFileInfos(rootPath, allFiles);  | 
|   | 
|         var amendRootPath = rootPath.Replace("\\", "/");  | 
|         foreach (var file in allFiles)  | 
|         {  | 
|             var extension = Path.GetExtension(file.FullName);  | 
|             if (extension == ".meta")  | 
|             {  | 
|                 continue;  | 
|             }  | 
|   | 
|             if (extension == ".DS_Store")  | 
|             {  | 
|                 continue;  | 
|             }  | 
|   | 
|             var directoryName = file.DirectoryName.Replace("\\", "/");  | 
|             var relativeDirectory = directoryName.Replace(amendRootPath, "");  | 
|   | 
|             var importerPath = assetPath + relativeDirectory + Path.DirectorySeparatorChar + file.Name;  | 
|             if (file.Name != ".DS_Store")  | 
|             {  | 
|                 var importer = AssetImporter.GetAtPath(importerPath);  | 
|                 importer.assetBundleName = "builtin/" + relativeDirectory.ToLower();  | 
|                 // EditorUtility.SetDirty(importer);  | 
|             }  | 
|         }  | 
|         Debug.Log("BuiltIn资源包名更新完成!");  | 
|         // AssetDatabase.SaveAssets();  | 
|         // AssetDatabase.Refresh();  | 
|     }  | 
| } |