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
566 B
C#
19 lines
566 B
C#
using GFramework.Core.Abstractions.resource;
|
||
|
||
namespace GFramework.Core.resource;
|
||
|
||
/// <summary>
|
||
/// 手动释放策略
|
||
/// 引用计数降为 0 时不自动卸载资源,需要手动调用 Unload
|
||
/// </summary>
|
||
public class ManualReleaseStrategy : IResourceReleaseStrategy
|
||
{
|
||
/// <summary>
|
||
/// 判断是否应该释放资源(始终返回 false)
|
||
/// </summary>
|
||
public bool ShouldRelease(string path, int refCount)
|
||
{
|
||
// 手动释放策略:永远不自动释放,由用户显式调用 Unload
|
||
return false;
|
||
}
|
||
} |