A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
diag: each modal card's classes and opacity under ?navlog (#1728) (#1759)
EllaSharakanskif5f857c137cb
diff --git a/changelog.d/1728-navlog-modal-state.md b/changelog.d/1728-navlog-modal-state.mdnew file mode 100644index 000000000..b412dce45--- /dev/null+++ b/changelog.d/1728-navlog-modal-state.md@@ -0,0 +1,8 @@+### Changed++- `?navlog` now also prints each modal card's own classes, resolved opacity, box and enabled state on a pointer down+ (#1728). Neither the capture dialog nor the decision card is an ancestor of the backdrop, so the pressed element's+ ancestor chain cannot show them: a press outside a card lands on the scrim, and the chain above the scrim says+ nothing about the card the scrim is protecting. A card held in `window-opening` stays in the layout and takes+ presses at `opacity: 0`, which is a modal the player cannot see; the class and the opacity together say whether+ that is what happened. Diagnostic only, behind the existing flag.diff --git a/unity/Assets/Scripts/UI/NavEventLog.cs b/unity/Assets/Scripts/UI/NavEventLog.csindex 9c39649f0..5bf77601a 100644--- a/unity/Assets/Scripts/UI/NavEventLog.cs+++ b/unity/Assets/Scripts/UI/NavEventLog.cs@@ -56,7 +56,29 @@ namespace Statecraft.Game.UIreturn string.Join(" < ", parts);}- void OnDown(PointerDownEvent e) => DiagLog.NavLine($"ui pointerdown id={e.pointerId} at ({e.position.x:0}, {e.position.y:0}) target={Name(e.target)} path={Path(e.target)}");+ /// <summary>The two modal cards' own state, when either is in the layout. Neither is an ancestor of the backdrop,+ /// so <see cref="Path"/> cannot show them: a press outside a card lands on the scrim, and the chain above the+ /// scrim says nothing about the card the scrim is protecting. What this adds is the card's classes and its+ /// resolved opacity. #1728 needs exactly that pair: a card left in `window-opening` is held at `opacity: 0` and+ /// `scale: 0.8` (Statecraft.uss, ".event-card.window-opening") while staying in the layout and taking presses, so+ /// the player is blocked by a modal they cannot see. `window-opening` with an opacity near 0 is that state;+ /// an opacity near 1 rules it out.</summary>+ string Modals()+ {+ var hud = root.Q("root") ?? root;+ var parts = new List<string>();+ foreach (var name in new[] { "capture-card", "event-card" })+ {+ var card = hud.Q(name);+ if (card == null || card.resolvedStyle.display == DisplayStyle.None) continue;+ var b = card.worldBound;+ parts.Add($"{name}{Classes(card)} opacity={card.resolvedStyle.opacity:0.00} "+ + $"box=({b.x:0}, {b.y:0}, {b.width:0}x{b.height:0}) enabled={card.enabledInHierarchy}");+ }+ return parts.Count == 0 ? "-" : string.Join(" | ", parts);+ }++ void OnDown(PointerDownEvent e) => DiagLog.NavLine($"ui pointerdown id={e.pointerId} at ({e.position.x:0}, {e.position.y:0}) target={Name(e.target)} path={Path(e.target)} modals={Modals()}");void OnUp(PointerUpEvent e) => DiagLog.NavLine($"ui pointerup id={e.pointerId} at ({e.position.x:0}, {e.position.y:0}) target={Name(e.target)}");void OnClick(ClickEvent e) => DiagLog.NavLine($"ui click count={e.clickCount} target={Name(e.target)}");void OnButtonUp(PointerUpEvent e) => DiagLog.NavLine($"button pointerup at ({e.position.x:0}, {e.position.y:0}) on={Name(e.currentTarget)} inside={((VisualElement)e.currentTarget).worldBound.Contains(e.position)}");