mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-08 17:44:29 +08:00
- 实现 RichTextEffectBase 基类提供统一的标签命名和参数读取逻辑 - 添加 RichTextBlueEffect、RichTextGoldEffect、RichTextGreenEffect 和 RichTextRedEffect 颜色标记效果 - 添加 RichTextFadeInEffect、RichTextFlyInEffect、RichTextJitterEffect 和 RichTextSineEffect 动画效果 - 实现 DefaultRichTextEffectRegistry 默认效果注册表 - 创建 GfRichTextLabel 富文本标签宿主组件 - 添加 IRichTextEffectRegistry 效果注册表接口 - 实现 RichTextEffectEntry、RichTextEffectsController 和 RichTextProfile 配置管理类 - 添加 RichTextMarkup 语义化标签构建辅助方法 - 创建 RichTextMarkupTests 和 RichTextProfileTests 单元测试
38 lines
1.3 KiB
C#
38 lines
1.3 KiB
C#
namespace GFramework.Godot.Text;
|
|
|
|
/// <summary>
|
|
/// 描述一个富文本效果组合配置。
|
|
/// 该资源是组合式扩展的核心载体,用于声明宿主标签需要安装的效果集合。
|
|
/// </summary>
|
|
[GlobalClass]
|
|
public partial class RichTextProfile : Resource
|
|
{
|
|
/// <summary>
|
|
/// 获取或设置当前配置启用的效果条目集合。
|
|
/// </summary>
|
|
[Export]
|
|
public RichTextEffectEntry[] Effects { get; set; } = [];
|
|
|
|
/// <summary>
|
|
/// 创建包含全部内置效果的默认配置。
|
|
/// 该方法为第一阶段提供零配置可用的回退组合。
|
|
/// </summary>
|
|
/// <returns>包含全部内置效果键的默认配置。</returns>
|
|
public static RichTextProfile CreateBuiltInDefault()
|
|
{
|
|
var profile = new RichTextProfile();
|
|
profile.Effects =
|
|
[
|
|
new RichTextEffectEntry { Key = "green" },
|
|
new RichTextEffectEntry { Key = "red" },
|
|
new RichTextEffectEntry { Key = "gold" },
|
|
new RichTextEffectEntry { Key = "blue" },
|
|
new RichTextEffectEntry { Key = "fade_in" },
|
|
new RichTextEffectEntry { Key = "sine" },
|
|
new RichTextEffectEntry { Key = "jitter" },
|
|
new RichTextEffectEntry { Key = "fly_in" }
|
|
];
|
|
return profile;
|
|
}
|
|
}
|