feat(D.2b): importer renders Type-12-with-sprites + carries DefaultState
Task G1: two gaps blocked chat window static sprite elements from rendering. Change 1 — DatWidgetFactory: only skip Type-12 elements that have no own state media (pure style prototypes). A Type-12 element that carries sprites (e.g. a chat Send button whose derived Type-0 element inherited Type 12 from its base prototype) now renders as a UiDatElement. Change 2 — ElementInfo: add DefaultStateName field (string, default ""). Change 3 — LayoutImporter.ToInfo: read ElementDesc.DefaultState.ToString() into DefaultStateName; normalize Undef/Undefined/0 sentinels to "". Change 4 — ElementReader.Merge: inherit DefaultStateName (derived wins if non-empty, else base). Change 5 — UiDatElement ctor: initialize ActiveState to DefaultStateName when set; else "Normal" when a Normal-state sprite is present (retail's implicit default for buttons/tabs); else "" (DirectState). This makes the Send button, max/min button, and numbered tabs render their default sprite without requiring explicit state assignment at runtime. Vitals neutrality: all vitals chrome/grip elements carry DirectState-only sprites with no "Normal" named state and DefaultStateName="" (Undef in dat), so their ActiveState stays "" and their existing conformance tests are unaffected. Vitals text labels (Type 0→12 via Merge, no StateMedia) are still skipped by the refined Type-12 guard (StateMedia.Count==0). Tests: 4 new tests (2 in DatWidgetFactoryTests, 3 in UiDatElementTests). All 386 pass; 387 total (1 pre-existing skip). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
c2170ab18f
commit
6e6339b026
6 changed files with 126 additions and 19 deletions
|
|
@ -71,6 +71,32 @@ public class DatWidgetFactoryTests
|
|||
Assert.Equal(7, e!.ZOrder);
|
||||
}
|
||||
|
||||
// ── Test G1a: Type 12 with own sprites renders; without sprites is skipped ──
|
||||
|
||||
/// <summary>
|
||||
/// Task G1 change 1: only PURE Type-12 prototypes (no state media) are skipped.
|
||||
/// A Type-12 element that carries its own state media must return a non-null widget.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void DatWidgetFactory_Type12WithMedia_Renders()
|
||||
{
|
||||
// Type 12 with a "Normal" state sprite — must render (NOT skipped).
|
||||
var withMedia = new ElementInfo
|
||||
{
|
||||
Type = 12,
|
||||
Width = 32,
|
||||
Height = 16,
|
||||
StateMedia = { ["Normal"] = (0x00001234u, 1) },
|
||||
};
|
||||
var e = DatWidgetFactory.Create(withMedia, NoTex, null);
|
||||
Assert.NotNull(e);
|
||||
Assert.IsType<UiDatElement>(e);
|
||||
|
||||
// Type 12 with NO state media — must still be skipped (pure prototype).
|
||||
var noMedia = new ElementInfo { Type = 12 };
|
||||
Assert.Null(DatWidgetFactory.Create(noMedia, NoTex, null));
|
||||
}
|
||||
|
||||
// ── Test 6: Meter slice extraction (the important one) ───────────────────
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue