mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 19:03:29 +08:00
- 为 AbstractContextUtility 类添加日志记录器文档注释 - 为 Architecture 类的 IsReady 属性和待初始化组件集合添加详细说明 - 修改 GitHub Actions workflow 使用 autobuild 模式替代手动构建 - 为 CoroutineScheduler 的 IsCoroutineAlive 方法添加完整文档注释 - 为 EnvironmentBase 类的 Initialize 方法和 Register 方法完善参数说明 - 为 IocContainer 的 OnContextReady 方法添加初始化日志记录器说明 - 为 WaitForEvent 协程指令类添加全面的 XML 文档注释和异常说明
58 lines
1.6 KiB
C#
58 lines
1.6 KiB
C#
using GFramework.Core.Abstractions.logging;
|
|
using GFramework.Core.Abstractions.utility;
|
|
using GFramework.Core.logging;
|
|
using GFramework.Core.rule;
|
|
|
|
namespace GFramework.Core.utility;
|
|
|
|
/// <summary>
|
|
/// 抽象上下文工具类,提供上下文相关的通用功能实现
|
|
/// 继承自ContextAwareBase并实现IContextUtility接口
|
|
/// </summary>
|
|
public abstract class AbstractContextUtility : ContextAwareBase, IContextUtility
|
|
{
|
|
/// <summary>
|
|
/// 日志记录器
|
|
/// </summary>
|
|
protected ILogger Logger = null !;
|
|
|
|
/// <summary>
|
|
/// 初始化上下文工具类
|
|
/// </summary>
|
|
public void Init()
|
|
{
|
|
var name = GetType().Name;
|
|
// 获取上下文中的日志记录器
|
|
Logger = LoggerFactoryResolver.Provider.CreateLogger(name);
|
|
Logger.Debug($"Initializing Context Utility: {name}");
|
|
|
|
// 执行子类实现的初始化逻辑
|
|
OnInit();
|
|
|
|
// 记录初始化完成信息
|
|
Logger.Info($"Context Utility initialized: {name}");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 销毁上下文工具类实例
|
|
/// </summary>
|
|
public void Destroy()
|
|
{
|
|
var name = GetType().Name;
|
|
Logger.Debug($"Destroying Context Utility: {name}");
|
|
OnDestroy();
|
|
Logger.Info($"Context Utility destroyed: {name}");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 抽象初始化方法,由子类实现具体的初始化逻辑
|
|
/// </summary>
|
|
protected abstract void OnInit();
|
|
|
|
/// <summary>
|
|
/// 虚拟销毁方法,可由子类重写以实现自定义销毁逻辑
|
|
/// </summary>
|
|
protected virtual void OnDestroy()
|
|
{
|
|
}
|
|
} |