少年修仙传客户端基础资源
lwb
2021-01-16 d53163a421aa411a3587d4e1f3496e12d19e5e16
Assets/Editor/Tool/UpdateAssetBundleName.cs
@@ -373,8 +373,10 @@
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)
    {
@@ -395,12 +397,19 @@
    [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);
            importer.assetBundleName = "maps/" + Path.GetFileNameWithoutExtension(file.FullName).ToLower();
            var name = Path.GetFileNameWithoutExtension(file.FullName);
            if (exportMaps.Contains(name)) //判断这个地图是否被排除,被排除不打包
                importer.assetBundleName = "";
            else
                importer.assetBundleName = "maps/" + name.ToLower();
            // EditorUtility.SetDirty(importer);
        }
@@ -419,11 +428,23 @@
            importer.assetBundleName = "maps/textures";
            // EditorUtility.SetDirty(importer);
        }
        exportMaps?.Clear();
        exportMaps = null;
        DebugEx.Log("Level资源包名更新完成!");
        // 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