diff --git a/Assets/Scripts/Editor/CustomImportSettings.cs b/Assets/Scripts/Editor/CustomImportSettings.cs index d380c0c0a1..77f1ee9602 100644 --- a/Assets/Scripts/Editor/CustomImportSettings.cs +++ b/Assets/Scripts/Editor/CustomImportSettings.cs @@ -28,6 +28,7 @@ namespace GameEditor {"/Atlas/", SetUITexture}, {"/BG/", SetBGTexture}, {"/DynamicAtlas/", SetBGTexture}, + {"/Fonts/", SetUITexture}, }; @@ -67,7 +68,7 @@ namespace GameEditor importer.spritePackingTag = GetAtlasName(importer.assetPath); importer.SetTextureSettingsExt(true, TextureImporterType.Sprite, 1, AppConst.PIXELTOWORLD, false, TextureWrapMode.Clamp, FilterMode.Trilinear, TextureImporterNPOTScale.None); importer.SetPlatformSettingsExt("Android", TextureImporterFormat.ETC2_RGBA8Crunched, MAX_TEXTURE_SIZE, 50, false); - //importer.SetPlatformSettingsExt("iPhone", TextureImporterFormat.ETC2_RGBA8Crunched, MAX_TEXTURE_SIZE, 50, false); + importer.SetPlatformSettingsExt("iPhone", TextureImporterFormat.ASTC_RGBA_6x6, MAX_TEXTURE_SIZE, 50, false); //importer.SetPlatformSettingsExt("Standalone", TextureImporterFormat.RGBA32, MAX_TEXTURE_SIZE, 50, false); } @@ -93,7 +94,7 @@ namespace GameEditor importer.spritePackingTag = string.Empty; //GetAtlasName(importer.assetPath); importer.SetTextureSettingsExt(true, TextureImporterType.Sprite, 1, AppConst.PIXELTOWORLD, false, TextureWrapMode.Clamp, FilterMode.Trilinear, TextureImporterNPOTScale.None); importer.SetPlatformSettingsExt("Android", TextureImporterFormat.ETC2_RGBA8Crunched, MAX_TEXTURE_SIZE, 50, false); - importer.SetPlatformSettingsExt("iPhone", TextureImporterFormat.ASTC_RGBA_10x10, MAX_TEXTURE_SIZE, 50, false); + importer.SetPlatformSettingsExt("iPhone", TextureImporterFormat.ASTC_RGBA_8x8, MAX_TEXTURE_SIZE, 50, false); importer.SetPlatformSettingsExt("Standalone", TextureImporterFormat.RGBA32, MAX_TEXTURE_SIZE, 50, false); } diff --git a/Assets/Scripts/Editor/OptTools/TextureOptTools.cs b/Assets/Scripts/Editor/OptTools/TextureOptTools.cs index 7fec6bc85c..9728995179 100644 --- a/Assets/Scripts/Editor/OptTools/TextureOptTools.cs +++ b/Assets/Scripts/Editor/OptTools/TextureOptTools.cs @@ -207,6 +207,44 @@ namespace LJ_OptTools GameEditor.CustomImportSettings.enabled = false; EditorUtility.ClearProgressBar(); } + [MenuItem("Assets/优化工具/重新导入")] + public static void ReImport() + { + var guids = Selection.assetGUIDs; + var filePaths = new List(); + foreach (var id in guids) + { + var path = AssetDatabase.GUIDToAssetPath(id); + if (File.Exists(path)) + { + if (!filePaths.Contains(path)) + filePaths.Add(path); + } + else if (Directory.Exists(path)) + { + var subFileGuids = AssetDatabase.FindAssets("t:Texture", new string[] { path }); + if (subFileGuids != null && subFileGuids.Length > 0) + { + foreach (var subId in subFileGuids) + { + var subPath = AssetDatabase.GUIDToAssetPath(subId); + if (!filePaths.Contains(subPath)) + filePaths.Add(subPath); + } + } + } + } + + if (filePaths.Count < 1) return; + for (int i = 0; i < filePaths.Count; i++) + { + string path = filePaths[i]; + EditorUtility.DisplayProgressBar(string.Format("Opt UI Texture({0}/{1})", i, filePaths.Count), path, i * 1f / filePaths.Count); + AssetDatabase.ImportAsset(path); + } + EditorUtility.ClearProgressBar(); + } + [MenuItem("Assets/优化工具/UI特效贴图快速压缩")]