using System;
using System.Threading.Tasks;
using UnityEngine.U2D;

namespace UnityEngine.UI
{
    public class UGUIPackManager: IDisposable
    {
        public static UGUIPackManager Instance
        {
            get
            {
                if (_instance == null)
                {
                    _instance = new UGUIPackManager();
                }

                return _instance;
            }
        }

        private static UGUIPackManager _instance;

        public IUGUIPackLoad UGUIPackLoadl
        {
            get { return _UGUIPackLoadl; }
        }

        private IUGUIPackLoad _UGUIPackLoadl;

        public void SetIUGUIPackLoad(IUGUIPackLoad uguiPackLoad)
        {
            _UGUIPackLoadl = uguiPackLoad;
        }
        public SpriteAtlas GetSpriteAtlas(string name)
        {
            if (_UGUIPackLoadl == null)
            {
                return null;
            }

            return _UGUIPackLoadl.GetSpriteAtlas(name);
        }

        public void Dispose()
        {
            _UGUIPackLoadl?.Dispose();
            _UGUIPackLoadl = null;
        }
    }
}