namespace XGame.Framework.Asset
{
    internal abstract class BaseLoader : System.IDisposable
    {
        private static AssetAsyncPool asyncPool;
        protected AssetAsyncPool AsyncPool
        {
            get
            {
                if (asyncPool == null)
                {
                    asyncPool = new AssetAsyncPool()
                    {
                        AgentLimit = 10
                    };
                }
                return asyncPool;
            }
        }

        void System.IDisposable.Dispose()
        {
            OnDispose();
            asyncPool?.Dispose();
            //assetCtrl?.Dispose();
            asyncPool = null;
            //assetCtrl = null;
        }

        protected abstract void OnDispose();
    }
}
