A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
UI: plainer Tiberias note, with the town's Hebrew name in Hebrew (follow-up to #699, refs #204) (#762)
Beri08d14aec9580
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 9f387476e..fbbc318c8 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -62,7 +62,8 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIB(Q-CUT-8). Every golden moves; the cutover re-pins them once.### Added-- The info panel of Tiberias' hex adds "Tiberias lies in the neighbouring water hex" (Hebrew too), so the hillside hex's+- The info panel of Tiberias' hex adds "Tiberias is shown here because its own hex is water." (Hebrew too, with the+ town's Hebrew name), so the hillside hex's70 m does not read as the town's (refs #204). It is worked out in Unity from the town's own lon/lat and the hex grid(`InfoPanelPresenter.TownHex`), with no new `content/map/` field; an ordinary hex shows no such line.- Tal's (@pixelrenderai-hash) 23 single-building Tripo models from #507, imported for the strategic map (refs #659, stepdiff --git a/unity/Assets/Scripts/UI/GameRoot.cs b/unity/Assets/Scripts/UI/GameRoot.csindex 6fb24371e..ce0b69487 100644--- a/unity/Assets/Scripts/UI/GameRoot.cs+++ b/unity/Assets/Scripts/UI/GameRoot.cs@@ -272,7 +272,8 @@ namespace Statecraft.Game.UIvar info = Own(new InfoPanelPresenter(root, bridge, text, names, nav: nav,selectedUnit: () => unitLayer.Selected is string id ? unitLayer.Tokens.First(p => p.Token.Unit.Id == id) : (Statecraft.Game.Map.Units.PlacedToken?)null,regions: regions, localitiesAt: localitiesAt,- townHex: InfoPanelPresenter.TownHex(map.SettlementsFor(inputs.Map.SettlementsYaml), map.Hexes)));+ townHex: InfoPanelPresenter.TownHex(map.SettlementsFor(inputs.Map.SettlementsYaml), map.Hexes),+ townNamesHe: map.SettlementsFor(inputs.Map.SettlementsYaml).ToDictionary(s => s.Id, s => s.NameHe)));// 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// right on every platform, and the scripted run never presses it.diff --git a/unity/Assets/Scripts/UI/InfoPanelPresenter.cs b/unity/Assets/Scripts/UI/InfoPanelPresenter.csindex 24e66d353..1525f6cdb 100644--- a/unity/Assets/Scripts/UI/InfoPanelPresenter.cs+++ b/unity/Assets/Scripts/UI/InfoPanelPresenter.cs@@ -31,6 +31,7 @@ namespace Statecraft.Game.UIreadonly IReadOnlyDictionary<string, string> settlementNames;readonly MapRegions? regions;readonly System.Func<string, (int q, int r)>? townHex;+ readonly IReadOnlyDictionary<string, string>? townNamesHe;/// <param name="localitiesAt">The 1948 localities that lie in a hex (null: the panel lists none); they are listed under the/// settlements with today's name where the shared rule (Localities.TodayName) allows (#245).</param>@@ -42,13 +43,17 @@ namespace Statecraft.Game.UI/// agreement (null: no region line).</param>/// <param name="townHex">The hex each settlement's own point lies in, by id (<see cref="TownHex"/>; null: no note on/// a town drawn from the water hex next door, #204).</param>+ /// <param name="townNamesHe">Each settlement's Hebrew name (name_he), by id: the Hebrew UI names the town in that+ /// note with it, or with the English name where it has none (null: English names). The "Settlements" line keeps the+ /// English names (#558).</param>public InfoPanelPresenter(VisualElement root, SimBridge bridge, UiText text, IReadOnlyDictionary<string, string> settlementNames,ScreenNav? nav = null, System.Func<PlacedToken?>? selectedUnit = null, MapRegions? regions = null,System.Func<int, int, IReadOnlyList<Statecraft.Game.Map.Kits.Localities.Place>>? localitiesAt = null,- System.Func<string, (int q, int r)>? townHex = null)+ System.Func<string, (int q, int r)>? townHex = null, IReadOnlyDictionary<string, string>? townNamesHe = null){panel = root.Q<VisualElement>("info-panel"); this.bridge = bridge; this.text = text;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");localitiesLabel = panel.Q<Label>("info-localities");placement = panel.Q<Label>("info-placement"); reason = panel.Q<Label>("info-reason");@@ -241,7 +246,12 @@ namespace Statecraft.Game.UI// so, so this hex's elevation does not read as the town's (#204).if (townHex != null)foreach (var town in c.SettlementHexes.Where(x => x.Q == q && x.R == r && townHex(x.Id) != (q, r)))- settlements.text += "\n" + text.Format("info.town_in_water", settlementNames[town.Id]);+ {+ // The Hebrew UI names the town in Hebrew (name_he), and in English where it has no Hebrew name.+ var name = text["ui.lang"] == UiLanguage.Hebrew && townNamesHe != null && townNamesHe.TryGetValue(town.Id, out var he)+ && !string.IsNullOrWhiteSpace(he) ? he : settlementNames[town.Id];+ settlements.text += "\n" + text.Format("info.town_in_water", name);+ }ShowLocalities(localitiesAt == null ? "" : LocalitiesText(text, localitiesAt(q, r)));var here = MapActions.At(s, q, r);var queued = bridge.QueuedLike(new MapAction(MapActions.Housing, q, r)) as MapAction;diff --git a/unity/Assets/Tests/EditMode/InfoPanelLayoutTests.cs b/unity/Assets/Tests/EditMode/InfoPanelLayoutTests.csindex 5fb621815..d5b41774d 100644--- a/unity/Assets/Tests/EditMode/InfoPanelLayoutTests.cs+++ b/unity/Assets/Tests/EditMode/InfoPanelLayoutTests.cs@@ -207,24 +207,28 @@ public class InfoPanelLayoutTests/// <summary>#204: Tiberias lies in the lake hex and is drawn on the land hex next to it (hexgrid.settlement_hex), so that/// hex's 70 m is not the town's: its panel says so in one line, in English and in Hebrew. An ordinary hex (Lydda's,- /// whose towns lie in it) has no such line.</summary>+ /// whose towns lie in it) has no such line. The Hebrew line names the town by its name_he (טבריה).</summary>[Test]public void ATownDrawnFromTheWaterHexNextDoorSaysSo(){- var townHex = InfoPanelPresenter.TownHex(SettlementPlacer.Parse(MapFile(SettlementPlacer.DefaultFileName)),- JsonUtility.FromJson<HexFile>(MapFile("hexes.json")));+ var settlements = SettlementPlacer.Parse(MapFile(SettlementPlacer.DefaultFileName));+ var townHex = InfoPanelPresenter.TownHex(settlements, JsonUtility.FromJson<HexFile>(MapFile("hexes.json")));+ var namesHe = settlements.ToDictionary(t => t.Id, t => t.NameHe);var tiberias = C.SettlementHexes.Single(s => s.Id == "tiberias");var lod = C.SettlementHexes.Single(s => s.Id == "lod");var he = UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.StringsHebrew).text, "strings.he.yaml");- foreach (var (text, words) in new[] { (Text, "neighbouring water hex"), (he, "במשושה המים הסמוך") })+ foreach (var (text, line, words) in new[]+ {+ (Text, "Tiberias is shown here because its own hex is water.", "its own hex is water"),+ (he, "טבריה מוצגת כאן, כי המשושה שלה מכוסה במים.", "מכוסה במים"),+ }){using var ui = new UiTestKit();var info = new InfoPanelPresenter(ui.Root, new SimBridge(GameSession.New(C, GoldenRun.Seed, Mode.Historical), text), text, Names(),- townHex: townHex);+ townHex: townHex, townNamesHe: namesHe);info.Show(tiberias.Q, tiberias.R);var lines = ui.Q<Label>("info-settlements").text.Split('\n');- Assert.AreEqual(text.Format("info.town_in_water", "Tiberias"), lines.Last(), $"{text["ui.lang"]}: Tiberias' hex names the water hex");- StringAssert.Contains(words, lines.Last());+ Assert.AreEqual(line, lines.Last(), $"{text["ui.lang"]}: Tiberias' hex names the water hex");info.Show(lod.Q, lod.R);StringAssert.DoesNotContain(words, ui.Q<Label>("info-settlements").text, $"{text["ui.lang"]}: Lydda's hex has no note");info.Dispose();diff --git a/unity/Assets/UI/strings.en.yaml b/unity/Assets/UI/strings.en.yamlindex bcd553448..dac5774e6 100644--- a/unity/Assets/UI/strings.en.yaml+++ b/unity/Assets/UI/strings.en.yaml@@ -212,7 +212,7 @@ date.month_12: "December"info.owned: "Settlements: {0}"info.localities: "1948 localities: {0}"info.locality_today: "{0} (today: {1})"-info.town_in_water: "{0} lies in the neighbouring water hex"+info.town_in_water: "{0} is shown here because its own hex is water."map.today: "Today: {0}"map.mixed: "Mixed locality"minimap.overview: "Zoom all the way out"diff --git a/unity/Assets/UI/strings.he.yaml b/unity/Assets/UI/strings.he.yamlindex 9a3a48360..2db31f39a 100644--- a/unity/Assets/UI/strings.he.yaml+++ b/unity/Assets/UI/strings.he.yaml@@ -203,10 +203,10 @@ date.month_12: "דצמבר"info.owned: "יישובים: {0}"info.localities: "יישובים ב-1948: {0}"info.locality_today: "{0} (היום: {1})"-# info.town_in_water: a town in a lake or sea hex drawn on the land hex next to it (#204); "מיקום {0}" has no verb or-# adjective on the town, so the line agrees whatever its gender, and it fits one line of the panel. For the native-# reviewer (#564).-info.town_in_water: "מיקום {0}: במשושה המים הסמוך"+# info.town_in_water: a town in a lake or sea hex drawn on the land hex next to it (#204), named by its name_he. "מוצגת+# ... שלה" is feminine, as Hebrew city names are; the drift guard (EveryTownDrawnOffItsOwnHexLiesInWater) says only+# Tiberias gets this line today. For the native reviewer (#564).+info.town_in_water: "{0} מוצגת כאן, כי המשושה שלה מכוסה במים."map.today: "היום: {0}"map.mixed: "יישוב מעורב"minimap.overview: "התרחקות מרבית"