A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
Advisors S2: the opening chain replaces the first-turn guide (Refs #1484) (#1576)
Eyal Golanecb292e4e653
diff --git a/changelog.d/advisors-s2.md b/changelog.d/advisors-s2.mdnew file mode 100644index 000000000..4e82c5efc--- /dev/null+++ b/changelog.d/advisors-s2.md@@ -0,0 +1,6 @@+### Changed++- The first-turn guide is replaced by the advisors' opening chain: on the first new game David Ben-Gurion, Golda+ Meyerson and Moshe Dayan show the same essentials in a side popup, one step at a time, with the same gold ring; the+ event step speaks before the card opens. How to play's button opens it again. The seven lines match the recorded+ ones, and the owner approved the Hebrew as a native reviewer (Refs #1484).diff --git a/unity/Assets/Resources/Advisors/advisor-messages.yaml b/unity/Assets/Resources/Advisors/advisor-messages.yamlindex c31439cc1..2d71c51fd 100644--- a/unity/Assets/Resources/Advisors/advisor-messages.yaml+++ b/unity/Assets/Resources/Advisors/advisor-messages.yaml@@ -8,5 +8,18 @@ advisors:- { id: ben_gurion, person: ben_gurion }- { id: meyerson, person: golda_meir }- { id: dayan, person: dayan }-messages: []+messages:+# The opening chain (spec 9.2): shown once on the first new game, step by step, each pointing at the part of the HUD the+# first-turn guide pointed at; its event step speaks before the card opens, and its Show me opens the card (spec 9.3).+# The seven opening lines' Hebrew: approved by the owner, a native speaker, in chat on 24 October 2026 (about 11:42 IDT):+# "Approved".+ - { id: opening.greeting, advisor: ben_gurion, signal: opening, level: new, he_review: approved }+# opening.attention and opening.event: copy-fix wording approved by the owner in chat, 24 October 2026, 04:14 UTC: "Approve all 8".+ - { id: opening.attention, advisor: ben_gurion, signal: opening, level: new, he_review: approved, requires: [opening.greeting], actions: [{ show_me: attention }] }+ - { id: opening.city, advisor: meyerson, signal: opening, level: new, he_review: approved, requires: [opening.attention], actions: [{ show_me: city_housing }] }+ - { id: opening.training, advisor: meyerson, signal: opening, level: new, he_review: approved, requires: [opening.city], actions: [{ show_me: city_training }] }+ - { id: opening.move, advisor: dayan, signal: opening, level: new, he_review: approved, requires: [opening.training], actions: [{ show_me: unit_move }] }+ - { id: opening.event, advisor: ben_gurion, signal: opening, level: new, he_review: approved, requires: [opening.move], when: { cards_waiting_at_least: 1 }, actions: [{ show_me: decision_waiting }, { open_card: true }] }+ - { id: opening.objectives, advisor: ben_gurion, signal: opening, level: new, he_review: approved, requires: [opening.event], actions: [{ show_me: nav_objectives }] }+pages: []diff --git a/unity/Assets/Scripts/UI/AdvisorCatalog.cs b/unity/Assets/Scripts/UI/AdvisorCatalog.csindex 76af1d709..1c78ac7fc 100644--- a/unity/Assets/Scripts/UI/AdvisorCatalog.cs+++ b/unity/Assets/Scripts/UI/AdvisorCatalog.cs@@ -126,7 +126,7 @@ namespace Statecraft.Game.UIpublic static Known Shipped() => new Known{Signals = AdvisorSignals.Names.ToList(), Conditions = AdvisorSignals.Measures.Keys.ToList(),- Screens = ScreenNav.Screens,+ Screens = ScreenNav.Screens, Targets = AdvisorTargets.Names,};/// <summary>Every problem, one line each (spec 4.1).</summary>diff --git a/unity/Assets/Scripts/UI/AdvisorPresenter.cs b/unity/Assets/Scripts/UI/AdvisorPresenter.csindex 9ede2b453..250419466 100644--- a/unity/Assets/Scripts/UI/AdvisorPresenter.cs+++ b/unity/Assets/Scripts/UI/AdvisorPresenter.cs@@ -14,6 +14,10 @@ namespace Statecraft.Game.UIpublic EventCardPresenter? Card;/// <summary>Opens a side screen by ScreenNav's name (an action's open_screen).</summary>public Action<string>? OpenScreen;+ public Action? ShowCity, ShowUnit;+ public Func<Action>? KeepSelection;+ public Func<Rect?>? MapTarget;+ public Action? CloseScreens;}/// <summary>The advisors' popup (spec 4.2, 7.1): one message at a time, in the right column's free upper part or a sheet@@ -30,13 +34,25 @@ namespace Statecraft.Game.UIpublic const float NamePx = 24f, RolePx = 15f, TextPx = 22f, ButtonPx = 19f, CountPx = 15f;/// <summary>The fade out (Statecraft.uss .advisor-popup.window-closing), in ms.</summary>public const long HideMs = 150;+ public const string RingClass = "advisor-ring-open";+ public const long RingOnlyMs = 4000;+ readonly VisualElement ring;+ string? target;+ Action? putBack;+ /// <summary>The selection a rebuilt presenter takes over from the one before it (ChainState.PutBack).</summary>+ Action? adopted;+ IVisualElementScheduledItem? ringOnly;readonly VisualElement hudRoot, layer, popup, portrait;readonly Label name, role, words, count;readonly Button showMe, more, notNow, gotIt, close;+ readonly Button? reopen;+ readonly Action onReopen;+ GameSession? openingGame;readonly SimBridge bridge; readonly UiText text; readonly AdvisorSession session; readonly PortraitCatalog? portraits;readonly AdvisorHooks hooks; readonly bool hebrew;- readonly Action onChanged, onCover, onShowMe, onGotIt, onNotNow;+ readonly Action onChanged, onCover, onShowMe, onGotIt, onNotNow, onClose;+ readonly IReadOnlyList<AdvisorCatalog.Message> chain;readonly Action<IReadOnlyList<Rejection>> onTurn;readonly EventCallback<GeometryChangedEvent> onLaidOut;readonly (VisualElement element, float px)[] floored;@@ -55,10 +71,12 @@ namespace Statecraft.Game.UI{this.bridge = bridge; this.text = text; this.session = session; this.portraits = portraits;this.hooks = hooks ?? new AdvisorHooks();+ chain = OrderedChain(session.Catalog);hebrew = text["ui.lang"] == UiLanguage.Hebrew;hudRoot = root.Q("root") ?? root;layer = root.Q<VisualElement>(LayerName);popup = layer.Q<VisualElement>("advisor-popup");+ ring = layer.Q("advisor-ring");portrait = popup.Q<VisualElement>("advisor-portrait");name = popup.Q<Label>("advisor-name"); role = popup.Q<Label>("advisor-role");words = popup.Q<Label>("advisor-text"); count = popup.Q<Label>("advisor-count");@@ -66,17 +84,33 @@ namespace Statecraft.Game.UInotNow = popup.Q<Button>("advisor-not-now"); gotIt = popup.Q<Button>("advisor-got-it"); close = popup.Q<Button>("advisor-close");showMe.text = text["advisor.show_me"]; more.text = text["advisor.more"]; notNow.text = text["advisor.not_now"];gotIt.text = text["advisor.got_it"]; close.text = text["advisor.close"];- floored = new (VisualElement, float)[] { (name, NamePx), (role, RolePx), (words, TextPx), (showMe, ButtonPx), (more, ButtonPx), (notNow, ButtonPx), (gotIt, ButtonPx), (count, CountPx) };+ floored = new (VisualElement, float)[] { (name, NamePx), (role, RolePx), (words, TextPx), (showMe, ButtonPx), (more, ButtonPx), (notNow, ButtonPx), (gotIt, ButtonPx), (close, ButtonPx), (count, CountPx) };onShowMe = ShowMe; onGotIt = GotIt; onNotNow = NotNow;- showMe.clicked += onShowMe; gotIt.clicked += onGotIt; close.clicked += onGotIt; notNow.clicked += onNotNow;+ onClose = () => { if (session.Chain.Step >= 0) CloseChain(); else GotIt(); };+ reopen = root.Q<Button>("how-to-play-guide");+ onReopen = OpenChain; // which closes How to play+ if (reopen != null)+ {+ reopen.text = text["how_to_play.guide"]; reopen.clicked += onReopen;+ Display(reopen, chain.Any(m => m.ApprovedIn(hebrew))); // no button that opens nothing (pending Hebrew)+ }+ showMe.clicked += onShowMe; gotIt.clicked += onGotIt; close.clicked += onClose; notNow.clicked += onNotNow;onChanged = Evaluate; onTurn = _ => Notice(AdvisorSignals.TurnEnded); onCover = CoverChanged; onLaidOut = PlaceWhenLaidOut;bridge.Changed += onChanged; bridge.TurnEnded += onTurn;layer.userData = onCover; // ScreenNav.DisableCovered calls it// The slot moves with the layout (a window resized, "Decision waiting" or the toast shown), so the popup follows- // it while it shows, as the guide's ring does.+ // it while it shows, as its ring does.follow = layer.schedule.Execute(Place).Every(100);follow.Pause();hudRoot.RemoveFromClassList(OpenClass);+ if (session.Chain.Step >= 0)+ {+ openingGame = bridge.Session;+ adopted = session.Chain.PutBack; session.Chain.PutBack = null;+ if (chain[session.Chain.Step].ApprovedIn(hebrew) && this.hooks.Card?.Shown != null && !this.hooks.Card.Collapsed)+ this.hooks.Card.Collapse(takeFocus: false);+ RenderChain();+ }}/// <summary>A modal layer is open (spec 4.2): the start screen, the open decision card, the capture dialog, the turn@@ -88,7 +122,7 @@ namespace Statecraft.Game.UI|| (hudRoot.ClassListContains(HudPresenter.TwoRowClass) && hudRoot.ClassListContains(ScreenNav.ScreenOpenClass));/// <summary>Showing a message: on screen and not fading out.</summary>- public bool IsOpen => hudRoot.ClassListContains(OpenClass) && !popup.ClassListContains(ScreenNav.ClosingClass);+ public bool IsOpen => !disposed && hudRoot.ClassListContains(OpenClass) && !popup.ClassListContains(ScreenNav.ClosingClass);/// <summary>The message on screen, or null.</summary>public AdvisorCatalog.Message? Shown { get; private set; }@@ -101,9 +135,19 @@ namespace Statecraft.Game.UIpublic void NewGame(){if (disposed) return;+ // StartScreen's close and NewGamePresenter.Started can report the same new session (Task7).+ if (session.Chain.Step >= 0 && ReferenceEquals(openingGame, bridge.Session)) return;session.Queue.Reset(); session.Fired.Clear(); session.FiredTurn = Turn;Shown = null; covered = null;+ session.Chain.Step = -1; session.Chain.PutBack = null; adopted = null;+ ClearTarget();Notice(AdvisorSignals.NewGame);+ if (session.AutoShow && session.Settings.HasFile && !session.Settings.OpeningSeen+ && !hudRoot.ClassListContains(StartScreenPresenter.OpenClass) && chain.Any(InTour))+ {+ session.Settings.MarkOpeningSeen();+ OpenChain();+ }}/// <summary>An event signal fired (spec 5): it holds for this turn.</summary>@@ -130,9 +174,11 @@ namespace Statecraft.Game.UIvoid Render(){if (disposed) return;+ if (session.Chain.Step >= 0) { RenderChain(); return; }if (Covered(hudRoot)) { if (Shown != null) covered = Shown; Hide(); return; }var m = session.Queue.Head(Turn, hebrew);- if (m == null) { Shown = null; Hide(); return; }+ if (m == null) { Shown = null; ClearTarget(); Hide(); return; }+ if (Shown?.Id != m.Id) ClearTarget();Fill(m);Show();}@@ -140,6 +186,7 @@ namespace Statecraft.Game.UIvoid Fill(AdvisorCatalog.Message m){Shown = m;+ gotIt.text = text["advisor.got_it"];name.text = text[m.Advisor == "meyerson" && !session.Introduced(m.Advisor) ? "advisor.meyerson.name_first" : "advisor." + m.Advisor + ".name"];role.text = text["advisor." + m.Advisor + ".role"];words.text = text["advisor." + m.Id + ".text"];@@ -175,13 +222,13 @@ namespace Statecraft.Game.UIhudRoot.AddToClassList(OpenClass);follow.Resume();layer.UnregisterCallback(onLaidOut);- if (Place(null) == null) layer.RegisterCallback(onLaidOut);+ if (Place(TargetRect()) == null) layer.RegisterCallback(onLaidOut);}/// <summary>Once, on the layer's first layout after Show: places the popup, which makes it visible.</summary>void PlaceWhenLaidOut(GeometryChangedEvent e){- if (Place(null) != null) layer.UnregisterCallback(onLaidOut);+ if (Place(TargetRect()) != null) layer.UnregisterCallback(onLaidOut);}void EndOpening(GeometryChangedEvent e)@@ -194,6 +241,7 @@ namespace Statecraft.Game.UI{if (hidden) return;hidden = true;+ ring.style.display = DisplayStyle.None;follow.Pause();layer.UnregisterCallback(onLaidOut);var focused = layer.focusController?.focusedElement as VisualElement;@@ -214,6 +262,7 @@ namespace Statecraft.Game.UIvoid CoverChanged(){if (disposed) return;+ if (session.Chain.Step >= 0) { RenderChain(); return; }if (Covered(hudRoot)) { if (Shown != null) covered = Shown; Hide(); return; }if (covered is AdvisorCatalog.Message m){@@ -225,11 +274,174 @@ namespace Statecraft.Game.UIRender();}+ /// <summary>Draws the ring round <paramref name="name"/>'s elements, showing its unit or city first as a click would+ /// (the selection it finds is put back by ClearTarget). Never carries out the advised action (spec 7.3).</summary>+ public void ShowTarget(string name)+ {+ if (disposed) return;+ ClearTarget();+ target = name;+ if (AdvisorTargets.ShowsCity(name) || AdvisorTargets.ShowsUnit(name))+ {+ putBack = adopted ?? hooks.KeepSelection?.Invoke(); // after a rebuild, the selection found before it+ adopted = null;+ (AdvisorTargets.ShowsUnit(name) ? hooks.ShowUnit : hooks.ShowCity)?.Invoke();+ }+ hudRoot.AddToClassList(RingClass);+ follow.Resume();+ if (Shown == null) ringOnly = ring.schedule.Execute(ClearTarget).StartingIn(RingOnlyMs); // the encyclopedia's ring fades by itself+ Place();+ }++ public void ClearTarget()+ {+ ringOnly?.Pause(); ringOnly = null;+ target = null;+ hudRoot.RemoveFromClassList(RingClass);+ if (!hudRoot.ClassListContains(OpenClass)) follow.Pause();+ var back = putBack; putBack = null;+ back?.Invoke();+ }++ Rect? TargetRect()+ {+ if (target == null) return null;+ var world = AdvisorTargets.Area(AdvisorTargets.Find(hudRoot, target, hooks.Card));+ Rect? local = world is Rect a ? Local(a) : (Rect?)null;+ ring.style.display = local == null || Covered(hudRoot) ? DisplayStyle.None : StyleKeyword.Null;+ if (local is Rect area)+ {+ var tl = Vector2.Max(area.min - new Vector2(4, 4), Vector2.zero);+ var br = Vector2.Min(area.max + new Vector2(4, 4), layer.layout.size);+ ring.style.left = tl.x; ring.style.top = tl.y; ring.style.width = br.x - tl.x; ring.style.height = br.y - tl.y;+ }+ // The ring stays on the named HUD control; the popup also keeps clear of its selected map hex (spec7.3).+ if ((AdvisorTargets.ShowsUnit(target) || AdvisorTargets.ShowsCity(target)) && hooks.MapTarget?.Invoke() is Rect map)+ return Local(map);+ return local;+ }++ public const int EventStep = 5;+ public IReadOnlyList<AdvisorCatalog.Message> Chain => chain;+ public bool InChain => session.Chain.Step >= 0 && IsOpen;+ public int ChainStep => InChain ? session.Chain.Step : -1;+ public static IReadOnlyList<string> ChainIds(AdvisorCatalog catalog) => OrderedChain(catalog).Select(m => m.Id).ToList();++ static List<AdvisorCatalog.Message> OrderedChain(AdvisorCatalog catalog)+ {+ var steps = catalog.Messages.Where(m => m.Signal == AdvisorSignals.Opening).ToList();+ var line = new List<AdvisorCatalog.Message>();+ var next = steps.FirstOrDefault(m => m.Requires.Count == 0);+ while (next != null && !line.Contains(next))+ {+ line.Add(next);+ next = steps.FirstOrDefault(m => m.Requires.Contains(line[line.Count - 1].Id));+ }+ return line;+ }++ bool InTour(AdvisorCatalog.Message message) => message.ApprovedIn(hebrew) && AdvisorSignals.When(Context(), message.When);+ int NextChainStep(int after)+ {+ for (int i = after + 1; i < chain.Count; i++) if (InTour(chain[i])) return i;+ return -1;+ }++ /// <summary>Manual reopen starts at the greeting; the opening card and selection are restored on close.</summary>+ public void OpenChain()+ {+ if (disposed) return;+ var first = NextChainStep(-1);+ if (first < 0) return; // no unreviewed Hebrew, even when explicitly asked+ hooks.CloseScreens?.Invoke();+ openingGame = bridge.Session;+ if (session.Chain.Step < 0)+ {+ session.Chain.CardWasOpen = hooks.Card?.Shown != null && !hooks.Card.Collapsed;+ session.Chain.CardEvent = hooks.Card?.Shown?.Id;+ session.Chain.OpenTurn = Turn;+ }+ session.Chain.EventShown = false;+ session.Chain.Step = first;+ if (hooks.Card?.Shown != null && !hooks.Card.Collapsed) hooks.Card.Collapse(takeFocus: false);+ ShowStep(first);+ FocusReturn.To(gotIt); // the player opens it, so Enter goes on (spec 16)+ }++ public void NextStep()+ {+ int step = session.Chain.Step;+ if (disposed || step < 0 || step >= chain.Count || !chain[step].ApprovedIn(hebrew)) return;+ session.Queue.Done(chain[step], Turn, bridge.State.Date);+ int next = NextChainStep(step);+ if (next < 0) CloseChain(); else ShowStep(next);+ }++ public void CloseChain() => CloseChain(restoreCard: true);+ void CloseChain(bool restoreCard)+ {+ if (disposed || session.Chain.Step < 0) return;+ session.Chain.Step = -1; session.Chain.PutBack = null; adopted = null;+ Shown = null; covered = null;+ ClearTarget();+ Hide();+ if (restoreCard && hooks.Card?.Shown != null)+ {+ if (session.Chain.CardWasOpen && hooks.Card.Collapsed) hooks.Card.Reopen();+ else if (!session.Chain.CardWasOpen && !hooks.Card.Collapsed) hooks.Card.Collapse(takeFocus: false);+ }+ Render();+ }++ void ShowStep(int step)+ {+ session.Chain.Step = step;+ if (!chain[step].ApprovedIn(hebrew)) { Shown = null; Hide(); return; }+ if (Covered(hudRoot)) { Hide(); return; }+ // The same step drawn again (the game changed under it, or a layer over it closed): its city or unit stays as+ // the player has it now, rather than being put back and shown again on every change.+ bool same = ReferenceEquals(Shown, chain[step]) && target != null;+ if (!same) ClearTarget();+ if (step == EventStep) session.Chain.EventShown = true;+ Fill(chain[step]);+ bool Counted(int i) => chain[i].ApprovedIn(hebrew) && (i == EventStep ? session.Chain.EventShown || InTour(chain[i]) : InTour(chain[i]));+ int number = Enumerable.Range(0, step + 1).Count(Counted), total = Enumerable.Range(0, chain.Count).Count(Counted);+ count.text = text.Format("advisor.step", number, total);+ gotIt.text = text[NextChainStep(step) < 0 ? "advisor.done" : "advisor.next"];+ Display(notNow, false);+ Display(showMe, chain[step].Actions.Any(a => a.OpenCard));+ if (!same) foreach (var action in chain[step].Actions) if (action.ShowMe != "") ShowTarget(action.ShowMe);+ Show();+ }++ void RenderChain()+ {+ if (session.Chain.Step < 0) return;+ if (Turn != session.Chain.OpenTurn) { CloseChain(hooks.Card?.Shown?.Id == session.Chain.CardEvent); return; }+ if (!chain[session.Chain.Step].ApprovedIn(hebrew)) { Shown = null; Hide(); return; }+ if (Covered(hudRoot)) { Hide(); return; }+ if (session.Chain.Step == EventStep && hooks.Card?.Shown == null)+ {+ NextStep(); // the card was answered: on to the next step+ if (InChain) TakeFocusFromTheCard();+ }+ else ShowStep(session.Chain.Step);+ }++ /// <summary>The answered card hands the focus to End turn (#41 M1) while the popup, hidden under the card, cannot take+ /// it yet: Next takes it now if it can and again on the next tick, so Enter goes on rather than ending the turn (#1323).</summary>+ void TakeFocusFromTheCard()+ {+ FocusReturn.To(gotIt);+ gotIt.schedule.Execute(() => { if (!disposed && InChain) gotIt.Focus(); });+ }+void ShowMe(){if (Shown == null) return;foreach (var a in Shown.Actions)- if (a.OpenScreen != "") hooks.OpenScreen?.Invoke(a.OpenScreen);+ if (a.ShowMe != "") ShowTarget(a.ShowMe);+ else if (a.OpenScreen != "") hooks.OpenScreen?.Invoke(a.OpenScreen);else if (a.OpenCard && hooks.Card?.Shown != null) hooks.Card.Reopen();}@@ -237,6 +449,8 @@ namespace Statecraft.Game.UIpublic void GotIt(){if (Shown == null || !IsOpen) return; // not while it fades out under a new layer+ if (session.Chain.Step >= 0) { NextStep(); return; }+ ClearTarget();session.Queue.Done(Shown, Turn, bridge.State.Date);Shown = null;Render();@@ -246,6 +460,7 @@ namespace Statecraft.Game.UIpublic void NotNow(){if (Shown == null || !IsOpen || Shown.Teaching || Shown.Critical) return;+ ClearTarget();session.Queue.PutOff(Shown, Turn, bridge.State.Date);Shown = null;Render();@@ -260,7 +475,7 @@ namespace Statecraft.Game.UIvar focused = layer.focusController?.focusedElement as VisualElement;if (!IsOpen || focused == null || !popup.Contains(focused)) return false;escapedAt = Time.frameCount;- GotIt();+ if (session.Chain.Step >= 0) CloseChain(); else GotIt();return true;}@@ -281,7 +496,7 @@ namespace Statecraft.Game.UI}/// <summary>In its slot, at the top (Task 8 passes Show me's target to keep it off), with the text floor applied.</summary>- internal void Place() => Place(null);+ internal void Place() => Place(TargetRect());/// <summary>Places the popup and returns where (in the layer's space), or null when it is not shown or not laid out.</summary>internal Rect? Place(Rect? avoid)@@ -323,13 +538,17 @@ namespace Statecraft.Game.UIpublic void Dispose(){if (disposed) return;+ // A rebuild (a language switch) resumes the chain: the selection it found goes on to the rebuilt presenter.+ if (session.Chain.Step >= 0) { session.Chain.PutBack = putBack ?? adopted; putBack = null; }+ ClearTarget();disposed = true;follow.Pause();fading?.Pause();layer.UnregisterCallback(onLaidOut);bridge.Changed -= onChanged; bridge.TurnEnded -= onTurn;if (layer.userData == (object)onCover) layer.userData = null;- showMe.clicked -= onShowMe; gotIt.clicked -= onGotIt; close.clicked -= onGotIt; notNow.clicked -= onNotNow;+ if (reopen != null) reopen.clicked -= onReopen;+ showMe.clicked -= onShowMe; gotIt.clicked -= onGotIt; close.clicked -= onClose; notNow.clicked -= onNotNow;hudRoot.RemoveFromClassList(OpenClass);}}diff --git a/unity/Assets/Scripts/UI/AdvisorSession.cs b/unity/Assets/Scripts/UI/AdvisorSession.csindex f088f088b..6107d9b7e 100644--- a/unity/Assets/Scripts/UI/AdvisorSession.cs+++ b/unity/Assets/Scripts/UI/AdvisorSession.cs@@ -17,6 +17,18 @@ namespace Statecraft.Game.UICatalog = catalog; Settings = settings; AutoShow = autoShow; Queue = new AdvisorQueue(catalog, settings);}+ /// <summary>The opening chain survives a presenter/language rebuild, not a load or a new game (spec9.2).</summary>+ public sealed class ChainState+ {+ public int Step = -1, OpenTurn;+ public bool CardWasOpen, EventShown;+ public string? CardEvent;+ /// <summary>Puts back the selection the chain found, carried over a rebuild (a language switch) to the rebuilt+ /// presenter's first city or unit, so closing the chain later still restores the player's own.</summary>+ public Action? PutBack;+ }+ public ChainState Chain { get; } = new ChainState();+public bool AutoShow { get; }public AdvisorCatalog Catalog { get; }public AdvisorSettings Settings { get; }diff --git a/unity/Assets/Scripts/UI/AdvisorSettings.cs b/unity/Assets/Scripts/UI/AdvisorSettings.csindex a614c6246..371799789 100644--- a/unity/Assets/Scripts/UI/AdvisorSettings.cs+++ b/unity/Assets/Scripts/UI/AdvisorSettings.cs@@ -12,7 +12,7 @@ namespace Statecraft.Game.UIpublic sealed class AdvisorSettings{public const string LevelKey = "advisor_level", SeenKey = "advisor_seen", OpeningKey = "advisor_opening";- /// <summary>The first-turn guide's line (spec 9.3: honoured, so a player who saw the guide gets no chain by itself).</summary>+ /// <summary>The legacy first-turn guide's saved line (spec 9.3: honoured, so a player who saw the guide gets no chain by itself).</summary>public const string GuideSeenKey = "first_turn_guide";/// <summary>Spec 6, from the chattiest; a message shows when its level's index (AdvisorCatalog.Levels) is at least this one's.</summary>public static readonly string[] Levels = { "new", "experienced", "warnings", "off" };diff --git a/unity/Assets/Scripts/UI/AdvisorSignals.cs b/unity/Assets/Scripts/UI/AdvisorSignals.csindex d5ddbe2e5..bead2b0e0 100644--- a/unity/Assets/Scripts/UI/AdvisorSignals.cs+++ b/unity/Assets/Scripts/UI/AdvisorSignals.cs@@ -10,11 +10,14 @@ namespace Statecraft.Game.UI/// TurnEnded only, never each frame (spec 16). A `when` condition measures one number on the state.</summary>public static class AdvisorSignals{- public const string NewGame = "new_game", TurnEnded = "turn_ended";- public static readonly IReadOnlyCollection<string> Events = new[] { NewGame, TurnEnded };+ public const string NewGame = "new_game", TurnEnded = "turn_ended", Opening = "opening";+ public static readonly IReadOnlyCollection<string> Events = new[] { NewGame, TurnEnded, Opening };public static readonly IReadOnlyDictionary<string, Func<AdvisorContext, bool>> States = new Dictionary<string, Func<AdvisorContext, bool>>();/// <summary>Each condition's measure; a name ends in _at_least or _at_most, which says how its bound reads.</summary>- public static readonly IReadOnlyDictionary<string, Func<AdvisorContext, double>> Measures = new Dictionary<string, Func<AdvisorContext, double>>();+ public static readonly IReadOnlyDictionary<string, Func<AdvisorContext, double>> Measures = new Dictionary<string, Func<AdvisorContext, double>>+ {+ ["cards_waiting_at_least"] = ctx => ctx.Card?.Shown != null ? 1 : 0,+ };public static IEnumerable<string> Names => Events.Concat(States.Keys);/// <summary>Whether a message's `when` holds: each named measure against its bound (spec 4.1).</summary>diff --git a/unity/Assets/Scripts/UI/AdvisorTargets.cs b/unity/Assets/Scripts/UI/AdvisorTargets.csnew file mode 100644index 000000000..539e6f13f--- /dev/null+++ b/unity/Assets/Scripts/UI/AdvisorTargets.cs@@ -0,0 +1,91 @@+#nullable enable+using System;+using System.Collections.Generic;+using System.Linq;+using Statecraft.Game.Map.Units;+using Statecraft.Sim;+using UnityEngine;+using UnityEngine.UIElements;++namespace Statecraft.Game.UI+{+ /// <summary>The real HUD targets and selection rules of Show me and the opening chain (spec 7.3; the first-turn guide's, #42).</summary>+ public static class AdvisorTargets+ {+ public const float MoveStepDistanceM = 40000f;+ public const string Attention = "attention", CityHousing = "city_housing", CityTraining = "city_training",+ UnitMove = "unit_move", DecisionWaiting = "decision_waiting";++ public static string Nav(string screen) => "nav_" + screen.Replace('-', '_');++ public static IReadOnlyList<string> Names =>+ new[] { Attention, CityHousing, CityTraining, UnitMove, DecisionWaiting }.Concat(ScreenNav.Screens.Select(Nav)).ToList();++ public static bool ShowsCity(string name) => name == CityHousing || name == CityTraining;+ public static bool ShowsUnit(string name) => name == UnitMove;++ /// <summary>The shown elements a name points at, as the HUD has them now (the guide's rules, #1265, #1189).</summary>+ public static IReadOnlyList<VisualElement> Find(VisualElement hudRoot, string name, EventCardPresenter? card)+ {+ var found = new List<VisualElement?>();+ var host = hudRoot.Q(GddHexPanel.HostName);+ switch (name)+ {+ case Attention: found.Add(hudRoot.Q("attention")); break;+ case CityHousing: foreach (var n in new[] { "city-housing", "city-jobs-row", "city-workers-row" }) found.Add(host?.Q(n)); break;+ case CityTraining:+ if (host != null) found.AddRange(host.Query<VisualElement>().Where(e => e.name.StartsWith("city-train-", StringComparison.Ordinal) && e.name.EndsWith("-row", StringComparison.Ordinal)).ToList());+ break;+ case UnitMove: found.Add(hudRoot.Q("info-move")); break;+ case DecisionWaiting: found.Add(card?.Shown != null && card.Collapsed ? hudRoot.Q("event-reopen") : hudRoot.Q("event-options")); break;+ default:+ var screen = ScreenNav.Screens.FirstOrDefault(s => Nav(s) == name);+ if (screen != null) found.Add(hudRoot.Q("nav-" + screen));+ break;+ }+ return found.Where(e => e != null && Shown(e)).Select(e => e!).ToList();+ }++ public static Rect? Area(IEnumerable<VisualElement> targets)+ {+ Rect? area = null;+ foreach (var e in targets)+ {+ var r = e.worldBound;+ area = area is Rect a ? Rect.MinMaxRect(Mathf.Min(a.xMin, r.xMin), Mathf.Min(a.yMin, r.yMin), Mathf.Max(a.xMax, r.xMax), Mathf.Max(a.yMax, r.yMax)) : r;+ }+ return area;+ }+ /// <summary>Shown on the panel: laid out with a size, and neither it nor any parent hidden.</summary>+ public static bool Shown(VisualElement e)+ {+ if (e.panel == null || !(e.worldBound.width > 0 && e.worldBound.height > 0)) return false;+ for (var v = e; v != null; v = v.parent)+ if (v.resolvedStyle.display == DisplayStyle.None || v.resolvedStyle.visibility == Visibility.Hidden) return false;+ return true;+ }++ /// <summary>The city the opening chain shows in the info panel: the first city (cities.yaml order) with a training facility at+ /// the start (Training.HasFacility, the sim's helper), else the first city; its settlement hex, or null with none.</summary>+ public static (int q, int r)? CityHex(Content c, GameState s)+ {+ var cities = c.Cities.Where(x => s.Cities.ContainsKey(x.Id)).ToList();+ var city = cities.FirstOrDefault(x => c.UnitTypes.Any(t => t.Facility != "" && Training.HasFacility(c, s, x.Id, t.Facility)))+ ?? cities.FirstOrDefault();+ if (city == null) return null;+ foreach (var h in c.SettlementHexes) if (h.Id == city.Id) return (h.Q, h.R);+ return null;+ }++ /// <summary>The unit the opening chain shows on its move step: the first of <paramref name="units"/> (the drawn tokens' rows, in+ /// units.yaml order) whose sim unit has a hex in Movement.Reachable now, so its card shows Move+ /// (InfoPanelPresenter.MoveTargets' rule); its id, or null with none (the legacy loop, or no unit able to move).</summary>+ public static string? UnitToShow(Content c, GameState s, IEnumerable<UnitEntry> units) =>+ units.FirstOrDefault(u => UnitCard.SimUnit(c, s, u) is int id && Movement.Reachable(c, s, id).Count > 0)?.Id;++ /// <summary>The drawn-token form used by the game. A raised token carries its sim id even without a starting row.</summary>+ public static string? UnitToShow(Content c, GameState s, IEnumerable<UnitToken> units) =>+ units.FirstOrDefault(u => UnitCard.SimUnit(c, s, u) is int id && Movement.Reachable(c, s, id).Count > 0)?.Unit.Id;++ }+}diff --git a/unity/Assets/Scripts/UI/AdvisorTargets.cs.meta b/unity/Assets/Scripts/UI/AdvisorTargets.cs.metanew file mode 100644index 000000000..202861b08--- /dev/null+++ b/unity/Assets/Scripts/UI/AdvisorTargets.cs.meta@@ -0,0 +1,2 @@+fileFormatVersion: 2+guid: b0dcf7d6fbf04c24b55aa6fb82381f45diff --git a/unity/Assets/Scripts/UI/EventCardPresenter.cs b/unity/Assets/Scripts/UI/EventCardPresenter.csindex 0de4bc1a0..319cd6684 100644--- a/unity/Assets/Scripts/UI/EventCardPresenter.cs+++ b/unity/Assets/Scripts/UI/EventCardPresenter.cs@@ -167,7 +167,7 @@ namespace Statecraft.Game.UIpublic void Collapse() => Collapse(takeFocus: true);/// <summary>Hide; with <paramref name="takeFocus"/> false "Decision waiting" leaves the focus where it is (the- /// first-turn guide hides the card while its own panel has the focus, FirstTurnGuidePresenter).</summary>+ /// advisor opening chain hides the card while its popup has the focus).</summary>public void Collapse(bool takeFocus){if (Shown == null) return;@@ -505,7 +505,7 @@ namespace Statecraft.Game.UI{// The bridge raises Refused (the toast shows it) or Changed (the toast clears and Render shows the next event,// which takes the focus). Answered from the keyboard with no event left, the focus goes to End Turn (#41 M1),- // unless a control outside the card took it meanwhile (the first-turn guide's Next, as it moves on, #1323).+ // unless a control outside the card took it meanwhile (the opening chain's Next, as it moves on, #1323).bridge.Queue(new ChooseEventOption(e.Id, o.Id));var focused = hudRoot.focusController?.focusedElement as VisualElement;bool kept = focused != null && focused.panel != null && !layer.Contains(focused);diff --git a/unity/Assets/Scripts/UI/FirstTurnGuidePresenter.cs b/unity/Assets/Scripts/UI/FirstTurnGuidePresenter.csdeleted file mode 100644index 7ef7c2a01..000000000--- a/unity/Assets/Scripts/UI/FirstTurnGuidePresenter.cs+++ /dev/null@@ -1,404 +0,0 @@-#nullable enable-using System;-using System.Collections.Generic;-using System.Linq;-using Statecraft.Game.Map.Units;-using Statecraft.Sim;-using UnityEngine;-using UnityEngine.UIElements;--namespace Statecraft.Game.UI-{- /// <summary>The first-turn guide (#42; Q-ONB-1, owner, 17 October 2026, #784; in v0.1.3 by the owner's ruling of- /// 20 October 2026): six short panels, Attention, a city's housing and jobs, training, moving a unit (#1141, owner,- /// 21 October 2026), an event card and the objectives, each with a gold ring round its part of the HUD as it is today- /// (<see cref="Targets"/>).- /// <para>It shows by itself once, on the first new game (<see cref="NewGame"/>): never on a Continue, and never without a- /// settings file to remember that it was seen (automated runs and EditMode tests have none). It can be skipped at any- /// step (Skip, Escape) and opened again from the How to play screen.</para>- /// <para>Presentation only: it reads the state and changes the UI alone (the card's Hide, the hex the info panel shows,- /// the "seen" line in the settings file, SettingsStore), never the sim, the queued orders or the save. Steps 2 and 3- /// show a city with a training facility (<see cref="CityHex"/>) in the info panel, step 4 a unit that can move- /// (<see cref="UnitToShow"/>) with its card's Move button, and the selection the guide found is put back when it- /// moves on to a step that does not explain it, or closes; the decision card is hidden ("Decision waiting") except on- /// step 5 and put back as it was when the guide closes. Step 5 is left out while there is no card to explain (the- /// guide then counts five steps), and answering the card on it moves the guide on (owner's report on v0.1.4, #1323).- /// The guide takes no pointer outside its panel, so the HUD stays usable under it (the browser checks press End Turn- /// with it open); End Turn closes it as the turn advances.</para></summary>- public sealed class FirstTurnGuidePresenter : IDisposable- {- /// <summary>On the "root" element while the guide shows (Statecraft.uss shows its layer).</summary>- public const string OpenClass = "guide-open";- /// <summary>On the dock while the panel sits at the top of the window (the step's target is in the lower half).</summary>- public const string TopClass = "guide-dock-top";- /// <summary>The settings file's line (SettingsStore) once the guide has shown by itself.</summary>- public const string SeenKey = "first_turn_guide";- /// <summary>The steps' string keys, in order (guide.<key>.title, guide.<key>.text).</summary>- public static readonly string[] Steps = { "attention", "city", "training", "move", "event", "objectives" };- /// <summary>The event card's step (the card shows on it and is hidden on the others).</summary>- public const int EventStep = 4;- /// <summary>The camera's farthest distance on the move step, which centres it on <see cref="UnitToShow"/>'s hex (GameRoot;- /// a nearer camera stays as near). At the start's 90 km, the view's fit to the map's edge (CameraController.Settle) left- /// a unit near the edge, the Negev Brigade at Nir Am, under the info panel (#1392).</summary>- public const float MoveStepDistanceM = 40000f;- /// <summary>The ring's gap round its target, in panel px. Under Attention (step 1) End Turn's border is kept clear of- /// it by Statecraft.uss (.guide-open #attention), not by this gap: the two sit 3 px apart in the bar.</summary>- const float RingGap = 4f;- /// <summary>The guide's text sizes in Statecraft.uss (.guide-count, .guide-title, .guide-text, and Button for Skip and- /// Next), in panel px: kept while they are at least the owner's text floor on screen (HudPresenter.TextFloorPx, the- /// top bar's rule), raised where the panel's scale is small (a phone held upright, about 0.49; owner, 21 October 2026).</summary>- public const float CountPx = 18f, TitlePx = 29f, TextPx = 22f, ButtonPx = 19f;-- readonly VisualElement hudRoot, layer, ring, dock;- readonly Label count, title, words;- readonly Button next, skip, reopenButton;- readonly UiText text;- readonly SettingsStore? store;- readonly EventCardPresenter? card;- readonly Action? showCity, closeScreens, showUnit;- readonly Func<Action>? keepSelection;- readonly SimBridge? bridge;- readonly Action onNext, onSkip, onReopen;- readonly Action<IReadOnlyList<Rejection>> onTurn;- readonly Action onChanged;- readonly IVisualElementScheduledItem follow;- readonly (VisualElement element, float px)[] floored;- /// <summary>The scale the text floor was last applied for (0: not yet).</summary>- float flooredFor;- bool disposed;- /// <summary>The card was open (not hidden) when the guide opened: it is put back so when the guide closes.</summary>- bool cardWasOpen;- /// <summary>The event the card showed when the guide opened (null: none), and the turn it opened on.</summary>- string? cardEvent;- int openTurn;- /// <summary>Puts back the selection the guide found, once it has shown its city or unit (null: it has not).</summary>- Action? putBack;- /// <summary>The event step has shown since the guide opened, so the count keeps it after its card is answered.</summary>- bool eventShown;- /// <summary>The frame a step was shown on: the panel is placed, and shown, only once that frame's layout has run.</summary>- int shownFrame = -1;-- /// <param name="store">The settings file, where the guide notes that it has shown (null: it never shows by itself).</param>- /// <param name="card">The decision card, hidden except on the event step (null: none).</param>- /// <param name="showCity">Shows <see cref="CityHex"/>'s city in the info panel, as a click on it would (null: nothing).</param>- /// <param name="closeScreens">Closes an open side-menu screen when the guide opens (null: nothing).</param>- /// <param name="bridge">The game: the guide closes when its turn advances (End Turn under the open guide; null: never).</param>- /// <param name="keepSelection">Notes the selection (hex or unit) just before the guide first shows its city, and- /// returns what puts it back when the guide closes (null: the guide's city or unit stays shown).</param>- /// <param name="showUnit">Shows <see cref="UnitToShow"/>'s unit and its card in the info panel, as a click on it would- /// (null: nothing).</param>- public FirstTurnGuidePresenter(VisualElement root, UiText text, SettingsStore? store, EventCardPresenter? card = null,- Action? showCity = null, Action? closeScreens = null, SimBridge? bridge = null, Func<Action>? keepSelection = null, Action? showUnit = null)- {- this.text = text; this.store = store; this.card = card; this.showCity = showCity; this.closeScreens = closeScreens;- this.bridge = bridge; this.keepSelection = keepSelection; this.showUnit = showUnit;- hudRoot = root.Q("root") ?? root;- layer = root.Q<VisualElement>("first-turn-guide");- ring = layer.Q<VisualElement>("guide-ring");- dock = layer.Q<VisualElement>("guide-dock");- count = layer.Q<Label>("guide-count"); title = layer.Q<Label>("guide-title"); words = layer.Q<Label>("guide-text");- next = layer.Q<Button>("guide-next"); skip = layer.Q<Button>("guide-skip");- skip.text = text["guide.skip"];- floored = new (VisualElement, float)[] { (count, CountPx), (title, TitlePx), (words, TextPx), (next, ButtonPx), (skip, ButtonPx) };- reopenButton = root.Q<Button>("how-to-play-guide");- reopenButton.text = text["how_to_play.guide"];- onNext = Next; onSkip = Close; onReopen = Open;- next.clicked += onNext; skip.clicked += onSkip; reopenButton.clicked += onReopen;- onTurn = _ => TurnEnded();- onChanged = GameChanged;- if (bridge != null) { bridge.TurnEnded += onTurn; bridge.Changed += onChanged; }- // The targets move with the layout (a window resized, the info panel re-rendered after an order), so the ring- // follows them while the guide shows.- follow = layer.schedule.Execute(Place).Every(100);- follow.Pause();- hudRoot.RemoveFromClassList(OpenClass);- }-- public bool IsOpen => hudRoot.ClassListContains(OpenClass);-- /// <summary>The step shown (0 to 5), or -1 when the guide is closed.</summary>- public int Step { get; private set; } = -1;-- /// <summary>Whether the guide has shown by itself before (the settings file's line); true with no file to read, so it- /// never shows by itself there.</summary>- public bool Seen => store == null || store.Read(SeenKey) == "seen";-- /// <summary>A new game has begun: the guide opens if it has never shown by itself, and notes that it has. Not under- /// the start screen: GameRoot calls this again when the screen closes on a new game.</summary>- public void NewGame()- {- if (disposed || IsOpen || Seen || hudRoot.ClassListContains(StartScreenPresenter.OpenClass)) return;- try { store!.Write(SeenKey, "seen"); }- catch (Exception e) { Debug.LogWarning("The first-turn guide could not note that it was seen: " + e.Message); }- Open();- }-- /// <summary>Opens the guide at its first step (How to play's button; NewGame). An open side-menu screen closes.</summary>- public void Open()- {- if (disposed) return;- closeScreens?.Invoke();- if (!IsOpen)- {- cardWasOpen = card?.Shown != null && !card.Collapsed;- cardEvent = card?.Shown?.Id;- openTurn = bridge?.State.Turn ?? 0;- }- hudRoot.AddToClassList(OpenClass);- follow.Resume();- eventShown = false;- Show(0);- }-- /// <summary>Next, or Done on the last step.</summary>- public void Next()- {- if (!IsOpen) return;- var next = NextStep(Step);- if (next < 0) Close(); else Show(next);- }-- /// <summary>Whether a step is in the tour now: every step but the event card's, which is left out while there is no- /// card to explain (answered before the guide reached it; owner's report on v0.1.4).</summary>- bool InTour(int step) => step != EventStep || card?.Shown != null;-- /// <summary>The step after <paramref name="step"/> in the tour, or -1 after the last.</summary>- int NextStep(int step)- {- for (int s = step + 1; s < Steps.Length; s++) if (InTour(s)) return s;- return -1;- }-- /// <summary>The game changed under the open guide (an order queued, the card answered): on the event step, once the- /// card it explains has closed with no other card to show, the guide goes on to the next step, as Next would, and Next- /// takes the focus back from the answer the player pressed.</summary>- void GameChanged()- {- if (disposed || !IsOpen || Step != EventStep || card?.Shown != null) return;- Next();- }-- /// <summary>Escape: skips the guide. True when it was open.</summary>- public bool Escape()- {- if (!IsOpen) return false;- Close();- return true;- }-- /// <summary>Closes the guide (Skip, Done, Escape) and puts the decision card and the selection back as they were when- /// the guide opened.</summary>- public void Close() => Close(restoreCard: true);-- /// <summary>The turn has ended (End Turn, which the guide leaves in reach): when it advanced, the guide closes, as Skip- /// does. Only the card the guide found is put back as it was; a new turn's card is left to its own rule (a new event- /// opens), so it neither stays hidden nor shows its backdrop under the guide (review of #1209). A refused turn (the- /// state unchanged) leaves the guide open.</summary>- void TurnEnded()- {- if (!IsOpen || bridge!.State.Turn == openTurn) return;- Close(restoreCard: card?.Shown?.Id == cardEvent);- }-- void Close(bool restoreCard)- {- if (!IsOpen) return;- Step = -1;- follow.Pause();- hudRoot.RemoveFromClassList(OpenClass);- var focused = layer.focusController?.focusedElement as VisualElement;- bool hadFocus = focused != null && layer.Contains(focused);- if (hadFocus) focused!.Blur();- if (restoreCard && card?.Shown != null)- {- if (cardWasOpen && card.Collapsed) card.Reopen(); // the card takes the focus itself- else if (!cardWasOpen && !card.Collapsed) card.Collapse(takeFocus: false);- }- // From the keyboard, the next Tab carries on from End Turn (#41 M1), unless the card is open and took the focus.- if (hadFocus && (card?.Shown == null || card.Collapsed)) FocusReturn.To(hudRoot.Q<Button>("end-turn"));- var back = putBack; putBack = null;- back?.Invoke();- }-- void Show(int step)- {- Step = step;- var key = Steps[step];- if (step == EventStep) eventShown = true;- // Counted as the player meets them: the event step counts while it has a card or once it has shown.- bool Counted(int s) => s == EventStep ? eventShown || InTour(s) : true;- int number = 0, total = 0;- for (int s = 0; s < Steps.Length; s++) if (Counted(s)) { total++; if (s <= step) number++; }- count.text = text.Format("guide.step", number, total);- title.text = text["guide." + key + ".title"];- words.text = text["guide." + key + ".text"];- next.text = text[NextStep(step) < 0 ? "guide.done" : "guide.next"];- // A step that does not explain the city or the unit puts away the one an earlier step showed (as Close does), so- // no stale panel stays under the event card or Objectives.- if (key != "city" && key != "training" && key != "move")- {- var back = putBack; putBack = null;- back?.Invoke();- }- // The card shows only on its own step: elsewhere its backdrop would dim the parts the other steps point at.- if (card?.Shown != null)- {- if (step == EventStep && card.Collapsed) card.Reopen();- else if (step != EventStep && !card.Collapsed) card.Collapse(takeFocus: false);- }- if (key == "city" || key == "training" || key == "move")- {- putBack ??= keepSelection?.Invoke(); // what the guide found, before it first shows its city or unit- if (key == "move") showUnit?.Invoke(); else showCity?.Invoke();- }- // The panel is placed once this frame's layout has run (the city or unit just shown has its size only then), and- // transparent until then, so it never shows for a frame in the half its target is about to take (steps 2 and 3).- shownFrame = Frame();- if (shownFrame < 0) Place(); // EditMode: laid out on demand- else- {- dock.style.opacity = 0f; // transparent, not hidden: a hidden Next could not take the focus below- ring.style.display = DisplayStyle.None; // nor the ring round the last step's target- layer.schedule.Execute(PlaceWhenLaidOut);- }- FocusReturn.To(next); // Enter goes on to the next step; again once styles resolve, as the layer may only now show- }-- /// <summary>The frame count in play (the layout runs once a frame, after the scheduler), or -1 in EditMode, where the- /// tests lay panels out on demand and Place runs at once.</summary>- static int Frame() => Application.isPlaying ? Time.frameCount : -1;-- void PlaceWhenLaidOut()- {- if (disposed || !IsOpen) return;- if (shownFrame >= 0 && Frame() == shownFrame) { layer.schedule.Execute(PlaceWhenLaidOut); return; }- Place();- }-- /// <summary>The elements a step points at, as the HUD has them now (the ring goes round the shown ones): Attention in- /// the top bar; the city's housing, jobs and workers rows in the info panel (GddHexPanel); its training rows; the unit- /// card's Move button (#1265; it shows only while the card's unit can move); the card's options, or "Decision- /// waiting" while it is hidden; and the side menu's Objectives button (#1189).</summary>- public IReadOnlyList<VisualElement> Targets(int step)- {- var found = new List<VisualElement?>();- switch (Steps[step])- {- case "attention": found.Add(hudRoot.Q("attention")); break;- case "city":- var gdd = hudRoot.Q(GddHexPanel.HostName);- foreach (var name in new[] { "city-housing", "city-jobs-row", "city-workers-row" }) found.Add(gdd?.Q(name));- break;- case "training":- var host = hudRoot.Q(GddHexPanel.HostName);- if (host != null) found.AddRange(host.Query<VisualElement>().Where(e => e.name.StartsWith("city-train-", StringComparison.Ordinal) && e.name.EndsWith("-row", StringComparison.Ordinal)).ToList());- break;- case "move": found.Add(hudRoot.Q("info-move")); break;- case "event":- found.Add(card?.Shown != null && card.Collapsed ? hudRoot.Q("event-reopen") : hudRoot.Q("event-options"));- break;- case "objectives": found.Add(hudRoot.Q("nav-objectives")); break;- }- return found.Where(e => e != null && Shown(e)).Select(e => e!).ToList();- }-- /// <summary>The window area the ring surrounds (the union of the step's shown targets), or null when none shows.</summary>- public Rect? TargetArea()- {- if (Step < 0) return null;- Rect? area = null;- foreach (var e in Targets(Step))- {- var r = e.worldBound;- area = area is Rect a ? Rect.MinMaxRect(Mathf.Min(a.xMin, r.xMin), Mathf.Min(a.yMin, r.yMin), Mathf.Max(a.xMax, r.xMax), Mathf.Max(a.yMax, r.yMax)) : r;- }- return area;- }-- /// <summary>Puts the ring round the step's targets, and the panel in the other half of the window, so it never covers- /// them. With no target shown (a card already answered, a city panel the player closed), no ring and the panel at the- /// bottom.</summary>- internal void Place()- {- if (!IsOpen) return;- if (shownFrame >= 0 && Frame() == shownFrame) return; // not before the step's layout (PlaceWhenLaidOut)- shownFrame = -1;- dock.style.opacity = StyleKeyword.Null;- ApplyTextFloor();- var area = TargetArea();- ring.style.display = area == null ? DisplayStyle.None : DisplayStyle.Flex;- if (area is not Rect a) { dock.RemoveFromClassList(TopClass); return; }- var topLeft = layer.WorldToLocal(new Vector2(a.xMin, a.yMin)) - new Vector2(RingGap, RingGap);- var bottomRight = layer.WorldToLocal(new Vector2(a.xMax, a.yMax)) + new Vector2(RingGap, RingGap);- // Inside the window: a target at its edge (Attention under the top of the window) gets a narrower gap there.- var size = layer.layout.size;- if (size.x > 0 && size.y > 0)- {- topLeft = Vector2.Max(topLeft, Vector2.zero);- bottomRight = Vector2.Min(bottomRight, size);- }- ring.style.left = topLeft.x; ring.style.top = topLeft.y;- ring.style.width = bottomRight.x - topLeft.x; ring.style.height = bottomRight.y - topLeft.y;- dock.EnableInClassList(TopClass, a.center.y > layer.worldBound.center.y);- }-- /// <summary>The top bar's text floor on the guide's text (HudPresenter.FlooredTextSize): each at its stylesheet size, or- /// larger where that would be under the floor on screen. Run with Place, so it follows a resized window while the guide- /// shows; the stylesheet's size comes back (no inline size) wherever the floor does not raise it.</summary>- void ApplyTextFloor()- {- if (layer.panel == null) return;- var scale = HudPresenter.ScreenPxPerPanelPx(layer.panel);- if (scale == flooredFor) return;- flooredFor = scale;- foreach (var (element, px) in floored)- {- var size = HudPresenter.FlooredTextSize(px, scale);- element.style.fontSize = size > px ? new StyleLength(size) : new StyleLength(StyleKeyword.Null);- }- }-- /// <summary>Shown on the panel: laid out with a size, and neither it nor any parent hidden.</summary>- static bool Shown(VisualElement e)- {- if (e.panel == null || !(e.worldBound.width > 0 && e.worldBound.height > 0)) return false;- for (var v = e; v != null; v = v.parent)- if (v.resolvedStyle.display == DisplayStyle.None || v.resolvedStyle.visibility == Visibility.Hidden) return false;- return true;- }-- /// <summary>The city the guide shows in the info panel: the first city (cities.yaml order) with a training facility at- /// the start (Training.HasFacility, the sim's helper), else the first city; its settlement hex, or null with none.</summary>- public static (int q, int r)? CityHex(Content c, GameState s)- {- var cities = c.Cities.Where(x => s.Cities.ContainsKey(x.Id)).ToList();- var city = cities.FirstOrDefault(x => c.UnitTypes.Any(t => t.Facility != "" && Training.HasFacility(c, s, x.Id, t.Facility)))- ?? cities.FirstOrDefault();- if (city == null) return null;- foreach (var h in c.SettlementHexes) if (h.Id == city.Id) return (h.Q, h.R);- return null;- }-- /// <summary>The unit the guide shows on its move step: the first of <paramref name="units"/> (the drawn tokens' rows, in- /// units.yaml order) whose sim unit has a hex in Movement.Reachable now, so its card shows Move- /// (InfoPanelPresenter.MoveTargets' rule); its id, or null with none (the legacy loop, or no unit able to move).</summary>- public static string? UnitToShow(Content c, GameState s, IEnumerable<UnitEntry> units) =>- units.FirstOrDefault(u => UnitCard.SimUnit(c, s, u) is int id && Movement.Reachable(c, s, id).Count > 0)?.Id;-- /// <summary>The drawn-token form used by the game. A raised token carries its sim id even without a starting row.</summary>- public static string? UnitToShow(Content c, GameState s, IEnumerable<UnitToken> units) =>- units.FirstOrDefault(u => UnitCard.SimUnit(c, s, u) is int id && Movement.Reachable(c, s, id).Count > 0)?.Unit.Id;-- public void Dispose()- {- if (disposed) return;- disposed = true;- follow.Pause();- Step = -1;- putBack = null; // a game going away: nothing to put back- hudRoot.RemoveFromClassList(OpenClass);- if (bridge != null) { bridge.TurnEnded -= onTurn; bridge.Changed -= onChanged; }- next.clicked -= onNext; skip.clicked -= onSkip; reopenButton.clicked -= onReopen;- }- }-}diff --git a/unity/Assets/Scripts/UI/FirstTurnGuidePresenter.cs.meta b/unity/Assets/Scripts/UI/FirstTurnGuidePresenter.cs.metadeleted file mode 100644index 878da39db..000000000--- a/unity/Assets/Scripts/UI/FirstTurnGuidePresenter.cs.meta+++ /dev/null@@ -1,2 +0,0 @@-fileFormatVersion: 2-guid: 2c3af2641513f49489a34b93390d7a23\ No newline at end of filediff --git a/unity/Assets/Scripts/UI/GameRoot.cs b/unity/Assets/Scripts/UI/GameRoot.csindex 995c28ddc..ed153e952 100644--- a/unity/Assets/Scripts/UI/GameRoot.cs+++ b/unity/Assets/Scripts/UI/GameRoot.cs@@ -67,10 +67,9 @@ namespace Statecraft.Game.UIEndScreenPresenter? end;/// <summary>Set by SwitchLanguage for its Begin: the player had closed the end screen, so the rebuilt one stays closed.</summary>bool endClosed;- FirstTurnGuidePresenter? guide;- /// <summary>Tests: the first-turn guide of the last Begin.</summary>- internal FirstTurnGuidePresenter? Guide => guide;AdvisorPresenter? advisor;+ /// <summary>Tests supply an in-memory approval copy for Hebrew layout; the shipped review fields are unchanged.</summary>+ internal AdvisorCatalog? AdvisorCatalogForTests { get; set; }/// <summary>Tests: the advisors' popup of the last Begin, and their session (kept across a language switch).</summary>internal AdvisorPresenter? Advisor => advisor;internal AdvisorSession? AdvisorSession { get; private set; }@@ -457,9 +456,6 @@ namespace Statecraft.Game.UIdrawn = null; drawnSites = null;RenderPlacementsIfChanged();SyncMinimap();- // The first-turn guide (#42) opens when the start screen closes on a new game (not on Continue). It is made after- // the screen, so Shutdown disposes it first and the screen's closing then opens nothing.- FirstTurnGuidePresenter? firstTurn = null;// The start screen goes up in the same frame the loading state ends, so the HUD never flashes before it. While it// shows, the camera keys are off (keyboard pan would otherwise move the hidden map; plan amendment A4).if (showsStart) // newGame is made above whenever smoke == 0@@ -469,7 +465,7 @@ namespace Statecraft.Game.UIstart = Own(new StartScreenPresenter(root, newGame!, resumed, shown =>{if (cam != null) cam.enabled = !shown;- if (!shown && start?.Resumed == false) { firstTurn?.NewGame(); advisor?.NewGame(); }+ if (!shown && start?.Resumed == false) { advisor?.NewGame(); }}, recording, text));start.Show();}@@ -479,12 +475,18 @@ namespace Statecraft.Game.UI// that can move, its ring and its card, as a click on it would (OnHexClicked), and centres the camera on its hex.Action showCity = () =>{- if (FirstTurnGuidePresenter.CityHex(bridge.Content, bridge.State) is not (int q, int r)) return;+ if (AdvisorTargets.CityHex(bridge.Content, bridge.State) is not (int q, int r)) return;unitLayer.Select(null); map.Select(q, r); info.Show(q, r);+ var cityHex = bridge.Content.HexAt(q, r);+ if (cityHex != null)+ {+ camRig.LookAt = map.Frame.ToWorld(cityHex.Lon, cityHex.Lat, 0);+ cameraController.Settle(); SyncMinimap(); labels?.Refresh();+ }};Action showUnit = () =>{- if (FirstTurnGuidePresenter.UnitToShow(bridge.Content, bridge.State, unitLayer.Tokens.Select(t => t.Token)) is not string id) return;+ if (AdvisorTargets.UnitToShow(bridge.Content, bridge.State, unitLayer.Tokens.Select(t => t.Token)) is not string id) return;unitLayer.Select(id);if (unitLayer.Selected != null){@@ -492,42 +494,63 @@ namespace Statecraft.Game.UIvar token = unitLayer.Tokens.First(t => t.Token.Unit.Id == id);var hex = bridge.Content.HexAt(token.Q, token.R)!;camRig.LookAt = map.Frame.ToWorld(hex.Lon, hex.Lat, 0);- camRig.Distance = Mathf.Min(camRig.Distance, FirstTurnGuidePresenter.MoveStepDistanceM);+ camRig.Distance = Mathf.Min(camRig.Distance, AdvisorTargets.MoveStepDistanceM);cameraController.Settle(); SyncMinimap(); labels?.Refresh();}};- // When it closes, the guide puts back the selection it found (a hex, a unit, or none), unless the player has+ // When it closes, the advisor puts back the selection it found (a hex, a unit, or none), unless the player has// picked something else meanwhile (the HUD stays usable under it).Func<Action> keepSelection = () =>{var hex = info.ShowsUnit ? null : info.Selected;var unit = info.ShowsUnit ? unitLayer.Selected : null;- var city = FirstTurnGuidePresenter.CityHex(bridge.Content, bridge.State);- var guideUnit = FirstTurnGuidePresenter.UnitToShow(bridge.Content, bridge.State, unitLayer.Tokens.Select(t => t.Token));+ var city = AdvisorTargets.CityHex(bridge.Content, bridge.State);+ var shownUnit = AdvisorTargets.UnitToShow(bridge.Content, bridge.State, unitLayer.Tokens.Select(t => t.Token));+ // It reads the UI of the Begin it runs in, so after a language switch rebuilt the UI it still puts back what+ // the advisor found before (AdvisorSession.ChainState.PutBack).return () =>{- // Under a screen, or the player picked another than the guide's city or unit: kept.- if (info.Covered || (info.ShowsUnit ? unitLayer.Selected != guideUnit : info.Selected != city)) return;- unitLayer.Select(unit);- if (unitLayer.Selected != null) { map.ClearSelection(); info.ShowUnit(); }- else if (hex is (int q, int r)) { map.Select(q, r); info.Show(q, r); }- else { map.ClearSelection(); info.Clear(); }+ if (this.info is not { } nowInfo || this.units is not { } nowUnits) return;+ // Under a screen, or the player picked another than the advisor's city or unit: kept.+ if (nowInfo.Covered || (nowInfo.ShowsUnit ? nowUnits.Selected != shownUnit : nowInfo.Selected != city)) return;+ nowUnits.Select(unit);+ if (nowUnits.Selected != null) { map.ClearSelection(); nowInfo.ShowUnit(); }+ else if (hex is (int q, int r)) { map.Select(q, r); nowInfo.Show(q, r); }+ else { map.ClearSelection(); nowInfo.Clear(); }};};- guide = firstTurn = Own(new FirstTurnGuidePresenter(root, text, showsStart && !FirstCardCheckRequested() ? SettingsFile() : null,- card, showCity, () => nav?.Close(), bridge, keepSelection, showUnit));- if (newGame != null) newGame.Started += firstTurn.NewGame; // New Game in the top bar too; both die with this Begin// The advisors (spec 4.2): their session survives a rebuild over the same game (a language switch keeps the// queue, the history and the opening chain's place) and is new for any other Begin. They show by themselves only- // where the guide does: the start screen shows and a settings file remembers what was seen.+ // on the first new game: the start screen shows and a settings file remembers what was seen.if (keep == null || AdvisorSession == null){bool autoShow = showsStart && !FirstCardCheckRequested() && SettingsFile() != null;- // As the guide's: no settings file for an automated run, which then never reads or writes the player's.- AdvisorSession = new AdvisorSession(AdvisorCatalog.Load(), new AdvisorSettings(autoShow ? SettingsFile() : null), autoShow);+ // Final S1 store isolation; S2 supplies only the catalogue test seam.+ AdvisorSession = new AdvisorSession(AdvisorCatalogForTests ?? AdvisorCatalog.Load(), new AdvisorSettings(autoShow ? SettingsFile() : null), autoShow);}advisor = Own(new AdvisorPresenter(root, bridge, text, AdvisorSession, portraits,- new AdvisorHooks { Card = card, OpenScreen = s => nav?.Open(s) }));+ new AdvisorHooks+ {+ Card = card, OpenScreen = s => nav?.Open(s), CloseScreens = () => nav?.Close(), ShowCity = showCity, ShowUnit = showUnit, KeepSelection = keepSelection,+ MapTarget = () =>+ {+ (int q, int r)? selected = info.Selected;+ if (info.ShowsUnit)+ {+ var token = unitLayer.Tokens.FirstOrDefault(t => t.Token.Unit.Id == unitLayer.Selected);+ selected = token.Token != null ? (token.Q, token.R) : ((int, int)?)null;+ }+ if (selected is not (int q, int r) || root.panel == null || bridge.Content.HexAt(q, r) is not { } hex) return null;+ var ground = map.Frame.ToWorld(hex.Lon, hex.Lat, 0);+ ground.y = map.Terrain.SampleHeight(ground) + map.Terrain.transform.position.y;+ var camera = Camera.main;+ if (camera == null) return null;+ var viewport = camera.WorldToViewportPoint(ground);+ if (viewport.z <= 0) return null;+ var at = MapLabelsPresenter.ToPanel(viewport, camera.rect, root.panel.visualTree.layout.size, Vector2.zero);+ return new Rect(at, Vector2.one);+ },+ }));if (newGame != null) newGame.Started += advisor.NewGame;if (hebrew) Own(new UiDirection(root, bridge));root.Q("root")?.RemoveFromClassList("loading"); // ready: the bar, panels and screens may show (P2-1)@@ -637,11 +660,14 @@ namespace Statecraft.Game.UI// The card first: disposing the start screen uncovers the decision layer, and a card still waiting for it would// then render and load the photo catalog for a game that is going away (#592; since the GDD cutover a new game's// card waits under the screen, so New Game's Begin would load it).+ // The advisors before the card: a card going away is a layer closing, which must not make a popup that is itself+ // going away draw its step again and show its city or unit on a camera being destroyed.+ if (advisor != null) { owned.Remove(advisor); advisor.Dispose(); }if (card != null) { owned.Remove(card); card.Dispose(); }for (int i = owned.Count - 1; i >= 0; i--) owned[i].Dispose();owned.Clear();if (hoveredCity != null) { hoveredCity = null; HandCursor(false); } // the next Begin's pills start unlit- minimap = null; labels = null; nav = null; start = null; card = null; outcomes = null; report = null; end = null; guide = null; advisor = null; feedback = null; share = null; info = null; rig = null; drawn = null; drawnSites = null; units = null; Regions = null; logCamera = false;+ minimap = null; labels = null; nav = null; start = null; card = null; outcomes = null; report = null; end = null; advisor = null; feedback = null; share = null; info = null; rig = null; drawn = null; drawnSites = null; units = null; Regions = null; logCamera = false;// A ?profile run cut short (a stopped coroutine never reaches its restore line) must not leave the terrain at the// profile's pixel error (Task 24 review M1). Nothing else changes it, so restoring is always right.if (map != null && map.Terrain != null) map.Terrain.heightmapPixelError = MapBuilder.TerrainPixelError;@@ -779,13 +805,13 @@ namespace Statecraft.Game.UI// Escape closes the open screen even when no element has the keyboard focus (ScreenNav also takes the UI// Cancel event from a focused element; closing twice is harmless). On the start screen it withdraws an open New// Game request (StartScreenPresenter.Escape; idempotent too).- // With no screen to close, Escape skips the first-turn guide (FirstTurnGuidePresenter.Escape).+ // The advisor handles Escape only while focus is inside its popup.// With nothing else to close, Escape on the open decision card is Hide (EventCardPresenter.Escape; the card itself// takes the Cancel event when it has the focus), and so on the open capture dialog (CaptureDialogPresenter.Escape),// 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 = 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) done = guide?.Escape() == 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 = 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(); }// 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/HudPresenter.cs b/unity/Assets/Scripts/UI/HudPresenter.csindex 8ac399deb..40c20e577 100644--- a/unity/Assets/Scripts/UI/HudPresenter.cs+++ b/unity/Assets/Scripts/UI/HudPresenter.cs@@ -86,7 +86,7 @@ namespace Statecraft.Game.UI/// screen: the stylesheet's SmallTextPx, or the whole px that keeps it at TextFloorPx on screen if that is larger.</summary>public static float SmallTextSize(float screenPxPerPanelPx) => FlooredTextSize(SmallTextPx, screenPxPerPanelPx);- /// <summary>The same rule for any text (the first-turn guide's too): its stylesheet size <paramref name="stylesheetPx"/>,+ /// <summary>The same rule for any text (the advisors' popup's too): its stylesheet size <paramref name="stylesheetPx"/>,/// or the whole px that keeps it at TextFloorPx on screen if that is larger.</summary>public static float FlooredTextSize(float stylesheetPx, float screenPxPerPanelPx) =>screenPxPerPanelPx > 0f ? UnityEngine.Mathf.Max(stylesheetPx, UnityEngine.Mathf.Ceil(TextFloorPx / screenPxPerPanelPx - 0.01f)) : stylesheetPx;diff --git a/unity/Assets/Tests/EditMode/FirstTurnGuideTests.cs b/unity/Assets/Tests/EditMode/AdvisorOpeningParityTests.cssimilarity index 52%rename from unity/Assets/Tests/EditMode/FirstTurnGuideTests.csrename to unity/Assets/Tests/EditMode/AdvisorOpeningParityTests.csindex 9cc1c8fd3..0d431dff4 100644--- a/unity/Assets/Tests/EditMode/FirstTurnGuideTests.cs+++ b/unity/Assets/Tests/EditMode/AdvisorOpeningParityTests.cs@@ -18,12 +18,19 @@ using UnityEngine.TestTools;using UnityEngine.UIElements;using Object = UnityEngine.Object;-/// <summary>The first-turn guide (#42; Q-ONB-1, owner, 17 October 2026, #784): it shows by itself on the first new game only,+/// <summary>The first-turn advisor (#42; Q-ONB-1, owner, 17 October 2026, #784): it shows by itself on the first new game only,/// never on a Continue or a second game; it can be skipped and opened again from How to play; every step's target is on/// screen at 1280x720 and 390x844 in English and Hebrew, with the panel clear of it; and it changes neither the sim nor the/// save.</summary>-public class FirstTurnGuideTests+public class AdvisorOpeningParityTests{+ // Approval is a test-only in-memory copy; no shipped review field is changed.+ static AdvisorCatalog Approved() => AdvisorCatalog.Parse(File.ReadAllText(AdvisorCatalog.Path).Replace("he_review: pending", "he_review: approved"));+ static string[] Steps => AdvisorPresenter.ChainIds(AdvisorCatalog.Load()).ToArray();+ static void Begin(GameRoot game, GameInputs inputs, int smoke, bool startScreen = false)+ {+ game.Begin(inputs, smoke, startScreen: startScreen);+ }static readonly Content C = ContentLoader.Load(Paths.Content);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");@@ -32,29 +39,32 @@ public class FirstTurnGuideTests.ToDictionary(t => t.Id, t => t.Name);static List<UnitEntry> UnitRows => UnitData.Parse(File.ReadAllText(Path.Combine(Paths.Content, "map", UnitData.DefaultFileName)));- /// <summary>The info panel and the guide as GameRoot wires them, without the map: the guide's city (CityHex) and its unit+ /// <summary>The info panel and the advisor as GameRoot wires them, without the map: the advisor's city (CityHex) and its unit/// (UnitToShow, among the tokens a new game draws) shown as a click would show them.</summary>- static (InfoPanelPresenter info, FirstTurnGuidePresenter guide) PanelAndGuide(VisualElement root, SimBridge bridge, UiText text,+ static (InfoPanelPresenter info, AdvisorPresenter advisor) PanelAndAdvisor(VisualElement root, SimBridge bridge, UiText text,SettingsStore? settings, EventCardPresenter card, Action closeScreens){var tokens = UnitRoster.FromState(UnitRows, bridge.Content, bridge.State, _ => true, (row, a, q, r) => a);PlacedToken? shown = null;var info = new InfoPanelPresenter(root, bridge, text, Names(), selectedUnit: () => shown);- var guide = new FirstTurnGuidePresenter(root, text, settings, card,- () => { if (FirstTurnGuidePresenter.CityHex(bridge.Content, bridge.State) is (int q, int r)) info.Show(q, r); }, closeScreens,- showUnit: () =>+ var session = new AdvisorSession(Approved(), new AdvisorSettings(settings), autoShow: true);+ var advisor = new AdvisorPresenter(root, bridge, text, session, hooks: new AdvisorHooks+ {+ Card = card, CloseScreens = closeScreens,+ ShowCity = () => { if (AdvisorTargets.CityHex(bridge.Content, bridge.State) is (int q, int r)) info.Show(q, r); },+ ShowUnit = () =>{- if (!(FirstTurnGuidePresenter.UnitToShow(bridge.Content, bridge.State, tokens) is string id)) return;- shown = new PlacedToken(tokens.First(t => t.Unit.Id == id), new AnchorSpot(0, 0, 0, 0, false));- info.ShowUnit();- });- return (info, guide);+ if (AdvisorTargets.UnitToShow(bridge.Content, bridge.State, tokens) is not string id) return;+ shown = new PlacedToken(tokens.First(t => t.Unit.Id == id), new AnchorSpot(0, 0, 0, 0, false)); info.ShowUnit();+ },+ });+ return (info, advisor);}readonly List<string> temp = new List<string>();string TempDir(){- var dir = Path.Combine(Path.GetTempPath(), "statecraft-guide-" + Guid.NewGuid().ToString("N"));+ var dir = Path.Combine(Path.GetTempPath(), "statecraft-advisor-" + Guid.NewGuid().ToString("N"));temp.Add(dir);return dir;}@@ -78,11 +88,12 @@ public class FirstTurnGuideTestsEditorSceneManager.OpenScene("Assets/Map.unity", OpenSceneMode.Single);Object.FindFirstObjectByType<MapScene>().Build(Inputs.Map);var root = Object.FindFirstObjectByType<GameRoot>();- root.Store = store; root.Settings = settings;+ root.Store = store; root.Settings = settings; root.Language = UiLanguage.English;+ root.AdvisorCatalogForTests = Approved();return root;}- /// <summary>Map.unity as a player boots it: the guide waits for the start screen, opens when New Game closes it (at its+ /// <summary>Map.unity as a player boots it: the advisor waits for the start screen, opens when New Game closes it (at its/// first step, the card hidden behind "Decision waiting") and notes in the settings file that it has shown; the next new/// game, from the start screen or the top bar, does not show it again.</summary>[Test]@@ -90,22 +101,22 @@ public class FirstTurnGuideTests{var settings = new SettingsStore(TempDir());var game = OpenScene(new SaveStore(TempDir()), settings);- game.Begin(Inputs, 0, startScreen: true); // a fresh profile: no save- Assert.IsFalse(game.Guide!.IsOpen, "not under the start screen");+ Begin(game, Inputs, 0, startScreen: true); // a fresh profile: no save+ Assert.IsFalse(game.Advisor!.InChain, "not under the start screen");UiTestKit.Press(Ui.Q<Button>("start-new-game"));- Assert.IsTrue(game.Guide!.IsOpen, "New Game closes the screen and the guide opens");- Assert.AreEqual(0, game.Guide.Step);+ Assert.IsTrue(game.Advisor!.InChain, "New Game closes the screen and the advisor opens");+ Assert.AreEqual(0, game.Advisor.ChainStep);Assert.IsTrue(game.Card!.Shown != null && game.Card.Collapsed, "the opening card waits behind Decision waiting");- Assert.AreEqual("seen", settings.Read(FirstTurnGuidePresenter.SeenKey));- UiTestKit.Press(Ui.Q<Button>("guide-skip"));- Assert.IsFalse(game.Guide.IsOpen);+ Assert.AreEqual("seen", settings.Read(AdvisorSettings.OpeningKey));+ UiTestKit.Press(Ui.Q<Button>("advisor-close"));+ Assert.IsFalse(game.Advisor.InChain);Assert.IsFalse(game.Card.Collapsed, "skipping puts the card back");- game.Begin(Inputs, 0, startScreen: true); // a reload with no save: a new game again+ Begin(game, Inputs, 0, startScreen: true); // a reload with no save: a new game againUiTestKit.Press(Ui.Q<Button>("start-new-game"));- Assert.IsFalse(game.Guide!.IsOpen, "a second new game: not again");+ Assert.IsFalse(game.Advisor!.InChain, "a second new game: not again");UiTestKit.Press(Ui.Q<Button>("new-game")); UiTestKit.Press(Ui.Q<Button>("new-game"));- Assert.IsFalse(game.Guide!.IsOpen, "nor from the top bar's New Game");+ Assert.IsFalse(game.Advisor!.InChain, "nor from the top bar's New Game");}/// <summary>A Continue (a loaded save) never shows it, even before it was ever seen; a new game from the top bar then@@ -119,23 +130,78 @@ public class FirstTurnGuideTestsplayed.EndTurn(); played.EndTurn();store.WriteAutosave(played.Session.Save.Write());var game = OpenScene(store, settings);- game.Begin(Inputs, 0, startScreen: true);+ Begin(game, Inputs, 0, startScreen: true);UiTestKit.Press(Ui.Q<Button>("start-continue"));- Assert.IsFalse(game.Guide!.IsOpen, "Continue");- Assert.IsNull(settings.Read(FirstTurnGuidePresenter.SeenKey), "and still unseen");+ Assert.IsFalse(game.Advisor!.InChain, "Continue");+ Assert.IsNull(settings.Read(AdvisorSettings.OpeningKey), "and still unseen");- game.Begin(Inputs, 0); // the tests' and tools' Begin: no start screen+ Begin(game, Inputs, 0); // the tests' and tools' Begin: no start screenUiTestKit.Press(Ui.Q<Button>("new-game")); UiTestKit.Press(Ui.Q<Button>("new-game"));- Assert.IsFalse(game.Guide!.IsOpen, "an automated run");+ Assert.IsFalse(game.Advisor!.InChain, "an automated run");game.Settings = null; // EditMode with no settings file- game.Begin(Inputs, 0, startScreen: true);+ Begin(game, Inputs, 0, startScreen: true);UiTestKit.Press(Ui.Q<Button>("start-new-game"));- Assert.IsFalse(game.Guide!.IsOpen, "nowhere to remember it: never by itself");+ Assert.IsFalse(game.Advisor!.InChain, "nowhere to remember it: never by itself");game.Settings = settings;- game.Begin(Inputs, 0, startScreen: true);+ Begin(game, Inputs, 0, startScreen: true);UiTestKit.Press(Ui.Q<Button>("start-new-game"));- Assert.IsTrue(game.Guide!.IsOpen, "the first new game in this profile");+ Assert.IsTrue(game.Advisor!.InChain, "the first new game in this profile");+ }++ /// <summary>Actual Task7 callback path: a saved start screen closes from NewGamePresenter.Started, and both notify advisors.</summary>+ [Test]+ public void ANewGameFromASavedStartScreenKeepsItsOpeningChain()+ {+ var store = new SaveStore(TempDir()); var settings = new SettingsStore(TempDir());+ var played = new SimBridge(GameSession.New(C, 9, Mode.Historical), En); played.EndTurn(); played.EndTurn();+ store.WriteAutosave(played.Session.Save.Write());+ var game = OpenScene(store, settings); Begin(game, Inputs, 0, startScreen: true);+ UiTestKit.Press(Ui.Q<Button>("start-new-game")); UiTestKit.Press(Ui.Q<Button>("start-new-game"));+ Assert.IsTrue(game.Advisor!.InChain); Assert.AreEqual(0, game.Advisor.ChainStep);+ Assert.AreEqual("seen", settings.Read(AdvisorSettings.OpeningKey));+ }++ /// <summary>Review focus3: actual Settings rebuilds preserve the step, hide pending Hebrew and resume English.</summary>+ [Test]+ public void ALanguageSwitchMidChainKeepsTheStep()+ {+ var game = OpenScene(new SaveStore(TempDir()), new SettingsStore(TempDir()));+ game.AdvisorCatalogForTests = AdvisorCatalog.Parse(File.ReadAllText(AdvisorCatalog.Path).Replace("he_review: approved", "he_review: pending"));+ Begin(game, Inputs, 0, startScreen: true); UiTestKit.Press(Ui.Q<Button>("start-new-game"));+ game.Advisor!.NextStep(); game.Advisor.NextStep(); var session = game.AdvisorSession;+ Assert.AreEqual(2, game.Advisor.ChainStep);+ UiTestKit.Press(Ui.Q<Button>("nav-settings")); UiTestKit.Press(Ui.Q<Button>("settings-language-he"));+ Assert.AreSame(session, game.AdvisorSession); Assert.IsFalse(game.Advisor!.IsOpen); Assert.AreEqual(2, session!.Chain.Step);+ if (!Ui.Q("root").ClassListContains(ScreenNav.ScreenOpenClass)) UiTestKit.Press(Ui.Q<Button>("nav-settings"));+ UiTestKit.Press(Ui.Q<Button>("settings-language-en"));+ if (Ui.Q("root").ClassListContains(ScreenNav.ScreenOpenClass)) UiTestKit.Press(Ui.Q<Button>("nav-settings"));+ Assert.AreSame(session, game.AdvisorSession); Assert.IsTrue(game.Advisor!.InChain); Assert.AreEqual(2, game.Advisor.ChainStep);+ }++ /// <summary>A language switch on a step that shows its city: the rebuilt chain shows the city again, and closing it puts+ /// back the hex the player had selected before the chain opened, not the advisor's city (review of the S2 head).</summary>+ [Test]+ public void ALanguageSwitchOnTheCityStepStillPutsBackTheSelectionItFound()+ {+ var game = OpenScene(new SaveStore(TempDir()), new SettingsStore(TempDir()));+ Begin(game, Inputs, 0, startScreen: true); UiTestKit.Press(Ui.Q<Button>("start-new-game"));+ game.Advisor!.CloseChain();+ var map = Object.FindFirstObjectByType<MapScene>(); var bridge = game.Bridge!;+ var city = AdvisorTargets.CityHex(bridge.Content, bridge.State)!.Value;+ var hex = bridge.Content.Hexes.Where(h => h.Land).Select(h => (h.Q, h.R)).First(h => h != city && game.Units!.UnitToSelectAt(h.Item1, h.Item2) == null);+ GameRoot.OnHexClicked(map, game.Units!, game.Info!, hex.Item1, hex.Item2);+ Assert.AreEqual(hex, game.Info!.Selected, "precondition: the player's hex");+ game.Advisor.OpenChain();+ for (int i = 0; i < 2; i++) UiTestKit.Press(Ui.Q<Button>("advisor-got-it"));+ Assert.AreEqual(city, game.Info!.Selected, "precondition: the city step shows its city");++ UiTestKit.Press(Ui.Q<Button>("nav-settings")); UiTestKit.Press(Ui.Q<Button>("settings-language-he"));+ if (Ui.Q("root").ClassListContains(ScreenNav.ScreenOpenClass)) UiTestKit.Press(Ui.Q<Button>("nav-settings"));+ Assert.IsTrue(game.Advisor!.InChain, "the rebuilt chain"); Assert.AreEqual("opening.city", Steps[game.Advisor.ChainStep]);+ Assert.AreEqual(city, game.Info!.Selected, "shows its city again");+ UiTestKit.Press(Ui.Q<Button>("advisor-close"));+ Assert.AreEqual(hex, game.Info!.Selected, "closing puts back the player's hex");}// --- Skip, Escape and How to play -------------------------------------------------------------------------------@@ -146,7 +212,8 @@ public class FirstTurnGuideTestspublic readonly SimBridge Bridge;public readonly ScreenNav Nav;public readonly EventCardPresenter Card;- public readonly FirstTurnGuidePresenter Guide;+ public readonly AdvisorPresenter Advisor;+ public readonly InfoPanelPresenter Info;readonly List<IDisposable> owned = new List<IDisposable>();public Rig(UiText text, SettingsStore? settings = null)@@ -157,9 +224,9 @@ public class FirstTurnGuideTestsNav = Own(new ScreenNav(Ui.Root));Card = Own(new EventCardPresenter(Ui.Root, Bridge, text, null));Own(new HowToPlayPresenter(Ui.Root, text));- var (info, guide) = PanelAndGuide(Ui.Root, Bridge, text, settings, Card, () => Nav.Close());- Own(info);- Guide = Own(guide);+ var (info, advisor) = PanelAndAdvisor(Ui.Root, Bridge, text, settings, Card, () => Nav.Close());+ Info = Own(info);+ Advisor = Own(advisor);}T Own<T>(T d) where T : IDisposable { owned.Add(d); return d; }@@ -171,17 +238,19 @@ public class FirstTurnGuideTests}}- /// <summary>The six steps, in the order a player meets them: the move step (#1141, owner, 21 October 2026) after- /// training and before the event card, which keeps its own step's number.</summary>+ /// <summary>The seven steps, in the order a player meets them (spec 9.2): the greeting first, then the guide's six with+ /// the guide's targets; the move step (#1141, owner, 21 October 2026) after training and before the event card.</summary>[Test]- public void HasSixStepsInOrder()+ public void HasSevenStepsInOrder(){- CollectionAssert.AreEqual(new[] { "attention", "city", "training", "move", "event", "objectives" }, FirstTurnGuidePresenter.Steps);- Assert.AreEqual(Array.IndexOf(FirstTurnGuidePresenter.Steps, "event"), FirstTurnGuidePresenter.EventStep);- foreach (var text in new[] { En, He })- foreach (var key in FirstTurnGuidePresenter.Steps)- foreach (var part in new[] { ".title", ".text" })- Assert.IsFalse(string.IsNullOrWhiteSpace(text["guide." + key + part]), $"{text["ui.lang"]}: guide.{key}{part}");+ CollectionAssert.AreEqual(new[] { "opening.greeting", "opening.attention", "opening.city", "opening.training", "opening.move", "opening.event", "opening.objectives" }, Steps);+ Assert.AreEqual(5, AdvisorPresenter.EventStep);+ var targets = AdvisorCatalog.Load().Messages.Where(m => m.Signal == AdvisorSignals.Opening)+ .Select(m => m.Actions.FirstOrDefault(a => a.ShowMe != "")?.ShowMe ?? "").ToArray();+ CollectionAssert.AreEqual(new[] { "", "attention", "city_housing", "city_training", "unit_move", "decision_waiting", "nav_objectives" }, targets,+ "the guide's targets, in its order");+ foreach (var text in new[] { En, He }) foreach (var key in Steps)+ Assert.IsFalse(string.IsNullOrWhiteSpace(text["advisor." + key + ".text"]), key);}/// <summary>The unit the move step shows: the first drawn unit (units.yaml order) that the sim lets move now (a hex in@@ -191,42 +260,44 @@ public class FirstTurnGuideTests{var s = GameSession.New(C, GoldenRun.Seed, Mode.Historical).State;var rows = UnitRoster.FromState(UnitRows, C, s, _ => true, (row, a, q, r) => a).Select(t => t.Unit).ToList();- var id = FirstTurnGuidePresenter.UnitToShow(C, s, rows);+ var id = AdvisorTargets.UnitToShow(C, s, rows);Assert.IsNotNull(id, "a new game has a unit that can move");var row = rows.Single(u => u.Id == id);Assert.AreEqual(UnitData.Israel, row.Side);Assert.IsNotEmpty(Movement.Reachable(C, s, UnitCard.SimUnit(C, s, row)!.Value), "the sim has a hex for it");var first = rows.First(u => UnitCard.SimUnit(C, s, u) is int i && Movement.Reachable(C, s, i).Count > 0);Assert.AreEqual(first.Id, id, "the first such row");- Assert.IsNull(FirstTurnGuidePresenter.UnitToShow(SimBridgeGddTests.Legacy, s, rows), "the legacy loop: no unit to show");+ Assert.IsNull(AdvisorTargets.UnitToShow(SimBridgeGddTests.Legacy, s, rows), "the legacy loop: no unit to show");}- /// <summary>Skip at any step closes it; Next walks the six steps and Done closes it; Escape skips; How to play's button+ /// <summary>Skip at any step closes it; Next walks the seven steps and Done closes it; Escape skips; How to play's button/// opens it again at its first step, closing that screen; each step shows its own strings.</summary>- [Test]- public void CanBeSkippedAtAnyStepAndReopened([Values(false, true)] bool hebrew)+ [UnityTest] public IEnumerator CanBeSkippedInEnglish() { yield return CanBeSkippedAtAnyStepAndReopened(false); }+ [UnityTest] public IEnumerator CanBeSkippedInHebrew() { yield return CanBeSkippedAtAnyStepAndReopened(true); }+ IEnumerator CanBeSkippedAtAnyStepAndReopened(bool hebrew){var text = hebrew ? He : En;using var rig = new Rig(text, new SettingsStore(TempDir()));using var objectives = new ObjectivesPresenter(rig.Ui.Root, rig.Bridge, text);- rig.Guide.NewGame();- Assert.IsTrue(rig.Guide.IsOpen);- for (int step = 0; step < FirstTurnGuidePresenter.Steps.Length; step++)+ rig.Advisor.NewGame();+ Assert.IsTrue(rig.Advisor.InChain);+ for (int step = 0; step < Steps.Length; step++){- var key = FirstTurnGuidePresenter.Steps[step];- Assert.AreEqual(step, rig.Guide.Step);- Assert.AreEqual(text.Format("guide.step", step + 1, 6), rig.Ui.Q<Label>("guide-count").text);- Assert.AreEqual(text["guide." + key + ".title"], rig.Ui.Q<Label>("guide-title").text);- Assert.AreEqual(text["guide." + key + ".text"], rig.Ui.Q<Label>("guide-text").text);- Assert.AreEqual(text[step == 5 ? "guide.done" : "guide.next"], rig.Ui.Q<Button>("guide-next").text);- Assert.AreEqual(step != FirstTurnGuidePresenter.EventStep, rig.Card.Collapsed, $"step {step + 1}: the card shows on its own step only");- if (key == "objectives")+ var key = Steps[step];+ Assert.AreEqual(step, rig.Advisor.ChainStep);+ Assert.AreEqual(text.Format("advisor.step", step + 1, 7), rig.Ui.Q<Label>("advisor-count").text);+ var speaker = AdvisorCatalog.Load().Messages.Single(m => m.Id == key).Advisor;+ Assert.AreEqual(text["advisor." + speaker + (step == 2 ? ".name_first" : ".name")], rig.Ui.Q<Label>("advisor-name").text);+ Assert.AreEqual(text["advisor." + key + ".text"], rig.Ui.Q<Label>("advisor-text").text);+ Assert.AreEqual(text[step == 6 ? "advisor.done" : "advisor.next"], rig.Ui.Q<Button>("advisor-got-it").text);+ Assert.IsTrue(rig.Card.Collapsed, "the chain speaks before the card opens");+ if (key == "opening.objectives"){- // #791: from the guide's last step the real Objectives button opens the new parts and the standalone goal.+ // #791: from the advisor's last step the real Objectives button opens the new parts and the standalone goal.CollectionAssert.AreEquivalent(new[] { "railway", "burma_road", "yishuvim", "absorb_immigrants" },C.Objectives.Select(o => o.Id).ToArray(), "the current objectives, not the retired standalone first yishuv");rig.Ui.Press("nav-objectives");- Assert.AreEqual("objectives", rig.Nav.Current, "the guide's Objectives destination opens");+ Assert.AreEqual("objectives", rig.Nav.Current, "the advisor's Objectives destination opens");var rows = rig.Ui.Q<ScrollView>("objectives-rows").Query(className: "objectives-row").ToList();CollectionAssert.AreEqual(C.Objectives.Select(o => "objectives-row-" + o.Id).ToArray(),rows.Select(row => row.name).ToArray(), "every current objective in the helper's order");@@ -239,89 +310,98 @@ public class FirstTurnGuideTests}rig.Nav.Close();}- rig.Ui.Press("guide-next");+ rig.Ui.Press("advisor-got-it");}- Assert.IsFalse(rig.Guide.IsOpen, "Done closes it");+ Assert.IsFalse(rig.Advisor.InChain, "Done closes it");Assert.IsFalse(rig.Card.Collapsed, "and the card is as it was");- for (int at = 0; at < FirstTurnGuidePresenter.Steps.Length; at++)+ for (int at = 0; at < Steps.Length; at++){rig.Ui.Press("nav-how-to-play");Assert.AreEqual("how-to-play", rig.Nav.Current);Assert.AreEqual(text["how_to_play.guide"], rig.Ui.Q<Button>("how-to-play-guide").text);rig.Ui.Press("how-to-play-guide");- Assert.IsTrue(rig.Guide.IsOpen, "How to play opens it again");+ Assert.IsTrue(rig.Advisor.InChain, "How to play opens it again");Assert.IsNull(rig.Nav.Current, "and closes itself");- Assert.AreEqual(0, rig.Guide.Step);- for (int i = 0; i < at; i++) rig.Ui.Press("guide-next");- rig.Ui.Press("guide-skip");- Assert.IsFalse(rig.Guide.IsOpen, $"Skip at step {at + 1}");+ Assert.AreEqual(0, rig.Advisor.ChainStep);+ for (int i = 0; i < at; i++) rig.Ui.Press("advisor-got-it");+ rig.Ui.Press("advisor-close");+ Assert.IsFalse(rig.Advisor.InChain, $"Skip at step {at + 1}");Assert.IsFalse(rig.Card.Collapsed, $"the card is back after a Skip at step {at + 1}");}- rig.Guide.Open();- Assert.IsTrue(rig.Guide.Escape(), "Escape skips it");- Assert.IsFalse(rig.Guide.IsOpen);- Assert.IsFalse(rig.Guide.Escape(), "and does nothing when it is closed");-- rig.Card.Collapse(); // the player hid the card before opening the guide- rig.Guide.Open();- for (int i = 0; i < FirstTurnGuidePresenter.EventStep; i++) rig.Ui.Press("guide-next");- Assert.IsFalse(rig.Card.Collapsed, "the event step shows the card");- rig.Ui.Press("guide-skip");+ rig.Advisor.OpenChain();+ yield return null; rig.Ui.Q<Button>("advisor-got-it").Focus();+ Assert.IsTrue(rig.Advisor.Escape(), "Escape skips it");+ Assert.IsFalse(rig.Advisor.InChain);+ // The guide's "Escape does nothing when closed" cannot be asked again here: Time.frameCount does not move in an+ // edit-mode test, so Escape keeps answering "used this frame" (AdvisorPopupTests.OneEscapeInThePopupLeavesTheScreenUnderItOpen).+ Assert.IsFalse(rig.Ui.Root.Q("root").ClassListContains(AdvisorPresenter.OpenClass), "and it stays closed");++ rig.Card.Collapse(); // the player hid the card before opening the advisor+ rig.Advisor.OpenChain();+ for (int i = 0; i < AdvisorPresenter.EventStep; i++) rig.Ui.Press("advisor-got-it");+ rig.Ui.Press("advisor-show-me");+ Assert.IsFalse(rig.Card.Collapsed, "Show me opens the card");+ rig.Card.Collapse();+ rig.Ui.Press("advisor-close");Assert.IsTrue(rig.Card.Collapsed, "and Skip hides it again, as the player left it");}- /// <summary>End turn pressed with the guide open (it takes no pointer outside its panel, so the HUD stays usable): the- /// guide closes as the turn advances, at any step, and the new turn's card is left to its own rule (a new event opens),- /// not hidden or shown by what the guide found on the old card (review of #1209, follow-up 1).</summary>+ /// <summary>End turn pressed with the advisor open (it takes no pointer outside its panel, so the HUD stays usable): the+ /// advisor closes as the turn advances, at any step, and the new turn's card is left to its own rule (a new event opens),+ /// not hidden or shown by what the advisor found on the old card (review of #1209, follow-up 1).</summary>[Test]- public void EndTurnClosesTheGuide([Values(0, 1, FirstTurnGuidePresenter.EventStep)] int step, [Values(false, true)] bool cardHidden)+ public void EndTurnClosesTheChain([Values(0, 1, 2, AdvisorPresenter.EventStep)] int step, [Values(false, true)] bool cardHidden){var game = OpenScene(new SaveStore(TempDir()), new SettingsStore(TempDir()));- game.Begin(Inputs, 0, startScreen: true);+ Begin(game, Inputs, 0, startScreen: true);UiTestKit.Press(Ui.Q<Button>("start-new-game"));- Assert.IsTrue(game.Guide!.IsOpen, "precondition: the first new game opens the guide");- game.Guide.Close();+ Assert.IsTrue(game.Advisor!.InChain, "precondition: the first new game opens the advisor");+ game.Advisor.CloseChain();var card = game.Card!;Assert.IsNotNull(card.Shown, "precondition: a new game opens on a card");var first = card.Shown!.Id;if (cardHidden) card.Collapse();- game.Guide.Open();- for (int i = 0; i < step; i++) UiTestKit.Press(Ui.Q<Button>("guide-next"));+ game.Advisor.OpenChain();+ for (int i = 0; i < step; i++) UiTestKit.Press(Ui.Q<Button>("advisor-got-it"));var turn = game.Bridge!.State.Turn;UiTestKit.Press(Ui.Q<Button>("end-turn"));Assert.AreEqual(turn + 1, game.Bridge.State.Turn, "precondition: End turn ran the turn");- Assert.IsFalse(game.Guide.IsOpen, "the guide closes when the turn advances");- Assert.AreEqual(-1, game.Guide.Step);- Assert.IsFalse(Ui.Q("root").ClassListContains(FirstTurnGuidePresenter.OpenClass));+ Assert.IsFalse(game.Advisor.InChain, "the advisor closes when the turn advances");+ Assert.AreEqual(-1, game.Advisor.ChainStep);+ Assert.IsFalse(Ui.Q("root").ClassListContains(AdvisorPresenter.OpenClass));if (card.Shown != null && card.Shown.Id != first)Assert.IsFalse(card.Collapsed, $"the new turn's card ({card.Shown.Id}) opens by its own rule");else if (card.Shown != null)- Assert.AreEqual(cardHidden, card.Collapsed, "the same card is put back as the guide found it");+ Assert.AreEqual(cardHidden, card.Collapsed, "the same card is put back as the advisor found it");Assert.AreEqual(card.Shown != null && !card.Collapsed, Ui.Q("root").ClassListContains(EventCardPresenter.OpenClass),"the backdrop shows with an open card only");}- /// <summary>The guide shows its city on steps 2 and 3; Done, Skip or Escape puts back the selection it found (none, a+ /// <summary>The advisor shows its city on steps 2 and 3; Done, Skip or Escape puts back the selection it found (none, a/// hex or a unit) with the info panel and the map's outline; a selection the player made meanwhile is kept (review of/// #1209, follow-up 3).</summary>- [Test]- public void ClosingPutsBackTheSelectionItFound()+ [UnityTest]+ public IEnumerator ClosingPutsBackTheSelectionItFound(){var game = OpenScene(new SaveStore(TempDir()), new SettingsStore(TempDir()));- game.Begin(Inputs, 0, startScreen: true);+ Begin(game, Inputs, 0, startScreen: true);UiTestKit.Press(Ui.Q<Button>("start-new-game"));- var guide = game.Guide!; var info = game.Info!; var units = game.Units!; var bridge = game.Bridge!;+ var advisor = game.Advisor!; var info = game.Info!; var units = game.Units!; var bridge = game.Bridge!;var map = Object.FindFirstObjectByType<MapScene>();- var city = FirstTurnGuidePresenter.CityHex(bridge.Content, bridge.State)!.Value;+ var city = AdvisorTargets.CityHex(bridge.Content, bridge.State)!.Value;bool Outlined() { var t = map.Terrain.transform.Find(MapScene.SelectionName); return t != null && t.GetComponent<MeshRenderer>().enabled; }- void ToCity() { UiTestKit.Press(Ui.Q<Button>("guide-next")); Assert.AreEqual(city, info.Selected, "step 2 shows the guide's city"); }+ void ToCity()+ {+ for (int i = 0; i < 2; i++) UiTestKit.Press(Ui.Q<Button>("advisor-got-it")); // past the greeting and Attention+ Assert.AreEqual(city, info.Selected, "step 3 shows the advisor's city");+ }void Click(int q, int r) => GameRoot.OnHexClicked(map, units, info, q, r);- Assert.IsTrue(guide.IsOpen && info.Selected == null && !info.ShowsUnit, "precondition: a new game, nothing selected");+ Assert.IsTrue(advisor.InChain && info.Selected == null && !info.ShowsUnit, "precondition: a new game, nothing selected");ToCity();- UiTestKit.Press(Ui.Q<Button>("guide-skip"));+ UiTestKit.Press(Ui.Q<Button>("advisor-close"));Assert.IsNull(info.Selected, "Skip: nothing selected again");Assert.IsFalse(info.ShowsUnit);Assert.IsNull(units.Selected);@@ -330,10 +410,10 @@ public class FirstTurnGuideTestsvar hex = bridge.Content.Hexes.Where(h => h.Land).Select(h => (h.Q, h.R)).First(h => h != city && units.UnitToSelectAt(h.Item1, h.Item2) == null);Click(hex.Item1, hex.Item2);Assert.AreEqual(hex, info.Selected, "precondition: a hex selected");- guide.Open(); ToCity();- for (int i = 1; i < FirstTurnGuidePresenter.Steps.Length; i++) UiTestKit.Press(Ui.Q<Button>("guide-next"));- Assert.IsFalse(guide.IsOpen, "Done");- Assert.AreEqual(hex, info.Selected, "Done: the hex the guide found");+ advisor.OpenChain(); ToCity();+ for (int i = 2; i < Steps.Length; i++) UiTestKit.Press(Ui.Q<Button>("advisor-got-it"));+ Assert.IsFalse(advisor.InChain, "Done");+ Assert.AreEqual(hex, info.Selected, "Done: the hex the advisor found");Assert.IsTrue(Outlined(), "outlined again");Assert.IsNotEmpty(units.Tokens, "precondition: units in play");@@ -341,47 +421,47 @@ public class FirstTurnGuideTestsClick(token.Q, token.R);var unit = units.Selected;Assert.IsTrue(unit != null && info.ShowsUnit, "precondition: a unit selected");- guide.Open(); ToCity();- Assert.IsTrue(guide.Escape());- Assert.AreEqual(unit, units.Selected, "Escape: the unit the guide found");+ advisor.OpenChain(); ToCity();+ yield return null; Ui.Q<Button>("advisor-got-it").Focus(); Assert.IsTrue(advisor.Escape());+ Assert.AreEqual(unit, units.Selected, "Escape: the unit the advisor found");Assert.IsTrue(info.ShowsUnit, "its card in the info panel");Assert.IsFalse(Outlined(), "with its ring, not a hex outline");Click(hex.Item1, hex.Item2);- guide.Open(); ToCity();+ advisor.OpenChain(); ToCity();var other = bridge.Content.Hexes.Where(h => h.Land).Select(h => (h.Q, h.R)).First(h => h != city && h != hex && units.UnitToSelectAt(h.Item1, h.Item2) == null);- Click(other.Item1, other.Item2); // the player picks a hex under the open guide- UiTestKit.Press(Ui.Q<Button>("guide-skip"));+ Click(other.Item1, other.Item2); // the player picks a hex under the open advisor+ UiTestKit.Press(Ui.Q<Button>("advisor-close"));Assert.AreEqual(other, info.Selected, "a selection the player made meanwhile stays");}- /// <summary>In the game as a player has it, the move step shows the guide's unit (UnitToShow) as a click on it would: its- /// ring and its card with the Move button. Skip puts back the selection the guide found (none), as on the city's steps.</summary>+ /// <summary>In the game as a player has it, the move step shows the advisor's unit (UnitToShow) as a click on it would: its+ /// ring and its card with the Move button. Skip puts back the selection the advisor found (none), as on the city's steps.</summary>[Test]public void TheMoveStepShowsAUnitsCardWithMove(){var game = OpenScene(new SaveStore(TempDir()), new SettingsStore(TempDir()));- game.Begin(Inputs, 0, startScreen: true);+ Begin(game, Inputs, 0, startScreen: true);UiTestKit.Press(Ui.Q<Button>("start-new-game"));- var guide = game.Guide!; var info = game.Info!; var units = game.Units!; var bridge = game.Bridge!;- Assert.IsTrue(guide.IsOpen && info.Selected == null && !info.ShowsUnit, "precondition: a new game, nothing selected");- var move = Array.IndexOf(FirstTurnGuidePresenter.Steps, "move");- for (int i = 0; i < move; i++) UiTestKit.Press(Ui.Q<Button>("guide-next"));- Assert.AreEqual(move, guide.Step);- var id = FirstTurnGuidePresenter.UnitToShow(bridge.Content, bridge.State, units.Tokens.Select(t => t.Token));+ var advisor = game.Advisor!; var info = game.Info!; var units = game.Units!; var bridge = game.Bridge!;+ Assert.IsTrue(advisor.InChain && info.Selected == null && !info.ShowsUnit, "precondition: a new game, nothing selected");+ var move = Array.IndexOf(Steps, "opening.move");+ for (int i = 0; i < move; i++) UiTestKit.Press(Ui.Q<Button>("advisor-got-it"));+ Assert.AreEqual(move, advisor.ChainStep);+ var id = AdvisorTargets.UnitToShow(bridge.Content, bridge.State, units.Tokens.Select(t => t.Token));Assert.IsNotNull(id, "precondition: a drawn unit can move");- Assert.AreEqual(id, units.Selected, "the guide's unit, with its ring");+ Assert.AreEqual(id, units.Selected, "the advisor's unit, with its ring");Assert.IsTrue(info.ShowsUnit, "its card in the info panel");Assert.AreEqual(DisplayStyle.Flex, Ui.Q<Button>("info-move").style.display.value, "with the Move button");- UiTestKit.Press(Ui.Q<Button>("guide-skip"));+ UiTestKit.Press(Ui.Q<Button>("advisor-close"));Assert.IsNull(units.Selected, "Skip: no unit selected again");Assert.IsFalse(info.ShowsUnit);Assert.IsNull(info.Selected, "and no hex");}- /// <summary>Issue #1392: the move step brings UnitToShow's hex into the map view, clear of the info panel and the guide's+ /// <summary>Issue #1392: the move step brings UnitToShow's hex into the map view, clear of the info panel and the advisor's/// card, with at least one of Movement.Reachable's lit destinations visible too. The real scene, camera projection and HUD- /// layout are used at the guide's supported desktop, itch embed and phone sizes, in both UI directions.</summary>+ /// layout are used at the advisor's supported desktop, itch embed and phone sizes, in both UI directions.</summary>[UnityTest]public IEnumerator TheMoveStepShowsTheUnitAndAReachableHexOnTheMap(){@@ -401,29 +481,29 @@ public class FirstTurnGuideTestsgame.Language = hebrew ? UiLanguage.Hebrew : UiLanguage.English;Object.FindFirstObjectByType<UIDocument>().panelSettings = ps;camera.targetTexture = camRt;- game.Begin(Inputs, 0, startScreen: true);+ Begin(game, Inputs, 0, startScreen: true);UiTestKit.Press(Ui.Q<Button>("start-new-game"));- var guide = game.Guide!; var bridge = game.Bridge!; var units = game.Units!;+ var advisor = game.Advisor!; var bridge = game.Bridge!; var units = game.Units!;var map = Object.FindFirstObjectByType<MapScene>();- var move = Array.IndexOf(FirstTurnGuidePresenter.Steps, "move");- for (int step = 0; step < move; step++) UiTestKit.Press(Ui.Q<Button>("guide-next"));- Assert.AreEqual(move, guide.Step, "precondition: the guide is on its move step");+ var move = Array.IndexOf(Steps, "opening.move");+ for (int step = 0; step < move; step++) UiTestKit.Press(Ui.Q<Button>("advisor-got-it"));+ Assert.AreEqual(move, advisor.ChainStep, "precondition: the advisor is on its move step");for (int frame = 0; frame < 5; frame++) yield return null;- var id = FirstTurnGuidePresenter.UnitToShow(bridge.Content, bridge.State, units.Tokens.Select(t => t.Token));+ var id = AdvisorTargets.UnitToShow(bridge.Content, bridge.State, units.Tokens.Select(t => t.Token));Assert.IsNotNull(id, "precondition: a drawn unit can move");var token = units.Tokens.Single(t => t.Token.Unit.Id == id);var simUnit = UnitCard.SimUnit(bridge.Content, bridge.State, token.Token);- Assert.IsNotNull(simUnit, "precondition: the guide's token has a sim unit");+ Assert.IsNotNull(simUnit, "precondition: the advisor's token has a sim unit");var reachable = Movement.Reachable(bridge.Content, bridge.State, simUnit!.Value).Keys.ToList();- Assert.IsNotEmpty(reachable, "precondition: the guide's unit has a destination");+ Assert.IsNotEmpty(reachable, "precondition: the advisor's unit has a destination");UiTestKit.Press(Ui.Q<Button>("info-move"));Assert.IsTrue(map.Terrain.transform.Find(MapScene.ReachableName)?.GetComponent<MeshRenderer>().enabled == true,"precondition: Move lit the reachable hexes");var root = Ui;var info = root.Q("info-panel").worldBound;- var card = root.Q("guide-panel").worldBound; // the guide's own card is opaque too+ var card = root.Q("advisor-popup").worldBound; // the advisor's own card is opaque toostring at = $"{(hebrew ? "he" : "en")} {w}x{h}";(bool visible, bool clear, Vector3 viewport, Vector2 panel) Project(int q, int r){@@ -438,9 +518,9 @@ public class FirstTurnGuideTestsvar unit = Project(token.Q, token.R);if (!unit.visible) problems.Add($"{at}: unit ({token.Q},{token.R}) is outside the viewport at {unit.viewport}");- else if (!unit.clear) problems.Add($"{at}: unit ({token.Q},{token.R}) at {unit.panel} is under the info panel {info} or the guide {card}");+ else if (!unit.clear) problems.Add($"{at}: unit ({token.Q},{token.R}) at {unit.panel} is under the info panel {info} or the advisor {card}");if (!reachable.Select(p => (at: p, projection: Project(p.Q, p.R))).Any(p => p.projection.visible && p.projection.clear))- problems.Add($"{at}: no reachable hex is visible and clear of the info panel and the guide");+ problems.Add($"{at}: no reachable hex is visible and clear of the info panel and the advisor");}finally{@@ -460,113 +540,134 @@ public class FirstTurnGuideTests/// <summary>The owner's report on v0.1.4 ("they open for a split second after the user closes the screen they were/// supposed to explain"), path A: the player answers the card while the event step explains it. The card closes, so the- /// guide goes on to the next step at once, with Next focused, instead of explaining a card that is gone.</summary>- [Test]- public void AnsweringTheCardOnItsStepGoesOnToTheNext()+ /// advisor goes on to the next step at once, with Next focused, instead of explaining a card that is gone.</summary>+ [UnityTest]+ public IEnumerator AnsweringTheCardOnItsStepGoesOnToTheNext(){var game = OpenScene(new SaveStore(TempDir()), new SettingsStore(TempDir()));- game.Begin(Inputs, 0, startScreen: true);- UiTestKit.Press(Ui.Q<Button>("start-new-game"));- var guide = game.Guide!; var card = game.Card!;- for (int i = 0; i < FirstTurnGuidePresenter.EventStep; i++) UiTestKit.Press(Ui.Q<Button>("guide-next"));- Assert.AreEqual(FirstTurnGuidePresenter.EventStep, guide.Step, "precondition: the event step");- Assert.IsTrue(card.Shown != null && !card.Collapsed, "precondition: its card open");- AnswerTheCard();- Assert.IsNull(card.Shown, "precondition: the opening turn has one card, now answered");- Assert.IsTrue(guide.IsOpen);- Assert.AreEqual(Array.IndexOf(FirstTurnGuidePresenter.Steps, "objectives"), guide.Step, "the guide goes on to Objectives");- Assert.AreEqual(En.Format("guide.step", 6, 6), Ui.Q<Label>("guide-count").text, "the count the player was shown stays");- Assert.AreEqual(En["guide.objectives.title"], Ui.Q<Label>("guide-title").text);- Assert.AreSame(Ui.Q<Button>("guide-next"), Ui.Q("root").focusController.focusedElement, "Next has the focus again");+ Begin(game, Inputs, 0, startScreen: true); UiTestKit.Press(Ui.Q<Button>("start-new-game"));+ var advisor = game.Advisor!; var card = game.Card!;+ for (int i = 0; i < AdvisorPresenter.EventStep; i++) advisor.NextStep();+ Assert.IsTrue(card.Shown != null && card.Collapsed);+ UiTestKit.Press(Ui.Q<Button>("advisor-show-me")); Assert.IsFalse(advisor.IsOpen);+ card.Collapse(); Assert.AreEqual(5, advisor.ChainStep); Assert.IsTrue(advisor.IsOpen);+ UiTestKit.Press(Ui.Q<Button>("advisor-show-me")); AnswerTheCard();+ Assert.IsNull(card.Shown); Assert.IsTrue(advisor.InChain); Assert.AreEqual(6, advisor.ChainStep);+ Assert.AreEqual(En.Format("advisor.step", 7, 7), Ui.Q<Label>("advisor-count").text, "the count the player was shown stays");+ Assert.AreEqual(En["advisor.opening.objectives.text"], Ui.Q<Label>("advisor-text").text, "on to Objectives");+ for (int i = 0; i < 3; i++) yield return null; // the popup was hidden under the card: styles resolve+ Assert.AreSame(Ui.Q<Button>("advisor-got-it"), Ui.Q("root").focusController.focusedElement, "Next has the focus again (#1323)");}- /// <summary>Path B: the card was answered before the guide reaches its event step (a returning player opening it from How- /// to play, or one who answered it under the guide): there is no card to explain, so the step is left out and the- /// guide counts five steps.</summary>+ /// <summary>Path B: the card was answered before the advisor reaches its event step (a returning player opening it from How+ /// to play, or one who answered it under the advisor): there is no card to explain, so the step is left out and the+ /// advisor counts five steps.</summary>[Test]public void WithNoCardTheEventStepIsLeftOut(){var game = OpenScene(new SaveStore(TempDir()), new SettingsStore(TempDir()));- game.Begin(Inputs, 0, startScreen: true);+ Begin(game, Inputs, 0, startScreen: true);UiTestKit.Press(Ui.Q<Button>("start-new-game"));- var guide = game.Guide!; var card = game.Card!;- guide.Close();+ var advisor = game.Advisor!; var card = game.Card!;+ advisor.CloseChain();AnswerTheCard();Assert.IsNull(card.Shown, "precondition: no card left this turn");UiTestKit.Press(Ui.Q<Button>("nav-how-to-play")); UiTestKit.Press(Ui.Q<Button>("how-to-play-guide"));- Assert.IsTrue(guide.IsOpen);+ Assert.IsTrue(advisor.InChain);var seen = new List<string>();- for (int shown = 1; guide.IsOpen; shown++)+ for (int shown = 1; advisor.InChain; shown++){- seen.Add(FirstTurnGuidePresenter.Steps[guide.Step]);- Assert.AreEqual(En.Format("guide.step", shown, 5), Ui.Q<Label>("guide-count").text, $"step {shown} of five");- Assert.AreEqual(En[shown == 5 ? "guide.done" : "guide.next"], Ui.Q<Button>("guide-next").text);- Assert.LessOrEqual(shown, 5, "five steps, then Done");- UiTestKit.Press(Ui.Q<Button>("guide-next"));+ seen.Add(Steps[advisor.ChainStep]);+ Assert.AreEqual(En.Format("advisor.step", shown, 6), Ui.Q<Label>("advisor-count").text, $"step {shown} of six");+ Assert.AreEqual(En[shown == 6 ? "advisor.done" : "advisor.next"], Ui.Q<Button>("advisor-got-it").text);+ Assert.LessOrEqual(shown, 6, "six steps, then Done");+ UiTestKit.Press(Ui.Q<Button>("advisor-got-it"));}- CollectionAssert.AreEqual(new[] { "attention", "city", "training", "move", "objectives" }, seen);+ CollectionAssert.AreEqual(new[] { "opening.greeting", "opening.attention", "opening.city", "opening.training", "opening.move", "opening.objectives" }, seen);}- /// <summary>The city or unit the guide shows for steps 2 to 4 is put away when the guide moves on to a step that does not+ /// <summary>The city or unit the advisor shows for steps 2 to 4 is put away when the advisor moves on to a step that does not/// explain it (the event card, Objectives), with or without a card, so no stale panel stays under the later steps.</summary>[Test]public void LeavingTheMoveStepPutsItsUnitCardAway([Values(false, true)] bool cardAnswered){var game = OpenScene(new SaveStore(TempDir()), new SettingsStore(TempDir()));- game.Begin(Inputs, 0, startScreen: true);+ Begin(game, Inputs, 0, startScreen: true);UiTestKit.Press(Ui.Q<Button>("start-new-game"));- var guide = game.Guide!; var info = game.Info!; var units = game.Units!;- if (cardAnswered) { guide.Close(); AnswerTheCard(); guide.Open(); }- var move = Array.IndexOf(FirstTurnGuidePresenter.Steps, "move");- for (int i = 0; i < move; i++) UiTestKit.Press(Ui.Q<Button>("guide-next"));+ var advisor = game.Advisor!; var info = game.Info!; var units = game.Units!;+ if (cardAnswered) { advisor.CloseChain(); AnswerTheCard(); advisor.OpenChain(); }+ var move = Array.IndexOf(Steps, "opening.move");+ for (int i = 0; i < move; i++) UiTestKit.Press(Ui.Q<Button>("advisor-got-it"));Assert.IsTrue(info.ShowsUnit && units.Selected != null, "precondition: the move step shows a unit's card");- UiTestKit.Press(Ui.Q<Button>("guide-next"));- Assert.AreEqual(cardAnswered ? "objectives" : "event", FirstTurnGuidePresenter.Steps[guide.Step]);+ UiTestKit.Press(Ui.Q<Button>("advisor-got-it"));+ Assert.AreEqual(cardAnswered ? "opening.objectives" : "opening.event", Steps[advisor.ChainStep]);Assert.IsFalse(info.ShowsUnit, "the unit's card is put away");- Assert.IsNull(units.Selected, "and its unit unselected, as the guide found it");+ Assert.IsNull(units.Selected, "and its unit unselected, as the advisor found it");Assert.IsNull(info.Selected, "with no hex shown either");}- /// <summary>A closed or disposed guide takes no notice of the game changing (it listens to SimBridge.Changed only while it+ /// <summary>A closed or disposed advisor takes no notice of the game changing (it listens to SimBridge.Changed only while it/// lives, and acts on it only while it is open).</summary>[Test]- public void AClosedGuideIgnoresTheGameChanging()+ public void AClosedChainIgnoresTheGameChanging(){var game = OpenScene(new SaveStore(TempDir()), new SettingsStore(TempDir()));- game.Begin(Inputs, 0, startScreen: true);+ Begin(game, Inputs, 0, startScreen: true);UiTestKit.Press(Ui.Q<Button>("start-new-game"));- var guide = game.Guide!;- for (int i = 0; i < FirstTurnGuidePresenter.EventStep; i++) UiTestKit.Press(Ui.Q<Button>("guide-next"));- UiTestKit.Press(Ui.Q<Button>("guide-skip"));+ var advisor = game.Advisor!;+ for (int i = 0; i < AdvisorPresenter.EventStep; i++) UiTestKit.Press(Ui.Q<Button>("advisor-got-it"));+ UiTestKit.Press(Ui.Q<Button>("advisor-close"));AnswerTheCard();- Assert.IsFalse(guide.IsOpen, "closed, it stays closed");- Assert.AreEqual(-1, guide.Step);- Assert.IsFalse(Ui.Q("root").ClassListContains(FirstTurnGuidePresenter.OpenClass));+ Assert.IsFalse(advisor.InChain, "closed, it stays closed");+ Assert.AreEqual(-1, advisor.ChainStep);+ Assert.IsFalse(Ui.Q("root").ClassListContains(AdvisorPresenter.OpenClass));using var rig = new Rig(En);var bridge = rig.Bridge;- var lone = new FirstTurnGuidePresenter(rig.Ui.Root, En, null, rig.Card, bridge: bridge);+ var lone = new AdvisorPresenter(rig.Ui.Root, bridge, En, new AdvisorSession(Approved(), new AdvisorSettings(null), false), hooks: new AdvisorHooks { Card = rig.Card });lone.Dispose();- rig.Guide.Open(); // another guide open on the same HUD (the root's class)- for (int i = 0; i < FirstTurnGuidePresenter.EventStep; i++) rig.Guide.Next();+ rig.Advisor.OpenChain(); // another advisor open on the same HUD (the root's class)+ for (int i = 0; i < AdvisorPresenter.EventStep; i++) rig.Advisor.NextStep();+ rig.Card.Reopen(); // the chain's event step waits for the cardUiTestKit.Press(rig.Ui.Root.Q("event-options").Query<Button>().First());Assert.IsNull(rig.Card.Shown, "precondition: the card answered");- Assert.AreEqual(-1, lone.Step, "the disposed guide was not called");+ Assert.AreEqual(-1, lone.ChainStep, "the disposed advisor was not called");+ }++ /// <summary>The game changing under an open step (a + or − on the city's workers raises SimBridge.Changed) draws the step+ /// again without showing its city again: a hex the player picked meanwhile stays selected (review of the S2 draft).</summary>+ [Test]+ public void TheGameChangingKeepsThePlayersSelectionOnAStep()+ {+ using var rig = new Rig(En, new SettingsStore(TempDir()));+ rig.Advisor.OpenChain(); rig.Advisor.NextStep(); rig.Advisor.NextStep();+ Assert.AreEqual("opening.city", Steps[rig.Advisor.ChainStep], "precondition: the city step");+ var city = AdvisorTargets.CityHex(rig.Bridge.Content, rig.Bridge.State)!.Value;+ Assert.AreEqual(city, rig.Info.Selected, "precondition: it shows its city");+ var other = rig.Bridge.Content.Hexes.Where(h => h.Land).Select(h => (h.Q, h.R)).First(h => h != city);+ rig.Info.Show(other.Item1, other.Item2); // the player picks another hex under the open advisor+ int changed = 0; rig.Bridge.Changed += () => changed++;+ Assert.IsNull(rig.Bridge.Queue(new AssignWorkers("tel_aviv", "job", 1)), "precondition: the order is queued");+ Assert.AreEqual(1, changed, "precondition: the game changed");+ Assert.AreEqual(other, rig.Info.Selected, "the player's hex stays");+ Assert.IsTrue(rig.Advisor.InChain); Assert.AreEqual("opening.city", Steps[rig.Advisor.ChainStep], "on the same step");+ rig.Ui.Press("advisor-close");+ Assert.AreEqual(other, rig.Info.Selected, "and Skip keeps the player's choice");}// --- Presentation only ------------------------------------------------------------------------------------------- /// <summary>The whole guide, by itself, through How to play, through every step, Skip and Escape: the state hash, the+ /// <summary>The whole advisor, by itself, through How to play, through every step, Skip and Escape: the state hash, the/// session, the queued orders and the save file are what they were.</summary>- [Test]- public void ChangesNeitherTheSimNorTheSave()+ [UnityTest]+ public IEnumerator ChangesNeitherTheSimNorTheSave(){var store = new SaveStore(TempDir());var settings = new SettingsStore(TempDir());var game = OpenScene(store, settings);- game.Begin(Inputs, 0, startScreen: true);+ Begin(game, Inputs, 0, startScreen: true);UiTestKit.Press(Ui.Q<Button>("start-new-game"));- Assert.IsTrue(game.Guide!.IsOpen);+ Assert.IsTrue(game.Advisor!.InChain);var bridge = game.Bridge!;bridge.EndTurn(); // a turn played, so there is a save to compareif (Ui.Q("root").ClassListContains(TurnReportPresenter.OpenClass)) UiTestKit.Press(Ui.Q<Button>("turn-report-close"));@@ -576,13 +677,13 @@ public class FirstTurnGuideTestsAssert.IsNotNull(save, "precondition: the turn was saved");var queued = bridge.Queued.Count;- void Next(int times) { for (int i = 0; i < times; i++) UiTestKit.Press(Ui.Q<Button>("guide-next")); }+ void Next(int times) { for (int i = 0; i < times; i++) UiTestKit.Press(Ui.Q<Button>("advisor-got-it")); }void FromHowToPlay() { UiTestKit.Press(Ui.Q<Button>("nav-how-to-play")); UiTestKit.Press(Ui.Q<Button>("how-to-play-guide")); }- Next(FirstTurnGuidePresenter.Steps.Length); // the guide that opened by itself, to Done- Assert.IsFalse(game.Guide.IsOpen);- FromHowToPlay(); Next(2); UiTestKit.Press(Ui.Q<Button>("guide-skip"));- FromHowToPlay(); Next(3); Assert.IsTrue(game.Guide.Escape());- Assert.IsFalse(game.Guide.IsOpen);+ Next(Steps.Length); // the advisor that opened by itself, to Done+ Assert.IsFalse(game.Advisor.InChain);+ FromHowToPlay(); Next(2); UiTestKit.Press(Ui.Q<Button>("advisor-close"));+ FromHowToPlay(); Next(3); yield return null; Ui.Q<Button>("advisor-got-it").Focus(); Assert.IsTrue(game.Advisor.Escape());+ Assert.IsFalse(game.Advisor.InChain);Assert.AreSame(session, bridge.Session, "the same game");Assert.AreEqual(hash, bridge.State.Hash(), "the state hash");Assert.AreEqual(queued, bridge.Queued.Count, "no order queued");@@ -601,21 +702,27 @@ public class FirstTurnGuideTestsvar problems = new List<string>();foreach (var hebrew in new[] { false, true })foreach (var (w, h) in new[] { (1920, 1080), (1280, 720), (390, 844) })- yield return EachStep(w, h, hebrew, (root, guide, step) =>+ yield return EachStep(w, h, hebrew, (root, advisor, step, eventCard) =>{- string at = $"{(hebrew ? "he" : "en")} {w}x{h} step {step + 1} ({FirstTurnGuidePresenter.Steps[step]})";+ string at = $"{(hebrew ? "he" : "en")} {w}x{h} step {step + 1} ({Steps[step]})";var window = root.worldBound;- var targets = guide.Targets(step);- if (FirstTurnGuidePresenter.Steps[step] == "objectives" &&+ var targets = Targets(root, advisor, eventCard, step);+ if (Steps[step] == "opening.objectives" &&(targets.Count != 1 || targets[0].name != "nav-objectives"))problems.Add($"{at}: the last step must point at the Objectives button");- if (FirstTurnGuidePresenter.Steps[step] == "move" &&+ if (Steps[step] == "opening.move" &&(targets.Count != 1 || targets[0].name != "info-move" || ((Button)targets[0]).text != (hebrew ? He : En)["unit.order.move"]))problems.Add($"{at}: the move step must point at the unit card's Move button");+ if (step == 0)+ {+ if (targets.Count != 0 || root.Q("advisor-ring").resolvedStyle.display == DisplayStyle.Flex) problems.Add($"{at}: greeting has a ring");+ if (!Inside(root.Q("advisor-popup").worldBound, window)) problems.Add($"{at}: greeting popup outside window");+ return;+ }if (targets.Count == 0) { problems.Add($"{at}: no target shows"); return; }- var area = guide.TargetArea()!.Value;+ var area = AdvisorTargets.Area(targets)!.Value;if (!Inside(area, window)) problems.Add($"{at}: the target {area} leaves the window {window}");- var ring = root.Q("guide-ring");+ var ring = root.Q("advisor-ring");if (ring.resolvedStyle.display != DisplayStyle.Flex) problems.Add($"{at}: no ring");else{@@ -623,70 +730,70 @@ public class FirstTurnGuideTestsif (!Inside(ring.worldBound, window)) problems.Add($"{at}: the ring {ring.worldBound} leaves the window {window}");// Step 1's ring round Attention must read as its own box, not one with End turn's gold border under it.var endTurn = root.Q("end-turn").worldBound;- if (step == 0 && Gap(ring.worldBound, endTurn) < RingClearPx)+ if (step == 1 && Gap(ring.worldBound, endTurn) < RingClearPx)problems.Add($"{at}: the ring {ring.worldBound} is {Gap(ring.worldBound, endTurn):0.#} px from End turn {endTurn} (under {RingClearPx})");}- var panel = root.Q("guide-panel").worldBound;+ var panel = root.Q("advisor-popup").worldBound;if (!(panel.width > 0) || !Inside(panel, window)) problems.Add($"{at}: the panel {panel} leaves the window {window}");if (panel.Overlaps(area)) problems.Add($"{at}: the panel {panel} covers the target {area}");// The ring too (its gap and border round the target), so the larger text (player feedback, 21 October// 2026) never pushes the panel onto the gold box it points at.if (ring.resolvedStyle.display == DisplayStyle.Flex && panel.Overlaps(ring.worldBound))problems.Add($"{at}: the panel {panel} covers the ring {ring.worldBound}");- foreach (var name in new[] { "guide-title", "guide-text", "guide-skip", "guide-next" })+ foreach (var name in new[] { "advisor-name", "advisor-text", "advisor-close", "advisor-got-it" })if (!Inside(root.Q(name).worldBound, panel)) problems.Add($"{at}: {name} {root.Q(name).worldBound} leaves the panel {panel}");});Assert.IsEmpty(problems, string.Join("\n", problems));}- /// <summary>Player feedback relayed by the owner (21 October 2026: the guide's text was too small; "make it slightly- /// bigger"): at 1280x720 (the itch embed) and 1920x1080, in English and Hebrew, the guide's text is at least+ /// <summary>Player feedback relayed by the owner (21 October 2026: the advisor's text was too small; "make it slightly+ /// bigger"): at 1280x720 (the itch embed) and 1920x1080, in English and Hebrew, the advisor's text is at least/// <see cref="GuideTextOnScreenPx"/> on screen and its smallest line, the step count, at least the owner's text floor/// (HudPresenter.TextFloorPx). Before the change they were 12.7 and 10.7 at 1280x720. On screen px are the resolved size/// times the panel's scale (EditMode draws at one pixel per CSS px). Every size and step is logged, the phone (390x844)- /// too, which is held to the floor alone (about 0.49 scale; <see cref="TheGuideKeepsTheTextFloorOnEveryWindow"/>).</summary>+ /// too, which is held to the floor alone (about 0.49 scale; <see cref="TheChainKeepsTheTextFloorOnEveryWindow"/>).</summary>[UnityTest]- public IEnumerator TheGuideReadsAtTheItchEmbedSize()+ public IEnumerator TheChainReadsAtTheItchEmbedSize(){var problems = new List<string>();foreach (var hebrew in new[] { false, true })foreach (var (w, h) in new[] { (1920, 1080), (1280, 720), (390, 844) })- yield return EachStep(w, h, hebrew, (root, guide, step) =>+ yield return EachStep(w, h, hebrew, (root, advisor, step, eventCard) =>{string at = $"{(hebrew ? "he" : "en")} {w}x{h} step {step + 1}";float scale = root.panel.scaledPixelsPerPoint;float OnScreen(string name) => root.Q(name).resolvedStyle.fontSize * scale;- var panel = root.Q("guide-panel").worldBound;- Debug.Log($"GUIDE SIZE {at}: scale {scale:0.###}, text {OnScreen("guide-text"):0.#} px, title {OnScreen("guide-title"):0.#} px, " +- $"count {OnScreen("guide-count"):0.#} px, buttons {OnScreen("guide-next"):0.#} px on screen; panel {panel.width * scale:0}x{panel.height * scale:0} px");+ var panel = root.Q("advisor-popup").worldBound;+ Debug.Log($"ADVISOR SIZE {at}: scale {scale:0.###}, text {OnScreen("advisor-text"):0.#} px, title {OnScreen("advisor-name"):0.#} px, " ++ $"count {OnScreen("advisor-count"):0.#} px, buttons {OnScreen("advisor-got-it"):0.#} px on screen; panel {panel.width * scale:0}x{panel.height * scale:0} px");if (w == 390) return;- if (OnScreen("guide-text") < GuideTextOnScreenPx - 0.01f)- problems.Add($"{at}: the guide's text is {OnScreen("guide-text"):0.##} px on screen (under {GuideTextOnScreenPx})");- if (OnScreen("guide-count") < HudPresenter.TextFloorPx - 0.01f)- problems.Add($"{at}: the step count is {OnScreen("guide-count"):0.##} px on screen (under the {HudPresenter.TextFloorPx} px floor)");- if (OnScreen("guide-title") <= OnScreen("guide-text"))- problems.Add($"{at}: the title ({OnScreen("guide-title"):0.#} px) is not larger than the text ({OnScreen("guide-text"):0.#} px)");+ if (OnScreen("advisor-text") < GuideTextOnScreenPx - 0.01f)+ problems.Add($"{at}: the advisor's text is {OnScreen("advisor-text"):0.##} px on screen (under {GuideTextOnScreenPx})");+ if (OnScreen("advisor-count") < HudPresenter.TextFloorPx - 0.01f)+ problems.Add($"{at}: the step count is {OnScreen("advisor-count"):0.##} px on screen (under the {HudPresenter.TextFloorPx} px floor)");+ if (OnScreen("advisor-name") <= OnScreen("advisor-text"))+ problems.Add($"{at}: the title ({OnScreen("advisor-name"):0.#} px) is not larger than the text ({OnScreen("advisor-text"):0.#} px)");});Assert.IsEmpty(problems, string.Join("\n", problems));}- /// <summary>The owner's text floor on the guide too (21 October 2026, after #1283): at every window, the phone held upright+ /// <summary>The owner's text floor on the advisor too (21 October 2026, after #1283): at every window, the phone held upright/// (390x844, about 0.49 scale) included, in English and Hebrew, the step count, the title, the text and both buttons/// are at least HudPresenter.TextFloorPx on screen, the top bar's rule (HudPresenter.SmallTextSize); where the scale/// keeps them over it (1920x1080, 1280x720) they are the stylesheet's sizes from #1283, unchanged. Before the change/// the phone's text was about 10.8 px on screen.</summary>[UnityTest]- public IEnumerator TheGuideKeepsTheTextFloorOnEveryWindow()+ public IEnumerator TheChainKeepsTheTextFloorOnEveryWindow(){var problems = new List<string>();- // Statecraft.uss: .guide-count, .guide-title, .guide-text, Button (Skip and Next).- var stylesheet = new Dictionary<string, float> { ["guide-count"] = 18f, ["guide-title"] = 29f, ["guide-text"] = 22f, ["guide-skip"] = 19f, ["guide-next"] = 19f };- CollectionAssert.AreEqual(new[] { 18f, 29f, 22f, 19f },- new[] { FirstTurnGuidePresenter.CountPx, FirstTurnGuidePresenter.TitlePx, FirstTurnGuidePresenter.TextPx, FirstTurnGuidePresenter.ButtonPx },+ // Statecraft.uss: .advisor-count, .advisor-name, .advisor-text, Button (Skip and Next).+ var stylesheet = new Dictionary<string, float> { ["advisor-count"] = 15f, ["advisor-name"] = 24f, ["advisor-text"] = 22f, ["advisor-close"] = 19f, ["advisor-got-it"] = 19f };+ CollectionAssert.AreEqual(new[] { 15f, 24f, 22f, 19f },+ new[] { AdvisorPresenter.CountPx, AdvisorPresenter.NamePx, AdvisorPresenter.TextPx, AdvisorPresenter.ButtonPx },"the presenter's sizes mirror the stylesheet's");foreach (var hebrew in new[] { false, true })foreach (var (w, h) in new[] { (1920, 1080), (1280, 720), (1024, 768), (390, 844) })- yield return EachStep(w, h, hebrew, (root, guide, step) =>+ yield return EachStep(w, h, hebrew, (root, advisor, step, eventCard) =>{string at = $"{(hebrew ? "he" : "en")} {w}x{h} step {step + 1}";float scale = root.panel.scaledPixelsPerPoint;@@ -695,16 +802,18 @@ public class FirstTurnGuideTestsfloat size = root.Q(name).resolvedStyle.fontSize;if (size * scale < HudPresenter.TextFloorPx - 0.01f)problems.Add($"{at}: {name} is {size * scale:0.##} px on screen ({size} px at {scale:0.###}; under the {HudPresenter.TextFloorPx} px floor)");- if (w >= 1280 && Mathf.Abs(size - px) > 0.01f)+ if (Mathf.Abs(size - HudPresenter.FlooredTextSize(px, HudPresenter.ScreenPxPerPanelPx(root.panel))) > 0.01f)problems.Add($"{at}: {name} is {size} px, not the stylesheet's {px} px (the desktop sizes stay)");}- if (root.Q("guide-title").resolvedStyle.fontSize <= root.Q("guide-text").resolvedStyle.fontSize)- problems.Add($"{at}: the title is not larger than the text");+ // Where the floor lifts both (the phone), the name (24 px) and the text (22 px) meet at the floor; it is+ // never smaller. TheChainReadsAtTheItchEmbedSize holds it larger where neither is floored.+ if (root.Q("advisor-name").resolvedStyle.fontSize < root.Q("advisor-text").resolvedStyle.fontSize)+ problems.Add($"{at}: the title is smaller than the text");});Assert.IsEmpty(problems, string.Join("\n", problems));}- /// <summary>The guide's text on screen at 1280x720 and larger, in px (22 panel px at 0.67 scale is 14.7).</summary>+ /// <summary>The advisor's text on screen at 1280x720 and larger, in px (22 panel px at 0.67 scale is 14.7).</summary>const float GuideTextOnScreenPx = 14f;/// <summary>The least clear space between the ring and End turn for them to read as two boxes, in panel px.</summary>@@ -718,14 +827,20 @@ public class FirstTurnGuideTestsinner.xMin >= outer.xMin - 0.5f && inner.xMax <= outer.xMax + 0.5f && inner.yMin >= outer.yMin - 0.5f && inner.yMax <= outer.yMax + 0.5f;/// <summary>The real Game.uxml on the real PanelSettings at w x h with the HUD, the opening card and the info panel on a- /// new game; the guide opened, and <paramref name="check"/> run at each step once the layout has settled.</summary>- static IEnumerator EachStep(int w, int h, bool hebrew, Action<VisualElement, FirstTurnGuidePresenter, int> check)+ /// new game; the advisor opened, and <paramref name="check"/> run at each step once the layout has settled.</summary>+ static IReadOnlyList<VisualElement> Targets(VisualElement root, AdvisorPresenter advisor, EventCardPresenter card, int step)+ {+ var action = advisor.Chain[step].Actions.FirstOrDefault(a => a.ShowMe != "");+ return action == null ? Array.Empty<VisualElement>() : AdvisorTargets.Find(root.Q("root"), action.ShowMe, card);+ }++ static IEnumerator EachStep(int w, int h, bool hebrew, Action<VisualElement, AdvisorPresenter, int, EventCardPresenter> 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("FirstTurnGuideTest");+ var go = new GameObject("AdvisorOpeningTest");go.SetActive(false);var doc = go.AddComponent<UIDocument>();doc.panelSettings = ps;@@ -738,24 +853,24 @@ public class FirstTurnGuideTestsvar hud = new HudPresenter(root, bridge, text);var nav = new ScreenNav(root);var card = new EventCardPresenter(root, bridge, text, null);- var (info, guide) = PanelAndGuide(root, bridge, text, null, card, () => nav.Close());+ var (info, advisor) = PanelAndAdvisor(root, bridge, text, null, card, () => nav.Close());try{Assert.IsNotNull(card.Shown, "precondition: a new game opens on a card");- guide.Open();- for (int step = 0; step < FirstTurnGuidePresenter.Steps.Length; step++)+ advisor.OpenChain();+ for (int step = 0; step < Steps.Length; step++){- if (step > 0) guide.Next();- for (int i = 0; i < 20 && guide.Targets(step).Count == 0; i++) yield return null;+ if (step > 0) advisor.NextStep();+ for (int i = 0; i < 20 && step > 0 && Targets(root, advisor, card, step).Count == 0; i++) yield return null;for (int i = 0; i < 3; i++) yield return null; // the layout settles- guide.Place();+ advisor.Place();for (int i = 0; i < 2; i++) yield return null; // the panel's dock follows the ring's side- check(root, guide, step);+ check(root, advisor, step, card);}}finally{- guide.Dispose(); info.Dispose(); card.Dispose(); nav.Dispose(); hud.Dispose();+ advisor.Dispose(); info.Dispose(); card.Dispose(); nav.Dispose(); hud.Dispose();Object.DestroyImmediate(go); Object.DestroyImmediate(ps); rt.Release(); Object.DestroyImmediate(rt);}}diff --git a/unity/Assets/Tests/EditMode/AdvisorOpeningParityTests.cs.meta b/unity/Assets/Tests/EditMode/AdvisorOpeningParityTests.cs.metanew file mode 100644index 000000000..02cac4b97--- /dev/null+++ b/unity/Assets/Tests/EditMode/AdvisorOpeningParityTests.cs.meta@@ -0,0 +1,2 @@+fileFormatVersion: 2+guid: 77011c189afd4c458f7280d2da75baa7diff --git a/unity/Assets/Tests/EditMode/AdvisorOpeningTests.cs b/unity/Assets/Tests/EditMode/AdvisorOpeningTests.csnew file mode 100644index 000000000..2bef838c2--- /dev/null+++ b/unity/Assets/Tests/EditMode/AdvisorOpeningTests.cs@@ -0,0 +1,176 @@+#nullable enable+using System;+using System.Collections.Generic;+using System.IO;+using System.Linq;+using NUnit.Framework;+using Statecraft.Game;+using Statecraft.Game.UI;+using Statecraft.Sim;+using UnityEditor;+using UnityEngine;+using UnityEngine.UIElements;++/// <summary>Opening-chain core lifecycle (spec 9.2-9.3). Scene and layout parity with the guide is in AdvisorOpeningParityTests.</summary>+public class AdvisorOpeningTests+{+ static readonly Content C = ContentLoader.Load(Paths.Content);+ 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");+ readonly List<string> dirs = new List<string>();+ SettingsStore Store() { var d = Path.Combine(Path.GetTempPath(), "statecraft-opening-" + Guid.NewGuid().ToString("N")); dirs.Add(d); return new SettingsStore(d); }+ [TearDown] public void Clean() { foreach (var d in dirs) if (Directory.Exists(d)) Directory.Delete(d, true); dirs.Clear(); }++ // Approval is simulated ONLY in the test's in-memory copy. Shipped Hebrew stays pending.+ static AdvisorCatalog Pending() => AdvisorCatalog.Parse(File.ReadAllText(AdvisorCatalog.Path).Replace("he_review: approved", "he_review: pending"));+ static AdvisorCatalog Approved() => AdvisorCatalog.Parse(File.ReadAllText(AdvisorCatalog.Path).Replace("he_review: pending", "he_review: approved"));++ sealed class Rig : IDisposable+ {+ public readonly UiTestKit Ui = new UiTestKit();+ public readonly SimBridge Bridge;+ public readonly ScreenNav Nav;+ public readonly EventCardPresenter Card;+ public readonly AdvisorSession Session;+ public readonly AdvisorPresenter Advisor;+ readonly HudPresenter hud;+ public Rig(UiText text, SettingsStore? store, bool approved = false, AdvisorSession? session = null)+ {+ Ui.Root.Q("root").RemoveFromClassList("loading");+ Ui.Root.Q("root").EnableInClassList(UiLanguage.HebrewClass, text["ui.lang"] == UiLanguage.Hebrew);+ Bridge = new SimBridge(GameSession.New(C, GoldenRun.Seed, Mode.Historical), text);+ hud = new HudPresenter(Ui.Root, Bridge, text); Nav = new ScreenNav(Ui.Root);+ Card = new EventCardPresenter(Ui.Root, Bridge, text, null);+ Session = session ?? new AdvisorSession(approved ? Approved() : Pending(), new AdvisorSettings(store), true);+ Advisor = new AdvisorPresenter(Ui.Root, Bridge, text, Session, hooks: new AdvisorHooks { Card = Card, CloseScreens = () => Nav.Close() });+ }+ public void Dispose() { Advisor.Dispose(); Card.Dispose(); Nav.Dispose(); hud.Dispose(); Ui.Dispose(); }+ }++ [Test]+ public void HasSevenStepsInOrder()+ {+ CollectionAssert.AreEqual(new[] { "opening.greeting", "opening.attention", "opening.city", "opening.training", "opening.move", "opening.event", "opening.objectives" }, AdvisorPresenter.ChainIds(AdvisorCatalog.Load()));+ Assert.AreEqual(5, AdvisorPresenter.EventStep);+ }++ [Test]+ public void ThePendingChainDoesNotOpenInHebrewAndIsNotMarkedSeen()+ {+ using var rig = new Rig(He, Store()); rig.Advisor.NewGame();+ Assert.IsFalse(rig.Advisor.InChain); Assert.IsFalse(rig.Session.Settings.OpeningSeen);+ }++ /// <summary>While every opening line is pending in Hebrew, How to play has no button that would open nothing, and asking+ /// for the chain leaves the screen the player is on open.</summary>+ [Test]+ public void ThePendingChainHasNoReopenButtonInHebrew()+ {+ using (var en = new Rig(En, Store()))+ Assert.AreEqual(DisplayStyle.Flex, en.Ui.Q<Button>("how-to-play-guide").style.display.value, "English: the button shows");+ using var rig = new Rig(He, Store());+ Assert.AreEqual(DisplayStyle.None, rig.Ui.Q<Button>("how-to-play-guide").style.display.value, "Hebrew, all pending: no button");+ rig.Ui.Press("nav-how-to-play");+ rig.Advisor.OpenChain();+ Assert.IsFalse(rig.Advisor.InChain);+ Assert.AreEqual("how-to-play", rig.Nav.Current, "How to play stays open");+ }++ [Test]+ public void ItShowsAutomaticallyOnlyOnceAndNeverWithoutAStore()+ {+ using var rig = new Rig(En, Store()); rig.Advisor.NewGame();+ Assert.IsTrue(rig.Advisor.InChain); Assert.IsTrue(rig.Session.Settings.OpeningSeen);+ rig.Advisor.CloseChain(); rig.Advisor.NewGame(); Assert.IsFalse(rig.Advisor.InChain);+ using var automated = new Rig(En, null); automated.Advisor.NewGame(); Assert.IsFalse(automated.Advisor.InChain);+ }++ /// <summary>The plan's assumption (c): the opening chain is the first game's onboarding, as the guide was, so it ignores+ /// the help level (review of the S2 head).</summary>+ [TestCase("off")] [TestCase("experienced")] [TestCase("warnings")]+ public void AnyHelpLevelGetsTheOpeningChainOnItsFirstGame(string level)+ {+ var store = Store(); store.Write(AdvisorSettings.LevelKey, level);+ using var rig = new Rig(En, store); rig.Advisor.NewGame();+ Assert.IsTrue(rig.Advisor.InChain, "the first new game shows the chain at " + level);+ Assert.IsTrue(rig.Session.Settings.OpeningSeen);+ }++ [Test]+ public void TheOldGuidesSeenMarkPreventsAnAutomaticChain()+ {+ var store = Store(); store.Write(AdvisorSettings.GuideSeenKey, "seen");+ using var rig = new Rig(En, store); rig.Advisor.NewGame(); Assert.IsFalse(rig.Advisor.InChain);+ rig.Advisor.OpenChain(); Assert.IsTrue(rig.Advisor.InChain, "manual reopen remains available");+ }++ [TestCase(false)] [TestCase(true)]+ public void EveryStepCanBeSkippedAndTheChainReopened(bool hebrew)+ {+ using var rig = new Rig(hebrew ? He : En, Store(), approved: true);+ for (int step = 0; step < 7; step++)+ {+ rig.Advisor.OpenChain(); for (int i = 0; i < step; i++) rig.Advisor.NextStep();+ Assert.AreEqual(step, rig.Advisor.ChainStep); Assert.IsTrue(rig.Card.Collapsed);+ rig.Ui.Press("advisor-close"); Assert.IsFalse(rig.Advisor.InChain);+ Assert.IsFalse(rig.Card.Collapsed, "restore the opening card");+ }+ }++ [Test]+ public void DuplicateNewGameNotificationsDoNotResetTheOpenChain()+ {+ using var rig = new Rig(En, Store()); rig.Advisor.NewGame(); rig.Advisor.NextStep(); rig.Advisor.NextStep();+ rig.Advisor.NewGame(); Assert.AreEqual(2, rig.Advisor.ChainStep, "the same session, not another new game");+ rig.Bridge.Replace(GameSession.New(C, GoldenRun.Seed, Mode.Historical)); rig.Advisor.NewGame();+ Assert.IsFalse(rig.Advisor.InChain, "a genuinely new session resets the old chain; its profile has seen it");+ }++ [Test]+ public void HowToPlaysButtonOpensTheChainAgain()+ {+ using var rig = new Rig(En, Store()); rig.Ui.Press("nav-how-to-play"); rig.Ui.Press("how-to-play-guide");+ Assert.IsTrue(rig.Advisor.InChain); Assert.AreEqual(0, rig.Advisor.ChainStep); Assert.IsNull(rig.Nav.Current);+ Assert.AreEqual("Show the opening advice again", rig.Ui.Q<Button>("how-to-play-guide").text);+ }++ [Test]+ public void WithNoCardTheEventStepIsLeftOut()+ {+ using var rig = new Rig(En, Store()); UiTestKit.Press(rig.Ui.Root.Q("event-options").Query<Button>().First());+ Assert.IsNull(rig.Card.Shown); rig.Advisor.OpenChain(); var seen = new List<string>();+ while (rig.Advisor.InChain) { seen.Add(rig.Advisor.Shown!.Id); Assert.LessOrEqual(seen.Count, 6); rig.Advisor.NextStep(); }+ CollectionAssert.AreEqual(new[] { "opening.greeting", "opening.attention", "opening.city", "opening.training", "opening.move", "opening.objectives" }, seen);+ }++ [Test]+ public void TheEventStepSpeaksBeforeTheCardAndStepsAside()+ {+ using var rig = new Rig(En, Store()); rig.Advisor.OpenChain();+ for (int i = 0; i < AdvisorPresenter.EventStep; i++) rig.Advisor.NextStep();+ Assert.IsTrue(rig.Card.Collapsed); Assert.AreEqual(5, rig.Advisor.ChainStep);+ Assert.AreEqual(AdvisorTargets.DecisionWaiting, rig.Advisor.Shown!.Actions.First(a => a.ShowMe != "").ShowMe, "(1) the ring's target: Decision waiting");+ Assert.IsTrue(rig.Ui.Root.Q("root").ClassListContains(AdvisorPresenter.RingClass), "(1) the ring shows");+ rig.Ui.Press("advisor-show-me"); Assert.IsFalse(rig.Card.Collapsed); Assert.IsFalse(rig.Advisor.IsOpen);+ rig.Card.Collapse(); Assert.IsTrue(rig.Advisor.IsOpen); Assert.AreEqual(5, rig.Advisor.ChainStep);+ rig.Ui.Press("advisor-show-me"); UiTestKit.Press(rig.Ui.Root.Q("event-options").Query<Button>().First());+ Assert.IsNull(rig.Card.Shown); Assert.AreEqual("opening.objectives", rig.Advisor.Shown!.Id); Assert.IsTrue(rig.Advisor.IsOpen);+ }++ [Test]+ public void ARebuiltPresenterKeepsTheStepAndHidesPendingHebrew()+ {+ var store = Store(); AdvisorSession session;+ using (var en = new Rig(En, store)) { en.Advisor.NewGame(); en.Advisor.NextStep(); en.Advisor.NextStep(); session = en.Session; Assert.AreEqual(2, session.Chain.Step); }+ using (var he = new Rig(He, store, session: session)) { Assert.IsFalse(he.Advisor.IsOpen); Assert.AreEqual(2, session.Chain.Step); }+ using var back = new Rig(En, store, session: session); Assert.IsTrue(back.Advisor.InChain); Assert.AreEqual(2, back.Advisor.ChainStep);+ }++ [Test]+ public void ClosingAndWalkingTheChainChangeNeitherTheSimNorItsSave()+ {+ using var rig = new Rig(En, Store()); var state = rig.Bridge.State.Hash(); var save = rig.Bridge.Session.Save.Write();+ rig.Advisor.OpenChain(); for (int i = 0; i < 7; i++) rig.Advisor.NextStep();+ Assert.IsFalse(rig.Advisor.InChain); Assert.AreEqual(state, rig.Bridge.State.Hash()); Assert.AreEqual(save, rig.Bridge.Session.Save.Write()); Assert.IsEmpty(rig.Bridge.Queued);+ }+}diff --git a/unity/Assets/Tests/EditMode/AdvisorOpeningTests.cs.meta b/unity/Assets/Tests/EditMode/AdvisorOpeningTests.cs.metanew file mode 100644index 000000000..eab0122f1--- /dev/null+++ b/unity/Assets/Tests/EditMode/AdvisorOpeningTests.cs.meta@@ -0,0 +1,2 @@+fileFormatVersion: 2+guid: 630ae558699941dfb76b79eb90090880diff --git a/unity/Assets/Tests/EditMode/AdvisorShowMeTests.cs b/unity/Assets/Tests/EditMode/AdvisorShowMeTests.csnew file mode 100644index 000000000..13770f9b2--- /dev/null+++ b/unity/Assets/Tests/EditMode/AdvisorShowMeTests.cs@@ -0,0 +1,82 @@+#nullable enable+using System.Collections;+using System.Collections.Generic;+using System.Linq;+using NUnit.Framework;+using Statecraft.Game.UI;+using UnityEngine;+using UnityEngine.TestTools;+using UnityEngine.UIElements;++/// <summary>Spec 7.3: Show me draws the gold ring round the named part of the real HUD, shows a unit or a city as a click+/// would and puts the selection back after, moves the popup off its target, and never carries out the advised action.</summary>+public class AdvisorShowMeTests+{+ const string Catalog = "advisors:\n - { id: ben_gurion, person: ben_gurion }\n - { id: meyerson, person: golda_meir }\n - { id: dayan, person: dayan }\n" ++ "messages:\n" ++ " - { id: t.att, advisor: ben_gurion, signal: new_game, level: new, actions: [{ show_me: attention }] }\n" ++ " - { id: t.city, advisor: meyerson, signal: turn_ended, level: new, actions: [{ show_me: city_housing }] }\n";++ static UiText Text() => UiText.Parse(UnityEditor.AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.Strings).text ++ "\nadvisor.t.att.text: \"Attention.\"\nadvisor.t.city.text: \"A city.\"\n");++ /// <summary>Find returns only what is shown with a size, so the HUD is laid out first (the layout harness).</summary>+ [UnityTest]+ public IEnumerator EveryNameIsKnownAndEverySideMenuButtonHasOne()+ {+ foreach (var s in ScreenNav.Screens) CollectionAssert.Contains(AdvisorTargets.Names, AdvisorTargets.Nav(s));+ yield return AdvisorPopupLayoutTests.Shown(1280, 720, false, (root, advisor) =>+ {+ foreach (var (name, element) in new[] { ("attention", "attention"), ("nav_objectives", "nav-objectives"), ("nav_budget", "nav-budget") })+ Assert.AreEqual(element, AdvisorTargets.Find(root.Q("root") ?? root, name, null).Single().name, name);+ });+ }++ [Test]+ public void ShowMeOnACityShowsItAndPutsTheSelectionBackWhenDone()+ {+ var calls = new List<string>();+ using var rig = new AdvisorPopupTests.Rig(catalog: Catalog, text: Text(), hooks: new AdvisorHooks+ {+ ShowCity = () => calls.Add("city"), KeepSelection = () => { calls.Add("keep"); return () => calls.Add("back"); },+ });+ rig.Advisor.NewGame(); rig.Ui.Press("advisor-got-it");+ rig.EndTurn();+ Assert.AreEqual("t.city", rig.Advisor.Shown!.Id, "precondition");+ rig.Ui.Press("advisor-show-me");+ CollectionAssert.AreEqual(new[] { "keep", "city" }, calls);+ Assert.IsTrue(rig.HudRoot.ClassListContains(AdvisorPresenter.RingClass));+ rig.Ui.Press("advisor-got-it");+ CollectionAssert.AreEqual(new[] { "keep", "city", "back" }, calls, "Got it puts back what Show me found");+ Assert.IsFalse(rig.HudRoot.ClassListContains(AdvisorPresenter.RingClass));+ }++ /// <summary>Review Focus 5 (desktop half): a target the popup's top would cover sends the popup to its slot's foot.</summary>+ [UnityTest]+ public IEnumerator AShowMeTargetUnderThePopupIsUncovered()+ {+ yield return AdvisorPopupLayoutTests.Shown(1280, 720, false, (root, advisor) =>+ {+ var slot = advisor.Slot();+ var target = new Rect(slot.xMin + 20, slot.yMin + 10, 60, 30); // a map target in the slot's upper part+ var popup = advisor.Place(target)!.Value;+ Assert.IsFalse(popup.Overlaps(target), $"{popup} covers {target}");+ Assert.LessOrEqual(popup.yMax, slot.yMax + 0.5f);+ });+ }++ [UnityTest]+ public IEnumerator TheRingGoesRoundAttentionInsideTheWindow()+ {+ yield return AdvisorPopupLayoutTests.Shown(1280, 720, false, (root, advisor) =>+ {+ advisor.ShowTarget(AdvisorTargets.Attention); // places the ring at once (its style; the layout follows)+ var s = root.Q("advisor-ring").style;+ var ring = new Rect(s.left.value.value, s.top.value.value, s.width.value.value, s.height.value.value);+ var layer = root.Q(AdvisorPresenter.LayerName); var a = root.Q("attention").worldBound;+ var target = Rect.MinMaxRect(layer.WorldToLocal(a.min).x, layer.WorldToLocal(a.min).y, layer.WorldToLocal(a.max).x, layer.WorldToLocal(a.max).y);+ Assert.IsTrue(ring.Contains(target.min) && ring.Contains(target.max), $"{ring} round {target}");+ Assert.IsTrue(new Rect(Vector2.zero, layer.layout.size).Contains(ring.max), "inside the window");+ });+ }+}diff --git a/unity/Assets/Tests/EditMode/AdvisorShowMeTests.cs.meta b/unity/Assets/Tests/EditMode/AdvisorShowMeTests.cs.metanew file mode 100644index 000000000..a27df4270--- /dev/null+++ b/unity/Assets/Tests/EditMode/AdvisorShowMeTests.cs.meta@@ -0,0 +1,2 @@+fileFormatVersion: 2+guid: cf166940f1b945f6a5e74da3df58d9e2diff --git a/unity/Assets/Tests/EditMode/FirstTurnGuideTests.cs.meta b/unity/Assets/Tests/EditMode/FirstTurnGuideTests.cs.metadeleted file mode 100644index 1817eec0c..000000000--- a/unity/Assets/Tests/EditMode/FirstTurnGuideTests.cs.meta+++ /dev/null@@ -1,2 +0,0 @@-fileFormatVersion: 2-guid: ff2faa371b4a844dfb95fd48c2f89012\ No newline at end of filediff --git a/unity/Assets/UI/Game.uxml b/unity/Assets/UI/Game.uxmlindex cf7d5f2dd..91304f522 100644--- a/unity/Assets/UI/Game.uxml+++ b/unity/Assets/UI/Game.uxml@@ -386,7 +386,7 @@<ui:Label name="how-to-play-end-turn" class="how-to-play-line" /><ui:Label name="how-to-play-why" class="how-to-play-line" /></ui:ScrollView>- <!-- Opens the first-turn guide again (#42, FirstTurnGuidePresenter), which closes this screen. -->+ <!-- Opens the advisor opening chain again (#1484, AdvisorPresenter), which closes this screen. --><ui:Button name="how-to-play-guide" class="how-to-play-guide" /><Statecraft.Game.UI.UiFrame /></ui:VisualElement>@@ -452,28 +452,11 @@</ui:VisualElement><Statecraft.Game.UI.UiFrame /></ui:VisualElement>- <!-- The first-turn guide (#42, FirstTurnGuidePresenter): a gold ring round the step's part of the HUD and a short panel- in the other half of the window. It takes no pointer outside the panel, so the HUD stays usable under it. Over the- screens and the decision layer, under the turn report, the outcome clips and the start screen. -->- <ui:VisualElement name="first-turn-guide" class="guide-layer" picking-mode="Ignore">- <ui:VisualElement name="guide-ring" class="guide-ring" picking-mode="Ignore" />- <ui:VisualElement name="guide-dock" class="guide-dock" picking-mode="Ignore">- <ui:VisualElement name="guide-panel" class="panel guide-panel">- <ui:Label name="guide-count" class="muted guide-count" />- <ui:Label name="guide-title" class="title guide-title" />- <ui:Label name="guide-text" class="guide-text" />- <ui:VisualElement class="row guide-actions">- <ui:Button name="guide-skip" />- <ui:Button name="guide-next" class="guide-next" />- </ui:VisualElement>- <Statecraft.Game.UI.UiFrame filigree="true" />- </ui:VisualElement>- </ui:VisualElement>- </ui:VisualElement><!-- The advisors' popup (spec 7.1, AdvisorPresenter): the right column's upper part, or a sheet under the bar on anupright phone, placed in code (AdvisorLayout). Not modal: the layer takes no pointer outside the popup. Ithides under every modal layer (ScreenNav.DisableCovered calls the presenter). --><ui:VisualElement name="advisor-layer" class="advisor-layer" picking-mode="Ignore">+ <ui:VisualElement name="advisor-ring" class="advisor-ring" picking-mode="Ignore" /><ui:VisualElement name="advisor-popup" class="panel advisor-popup"><ui:VisualElement class="row advisor-head"><ui:VisualElement name="advisor-portrait" class="advisor-portrait" />diff --git a/unity/Assets/UI/Statecraft.uss b/unity/Assets/UI/Statecraft.ussindex bed819f6e..8fb07b933 100644--- a/unity/Assets/UI/Statecraft.uss+++ b/unity/Assets/UI/Statecraft.uss@@ -551,32 +551,7 @@ Button.settings-choice-selected { -unity-font-definition: url("project://databas.end-screen-line { white-space: normal; margin-bottom: 6px; }.turn-report-actions { justify-content: flex-end; margin-top: 8px; flex-shrink: 0; }.turn-report-actions > Button { margin-left: 8px; }-/* The first-turn guide (#42, FirstTurnGuidePresenter): shown while the root has guide-open. The layer and the ring take no- pointer; the ring goes round the step's targets (placed in code), the dock holds the panel at the bottom of the window,- or at the top (guide-dock-top) when the targets are in the lower half. */-.guide-layer { display: none; position: absolute; left: 0; top: 0; right: 0; bottom: 0; }-.guide-open .guide-layer { display: flex; }-.guide-ring { position: absolute; border-width: 3px; border-color: var(--gold-light); border-radius: 6px; }-/* Attention sits about 3 px over End Turn in the bar: while the guide shows, more room under it keeps step 1's ring (4 px- round Attention) at least 4 px clear of End Turn's gold border, so the two read as two boxes (review of #1209;- FirstTurnGuideTests). 5 px is what the one-row bar's 70 px holds with End Turn in it; the taller narrow bar takes 8. */-.guide-open #attention { margin-bottom: 5px; }-.guide-open.hud-narrow #attention { margin-bottom: 8px; }-.guide-dock { position: absolute; left: 0; right: 0; bottom: 16px; flex-direction: row; justify-content: center; padding: 0 16px; }-.guide-dock.guide-dock-top { bottom: auto; top: 16px; }-/* Sizes raised for player feedback (21 October 2026, "too small"): the panel scales with the window (0.67 at 1280x720, the- itch embed), so the text is 22 px (about 15 on screen there) and the step count 18 (the owner's 12 px floor); the panel- is wider in step, so a step keeps about its line count (FirstTurnGuideTests.TheGuideReadsAtTheItchEmbedSize). Where the- scale is small (a phone, about 0.49) FirstTurnGuidePresenter raises them to the owner's 12 px floor on screen; its CountPx,- TitlePx, TextPx and ButtonPx mirror these sizes and Button's 19 px. */-.guide-panel { flex-grow: 1; flex-shrink: 1; max-width: 640px; padding: 14px 18px; background-color: var(--navy-solid); border-color: var(--gold); }-.guide-count { font-size: 18px; }-.guide-title { color: var(--gold-light); font-size: 29px; white-space: normal; }-.guide-text { white-space: normal; font-size: 22px; margin: 4px 0 8px 0; }-.guide-actions { justify-content: space-between; }-.guide-actions > Button { min-height: 44px; }-.guide-next, .lang-he .guide-next { min-width: 120px; -unity-text-align: middle-center; }-/* How to play's button that opens the guide again: under the lines, never squeezed by them. */+/* How to play's button that opens the opening advice again: under the lines, never squeezed by them. */.how-to-play-guide { flex-shrink: 0; align-self: flex-start; min-height: 44px; margin-top: 8px; }.lang-he .how-to-play-guide { align-self: flex-end; }/* The advisors' popup (spec 7.1, AdvisorPresenter): placed in code in the free upper part of the right column (AdvisorLayout),@@ -1040,3 +1015,14 @@ Button.settings-choice-selected { -unity-font-definition: url("project://databas.timeline-diverged { border-left-width: 3px; padding-left: 8px; }.lang-he .timeline-diverged { border-left-width: 0; border-right-width: 3px; padding-left: 4px; padding-right: 8px; }#timeline-difference, #timeline-rejoined { color: var(--gold-light); }++/* Show me's gold ring (spec 7.3), round the named part of the HUD; the guide's ring, moved. The layer shows for the ring+ alone too (the encyclopedia's Show me), with the popup hidden. */+.advisor-ring { display: none; position: absolute; border-width: 3px; border-color: var(--gold-light); border-radius: 6px; }+.advisor-ring-open .advisor-layer, .advisor-ring-open .advisor-ring { display: flex; }+.advisor-popup { display: none; }+.advisor-open .advisor-popup { display: flex; }+/* Under Attention's ring, End Turn's border is kept clear of it (AdvisorOpeningParityTests): 5 px in the+ one-row bar, 8 in the narrow one. */+.advisor-ring-open #attention { margin-bottom: 5px; }+.advisor-ring-open.hud-narrow #attention { margin-bottom: 8px; }diff --git a/unity/Assets/UI/strings.en.yaml b/unity/Assets/UI/strings.en.yamlindex 53f0ba1ec..824318896 100644--- a/unity/Assets/UI/strings.en.yaml+++ b/unity/Assets/UI/strings.en.yaml@@ -71,28 +71,8 @@ how_to_play.why: "After a turn, open Why? to see each change and its cause."objectives.title: "Objectives"objectives.done: "Completed on {0}; historically {1}"objectives.open: "Not completed yet; historically {0}"-# How to play's button that opens the first-turn guide again (#42).-how_to_play.guide: "Show the first-turn guide"-# The first-turn guide (#42; Q-ONB-1, owner, 17 October 2026, #784): six steps, each pointing at its part of the HUD-# (FirstTurnGuidePresenter). Like the How to play lines, they describe the sim without balance values. {0} the step, {1} the-# number of steps.-guide.step: "Step {0} of {1}"-guide.next: "Next"-guide.done: "Done"-guide.skip: "Skip the guide"-guide.attention.title: "Attention"-guide.attention.text: "Most orders cost Attention. This shows how much you have left this turn. It refills at the start of each turn, and Attention you leave unspent does not carry over."-guide.city.title: "A city's housing and jobs"-guide.city.text: "Select a city to see its housing and jobs. The + and − buttons set how many people, including craftsmen, work. The order takes effect when you end the turn."-guide.training.title: "Training"-guide.training.text: "At a military camp, train civilians without work as recruits. At a Hakhshara (pioneer training camp), train them as halutzim (pioneers who build settlements). Buttons show cost and training time."-# The move step (#1141, owner, 21 October 2026): the unit card's Move button (unit.order.move, unit.move_pick).-guide.move.title: "Moving a unit"-guide.move.text: "Select one of your units, press Move, and choose a lit hex. The unit moves when you end the turn."-guide.event.title: "An event card"-guide.event.text: "An event card asks for a decision. Answering it costs Attention, and your choice takes effect when you end the turn. A card you leave unanswered goes to the responsible minister."-guide.objectives.title: "Objectives"-guide.objectives.text: "Objectives lists the game's goals, with the date you completed each beside the historical one. Completing one also brings its card."+# How to play's button that opens the advisor opening chain again (#1484).+how_to_play.guide: "Show the opening advice again"# The advisors (spec 3.1 and 7.1; AdvisorPresenter). Their names as the popup shows them: Golda Meyerson's first appearance# in a profile adds "(later Meir)" (owner, 23 October 2026). "Advisor" is a game role, not an office they held.advisor.ben_gurion.name: "David Ben-Gurion"@@ -644,3 +624,19 @@ event.effect.veteran_halutz: "Veteran Halutzim"event.effect.housing_capacity: "housing capacity"event.effect.job_slots: "job slots"event.effect.condition: "housing condition"++# The opening chain (spec 9.2; AdvisorPresenter): game dialogue in each advisor's persona, labelled "Advisor", never a+# quote. Each step is the advisor's recorded line, without balance values. opening.attention and opening.event use the+# copy-fix wording ("next month", "when the month ends") the owner approved in chat on 24 October 2026, 04:14 UTC:+# "Approve all 8".+advisor.opening.greeting.text: "The country has urgent needs and limited means. The decisions are theirs, and the advisers will explain what each choice changes."+advisor.opening.attention.text: "Attention is the capacity for decisions this month. It refills next month, and any amount left now does not carry over."+advisor.opening.city.text: "A city shows its housing, housing condition, jobs, and people. Employment brings in Money, while overcrowding can weaken Social cohesion."+advisor.opening.training.text: "Training uses civilians without work, Money, and time. Halutz and craftsman training supports development; military training also requires Arms."+advisor.opening.move.text: "A unit moves at once, and terrain sets the cost of each hex. A farther destination creates a route that continues on later turns."+advisor.opening.event.text: "An event card presents a decision and shows its effects. A card left unanswered when the month ends goes to the responsible minister."+advisor.opening.objectives.text: "Objectives define the campaign's goals and compare each completion date with its historical date. Completion awards points and opens the objective's event card."+advisor.next: "Next"+advisor.done: "Done"+# {0} the step, {1} the steps in the chain now.+advisor.step: "Step {0} of {1}"diff --git a/unity/Assets/UI/strings.he.yaml b/unity/Assets/UI/strings.he.yamlindex f0205bf7d..8130b065b 100644--- a/unity/Assets/UI/strings.he.yaml+++ b/unity/Assets/UI/strings.he.yaml@@ -63,28 +63,8 @@ how_to_play.why: "אחרי תור, פתחו את המסך למה? כדי לראobjectives.title: "יעדים"objectives.done: "הושלם ב־{0}; בהיסטוריה ב־{1}"objectives.open: "טרם הושלם; בהיסטוריה ב־{0}"-# How to play's button that opens the first-turn guide again (#42). For the native reviewer (#564).-how_to_play.guide: "הצגת המדריך לתור הראשון"-# The first-turn guide (#42): agent-drafted Hebrew, the How to play screen's terms (#1041) and the city panel's (city.*).-# For the native reviewer (#564).-guide.step: "שלב {0} מתוך {1}"-guide.next: "הבא"-guide.done: "סיום"-guide.skip: "דילוג על המדריך"-guide.attention.title: "תשומת לב"-guide.attention.text: "רוב ההוראות עולות תשומת לב. כאן מוצג כמה נשאר לכם בתור הזה. היא מתמלאת מחדש בתחילת כל תור, ותשומת לב שלא ניצלתם אינה עוברת לתור הבא."-guide.city.title: "דיור ומשרות בעיר"-guide.city.text: "בחרו עיר כדי לראות את הדיור והמשרות בה. הכפתורים + ו־− קובעים כמה אנשים עובדים, ובהם בעלי מלאכה. ההוראה מתבצעת בסיום התור."-guide.training.title: "אימון והכשרה"-guide.training.text: "במחנה צבאי אפשר לאמן אזרחים ללא עבודה כמגויסים. בהכשרה (מחנה הכשרה לחלוצים) אפשר להכשיר אותם כחלוצים שבונים יישובים. הכפתורים מציגים עלות ומשך הכשרה."-# The move step (#1141): agent-drafted Hebrew, not yet read by a native speaker, in unit.order.move's, unit.move_pick's-# and unit.move_queued's terms. For the native reviewer (#564).-guide.move.title: "תנועת יחידה"-guide.move.text: "בחרו אחת מהיחידות שלכם, לחצו על תנועה ובחרו משושה מואר. היחידה תנוע בסיום התור."-guide.event.title: "כרטיס אירוע"-guide.event.text: "כרטיס אירוע מבקש מכם החלטה. מענה עליו עולה תשומת לב, והבחירה שלכם נכנסת לתוקף בסיום התור. כרטיס שלא עניתם עליו עובר לשר האחראי."-guide.objectives.title: "יעדים"-guide.objectives.text: "במסך היעדים מופיעים יעדי המשחק ולצד כל אחד התאריך שבו השלמתם אותו לעומת התאריך ההיסטורי. השלמת יעד מביאה גם את הכרטיס שלו."+# How to play's button that opens the advisor opening chain again (#1484). For the native reviewer (#564).+how_to_play.guide: "הצגת עצות הפתיחה שוב"# The advisors (spec 3.1, 14): the names as in people.yaml (name_he) and the spec; "יועצת" for Meyerson, the speaker's own# gender. Agent-drafted. For the native reviewer (#564).advisor.ben_gurion.name: "דוד בן-גוריון"@@ -687,3 +667,16 @@ event.effect.veteran_halutz: "חלוצים ותיקים"event.effect.housing_capacity: "קיבולת דיור"event.effect.job_slots: "מקומות עבודה"event.effect.condition: "מצב הדיור"++# The opening chain (#1484). Agent-drafted; approved by the owner, a native speaker, in chat on 24 October 2026 (about+# 11:42 IDT): "Approved" (he_review: approved in advisor-messages.yaml, spec OQ-4).+advisor.opening.greeting.text: "למדינה צרכים דחופים ואמצעים מוגבלים. ההחלטות בידיכם, והיועצים יסבירו מה כל בחירה משנה."+advisor.opening.attention.text: "תשומת לב היא היכולת לקבל החלטות בחודש הזה. היא מתמלאת מחדש בחודש הבא, ומה שנשאר עכשיו אינו עובר הלאה."+advisor.opening.city.text: "בעיר מוצגים הדיור, מצב הדיור, המשרות והאנשים. תעסוקה מכניסה כסף, ואילו צפיפות יתר עלולה להחליש את הלכידות החברתית."+advisor.opening.training.text: "אימון והכשרה דורשים אזרחים ללא עבודה, כסף וזמן. הכשרת חלוצים ובעלי מלאכה תומכת בפיתוח; אימון צבאי דורש גם נשק."+advisor.opening.move.text: "יחידה נעה מיד, והשטח קובע את העלות של כל משושה. יעד רחוק יותר יוצר מסלול שממשיך בתורות הבאים."+advisor.opening.event.text: "כרטיס אירוע מציג החלטה ואת השפעותיה. כרטיס שלא נענה בסיום החודש עובר לשר האחראי."+advisor.opening.objectives.text: "היעדים מגדירים את מטרות המערכה ומשווים כל תאריך השלמה לתאריך ההיסטורי שלו. השלמה מעניקה נקודות ופותחת את כרטיס האירוע של היעד."+advisor.next: "הבא"+advisor.done: "סיום"+advisor.step: "שלב {0} מתוך {1}"