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 单元测试覆盖各种使用场景
19 lines
492 B
C#
19 lines
492 B
C#
using GFramework.Core.Abstractions.resource;
|
|
|
|
namespace GFramework.Core.resource;
|
|
|
|
/// <summary>
|
|
/// 自动释放策略
|
|
/// 当资源引用计数降为 0 时自动卸载资源
|
|
/// </summary>
|
|
public class AutoReleaseStrategy : IResourceReleaseStrategy
|
|
{
|
|
/// <summary>
|
|
/// 判断是否应该释放资源
|
|
/// 当引用计数降为 0 时返回 true
|
|
/// </summary>
|
|
public bool ShouldRelease(string path, int refCount)
|
|
{
|
|
return refCount <= 0;
|
|
}
|
|
} |