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:
parent
d4ce64f56b
commit
2c3da8e153
14 changed files with 231 additions and 34 deletions
|
|
@ -165,8 +165,37 @@ public sealed class UiDatElement : UiElement, IUiDatStateful
|
|||
/// </summary>
|
||||
public bool MediaVisible { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Runtime image installed on this region in place of its authored state media.
|
||||
/// A non-null value mirrors retail <c>UIRegion::ClearImage</c> followed by
|
||||
/// <c>UIRegion::SetImage</c>; zero deliberately leaves the region image-less.
|
||||
/// The image remains this element's own media, so authored descendants retain
|
||||
/// their normal foreground relationship.
|
||||
/// </summary>
|
||||
public uint? RuntimeImageTexture { get; set; }
|
||||
|
||||
protected override void OnDraw(UiRenderContext ctx)
|
||||
{
|
||||
if (MediaVisible && RuntimeImageTexture is uint runtimeTexture)
|
||||
{
|
||||
if (runtimeTexture != 0u)
|
||||
{
|
||||
ctx.DrawSprite(
|
||||
runtimeTexture,
|
||||
0f,
|
||||
0f,
|
||||
Width,
|
||||
Height,
|
||||
0f,
|
||||
0f,
|
||||
1f,
|
||||
1f,
|
||||
Vector4.One);
|
||||
}
|
||||
DrawLabel(ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
var (file, _) = ActiveMedia();
|
||||
if (MediaVisible && file != 0)
|
||||
{
|
||||
|
|
@ -180,6 +209,11 @@ public sealed class UiDatElement : UiElement, IUiDatStateful
|
|||
}
|
||||
}
|
||||
|
||||
DrawLabel(ctx);
|
||||
}
|
||||
|
||||
private void DrawLabel(UiRenderContext ctx)
|
||||
{
|
||||
// Centered text label over the sprite (retail draws button captions as text;
|
||||
// their dat sprites are blank frames).
|
||||
if (Label is { Length: > 0 } label && LabelFont is { } lf)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue