using System; using UnityEditor; using UnityEditor.Presets; namespace XGame.Editor.Asset { [Serializable] public class AtlasInfo { internal static AtlasInfo DefaultInfo() { return new AtlasInfo() { packerMode = SpritePackerMode.Atlas, atlasLayerLimit = 3, spriteAtlasPreset = DefaultPreset, }; } public SpritePackerMode packerMode; /// /// 图集文件夹子目录的遍历上限 /// 超过上限的视为同一个图集 /// public byte atlasLayerLimit; /// /// 图集预设 /// public Preset spriteAtlasPreset; /// /// 图集名命名类型 /// 0:tag+文件夹名 /// 1:文件夹路径 /// 2:guid /// public int atlasNameType; private static Preset DefaultPreset { get { var guids = AssetDatabase.FindAssets("SpriteAtlasTemplate"); if (guids.Length > 0) { var assetPath = AssetDatabase.GUIDToAssetPath(guids[0]); return AssetDatabase.LoadAssetAtPath(assetPath); } return null; } } } }