fix(ui): keep spell components in authored foreground

Install examination formula icons as the template root UIRegion image, matching retail ClearImage/SetImage behavior while retaining the authored missing-component overlay. Add the real DAT template fixture and conformance coverage.

Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-24 08:08:29 +02:00
parent d4ce64f56b
commit 2c3da8e153
14 changed files with 231 additions and 34 deletions

View file

@ -5,8 +5,8 @@ namespace AcDream.App.UI.Layout;
/// <summary>
/// Instantiates the authored formula-icon template used by retail
/// <c>SpellExamineUI::ExamineSpell @ 0x004B6210</c>. The controller replaces
/// the template root's placeholder image with the resolved component icon while
/// <c>SpellExamineUI::ExamineSpell @ 0x004B6210</c>. The controller installs
/// the component icon as the template root's own <c>UIRegion</c> image while
/// retaining child <c>0x10000330</c> as the missing-component overlay.
/// </summary>
public sealed class SpellExamineComponentTemplateFactory
@ -62,20 +62,13 @@ public sealed class SpellExamineComponentTemplateFactory
did => _fonts.TryGetValue(did, out UiDatFont? font)
? font
: _defaultFont);
UiElement root = content.Root;
if (root is UiDatElement datRoot)
datRoot.MediaVisible = false;
var icon = new UiTextureElement
if (content.Root is not UiDatElement root)
{
Width = root.Width,
Height = root.Height,
Anchors = AnchorEdges.Left | AnchorEdges.Top
| AnchorEdges.Right | AnchorEdges.Bottom,
Texture = iconTexture,
ZOrder = int.MinValue / 2,
};
root.AddChild(icon);
throw new InvalidOperationException(
$"Retail spell-component template 0x{TemplateId:X8} "
+ "must resolve to a UIRegion-compatible element.");
}
root.RuntimeImageTexture = iconTexture;
if (content.FindElement(MissingOverlayId) is { } missing)
missing.Visible = !owned;