A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
Desktop: a Quit button on the start screen and in Settings, hidden in the browser (#2153) (#2188)
Eyal Golan0e81b52176f8
diff --git a/changelog.d/desktop-quit-button.md b/changelog.d/desktop-quit-button.mdnew file mode 100644index 000000000..7d92961a6--- /dev/null+++ b/changelog.d/desktop-quit-button.md@@ -0,0 +1,3 @@+- A Quit button on the start screen and in Settings for the desktop players (#2153), so a full-screen game or a Steam+ Deck can be closed from the game. The browser version does not show it. In Settings, Quit asks first: the first+ press shows "Press again to quit", and the second closes the game (#2188).diff --git a/unity/Assets/Scripts/UI/QuitButton.cs b/unity/Assets/Scripts/UI/QuitButton.csnew file mode 100644index 000000000..793cbba91--- /dev/null+++ b/unity/Assets/Scripts/UI/QuitButton.cs@@ -0,0 +1,48 @@+#nullable enable+using System;+using UnityEngine;+using UnityEngine.UIElements;++namespace Statecraft.Game.UI+{+ /// <summary>Quit (#2153): on the start screen ("start-quit") and in Settings ("settings-quit") for the desktop players+ /// (Steam, the GitHub archives), where a full-screen player otherwise has only Alt+F4 and a Steam Deck has no way out.+ /// Hidden in the browser, where a page cannot close itself (and on any other platform, which the game does not ship to).</summary>+ public static class QuitButton+ {+ /// <summary>The platform the presenters bind for. Tests put their own here (and put <see cref="DefaultPlatform"/> back).</summary>+ internal static Func<RuntimePlatform> Platform = DefaultPlatform;+ /// <summary>What a press does in the presenters, read at the press. Tests put a counter here (and put+ /// <see cref="DefaultQuit"/> back), so no test ever quits.</summary>+ internal static Action Quitter = DefaultQuit;+ internal static RuntimePlatform DefaultPlatform() => Application.platform;+ internal static void DefaultQuit() => Application.Quit();++ /// <summary>Whether Quit shows on <paramref name="p"/>: the Windows, macOS and Linux players and their editors.</summary>+ public static bool Shown(RuntimePlatform p) => p switch+ {+ RuntimePlatform.WindowsPlayer or RuntimePlatform.OSXPlayer or RuntimePlatform.LinuxPlayer => true,+ RuntimePlatform.WindowsEditor or RuntimePlatform.OSXEditor or RuntimePlatform.LinuxEditor => true,+ _ => false,+ };++ /// <summary>Shows <paramref name="b"/> (or <paramref name="row"/>, the row it alone fills) only where+ /// <see cref="Shown"/>, and calls <paramref name="quit"/> when it is pressed. The start screen binds through+ /// <see cref="BindInGame"/>; Settings binds its own press, which asks first (#2188). Returns the unbinding, for+ /// the presenter's Dispose (a language switch builds the screens again over the same buttons).</summary>+ public static Action Bind(Button b, RuntimePlatform p, Action quit, VisualElement? row = null)+ {+ if (b == null) throw new ArgumentNullException(nameof(b));+ if (quit == null) throw new ArgumentNullException(nameof(quit));+ bool shown = Shown(p);+ // Shown: the inline display is cleared, so the stylesheet decides, as for the buttons beside it.+ (row ?? b).style.display = shown ? new StyleEnum<DisplayStyle>(StyleKeyword.Null) : DisplayStyle.None;+ if (!shown) return () => { };+ b.clicked += quit;+ return () => b.clicked -= quit;+ }++ /// <summary><see cref="Bind"/> as the presenters bind: on <see cref="Platform"/>, calling <see cref="Quitter"/>.</summary>+ internal static Action BindInGame(Button b, VisualElement? row = null) => Bind(b, Platform(), () => Quitter(), row);+ }+}diff --git a/unity/Assets/Scripts/UI/QuitButton.cs.meta b/unity/Assets/Scripts/UI/QuitButton.cs.metanew file mode 100644index 000000000..53261e641--- /dev/null+++ b/unity/Assets/Scripts/UI/QuitButton.cs.meta@@ -0,0 +1,2 @@+fileFormatVersion: 2+guid: 4e98b470da254be68922b4452cbbf1c9diff --git a/unity/Assets/Scripts/UI/SettingsPresenter.cs b/unity/Assets/Scripts/UI/SettingsPresenter.csindex dbf0416fe..9eeae85b3 100644--- a/unity/Assets/Scripts/UI/SettingsPresenter.cs+++ b/unity/Assets/Scripts/UI/SettingsPresenter.cs@@ -41,7 +41,10 @@ namespace Statecraft.Game.UIstring soundLevel;readonly PanelSettings? panel; readonly Vector2Int reference; int uiScale = UiScales[0], chosen = UiScales[0];readonly (Button button, int percent, Action pick)[] scales;- readonly Action unbindStar;+ readonly Action unbindStar, unbindQuit;+ readonly Button quit;+ /// <summary>True between Quit's first press, which asks, and its second, which quits (#2188).</summary>+ bool quitAsked;/// <param name="store">Where the choice is kept; null keeps nothing (the option still works until the page closes).</param>/// <param name="switchLanguage">Puts the UI in the language pressed (GameRoot builds the screens again); null changes@@ -128,7 +131,13 @@ namespace Statecraft.Game.UIvar star = screen.Q<Button>("settings-star");star.text = text["community.star"];unbindStar = ExternalLink.Bind(star, ExternalLink.Repository);- ScreenNav.OnOpened(screen, Show); // a dev toggle may have changed it while the screen was shut+ // Quit (#2153: desktop players only) asks first (#2188, the owner: "Ask to confirm (Recommended)"): the first+ // press puts the question in the button's place and the second quits, the two presses New game uses+ // (NewGamePresenter). Opening Settings again withdraws the question.+ quit = screen.Q<Button>("settings-quit");+ quit.text = text["ui.quit"];+ unbindQuit = QuitButton.Bind(quit, QuitButton.Platform(), PressQuit, screen.Q("settings-quit-row"));+ ScreenNav.OnOpened(screen, () => { WithdrawQuit(); Show(); }); // a dev toggle may have changed it while the screen was shutShow();}@@ -141,11 +150,21 @@ namespace Statecraft.Game.UIforeach (var (b, _, pick) in scales) b.clicked -= pick;foreach (var (b, _, pick) in helpLevels) b.clicked -= pick;unbindStar();+ unbindQuit();root.UnregisterCallback<GeometryChangedEvent>(OnGeometry);if (panel != null) panel.referenceResolution = reference;if (screen.userData is Action) screen.userData = null;}+ void PressQuit()+ {+ if (!quitAsked) { quitAsked = true; quit.text = text["ui.quit_confirm"]; return; }+ WithdrawQuit();+ QuitButton.Quitter();+ }++ void WithdrawQuit() { quitAsked = false; quit.text = text["ui.quit"]; }+void Flip(){TiltShift.Enabled = !TiltShift.Enabled;diff --git a/unity/Assets/Scripts/UI/StartScreenPresenter.cs b/unity/Assets/Scripts/UI/StartScreenPresenter.csindex 61f609716..2e2a64ced 100644--- a/unity/Assets/Scripts/UI/StartScreenPresenter.cs+++ b/unity/Assets/Scripts/UI/StartScreenPresenter.cs@@ -59,6 +59,7 @@ namespace Statecraft.Game.UIreadonly EventCallback<GeometryChangedEvent> onLaidOut;readonly VisualElement[] laidOut;readonly LanguageButtons languages;+ readonly Action unbindQuit;string? loggedCentres;/// <summary>The buttons ButtonCentres reports, by name.</summary>@@ -102,6 +103,9 @@ namespace Statecraft.Game.UIunbindStar = ExternalLink.Bind(starButton, ExternalLink.Repository); // #1168starButton.generateVisualContent += PaintStarSigns;languages = new LanguageButtons(screen, "start-language-", text?["ui.lang"] ?? UiLanguage.English, settings, switchLanguage);+ var quit = screen.Q<Button>("start-quit"); // #2153: desktop players only+ if (text != null) quit.text = text["ui.quit"];+ unbindQuit = QuitButton.BindInGame(quit);onContinue = Continue; onNewGame = NewGame; onStarted = Started;continueButton.clicked += onContinue;newGameButton.clicked += onNewGame;@@ -278,6 +282,7 @@ namespace Statecraft.Game.UInewGameButton.clicked -= onNewGame;newGame.Started -= onStarted;unbindStar();+ unbindQuit();starButton.generateVisualContent -= PaintStarSigns;languages.Dispose();screen.UnregisterCallback(onCancel);diff --git a/unity/Assets/Tests/EditMode/HebrewUiTests.cs b/unity/Assets/Tests/EditMode/HebrewUiTests.csindex c1abd7ff3..babffaa52 100644--- a/unity/Assets/Tests/EditMode/HebrewUiTests.cs+++ b/unity/Assets/Tests/EditMode/HebrewUiTests.cs@@ -523,6 +523,7 @@ public class HebrewUiTests("share-attach", "share.attach"), ("share-close", "report.close"),("start-source", "start.source"), ("start-recording-credit", "start.recording_credit"),("start-continue", "start.continue"), ("start-new-game", "start.new_game"),+ ("start-quit", "ui.quit"), ("settings-quit", "ui.quit"), // #2153};/// <summary>Static texts that stay as Game.uxml writes them in every language: the game's name, and the Declaration'sdiff --git a/unity/Assets/Tests/EditMode/QuitButtonTests.cs b/unity/Assets/Tests/EditMode/QuitButtonTests.csnew file mode 100644index 000000000..1ee013ccf--- /dev/null+++ b/unity/Assets/Tests/EditMode/QuitButtonTests.cs@@ -0,0 +1,226 @@+#nullable enable+using NUnit.Framework;+using Statecraft.Game;+using Statecraft.Game.UI;+using Statecraft.Sim;+using UnityEditor;+using UnityEngine;+using UnityEngine.UIElements;++/// <summary>Desktop Quit (#2153): a Quit button on the start screen and in Settings for the desktop players (Steam, the+/// GitHub archives), hidden in the browser, where a page cannot close itself.</summary>+public class QuitButtonTests+{+ static UiText En => UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.Strings).text);+ static UiText He => UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.StringsHebrew).text, "strings.he.yaml");++ [TearDown] public void PutTheDefaultsBack() { QuitButton.Platform = QuitButton.DefaultPlatform; QuitButton.Quitter = QuitButton.DefaultQuit; }++ [TestCase(RuntimePlatform.WebGLPlayer, false)]+ [TestCase(RuntimePlatform.WindowsPlayer, true)]+ [TestCase(RuntimePlatform.OSXPlayer, true)]+ [TestCase(RuntimePlatform.LinuxPlayer, true)]+ [TestCase(RuntimePlatform.WindowsEditor, true)]+ [TestCase(RuntimePlatform.OSXEditor, true)]+ [TestCase(RuntimePlatform.LinuxEditor, true)]+ public void It_shows_on_desktop_and_never_in_the_browser(RuntimePlatform p, bool shown)+ {+ Assert.AreEqual(shown, QuitButton.Shown(p));+ }++ [TestCase("start-screen", "start-quit")]+ [TestCase("screen-settings", "settings-quit")]+ public void Each_screen_has_exactly_one_quit_button(string screen, string name)+ {+ using var ui = new UiTestKit();+ Assert.AreEqual(1, ui.Root.Query<Button>(name).ToList().Count, name);+ Assert.AreEqual(1, ui.Root.Q(screen).Query<Button>(name).ToList().Count, $"{name} is on {screen}");+ }++ [TestCase("start-quit")]+ [TestCase("settings-quit")]+ public void In_the_browser_it_is_hidden(string name)+ {+ using var ui = new UiTestKit();+ int quits = 0;+ var unbind = QuitButton.Bind(ui.Q<Button>(name), RuntimePlatform.WebGLPlayer, () => quits++);+ Assert.AreEqual(DisplayStyle.None, ui.Q<Button>(name).style.display.value);+ ui.Press(name);+ Assert.AreEqual(0, quits, "nothing is bound in the browser");+ unbind();+ }++ /// <summary>Settings hides Quit's whole row in the browser, so no empty row is left at the bottom of the screen.</summary>+ [Test]+ public void In_the_browser_settings_hides_the_whole_row()+ {+ using var ui = new UiTestKit();+ var b = ui.Q<Button>("settings-quit");+ QuitButton.Bind(b, RuntimePlatform.WebGLPlayer, () => { }, ui.Q<VisualElement>("settings-quit-row"))();+ Assert.AreSame(ui.Q<VisualElement>("settings-quit-row"), b.parent, "the row is the button's own");+ Assert.AreEqual(DisplayStyle.None, ui.Q<VisualElement>("settings-quit-row").style.display.value);+ QuitButton.Bind(b, RuntimePlatform.LinuxPlayer, () => { }, ui.Q<VisualElement>("settings-quit-row"))();+ Assert.AreEqual(StyleKeyword.Null, ui.Q<VisualElement>("settings-quit-row").style.display.keyword);+ }++ [TestCase("start-quit")]+ [TestCase("settings-quit")]+ public void On_desktop_it_shows_and_a_press_quits_once(string name)+ {+ using var ui = new UiTestKit();+ int quits = 0;+ ui.Q<Button>(name).style.display = DisplayStyle.None;+ var unbind = QuitButton.Bind(ui.Q<Button>(name), RuntimePlatform.WindowsPlayer, () => quits++);+ Assert.AreEqual(StyleKeyword.Null, ui.Q<Button>(name).style.display.keyword, "shown: its inline display is cleared, so the stylesheet decides");+ ui.Press(name);+ Assert.AreEqual(1, quits);+ unbind();+ ui.Press(name);+ Assert.AreEqual(1, quits, "unbound: a rebuilt screen (the language switch) never quits twice");+ }++ [Test]+ public void Both_languages_name_it()+ {+ Assert.AreEqual("Quit", En["ui.quit"]);+ Assert.AreEqual("יציאה", He["ui.quit"]);+ }++ /// <summary>The presenters bind it in the UI's language (the editor is a desktop platform, so it shows here).</summary>+ [Test]+ public void Settings_shows_it_in_the_UIs_language()+ {+ foreach (var text in new[] { En, He })+ {+ using var ui = new UiTestKit();+ ui.Q<Button>("settings-quit").text = ""; // so the English, which Game.uxml also writes, proves the binding too+ using (new SettingsPresenter(ui.Root, text, null))+ {+ Assert.AreEqual(text["ui.quit"], ui.Q<Button>("settings-quit").text);+ }+ }+ }++ [Test]+ public void The_start_screen_shows_it_in_the_UIs_language()+ {+ var c = ContentLoader.Load(Paths.Content);+ foreach (var text in new[] { En, He })+ {+ using var ui = new UiTestKit();+ var store = new SaveStore(System.IO.Path.Combine(System.IO.Path.GetTempPath(), "statecraft-quit-" + System.Guid.NewGuid().ToString("N")));+ var bridge = new SimBridge(GameSession.New(c, GoldenRun.Seed, Mode.Historical), text);+ using var toast = new ToastPresenter(ui.Root, bridge, text);+ using var newGame = new NewGamePresenter(ui.Root, bridge, store, toast, text, () => 5UL);+ ui.Q<Button>("start-quit").text = ""; // so the English, which Game.uxml also writes, proves the binding too+ using (new StartScreenPresenter(ui.Root, newGame, false, text: text))+ {+ Assert.AreEqual(text["ui.quit"], ui.Q<Button>("start-quit").text);+ }+ }+ }++ // Review round (k2 C1): the presenters' own binding, through QuitButton.Platform and QuitButton.Quitter.++ static NewGamePresenter NewGame(UiTestKit ui, out ToastPresenter toast)+ {+ var c = ContentLoader.Load(Paths.Content);+ var store = new SaveStore(System.IO.Path.Combine(System.IO.Path.GetTempPath(), "statecraft-quit-" + System.Guid.NewGuid().ToString("N")));+ var bridge = new SimBridge(GameSession.New(c, GoldenRun.Seed, Mode.Historical), En);+ toast = new ToastPresenter(ui.Root, bridge, En);+ return new NewGamePresenter(ui.Root, bridge, store, toast, En, () => 5UL);+ }++ [Test]+ public void A_screen_built_again_quits_once()+ {+ int quits = 0;+ QuitButton.Platform = () => RuntimePlatform.WindowsPlayer;+ QuitButton.Quitter = () => quits++;+ using (var ui = new UiTestKit())+ {+ using var newGame = NewGame(ui, out var toast);+ using (toast)+ {+ new StartScreenPresenter(ui.Root, newGame, false).Dispose(); // the language switch disposes the old screen+ using (new StartScreenPresenter(ui.Root, newGame, false)) ui.Press("start-quit");+ }+ }+ Assert.AreEqual(1, quits, "start screen");+ quits = 0;+ using (var ui = new UiTestKit())+ {+ new SettingsPresenter(ui.Root, En, null).Dispose();+ using (new SettingsPresenter(ui.Root, En, null)) { ui.Press("settings-quit"); ui.Press("settings-quit"); } // Settings asks first (#2188)+ }+ Assert.AreEqual(1, quits, "Settings");+ }++ // #2188, the owner (2 Nov 2026): "Ask to confirm (Recommended)". Settings' Quit asks on the first press, in the+ // button's place, and quits on the second, as New game does (NewGamePresenter).++ [Test]+ public void Both_languages_ask_before_quitting()+ {+ Assert.AreEqual("Press again to quit", En["ui.quit_confirm"]);+ Assert.AreEqual("יש ללחוץ שוב ליציאה", He["ui.quit_confirm"]);+ }++ [Test]+ public void Settings_asks_before_it_quits()+ {+ int quits = 0;+ QuitButton.Platform = () => RuntimePlatform.WindowsPlayer;+ QuitButton.Quitter = () => quits++;+ foreach (var text in new[] { En, He })+ {+ quits = 0;+ using var ui = new UiTestKit();+ using (new SettingsPresenter(ui.Root, text, null))+ {+ var b = ui.Q<Button>("settings-quit");+ ui.Press("settings-quit");+ Assert.AreEqual(0, quits, "the first press only asks");+ Assert.AreEqual(text["ui.quit_confirm"], b.text, "the question is in the button's place");+ ui.Press("settings-quit");+ Assert.AreEqual(1, quits, "the second press quits");+ Assert.AreEqual(text["ui.quit"], b.text, "and the button reads Quit again");+ }+ }+ }++ [Test]+ public void Opening_settings_again_withdraws_the_question()+ {+ int quits = 0;+ QuitButton.Platform = () => RuntimePlatform.WindowsPlayer;+ QuitButton.Quitter = () => quits++;+ using var ui = new UiTestKit();+ using (new SettingsPresenter(ui.Root, En, null))+ {+ var b = ui.Q<Button>("settings-quit");+ ui.Press("settings-quit");+ Assert.AreEqual(En["ui.quit_confirm"], b.text);+ (ui.Q<VisualElement>("screen-settings").userData as System.Action)!.Invoke(); // what ScreenNav runs when Settings opens+ Assert.AreEqual(En["ui.quit"], b.text, "a reopened Settings shows Quit, not an old question");+ ui.Press("settings-quit");+ Assert.AreEqual(0, quits, "after reopening, the first press asks again");+ }+ }++ [Test]+ public void In_the_browser_the_presenters_hide_it()+ {+ QuitButton.Platform = () => RuntimePlatform.WebGLPlayer;+ using (var ui = new UiTestKit())+ {+ using var newGame = NewGame(ui, out var toast);+ using (toast)+ using (new StartScreenPresenter(ui.Root, newGame, false))+ Assert.AreEqual(DisplayStyle.None, ui.Q<Button>("start-quit").style.display.value);+ }+ using (var ui = new UiTestKit())+ using (new SettingsPresenter(ui.Root, En, null)) // its Show() runs after the binding: the row stays hidden+ Assert.AreEqual(DisplayStyle.None, ui.Q<VisualElement>("settings-quit-row").style.display.value, "Settings hides Quit's whole row");+ }+}diff --git a/unity/Assets/Tests/EditMode/QuitButtonTests.cs.meta b/unity/Assets/Tests/EditMode/QuitButtonTests.cs.metanew file mode 100644index 000000000..ba494e7c1--- /dev/null+++ b/unity/Assets/Tests/EditMode/QuitButtonTests.cs.meta@@ -0,0 +1,2 @@+fileFormatVersion: 2+guid: 7a354096f58140078edfb59636c32279diff --git a/unity/Assets/Tests/EditMode/SettingsScreenTests.cs b/unity/Assets/Tests/EditMode/SettingsScreenTests.csindex 5e86dd0fd..6867233f5 100644--- a/unity/Assets/Tests/EditMode/SettingsScreenTests.cs+++ b/unity/Assets/Tests/EditMode/SettingsScreenTests.cs@@ -647,7 +647,7 @@ public class SettingsScreenTests"settings-quality-label", "settings-quality-auto", "settings-quality-high", "settings-quality-low","settings-language-label", "settings-language-en", "settings-language-he","settings-uiscale-label", "settings-uiscale-100", "settings-uiscale-125", "settings-uiscale-150",- "settings-community-label", "settings-star", "settings-report", "settings-share" })+ "settings-community-label", "settings-star", "settings-report", "settings-share", "settings-quit" }){var e = root.Q<TextElement>(name);Assert.IsFalse(string.IsNullOrWhiteSpace(e.text), $"{at}: {name} has its text");diff --git a/unity/Assets/Tests/EditMode/StartScreenTests.cs b/unity/Assets/Tests/EditMode/StartScreenTests.csindex ae698dba1..c7ba70fb8 100644--- a/unity/Assets/Tests/EditMode/StartScreenTests.cs+++ b/unity/Assets/Tests/EditMode/StartScreenTests.cs@@ -378,9 +378,10 @@ public class StartScreenTestscont.Focus();Assert.AreSame(cont, rig.Ui.Root.focusController?.focusedElement, "Continue has the focus");// Tab walks the screen's buttons only: Continue, New Game, the recording's button, Star on GitHub (#1168), Report a- // bug or idea (#1169) and the two languages (#2054), English then Hebrew.+ // bug or idea (#1169), the two languages (#2054), English then Hebrew, and Quit (#2153; the editor is a desktop+ // platform, so it shows).var seen = new List<string>();- for (int i = 0; i < 6; i++)+ for (int i = 0; i < 7; i++){var at = (VisualElement)rig.Ui.Root.focusController!.focusedElement;using (var e = NavigationMoveEvent.GetPooled(NavigationMoveEvent.Direction.Next)) { e.target = at; at.SendEvent(e); }@@ -389,9 +390,10 @@ public class StartScreenTests}Assert.AreEqual("start-new-game", seen[0], "Tab moves from Continue to New Game: " + string.Join(", ", seen));Assert.IsTrue(seen.All(n => n == "start-continue" || n == "start-new-game" || n == "start-listen" || n == "start-star" || n == "start-report"- || n == "start-language-en" || n == "start-language-he"), "Tab stays on the screen's buttons: " + string.Join(", ", seen));+ || n == "start-language-en" || n == "start-language-he" || n == "start-quit"), "Tab stays on the screen's buttons: " + string.Join(", ", seen));var en = seen.IndexOf("start-language-en");Assert.IsTrue(en >= 0 && en + 1 < seen.Count && seen[en + 1] == "start-language-he", "Tab reaches English, then Hebrew: " + string.Join(", ", seen));+ Assert.IsTrue(en + 2 < seen.Count && seen[en + 2] == "start-quit", "Tab reaches Quit after Hebrew: " + string.Join(", ", seen));CollectionAssert.Contains(seen, "start-listen", "Tab reaches the recording's button: " + string.Join(", ", seen));rig.Ui.Press("start-continue");yield return null; yield return null;@@ -614,6 +616,10 @@ public class StartScreenTestsAssert.AreNotEqual(newGameStyle.borderTopColor, starStyle.borderTopColor, $"{at}: the Star button's edge is not New game's gold");Assert.IsTrue(Inside(R("start-report"), R("start-community")), $"{at}: the Report button {R("start-report")} is in its row"); // #1169Assert.IsFalse(R("start-report").Overlaps(star), at);+ // #2153: Quit (shown: the editor is a desktop platform) in the same row, inside the panel, over nothing.+ Assert.IsTrue(Inside(R("start-quit"), R("start-community")) && Inside(R("start-quit"), panel), $"{at}: Quit {R("start-quit")} is in its row, inside the panel");+ foreach (var other in new[] { "start-report", "start-language-en", "start-language-he" })+ Assert.IsFalse(R("start-quit").Overlaps(R(other)), $"{at}: Quit {R("start-quit")} overlaps {other} {R(other)}");}finally{@@ -714,6 +720,7 @@ public class StartScreenTestspublic IEnumerator InHebrewTheButtonRowsMirror(){var gaps = new Dictionary<(int, int), float>();+ var quitGaps = new Dictionary<(int, int), float>();var recordingCompared = new HashSet<(int, int)>();foreach (var hebrew in new[] { false, true })foreach (var (w, h) in new[] { (1920, 1080), (1366, 768), (390, 844) })@@ -780,6 +787,16 @@ public class StartScreenTestsvar near = hebrew ? R("start-language-en").xMax : R("start-language-en").xMin;gaps[(w, hebrew ? 1 : 0)] = hebrew ? report.xMin - near : near - report.xMax;}+ // Quit (#2153; review round k2): after the pair, mirrored, as far from it as Report is.+ var quit = R("start-quit");+ if (w == 1920) Assert.IsTrue(OneLine(quit, pair), $"{at}: Quit {quit} is beside the languages {pair}");+ if (OneLine(quit, pair))+ {+ if (hebrew) Assert.LessOrEqual(quit.xMax, pair.xMin + 0.5f, $"{at}: Quit {quit} is left of the languages {pair}");+ else Assert.GreaterOrEqual(quit.xMin, pair.xMax - 0.5f, $"{at}: Quit {quit} is right of the languages {pair}");+ var nearHe = R("start-language-he");+ quitGaps[(w, hebrew ? 1 : 0)] = hebrew ? nearHe.xMin - quit.xMax : quit.xMin - nearHe.xMax;+ }}finally{@@ -791,6 +808,10 @@ public class StartScreenTestsif (gaps.TryGetValue((w, 0), out var en) && gaps.TryGetValue((w, 1), out var he))Assert.AreEqual(en, he, 1f, $"{w}: the gap between Report and the languages is the same in Hebrew ({he:0.0}) as in English ({en:0.0})");Assert.IsTrue(gaps.ContainsKey((1920, 0)) && gaps.ContainsKey((1920, 1)), "the gap was measured at 1920x1080");+ foreach (var key in quitGaps.Keys)+ if (gaps.TryGetValue(key, out var reportGap))+ Assert.AreEqual(reportGap, quitGaps[key], 1f, $"{key}: Quit is as far from the languages ({quitGaps[key]:0.0}) as Report ({reportGap:0.0})");+ Assert.IsTrue(quitGaps.ContainsKey((1920, 0)) && quitGaps.ContainsKey((1920, 1)), "Quit's gap was measured at 1920x1080");Assert.IsTrue(recordingCompared.Contains((1920, 0)) && recordingCompared.Contains((1920, 1)), "the recording's row was compared at 1920x1080");}diff --git a/unity/Assets/UI/Game.uxml b/unity/Assets/UI/Game.uxmlindex 05dde9343..1b98b5bfb 100644--- a/unity/Assets/UI/Game.uxml+++ b/unity/Assets/UI/Game.uxml@@ -495,6 +495,10 @@<ui:Button name="settings-share" text="Share" class="settings-switch" /></ui:VisualElement></ui:VisualElement>+ <!-- Quit (#2153, QuitButton): desktop players only; its own row, last, hidden whole in the browser. -->+ <ui:VisualElement name="settings-quit-row" class="row settings-row">+ <ui:Button name="settings-quit" text="Quit" class="settings-switch" />+ </ui:VisualElement><Statecraft.Game.UI.UiFrame /></ui:VisualElement><!-- The advisors' popup (spec 7.1, AdvisorPresenter): the right column's upper part, or a sheet under the bar on an@@ -628,6 +632,9 @@<ui:Button name="start-language-en" class="start-language-button" /><ui:Button name="start-language-he" class="start-language-button" /></ui:VisualElement>+ <!-- Quit (#2153, QuitButton): desktop players only, hidden in the browser; as quiet as Report, last in+ the row and in the Tab order (the panel keeps its height). -->+ <ui:Button name="start-quit" text="Quit" class="start-report start-quit" /></ui:VisualElement><ui:VisualElement name="start-caption" class="start-caption" picking-mode="Ignore"><ui:Label name="start-caption-he" text="…אנו מכריזים בזאת על הקמת מדינה יהודית בארץ־ישראל, היא מדינת ישראל." class="start-he start-caption-he" language-direction="RTL" picking-mode="Ignore" />diff --git a/unity/Assets/UI/Statecraft.uss b/unity/Assets/UI/Statecraft.ussindex ba5e1bf21..5852115bb 100644--- a/unity/Assets/UI/Statecraft.uss+++ b/unity/Assets/UI/Statecraft.uss@@ -953,6 +953,9 @@ Button.settings-choice-selected { -unity-font-definition: url("project://databas/* In Hebrew the row mirrors like the rest of the UI (the owner, 31 Oct 2026): the pair left of Report, the gap on Report's side. */.lang-he .start-language { margin-left: 0; margin-right: 8px; }.start-language-button { font-size: 18px; min-width: 96px; padding: 4px 16px; margin: 2px 4px; -unity-text-align: middle-center; }+/* Quit (#2153), desktop players only: a .start-report after the languages, as far from them as Report is (10 + 8 + 4 px). */+.start-quit { margin-left: 18px; }+.lang-he .start-quit { margin-left: 10px; margin-right: 18px; }/* Star on GitHub (#1168): a .start-button, New game's size, beside it (the row wraps it under New game in a narrowwindow). Its star and GitHub mark are painted into the left padding (the right in Hebrew; StartScreenPresenterPaintStarSigns). Secondary to New game in colour: no fill and a grey edge instead of the gold one; hover and keyboarddiff --git a/unity/Assets/UI/strings.en.yaml b/unity/Assets/UI/strings.en.yamlindex c81edaed5..5e29c8801 100644--- a/unity/Assets/UI/strings.en.yaml+++ b/unity/Assets/UI/strings.en.yaml@@ -593,6 +593,11 @@ minimap.overview: "Zoom all the way out"minimap.labels: "Show or hide the settlement names"minimap.borders: "Show or hide the region borders"ui.lang: "en"+# ui.quit: Quit on the start screen and in Settings, desktop players only (#2153, QuitButton).+ui.quit: "Quit"+# ui.quit_confirm: Settings' Quit after its first press, in the button's place; the second press quits (#2188, the owner's+# "are you sure?" ruling of 2 November 2026). Same two presses as New game (newgame.confirm).+ui.quit_confirm: "Press again to quit"info.built: "{0} built here in {1}"info.queued: "Ordered: {0}, at End turn"info.build_camp: "Place a transit camp ({0})"diff --git a/unity/Assets/UI/strings.he.yaml b/unity/Assets/UI/strings.he.yamlindex 6d1cdbb90..b50c4427e 100644--- a/unity/Assets/UI/strings.he.yaml+++ b/unity/Assets/UI/strings.he.yaml@@ -633,6 +633,11 @@ minimap.overview: "התרחקות מרבית"minimap.labels: "הצגה או הסתרה של שמות היישובים"minimap.borders: "הצגה או הסתרה של גבולות האזורים"ui.lang: "he"+# ui.quit: Quit on the start screen and in Settings, desktop players only (#2153). An action noun (HE-03). For the native reviewer (#564).+ui.quit: "יציאה"+# ui.quit_confirm: Settings' Quit after its first press, in the button's place; the second press quits (#2188). "יש ל..." as in+# newgame.confirm (HE-03), with the action noun of ui.quit. For the native reviewer (#564).+ui.quit_confirm: "יש ללחוץ שוב ליציאה"# #701: {1} is a month and a year ("אוגוסט 1950"). A date label with no verb, since a fixed "נבנה" is wrong for a feminine# name ("מעברה"); Beri approved this wording as a native speaker (17 October 2026). For the native reviewer (#564).info.built: "{0} – תאריך הקמה: {1}"