mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 10:34:30 +08:00
- 实现了完整的资源管理系统,包括资源加载、缓存和卸载功能 - 添加了 IResourceHandle、IResourceLoader、IResourceManager 和 IResourceReleaseStrategy 接口定义 - 实现了 AutoReleaseStrategy 和 ManualReleaseStrategy 两种资源释放策略 - 创建了 ResourceCache 缓存系统和 ResourceHandle 资源句柄管理 - 在 ConfigurationManager 和 CoroutineScheduler 中集成了 ILogger 日志功能 - 添加了全面的 ResourceManagerTests 单元测试覆盖各种使用场景
38 lines
877 B
C#
38 lines
877 B
C#
namespace GFramework.Core.Abstractions.resource;
|
|
|
|
/// <summary>
|
|
/// 资源句柄接口,用于管理资源的生命周期和引用
|
|
/// </summary>
|
|
/// <typeparam name="T">资源类型</typeparam>
|
|
public interface IResourceHandle<out T> : IDisposable where T : class
|
|
{
|
|
/// <summary>
|
|
/// 获取资源实例
|
|
/// </summary>
|
|
T? Resource { get; }
|
|
|
|
/// <summary>
|
|
/// 获取资源路径
|
|
/// </summary>
|
|
string Path { get; }
|
|
|
|
/// <summary>
|
|
/// 获取资源是否有效(未被释放)
|
|
/// </summary>
|
|
bool IsValid { get; }
|
|
|
|
/// <summary>
|
|
/// 获取当前引用计数
|
|
/// </summary>
|
|
int ReferenceCount { get; }
|
|
|
|
/// <summary>
|
|
/// 增加引用计数
|
|
/// </summary>
|
|
void AddReference();
|
|
|
|
/// <summary>
|
|
/// 减少引用计数
|
|
/// </summary>
|
|
void RemoveReference();
|
|
} |