mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-07 00:39:00 +08:00
- 新增面向静态游戏内容的 AI-First 配表方案介绍 - 详细说明 YAML 作为配置源文件和 JSON Schema 结构描述功能 - 提供推荐目录结构和 Schema 示例配置 - 添加 VS Code 插件工具支持说明 - 包含 Godot 文本配置桥接使用指南 - 提供运行时读取和热重载模板示例 - 说明生成器接入约定和运行时校验行为 - 添加开发期热重载和工具支持详细说明 - 创建 Godot 测试项目配置文件 - 实现 GodotYamlConfigLoader 配置加载适配层
57 lines
1.9 KiB
C#
57 lines
1.9 KiB
C#
namespace GFramework.Godot.Config;
|
|
|
|
/// <summary>
|
|
/// 描述一个 Godot YAML 配置表在资源目录中的来源信息。
|
|
/// </summary>
|
|
public sealed class GodotYamlConfigTableSource
|
|
{
|
|
/// <summary>
|
|
/// 初始化一个配置表来源描述。
|
|
/// </summary>
|
|
/// <param name="tableName">运行时表名称。</param>
|
|
/// <param name="configRelativePath">相对配置根目录的 YAML 目录。</param>
|
|
/// <param name="schemaRelativePath">相对配置根目录的 schema 文件路径;未启用 schema 时为空。</param>
|
|
public GodotYamlConfigTableSource(
|
|
string tableName,
|
|
string configRelativePath,
|
|
string? schemaRelativePath = null)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(tableName))
|
|
{
|
|
throw new ArgumentException("Table name cannot be null or whitespace.", nameof(tableName));
|
|
}
|
|
|
|
if (string.IsNullOrWhiteSpace(configRelativePath))
|
|
{
|
|
throw new ArgumentException("Config relative path cannot be null or whitespace.",
|
|
nameof(configRelativePath));
|
|
}
|
|
|
|
if (schemaRelativePath != null && string.IsNullOrWhiteSpace(schemaRelativePath))
|
|
{
|
|
throw new ArgumentException(
|
|
"Schema relative path cannot be empty or whitespace when provided.",
|
|
nameof(schemaRelativePath));
|
|
}
|
|
|
|
TableName = tableName;
|
|
ConfigRelativePath = configRelativePath;
|
|
SchemaRelativePath = schemaRelativePath;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取运行时表名称。
|
|
/// </summary>
|
|
public string TableName { get; }
|
|
|
|
/// <summary>
|
|
/// 获取相对配置根目录的 YAML 目录路径。
|
|
/// </summary>
|
|
public string ConfigRelativePath { get; }
|
|
|
|
/// <summary>
|
|
/// 获取相对配置根目录的 schema 文件路径;未启用 schema 校验时为空。
|
|
/// </summary>
|
|
public string? SchemaRelativePath { get; }
|
|
}
|