mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-23 19:24:29 +08:00
- 修改模块安装日志格式,添加.Module后缀 - 重命名_mInited字段为_mInitialized以提高语义清晰度 - 将EnterPhase方法设为protected virtual以支持继承扩展 - 将阶段变更通知的日志级别从Debug调整为Trace - 为NotifyPhase方法添加生命周期钩子的日志记录 - 实现同步和异步初始化方法(Initialize和InitializeAsync) - 创建InitializeComponentAsync方法统一处理组件初始化逻辑 - 重构InitializeInternalAsync方法实现完整的异步初始化流程 - 重命名测试架构类TestArchitecture为SyncTestArchitecture - 添加异步测试模型AsyncTestModel用于验证异步初始化功能 - 添加失败模型FailingModel用于测试异常处理机制 - 重命名系统测试类的初始化和销毁状态属性 - 创建新的同步架构测试类SyncArchitectureTests替代原有测试 - 删除已过时的ArchitectureInitializationTests测试类
30 lines
873 B
C#
30 lines
873 B
C#
using GFramework.Core.Abstractions.enums;
|
|
using GFramework.Core.architecture;
|
|
using GFramework.Core.events;
|
|
using GFramework.Core.Tests.model;
|
|
using GFramework.Core.Tests.system;
|
|
|
|
namespace GFramework.Core.Tests.architecture;
|
|
|
|
public sealed class SyncTestArchitecture : Architecture
|
|
{
|
|
public bool ReadyEventFired { get; private set; }
|
|
public bool InitCalled { get; private set; }
|
|
|
|
public List<ArchitecturePhase> PhaseHistory { get; } = new();
|
|
|
|
protected override void Init()
|
|
{
|
|
InitCalled = true;
|
|
|
|
RegisterModel(new TestModel());
|
|
RegisterSystem(new TestSystem());
|
|
Context.RegisterEvent<ArchitectureEvents.ArchitectureLifecycleReadyEvent>(_ => { ReadyEventFired = true; });
|
|
}
|
|
|
|
protected override void EnterPhase(ArchitecturePhase next)
|
|
{
|
|
base.EnterPhase(next);
|
|
PhaseHistory.Add(next);
|
|
}
|
|
} |