using UnityEditor;
using UnityEngine;

namespace XGame.Editor.Asset.Processor
{
    [System.Serializable]
    public class AtlasImportOption : AssetImportOption<TextureImporter>
    {
        private Vector4 spriteBorder;
        private Vector2 spritePivot;
        protected override string PresetTemplateName => "AtlasImporterTemplate";
        protected override void OnInit()
        {
            importKeys = new string[] { "UI/Atlas/", "Map/Atlas/" };
        }

        protected override void PreApplyImporter(string assetPath, TextureImporter importer)
        {
            spriteBorder = importer.spriteBorder;
            spritePivot = importer.spritePivot;
        }
        protected override void OnApplyImporter(string assetPath, TextureImporter importer)
        {
            importer.spriteBorder = spriteBorder;
            importer.spritePivot = spritePivot;
            //if (AssetsConfig.PackerMode == SpritePackerMode.Legacy)
            //{
            //    importer.spritePackingTag = AtlasHelper.GetAtlasNameByAssetPath(assetPath);
            //}
        }
    }
}
