| | |
| | | UpdateLevelSetting.SetAllLevelAssetBundleName();
|
| | | UpdateAudioSetting.SetAllAudioAssetBundleName();
|
| | | UpdateVideoSetting.SetAllVideoAssetBundleName();
|
| | | // UpdateLuaSetting.SetAllLuaAssetBundleName();
|
| | | UpdateBuiltInSetting.SetBuiltinAssetBundleName();
|
| | | AssetDatabase.Refresh();
|
| | | DebugEx.Log("资源包名全部更新完成!");
|
| | |
| | | [MenuItem("程序/设置资源包名/更新Sprite(All) AssetBundleName")]
|
| | | public static void SetAllSpriteAssetBundleName()
|
| | | {
|
| | | var allFiles = new DirectoryInfo(rootPath).GetFiles("*.png", SearchOption.AllDirectories);
|
| | | //改成设置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 = "ui/sprite/" + file.Name.Split(".")[0].ToLower();
|
| | | // EditorUtility.SetDirty(importer);
|
| | | }
|
| | |
|
| | | allFiles = new DirectoryInfo(rootPath).GetFiles("*.png", SearchOption.AllDirectories);
|
| | |
|
| | | foreach (var file in allFiles)
|
| | | {
|
| | |
| | | importer.assetBundleName = "ui/sprite/" + pathStringArray[pathStringArray.Length - 1].ToLower();
|
| | | // EditorUtility.SetDirty(importer);
|
| | | }
|
| | |
|
| | |
|
| | | DebugEx.Log("Sprite资源包名更新完成!");
|
| | | // AssetDatabase.SaveAssets();
|
| | | // AssetDatabase.Refresh();
|
| | |
| | |
|
| | | public class UpdateMobSetting
|
| | | {
|
| | | static string rootPath = Application.dataPath + "/ResourcesOut/Mob";
|
| | | static string assetPath = "Assets/ResourcesOut/Mob";
|
| | | static string createroleRoot = Application.dataPath + "/ResourcesOut/Mob/CreateRole";
|
| | | static string createroleAssetPath = "Assets/ResourcesOut/Mob/CreateRole";
|
| | | 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/Mob/A_Zs/Materials";
|
| | | static string fsMaterialPath_OutPut = Application.dataPath + "/ResourcesOut/Mob/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()
|
| | |
| | | .Replace(".prefab", "")
|
| | | .Replace("Prefab_Hand", "");
|
| | |
|
| | | importer.assetBundleName = StringUtility.Contact("mob/prefab_race", hostfix);
|
| | | importer.assetBundleName = StringUtility.Contact("gmodels/prefab_race", hostfix);
|
| | | // EditorUtility.SetDirty(importer);
|
| | | }
|
| | |
|
| | |
| | | var importerPath = createroleAssetPath + Path.DirectorySeparatorChar + file.Name;
|
| | | var extersion = Path.GetExtension(file.FullName);
|
| | | var importer = AssetImporter.GetAtPath(importerPath);
|
| | | importer.assetBundleName = "mob/createrole";
|
| | | importer.assetBundleName = "gmodels/createrole";
|
| | | // EditorUtility.SetDirty(importer);
|
| | | }
|
| | |
|
| | |
| | | if (_file.Name.StartsWith("A_Zs_Sz"))
|
| | | {
|
| | | string _abName = Path.GetFileNameWithoutExtension(_file.Name).Replace("_Dm", "");
|
| | | _importer.assetBundleName = "mob/prefab_race_" + _abName;
|
| | | _importer.assetBundleName = "gmodels/prefab_race_" + _abName;
|
| | | }
|
| | | else
|
| | | {
|
| | | string _abName = Path.GetFileNameWithoutExtension(_file.Name).Replace("_02", "").Replace("_Dm", "").Replace("_Dm_02", "");
|
| | | _importer.assetBundleName = "mob/prefab_race_" + _abName;
|
| | | _importer.assetBundleName = "gmodels/prefab_race_" + _abName;
|
| | | }
|
| | | // EditorUtility.SetDirty(_importer);
|
| | | }
|
| | |
| | | if (_file.Name.StartsWith("A_Fs_Sz"))
|
| | | {
|
| | | string _abName = Path.GetFileNameWithoutExtension(_file.Name).Replace("_Dm", "");
|
| | | _importer.assetBundleName = "mob/prefab_race_" + _abName;
|
| | | _importer.assetBundleName = "gmodels/prefab_race_" + _abName;
|
| | | }
|
| | | else
|
| | | {
|
| | | string _abName = Path.GetFileNameWithoutExtension(_file.Name).Replace("_02", "").Replace("_Dm", "").Replace("_Dm_02", "");
|
| | | _importer.assetBundleName = "mob/prefab_race_" + _abName;
|
| | | _importer.assetBundleName = "gmodels/prefab_race_" + _abName;
|
| | | }
|
| | | // EditorUtility.SetDirty(_importer);
|
| | | }
|
| | |
| | | // var importerPath = assetPath + "/A_Zs/Materials/" + file.Name;
|
| | | // var importer = AssetImporter.GetAtPath(importerPath);
|
| | |
|
| | | // importer.assetBundleName = "mob/a_zs_materials";
|
| | | // importer.assetBundleName = "gmodels/a_zs_materials";
|
| | | // EditorUtility.SetDirty(importer);
|
| | | //}
|
| | |
|
| | |
| | | // var importerPath = assetPath + "/A_Fs/Materials/" + file.Name;
|
| | | // var importer = AssetImporter.GetAtPath(importerPath);
|
| | |
|
| | | // importer.assetBundleName = "mob/a_fs_materials";
|
| | | // importer.assetBundleName = "gmodels/a_fs_materials";
|
| | | // EditorUtility.SetDirty(importer);
|
| | | //}
|
| | | DebugEx.Log("Mob资源包名更新完成!");
|
| | | DebugEx.Log("Gmodels资源包名更新完成!");
|
| | | //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)
|
| | | {
|
| | |
| | | [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);
|
| | | }
|
| | |
|
| | |
| | | importer.assetBundleName = "maps/textures";
|
| | | // EditorUtility.SetDirty(importer);
|
| | | }
|
| | | DebugEx.Log("Level资源包名更新完成!");
|
| | | exportMaps?.Clear();
|
| | | exportMaps = null;
|
| | | DebugEx.Log("map资源包名更新完成!");
|
| | | // AssetDatabase.SaveAssets();
|
| | | // AssetDatabase.Refresh();
|
| | | }
|
| | |
|
| | | //读取排除地图的配置
|
| | | private static void ReadExportConfig()
|
| | | {
|
| | | if (File.Exists(exportMapsPath))
|
| | | {
|
| | | var lines = File.ReadAllLines(exportMapsPath);
|
| | | exportMaps = new HashSet<string>(lines);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | {
|
| | | var importerPath = assetPath + file.Name;
|
| | | var importer = AssetImporter.GetAtPath(importerPath);
|
| | | importer.assetBundleName = "video/mp4";
|
| | | importer.assetBundleName = "video/"+Path.GetFileNameWithoutExtension(file.FullName);
|
| | | // EditorUtility.SetDirty(importer);
|
| | | }
|
| | | DebugEx.Log("Video资源包名更新完成!");
|
| | | // AssetDatabase.SaveAssets();
|
| | | // AssetDatabase.Refresh();
|
| | | }
|
| | | }
|
| | |
|
| | | public class UpdateLuaSetting
|
| | | {
|
| | | static string rootPath = Application.dataPath + "/ResourcesOut/Lua/";
|
| | | static string assetPath = "Assets/ResourcesOut/Lua/";
|
| | |
|
| | | [MenuItem("程序/设置资源包名/更新Lua(All) AssetBundleName")]
|
| | | public static void SetAllLuaAssetBundleName()
|
| | | {
|
| | | var allFiles = new DirectoryInfo(rootPath).GetFiles("*.txt", SearchOption.AllDirectories);
|
| | |
|
| | | var amendRootPath = rootPath.Replace("\\", "/");
|
| | | foreach (var file in allFiles)
|
| | | {
|
| | | var directoryName = file.DirectoryName.Replace("\\", "/");
|
| | | var relativeDirectory = directoryName.Replace(amendRootPath, "");
|
| | |
|
| | | var importerPath = assetPath + relativeDirectory + Path.DirectorySeparatorChar + file.Name;
|
| | | var importer = AssetImporter.GetAtPath(importerPath);
|
| | | importer.assetBundleName = "lua/" + relativeDirectory.ToLower();
|
| | | // EditorUtility.SetDirty(importer);
|
| | | }
|
| | | DebugEx.Log("Lua资源包名更新完成!");
|
| | | // AssetDatabase.SaveAssets();
|
| | | // AssetDatabase.Refresh();
|
| | | }
|
| | |
| | | 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;
|
| | | var importer = AssetImporter.GetAtPath(importerPath);
|
| | | importer.assetBundleName = "builtin/" + relativeDirectory.ToLower();
|
| | | // EditorUtility.SetDirty(importer);
|
| | | if (file.Name != ".DS_Store")
|
| | | {
|
| | | var importer = AssetImporter.GetAtPath(importerPath);
|
| | | importer.assetBundleName = "builtin/" + relativeDirectory.ToLower();
|
| | | // EditorUtility.SetDirty(importer);
|
| | | }
|
| | | }
|
| | | DebugEx.Log("BuiltIn资源包名更新完成!");
|
| | | // AssetDatabase.SaveAssets();
|