A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
UI: the two-row hint chip wraps clear of the border layer's label (refs #1227) (#1468)
Eyal Golanc389b49247c1
diff --git a/changelog.d/hint-chip-two-row-1227.md b/changelog.d/hint-chip-two-row-1227.mdnew file mode 100644index 000000000..fd3f1589d--- /dev/null+++ b/changelog.d/hint-chip-two-row-1227.md@@ -0,0 +1,4 @@+### Fixed++- On the two-row bar (a window narrower than about square, e.g. 960x1080) the "no hex chosen" hint wraps to two lines+ and ends left of the minimap column, so it no longer covers the border layer's label (refs #1227).diff --git a/unity/Assets/Tests/EditMode/ArmisticeTests.cs b/unity/Assets/Tests/EditMode/ArmisticeTests.csindex 8c576426d..ffb044542 100644--- a/unity/Assets/Tests/EditMode/ArmisticeTests.cs+++ b/unity/Assets/Tests/EditMode/ArmisticeTests.cs@@ -306,6 +306,8 @@ public class ArmisticeTestsvar bridge = new SimBridge(GameSession.New(c, GoldenRun.Seed, Mode.Historical), t);var hud = new HudPresenter(root, bridge, t);var card = new EventCardPresenter(root, bridge, t, null, null);+ // The info panel as the game draws it before a hex is chosen: the hint chip (its presenter, not the bare UXML).+ var info = new InfoPanelPresenter(root, bridge, t, new System.Collections.Generic.Dictionary<string, string>());try{var g = GameSession.New(c, GoldenRun.Seed, Mode.Historical);@@ -329,7 +331,7 @@ public class ArmisticeTestsAssert.LessOrEqual(size.y, lb.height + 1f, $"{w}x{h}: the label's text is cut off");Assert.LessOrEqual(size.y, 4 * label.resolvedStyle.fontSize * 1.4f, $"{w}x{h}: the label takes more than four lines ({size.y} px)");}- finally { card.Dispose(); hud.Dispose(); Object.DestroyImmediate(go); Object.DestroyImmediate(ps); rt.Release(); Object.DestroyImmediate(rt); }+ finally { info.Dispose(); card.Dispose(); hud.Dispose(); Object.DestroyImmediate(go); Object.DestroyImmediate(ps); rt.Release(); Object.DestroyImmediate(rt); }}}diff --git a/unity/Assets/Tests/EditMode/InfoPanelLayoutTests.cs b/unity/Assets/Tests/EditMode/InfoPanelLayoutTests.csindex dfe51f12d..c9131f72a 100644--- a/unity/Assets/Tests/EditMode/InfoPanelLayoutTests.cs+++ b/unity/Assets/Tests/EditMode/InfoPanelLayoutTests.cs@@ -292,14 +292,14 @@ public class InfoPanelLayoutTests}/// <summary>The empty hint stays inside the window and clear of the minimap in both languages: one line on desktop,- /// at most two on the phone tier, with no terrain sign, fact rows or spare panel height.</summary>+ /// at most two on the two-row and phone tiers, with no terrain sign, fact rows or spare panel height.</summary>[UnityTest]public IEnumerator TheEmptyInfoPanelHintFitsBothLanguages(){var g = GameSession.New(C, GoldenRun.Seed, Mode.Historical);var he = UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.StringsHebrew).text, "strings.he.yaml");foreach (var hebrew in new[] { false, true })- foreach (var (w, h) in new[] { (1920, 1080), (1280, 720), (390, 844) })+ foreach (var (w, h) in new[] { (1920, 1080), (1280, 720), (960, 1080), (390, 844) })yield return Rendered(w, h, g, (root, info) => { }, root =>{var at = $"{(hebrew ? "he" : "en")} {w}x{h}";@@ -310,7 +310,7 @@ public class InfoPanelLayoutTestsAssert.IsTrue(Inside(hint.worldBound, panel.worldBound), $"{at}: the hint fits the panel");Assert.IsTrue(Inside(panel.worldBound, root.worldBound), $"{at}: the hint panel fits the window");Assert.IsFalse(panel.worldBound.Overlaps(root.Q("minimap").worldBound), $"{at}: the hint stays clear of the minimap");- var lines = root.Q("root").ClassListContains("hud-three-row") ? 2 : 1;+ var lines = root.Q("root").ClassListContains("hud-two-row") ? 2 : 1;var natural = hint.MeasureTextSize(hint.text, 0, VisualElement.MeasureMode.Undefined, 0, VisualElement.MeasureMode.Undefined);Assert.LessOrEqual(hint.contentRect.height, natural.y * lines + 1f, $"{at}: the hint uses at most {lines} lines");Assert.AreEqual(DisplayStyle.None, root.Q("info-thumb").resolvedStyle.display, $"{at}: no terrain sign");diff --git a/unity/Assets/UI/Statecraft.uss b/unity/Assets/UI/Statecraft.ussindex a31767b1b..0ff36a48a 100644--- a/unity/Assets/UI/Statecraft.uss+++ b/unity/Assets/UI/Statecraft.uss@@ -404,10 +404,13 @@ Button:disabled { color: var(--ink-dim); border-color: rgba(120, 120, 120, 0.4);.info-panel.info-empty { min-height: 0; width: auto; padding: 8px 16px; }.info-empty .gold-rule, .info-empty #info-subtitle, .info-empty .reason { display: none; }.info-empty #info-title { font-size: 20px; }+/* On the two-row bar the window is too narrow for the one-line chip beside the right column: it ran under the border+ layer's label (.map-layer, the column's left 250 px). The chip ends 12 px left of the column (16 px + 480 px) and wraps. */+.hud-two-row .info-panel.info-empty { right: 508px; }+.hud-two-row .info-empty #info-title { white-space: normal; }/* On a phone upright the hint chip keeps the window's width from the left edge (two lines, InfoPanelLayoutTests), so it sitsover Star, Report and Share (#1236): the window's 16 px, three 60 px discs with their 12 px margins, and a 12 px gap. */.hud-three-row .info-panel.info-empty { left: 16px; bottom: 244px; right: 254px; }-.hud-three-row .info-empty #info-title { white-space: normal; }/* The hex's facts as the promo's icon rows: a gold sign, then the line, which wraps inside the panel (#397). A unit's cardreuses the lines without the signs (they name a hex's facts, not a unit's). */.info-row { flex-direction: row; align-items: flex-start; margin-bottom: 3px; }