supervisor-simulator/scripts/Models/DefinitionSupport.cs
2026-01-11 23:57:24 +08:00

52 lines
1.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections.Generic;
namespace Models;
/// <summary>
/// 定义数据的通用结构i18n + 标识 + 标签)
/// 设计说明:
/// 1) LocalizedText 只保存 Key/Fallback不做翻译翻译交给服务层。
/// 2) DefinitionHeader 用组合而非继承,避免所有定义都挂在同一基类。
/// 3) Tags 统一用 string Id便于 Mod 增删与过滤。
/// 注意事项:
/// - 资源路径统一使用 res:// 且小写下划线。
/// - Id 建议使用 “namespace:name” 形式,例如 “core:discipline_biology”。
/// 未来扩展:
/// - 可加入 Icon/Color/SortOrder 以支持 UI 排序与分组。
/// - 可加入 Source/Version 字段用于 Mod 冲突排查。
/// </summary>
public sealed class LocalizedText
{
/// <summary>
/// 键值
/// </summary>
public string Key { get; set; }
/// <summary>
/// 默认值
/// </summary>
public string Fallback { get; set; }
}
public sealed class DefinitionHeader
{
/// <summary>
/// 定义ID
/// </summary>
public string Id { get; set; }
/// <summary>
/// 名称
/// </summary>
public LocalizedText Name { get; set; } = new();
/// <summary>
/// 描述
/// </summary>
public LocalizedText Description { get; set; } = new();
/// <summary>
/// 图标路径
/// </summary>
public string IconPath { get; set; }
/// <summary>
/// 标签列表
/// </summary>
public List<string> Tags { get; } = new();
}