namespace XGame.Framework.Asset
{
    /// <summary>
    /// 资源加载接口
    /// </summary>
    interface IAssetLoader/* : System.IDisposable*/
    {
        /// <summary>
        /// 同步加载
        /// </summary>
        /// <typeparam name="TResult">返回结果的泛型，只用于加载前的一些判断</typeparam>
        /// <param name="addressableName">可寻址的资源名</param>
        /// <returns>返回加载的object，因为TResult可能只是object的某个组件，有时无法真实表达具体的object</returns>
        object LoadSync<TResult>(string addressableName);

        /// <summary>
        /// 异步加载
        /// </summary>
        /// <typeparam name="TResult">返回结果的泛型，只用于加载前的一些判断</typeparam>
        /// <param name="addressableName"></param>
        /// <returns>返回加载的IAssetAsync，Async的GetResult返回object，因为TResult可能只是object的某个组件，有时无法真实表达具体的object</returns>
        IAssetAsync LoadAsync<TResult>(string addressableName);
        /// <summary>
        /// 卸载资源
        /// </summary>
        /// <param name="addressableName"></param>
        /// <param name="source"></param>
        void Unload(string addressableName, object source);
        /// <summary>
        /// 卸载所有没有使用的资源
        /// </summary>
        void UnloadUnusedAssets();

        /// <summary>
        /// 异步加载Scene的AssetBundle到内存
        /// </summary>
        /// <param name="sceneName"></param>
        IAssetAsync LoadSceneBundleAsync(string sceneName);
        /// <summary>
        /// 卸载Scene的AssetBundle
        /// </summary>
        /// <param name="sceneName"></param>
        void UnLoadSceneBundle(string sceneName);
    }
}