GeWuYou 2b30e859e9 docs(config): 添加游戏内容配置系统文档和集成测试
- 新增游戏内容配置系统完整文档,包含 YAML 配置、JSON Schema 结构描述
- 添加推荐目录结构和配置示例,支持怪物、物品、技能等静态内容管理
- 实现 Source Generator 自动生成配置类型、表包装和注册访问辅助功能
- 集成 VS Code 插件提供配置浏览、raw 编辑、schema 打开和校验功能
- 添加生成查询辅助,为顶层标量字段生成 FindBy* 与 TryFindFirstBy* 方法
- 实现开发期热重载功能,支持配置文件修改后自动刷新运行时表
- 添加跨表引用校验,支持 x-gframework-ref-table 声明的引用关系检查
- 新增集成测试验证生成器自动拾取 schema 并支持强类型访问入口
- 添加 IsExternalInit 类型支持低版本 .NET 框架的 init-only setter 功能
2026-04-06 11:42:34 +08:00

154 lines
6.2 KiB
Plaintext

// <auto-generated />
#nullable enable
namespace GFramework.Game.Config.Generated;
/// <summary>
/// Auto-generated table wrapper for schema file 'monster.schema.json'.
/// The wrapper keeps generated call sites strongly typed while delegating actual storage to the runtime config table implementation.
/// </summary>
public sealed partial class MonsterTable : global::GFramework.Game.Abstractions.Config.IConfigTable<int, MonsterConfig>
{
private readonly global::GFramework.Game.Abstractions.Config.IConfigTable<int, MonsterConfig> _inner;
/// <summary>
/// Creates a generated table wrapper around the runtime config table instance.
/// </summary>
/// <param name="inner">The runtime config table instance.</param>
public MonsterTable(global::GFramework.Game.Abstractions.Config.IConfigTable<int, MonsterConfig> inner)
{
_inner = inner ?? throw new global::System.ArgumentNullException(nameof(inner));
}
/// <inheritdoc />
public global::System.Type KeyType => _inner.KeyType;
/// <inheritdoc />
public global::System.Type ValueType => _inner.ValueType;
/// <inheritdoc />
public int Count => _inner.Count;
/// <inheritdoc />
public MonsterConfig Get(int key)
{
return _inner.Get(key);
}
/// <inheritdoc />
public bool TryGet(int key, out MonsterConfig? value)
{
return _inner.TryGet(key, out value);
}
/// <inheritdoc />
public bool ContainsKey(int key)
{
return _inner.ContainsKey(key);
}
/// <inheritdoc />
public global::System.Collections.Generic.IReadOnlyCollection<MonsterConfig> All()
{
return _inner.All();
}
/// <summary>
/// Finds all config entries whose property 'name' equals the supplied value.
/// </summary>
/// <param name="value">The property value to match.</param>
/// <returns>A read-only snapshot containing every matching config entry.</returns>
/// <remarks>
/// The generated helper performs a deterministic linear scan over <see cref="All"/> so it stays compatible with runtime hot reload and does not require secondary index infrastructure.
/// </remarks>
public global::System.Collections.Generic.IReadOnlyList<MonsterConfig> FindByName(string value)
{
var matches = new global::System.Collections.Generic.List<MonsterConfig>();
// Scan the current table snapshot on demand so generated helpers stay aligned with reloadable runtime data.
foreach (var candidate in All())
{
if (global::System.Collections.Generic.EqualityComparer<string>.Default.Equals(candidate.Name, value))
{
matches.Add(candidate);
}
}
return matches.Count == 0 ? global::System.Array.Empty<MonsterConfig>() : matches.AsReadOnly();
}
/// <summary>
/// Tries to find the first config entry whose property 'name' equals the supplied value.
/// </summary>
/// <param name="value">The property value to match.</param>
/// <param name="result">The first matching config entry when lookup succeeds; otherwise <see langword="null" />.</param>
/// <returns><see langword="true" /> when a matching config entry is found; otherwise <see langword="false" />.</returns>
/// <remarks>
/// The generated helper walks the same snapshot exposed by <see cref="All"/> and returns the first match in iteration order.
/// </remarks>
public bool TryFindFirstByName(string value, out MonsterConfig? result)
{
// Keep the search path allocation-free for the first-match case by exiting as soon as one entry matches.
foreach (var candidate in All())
{
if (global::System.Collections.Generic.EqualityComparer<string>.Default.Equals(candidate.Name, value))
{
result = candidate;
return true;
}
}
result = null;
return false;
}
/// <summary>
/// Finds all config entries whose property 'hp' equals the supplied value.
/// </summary>
/// <param name="value">The property value to match.</param>
/// <returns>A read-only snapshot containing every matching config entry.</returns>
/// <remarks>
/// The generated helper performs a deterministic linear scan over <see cref="All"/> so it stays compatible with runtime hot reload and does not require secondary index infrastructure.
/// </remarks>
public global::System.Collections.Generic.IReadOnlyList<MonsterConfig> FindByHp(int? value)
{
var matches = new global::System.Collections.Generic.List<MonsterConfig>();
// Scan the current table snapshot on demand so generated helpers stay aligned with reloadable runtime data.
foreach (var candidate in All())
{
if (global::System.Collections.Generic.EqualityComparer<int?>.Default.Equals(candidate.Hp, value))
{
matches.Add(candidate);
}
}
return matches.Count == 0 ? global::System.Array.Empty<MonsterConfig>() : matches.AsReadOnly();
}
/// <summary>
/// Tries to find the first config entry whose property 'hp' equals the supplied value.
/// </summary>
/// <param name="value">The property value to match.</param>
/// <param name="result">The first matching config entry when lookup succeeds; otherwise <see langword="null" />.</param>
/// <returns><see langword="true" /> when a matching config entry is found; otherwise <see langword="false" />.</returns>
/// <remarks>
/// The generated helper walks the same snapshot exposed by <see cref="All"/> and returns the first match in iteration order.
/// </remarks>
public bool TryFindFirstByHp(int? value, out MonsterConfig? result)
{
// Keep the search path allocation-free for the first-match case by exiting as soon as one entry matches.
foreach (var candidate in All())
{
if (global::System.Collections.Generic.EqualityComparer<int?>.Default.Equals(candidate.Hp, value))
{
result = candidate;
return true;
}
}
result = null;
return false;
}
}