mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-23 03:04:29 +08:00
- 统一调整代码注释的缩进格式,保持文档注释的一致性 - 简化对象初始化语法,移除不必要的参数名称指定 - 优化条件语句结构,移除多余的花括号 - 调整方法实现格式,使用表达式主体语法简化代码 - 标准化代码缩进和空格使用,提升代码可读性 - [skip ci]
46 lines
1.1 KiB
C#
46 lines
1.1 KiB
C#
using GFramework.Core.Abstractions.architecture;
|
|
using GFramework.Core.Abstractions.enums;
|
|
using GFramework.Core.Abstractions.system;
|
|
|
|
namespace GFramework.Core.Tests.system;
|
|
|
|
/// <summary>
|
|
/// 异步测试系统,实现 ISystem 和 IAsyncInitializable
|
|
/// </summary>
|
|
public sealed class AsyncTestSystem : ISystem, IAsyncInitializable
|
|
{
|
|
private IArchitectureContext _context = null!;
|
|
public bool Initialized { get; private set; }
|
|
public bool DestroyCalled { get; private set; }
|
|
|
|
public async Task InitializeAsync()
|
|
{
|
|
await Task.Delay(10);
|
|
Initialized = true;
|
|
}
|
|
|
|
public void SetContext(IArchitectureContext context)
|
|
{
|
|
_context = context;
|
|
}
|
|
|
|
public IArchitectureContext GetContext()
|
|
{
|
|
return _context;
|
|
}
|
|
|
|
public void Init()
|
|
{
|
|
// 同步 Init 不应该被调用
|
|
throw new InvalidOperationException("Sync Init should not be called");
|
|
}
|
|
|
|
public void Destroy()
|
|
{
|
|
DestroyCalled = true;
|
|
}
|
|
|
|
public void OnArchitecturePhase(ArchitecturePhase phase)
|
|
{
|
|
}
|
|
} |