| | |
| | | using UnityEngine; |
| | | using UnityEditor; |
| | | using Spine; |
| | | |
| | | |
| | | //新引擎 提供创建sprite atlas |
| | | |
| | | [CreateAssetMenu(menuName = "Config/SpriteSettingConfig")] |
| | | public class SpriteSettingConfig : ScriptableObject
|
| | |
| | | public class SpriteSetting
|
| | | {
|
| | | public string folderName;
|
| | | public SpriteMeshType meshType = SpriteMeshType.Tight;
|
| | | public TextureImporterAlphaSource alphaSource = TextureImporterAlphaSource.FromInput;
|
| | | public int blockOffset = 1;
|
| | | public bool enableRotation = false;
|
| | | public bool enableTightPacking = false;
|
| | | public int padding = 4;
|
| | |
|
| | | public bool readable = false;
|
| | | public bool generateMipMaps = false;
|
| | | public bool sRGB = true;
|
| | | public FilterMode filterMode = FilterMode.Bilinear; // = FilterMode.Bilinear,
|
| | |
|
| | | public PlatformSetting[] platformSettings;
|
| | | } |
| | | |
| | |
| | | {
|
| | | public string name;
|
| | | public int maxTextureSize = 2048;
|
| | | public TextureImporterFormat textureFormat = TextureImporterFormat.RGBA32;
|
| | | public int compressionQuality = 1;
|
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | public static class SpriteSettingUtility
|
| | | {
|
| | | public static bool Equal(this SpriteSettingConfig.SpriteSetting _spriteSetting, TextureImporter _textureImporter)
|
| | | {
|
| | | if (_spriteSetting.alphaSource != _textureImporter.alphaSource)
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | foreach (var platformSetting in _spriteSetting.platformSettings)
|
| | | {
|
| | | var nowPlatformSetting = _textureImporter.GetPlatformTextureSettings(platformSetting.name);
|
| | | if (nowPlatformSetting == null)
|
| | | {
|
| | | continue;
|
| | | }
|
| | |
|
| | | if (platformSetting.maxTextureSize != nowPlatformSetting.maxTextureSize)
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | if (platformSetting.textureFormat != nowPlatformSetting.format)
|
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | if (platformSetting.compressionQuality != nowPlatformSetting.compressionQuality)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | return true;
|
| | | public TextureImporterCompression textureCompression = TextureImporterCompression.Compressed; |
| | | public TextureImporterFormat textureFormat = TextureImporterFormat.ASTC_6x6; //ios TextureImporterFormat.PVRTC_RGB4
|
| | | }
|
| | | }
|
| | |
|
| | | } |