mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 18:52:08 +08:00
- 更新所有GFramework.Core.Abstractions.System引用为GFramework.Core.Abstractions.Systems - 重命名GFramework.Core/System目录为GFramework.Core/Systems - 重命名GFramework.Core.Tests/System目录为GFramework.Core.Tests/Systems - 更新所有相关using语句和命名空间声明 - 修复测试文件中的命名空间引用 - 添加全局using引用GFramework.Core.Systems
47 lines
1.1 KiB
C#
47 lines
1.1 KiB
C#
using GFramework.Core.Abstractions.Architecture;
|
|
using GFramework.Core.Abstractions.Enums;
|
|
using GFramework.Core.Abstractions.Lifecycle;
|
|
using GFramework.Core.Abstractions.Systems;
|
|
|
|
namespace GFramework.Core.Tests.Systems;
|
|
|
|
/// <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 Initialize()
|
|
{
|
|
// 同步 OnInitialize 不应该被调用
|
|
throw new InvalidOperationException("Sync OnInitialize should not be called");
|
|
}
|
|
|
|
public void Destroy()
|
|
{
|
|
DestroyCalled = true;
|
|
}
|
|
|
|
public void OnArchitecturePhase(ArchitecturePhase phase)
|
|
{
|
|
}
|
|
} |