fix(ui): restore retail spell tabs and spellbook

Bind the spellbook and component-book tabs as their authored stateful text controls, propagate Closed/Open state into the retained DAT child tree, and keep authored label colors live across state changes.

Match retail UIElement_Text zero-margin construction so the Magic favorite captions I through VIII are no longer clipped. Add a real portal.dat spellbook fixture plus controller, state-propagation, and text-layout regression coverage.

Co-Authored-By: Codex <noreply@openai.com>
This commit is contained in:
Erik 2026-07-15 15:54:11 +02:00
parent 07be994d97
commit ad30c37a48
15 changed files with 13492 additions and 38 deletions

View file

@ -21,6 +21,7 @@ public sealed class RetailLayoutFixtureGenerator
(0x21000023u, "inventory_21000023.json"),
(0x21000024u, "paperdoll_21000024.json"),
(0x2100002Eu, "character_2100002E.json"),
(SpellbookWindowController.LayoutId, "spellbook_21000034.json"),
(0x2100006Cu, "vitals_2100006C.json"),
(EffectsIndicatorController.LayoutId, "indicators_21000071.json"),
(0x21000072u, "powerbar_21000072.json"),
@ -116,6 +117,21 @@ public sealed class RetailLayoutFixtureGenerator
Assert.Equal("High", labels.High);
Assert.Equal("Medium", labels.Medium);
Assert.Equal("Low", labels.Low);
var strings = new DatStringResolver(dats);
uint[] tabIds =
{
0x100000A3u, 0x100000A4u, 0x100000A5u, 0x100000A6u,
0x100000A7u, 0x100000A8u, 0x100000A9u, 0x100005C2u,
};
string[] expected = ["I", "II", "III", "IV", "V", "VI", "VII", "VIII"];
for (int i = 0; i < tabIds.Length; i++)
{
uint id = tabIds[i];
ElementInfo tab = FindInfo(info, id)!;
Assert.NotNull(tab);
Assert.True(tab.TryGetEffectiveProperty(0x17u, out UiPropertyValue label));
Assert.Equal(expected[i], strings.Resolve(label.StringInfoValue));
}
}
var json = JsonSerializer.Serialize(info, new JsonSerializerOptions
{
@ -129,4 +145,12 @@ public sealed class RetailLayoutFixtureGenerator
private static string FixtureDirectory([CallerFilePath] string thisFile = "")
=> Path.Combine(Path.GetDirectoryName(thisFile)!, "fixtures");
private static ElementInfo? FindInfo(ElementInfo root, uint id)
{
if (root.Id == id) return root;
foreach (ElementInfo child in root.Children)
if (FindInfo(child, id) is { } match) return match;
return null;
}
}