A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
ui: second re-review fixes for the promo HUD
eyalgolan6b6240fee38f
diff --git a/unity/Assets/Scripts/UI/GameRoot.cs b/unity/Assets/Scripts/UI/GameRoot.csindex 9b1c3b2ad..a44f255ba 100644--- a/unity/Assets/Scripts/UI/GameRoot.cs+++ b/unity/Assets/Scripts/UI/GameRoot.cs@@ -131,8 +131,8 @@ namespace Statecraft.Game.UI// The toast first: the autosave (below) must report a failed write after the toast has shown the turn's refusals.var toast = Own(new ToastPresenter(root, bridge, text));Own(new HudPresenter(root, bridge, text));- Own(new ScreenNav(root));- Own(new PointerBlur(root)); // a mouse click leaves no focus fill behind (keyboard keeps it) // every screen starts hidden (USS); ScreenNav opens one at a time+ Own(new ScreenNav(root)); // every screen starts hidden (USS); ScreenNav opens one at a time+ Own(new PointerBlur(root)); // a mouse click leaves no focus fill behind (keyboard keeps it)if (DiagLog.Nav) Own(new NavEventLog(root)); // ?navlog: every UI pointer/submit event (playtest 2, P2-4)var card = Own(new EventCardPresenter(root, bridge, text, portraits));Own(new DefencePresenter(root, bridge, text));diff --git a/unity/Assets/Scripts/UI/HudPresenter.cs b/unity/Assets/Scripts/UI/HudPresenter.csindex 29c60df36..2ed9067e7 100644--- a/unity/Assets/Scripts/UI/HudPresenter.cs+++ b/unity/Assets/Scripts/UI/HudPresenter.cs@@ -10,17 +10,21 @@ namespace Statecraft.Game.UIreadonly Button endTurn; readonly System.Action onEndTurn;readonly VisualElement bar, hudRoot;- /// <summary>Below this top-bar width (logical px) the meters drop their icons (Statecraft.uss .top-bar--compact): six- /// meters with icons and their widest changes, the date badge, the screen buttons and End Turn need about this much: 16:9- /// (1920 logical) keeps the icons, 16:10 (about 1821) does not (PromoHudTests.EveryWindowShapeFitsTheBarAfterATurn).</summary>- public const float CompactBelowPx = 1900f;- public const string CompactClass = "top-bar--compact";- /// <summary>Below this width the HUD's root also gets NarrowClass: a taller bar whose meters stack the change under the- /// value, and the panels below it move down to match (Statecraft.uss .hud-narrow). Without the icons the bar still- /// cannot hold six values with their widest changes side by side below about 1900 px (PromoHudTests- /// .EveryWindowShapeFitsTheBarAfterATurn), so the two tiers share the threshold.</summary>- public const float NarrowBelowPx = CompactBelowPx;+ // Three tiers by the bar's logical width (1080p reference, match 0.5: logical width = sqrt(aspect x 1920 x 1080)).+ // Each threshold sits well clear of a common window shape, so a small window change does not flip a tier:+ // 16:9 fullscreen 1920, a 16:10 MacBook browser ~1910 | NarrowBelowPx 1860 | 16:10 fullscreen ~1821+ // | CompactBelowPx 1700 | 4:3 ~1662, 5:4 ~1585 | TwoRowBelowPx 1500 | square ~1440, half a 1080p screen ~1358.+ // PromoHudTests.EveryWindowShapeFitsTheBarAfterATurn proves each tier holds the widest late-game values and changes.++ /// <summary>Below this width the HUD's root gets NarrowClass: a taller bar (124 px) whose meters stack the change under+ /// the value, and the panels below it move down to match (Statecraft.uss .hud-narrow). Above it, six values and their+ /// changes fit side by side with the icons.</summary>+ public const float NarrowBelowPx = 1860f;public const string NarrowClass = "hud-narrow";+ /// <summary>Below this width the meters also drop their icons (Statecraft.uss .top-bar--compact): 16:10 keeps them on the+ /// stacked bar; 4:3 and 5:4 do not have the room.</summary>+ public const float CompactBelowPx = 1700f;+ public const string CompactClass = "top-bar--compact";/// <summary>Below this width (windows narrower than about square, e.g. a browser snapped to half a 1080p screen, about/// 1360 logical px) one row cannot hold the badge, six meters, the screen buttons and End Turn: the root also gets/// TwoRowClass, and the bar wraps into two rows, the date and the meters above, the screen buttons and End Turndiff --git a/unity/Assets/Scripts/UI/UiIcon.cs b/unity/Assets/Scripts/UI/UiIcon.csindex 094cc34f7..a2d8f22b9 100644--- a/unity/Assets/Scripts/UI/UiIcon.cs+++ b/unity/Assets/Scripts/UI/UiIcon.cs@@ -35,7 +35,8 @@ namespace Statecraft.Game.UIBlue = new Color32(92, 138, 200, 255), BlueLight = new Color32(206, 224, 246, 255), Sage = new Color32(126, 168, 120, 255),SageLight = new Color32(214, 236, 204, 255), Navy = new Color32(14, 22, 38, 200);- delegate void Painter(Painter2D p, Func<float, float, Vector2> at, float s);+ /// <summary>Draws one glyph; <c>gold</c> is the line colour of the gold glyphs (plain, or lit while focused).</summary>+ delegate void Painter(Painter2D p, Func<float, float, Vector2> at, float s, Color gold);static readonly Dictionary<string, Painter> Painters = new Dictionary<string, Painter>{@@ -46,9 +47,6 @@ namespace Statecraft.Game.UI["biome-mountains"] = Mountains, ["biome-valley"] = Valley, ["biome-desert"] = Dunes,};- // The line colour of the gold glyphs: gold, or gold-light while lit (on the focus fill, review N4).- static Color Gold = GoldBase;-/// <summary>The gold glyphs' line colour, plain or lit (PromoHudTests checks lit stays >= 3:1 on the focus fill).</summary>public static Color LineColour(bool lit) => lit ? GoldLight : GoldBase;@@ -76,9 +74,7 @@ namespace Statecraft.Game.UIvar origin = new Vector2(box.x + (box.width - 24f * s) / 2f, box.y + (box.height - 24f * s) / 2f);var p = mgc.painter2D;p.lineJoin = LineJoin.Round; p.lineCap = LineCap.Round;- Gold = LineColour(lit); // UI painting runs on the main thread, one element at a time- try { paint(p, (x, y) => origin + new Vector2(x, y) * s, s); }- finally { Gold = GoldBase; }+ paint(p, (x, y) => origin + new Vector2(x, y) * s, s, LineColour(lit));}/// <summary>A round navy disc with a gold rim and <paramref name="glyph"/> inside it, centred on <paramref name="centre"/>@@ -124,23 +120,23 @@ namespace Statecraft.Game.UI}// --- the indicator icons ---- static void Coin(Painter2D p, Func<float, float, Vector2> at, float s)+ static void Coin(Painter2D p, Func<float, float, Vector2> at, float s, Color gold){p.fillColor = GoldDark; p.strokeColor = new Color32(96, 68, 30, 255); p.lineWidth = 0.9f * s;Circle(p, at(14.5f, 14.5f), 7.4f * s); p.Fill(); p.Stroke();- p.fillColor = Gold;+ p.fillColor = gold;Circle(p, at(10.5f, 10.5f), 8.4f * s); p.Fill(); p.Stroke();p.strokeColor = GoldLight; p.lineWidth = 0.9f * s;Circle(p, at(10.5f, 10.5f), 5.8f * s); p.Stroke();}- static void People(Painter2D p, Func<float, float, Vector2> at, float s)+ static void People(Painter2D p, Func<float, float, Vector2> at, float s, Color gold){Figure(p, at, s, 15.2f, 0.92f, BeigeDark, Navy);Figure(p, at, s, 8.8f, 1f, Beige, Navy);}- static void Crowd(Painter2D p, Func<float, float, Vector2> at, float s)+ static void Crowd(Painter2D p, Func<float, float, Vector2> at, float s, Color gold){Figure(p, at, s, 5.6f, 0.78f, BeigeDark, Navy);Figure(p, at, s, 18.4f, 0.78f, BeigeDark, Navy);@@ -156,7 +152,7 @@ namespace Statecraft.Game.UIp.LineTo(at(3.8f, 5.2f)); p.ClosePath();}- static void Shield(Painter2D p, Func<float, float, Vector2> at, float s)+ static void Shield(Painter2D p, Func<float, float, Vector2> at, float s, Color gold){ShieldPath(p, at); p.fillColor = Blue; p.Fill();p.strokeColor = BlueLight; p.lineWidth = 1.3f * s;@@ -165,7 +161,7 @@ namespace Statecraft.Game.UIShieldPath(p, at); p.lineWidth = 1.1f * s; p.Stroke();}- static void Globe(Painter2D p, Func<float, float, Vector2> at, float s)+ static void Globe(Painter2D p, Func<float, float, Vector2> at, float s, Color gold){p.fillColor = new Color(Blue.r, Blue.g, Blue.b, 0.22f);Circle(p, at(12, 12), 9.2f * s); p.Fill();@@ -179,7 +175,7 @@ namespace Statecraft.Game.UIp.BeginPath(); p.MoveTo(at(4.4f, 16.6f)); p.LineTo(at(19.6f, 16.6f)); p.Stroke();}- static void Banknote(Painter2D p, Func<float, float, Vector2> at, float s)+ static void Banknote(Painter2D p, Func<float, float, Vector2> at, float s, Color gold){p.fillColor = new Color32(84, 120, 82, 255); p.strokeColor = SageLight; p.lineWidth = 0.9f * s;Rect(p, at, 4.5f, 4.2f, 17, 11); p.Fill(); p.Stroke();@@ -192,9 +188,9 @@ namespace Statecraft.Game.UI}// --- the screen buttons (gold line art, as the promo's round buttons) ---- static void Columns(Painter2D p, Func<float, float, Vector2> at, float s)+ static void Columns(Painter2D p, Func<float, float, Vector2> at, float s, Color gold){- p.fillColor = Gold;+ p.fillColor = gold;p.BeginPath(); p.MoveTo(at(2.5f, 8)); p.LineTo(at(12, 2.6f)); p.LineTo(at(21.5f, 8)); p.ClosePath(); p.Fill();Rect(p, at, 3, 8.8f, 18, 1.6f); p.Fill();foreach (var x in new[] { 4.6f, 9.1f, 13.3f, 17.8f }) { Rect(p, at, x, 11.2f, 1.6f, 7); p.Fill(); }@@ -202,9 +198,9 @@ namespace Statecraft.Game.UIRect(p, at, 1.6f, 20.9f, 20.8f, 1.5f); p.Fill();}- static void Scales(Painter2D p, Func<float, float, Vector2> at, float s)+ static void Scales(Painter2D p, Func<float, float, Vector2> at, float s, Color gold){- p.strokeColor = Gold; p.fillColor = Gold; p.lineWidth = 1.4f * s;+ p.strokeColor = gold; p.fillColor = gold; p.lineWidth = 1.4f * s;p.BeginPath(); p.MoveTo(at(12, 4.6f)); p.LineTo(at(12, 19.6f)); p.Stroke();p.BeginPath(); p.MoveTo(at(3.6f, 7)); p.LineTo(at(20.4f, 7)); p.Stroke();Circle(p, at(12, 4.2f), 1.5f * s); p.Fill();@@ -219,54 +215,54 @@ namespace Statecraft.Game.UI}}- static void Helmet(Painter2D p, Func<float, float, Vector2> at, float s)+ static void Helmet(Painter2D p, Func<float, float, Vector2> at, float s, Color gold){- p.fillColor = Gold;+ p.fillColor = gold;p.BeginPath(); p.MoveTo(at(4.2f, 15.4f)); p.Arc(at(12, 15.4f), 7.8f * s, Angle.Degrees(180), Angle.Degrees(360)); p.ClosePath(); p.Fill();p.BeginPath(); p.MoveTo(at(1.8f, 15.6f)); p.LineTo(at(22.2f, 15.6f)); p.LineTo(at(20.6f, 18.4f)); p.LineTo(at(3.4f, 18.4f)); p.ClosePath(); p.Fill();p.strokeColor = GoldDark; p.lineWidth = 1f * s;p.BeginPath(); p.MoveTo(at(7.2f, 13.6f)); p.Arc(at(12, 13.6f), 4.8f * s, Angle.Degrees(180), Angle.Degrees(270)); p.Stroke();}- static void Question(Painter2D p, Func<float, float, Vector2> at, float s)+ static void Question(Painter2D p, Func<float, float, Vector2> at, float s, Color gold){- p.strokeColor = Gold; p.lineWidth = 2.3f * s;+ p.strokeColor = gold; p.lineWidth = 2.3f * s;p.BeginPath(); p.MoveTo(at(7.4f, 8.6f));p.Arc(at(12, 8.6f), 4.6f * s, Angle.Degrees(180), Angle.Degrees(405));p.LineTo(at(12, 14.6f)); p.LineTo(at(12, 15.8f)); p.Stroke();- p.fillColor = Gold; Circle(p, at(12, 20), 1.6f * s); p.Fill();+ p.fillColor = gold; Circle(p, at(12, 20), 1.6f * s); p.Fill();}- static void Restart(Painter2D p, Func<float, float, Vector2> at, float s)+ static void Restart(Painter2D p, Func<float, float, Vector2> at, float s, Color gold){- p.strokeColor = Gold; p.lineWidth = 2f * s;+ p.strokeColor = gold; p.lineWidth = 2f * s;p.BeginPath(); p.MoveTo(at(16.2f, 6.2f));p.Arc(at(12, 12.6f), 7.6f * s, Angle.Degrees(303), Angle.Degrees(573)); p.Stroke();- p.fillColor = Gold;+ p.fillColor = gold;p.BeginPath(); p.MoveTo(at(13.6f, 2.6f)); p.LineTo(at(20.4f, 5.4f)); p.LineTo(at(15.0f, 10.4f)); p.ClosePath(); p.Fill();}- static void Chevron(Painter2D p, Func<float, float, Vector2> at, float s)+ static void Chevron(Painter2D p, Func<float, float, Vector2> at, float s, Color gold){- p.strokeColor = Gold; p.lineWidth = 2.2f * s;+ p.strokeColor = gold; p.lineWidth = 2.2f * s;p.BeginPath(); p.MoveTo(at(9.6f, 6.4f)); p.LineTo(at(15.2f, 12)); p.LineTo(at(9.6f, 17.6f)); p.Stroke();}- static void Hourglass(Painter2D p, Func<float, float, Vector2> at, float s)+ static void Hourglass(Painter2D p, Func<float, float, Vector2> at, float s, Color gold){- p.strokeColor = Gold; p.lineWidth = 1.5f * s;+ p.strokeColor = gold; p.lineWidth = 1.5f * s;p.BeginPath(); p.MoveTo(at(6, 3)); p.LineTo(at(18, 3)); p.Stroke();p.BeginPath(); p.MoveTo(at(6, 21)); p.LineTo(at(18, 21)); p.Stroke();p.BeginPath(); p.MoveTo(at(7.4f, 3)); p.BezierCurveTo(at(7.4f, 9), at(11, 10.4f), at(11, 12)); p.BezierCurveTo(at(11, 13.6f), at(7.4f, 15), at(7.4f, 21)); p.Stroke();p.BeginPath(); p.MoveTo(at(16.6f, 3)); p.BezierCurveTo(at(16.6f, 9), at(13, 10.4f), at(13, 12)); p.BezierCurveTo(at(13, 13.6f), at(16.6f, 15), at(16.6f, 21)); p.Stroke();- p.fillColor = Gold;+ p.fillColor = gold;p.BeginPath(); p.MoveTo(at(8.6f, 20)); p.LineTo(at(12, 16.4f)); p.LineTo(at(15.4f, 20)); p.ClosePath(); p.Fill();}// --- terrain signs for the info panel (drawn dark on the biome's own map colour) ---static readonly Color Ink = new Color32(14, 22, 38, 170), InkLight = new Color32(255, 250, 236, 220); // waves at >= 3:1 on sea and lake- static void Waves(Painter2D p, Func<float, float, Vector2> at, float s)+ static void Waves(Painter2D p, Func<float, float, Vector2> at, float s, Color gold){p.strokeColor = InkLight; p.lineWidth = 1.6f * s;foreach (var y in new[] { 8f, 13f, 18f })@@ -277,7 +273,7 @@ namespace Statecraft.Game.UI}}- static void Plain(Painter2D p, Func<float, float, Vector2> at, float s)+ static void Plain(Painter2D p, Func<float, float, Vector2> at, float s, Color gold){p.strokeColor = Ink; p.lineWidth = 1.4f * s;p.BeginPath(); p.MoveTo(at(2.5f, 17)); p.LineTo(at(21.5f, 17)); p.Stroke();@@ -289,13 +285,13 @@ namespace Statecraft.Game.UI}}- static void Hills(Painter2D p, Func<float, float, Vector2> at, float s)+ static void Hills(Painter2D p, Func<float, float, Vector2> at, float s, Color gold){p.fillColor = Ink;p.BeginPath(); p.MoveTo(at(1.5f, 19)); p.BezierCurveTo(at(4, 9.5f), at(10, 9.5f), at(12.5f, 15)); p.BezierCurveTo(at(14.5f, 11), at(20, 11), at(22.5f, 19)); p.ClosePath(); p.Fill();}- static void Mountains(Painter2D p, Func<float, float, Vector2> at, float s)+ static void Mountains(Painter2D p, Func<float, float, Vector2> at, float s, Color gold){p.fillColor = Ink;p.BeginPath(); p.MoveTo(at(1.5f, 20)); p.LineTo(at(9, 5)); p.LineTo(at(13, 12)); p.LineTo(at(16, 8.4f)); p.LineTo(at(22.5f, 20)); p.ClosePath(); p.Fill();@@ -303,7 +299,7 @@ namespace Statecraft.Game.UIp.BeginPath(); p.MoveTo(at(9, 5)); p.LineTo(at(11.2f, 9.4f)); p.LineTo(at(9.6f, 8.6f)); p.LineTo(at(8.2f, 9.8f)); p.LineTo(at(7.2f, 8.6f)); p.ClosePath(); p.Fill();}- static void Valley(Painter2D p, Func<float, float, Vector2> at, float s)+ static void Valley(Painter2D p, Func<float, float, Vector2> at, float s, Color gold){p.fillColor = Ink;p.BeginPath(); p.MoveTo(at(1.5f, 6)); p.BezierCurveTo(at(6, 7), at(9, 15), at(12, 17)); p.BezierCurveTo(at(15, 15), at(18, 7), at(22.5f, 6)); p.LineTo(at(22.5f, 20)); p.LineTo(at(1.5f, 20)); p.ClosePath(); p.Fill();@@ -311,7 +307,7 @@ namespace Statecraft.Game.UIp.BeginPath(); p.MoveTo(at(12, 17.4f)); p.BezierCurveTo(at(10.5f, 18.6f), at(13.5f, 19.2f), at(12, 20)); p.Stroke();}- static void Dunes(Painter2D p, Func<float, float, Vector2> at, float s)+ static void Dunes(Painter2D p, Func<float, float, Vector2> at, float s, Color gold){p.fillColor = Ink;p.BeginPath(); p.MoveTo(at(1.5f, 20)); p.BezierCurveTo(at(5, 12), at(9, 11), at(14, 16)); p.BezierCurveTo(at(17, 13), at(20, 13), at(22.5f, 15)); p.LineTo(at(22.5f, 20)); p.ClosePath(); p.Fill();diff --git a/unity/Assets/Tests/EditMode/PromoHudTests.cs b/unity/Assets/Tests/EditMode/PromoHudTests.csindex ba9d04546..3e6d3da09 100644--- a/unity/Assets/Tests/EditMode/PromoHudTests.cs+++ b/unity/Assets/Tests/EditMode/PromoHudTests.cs@@ -127,21 +127,23 @@ public class PromoHudTests}}- /// <summary>The bar at every window shape, after a turn has played and with the widest realistic changes and date:- /// 16:9 (1920 logical px) keeps the icons; 16:10 (~1821), 5:4, 4:3 and windows narrower than about square (1280x1024 ~1585,- /// 1024x768 ~1662, 1024x1024 ~1440, a browser snapped to half a 1080p screen ~1358, 800x1000 ~1288) get the compact,- /// narrow HUD: no icons, and a taller bar whose meters stack the change under the value. Below about 1500 logical px- /// (1024x1024, 960x1080, 800x1000) the bar also wraps into two rows. Everywhere: every meter label stays inside its meter and the bar, no two meters'- /// labels overlap, the meters end before the screen buttons, the date badge holds its widest line inside its trim at a- /// fixed width, and the panels start below the bar (review N2, N3 and the narrow-window follow-up).</summary>+ /// <summary>The bar at every window shape, after a turn has played and with the widest late-game values, changes and+ /// date (the tiers: HudPresenter). 16:9 and a 16:10 MacBook browser keep the icons on the one-row bar; 16:10 fullscreen+ /// keeps them on the stacked bar; 4:3 and 5:4 drop them; square and narrower windows wrap into two rows. Everywhere:+ /// every meter label stays inside its meter and the bar, no two meters' labels overlap, the meters keep 5% spare room+ /// and stay 12 px clear of the screen buttons, End Turn and the badge, the badge holds its widest line inside its trim at+ /// a fixed width, and the panels start below the bar (reviews N2, N3, N5, N7).</summary>[UnityTest]public IEnumerator EveryWindowShapeFitsTheBarAfterATurn(){- foreach (var (w, h, compact, narrow, twoRow) in new[] { (1920, 1080, false, false, false), (1280, 720, false, false, false),- (1366, 768, false, false, false), (1920, 1200, true, true, false),- (1440, 900, true, true, false), (1280, 1024, true, true, false),- (1024, 768, true, true, false), (1024, 1024, true, true, true),- (960, 1080, true, true, true), (800, 1000, true, true, true) })+ // (window, icons, stacked changes, two rows): 16:9 fullscreen; a 16:9 window; a 16:10 MacBook browser (~1911+ // logical); 16:10 fullscreen (~1821) keeps the icons on the stacked bar; 4:3 and 5:4 drop them; square and narrower wrap.+ foreach (var (w, h, icons, narrow, twoRow) in new[] { (1920, 1080, true, false, false), (1280, 720, true, false, false),+ (1366, 768, true, false, false), (1760, 1000, true, false, false),+ (1920, 1200, true, true, false), (1440, 900, true, true, false),+ (1024, 768, false, true, false), (1280, 1024, false, true, false),+ (1024, 1024, false, true, true), (960, 1080, false, true, true),+ (800, 1000, false, true, true) }){var rt = new RenderTexture(w, h, 0);var ps = Object.Instantiate(AssetDatabase.LoadAssetAtPath<PanelSettings>(UiPaths.Panel));@@ -166,16 +168,21 @@ public class PromoHudTestsforeach (var (name, delta) in new[] { ("treasury", PlayerText.MoneyChange(C, "treasury", -12.4)), ("immigration", Text.Format("hud.delta_people", 12345.0)),("security", "-10%"), ("support", "-10%"), ("standing", "+10%"), ("fx", PlayerText.MoneyChange(C, "fx_reserves", 12.5)) })root.Q<Label>(name + "-delta").text = delta;+ // ... and the widest late-game values (review N7).+ foreach (var (name, value) in new[] { ("treasury", PlayerText.Money(C, "treasury", -123.4)), ("immigration", Text.Format("hud.people", 123456.0)),+ ("fx", PlayerText.Money(C, "fx_reserves", 123.4)), ("security", "100%"), ("support", "100%"), ("standing", "100%") })+ root.Q<Label>(name + "-value").text = value;+ root.Q<Label>("security-level").text = Text.Format("hud.level", 5);root.Q<Label>("turn").text = Text.Format("hud.turn", 120);root.Q<Label>("date").text = Text.Format("hud.date", PlayerText.Date(new System.DateTime(1956, 9, 30)));for (int i = 0; i < 3; i++) yield return null;var bar = root.Q("top-bar"); var barRect = bar.worldBound;var where = $"{w}x{h} (bar {barRect.width:0} px)";- Assert.AreEqual(compact, bar.ClassListContains(HudPresenter.CompactClass), where + ": compact");+ Assert.AreEqual(!icons, bar.ClassListContains(HudPresenter.CompactClass), where + ": compact (no icons)");Assert.AreEqual(narrow, root.Q("root").ClassListContains(HudPresenter.NarrowClass), where + ": narrow");Assert.AreEqual(twoRow, root.Q("root").ClassListContains(HudPresenter.TwoRowClass), where + ": two rows");foreach (var icon in root.Q("meters").Query<UiIcon>().ToList())- Assert.AreEqual(compact ? DisplayStyle.None : DisplayStyle.Flex, icon.resolvedStyle.display, $"{where}: {icon.Glyph}");+ Assert.AreEqual(icons ? DisplayStyle.Flex : DisplayStyle.None, icon.resolvedStyle.display, $"{where}: {icon.Glyph}");var badge = root.Q(className: "date-box");foreach (var l in badge.Query<Label>().ToList())Assert.LessOrEqual(l.worldBound.xMax, badge.worldBound.xMax - 4f, $"{where}: '{l.text}' {l.worldBound} runs under the badge's trim {badge.worldBound}");@@ -293,6 +300,19 @@ public class PromoHudTestsAssert.AreNotSame(b, b.focusController.focusedElement, name + ": a pointer click leaves no focus behind");Near(navy, look.resolvedStyle.backgroundColor, name + ": no focus fill after the click");}++ // Keyboard activation (Enter, Space: NavigationSubmitEvent) runs the button and keeps its focus (review N8): this pins+ // PointerBlur's assumption that only a pointer click raises ClickEvent.+ var endTurn = ui.Q<Button>("end-turn");+ int pressed = 0; System.Action count = () => pressed++;+ endTurn.clicked += count;+ endTurn.Focus();+ for (int i = 0; i < 10 && endTurn.focusController.focusedElement != endTurn; i++) yield return null;+ using (var e = NavigationSubmitEvent.GetPooled()) { e.target = endTurn; endTurn.SendEvent(e); }+ yield return null;+ endTurn.clicked -= count;+ Assert.AreEqual(1, pressed, "Enter/Space pressed End Turn");+ Assert.AreSame(endTurn, endTurn.focusController.focusedElement, "keyboard activation keeps the focus");}finally { nav.Dispose(); blur.Dispose(); card.Dispose(); }}diff --git a/unity/Assets/UI/Statecraft.uss b/unity/Assets/UI/Statecraft.ussindex 08d9af1b7..58a79e70a 100644--- a/unity/Assets/UI/Statecraft.uss+++ b/unity/Assets/UI/Statecraft.uss@@ -81,7 +81,7 @@ Button:disabled { color: var(--ink-dim); border-color: rgba(120, 120, 120, 0.4);.date-box {flex-shrink: 0; width: 230px; height: 82px; /* fixed, and wide enough for the widest line ("Turn 120 30 September 1956"),so the meters never shift when the month changes */ justify-content: center;- padding: 0 12px 0 18px; margin-right: 10px;+ padding: 0 10px 0 12px; margin-right: 10px;background-color: var(--navy-raised); border-width: 1px; border-color: var(--gold-dim); border-radius: 2px;}.date-row { flex-direction: row; }@@ -89,26 +89,26 @@ Button:disabled { color: var(--ink-dim); border-color: rgba(120, 120, 120, 0.4);.year { -unity-font-definition: url("project://database/Assets/UI/Fonts/EBGaramond-SemiBold.ttf"); font-size: 32px; color: var(--ink); }.meters { flex-direction: row; flex-grow: 1; align-items: center; }.meter {- flex-direction: row; align-items: center; min-width: 130px; flex-shrink: 1; padding: 0 8px 0 7px;+ flex-direction: row; align-items: center; min-width: 130px; flex-shrink: 1; padding: 0 7px 0 6px;border-right-width: 1px; border-color: rgba(196, 160, 92, 0.25);}/* The icon gives way first in a narrow window (down to 26px), so the caption keeps its line. */-.meter-icon { width: 32px; height: 32px; flex-shrink: 1; min-width: 24px; margin-right: 6px; }+.meter-icon { width: 30px; height: 30px; flex-shrink: 1; min-width: 24px; margin-right: 5px; }.meter-body { flex-shrink: 1; flex-grow: 1; min-width: 0; }.meter-name { font-size: 16px; color: var(--ink); white-space: normal; max-width: 120px; } /* a long caption wraps rather than widen its meter */#security-level { font-size: 14px; color: var(--ink-dim); }.meter-row { flex-direction: row; align-items: flex-end; }-.meter-value { font-size: 24px; color: var(--ink); }+.meter-value { font-size: 22px; color: var(--ink); }.meter-delta { font-size: 16px; margin-left: 7px; }/* The screen buttons: a round, gold-rimmed icon with its name under it (the name keeps them legible without tooltips). */.nav { flex-direction: row; flex-shrink: 0; align-items: center; }.nav-button {- width: 64px; height: 86px; margin: 0 1px; padding: 56px 0 0 0;+ width: 60px; height: 86px; margin: 0 1px; padding: 56px 0 0 0;background-color: rgba(0, 0, 0, 0); border-width: 0;font-size: 14px; color: var(--ink-dim); -unity-text-align: upper-center; white-space: nowrap;}.nav-disc {- position: absolute; top: 2px; left: 7px; width: 50px; height: 50px; padding: 11px;+ position: absolute; top: 2px; left: 5px; width: 50px; height: 50px; padding: 11px;border-radius: 25px; border-width: 1.5px; border-color: var(--gold-dim); background-color: var(--navy-deep);}.nav-button:hover { background-color: rgba(0, 0, 0, 0); color: var(--ink); }@@ -122,11 +122,9 @@ Button:disabled { color: var(--ink-dim); border-color: rgba(120, 120, 120, 0.4);/* A window too narrow for the icons (HudPresenter sets top-bar--compact below HudPresenter.CompactBelowPx): the metersdrop their icons and tighten, as the bar was before the icons. */.top-bar--compact .meter-icon { display: none; }-.top-bar--compact .date-box { width: 226px; padding: 0 10px 0 12px; margin-right: 6px; }+.top-bar--compact .date-box { width: 226px; margin-right: 6px; }.top-bar--compact .date-row Label { font-size: 16px; margin-right: 6px; }.top-bar--compact .meter { padding: 0 8px; }-.top-bar--compact .nav-button { width: 62px; }-.top-bar--compact .nav-disc { left: 6px; }/* The narrow HUD (HudPresenter sets hud-narrow on the root, with the compact bar): a taller bar whose meters put thechange under the value, so no change runs into its neighbour; the panels below the bar move down with it. */.hud-narrow .top-bar { height: 124px; }