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: playtest B5-B11: decision plural, named city blocks, jobs cost at End turn, portrait plays Watch, Escape closes the card, links open on release, 1512x982 wrapping (#1650)

Eyal Golan7f05540043d7
diff --git a/changelog.d/playtest-b5-b11.md b/changelog.d/playtest-b5-b11.md
new file mode 100644
index 000000000..6f311484f
--- /dev/null
+++ b/changelog.d/playtest-b5-b11.md
@@ -0,0 +1,6 @@
+### Fixed
+- Playtest follow-ups: "1 more decision waiting" in the singular; a hex with two cities names each city's block; the jobs
+ stepper shows its Attention price and that the change takes effect at End turn; a click on an advisor's portrait plays
+ its clip, as Watch does; Escape closes the unit card or the hex panel; Star on GitHub, Report a bug and the share links
+ open only when the press is released over the same button; at 1512x982 the top bar keeps "International support" on
+ one line and the unit card keeps Move, Fortify and Hold together.
diff --git a/unity/Assets/Scripts/UI/AdvisorPresenter.cs b/unity/Assets/Scripts/UI/AdvisorPresenter.cs
index f9e3a57b3..6a9de17b0 100644
--- a/unity/Assets/Scripts/UI/AdvisorPresenter.cs
+++ b/unity/Assets/Scripts/UI/AdvisorPresenter.cs
@@ -50,6 +50,7 @@ namespace Statecraft.Game.UI
readonly Label mediaLabel, mediaCredit, overlayCaption, overlayLabel, overlayCredit;
readonly Button watch, overlayClose;
readonly Action onWatch, onOverlayClose;
+ readonly EventCallback<ClickEvent> onPortraitClick;
readonly EventCallback<GeometryChangedEvent> onMediaGeometry;
string watchScreens = "";
VisualElement? mediaOpener;
@@ -125,6 +126,14 @@ namespace Statecraft.Game.UI
hudRoot.RegisterCallback(onMediaGeometry); mediaPicture.RegisterCallback(onMediaGeometry); overlayPicture.RegisterCallback(onMediaGeometry);
portrait = popup.Q<VisualElement>("advisor-portrait");
+ onPortraitClick = e =>
+ {
+ if (e.target is VisualElement target && (target == watch || watch.Contains(target))) return; // the strip already ran onWatch
+ if (e.button != 0 || !portrait.enabledInHierarchy || !Watchable(Shown?.Media) || Shown?.ApprovedIn(hebrew) != true || HardMediaCover()) return;
+ watchStoppedOnPress = false;
+ onWatch(); e.StopPropagation();
+ };
+ portrait.RegisterCallback(onPortraitClick);
name = popup.Q<Label>("advisor-name"); role = popup.Q<Label>("advisor-role");
words = popup.Q<Label>("advisor-text"); count = popup.Q<Label>("advisor-count");
quote = popup.Q<Label>("advisor-quote"); quoteSource = popup.Q<Label>("advisor-quote-source");
@@ -729,6 +738,7 @@ namespace Statecraft.Game.UI
disposed = true;
StopWatching(); Media?.Dispose();
watch.clicked -= onWatch; overlayClose.clicked -= onOverlayClose;
+ portrait.UnregisterCallback(onPortraitClick);
hudRoot.UnregisterCallback(onMediaGeometry); mediaPicture.UnregisterCallback(onMediaGeometry); overlayPicture.UnregisterCallback(onMediaGeometry);
hudRoot.UnregisterCallback(onMediaPointer, TrickleDown.TrickleDown); hudRoot.UnregisterCallback(onMediaSubmit, TrickleDown.TrickleDown);
overlay.UnregisterCallback(onMediaCancel);
diff --git a/unity/Assets/Scripts/UI/EventCardPresenter.cs b/unity/Assets/Scripts/UI/EventCardPresenter.cs
index 319cd6684..04871d9c9 100644
--- a/unity/Assets/Scripts/UI/EventCardPresenter.cs
+++ b/unity/Assets/Scripts/UI/EventCardPresenter.cs
@@ -165,13 +165,15 @@ namespace Statecraft.Game.UI
/// <summary>Hide: the card gives the map back and waits behind the "Decision waiting" button, which takes the focus.</summary>
public void Collapse() => Collapse(takeFocus: true);
+ int collapsedAt = -1;
+ internal bool CollapsedThisFrame => collapsedAt == UnityEngine.Time.frameCount;
/// <summary>Hide; with <paramref name="takeFocus"/> false "Decision waiting" leaves the focus where it is (the
/// advisor opening chain hides the card while its popup has the focus).</summary>
public void Collapse(bool takeFocus)
{
if (Shown == null) return;
- collapsedFor = Shown.Id;
+ collapsedFor = Shown.Id; collapsedAt = UnityEngine.Time.frameCount;
Render();
if (!takeFocus) return;
if (hideByPointer) { hideByPointer = false; return; }
@@ -289,7 +291,7 @@ namespace Statecraft.Game.UI
rejoin.AddToClassList("muted"); rejoin.AddToClassList(RejoinClass);
options.Add(rejoin);
}
- card.Q<Label>("event-count").text = open.Count > 1 ? text.Format("event.more", open.Count - 1) : "";
+ card.Q<Label>("event-count").text = open.Count > 1 ? text.Format(open.Count == 2 ? "event.more_one" : "event.more", open.Count - 1) : "";
if (shown && !photoWaits && layer.enabledInHierarchy && openedFor != e.Id) { openedFor = e.Id; Opened?.Invoke(e.Id); }
if (shown && focusedFor != e.Id) FocusCard(e.Id, force: false);
}
diff --git a/unity/Assets/Scripts/UI/ExternalLink.cs b/unity/Assets/Scripts/UI/ExternalLink.cs
index b1f26b05d..370d734b7 100644
--- a/unity/Assets/Scripts/UI/ExternalLink.cs
+++ b/unity/Assets/Scripts/UI/ExternalLink.cs
@@ -8,10 +8,9 @@ namespace Statecraft.Game.UI
/// <summary>Opens a web page outside the game (#1168: the "Star on GitHub" buttons in Settings and on the start screen).
/// On WebGL a browser lets a page open a new tab only inside the player's own click or key event, and Unity handles
/// input on the next frame, outside it, so Application.OpenURL there can be popup-blocked. ExternalLink.jslib instead
- /// arms a one-shot listener for the press's release (pointerup on #unity-canvas, or keyup), which calls window.open
- /// inside that real gesture. That is why Bind opens on the press (pointer down, or the keyboard's Submit, which comes on
- /// key down) and not on `clicked`, which comes on the release, too late to arm anything; so a press dragged off the
- /// button still opens the page. In the editor and in desktop builds Open falls back to Application.OpenURL.</summary>
+ /// arms a one-shot listener on the press, which calls window.open on the release inside that real gesture, and only
+ /// when the pointer is released over the same button (playtest B10: a press dragged off it cancels, as on any button).
+ /// In the editor and in desktop builds the page opens on `clicked`, which Clickable gives only for a completed click.</summary>
public static class ExternalLink
{
/// <summary>The game's repository, which the Star buttons open.</summary>
@@ -19,28 +18,65 @@ namespace Statecraft.Game.UI
/// <summary>What Open does with the URL. Tests put a recorder here (and put Default back), so no browser opens.</summary>
public static Action<string> Opener = Default;
-
public static void Open(string url) => Opener(url);
- /// <summary>Opens <paramref name="url"/> when the button is pressed with the primary pointer or the keyboard's Submit.
- /// The returned action unwires it (a presenter's Dispose).</summary>
+ /// <summary>Pointer-down only arms WebGL. Native/editor and test recorders open on clicked, after Clickable has
+ /// accepted the release. Keyboard Submit arms its own Enter/Space key-up on WebGL. Dispose cancels a pending arm.</summary>
public static Action Bind(Button button, string url)
{
- EventCallback<PointerDownEvent> onPointer = e => { if (e.button == 0) Open(url); };
- EventCallback<NavigationSubmitEvent> onSubmit = _ => Open(url);
- // TrickleDown: runs before the button's Clickable, whatever it does with the event.
+#if UNITY_WEBGL && !UNITY_EDITOR
+ int ticket = 0;
+#endif
+ void Cancel()
+ {
+#if UNITY_WEBGL && !UNITY_EDITOR
+ if (Opener == (Action<string>)Default && ticket != 0) StatecraftCancelExternalLink(ticket);
+#endif
+ }
+ void Arm(bool keyboard)
+ {
+ if (!button.enabledInHierarchy) return;
+#if UNITY_WEBGL && !UNITY_EDITOR
+ if (Opener != (Action<string>)Default) return;
+ var frame = button.panel?.visualTree.worldBound ?? default;
+ if (!(frame.width > 0f && frame.height > 0f)) return;
+ var r = button.worldBound;
+ ticket = StatecraftOpenOnRelease(url, (r.xMin - frame.xMin) / frame.width, (r.yMin - frame.yMin) / frame.height,
+ (r.xMax - frame.xMin) / frame.width, (r.yMax - frame.yMin) / frame.height, keyboard ? 1 : 0);
+#endif
+ }
+ EventCallback<PointerDownEvent> onPointer = e => { if (e.button == 0) Arm(false); };
+ EventCallback<NavigationSubmitEvent> onSubmit = _ => Arm(true);
+ EventCallback<PointerCancelEvent> onCancel = _ => Cancel();
+ EventCallback<FocusOutEvent> onBlur = _ => Cancel();
+ EventCallback<GeometryChangedEvent> onGeometry = _ => Cancel();
+ Action onClick = () =>
+ {
+ if (!button.enabledInHierarchy) return;
+#if UNITY_WEBGL && !UNITY_EDITOR
+ if (Opener == (Action<string>)Default) return; // the real browser release already handled this activation
+#endif
+ Open(url);
+ };
button.RegisterCallback(onPointer, TrickleDown.TrickleDown);
button.RegisterCallback(onSubmit, TrickleDown.TrickleDown);
+ button.RegisterCallback(onCancel); button.RegisterCallback(onBlur); button.RegisterCallback(onGeometry);
+ button.clicked += onClick;
return () =>
{
+ Cancel();
button.UnregisterCallback(onPointer, TrickleDown.TrickleDown);
button.UnregisterCallback(onSubmit, TrickleDown.TrickleDown);
+ button.UnregisterCallback(onCancel); button.UnregisterCallback(onBlur); button.UnregisterCallback(onGeometry);
+ button.clicked -= onClick;
};
}
#if UNITY_WEBGL && !UNITY_EDITOR
- [System.Runtime.InteropServices.DllImport("__Internal")] static extern void StatecraftOpenOnRelease(string url);
- public static void Default(string url) => StatecraftOpenOnRelease(url);
+ [System.Runtime.InteropServices.DllImport("__Internal")] static extern int StatecraftOpenOnRelease(string url, float left, float top, float right, float bottom, int keyboard);
+ [System.Runtime.InteropServices.DllImport("__Internal")] static extern void StatecraftCancelExternalLink(int ticket);
+ // A caller without a button can only request a keyboard activation, never the next unrelated pointer release.
+ public static void Default(string url) { StatecraftOpenOnRelease(url, 0f, 0f, 1f, 1f, 1); }
#else
public static void Default(string url) => Application.OpenURL(url);
#endif
diff --git a/unity/Assets/Scripts/UI/ExternalLink.jslib b/unity/Assets/Scripts/UI/ExternalLink.jslib
index b906f356d..760b0f276 100644
--- a/unity/Assets/Scripts/UI/ExternalLink.jslib
+++ b/unity/Assets/Scripts/UI/ExternalLink.jslib
@@ -1,34 +1,60 @@
// Opens a URL in a new tab inside the player's own gesture (#1168, ExternalLink.cs). Unity handles a press on the next
// frame, outside the browser's event, where window.open is popup-blocked; so a press arms a one-shot listener for its
-// release (pointerup on the canvas, or keyup for the keyboard's Enter / Space), and the release opens the tab.
-// Whichever comes first opens it and removes both; a second keyboard or gamepad press before the release only replaces
-// the URL (a canvas press disarms first, see below). A release that never reaches the listener (a quick tap whose
-// pointerup beat the next frame, a release off the canvas, a gamepad's Submit) would leave it armed for an unrelated
-// later click, so it disarms itself after 1.5 s and opens nothing then, and a new press on the canvas (pointerdown)
-// disarms it at once: a tap shorter than a frame is released before Unity arms the listener, and the next click
-// anywhere would otherwise open the tab. A press on the button itself arms it again on the next frame, after its own
-// pointerdown.
+// release, and the release opens the tab. A pointer press opens only on the primary pointer's release inside the
+// button's rectangle (left/top/right/bottom: fractions of the canvas), so a press dragged off the button cancels, as a
+// native button does (playtest B10); a keyboard press opens on Enter or Space's keyup. A release that never reaches the
+// listener (a tap shorter than a frame, a release off the canvas) would leave it armed, so it disarms after 1.5 s, on a
+// new canvas press, Escape, blur, resize or a hidden tab, and when Unity cancels its ticket (focus out, Dispose).
mergeInto(LibraryManager.library, {
- StatecraftOpenOnRelease: function (urlPtr) {
+ StatecraftCancelExternalLink: function (ticket) {
+ if (typeof window !== "undefined" && window.statecraftOpenOnRelease && window.statecraftOpenOnRelease.id === ticket) window.statecraftOpenOnRelease.cancel();
+ },
+ StatecraftOpenOnRelease: function (urlPtr, left, top, right, bottom, keyboard) {
+ if (typeof window === "undefined") return 0;
var url = UTF8ToString(urlPtr);
- if (typeof window === "undefined") return;
- var armed = window.statecraftOpenOnRelease;
- if (armed) { armed.url = url; return; }
- var canvas = document.querySelector("#unity-canvas") || document;
- armed = window.statecraftOpenOnRelease = { url: url };
+ if (window.statecraftOpenOnRelease) window.statecraftOpenOnRelease.cancel();
+ var canvas = document.querySelector("#unity-canvas");
+ if (!canvas) return 0;
+ var id = window.statecraftExternalLinkSerial = (window.statecraftExternalLinkSerial || 0) + 1;
var timer;
var disarm = function () {
clearTimeout(timer);
- canvas.removeEventListener("pointerup", open);
+ canvas.removeEventListener("pointerup", release);
canvas.removeEventListener("pointerdown", disarm);
- document.removeEventListener("keyup", open);
- window.statecraftOpenOnRelease = null;
+ canvas.removeEventListener("pointercancel", disarm);
+ document.removeEventListener("keyup", release);
+ document.removeEventListener("keydown", escape);
+ document.removeEventListener("visibilitychange", disarm);
+ window.removeEventListener("blur", disarm);
+ window.removeEventListener("resize", disarm);
+ if (window.statecraftOpenOnRelease && window.statecraftOpenOnRelease.id === id) window.statecraftOpenOnRelease = null;
+ };
+ var escape = function (e) { if (e.key === "Escape") disarm(); };
+ var release = function (e) {
+ var valid = false;
+ if (keyboard) {
+ if (e.type !== "keyup" || (e.key !== "Enter" && e.key !== " " && e.key !== "Spacebar")) return;
+ valid = true;
+ } else {
+ if (e.type !== "pointerup" || e.isPrimary === false || e.button !== 0) return;
+ var r = canvas.getBoundingClientRect();
+ var x = (e.clientX - r.left) / r.width, y = (e.clientY - r.top) / r.height;
+ valid = r.width > 0 && r.height > 0 && x >= left && x < right && y >= top && y < bottom;
+ }
+ disarm();
+ if (valid) window.open(url, "_blank", "noopener");
};
- var open = function () { disarm(); window.open(armed.url, "_blank", "noopener"); };
- canvas.addEventListener("pointerup", open);
+ window.statecraftOpenOnRelease = { cancel: disarm, id: id };
+ canvas.addEventListener("pointerup", release);
canvas.addEventListener("pointerdown", disarm);
- document.addEventListener("keyup", open);
+ canvas.addEventListener("pointercancel", disarm);
+ document.addEventListener("keyup", release);
+ document.addEventListener("keydown", escape);
+ document.addEventListener("visibilitychange", disarm);
+ window.addEventListener("blur", disarm);
+ window.addEventListener("resize", disarm);
timer = setTimeout(disarm, 1500);
+ return id;
},
// The bug form's platform line (#1169, ReportLinks.Environment): the browser's user agent and screen size, nothing else.
StatecraftBrowserEnv: function () {
diff --git a/unity/Assets/Scripts/UI/GameRoot.cs b/unity/Assets/Scripts/UI/GameRoot.cs
index 3e7fe4481..8ccc0a50f 100644
--- a/unity/Assets/Scripts/UI/GameRoot.cs
+++ b/unity/Assets/Scripts/UI/GameRoot.cs
@@ -310,7 +310,7 @@ namespace Statecraft.Game.UI
// Star, Report and Share as round icons at the map screen's bottom left (#1236): the same actions as Settings' buttons.
Own(new CommunityIconsPresenter(root, text, feedbackPanel, sharePanel));
// Both panels in one hook: the same Escape never closes the screen under the panel too.
- nav!.TakesEscape = () => feedbackPanel.Escape() || sharePanel.Escape() || advisor?.CloseOverlay() == true || advisor?.OverlayClosedThisFrame == true || advisor?.Escape() == true;
+ nav!.TakesEscape = () => feedbackPanel.Escape() || sharePanel.Escape() || advisor?.CloseOverlay() == true || advisor?.OverlayClosedThisFrame == true || advisor?.Escape() == true || this.info?.Escape() == true; // the field: the panel is made below
var names = map.SettlementsFor(inputs.Map.SettlementsYaml).ToDictionary(s => s.Id, s => s.Name); // the map's parse (issue #321)
// The capture dialog (GDD Phase 6 PR 10, #802): in the decision layer, after the card, which goes first; the
// places' Hebrew names from the same parse.
@@ -378,7 +378,7 @@ namespace Statecraft.Game.UI
showReachable: map.ShowReachable,
unitName: id => unitLayer.Tokens.Where(p => UnitCard.SimUnit(bridge.Content, bridge.State, p.Token) == id)
.Select(p => UnitCard.For(p, bridge.State, text, bridge.Content.IsGdd, bridge.Content, townNamesHe).Title).FirstOrDefault(),
- unitDone: FocusNextUnit, showRoute: map.ShowRoute));
+ unitDone: FocusNextUnit, showRoute: map.ShowRoute, clearSelection: () => { unitLayer.Select(null); map.ClearSelection(); }));
toast.Units = unitData; toast.TownNamesHe = townNamesHe; why.TownNamesHe = townNamesHe;
// A smoke session never touches the player's save: no autosave, and no New Game (which deletes the autosave).
// Leaving New Game out is safer than handing it a throwaway store: no file is ever deleted, no path has to be
@@ -867,7 +867,20 @@ namespace Statecraft.Game.UI
// which shows only while the card does not.
// The report panel (#1169) and the share panel (#1170) are over everything: their Escape goes no further.
// Nor does the advisors' popup's, with the focus inside it (AdvisorPresenter.Escape, also in the frame its Cancel closed it).
- if (UnityEngine.InputSystem.Keyboard.current?.escapeKey.wasPressedThisFrame == true && feedback?.Escape() != true && share?.Escape() != true && advisor?.Escape() != true) { bool done = outcomes?.SkipAll() == true || outcomes?.ClosedThisFrame == true; if (!done) done = advisor?.CloseOverlay() == true || advisor?.OverlayClosedThisFrame == true; if (!done) done = end?.Close() == true || end?.ClosedThisFrame == true; if (!done) done = report?.Close() == true || report?.ClosedThisFrame == true; done |= start?.Escape() == true; done |= nav?.Close() == true; if (!done && document.rootVisualElement.focusController?.focusedElement == null && capture?.Escape() != true) card?.Escape(); }
+ if (UnityEngine.InputSystem.Keyboard.current?.escapeKey.wasPressedThisFrame == true
+ && feedback?.Escape() != true && share?.Escape() != true && advisor?.Escape() != true)
+ {
+ bool done = outcomes?.SkipAll() == true || outcomes?.ClosedThisFrame == true;
+ if (!done) done = advisor?.CloseOverlay() == true || advisor?.OverlayClosedThisFrame == true;
+ if (!done) done = end?.Close() == true || end?.ClosedThisFrame == true;
+ if (!done) done = report?.Close() == true || report?.ClosedThisFrame == true;
+ done |= start?.Escape() == true;
+ done |= nav?.Close() == true;
+ // A screen/card that consumed this Cancel must not also dismiss the map selection in this frame.
+ if (!done && nav?.ClosedThisFrame != true && document.rootVisualElement.focusController?.focusedElement == null
+ && capture?.Escape() != true && card?.Escape() != true && card?.CollapsedThisFrame != true)
+ info?.Escape();
+ }
// PageUp, PageDown, Home and End, with no modifier, scroll the open screen or the open card's text, with or without
// focus (KeyScroll; accessibility audit H3), but not under an End Turn outcome clip, which covers them. The arrows
// stay with the camera (NavigationGuard, B6).
diff --git a/unity/Assets/Scripts/UI/GddHexPanel.cs b/unity/Assets/Scripts/UI/GddHexPanel.cs
index cc8d688d4..69cd6cdcf 100644
--- a/unity/Assets/Scripts/UI/GddHexPanel.cs
+++ b/unity/Assets/Scripts/UI/GddHexPanel.cs
@@ -31,6 +31,8 @@ namespace Statecraft.Game.UI
/// <summary>On the city's own hex, on a stacked bar or a short window, the project part folds behind this toggle
/// ("City projects (N)") and the list it opens (owner ruling on #1150, 21 Oct 2026; Statecraft.uss .city-projects-list).</summary>
public const string ToggleName = "city-projects-toggle", ListName = "city-projects-list", OpenClass = "info-projects-open";
+ /// <summary>The name over each city's block on a hex that holds two (Statecraft.uss).</summary>
+ public const string CityNameClass = "city-part-name";
const string LineClass = "info-gdd-line", RowClass = "info-gdd-row", PairsClass = "info-gdd-pairs";
public static void Hide(VisualElement host) { host.Clear(); host.style.display = DisplayStyle.None; }
@@ -45,8 +47,16 @@ namespace Statecraft.Game.UI
string? title = null;
if (c.IsGdd)
{
- foreach (var at in c.SettlementHexes.Where(x => x.Q == q && x.R == r && s.Cities.ContainsKey(x.Id)))
- City(host, bridge, text, at.Id);
+ // A hex with two cities (Rishon LeZion and Rehovot) shows two stat blocks: each gets its own part, named, so the
+ // player can tell whose jobs stepper is whose (playtest B6). One city's block needs no name: the title has it.
+ var cities = c.SettlementHexes.Where(x => x.Q == q && x.R == r && s.Cities.ContainsKey(x.Id)).ToList();
+ foreach (var at in cities)
+ {
+ var part = new VisualElement { name = "city-part-" + at.Id };
+ host.Add(part);
+ if (cities.Count > 1) Line(part, "city-name", townName(at.Id)).AddToClassList(CityNameClass);
+ City(part, bridge, text, at.Id);
+ }
var cityHere = host.childCount > 0;
// A hex may hold two sites, a yishuv or the Hula swamp and the field it readies (R-FIELD-001, R-SWAMP-001): each
// gets its own part, the one to finish first on top, and its name is the title (#1124).
@@ -106,8 +116,11 @@ namespace Statecraft.Game.UI
var max = Cities.MaxWorkers(s, id, bridge.Queued);
var workers = Row(host, "city-workers-row");
Button(workers, "city-workers-less", "−", () => Workers(bridge, id, city.Employed, target - 1)).SetEnabled(target > 0);
- Line(workers, "city-workers", text.Format("city.workers", Groups(text, target)));
+ Line(workers, "city-workers", text.Format(queued == null ? "city.workers" : "city.workers_ordered", Groups(text, target)));
Button(workers, "city-workers-more", "+", () => Workers(bridge, id, city.Employed, target + 1)).SetEnabled(target < max);
+ // The Assign order's Attention price (the queue's, at this turn's start) and when it applies (playtest B7): the
+ // Jobs line stays the sim's actual count until End turn. Changing a queued target does not buy another order.
+ Line(host, "city-workers-cost", text.Format("city.workers_cost", bridge.Price(new AssignWorkers(id, "job", target))));
// Train, for each facility the city has (Training.HasFacility: its own, D-D5, or a built camp site's, R-CAMP-001):
// each press orders one more group; R-TRAIN-001 takes only civilians without work, and the sim counts every track's
diff --git a/unity/Assets/Scripts/UI/HudPresenter.cs b/unity/Assets/Scripts/UI/HudPresenter.cs
index 522388303..f8f3315cb 100644
--- a/unity/Assets/Scripts/UI/HudPresenter.cs
+++ b/unity/Assets/Scripts/UI/HudPresenter.cs
@@ -35,6 +35,8 @@ namespace Statecraft.Game.UI
/// (promo 03's 6.5%) holds seven values and their changes side by side with the icons.</summary>
public const float NarrowBelowPx = 1860f;
public const string NarrowClass = "hud-narrow";
+ /// <summary>The noncompact stacked tier has room for natural-width resource captions (laptop playtest).</summary>
+ public const string CaptionLineClass = "top-bar--caption-line";
/// <summary>Below this width the meters also drop their icons (Statecraft.uss .top-bar--compact): a square window does not
/// have the room for them on the stacked bar.</summary>
public const float CompactBelowPx = 1640f;
@@ -207,6 +209,7 @@ namespace Statecraft.Game.UI
dateRow?.parent?.UnregisterCallback<GeometryChangedEvent>(OnPlateGeometry);
foreach (var m in meters) m.UnregisterCallback<GeometryChangedEvent>(OnMeterGeometry);
bar.RemoveFromClassList(RoomyClass);
+ bar.RemoveFromClassList(CaptionLineClass);
bar.RemoveFromClassList(CompactClass); hudRoot.RemoveFromClassList(NarrowClass); hudRoot.RemoveFromClassList(TwoRowClass); hudRoot.RemoveFromClassList(ThreeRowClass);
ScreenNav.DisableCovered(hudRoot);
}
@@ -444,6 +447,7 @@ namespace Statecraft.Game.UI
var tierWidth = raised ? width - FloorGrowth() : width; // the owner's text floor needs room (#624)
bar.EnableInClassList(CompactClass, tierWidth < CompactBelowPx);
hudRoot.EnableInClassList(NarrowClass, tierWidth < NarrowBelowPx || raised && smallTextSize > OneRowSmallMaxPx);
+ bar.EnableInClassList(CaptionLineClass, hudRoot.ClassListContains(NarrowClass) && !bar.ClassListContains(CompactClass));
captionFitWrap = raised && width >= TwoRowBelowPx && bar.ClassListContains(CompactClass) && CaptionsNeedAnotherRow(width);
hudRoot.EnableInClassList(TwoRowClass, width < TwoRowBelowPx || captionFitWrap);
hudRoot.EnableInClassList(ThreeRowClass, width < ThreeRowBelowPx);
diff --git a/unity/Assets/Scripts/UI/InfoPanelPresenter.cs b/unity/Assets/Scripts/UI/InfoPanelPresenter.cs
index a4db3ee16..e79171a6e 100644
--- a/unity/Assets/Scripts/UI/InfoPanelPresenter.cs
+++ b/unity/Assets/Scripts/UI/InfoPanelPresenter.cs
@@ -17,6 +17,9 @@ namespace Statecraft.Game.UI
/// and Send home after the unit's front signs its armistice (#1309).</summary>
public sealed class InfoPanelPresenter : System.IDisposable
{
+ readonly System.Action? clearSelection;
+ readonly EventCallback<NavigationCancelEvent> onCancel;
+
/// <summary>The class of a fact row (Game.uxml): a sign, then the fact's line; hidden while the line is empty.</summary>
public const string RowClass = "info-row";
/// <summary>On the panel while it shows a unit's card: the rows keep their lines but drop the hex signs (Statecraft.uss).</summary>
@@ -90,9 +93,12 @@ namespace Statecraft.Game.UI
System.Func<string, (int q, int r)>? townHex = null, IReadOnlyDictionary<string, string>? townNamesHe = null,
System.Action<IReadOnlyCollection<(int q, int r)>>? showReachable = null, System.Func<int, string?>? unitName = null,
System.Action? unitDone = null,
- System.Action<IReadOnlyList<(int q, int r, int turn)>>? showRoute = null)
+ System.Action<IReadOnlyList<(int q, int r, int turn)>>? showRoute = null, System.Action? clearSelection = null)
{
panel = root.Q<VisualElement>("info-panel"); this.bridge = bridge; this.text = text;
+ this.clearSelection = clearSelection;
+ onCancel = e => { if (!e.isPropagationStopped && Escape()) e.StopPropagation(); };
+ panel.RegisterCallback(onCancel);
this.settlementNames = settlementNames; this.regions = regions; this.localitiesAt = localitiesAt; this.townHex = townHex;
this.townNamesHe = townNamesHe;
title = panel.Q<Label>("info-title"); subtitle = panel.Q<Label>("info-subtitle"); region = panel.Q<Label>("info-region"); settlements = panel.Q<Label>("info-settlements");
@@ -147,7 +153,7 @@ namespace Statecraft.Game.UI
void OnHudGeometry(GeometryChangedEvent e) => panel.EnableInClassList(ShortClass, e.newRect.height < ShortBelowPx);
/// <summary>Unsubscribes from the bridge and the buttons (the owner calls this when disabled).</summary>
- public void Dispose() { presses.Dispose(); bridge.Changed -= Render; panel.parent?.UnregisterCallback<GeometryChangedEvent>(OnHudGeometry); campButton.clicked -= onCamp; housingButton.clicked -= onHousing; defenceButton.clicked -= onDefence; moveButton.clicked -= onMove; fortifyButton.clicked -= onFortify; holdButton.clicked -= onHold; attackButton.clicked -= onAttack; sendHomeButton.clicked -= onSendHome; skipButton.clicked -= onSkip; reinforceButton.clicked -= onReinforce; EndPick(); }
+ public void Dispose() { panel.UnregisterCallback(onCancel); presses.Dispose(); bridge.Changed -= Render; panel.parent?.UnregisterCallback<GeometryChangedEvent>(OnHudGeometry); campButton.clicked -= onCamp; housingButton.clicked -= onHousing; defenceButton.clicked -= onDefence; moveButton.clicked -= onMove; fortifyButton.clicked -= onFortify; holdButton.clicked -= onHold; attackButton.clicked -= onAttack; sendHomeButton.clicked -= onSendHome; skipButton.clicked -= onSkip; reinforceButton.clicked -= onReinforce; EndPick(); }
/// <summary>Below this window height (logical px; 1366x657 is about 998) the panel gets ShortClass, and the city's own
/// hex folds its projects behind their toggle as on a stacked bar (GddHexPanel.ToggleName): there the full list ran into
@@ -155,6 +161,20 @@ namespace Statecraft.Game.UI
public const float ShortBelowPx = 1040f;
public const string ShortClass = "info-short";
+ /// <summary>Escape dismisses a reachable selection and its pick, without queuing an order (playtest B9). Covers keep
+ /// priority. Focus on one of the panel's controls, which the clear hides, goes to the map stop (as after a press, #41).</summary>
+ public bool Escape()
+ {
+ var hud = panel.parent;
+ if (Covered || !panel.enabledInHierarchy || hud?.ClassListContains(ScreenNav.ScreenOpenClass) == true
+ || (Selected == null && !ShowsUnit)) return false;
+ var focused = panel.panel?.focusController?.focusedElement as VisualElement;
+ bool inside = focused != null && (focused == panel || panel.Contains(focused));
+ Clear(); clearSelection?.Invoke();
+ if (inside) FocusReturn.To(mapFocus);
+ return true;
+ }
+
public (int q, int r)? Selected { get; private set; }
/// <summary>True while the panel shows a unit's card.</summary>
diff --git a/unity/Assets/Scripts/UI/ScreenNav.cs b/unity/Assets/Scripts/UI/ScreenNav.cs
index 951d3d83b..eb9549c92 100644
--- a/unity/Assets/Scripts/UI/ScreenNav.cs
+++ b/unity/Assets/Scripts/UI/ScreenNav.cs
@@ -271,6 +271,8 @@ namespace Statecraft.Game.UI
/// goes to the screen's top-bar button, so the next Tab carries on from there (#41 M1); an open decision card
/// takes it instead (EventCardPresenter, when its cover closes).</summary>
public bool Close() => Close(handFocus: true);
+ int closedFrame = -1;
+ public bool ClosedThisFrame => closedFrame == UnityEngine.Time.frameCount;
/// <param name="handFocus">False when the screen's X was pressed with the pointer: the focus is not handed on.</param>
bool Close(bool handFocus)
@@ -279,7 +281,7 @@ namespace Statecraft.Game.UI
var screen = root.Q<VisualElement>("screen-" + Current); var button = root.Q<Button>("nav-" + Current);
var focused = root.panel?.focusController?.focusedElement as VisualElement;
var inside = focused != null && (focused == screen || screen.Contains(focused));
- Open(null);
+ Open(null); closedFrame = UnityEngine.Time.frameCount;
if (handFocus && inside && !(root.Q("root") ?? root).ClassListContains(EventCardPresenter.ModalClass)) FocusReturn.To(button);
return true;
}
diff --git a/unity/Assets/Tests/EditMode/AdvisorMediaTests.cs b/unity/Assets/Tests/EditMode/AdvisorMediaTests.cs
index cb8f48efa..2e7f101a6 100644
--- a/unity/Assets/Tests/EditMode/AdvisorMediaTests.cs
+++ b/unity/Assets/Tests/EditMode/AdvisorMediaTests.cs
@@ -562,4 +562,34 @@ public class AdvisorMediaTests
static bool Inside(Rect inner, Rect outer) =>
inner.xMin >= outer.xMin - 0.5f && inner.xMax <= outer.xMax + 0.5f && inner.yMin >= outer.yMin - 0.5f && inner.yMax <= outer.yMax + 0.5f;
+ [Test]
+ public void ClickingThePortraitUsesTheSameWatchAction()
+ {
+ using var rig = new AdvisorPopupTests.Rig(catalog: TeachWith("{ picture: x.mp4, narration: { en: t.en.wav }, cues: { en: [0, 2.5] }, label: advisor.media_label }"), text: Text);
+ var output = new FakeOutput();
+ rig.Advisor.Media = new AdvisorMedia(Text, new FakePicture { Ready = true }, new FakePicture(), Immediate, output);
+ rig.Advisor.ForceInline = true; rig.Advisor.NewGame();
+ var portrait = rig.Ui.Root.Q("advisor-portrait");
+ using (var click = ClickEvent.GetPooled())
+ {
+ click.target = portrait;
+ typeof(ClickEvent).GetProperty("button")!.SetValue(click, 0);
+ portrait.SendEvent(click);
+ }
+ rig.Advisor.Media.Tick();
+ Assert.IsTrue(rig.Advisor.Media.Playing && output.Played, "the picture itself starts Watch");
+ UiTestKit.Press(rig.Ui.Root.Q<Button>("advisor-watch"));
+ Assert.IsFalse(rig.Advisor.Media.Playing, "the nested Watch strip still toggles exactly once");
+ using (var bubble = ClickEvent.GetPooled())
+ {
+ bubble.target = rig.Ui.Root.Q<Button>("advisor-watch");
+ typeof(ClickEvent).GetProperty("button")!.SetValue(bubble, 0); rig.Ui.Root.Q<Button>("advisor-watch").SendEvent(bubble);
+ }
+ Assert.IsFalse(rig.Advisor.Media.Playing, "a strip click bubbling through the portrait does not start it again");
+ rig.Advisor.Dispose();
+ using var after = ClickEvent.GetPooled(); after.target = portrait;
+ typeof(ClickEvent).GetProperty("button")!.SetValue(after, 0); portrait.SendEvent(after);
+ Assert.IsFalse(rig.Advisor.Media.Playing, "disposed portrait is unwired");
+ }
+
}
diff --git a/unity/Assets/Tests/EditMode/CityPanelTests.cs b/unity/Assets/Tests/EditMode/CityPanelTests.cs
index 7b5c32739..db43afdbb 100644
--- a/unity/Assets/Tests/EditMode/CityPanelTests.cs
+++ b/unity/Assets/Tests/EditMode/CityPanelTests.cs
@@ -161,7 +161,7 @@ public class CityPanelTests
var order = bridge.QueuedLike(new AssignWorkers(City, "job", 0)) as AssignWorkers;
Assert.IsNotNull(order, "the stepper queues an AssignWorkers order");
Assert.AreEqual(employed - 1, order!.Count);
- Assert.AreEqual(En.Format("city.workers", En.Format("city.groups", employed - 1)), ui.Q<Label>("city-workers").text, "the stepper shows the ordered count");
+ Assert.AreEqual(En.Format("city.workers_ordered", En.Format("city.groups", employed - 1)), ui.Q<Label>("city-workers").text, "the stepper shows the ordered count, at End turn (playtest B7)");
UiTestKit.Press(ui.Q<Button>("city-workers-more"));
Assert.IsNull(bridge.QueuedLike(new AssignWorkers(City, "job", 0)), "back at the current count: no order is left queued");
}
@@ -1151,4 +1151,50 @@ public class CityPanelTests
Assert.IsNotNull(ui.Root.Q<Button>($"site-build-{idle}"), "precondition: the group is offered Build");
Assert.IsNotNull(ui.Root.Q<Button>($"pioneer-return-{idle}"));
}
+ [TestCase(false)] [TestCase(true)]
+ public void EverySettlementBlockNamesItsOwnCity(bool hebrew)
+ {
+ var text = hebrew ? He : En; var bridge = Bridge(text);
+ var pair = C.SettlementHexes.Where(h => bridge.State.Cities.ContainsKey(h.Id)).GroupBy(h => (h.Q, h.R)).First(g => g.Count() > 1);
+ var host = new VisualElement(); var projects = new VisualElement();
+ GddHexPanel.Render(host, projects, bridge, text, pair.Key.Q, pair.Key.R, id => "name:" + id);
+ foreach (var h in pair)
+ {
+ var part = host.Q("city-part-" + h.Id);
+ Assert.IsNotNull(part, "each settlement owns a distinct block: " + h.Id);
+ Assert.AreEqual("name:" + h.Id, part!.Q<Label>("city-name").text);
+ Assert.IsNotNull(part!.Q<Button>("city-workers-less"), "the name belongs to its own jobs stepper");
+ }
+ var single = C.SettlementHexes.Where(h => bridge.State.Cities.ContainsKey(h.Id)).GroupBy(h => (h.Q, h.R)).First(g => g.Count() == 1);
+ GddHexPanel.Render(host, projects, bridge, text, single.Key.Q, single.Key.R, id => "name:" + id);
+ Assert.IsNull(host.Q<Label>("city-name"), "one city's block is not named again under the panel's title");
+ }
+
+ [TestCase(false)] [TestCase(true)]
+ public void WorkerChangesNameTheirTimingAndActualAttentionPrice(bool hebrew)
+ {
+ var text = hebrew ? He : En; var bridge = Bridge(text, s => s.Rung = 2); // a fractional price (0.625)
+ using var ui = new UiTestKit(); using var panel = Panel(ui, bridge, text);
+ panel.Show(CityHex.q, CityHex.r);
+ var city = bridge.State.Cities["tel_aviv"]; int before = city.Employed;
+ Assert.Greater(before, 0, "precondition: there is a worker to remove");
+ Assert.IsNotNull(ui.Q<Label>("city-workers-cost"), "the order price and timing are visible, not only in a tooltip");
+ Assert.AreEqual(text.Format("city.workers_cost", bridge.Price(new AssignWorkers("tel_aviv", "job", before))), ui.Q<Label>("city-workers-cost").text);
+ UiTestKit.Press(ui.Q<Button>("city-workers-less"));
+ Assert.AreEqual(before, city.Employed, "queued work does not pretend the simulation already ran");
+ Assert.AreEqual(text.Format("city.workers_ordered", GddHexPanel.Groups(text, before - 1)), ui.Q<Label>("city-workers").text);
+ Assert.AreEqual(text.Format("city.jobs", before, city.JobSlots), ui.Q<Label>("city-jobs").text);
+ StringAssert.Contains("0.6", ui.Q<Label>("city-workers-cost").text, "the price as the HUD and the cards show Attention (one decimal)");
+ double left = bridge.AttentionLeft;
+ if (before > 1)
+ {
+ UiTestKit.Press(ui.Q<Button>("city-workers-less"));
+ Assert.AreEqual(left, bridge.AttentionLeft, 1e-9, "adjusting one queued assignment does not buy another order");
+ UiTestKit.Press(ui.Q<Button>("city-workers-more"));
+ }
+ UiTestKit.Press(ui.Q<Button>("city-workers-more"));
+ Assert.IsNull(bridge.QueuedLike(new AssignWorkers("tel_aviv", "job", 0)), "return to current count cancels the queued order");
+ Assert.AreEqual(text.Format("city.workers", GddHexPanel.Groups(text, before)), ui.Q<Label>("city-workers").text);
+ }
+
}
diff --git a/unity/Assets/Tests/EditMode/CommunityIconsTests.cs b/unity/Assets/Tests/EditMode/CommunityIconsTests.cs
index 73e90706a..d55c918f3 100644
--- a/unity/Assets/Tests/EditMode/CommunityIconsTests.cs
+++ b/unity/Assets/Tests/EditMode/CommunityIconsTests.cs
@@ -304,4 +304,25 @@ public class CommunityIconsTests
});
Assert.IsEmpty(problems, string.Join("\n", problems));
}
+ [Test]
+ public void AnExternalPressCanBeCancelledBeforeItsClick()
+ {
+ var opened = new List<string>(); ExternalLink.Opener = opened.Add;
+ try
+ {
+ using var ui = new UiTestKit(); var button = ui.Q<Button>("hud-star");
+ var undo = ExternalLink.Bind(button, ExternalLink.Repository);
+ using (var down = PointerDownEvent.GetPooled())
+ {
+ down.target = button; typeof(PointerDownEvent).GetProperty("button")!.SetValue(down, 0); button.SendEvent(down);
+ }
+ Assert.IsEmpty(opened, "pointer down alone must not open a page; dragging off cancels the click");
+ SettingsScreenTests.PressWithPointer(button);
+ Assert.AreEqual(1, opened.Count, "one completed pointer click opens once");
+ UiTestKit.Press(button); Assert.AreEqual(2, opened.Count, "keyboard Submit still opens once");
+ undo(); SettingsScreenTests.PressWithPointer(button); Assert.AreEqual(2, opened.Count, "Dispose removes the binding");
+ }
+ finally { ExternalLink.Opener = ExternalLink.Default; }
+ }
+
}
diff --git a/unity/Assets/Tests/EditMode/EventCardTests.cs b/unity/Assets/Tests/EditMode/EventCardTests.cs
index edab1b943..df64f14af 100644
--- a/unity/Assets/Tests/EditMode/EventCardTests.cs
+++ b/unity/Assets/Tests/EditMode/EventCardTests.cs
@@ -752,4 +752,24 @@ sources: [{ url: ""https://example.org/record"", checked: 2026-10-17 }]
card.Render();
Assert.AreEqual(He.Format("event.alt_origin", "הדרך שלא נבחרה", "A different road title", "מה שקרה"), ui.Q<Label>("event-alt-banner").text);
}
+ [TestCase(false, 1)] [TestCase(false, 2)] [TestCase(true, 1)] [TestCase(true, 2)]
+ public void MoreDecisionsUseARealPlural(bool hebrew, int remaining)
+ {
+ var text = hebrew ? UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.StringsHebrew).text, "strings.he.yaml") : Text;
+ var g = GameSession.New(C, GoldenRun.Seed, Mode.Historical);
+ g.State.Date = new System.DateTime(1948, 6, 15);
+ g.State.PendingEvents.Clear();
+ foreach (var e in C.Events.Take(remaining + 1)) g.State.PendingEvents.Add(e.Id);
+ using var ui = new UiTestKit();
+ using var card = new EventCardPresenter(ui.Root, new SimBridge(g, text), text, null);
+ Assert.IsNotNull(card.Shown, "precondition: a pending card shows");
+ string actual = ui.Q<Label>("event-count").text;
+ if (hebrew)
+ {
+ Assert.AreEqual("החלטה ממתינה נוספת: {0}", text["event.more_one"], "the owner's singular label (25 Oct)");
+ Assert.AreEqual(text.Format(remaining == 1 ? "event.more_one" : "event.more", remaining), actual);
+ }
+ else Assert.AreEqual(remaining == 1 ? "1 more decision waiting" : "2 more decisions waiting", actual);
+ }
+
}
diff --git a/unity/Assets/Tests/EditMode/InfoPanelLayoutTests.cs b/unity/Assets/Tests/EditMode/InfoPanelLayoutTests.cs
index 7cc81e138..03d49b064 100644
--- a/unity/Assets/Tests/EditMode/InfoPanelLayoutTests.cs
+++ b/unity/Assets/Tests/EditMode/InfoPanelLayoutTests.cs
@@ -495,4 +495,26 @@ public class InfoPanelLayoutTests
}
});
}
+ [UnityTest]
+ public IEnumerator LaptopPrimaryUnitOrdersStayTogether([Values(false, true)] bool hebrew)
+ {
+ var text = UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(hebrew ? UiPaths.StringsHebrew : UiPaths.Strings).text);
+ var g = GameSession.New(C, GoldenRun.Seed, Mode.Historical);
+ var data = Statecraft.Game.Map.Units.UnitData.Parse(MapFile(Statecraft.Game.Map.Units.UnitData.DefaultFileName));
+ var token = Statecraft.Game.Map.Units.UnitRoster.FromState(data, C, g.State, _ => true, (row, a, q, r) => a).Single(t => t.Unit.Id == "golani");
+ Statecraft.Game.Map.Units.PlacedToken? selected = new Statecraft.Game.Map.Units.PlacedToken(token, new Statecraft.Game.Map.Units.AnchorSpot(0, 0, 0, 0, false));
+ yield return Rendered(1512, 982, g, (root, info) => info.ShowUnit(), root =>
+ {
+ var move = root.Q("info-move"); var fortify = root.Q("info-fortify"); var hold = root.Q("info-hold");
+ foreach (var b in new[] { move, fortify, hold })
+ {
+ Assert.IsTrue(Shown(b), b.name + " precondition");
+ Assert.Greater(b.worldBound.width, 0f, b.name + " is laid out");
+ Assert.IsTrue(Inside(b.worldBound, root.Q("info-panel").worldBound), b.name + " stays inside the panel");
+ }
+ Assert.That(fortify.worldBound.yMin, Is.EqualTo(move.worldBound.yMin).Within(1f));
+ Assert.That(hold.worldBound.yMin, Is.EqualTo(move.worldBound.yMin).Within(1f), "Hold does not get stranded on a line of its own");
+ }, text: text, hebrew: hebrew, unit: () => selected);
+ }
+
}
diff --git a/unity/Assets/Tests/EditMode/TopBarTests.cs b/unity/Assets/Tests/EditMode/TopBarTests.cs
index d46f04fa6..bfee4b9cb 100644
--- a/unity/Assets/Tests/EditMode/TopBarTests.cs
+++ b/unity/Assets/Tests/EditMode/TopBarTests.cs
@@ -629,4 +629,20 @@ public class TopBarTests
order, (hebrew ? "he" : "en") + ": the Tab order");
}, widest: false);
}
+ [UnityTest]
+ public IEnumerator LaptopCaptionKeepsOneLineWithoutSmallerType([Values(false, true)] bool hebrew)
+ {
+ yield return Rendered(1512, 982, hebrew, (root, text) =>
+ {
+ var caption = root.Q("meter-standing").Q<Label>(className: "meter-name");
+ Assert.AreEqual(text["hud.caption.standing"], caption.text, "retain the full adopted resource name");
+ Assert.Greater(caption.worldBound.width, 0f, "the caption is actually laid out");
+ Assert.AreEqual(DisplayStyle.Flex, caption.resolvedStyle.display);
+ var line = caption.MeasureTextSize(caption.text, 0, VisualElement.MeasureMode.Undefined, 0, VisualElement.MeasureMode.Undefined);
+ Assert.LessOrEqual(caption.contentRect.height, line.y + 1f, "International support keeps one line at the playtest size");
+ Assert.IsTrue(TextFits(caption));
+ Assert.GreaterOrEqual(caption.resolvedStyle.fontSize, 15f, "do not solve wrapping by shrinking type");
+ });
+ }
+
}
diff --git a/unity/Assets/Tests/EditMode/UnitOrdersTests.cs b/unity/Assets/Tests/EditMode/UnitOrdersTests.cs
index f19c0e82e..66f650a8c 100644
--- a/unity/Assets/Tests/EditMode/UnitOrdersTests.cs
+++ b/unity/Assets/Tests/EditMode/UnitOrdersTests.cs
@@ -867,4 +867,33 @@ public class UnitOrdersTests
Assert.IsTrue(GameRoot.SmokeOrdersRequested(null, new[] { "Statecraft", "-smoke-orders" }, false));
Assert.IsFalse(GameRoot.SmokeOrdersRequested("http://localhost/?smoke-orders", new[] { "Statecraft" }, false), "desktop reads only the command line");
}
+ [TestCase(false)] [TestCase(true)]
+ public void EscapeClearsTheUnitOrHexWithoutGivingAnOrder(bool hebrew)
+ {
+ var text = hebrew ? UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.StringsHebrew).text, "strings.he.yaml") : Text;
+ using var ui = new UiTestKit();
+ var g = GameSession.New(C, GoldenRun.Seed, Mode.Historical); var bridge = new SimBridge(g, text);
+ var golani = UnitRoster.FromState(Units, C, g.State, _ => true, (row, a, q, r) => a).Single(t => t.Unit.Id == "golani");
+ PlacedToken? selected = new PlacedToken(golani, new AnchorSpot(0, 0, 0, 0, false));
+ var towns = SettlementPlacer.Parse(File.ReadAllText(Path.Combine(Paths.Content, "map", SettlementPlacer.DefaultFileName))).ToDictionary(t => t.Id, t => t.Name);
+ using var info = new InfoPanelPresenter(ui.Root, bridge, text, towns, selectedUnit: () => selected);
+ using var nav = new ScreenNav(ui.Root);
+ static void Cancel(VisualElement target)
+ {
+ using var e = NavigationCancelEvent.GetPooled(); e.target = target; target.SendEvent(e);
+ }
+ info.ShowUnit(); Assert.IsTrue(info.ShowsUnit);
+ nav.Open("settings"); Cancel(ui.Root);
+ Assert.IsNull(nav.Current, "first Escape closes the covering screen");
+ Assert.IsTrue(info.ShowsUnit, "the same Cancel does not also dismiss the underlying selection");
+ var move = ui.Q<Button>("info-move");
+ move.Focus(); Assert.AreSame(move, move.focusController?.focusedElement, "precondition: the focus is on Move");
+ Cancel(move);
+ Assert.IsFalse(info.ShowsUnit, "Escape from a card control dismisses the unit card");
+ Assert.AreSame(ui.Q<VisualElement>("map-focus"), move.focusController?.focusedElement, "the focus goes to the map stop, not lost with the hidden Move");
+ info.Show(golani.StateUnit!.Q, golani.StateUnit!.R); Assert.IsNotNull(info.Selected);
+ Cancel(ui.Q<VisualElement>("info-panel")); Assert.IsNull(info.Selected, "Escape dismisses the hex panel too");
+ Assert.IsEmpty(bridge.Queued, "closing selection does not alter the turn's orders");
+ }
+
}
diff --git a/unity/Assets/UI/Game.uxml b/unity/Assets/UI/Game.uxml
index 33d6ca733..09bbee2f1 100644
--- a/unity/Assets/UI/Game.uxml
+++ b/unity/Assets/UI/Game.uxml
@@ -149,11 +149,14 @@
<ui:Button name="build-camp" />
<ui:Button name="build-housing" />
<ui:Button name="info-defence" />
- <!-- The unit card's Move order (GDD loop, #754): shown only when the sim has a hex the unit can reach. -->
- <ui:Button name="info-move" />
- <!-- Fortify and Hold (#754): each shown only when the sim's Orders.Check takes it; else its reason shows. -->
- <ui:Button name="info-fortify" />
- <ui:Button name="info-hold" />
+ <!-- Keep the three primary orders together when the laptop panel has room; the group still wraps on phones. -->
+ <ui:VisualElement name="info-primary-orders" class="row info-primary-orders">
+ <!-- The unit card's Move order (GDD loop, #754): shown only when the sim has a hex the unit can reach. -->
+ <ui:Button name="info-move" />
+ <!-- Fortify and Hold (#754): each shown only when the sim's Orders.Check takes it; else its reason shows. -->
+ <ui:Button name="info-fortify" />
+ <ui:Button name="info-hold" />
+ </ui:VisualElement>
<!-- Skip is UI-only: it drops this unit from the needs-orders cycle for this turn. Hidden until the unit card
shows it (InfoPanelPresenter sets its display on every render). -->
<ui:Button name="info-skip" style="display: none;" />
diff --git a/unity/Assets/UI/Statecraft.uss b/unity/Assets/UI/Statecraft.uss
index 19b6d8c6e..6aae12372 100644
--- a/unity/Assets/UI/Statecraft.uss
+++ b/unity/Assets/UI/Statecraft.uss
@@ -1074,3 +1074,10 @@ Button.settings-choice-selected { -unity-font-definition: url("project://databas
.advisor-no-portrait.advisor-has-media .advisor-portrait { display: flex; }
.advisor-watching .advisor-head > .advisor-portrait, .advisor-watching .advisor-head > .advisor-names { display: none; }
+
+/* Playtest B11: the narrow (not compact) bar has room for each caption on one line; compact and phone tiers keep wrapping. */
+.top-bar--caption-line .meter .meter-name { max-width: none; white-space: nowrap; }
+/* Playtest B11: Move, Fortify and Hold wrap as one group, so Hold is never left alone on a line; a small window wraps inside it. */
+.info-primary-orders { flex-wrap: wrap; max-width: 100%; flex-shrink: 0; }
+/* Playtest B6: the city's name over its block on a hex that holds two cities (GddHexPanel.CityNameClass). */
+.city-part-name { -unity-font-style: bold; color: var(--gold-light); margin-top: 6px; }
diff --git a/unity/Assets/UI/strings.en.yaml b/unity/Assets/UI/strings.en.yaml
index d533b74cf..c68164577 100644
--- a/unity/Assets/UI/strings.en.yaml
+++ b/unity/Assets/UI/strings.en.yaml
@@ -138,7 +138,8 @@ start.new_game: "New game"
boot.loading: "Loading the map of 1948…"
toast.refused: "Not done: {0}"
event.office: "{0}: {1}"
-event.more: "{0} more decision(s) waiting"
+event.more: "{0} more decisions waiting"
+event.more_one: "{0} more decision waiting"
event.hide: "Hide"
event.reopen: "Decision waiting"
event.illustration: "Illustration"
@@ -755,3 +756,7 @@ advisor.dayan.defeat_war.cue.1: "An enemy military unit holds one of the country
advisor.dayan.defeat_war.cue.2: "The campaign has ended in defeat."
advisor.dayan.arms_out.cue.1: "Arms equip military training and are spent in attacks."
advisor.dayan.arms_out.cue.2: "Buying Arms with Money before the stock runs short keeps those choices available."
+
+# Playtest B7: the jobs stepper's queued count and the Assign order's price and timing.
+city.workers_ordered: "At End turn: {0}"
+city.workers_cost: "At End turn · Order cost: {0:0.0} Attention"
diff --git a/unity/Assets/UI/strings.he.yaml b/unity/Assets/UI/strings.he.yaml
index ee0fa7f1d..e4e8c29df 100644
--- a/unity/Assets/UI/strings.he.yaml
+++ b/unity/Assets/UI/strings.he.yaml
@@ -158,6 +158,8 @@ boot.loading: "טוען את מפת 1948…"
toast.refused: "לא בוצע: {0}"
event.office: "{0}: {1}"
event.more: "החלטות ממתינות נוספות: {0}"
+# Approved: owner, 25 Oct 2026 (recommendations page, item 4).
+event.more_one: "החלטה ממתינה נוספת: {0}"
event.hide: "הסתר"
event.reopen: "החלטה ממתינה"
event.illustration: "איור"
@@ -813,3 +815,8 @@ advisor.dayan.defeat_war.cue.1: "יחידה צבאית של האויב מחזי
advisor.dayan.defeat_war.cue.2: "המערכה הסתיימה בתבוסה."
advisor.dayan.arms_out.cue.1: "אימון צבאי דורש נשק, ונשק נצרך בהתקפות."
advisor.dayan.arms_out.cue.2: "קניית נשק בכסף לפני שהמלאי אוזל שומרת את האפשרויות האלה פתוחות."
+
+# Playtest B7: the jobs stepper's queued count and the Assign order's price and timing.
+# Approved: owner, 25 Oct 2026 (recommendations page, item 5); the price in one decimal, as the HUD and the cards show Attention.
+city.workers_ordered: "בסיום התור: {0}"
+city.workers_cost: "בסיום התור · עלות ההוראה: {0:0.0} תשומת לב"