fix(D.5.1): toolbar movable + chrome-grab + peace-only indicator + no prototype square

D1 — Toolbar not movable: toolbarRoot.Anchors = AnchorEdges.None (was Left|Top)
so ApplyAnchor early-returns and doesn't re-pin the window every frame.
Matches the vitalsRoot idiom exactly.

D2 — Cannot grab toolbar by chrome: toolbarRoot.ClickThrough = false
so HitTest succeeds over the UiDatElement chrome and the drag starts.
UiDatElement ctor defaults ClickThrough=true; vitalsRoot already overrides it.

C1 — All four combat-mode indicators visible at once (war/flame stacked on
peace): ports gmToolbarUI::RecvNotice_SetCombatMode
(acclient_2013_pseudo_c.txt:196632-196669). CombatIndicatorIds[] maps
index 0-3 to NonCombat/Melee/Missile/Magic; SetCombatMode shows exactly one
and hides the other three. Default to NonCombat at bind (player always
spawns in peace). Wires CombatState.CombatModeChanged for live updates.
Tests: CombatIndicator_defaultNonCombat_onlyPeaceVisible,
CombatIndicator_setCombatModeMelee_onlyMeleeVisible,
CombatIndicator_liveSignal_updatesWhenCombatStateChanges.

V1 — Blue empty-slot square at top-left (prototype 0x100001B2 materialized):
ImportInfos now skips top-level elements that are (a) referenced as a
BaseElement by another element in the same layout AND (b) have no own state
media. The CollectBaseRefsInDesc walk covers nested children; HasNoOwnMedia
re-uses ToInfo's media extraction. The Resolve path reads BaseElement from the
raw dat via dats.Get<LayoutDesc> — it never depends on the prototype being in
the built widget tree — so the skip is safe. Conformance tests (vitals, chat)
are unaffected (they exercise Build, not ImportInfos).
Test: BuildFromInfos_PrototypeSkipped_DerivedPresent_PrototypeAbsent.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-06-17 13:03:07 +02:00
parent b3e5e8b0f7
commit bfc452d610
5 changed files with 262 additions and 11 deletions

View file

@ -1921,11 +1921,17 @@ public sealed class GameWindow : IDisposable
toolbarLayout, Items,
() => Shortcuts,
iconIds: (icon, under, over) => iconComposer.GetIcon(icon, under, over),
useItem: guid => UseItemByGuid(guid));
useItem: guid => UseItemByGuid(guid),
combatState: Combat);
var toolbarRoot = toolbarLayout.Root;
toolbarRoot.Left = 10; toolbarRoot.Top = 300;
toolbarRoot.Anchors = AcDream.App.UI.AnchorEdges.Left | AcDream.App.UI.AnchorEdges.Top;
// D1: Anchors=None so ApplyAnchor skips re-pinning every frame and
// the drag position is preserved (matches vitalsRoot pattern).
toolbarRoot.Anchors = AcDream.App.UI.AnchorEdges.None;
// D2: UiDatElement ctor defaults ClickThrough=true; override so the
// chrome is hittable and the drag can start (matches vitalsRoot pattern).
toolbarRoot.ClickThrough = false;
toolbarRoot.Draggable = true;
_uiHost.Root.AddChild(toolbarRoot);
Console.WriteLine("[D.5.1] retail toolbar window from LayoutDesc importer (0x21000016).");