Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

UI: a screenshot run (?shot) hides the opening card so the captures show the map (refs #672) (#677)

Eyal Golan40825b6f6a48
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d81b55709..480249e3c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -620,6 +620,9 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIB
It decodes to the same bytes, so the terrain is unchanged (#44).
### Fixed
+- Screenshot runs (`?shot`, `-shot`; `tools/art_checkpoint.sh`) show the map again: since the GDD cutover (#600) the
+ opening card, One Army, covered it in every capture. The card, its scrim and "Decision waiting" now stay hidden in a
+ screenshot run, as the units do (`EventCardPresenter.HiddenInCaptures`); normal play and the smoke run still show it.
- In the Hebrew UI a refused order names its kind in Hebrew (refs #595; owner, 15 October 2026: "Yes, translate them"),
for example "לא ניתן לזהות מדיניות", not "policy לא מוכר". Each kind is a string, `order.kind.<kind>`, in both
strings files; English reads as before ("Unknown policy"). The Hebrew words wait for the native reviewer (#564).
diff --git a/unity/Assets/Scripts/UI/EventCardPresenter.cs b/unity/Assets/Scripts/UI/EventCardPresenter.cs
index ee97b3e18..efca83824 100644
--- a/unity/Assets/Scripts/UI/EventCardPresenter.cs
+++ b/unity/Assets/Scripts/UI/EventCardPresenter.cs
@@ -35,6 +35,8 @@ namespace Statecraft.Game.UI
/// <summary>The card was built under the start screen and it has not closed yet (issue #592): the photograph (and the
/// portrait in its place) waits for onUncovered, so a Continue with a decision waiting loads no catalog in GameRoot.Begin.</summary>
bool photoWaits;
+ /// <summary>A screenshot run (HiddenInCaptures): the card never shows, so the captures show the map.</summary>
+ readonly bool hiddenInCapture;
/// <summary>Tests: the card is waiting for the start screen to close before it looks up its photograph.</summary>
internal bool PhotoWaits => photoWaits;
readonly VisualElement band, head, scroll, options, layer, hudRoot; readonly Label credit;
@@ -68,11 +70,14 @@ namespace Statecraft.Game.UI
/// <param name="photosLater">With no <paramref name="photos"/>: gives the catalog, asked only once an event shows.</param>
/// <param name="underStartScreen">The start screen goes up over the card once it is built (GameRoot.Begin): the card
/// looks up no photograph until the screen closes, then renders again with it before it is first seen (issue #592).</param>
+ /// <param name="hiddenInCapture">A screenshot run (HiddenInCaptures): neither the card, its scrim nor "Decision
+ /// waiting" ever shows. Shown still names the event; the sim is untouched.</param>
public EventCardPresenter(VisualElement root, SimBridge bridge, UiText text, PortraitCatalog? portraits, EventImageCatalog? photos = null,
CardVideo? video = null, System.Func<string, EventVideoMapping.Row?>? clipFor = null, System.Func<EventImageCatalog?>? photosLater = null,
- bool underStartScreen = false)
+ bool underStartScreen = false, bool hiddenInCapture = false)
{
photoWaits = underStartScreen;
+ this.hiddenInCapture = hiddenInCapture;
this.video = clipFor == null ? null : video; this.clipFor = clipFor;
card = root.Q<VisualElement>("event-card"); this.bridge = bridge; this.text = text; this.portraits = portraits; this.photos = photos; this.photosLater = photosLater;
band = card.Q<VisualElement>("event-photo"); credit = card.Q<Label>("event-photo-credit");
@@ -90,7 +95,7 @@ namespace Statecraft.Game.UI
{
// The start screen has closed: the photograph now, in the same frame the card first shows (issue #592).
if (photoWaits) { photoWaits = false; if (Shown != null) Render(); }
- focusedFor = null; if (Shown != null && !Collapsed) FocusCard(Shown.Id, force: true);
+ focusedFor = null; if (!hiddenInCapture && Shown != null && !Collapsed) FocusCard(Shown.Id, force: true);
};
onHidePointer = _ => hideByPointer = true;
onHideSubmit = _ => hideByPointer = false;
@@ -116,6 +121,13 @@ namespace Statecraft.Game.UI
Render();
}
+ /// <summary>True for a screenshot run (?shot, -shot; VisualShots.Requested) that is not also a smoke run: the card is
+ /// then never shown, so the captures show the map, as before the GDD cutover opened every new game on a card. The
+ /// units are left out of the same runs (UnitLayer.HiddenInCaptures). A smoke run presses the card's options, so it
+ /// keeps the card; with no flag (normal play) the card shows.</summary>
+ public static bool HiddenInCaptures(string? url, string[] args, bool webgl) =>
+ Statecraft.Game.Map.VisualShots.Requested(url, args, webgl) && GameRoot.SmokeTurns(url, args, webgl) == 0;
+
/// <summary>Unsubscribes from the bridge, removes the option buttons and hides the card (the owner calls this when disabled).</summary>
public void Dispose()
{
@@ -178,10 +190,10 @@ namespace Statecraft.Game.UI
Shown = open.FirstOrDefault();
if (Shown == null) collapsedFor = null;
if (bridge.Session != session) { session = bridge.Session; collapsedFor = null; focusedFor = null; }
- var shown = Shown != null && !Collapsed;
+ var shown = !hiddenInCapture && Shown != null && !Collapsed;
card.style.display = shown ? DisplayStyle.Flex : DisplayStyle.None;
card.SetEnabled(shown); // a child of an undisplayed element can still take the focus (#400): a collapsed card's options must not
- reopen.style.display = Collapsed ? DisplayStyle.Flex : DisplayStyle.None;
+ reopen.style.display = !hiddenInCapture && Collapsed ? DisplayStyle.Flex : DisplayStyle.None;
hudRoot.EnableInClassList(OpenClass, shown);
ScreenNav.DisableCovered(hudRoot);
if (Shown == null || Collapsed) video?.Stop();
diff --git a/unity/Assets/Scripts/UI/GameRoot.cs b/unity/Assets/Scripts/UI/GameRoot.cs
index a525928cc..fa25a0dae 100644
--- a/unity/Assets/Scripts/UI/GameRoot.cs
+++ b/unity/Assets/Scripts/UI/GameRoot.cs
@@ -212,7 +212,10 @@ namespace Statecraft.Game.UI
EventPhotos.ScheduleOn(root);
card = Own(new EventCardPresenter(root, bridge, text, portraits, null, video,
clips == null ? null : id => clips.TryGetValue(id, out var r) ? r : null, EventPhotos.Get,
- underStartScreen: showsStart));
+ underStartScreen: showsStart,
+ // A screenshot run (?shot) captures the map: the opening card would cover it (UnitLayer.HiddenInCaptures' rule).
+ hiddenInCapture: EventCardPresenter.HiddenInCaptures(Application.absoluteURL, Environment.GetCommandLineArgs(),
+ Application.platform == RuntimePlatform.WebGLPlayer)));
// The End Turn outcome clips (decision videos, phase 3): none in the automated runs (no video there). Their own
// player, so the card's loop never takes it; an open screen closes when one starts.
outcomes = video == null ? null : Own(new OutcomePresenter(root, bridge, text, Own(new CardVideo()), mapping.outcomes,
diff --git a/unity/Assets/Tests/EditMode/EventCardTests.cs b/unity/Assets/Tests/EditMode/EventCardTests.cs
index 964b9f1fa..893299c59 100644
--- a/unity/Assets/Tests/EditMode/EventCardTests.cs
+++ b/unity/Assets/Tests/EditMode/EventCardTests.cs
@@ -237,4 +237,43 @@ public class EventCardTests
Assert.AreEqual(DisplayStyle.None, ui.Q<VisualElement>("event-photo").style.display.value);
Assert.AreEqual(portraits.Get("ben_gurion"), ui.Q<VisualElement>("event-image").style.backgroundImage.value.texture);
}
+ /// <summary>A screenshot run (?shot, -shot) captures the map, so the opening card (One Army, waiting on every new game
+ /// since the GDD cutover) must not cover it, as the units are left out (UnitLayer.HiddenInCaptures). A smoke run
+ /// presses the card's options, so it keeps the card even with shot; every other run, normal play first, shows it.</summary>
+ [Test]
+ public void AScreenshotRunHidesTheCardAndOnlyIt()
+ {
+ Assert.IsTrue(EventCardPresenter.HiddenInCaptures("https://x/?shot", new string[0], true));
+ Assert.IsTrue(EventCardPresenter.HiddenInCaptures("https://x/?golden&shot", new string[0], true), "tools/art_checkpoint.sh's query");
+ Assert.IsTrue(EventCardPresenter.HiddenInCaptures("https://x/?golden&shot&units", new string[0], true), "the unit slice's shots too");
+ Assert.IsTrue(EventCardPresenter.HiddenInCaptures(null, new[] { "player", "-shot" }, false));
+ Assert.IsFalse(EventCardPresenter.HiddenInCaptures("https://x/", new string[0], true), "normal play shows the card");
+ Assert.IsFalse(EventCardPresenter.HiddenInCaptures(null, new string[0], true), "no URL: normal play");
+ Assert.IsFalse(EventCardPresenter.HiddenInCaptures(null, new[] { "player" }, false));
+ Assert.IsFalse(EventCardPresenter.HiddenInCaptures("https://x/?golden", new string[0], true));
+ Assert.IsFalse(EventCardPresenter.HiddenInCaptures("https://x/?vprofile", new string[0], true), "the frame profile prices the card");
+ Assert.IsFalse(EventCardPresenter.HiddenInCaptures("https://x/?screenshot=1", new string[0], true), "a whole parameter only");
+ Assert.IsFalse(EventCardPresenter.HiddenInCaptures("https://x/?smoke=5&shot", new string[0], true), "a smoke run presses the card");
+ Assert.IsFalse(EventCardPresenter.HiddenInCaptures(null, new[] { "player", "-smoke", "5", "-shot" }, false));
+ }
+
+ [Test]
+ public void AHiddenCardLeavesTheMapClearAndANormalOneCoversIt()
+ {
+ foreach (var hidden in new[] { true, false })
+ {
+ using var ui = new UiTestKit();
+ var bridge = new SimBridge(GameSession.New(C, GoldenRun.Seed, Mode.Historical), Text);
+ var card = new EventCardPresenter(ui.Root, bridge, Text, null, hiddenInCapture: hidden);
+ var hud = ui.Root.Q("root") ?? ui.Root;
+ Assert.AreEqual("idf_founding", card.Shown?.Id, "a new game opens on One Army either way: the sim is untouched");
+ Assert.AreEqual(hidden ? DisplayStyle.None : DisplayStyle.Flex, ui.Q<VisualElement>("event-card").style.display.value, $"hidden {hidden}");
+ Assert.AreEqual(!hidden, hud.ClassListContains(EventCardPresenter.OpenClass), $"the scrim, hidden {hidden}");
+ Assert.AreEqual(DisplayStyle.None, ui.Q<Button>("event-reopen").style.display.value, "no Decision waiting button");
+ card.Render(); // a later render (any bridge change) keeps it so
+ Assert.AreEqual(hidden ? DisplayStyle.None : DisplayStyle.Flex, ui.Q<VisualElement>("event-card").style.display.value, $"re-rendered, hidden {hidden}");
+ Assert.AreEqual(!hidden, hud.ClassListContains(EventCardPresenter.OpenClass));
+ card.Dispose();
+ }
+ }
}