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: Star, Report and Share as three round icons at the bottom left of the map screen (Fixes #1236) (#1256)

Beric254d4eefb7d
diff --git a/changelog.d/1236.md b/changelog.d/1236.md
new file mode 100644
index 000000000..0fe25b13b
--- /dev/null
+++ b/changelog.d/1236.md
@@ -0,0 +1,4 @@
+- Star, Report and Share as three round icons, one above the other, at the bottom left of the map screen, at the foot
+ of the side menu's lane (#1236). Each does what its Settings button does and has the same name, shown beside it on
+ hover and on keyboard focus, in English and Hebrew; Tab reaches them after the info panel. The info panel now starts
+ right of that lane and keeps its right edge, which also keeps it off the side menu on a phone held in landscape.
diff --git a/unity/Assets/Scripts/UI/CommunityIconsPresenter.cs b/unity/Assets/Scripts/UI/CommunityIconsPresenter.cs
new file mode 100644
index 000000000..9acac1188
--- /dev/null
+++ b/unity/Assets/Scripts/UI/CommunityIconsPresenter.cs
@@ -0,0 +1,46 @@
+#nullable enable
+using System;
+using System.Linq;
+using UnityEngine.UIElements;
+
+namespace Statecraft.Game.UI
+{
+ /// <summary>Star, Report and Share on the map screen (#1236, v0.1.4): three round icons, one above the other, at the foot
+ /// of the left icon lane (Game.uxml community-column). Each does exactly what its Settings button does: Star opens the
+ /// repository in a new tab (ExternalLink, inside the press), Report opens the report panel (FeedbackPresenter) and Share the
+ /// share panel (SharePresenter), and Close gives the focus back to the icon. Icon-only, as the side menu: each one's name is
+ /// its text, drawn clear, and its tooltip, the Settings button's own string, which HoverTip shows beside the disc.</summary>
+ public sealed class CommunityIconsPresenter : IDisposable
+ {
+ public const string ColumnName = "community-column";
+
+ readonly Button star, report, share;
+ readonly FeedbackPresenter feedback; readonly SharePresenter sharePanel;
+ readonly Action unbindStar;
+ readonly HoverTip? tips;
+
+ public CommunityIconsPresenter(VisualElement root, UiText text, FeedbackPresenter feedback, SharePresenter share)
+ {
+ this.feedback = feedback; sharePanel = share;
+ var column = root.Q(ColumnName);
+ star = column.Q<Button>("hud-star"); report = column.Q<Button>("hud-report"); this.share = column.Q<Button>("hud-share");
+ star.text = text["community.star"]; report.text = text["feedback.open"]; this.share.text = text["share.open"];
+ foreach (var b in new[] { star, report, this.share }) b.tooltip = b.text;
+ unbindStar = ExternalLink.Bind(star, ExternalLink.Repository);
+ report.clicked += OpenReport;
+ this.share.clicked += OpenShare;
+ if (root.Q<Label>(HoverTip.TipName) != null) tips = new HoverTip(root, column.Query<Button>().ToList(), () => HoverTip.Side.Right);
+ }
+
+ void OpenReport() => feedback.Open(report);
+ void OpenShare() => sharePanel.Open(share);
+
+ public void Dispose()
+ {
+ unbindStar();
+ report.clicked -= OpenReport;
+ share.clicked -= OpenShare;
+ tips?.Dispose();
+ }
+ }
+}
diff --git a/unity/Assets/Scripts/UI/CommunityIconsPresenter.cs.meta b/unity/Assets/Scripts/UI/CommunityIconsPresenter.cs.meta
new file mode 100644
index 000000000..cd5fb8c2f
--- /dev/null
+++ b/unity/Assets/Scripts/UI/CommunityIconsPresenter.cs.meta
@@ -0,0 +1,2 @@
+fileFormatVersion: 2
+guid: f799b7f8b824346048895eb827a29569
\ No newline at end of file
diff --git a/unity/Assets/Scripts/UI/GameRoot.cs b/unity/Assets/Scripts/UI/GameRoot.cs
index 8a2c9ecd3..55c3b9c89 100644
--- a/unity/Assets/Scripts/UI/GameRoot.cs
+++ b/unity/Assets/Scripts/UI/GameRoot.cs
@@ -279,6 +279,8 @@ namespace Statecraft.Game.UI
report = Own(new TurnReportPresenter(root, bridge, text, nav!));
// "Share" (#1170), from Settings and the turn report: the frame is captured at its end, before the panel shows.
var sharePanel = share = Own(new SharePresenter(root, bridge, text, done => StartCoroutine(ShareShot.Capture(done))));
+ // 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();
var names = map.SettlementsFor(inputs.Map.SettlementsYaml).ToDictionary(s => s.Id, s => s.Name); // the map's parse (issue #321)
diff --git a/unity/Assets/Scripts/UI/MapLabelsPresenter.cs b/unity/Assets/Scripts/UI/MapLabelsPresenter.cs
index 22bc2d53d..a88a7e70e 100644
--- a/unity/Assets/Scripts/UI/MapLabelsPresenter.cs
+++ b/unity/Assets/Scripts/UI/MapLabelsPresenter.cs
@@ -32,7 +32,7 @@ namespace Statecraft.Game.UI
/// place (village, kibbutz, moshav) beyond DeclutterDistanceM, or when no spot fits. Its anchor class (USS) picks which
/// of the three spots above the kit is tried first; the spots are applied as a pixel shift on the slot's translate (no
/// class change, so no style pass). A spot fits when the pill lies wholly on screen and clear of every panel
- /// (OccluderNames: the top bar and its hanging date plate, the left icon column, the info panel, the minimap and its map-layer caption, the event card), does not
+ /// (OccluderNames: the top bar and its hanging date plate, the left icon column and Star, Report and Share under it (#1236), the info panel, the minimap and its map-layer caption, the event card), does not
/// overlap an already placed pill (its last laid-out size plus MarginPx), covers at most MaxKitCover of its own kit's
/// rectangle and of every other visible kit's, and is more than twice as far from every other visible marker's top as
/// from its own kit (the kit alone, not the tokens on it), plus MarginPx, so no name reads as a neighbour's. Whatever
@@ -92,7 +92,7 @@ namespace Statecraft.Game.UI
/// (".map-label-tier"); in the Hebrew UI the badge is inset from the right edge (owner, on #897).</summary>
const float TierInsetPx = 7f, TierWidthPx = 23f;
/// <summary>The panels a pill never sits under (Game.uxml names).</summary>
- public static readonly string[] OccluderNames = { "top-bar", "date-plate", "left-column", "info-panel", "minimap", "map-layer", "event-card" };
+ public static readonly string[] OccluderNames = { "top-bar", "date-plate", "left-column", "community-column", "info-panel", "minimap", "map-layer", "event-card" };
const string Centre = "anchor-lower-centre", Left = "anchor-lower-left", Right = "anchor-lower-right";
diff --git a/unity/Assets/Scripts/UI/ScreenNav.cs b/unity/Assets/Scripts/UI/ScreenNav.cs
index ee758f65c..197b10235 100644
--- a/unity/Assets/Scripts/UI/ScreenNav.cs
+++ b/unity/Assets/Scripts/UI/ScreenNav.cs
@@ -49,6 +49,7 @@ namespace Statecraft.Game.UI
r.EnableInClassList(EventCardPresenter.ModalClass, modal);
r.Q("top-bar")?.SetEnabled(!(start || outcome || report));
r.Q("left-column")?.SetEnabled(!(start || outcome || report)); // the screens' buttons: usable wherever the top bar is
+ r.Q(CommunityIconsPresenter.ColumnName)?.SetEnabled(!(start || outcome || report)); // Star, Report, Share (#1236): in the same lane
r.Q("right-column")?.SetEnabled(!(start || full || modal || outcome || report));
bool infoCovered = start || full || modal || outcome || report || r.ClassListContains(WideOpenClass);
r.Q("info-panel")?.SetEnabled(!infoCovered);
diff --git a/unity/Assets/Scripts/UI/UiIcon.cs b/unity/Assets/Scripts/UI/UiIcon.cs
index dfe8e87c4..f26d3b1c5 100644
--- a/unity/Assets/Scripts/UI/UiIcon.cs
+++ b/unity/Assets/Scripts/UI/UiIcon.cs
@@ -8,7 +8,7 @@ namespace Statecraft.Game.UI
{
/// <summary>A small vector icon drawn with Painter2D (no image asset), in the promo's style (promo/final/03): a gold coin
/// for the Treasury, figures for Immigration and Public Support, a blue shield for Security, a globe for International
- /// Standing, a banknote for Foreign Currency, two linked rings for Social cohesion, gold line icons for the screen buttons, a star and the GitHub mark for "Star on GitHub" (#1168), and a terrain sign per biome. Each
+ /// Standing, a banknote for Foreign Currency, two linked rings for Social cohesion, gold line icons for the screen buttons, a star and the GitHub mark for "Star on GitHub" (#1168), a speech bubble and the share sign for the map screen's Report and Share icons (#1236), and a terrain sign per biome. Each
/// glyph is drawn in a 24 x 24 design box, scaled to the element's content box and centred in it. In UXML:
/// <c>&lt;Statecraft.Game.UI.UiIcon glyph="coin" /&gt;</c>. An unknown glyph draws nothing.</summary>
[UxmlElement]
@@ -42,7 +42,7 @@ namespace Statecraft.Game.UI
{
["coin"] = Coin, ["people"] = People, ["crowd"] = Crowd, ["shield"] = Shield, ["globe"] = Globe, ["banknote"] = Banknote, ["rings"] = Rings,
["columns"] = Columns, ["scales"] = Scales, ["helmet"] = Helmet, ["question"] = Question, ["book"] = Book, ["restart"] = Restart, ["gear"] = Gear,
- ["hourglass"] = Hourglass, ["star"] = Star, ["mark-github"] = MarkGithub,
+ ["hourglass"] = Hourglass, ["star"] = Star, ["mark-github"] = MarkGithub, ["speech"] = Speech, ["share"] = Share,
["region"] = Region, ["house"] = House, ["village"] = Village, ["flag"] = Flag,
["peaks"] = Peaks, ["skyline"] = Skyline, ["ledger"] = Ledger,
["biome-sea"] = Waves, ["biome-lake"] = Waves, ["biome-coastal_plain"] = Plain, ["biome-hills"] = Hills,
@@ -299,6 +299,33 @@ namespace Statecraft.Game.UI
// as cubics), so Painter2D fills it without an SVG parser. Filled in the gold glyphs' colour.
static void Star(Painter2D p, Func<float, float, Vector2> at, float s, Color gold) => FillCubics(p, at, StarPath, gold);
+ /// <summary>A speech bubble with two lines of text in it (Report a bug or idea, #1236), in gold line: a rounded box with
+ /// a tail at its lower left.</summary>
+ static void Speech(Painter2D p, Func<float, float, Vector2> at, float s, Color gold)
+ {
+ p.strokeColor = gold; p.lineWidth = 1.8f * s;
+ const float l = 3.2f, t = 4.2f, r = 20.8f, b = 16.4f, k = 2.6f; // the box and its corner radius
+ p.BeginPath();
+ p.MoveTo(at(l + k, t)); p.LineTo(at(r - k, t)); p.Arc(at(r - k, t + k), k * s, Angle.Degrees(270), Angle.Degrees(360));
+ p.LineTo(at(r, b - k)); p.Arc(at(r - k, b - k), k * s, Angle.Degrees(0), Angle.Degrees(90));
+ p.LineTo(at(10.4f, b)); p.LineTo(at(6.2f, 20.4f)); p.LineTo(at(6.8f, b)); p.LineTo(at(l + k, b));
+ p.Arc(at(l + k, b - k), k * s, Angle.Degrees(90), Angle.Degrees(180));
+ p.LineTo(at(l, t + k)); p.Arc(at(l + k, t + k), k * s, Angle.Degrees(180), Angle.Degrees(270));
+ p.ClosePath(); p.Stroke();
+ p.lineWidth = 1.4f * s;
+ p.BeginPath(); p.MoveTo(at(7.4f, 8.6f)); p.LineTo(at(16.6f, 8.6f)); p.Stroke();
+ p.BeginPath(); p.MoveTo(at(7.4f, 12.2f)); p.LineTo(at(13.6f, 12.2f)); p.Stroke();
+ }
+
+ /// <summary>The share sign (Share, #1236): three gold nodes, one on the left and two on the right, joined by two lines.</summary>
+ static void Share(Painter2D p, Func<float, float, Vector2> at, float s, Color gold)
+ {
+ p.strokeColor = gold; p.lineWidth = 1.8f * s;
+ p.BeginPath(); p.MoveTo(at(17.4f, 5.8f)); p.LineTo(at(6.6f, 12f)); p.LineTo(at(17.4f, 18.2f)); p.Stroke();
+ p.fillColor = gold;
+ foreach (var (x, y) in new[] { (17.6f, 5.6f), (6.4f, 12f), (17.6f, 18.4f) }) { Circle(p, at(x, y), 3.1f * s); p.Fill(); }
+ }
+
static void MarkGithub(Painter2D p, Func<float, float, Vector2> at, float s, Color gold) => FillCubics(p, at, MarkGithubPath, gold);
/// <summary>Fills the outline <paramref name="d"/>: a start point, then (control 1, control 2, end) per segment.</summary>
diff --git a/unity/Assets/Tests/EditMode/CommunityIconsTests.cs b/unity/Assets/Tests/EditMode/CommunityIconsTests.cs
new file mode 100644
index 000000000..73e90706a
--- /dev/null
+++ b/unity/Assets/Tests/EditMode/CommunityIconsTests.cs
@@ -0,0 +1,307 @@
+#nullable enable
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using NUnit.Framework;
+using Statecraft.Game;
+using Statecraft.Game.Map;
+using Statecraft.Game.UI;
+using Statecraft.Sim;
+using UnityEditor;
+using UnityEngine;
+using UnityEngine.TestTools;
+using UnityEngine.UIElements;
+
+/// <summary>#1236 (v0.1.4): Star, Report and Share as three round icons, one above the other, at the foot of the map
+/// screen's left icon lane, under the side-menu discs. Each does what its Settings button does (ExternalLink to the
+/// repository, the Report panel, the Share panel); each one's name is its text (drawn clear) and its tooltip, which HoverTip
+/// shows beside it, in English and Hebrew. They stay at the bottom left in Hebrew, as the side menu does (#550).</summary>
+public class CommunityIconsTests
+{
+ static readonly Content C = ContentLoader.Load(Paths.Content);
+ static readonly HexFile Hexes = MapBuilder.LoadHexes(Path.Combine(Paths.Content, "map", "hexes.json"));
+ 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");
+ static string MapFile(string name) => File.ReadAllText(Path.Combine(Paths.Content, "map", name));
+ static MapRegions Regions() => new MapRegions(Subdistricts1948.Parse(MapFile(Subdistricts1948.FileName)), Armistice1949.Parse(MapFile(Armistice1949.FileName)));
+ static Dictionary<string, string> Names() => SettlementPlacer.Parse(MapFile(SettlementPlacer.DefaultFileName)).ToDictionary(t => t.Id, t => t.Name);
+
+ const string Column = "community-column"; // CommunityIconsPresenter.ColumnName
+
+ /// <summary>Top to bottom: the button, the string its name and tooltip are (the Settings buttons' own), its glyph.</summary>
+ static readonly (string name, string key, string glyph)[] Icons =
+ {
+ ("hud-star", "community.star", "star"), ("hud-report", "feedback.open", "speech"), ("hud-share", "share.open", "share"),
+ };
+
+ /// <summary>The layout suites' sizes (InfoPanelLayoutTests, LeftColumnTests: the smaller upright phones) and two phones
+ /// held in landscape (TopBarTests' 844x390, and 667x375).</summary>
+ static readonly (int w, int h)[] Landscape = { (844, 390), (667, 375) };
+ static readonly (int w, int h)[] Windows = InfoPanelLayoutTests.Windows.Concat(new[] { (360, 800), (375, 667) }).Concat(Landscape).ToArray();
+
+ static GameSession WithAnEventOpen()
+ {
+ var g = GameSession.New(C, GoldenRun.Seed, Mode.Historical);
+ for (int t = 0; g.State.PendingEvents.Count == 0; t++)
+ {
+ if (t >= 50) Assert.Fail("no event within 50 turns");
+ g.Step(new Command[0]);
+ }
+ return g;
+ }
+
+ /// <summary>The real Game.uxml on the real PanelSettings at w x h, with the top bar, the side menu, the decision card (open
+ /// when the session has an event), the info panel on the hex given, the minimap and the border caption.</summary>
+ static IEnumerator Rendered(int w, int h, bool hebrew, GameSession g, (int q, int r)? hex, System.Action<VisualElement> check)
+ {
+ var text = hebrew ? He : En;
+ var rt = new RenderTexture(w, h, 0);
+ var ps = Object.Instantiate(AssetDatabase.LoadAssetAtPath<PanelSettings>(UiPaths.Panel));
+ ps.targetTexture = rt;
+ var go = new GameObject("CommunityIconsTest");
+ go.SetActive(false);
+ var doc = go.AddComponent<UIDocument>();
+ doc.panelSettings = ps;
+ doc.visualTreeAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(UiPaths.GameUxml);
+ go.SetActive(true);
+ var root = doc.rootVisualElement;
+ root.Q("root").RemoveFromClassList("loading");
+ if (hebrew) root.Q("root").AddToClassList(UiLanguage.HebrewClass);
+ var bridge = new SimBridge(g, text);
+ var hud = new HudPresenter(root, bridge, text);
+ var nav = new ScreenNav(root);
+ var card = new EventCardPresenter(root, bridge, text, null);
+ var info = new InfoPanelPresenter(root, bridge, text, Names(), regions: Regions());
+ var mini = new MinimapPresenter(root, Hexes, text);
+ var layer = root.Q<Label>("map-layer");
+ layer.text = "Mandate sub-districts, 1947";
+ layer.style.display = DisplayStyle.Flex;
+ try
+ {
+ if (hex is { } x) info.Show(x.q, x.r);
+ for (int i = 0; i < 30 && !(root.Q("nav-cabinet").layout.width > 0); i++) yield return null;
+ for (int i = 0; i < 3; i++) yield return null;
+ check(root);
+ }
+ finally
+ {
+ mini.Dispose(); info.Dispose(); card.Dispose(); nav.Dispose(); hud.Dispose();
+ Object.DestroyImmediate(go); Object.DestroyImmediate(ps); rt.Release(); Object.DestroyImmediate(rt);
+ }
+ }
+
+ static Rect Hull(IEnumerable<VisualElement> parts) => parts.Select(b => b.worldBound)
+ .Aggregate((a, b) => Rect.MinMaxRect(Mathf.Min(a.xMin, b.xMin), Mathf.Min(a.yMin, b.yMin), Mathf.Max(a.xMax, b.xMax), Mathf.Max(a.yMax, b.yMax)));
+
+ /// <summary>At every size, in English and Hebrew, with Lydda's hex and Tel Aviv's (the GDD city panel) chosen and a card
+ /// open: the three icons lie in the window, at its bottom left, one above the other, at least 24 screen px each, and
+ /// overlap neither the info panel, the side menu, the minimap, the border caption, the top bar nor the card. The info
+ /// panel, moved right of the lane to make room, clears the side menu too.</summary>
+ [UnityTest]
+ public IEnumerator TheIconsFitEveryWindowAtTheBottomLeftClearOfThePanels()
+ {
+ var problems = new List<string>();
+ var g = WithAnEventOpen();
+ var lod = C.SettlementHexes.Single(s => s.Id == "lod"); var city = C.SettlementHexes.Single(s => s.Id == "tel_aviv");
+ foreach (var hebrew in new[] { false, true })
+ foreach (var (w, h) in Windows)
+ foreach (var (what, q, r) in new[] { ("Lydda", lod.Q, lod.R), ("Tel Aviv", city.Q, city.R) })
+ yield return Rendered(w, h, hebrew, g, (q, r), root =>
+ {
+ string at = $"{(hebrew ? "he" : "en")} {w}x{h} {what}";
+ var window = root.worldBound;
+ float scale = w / window.width;
+ var buttons = Icons.Select(i => root.Q<Button>(i.name)).ToList();
+ if (buttons.Any(b => b == null)) { problems.Add($"{at}: precondition: the three icons exist"); return; }
+ foreach (var shown in new[] { "event-card", "info-panel", "minimap", "map-layer" })
+ if (!(root.Q(shown).worldBound.width > 0)) problems.Add($"{at}: precondition: {shown} shows");
+ var hull = Hull(buttons);
+ TestContext.WriteLine($"{at}: icons {hull}, info {root.Q("info-panel").worldBound}, column {Hull(root.Q("left-column").Query<Button>().ToList())}");
+ if (!(hull.xMin >= window.xMin && hull.xMax <= window.xMax && hull.yMin >= window.yMin && hull.yMax <= window.yMax)) problems.Add($"{at}: the icons {hull} leave the window {window}");
+ if (hull.xMin - window.xMin > 0.03f * window.width) problems.Add($"{at}: the icons {hull} are not at the left edge");
+ if (window.yMax - hull.yMax > 0.03f * window.height) problems.Add($"{at}: the icons {hull} are not at the bottom");
+ for (int i = 1; i < buttons.Count; i++)
+ if (!(buttons[i].worldBound.yMin >= buttons[i - 1].worldBound.yMax) || Mathf.Abs(buttons[i].worldBound.center.x - buttons[0].worldBound.center.x) > 0.5f)
+ problems.Add($"{at}: {buttons[i].name} {buttons[i].worldBound} is not under {buttons[i - 1].name} {buttons[i - 1].worldBound}");
+ foreach (var b in buttons)
+ {
+ // The 24 screen px floor at the sizes the side menu keeps it (LeftColumnTests); on a phone held in landscape
+ // the one-row bar's 45 px discs come out smaller, the side menu's too: there the icons are its size.
+ if (Landscape.Contains((w, h))) { if (b.worldBound.width < root.Q<Button>("nav-cabinet").worldBound.width - 0.5f) problems.Add($"{at}: {b.name} is smaller than the side menu's discs"); }
+ else if (b.worldBound.width * scale < 24f || b.worldBound.height * scale < 24f) problems.Add($"{at}: {b.name} is {b.worldBound.width * scale:0} px, under 24");
+ if (b.resolvedStyle.color.a > 0.01f) problems.Add($"{at}: {b.name}'s caption shows");
+ }
+ var column = Hull(root.Q("left-column").Query<Button>().ToList());
+ foreach (var (name, other) in new[] { ("the info panel", root.Q("info-panel").worldBound), ("the side menu", column), ("the minimap", root.Q("minimap").worldBound),
+ ("the border caption", root.Q("map-layer").worldBound), ("the top bar", root.Q("top-bar").worldBound), ("the decision card", root.Q("event-card").worldBound) })
+ if (other.Overlaps(hull)) problems.Add($"{at}: the icons {hull} overlap {name} {other}");
+ if (root.Q("info-panel").worldBound.Overlaps(column)) problems.Add($"{at}: the info panel {root.Q("info-panel").worldBound} overlaps the side menu {column}");
+ });
+ Assert.IsEmpty(problems, string.Join("\n", problems));
+ }
+
+ /// <summary>Each icon is a round disc with its own glyph, named in both languages by the Settings button's string (its
+ /// text, drawn clear, and its tooltip); Star opens the repository (a click, Enter or Space), Report and Share open their
+ /// panels, and Close gives the focus back to the icon. Disposed, the icons are unwired.</summary>
+ [Test]
+ public void EachIconIsNamedAndDoesWhatItsSettingsButtonDoes([Values(false, true)] bool hebrew)
+ {
+ var text = hebrew ? He : En;
+ var opened = new List<string>();
+ ExternalLink.Opener = opened.Add;
+ ShareShot.Keep = (png, name) => { };
+ ShareShot.CanShareFiles = () => true;
+ try
+ {
+ using var ui = new UiTestKit();
+ var bridge = new SimBridge(GameSession.New(C, GoldenRun.Seed, Mode.Historical), text);
+ using var feedback = new FeedbackPresenter(ui.Root, text, "v-test");
+ using var share = new SharePresenter(ui.Root, bridge, text, done => done(new byte[] { 1 }));
+ var icons = new CommunityIconsPresenter(ui.Root, text, feedback, share);
+ CollectionAssert.AreEqual(Icons.Select(i => i.name).ToArray(), ui.Q<VisualElement>(Column).Query<Button>().ToList().Select(b => b.name).ToArray(), "the icons, top to bottom");
+ foreach (var (name, key, glyph) in Icons)
+ {
+ var b = ui.Q<Button>(name);
+ Assert.AreEqual(text[key], b.text, name + ": its name is the Settings button's");
+ Assert.AreEqual(b.text, b.tooltip, name + ": the tooltip says the name");
+ Assert.AreEqual(glyph, b.Q<UiIcon>()?.Glyph, name + ": its glyph");
+ Assert.IsTrue(b.focusable, name + ": Tab reaches it");
+ }
+ CollectionAssert.Contains(UiIcon.Glyphs, "speech"); CollectionAssert.Contains(UiIcon.Glyphs, "share");
+
+ var star = ui.Q<Button>("hud-star");
+ SettingsScreenTests.PressWithPointer(star);
+ UiTestKit.Press(star);
+ CollectionAssert.AreEqual(new[] { ExternalLink.Repository, ExternalLink.Repository }, opened, "a click, then Enter or Space");
+
+ var report = ui.Q<Button>("hud-report");
+ UiTestKit.Press(report);
+ Assert.IsTrue(feedback.IsOpen, "Report opens the report panel");
+ feedback.Close();
+ Assert.AreEqual(report, report.focusController.focusedElement, "Close gives the focus back to the icon");
+
+ var shareIcon = ui.Q<Button>("hud-share");
+ UiTestKit.Press(shareIcon);
+ Assert.IsTrue(share.IsOpen, "Share opens the share panel");
+ share.Close();
+ Assert.AreEqual(shareIcon, shareIcon.focusController.focusedElement, "Close gives the focus back to the icon");
+
+ icons.Dispose();
+ UiTestKit.Press(star); UiTestKit.Press(report);
+ Assert.AreEqual(2, opened.Count, "disposed, Star is unwired");
+ Assert.IsFalse(feedback.IsOpen, "disposed, Report is unwired");
+ UiTestKit.Press(shareIcon);
+ Assert.IsFalse(share.IsOpen, "disposed, Share is unwired");
+ }
+ finally
+ {
+ ExternalLink.Opener = ExternalLink.Default;
+ ShareShot.Keep = ShareShot.DefaultKeep; ShareShot.CanShareFiles = ShareShot.DefaultCanShareFiles;
+ }
+ }
+
+ /// <summary>The icons follow the side menu: usable under the decision card (they sit in its lane, which the card's
+ /// backdrop leaves free), out of reach under the start screen, an outcome clip and the turn report, hidden under the
+ /// start screen and while loading; Tab reaches them after the info panel's actions. Each shows its name on hover.</summary>
+ [UnityTest]
+ public IEnumerator TheIconsAreCoveredWhereTheSideMenuIsAndShowTheirNames()
+ {
+ var g = WithAnEventOpen();
+ var lod = C.SettlementHexes.Single(s => s.Id == "lod");
+ foreach (var hebrew in new[] { false, true })
+ yield return Rendered(1920, 1080, hebrew, g, (lod.Q, lod.R), root =>
+ {
+ string at = hebrew ? "he" : "en";
+ var text = hebrew ? He : En;
+ using var feedback = new FeedbackPresenter(root, text, "v-test");
+ using var share = new SharePresenter(root, new SimBridge(g, text), text, done => done(new byte[] { 1 }));
+ using var icons = new CommunityIconsPresenter(root, text, feedback, share);
+ var column = root.Q(Column);
+ var r = root.Q("root");
+ Assert.IsTrue(r.ClassListContains(EventCardPresenter.ModalClass), at + ": precondition: the card is open");
+ ScreenNav.DisableCovered(root);
+ Assert.IsTrue(column.enabledInHierarchy, at + ": usable under the card, as the side menu is");
+ var star = root.Q<Button>("hud-star");
+ var picked = root.panel.Pick(star.worldBound.center);
+ Assert.IsTrue(picked == star || picked?.GetFirstAncestorOfType<Button>() == star, $"{at}: the card's backdrop does not take its press ({picked?.name})");
+ var order = root.Query<VisualElement>().Where(e => e.focusable && e.canGrabFocus && e.tabIndex >= 0 && e is Button).ToList().Select(e => e.name).ToList();
+ CollectionAssert.AreEqual(Icons.Select(i => i.name).ToArray(), order.Where(n => n.StartsWith("hud-")).ToArray(), at + ": Tab reaches them top to bottom");
+ Assert.Less(order.IndexOf("end-turn"), order.IndexOf("hud-star"), at + ": after End Turn");
+ foreach (var cover in new[] { StartScreenPresenter.OpenClass, OutcomePresenter.OpenClass, TurnReportPresenter.OpenClass })
+ {
+ r.AddToClassList(cover); ScreenNav.DisableCovered(root);
+ Assert.IsFalse(column.enabledSelf, $"{at}: out of reach under {cover}");
+ r.RemoveFromClassList(cover); ScreenNav.DisableCovered(root);
+ Assert.IsTrue(column.enabledSelf, $"{at}: back after {cover}");
+ }
+ var tip = root.Q<Label>(HoverTip.TipName);
+ foreach (var (name, _, _) in Icons)
+ {
+ var b = root.Q<Button>(name);
+ using (var e = PointerEnterEvent.GetPooled(new Event { type = EventType.MouseMove, mousePosition = b.worldBound.center }))
+ { e.target = b; b.SendEvent(e); }
+ Assert.AreEqual(DisplayStyle.Flex, tip.style.display.value, $"{at}: hovering {name} shows its tip");
+ Assert.AreEqual(b.tooltip, tip.text, $"{at}: {name}'s tip says its name");
+ Assert.GreaterOrEqual(tip.style.left.value.value, b.worldBound.xMax - 0.5f, $"{at}: the tip of {name} is beside it, not over it");
+ using (var e = PointerLeaveEvent.GetPooled(new Event { type = EventType.MouseMove, mousePosition = Vector2.zero }))
+ { e.target = b; b.SendEvent(e); }
+ }
+ });
+ // The stylesheet hides them with the side menu under the start screen and while loading.
+ foreach (var hebrew in new[] { false, true })
+ foreach (var cover in new[] { StartScreenPresenter.OpenClass, "loading" })
+ {
+ yield return RenderedWith(1920, 1080, hebrew, cover, root =>
+ {
+ var col = root.Q(Column).resolvedStyle;
+ if (cover == "loading") Assert.AreEqual(Visibility.Hidden, col.visibility, $"{cover}: hidden while loading, as the side menu");
+ else Assert.AreEqual(DisplayStyle.None, col.display, $"{cover}: hidden under the start screen, as the side menu");
+ });
+ }
+ }
+
+ /// <summary>The bare Game.uxml at w x h with <paramref name="rootClass"/> on its root, after its layout.</summary>
+ static IEnumerator RenderedWith(int w, int h, bool hebrew, string rootClass, System.Action<VisualElement> check)
+ {
+ var rt = new RenderTexture(w, h, 0);
+ var ps = Object.Instantiate(AssetDatabase.LoadAssetAtPath<PanelSettings>(UiPaths.Panel));
+ ps.targetTexture = rt;
+ var go = new GameObject("CommunityIconsCover");
+ go.SetActive(false);
+ var doc = go.AddComponent<UIDocument>();
+ doc.panelSettings = ps;
+ doc.visualTreeAsset = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(UiPaths.GameUxml);
+ go.SetActive(true);
+ var root = doc.rootVisualElement;
+ root.Q("root").RemoveFromClassList("loading");
+ if (hebrew) root.Q("root").AddToClassList(UiLanguage.HebrewClass);
+ root.Q("root").AddToClassList(rootClass);
+ try
+ {
+ for (int i = 0; i < 5; i++) yield return null;
+ check(root);
+ }
+ finally { Object.DestroyImmediate(go); Object.DestroyImmediate(ps); rt.Release(); Object.DestroyImmediate(rt); }
+ }
+
+ /// <summary>On a phone upright the hint chip (no hex chosen yet) sits over the icons, clear of them, in English and Hebrew.</summary>
+ [UnityTest]
+ public IEnumerator OnAPhoneTheEmptyHintClearsTheIcons()
+ {
+ var problems = new List<string>();
+ var g = GameSession.New(C, GoldenRun.Seed, Mode.Historical);
+ foreach (var hebrew in new[] { false, true })
+ foreach (var (w, h) in new[] { (390, 844), (360, 800), (375, 667) })
+ yield return Rendered(w, h, hebrew, g, null, root =>
+ {
+ string at = $"{(hebrew ? "he" : "en")} {w}x{h}";
+ var panel = root.Q("info-panel");
+ if (!panel.ClassListContains("info-empty") || !(panel.worldBound.width > 0)) { problems.Add($"{at}: precondition: the hint chip shows"); return; }
+ var hull = Hull(Icons.Select(i => root.Q<Button>(i.name)));
+ if (panel.worldBound.Overlaps(hull)) problems.Add($"{at}: the hint {panel.worldBound} overlaps the icons {hull}");
+ if (panel.worldBound.Overlaps(root.Q("minimap").worldBound)) problems.Add($"{at}: the hint {panel.worldBound} overlaps the minimap");
+ });
+ Assert.IsEmpty(problems, string.Join("\n", problems));
+ }
+}
diff --git a/unity/Assets/Tests/EditMode/CommunityIconsTests.cs.meta b/unity/Assets/Tests/EditMode/CommunityIconsTests.cs.meta
new file mode 100644
index 000000000..4dd55538f
--- /dev/null
+++ b/unity/Assets/Tests/EditMode/CommunityIconsTests.cs.meta
@@ -0,0 +1,2 @@
+fileFormatVersion: 2
+guid: 7a9eab5c18cb1f9d38e377e758182212
\ No newline at end of file
diff --git a/unity/Assets/Tests/EditMode/HebrewUiTests.cs b/unity/Assets/Tests/EditMode/HebrewUiTests.cs
index cfb8db7a3..ad0303554 100644
--- a/unity/Assets/Tests/EditMode/HebrewUiTests.cs
+++ b/unity/Assets/Tests/EditMode/HebrewUiTests.cs
@@ -296,6 +296,7 @@ public class HebrewUiTests
("settings-uiscale-label", "settings.uiscale"),
("settings-community-label", "settings.community"), ("settings-star", "community.star"), ("start-star", "community.star"),
("settings-report", "feedback.open"), ("start-report", "feedback.open"), ("feedback-title", "feedback.open"), // #1169
+ ("hud-star", "community.star"), ("hud-report", "feedback.open"), ("hud-share", "share.open"), // #1236
("feedback-intro", "feedback.intro"), ("feedback-bug", "feedback.bug"), ("feedback-feature", "feedback.feature"),
("feedback-itch", "feedback.itch"), ("feedback-close", "report.close"),
("settings-share", "share.open"), ("turn-report-share", "share.open"), ("share-title", "share.title"), // #1170
diff --git a/unity/Assets/UI/Game.uxml b/unity/Assets/UI/Game.uxml
index 97bd4e7a7..73be36902 100644
--- a/unity/Assets/UI/Game.uxml
+++ b/unity/Assets/UI/Game.uxml
@@ -160,6 +160,14 @@
<ui:VisualElement name="info-gdd" class="info-gdd" />
<Statecraft.Game.UI.UiFrame filigree="true" />
</ui:VisualElement>
+ <!-- Star, Report and Share (#1236, CommunityIconsPresenter): three round icons at the foot of the side menu's lane, at
+ the bottom left (the info panel starts right of the lane). Icon-only as the side menu: each one's name is its text,
+ drawn clear, and its tooltip (HoverTip). After the info panel in the tree, so Tab reaches them after its actions. -->
+ <ui:VisualElement name="community-column" class="community-column" picking-mode="Ignore">
+ <ui:Button name="hud-star" text="Star on GitHub" class="nav-button rail-button"><Statecraft.Game.UI.UiIcon glyph="star" class="nav-disc" /></ui:Button>
+ <ui:Button name="hud-report" text="Report a bug or idea" class="nav-button rail-button"><Statecraft.Game.UI.UiIcon glyph="speech" class="nav-disc" /></ui:Button>
+ <ui:Button name="hud-share" text="Share" class="nav-button rail-button"><Statecraft.Game.UI.UiIcon glyph="share" class="nav-disc" /></ui:Button>
+ </ui:VisualElement>
<!-- The decision layer under the top bar (decision cards, 2026-10-13): while an event is open a dim backdrop blocks the
map and the panels under it, and the card sits in the middle, up to 1040 px wide, with a 16:9 media header (the
event's photograph). Hidden under the start screen and any open screen (ScreenNav.DisableCovered). -->
diff --git a/unity/Assets/UI/Statecraft.uss b/unity/Assets/UI/Statecraft.uss
index f0211fd7f..4de0786f0 100644
--- a/unity/Assets/UI/Statecraft.uss
+++ b/unity/Assets/UI/Statecraft.uss
@@ -247,6 +247,20 @@ Button:disabled { color: var(--ink-dim); border-color: rgba(120, 120, 120, 0.4);
.hud-three-row .left-column > .rail-button { width: 60px; height: 60px; margin: 0 0 12px 0; }
.hud-three-row .left-column > .rail-button .nav-disc { width: 60px; height: 60px; padding: 14px; border-radius: 30px; }
.hud-three-row .event-gutter { width: 76px; }
+/* Star, Report and Share (#1236, CommunityIconsPresenter): the side menu's discs at each tier (the same numbers as the rules
+ above, in rules of their own: tools/headed.py reads the side menu's rules by their selectors), one above the other at
+ the foot of the same lane, from the window's bottom up, so they keep the bottom left whatever the bar's height. The side
+ menu ends far above them at every size (CommunityIconsTests). In Hebrew they stay at the left, as the side menu does
+ (#550): the Hebrew UI mirrors rows, not the screen's corners. The info panel starts right of the lane to make room. */
+.community-column { position: absolute; left: 16px; bottom: 16px; width: 56px; align-items: center; }
+.community-column .rail-button { width: 45px; height: 45px; margin: 0 0 3px 0; padding: 0; font-size: 1px; color: rgba(0, 0, 0, 0); }
+.community-column .rail-button:hover, .community-column .rail-button:focus { color: rgba(0, 0, 0, 0); }
+.community-column .rail-button .nav-disc { top: 0; left: 0; width: 45px; height: 45px; padding: 10.5px; border-radius: 22.5px; }
+.hud-narrow .community-column > .rail-button { width: 50px; height: 50px; margin: 0 0 6px 0; }
+.hud-narrow .community-column > .rail-button .nav-disc { width: 50px; height: 50px; padding: 11px; border-radius: 25px; }
+.hud-three-row .community-column { width: 60px; }
+.hud-three-row .community-column > .rail-button { width: 60px; height: 60px; margin: 0 0 12px 0; }
+.hud-three-row .community-column > .rail-button .nav-disc { width: 60px; height: 60px; padding: 14px; border-radius: 30px; }
.hud-three-row .event-scrim { left: 60px; }
.right-gap { flex-grow: 1; flex-shrink: 0; min-height: 16px; }
/* The decision layer: the room under the bar, top per HUD tier as the column's. While an event is open (event-open on the
@@ -345,8 +359,10 @@ Button:disabled { color: var(--ink-dim); border-color: rgba(120, 120, 120, 0.4);
/* The line over the greyed-out options when the Attention left cannot pay for an answer (#1034). */
.event-delegate { display: none; white-space: normal; margin: 4px 0; color: var(--gold-light); }
.draft { display: none; color: var(--down); -unity-font-definition: url("project://database/Assets/UI/Fonts/EBGaramond-SemiBold.ttf"); -unity-text-align: middle-center; }
-/* The info panel: the hex's terrain sign (UiIcon on the biome's map colour, InfoPanelPresenter) beside its facts. */
-.info-panel { position: absolute; left: 16px; bottom: 16px; width: 520px; min-height: 160px; flex-direction: row; align-items: flex-start; }
+/* The info panel: the hex's terrain sign (UiIcon on the biome's map colour, InfoPanelPresenter) beside its facts. It starts
+ right of the left icon lane (84 px, as the toast; #1236: Star, Report and Share sit at the lane's foot) and keeps its right
+ edge (536 px; 936 px with the GDD column), so the side screens beside it keep their place. */
+.info-panel { position: absolute; left: 84px; bottom: 16px; width: 452px; min-height: 160px; flex-direction: row; align-items: flex-start; }
.info-thumb {
width: 92px; height: 116px; flex-shrink: 0; margin-right: 14px; padding: 10px;
border-width: 1px; border-color: var(--gold); border-radius: 2px; background-color: var(--navy-deep);
@@ -358,7 +374,7 @@ Button:disabled { color: var(--ink-dim); border-color: rgba(120, 120, 120, 0.4);
Build/Stop. A second column beside the hex's facts, so the panel stays under the left column on a short window
(InfoPanelLayoutTests.TheGddCityAndSitePanelsFitEveryWindow): the panel widens to hold it. Its rows wrap their buttons,
a long button label wraps, and a row mirrors in Hebrew (.lang-he .row). */
-.info-panel.info-gdd-shown { width: 920px; }
+.info-panel.info-gdd-shown { width: 852px; }
.info-gdd { flex-direction: column; width: 380px; flex-shrink: 0; margin-left: 14px; padding-left: 14px; border-left-width: 1px; border-color: var(--gold-dim); }
.info-gdd-line { font-size: 17px; flex-shrink: 1; }
.info-gdd-row { flex-wrap: wrap; align-items: center; }
@@ -383,7 +399,9 @@ Button:disabled { color: var(--ink-dim); border-color: rgba(120, 120, 120, 0.4);
.info-panel.info-empty { min-height: 0; width: auto; padding: 8px 16px; }
.info-empty .gold-rule, .info-empty #info-subtitle, .info-empty .reason { display: none; }
.info-empty #info-title { font-size: 20px; }
-.hud-three-row .info-panel.info-empty { right: 254px; }
+/* On a phone upright the hint chip keeps the window's width from the left edge (two lines, InfoPanelLayoutTests), so it sits
+ over Star, Report and Share (#1236): the window's 16 px, three 60 px discs with their 12 px margins, and a 12 px gap. */
+.hud-three-row .info-panel.info-empty { left: 16px; bottom: 244px; right: 254px; }
.hud-three-row .info-empty #info-title { white-space: normal; }
/* The hex's facts as the promo's icon rows: a gold sign, then the line, which wraps inside the panel (#397). A unit's card
reuses the lines without the signs (they name a hex's facts, not a unit's). */
@@ -751,7 +769,7 @@ Button.settings-choice-selected { -unity-font-definition: url("project://databas
.loading-line { display: none; position: absolute; left: 0; right: 0; top: 45%; -unity-text-align: middle-center; font-size: 28px; color: var(--ink); white-space: normal; padding-left: 24px; padding-right: 24px; }
.loading .loading-line { display: flex; }
.root.loading { background-color: var(--navy-solid); } /* the template's navy, not the default sky (final review M1) */
-.loading .date-box, .loading .meters, .loading .nav, .loading .left-column, .loading .turn-box, .loading .info-panel, .loading .right-column, .loading .event-layer { visibility: hidden; }
+.loading .date-box, .loading .meters, .loading .nav, .loading .left-column, .loading .community-column, .loading .turn-box, .loading .info-panel, .loading .right-column, .loading .event-layer { visibility: hidden; }
/* Map labels (visual v1 Task 9; promo HUD pass: rounder, a firmer gold edge): the promo's dark pill with a thin gold edge, in EB Garamond SemiBold. Each pill sits in a
zero-size slot that MapLabelsPresenter moves with an inline translate; the anchor class says which corner of the pill sits
@@ -838,7 +856,7 @@ Button.settings-choice-selected { -unity-font-definition: url("project://databas
whole painting, as a full-width band, over the panel (StartScreenPresenter.Fit). */
.start-screen { display: none; position: absolute; left: 0; top: 0; right: 0; bottom: 0; background-color: var(--navy-deep); }
.start-open .start-screen { display: flex; }
-.start-open .top-bar, .start-open .left-column, .start-open .right-column, .start-open .event-layer, .start-open .info-panel, .start-open .screen, .start-open .map-labels { display: none; }
+.start-open .top-bar, .start-open .left-column, .start-open .community-column, .start-open .right-column, .start-open .event-layer, .start-open .info-panel, .start-open .screen, .start-open .map-labels { display: none; }
.start-art {
position: absolute; left: 0; top: 0; right: 0; bottom: 0;
background-image: url("project://database/Assets/UI/StartScreen/declaration-hall.jpg");
@@ -968,5 +986,5 @@ Button.settings-choice-selected { -unity-font-definition: url("project://databas
.lang-he .info-gdd { margin-left: 0; padding-left: 0; border-left-width: 0; margin-right: 14px; padding-right: 14px; border-right-width: 1px; }
.lang-he .info-gdd Button, .lang-he .info-projects Button { margin: 2px 0 2px 6px; }
.lang-he .info-gdd-pairs > .info-gdd-line { margin-right: 0; margin-left: 14px; }
-.hud-two-row .info-panel.info-gdd-shown { width: 520px; flex-wrap: wrap; }
+.hud-two-row .info-panel.info-gdd-shown { width: 452px; flex-wrap: wrap; }
.hud-two-row .info-gdd { width: 100%; margin: 8px 0 0 0; padding: 8px 0 0 0; border-left-width: 0; border-right-width: 0; border-top-width: 1px; }