
using XGame.Framework.Asyncs;

namespace XGame.Framework.Asset
{
    /// <summary>
    /// 从AssetBundleLoader缓存重新加载回来的Asset
    /// 该异步为伪异步，不需要进AsyncPool，而是直接使用Start()结束异步操作
    /// </summary>
    internal class AssetLoadFromCacheAsync : Async, IAssetAsync
    {
        public UnityEngine.Object Source { internal set; get; }
        //public string Path { internal set; get; }
        public string AddressableName { get; internal set; }
        public void Start()
        {
            Progress = 1f;
            Completed();
        }

        public object GetResult()
        {
            object result = Source;
            Clear();
            return result;
        }

        void Clear()
        {
            Source = null;
        }
    }
}

