GeWuYou 31045f305c refactor(core): 调整命名空间结构以优化模块组织
- 将 IRegistry 接口从 GFramework.Game.Abstractions.registry 移至 GFramework.Core.Abstractions.registries
- 移除 KeyValueRegistryBase 中对旧命名空间的引用
- 将 IsExternalInit 类从 System.Runtime.CompilerServices 移至 GFramework.Game.Abstractions.internals
- 更新 IGameSceneRegistry 对新注册表命名空间的引用
- 将音频和图形设置类移至 GFramework.Game.Abstractions.setting.data 子命名空间
- 将资产注册表接口更新为使用新的核心注册表命名空间
- 调整 Godot 模块中的音频总线映射命名空间至 data 子目录
- 更新 Godot 音频和图形设置类以引用正确的设置数据命名空间
2026-01-27 22:58:37 +08:00

38 lines
1.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using GFramework.Core.Abstractions.bases;
namespace GFramework.Core.Abstractions.registries;
/// <summary>
/// 表示一个通用的注册表接口用于根据键类型T获取值类型TR的对象
/// </summary>
/// <typeparam name="T">注册表中用作键的类型</typeparam>
/// <typeparam name="Tr">注册表中存储的值的类型</typeparam>
public interface IRegistry<in T, Tr>
{
/// <summary>
/// 根据指定的键获取对应的值
/// </summary>
/// <param name="key">用于查找值的键</param>
/// <returns>与指定键关联的值</returns>
Tr Get(T key);
/// <summary>
/// 检查注册表是否包含指定的键
/// </summary>
/// <param name="key">要检查的键</param>
/// <returns>如果注册表包含具有指定键的元素则为true否则为false</returns>
bool Contains(T key);
/// <summary>
/// 添加一个键值对到注册表中
/// </summary>
/// <param name="mapping">要添加的键值对映射对象</param>
IRegistry<T, Tr> Registry(IKeyValue<T, Tr> mapping);
/// <summary>
/// 添加一个键值对到注册表中
/// </summary>
/// <param name="key">要添加的键</param>
/// <param name="value">要添加的值</param>
IRegistry<T, Tr> Registry(T key, Tr value);
}