mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 10:34:30 +08:00
- 移除自动初始化器,改用显式注册方式 - 修改 UseArch 扩展方法支持可选配置参数 - 更新文档说明新的集成方式和配置选项 - 删除自动注册相关的测试代码 - 调整 README 中的使用示例和架构说明
31 lines
959 B
C#
31 lines
959 B
C#
using GFramework.Core.Abstractions.architecture;
|
|
|
|
namespace GFramework.Ecs.Arch.extensions;
|
|
|
|
/// <summary>
|
|
/// Arch ECS 扩展方法
|
|
/// </summary>
|
|
public static class ArchExtensions
|
|
{
|
|
/// <summary>
|
|
/// 添加 Arch ECS 支持到架构中
|
|
/// </summary>
|
|
/// <typeparam name="TArchitecture">架构类型</typeparam>
|
|
/// <param name="architecture">架构实例</param>
|
|
/// <param name="configure">可选的配置委托</param>
|
|
/// <returns>架构实例,支持链式调用</returns>
|
|
public static TArchitecture UseArch<TArchitecture>(
|
|
this TArchitecture architecture,
|
|
Action<ArchOptions>? configure = null)
|
|
where TArchitecture : IArchitecture
|
|
{
|
|
// 配置选项
|
|
var options = new ArchOptions();
|
|
configure?.Invoke(options);
|
|
|
|
// 注册模块
|
|
ArchitectureModuleRegistry.Register(() => new ArchEcsModule(enabled: true));
|
|
|
|
return architecture;
|
|
}
|
|
} |