From 081a65f740b4c1496a220009e64d3f46c1da573b Mon Sep 17 00:00:00 2001
From: GeWuYou <95328647+GeWuYou@users.noreply.github.com>
Date: Fri, 3 Apr 2026 12:21:03 +0800
Subject: [PATCH] =?UTF-8?q?feat(config):=20=E6=B7=BB=E5=8A=A0YAML=E9=85=8D?=
=?UTF-8?q?=E7=BD=AE=E5=8A=A0=E8=BD=BD=E5=99=A8=E4=BE=9D=E8=B5=96=E6=B3=A8?=
=?UTF-8?q?=E5=85=A5=E6=94=AF=E6=8C=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 引入GFramework.Core.Abstractions.Events命名空间
- 添加YamlDotNet反序列化库依赖
- 注册YAML配置加载器到依赖注入容器
- 更新单元测试中的命名空间引用
- 实现YAML配置文件的解析功能
- 添加配置加载过程中的事件发布机制
---
GFramework.Game.Tests/Config/YamlConfigLoaderTests.cs | 5 +++--
GFramework.Game/Config/YamlConfigLoader.cs | 3 +++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/GFramework.Game.Tests/Config/YamlConfigLoaderTests.cs b/GFramework.Game.Tests/Config/YamlConfigLoaderTests.cs
index d5008f44..c5355096 100644
--- a/GFramework.Game.Tests/Config/YamlConfigLoaderTests.cs
+++ b/GFramework.Game.Tests/Config/YamlConfigLoaderTests.cs
@@ -1,4 +1,5 @@
using System.IO;
+using GFramework.Game.Abstractions.Config;
using GFramework.Game.Config;
namespace GFramework.Game.Tests.Config;
@@ -9,8 +10,6 @@ namespace GFramework.Game.Tests.Config;
[TestFixture]
public class YamlConfigLoaderTests
{
- private string _rootPath = null!;
-
///
/// 为每个测试创建独立临时目录,避免文件系统状态互相污染。
///
@@ -33,6 +32,8 @@ public class YamlConfigLoaderTests
}
}
+ private string _rootPath = null!;
+
///
/// 验证加载器能够扫描 YAML 文件并将结果写入注册表。
///
diff --git a/GFramework.Game/Config/YamlConfigLoader.cs b/GFramework.Game/Config/YamlConfigLoader.cs
index 3a46b7f3..df99f1a6 100644
--- a/GFramework.Game/Config/YamlConfigLoader.cs
+++ b/GFramework.Game/Config/YamlConfigLoader.cs
@@ -1,4 +1,7 @@
+using GFramework.Core.Abstractions.Events;
using GFramework.Game.Abstractions.Config;
+using YamlDotNet.Serialization;
+using YamlDotNet.Serialization.NamingConventions;
namespace GFramework.Game.Config;