A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
unity: the map legend is hidden while the decision card is open (fixes #849) (#915)
Eyal Golanf74efd7e3905
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 25581c999..5342e276d 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -46,6 +46,9 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIB- A WebGL `?firstcard` check now follows the normal first-card path: it closes the start screen through New Game,leaves decision video enabled, records the event-photo load, and requires an interactive photo or portrait-fallbackcard within a proposed 10-second budget (refs #909; budget needs maintainer sign-off).+- The map legend is hidden while the decision card is open, so no card, the photograph's included, covers it at any+ window, desktop or phone; it comes back when the card is hidden or answered (Fixes #849; the owner's decision of+ 17 October 2026, "Hide legend under card"). The card and its photograph keep their full size.- The content loader now checks `name_he_review` on people rows the way it does for parties, governments,legislatures, offices and settlements: the flag is `agent-checked` or left out, and only beside a `name_he`(CONTENT_POLICY section 2, rule 6; #862). No people row carries the flag yet, so no row changes.diff --git a/unity/Assets/Tests/EditMode/ArmisticeTests.cs b/unity/Assets/Tests/EditMode/ArmisticeTests.csindex 006920e28..9987cba3a 100644--- a/unity/Assets/Tests/EditMode/ArmisticeTests.cs+++ b/unity/Assets/Tests/EditMode/ArmisticeTests.cs@@ -279,27 +279,20 @@ public class ArmisticeTests/// <summary>Review I-4: the longest label (from 22 Feb 1950: all four fronts, Jordan low-accuracy, the 1950 note) fits/// on screen beside the minimap with the real HUD (HudPresenter: one, two and three-row bars) and the longest event card,- /// at the card's window shapes and main's narrow ones: on screen, clear of the card, the minimap and the info panel, its- /// text not cut, at most four lines.</summary>+ /// at the card's window shapes and main's narrow ones: on screen, clear of the minimap, the info panel and the top bar,+ /// its text not cut, at most four lines. Not clear of the card: since the owner's decision of 17 October 2026 (#849,+ /// issuecomment-6233870812, "Hide legend under card") the legend is hidden while the modal card is open+ /// (DecisionCardTests.TheLegendIsHiddenWhileTheCardIsOpen).</summary>[UnityTest]public IEnumerator TheLongestMapLabelFitsBesideTheEventCard(){var c = Inputs.Content; var t = Text;var text = L(Regions(), new DateTime(1950, 3, 1));StringAssert.Contains("Jordan (low accuracy)", text);- // Each window with the longest text without a picture; the two-row shapes also with the longest text that has its- // photograph (the tallest card a player meets: review B1 of #831 saw it cover the label at 1024x1024 where the first- // did not). On main the photo card already touches the label at some one-row and stacked windows (1920x1080,- // 1680x1050, 1280x720, 1280x1024; noted in #831's review): a follow-up, so those are not pinned here.- var catalog = AssetDatabase.LoadAssetAtPath<EventImageCatalog>("Assets/Resources/EventImageCatalog.asset");- Assert.IsNotNull(catalog, "precondition: the photo catalog");- var pictured = new System.Collections.Generic.HashSet<string>(catalog.entries.Where(x => x.image != null).Select(x => x.eventId));- foreach (var (w, h, photo) in new[] { (1920, 1080), (1280, 720), (1531, 784), (1366, 657), (2560, 1080), (1920, 900), (1280, 1024),- (960, 600), (1024, 768), (390, 844), (1600, 757),- // the two-row bar's shapes (#380's re-tier gives a square window two rows; review B1 of #831)- (1024, 1024), (960, 1080), (800, 1000) }- .Select(x => (x.Item1, x.Item2, false))- .Concat(new[] { (1024, 1024, true), (960, 1080, true), (800, 1000, true) }))+ foreach (var (w, h) in new[] { (1920, 1080), (1280, 720), (1531, 784), (1366, 657), (2560, 1080), (1920, 900), (1280, 1024),+ (960, 600), (1024, 768), (390, 844), (1600, 757),+ // the two-row bar's shapes (#380's re-tier gives a square window two rows; review B1 of #831)+ (1024, 1024), (960, 1080), (800, 1000) }){var rt = new RenderTexture(w, h, 0);var ps = Object.Instantiate(AssetDatabase.LoadAssetAtPath<PanelSettings>(UiPaths.Panel));@@ -311,11 +304,11 @@ public class ArmisticeTestsvar root = doc.rootVisualElement;var 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, photo ? catalog : null);+ var card = new EventCardPresenter(root, bridge, t, null, null);try{var g = GameSession.New(c, GoldenRun.Seed, Mode.Historical);- var e = c.Events.Where(x => !photo || pictured.Contains(x.Id)).OrderByDescending(x => x.Text.Length).First();+ var e = c.Events.OrderByDescending(x => x.Text.Length).First();g.State.Date = e.From; g.State.PendingEvents.Clear(); g.State.PendingEvents.Add(e.Id);bridge.Replace(g);var label = root.Q<Label>("map-layer");@@ -325,16 +318,15 @@ public class ArmisticeTestsvar lb = label.worldBound;var screen = root.worldBound;Assert.IsTrue(lb.xMin >= screen.xMin - 0.5f && lb.xMax <= screen.xMax + 0.5f && lb.yMin >= screen.yMin - 0.5f && lb.yMax <= screen.yMax + 0.5f,- $"{w}x{h}{(photo ? " (photo card)" : "")}: the label {lb} leaves the screen {screen}");- Assert.IsFalse(lb.Overlaps(R("minimap")), $"{w}x{h}{(photo ? " (photo card)" : "")}: the label {lb} overlaps the minimap {R("minimap")}");- Assert.IsFalse(lb.Overlaps(R("event-card")), $"{w}x{h}{(photo ? " (photo card)" : "")}: the event card {R("event-card")} overlaps the label {lb}");+ $"{w}x{h}: the label {lb} leaves the screen {screen}");+ Assert.IsFalse(lb.Overlaps(R("minimap")), $"{w}x{h}: the label {lb} overlaps the minimap {R("minimap")}");if (root.Q("info-panel").resolvedStyle.display == DisplayStyle.Flex)- Assert.IsFalse(lb.Overlaps(R("info-panel")), $"{w}x{h}{(photo ? " (photo card)" : "")}: the info panel {R("info-panel")} overlaps the label {lb}");- Assert.IsFalse(lb.Overlaps(R("top-bar")), $"{w}x{h}{(photo ? " (photo card)" : "")}: the top bar overlaps the label");+ Assert.IsFalse(lb.Overlaps(R("info-panel")), $"{w}x{h}: the info panel {R("info-panel")} overlaps the label {lb}");+ Assert.IsFalse(lb.Overlaps(R("top-bar")), $"{w}x{h}: the top bar overlaps the label");var size = label.MeasureTextSize(text, lb.width - label.resolvedStyle.paddingLeft - label.resolvedStyle.paddingRight,VisualElement.MeasureMode.Exactly, 0, VisualElement.MeasureMode.Undefined);- Assert.LessOrEqual(size.y, lb.height + 1f, $"{w}x{h}{(photo ? " (photo card)" : "")}: the label's text is cut off");- Assert.LessOrEqual(size.y, 4 * label.resolvedStyle.fontSize * 1.4f, $"{w}x{h}{(photo ? " (photo card)" : "")}: the label takes more than four lines ({size.y} px)");+ Assert.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); }}diff --git a/unity/Assets/Tests/EditMode/ControlTests.cs b/unity/Assets/Tests/EditMode/ControlTests.csindex 6d7bdf2bc..200e72563 100644--- a/unity/Assets/Tests/EditMode/ControlTests.cs+++ b/unity/Assets/Tests/EditMode/ControlTests.cs@@ -283,8 +283,8 @@ public class ControlTests}/// <summary>The longest legend label (English and Hebrew, a period with some fronts switched: legend and caption) fits- /// beside the minimap with the real HUD and the longest event card (which, being modal, may cover it: owner, 15 October- /// 2026), as ArmisticeTests.TheLongestMapLabelFitsBesideTheEventCard+ /// beside the minimap with the real HUD and the longest event card (which hides it while open: owner, 17 October 2026,+ /// #849), as ArmisticeTests.TheLongestMapLabelFitsBesideTheEventCard/// checks the older label: on screen, clear of the card, the minimap, the info panel and the top bar, its text not cut, at/// most six lines (the approved legend is about three of them in the narrow box).</summary>[UnityTest]@@ -324,13 +324,9 @@ public class ControlTestsAssert.IsTrue(lb.xMin >= screen.xMin - 0.5f && lb.xMax <= screen.xMax + 0.5f && lb.yMin >= screen.yMin - 0.5f && lb.yMax <= screen.yMax + 0.5f,$"{at}: the label {lb} leaves the screen {screen}");Assert.IsFalse(lb.Overlaps(R("minimap")), $"{at}: the label {lb} overlaps the minimap {R("minimap")}");- // Owner, 15 October 2026, on the longest card (bernadotte_assassination since the GDD cutover) covering the- // legend at 390x844: "Accept it, the card is modal". A modal card (its backdrop dims the map and disables- // the minimap column, ScreenNav.DisableCovered) may cover the legend at any size; a card that covers it must- // be modal. Today every shown card is modal, so this fails only if a shown card stops being modal.- if (lb.Overlaps(R("event-card")))- Assert.IsTrue(root.Q("root").ClassListContains(EventCardPresenter.ModalClass),- $"{at}: the event card {R("event-card")} covers the label {lb} and is not modal");+ // Not clear of the card: the owner's decision of 17 October 2026 (#849, issuecomment-6233870812, "Hide+ // legend under card", on desktop and phone alike) hides the legend while the modal card is open+ // (DecisionCardTests.TheLegendIsHiddenWhileTheCardIsOpen), so the card never covers it.if (root.Q("info-panel").resolvedStyle.display == DisplayStyle.Flex)Assert.IsFalse(lb.Overlaps(R("info-panel")), $"{at}: the info panel overlaps the label {lb}");Assert.IsFalse(lb.Overlaps(R("top-bar")), $"{at}: the top bar overlaps the label");diff --git a/unity/Assets/Tests/EditMode/DecisionCardTests.cs b/unity/Assets/Tests/EditMode/DecisionCardTests.csindex 5a5690ab9..a5e4126e8 100644--- a/unity/Assets/Tests/EditMode/DecisionCardTests.cs+++ b/unity/Assets/Tests/EditMode/DecisionCardTests.cs@@ -26,8 +26,9 @@ public class DecisionCardTestspublic readonly VisualElement Root; public readonly SimBridge Bridge; public readonly ScreenNav Nav; public readonly EventCardPresenter Card;readonly GameObject go; readonly PanelSettings ps; readonly RenderTexture rt; readonly List<System.IDisposable> owned = new List<System.IDisposable>();- public Rig(int w, int h, string eventId, bool photos = false)+ public Rig(int w, int h, string eventId, bool photos = false, UiText? text = null){+ var t = text ?? Text;rt = new RenderTexture(w, h, 0);ps = Object.Instantiate(AssetDatabase.LoadAssetAtPath<PanelSettings>(UiPaths.Panel));ps.targetTexture = rt;@@ -39,11 +40,12 @@ public class DecisionCardTestsgo.SetActive(true);Root = doc.rootVisualElement;Root.Q("root").RemoveFromClassList("loading");- Bridge = new SimBridge(Pending(eventId), Text);- owned.Add(new HudPresenter(Root, Bridge, Text));+ Root.Q("root").EnableInClassList(UiLanguage.HebrewClass, t["ui.lang"] == UiLanguage.Hebrew); // as GameRoot+ Bridge = new SimBridge(Pending(eventId), t);+ owned.Add(new HudPresenter(Root, Bridge, t));Nav = new ScreenNav(Root); owned.Add(Nav);- owned.Add(new InfoPanelPresenter(Root, Bridge, Text, C.SettlementHexes.ToDictionary(x => x.Id, x => x.Id)));- Card = new EventCardPresenter(Root, Bridge, Text, null,+ owned.Add(new InfoPanelPresenter(Root, Bridge, t, C.SettlementHexes.ToDictionary(x => x.Id, x => x.Id)));+ Card = new EventCardPresenter(Root, Bridge, t, null,photos ? AssetDatabase.LoadAssetAtPath<EventImageCatalog>("Assets/Resources/EventImageCatalog.asset") : null); owned.Add(Card);}@@ -380,4 +382,46 @@ public class DecisionCardTestsAssert.IsNull(r.Card.Shown, "the only event is answered");Assert.AreSame(r.Root.Q<Button>("end-turn"), r.Focused, "End Turn has the focus");}++ /// <summary>#849, the owner's decision of 17 October 2026 ("Hide legend under card", on desktop and phone alike;+ /// issuecomment-6233870812): while the modal decision card is open the map's legend (map-layer) is hidden, so no card,+ /// the photograph's included, covers it; Hide brings it back, Decision waiting hides it again, and answering the event+ /// brings it back. Only the legend: the minimap and the left column stay shown. Every window ArmisticeTests lists, in+ /// English and Hebrew.</summary>+ [UnityTest]+ public IEnumerator TheLegendIsHiddenWhileTheCardIsOpen()+ {+ var he = UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.StringsHebrew).text, "strings.he.yaml");+ var problems = new List<string>();+ foreach (var t in new[] { Text, he })+ foreach (var (w, h) in new[] { (1920, 1080), (1680, 1050), (1280, 720), (1531, 784), (1366, 657), (2560, 1080), (1920, 900), (1280, 1024),+ (960, 600), (1024, 768), (390, 844), (1600, 757), (1024, 1024), (960, 1080), (800, 1000) })+ {+ using var r = new Rig(w, h, "idf_founding", photos: true, text: t);+ var legend = r.Root.Q<Label>("map-layer");+ legend.text = "Held by Israel: blue"; legend.style.display = DisplayStyle.Flex; // as GameRoot shows it while borders are drawn+ yield return Frames(4);+ var where = $"{t["ui.lang"]} {w}x{h}";+ bool Seen() => legend.resolvedStyle.display == DisplayStyle.Flex && legend.resolvedStyle.visibility == Visibility.Visible;+ void Expect(bool seen, string when)+ {+ if (Seen() != seen) problems.Add($"{where}: the legend is {(seen ? "hidden" : "shown")} {when}");+ }+ if (!r.Shows("event-card")) { problems.Add($"{where}: precondition, the card shows"); continue; }+ Expect(false, "under the open card");+ foreach (var n in new[] { "minimap", "left-column" })+ if (r.Root.Q(n).resolvedStyle.visibility != Visibility.Visible || !r.Shows(n)) problems.Add($"{where}: {n} is hidden with the legend");+ Press(r.Hide);+ yield return Frames(3);+ Expect(true, "after Hide");+ Press(r.Waiting);+ yield return Frames(3);+ Expect(false, "with the card reopened");+ Press(r.FirstOption);+ yield return Frames(3);+ if (r.Card.Shown != null) problems.Add($"{where}: precondition, the option answered the event");+ Expect(true, "once the event is answered");+ }+ Assert.IsEmpty(problems, string.Join("\n", problems));+ }}diff --git a/unity/Assets/UI/Statecraft.uss b/unity/Assets/UI/Statecraft.ussindex 5433123ae..703247c78 100644--- a/unity/Assets/UI/Statecraft.uss+++ b/unity/Assets/UI/Statecraft.uss@@ -317,6 +317,11 @@ Button:disabled { color: var(--ink-dim); border-color: rgba(120, 120, 120, 0.4);/* A phone upright (three-row bar): the info panel spans the bottom left, beside the minimap, but the column is tall, so thelabel goes back above the minimap, in the column's flow. */.hud-three-row .map-layer { position: relative; right: auto; bottom: auto; align-self: flex-end; max-width: 480px; margin-bottom: 6px; }+/* While the modal decision card is open (event-modal, ScreenNav.DisableCovered) the legend is hidden: no card, the+ photograph's included, covers it, and the card keeps its full size (owner, 17 October 2026, "Hide legend under card", on+ desktop and phone alike; #849). Visibility, not display: GameRoot sets the label's display inline (borders shown or not),+ and it comes back as it was when the card is hidden or answered. Only the label: the minimap and the map stay. */+.event-modal .map-layer { visibility: hidden; }/* HUD round 2 (#398): promo 03's minimap, the painted relief picture with three round buttons beside it, in one frame. Thepicture's box is as wide as the tall picture needs at this height (MinimapPresenter fits the picture to it). */.minimap { align-self: flex-end; flex-shrink: 0; flex-direction: row; width: 222px; height: 380px; padding: 12px; background-color: rgba(9, 14, 26, 0.97); }