From b67c922b09ba2ee8584f77a6c91fafe6b9f02cb6 Mon Sep 17 00:00:00 2001 From: GwWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Thu, 18 Dec 2025 19:40:54 +0800 Subject: [PATCH] =?UTF-8?q?feat(core):=20=E5=BC=95=E5=85=A5=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E6=A0=87=E8=AF=86=E7=AC=A6=E6=8E=A5=E5=8F=A3=E5=92=8C?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E6=98=A0=E5=B0=84=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 IAssetId 接口定义资源路径访问方式 - 新增 AssetCatalogMapping 结构体用于资源目录键值对映射 - 修改 SceneId 和 ResourceId 结构体实现 IAssetId 接口 - 增强资源管理系统的类型安全性和扩展性 --- GFramework.Core.Godot/system/AssetCatalog.cs | 23 ++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/GFramework.Core.Godot/system/AssetCatalog.cs b/GFramework.Core.Godot/system/AssetCatalog.cs index 19020e9..2d6d32b 100644 --- a/GFramework.Core.Godot/system/AssetCatalog.cs +++ b/GFramework.Core.Godot/system/AssetCatalog.cs @@ -6,15 +6,34 @@ namespace GFramework.Core.Godot.system; /// public static class AssetCatalog { + /// + /// 资源标识符接口,定义了资源路径的访问接口 + /// + public interface IAssetId + { + /// + /// 获取资源的路径 + /// + string Path { get; } + } + + /// + /// 资源目录映射结构体,用于存储资源目录的键值对映射关系 + /// + /// 资源目录的键 + /// 资源标识符 + public readonly record struct AssetCatalogMapping(string Key, IAssetId Id); + /// /// 场景标识符结构体,用于唯一标识一个场景资源 /// /// 场景资源的路径 - public readonly record struct SceneId(string Path); + public readonly record struct SceneId(string Path) : IAssetId; /// /// 资源标识符结构体,用于唯一标识一个游戏资源 /// /// 游戏资源的路径 - public readonly record struct ResourceId(string Path); + public readonly record struct ResourceId(string Path) : IAssetId; + }