From 925b6ce2d2ec3b50a6769e98c65e63a7ae30836b Mon Sep 17 00:00:00 2001
From: GeWuYou <95328647+GeWuYou@users.noreply.github.com>
Date: Sun, 12 Apr 2026 14:09:53 +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=BA=8F=E5=88=97=E5=8C=96=E6=94=AF=E6=8C=81=E5=B9=B6?=
=?UTF-8?q?=E5=AE=8C=E5=96=84=E6=B5=8B=E8=AF=95=E4=BE=9D=E8=B5=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 集成YamlDotNet库实现YAML配置文件的序列化功能
- 在配置消费者集成测试中添加抽象配置接口引用
- 在YAML配置验证测试中添加抽象配置接口引用
- 统一配置模块的依赖注入和接口抽象层次
---
.../Config/GeneratedConfigConsumerIntegrationTests.cs | 5 +++--
GFramework.Game.Tests/Config/YamlConfigTextValidatorTests.cs | 5 +++--
GFramework.Game/Config/YamlConfigTextSerializer.cs | 3 +++
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/GFramework.Game.Tests/Config/GeneratedConfigConsumerIntegrationTests.cs b/GFramework.Game.Tests/Config/GeneratedConfigConsumerIntegrationTests.cs
index 9422aa75..4cdac7da 100644
--- a/GFramework.Game.Tests/Config/GeneratedConfigConsumerIntegrationTests.cs
+++ b/GFramework.Game.Tests/Config/GeneratedConfigConsumerIntegrationTests.cs
@@ -1,4 +1,5 @@
using System.IO;
+using GFramework.Game.Abstractions.Config;
using GFramework.Game.Config;
using GFramework.Game.Config.Generated;
@@ -11,8 +12,6 @@ namespace GFramework.Game.Tests.Config;
[TestFixture]
public class GeneratedConfigConsumerIntegrationTests
{
- private string _rootPath = null!;
-
///
/// 为每个端到端测试准备独立的配置根目录,避免编译期 schema 资产与运行时写入互相污染。
///
@@ -35,6 +34,8 @@ public class GeneratedConfigConsumerIntegrationTests
}
}
+ private string _rootPath = null!;
+
///
/// 验证生成器自动拾取消费者项目的 schema 后,
/// 可以用生成的聚合注册辅助完成加载,并通过强类型表包装访问运行时数据与查询辅助。
diff --git a/GFramework.Game.Tests/Config/YamlConfigTextValidatorTests.cs b/GFramework.Game.Tests/Config/YamlConfigTextValidatorTests.cs
index 02403d75..8c6eeb36 100644
--- a/GFramework.Game.Tests/Config/YamlConfigTextValidatorTests.cs
+++ b/GFramework.Game.Tests/Config/YamlConfigTextValidatorTests.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 sealed class YamlConfigTextValidatorTests
{
- private string _rootPath = null!;
-
///
/// 为每个测试准备独立临时目录。
///
@@ -33,6 +32,8 @@ public sealed class YamlConfigTextValidatorTests
}
}
+ private string _rootPath = null!;
+
///
/// 验证合法 YAML 文本会通过公开校验入口。
///
diff --git a/GFramework.Game/Config/YamlConfigTextSerializer.cs b/GFramework.Game/Config/YamlConfigTextSerializer.cs
index f8467220..12a26e31 100644
--- a/GFramework.Game/Config/YamlConfigTextSerializer.cs
+++ b/GFramework.Game/Config/YamlConfigTextSerializer.cs
@@ -1,3 +1,6 @@
+using YamlDotNet.Serialization;
+using YamlDotNet.Serialization.NamingConventions;
+
namespace GFramework.Game.Config;
///