Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

ui: Civ select-then-click movement (v0.3.0 blocker): selecting a unit lights its reach, left or right click moves it (#1654)

Eyal Golanb331b17ee222
diff --git a/changelog.d/civ-select-move.md b/changelog.d/civ-select-move.md
new file mode 100644
index 000000000..73ee91fd3
--- /dev/null
+++ b/changelog.d/civ-select-move.md
@@ -0,0 +1,6 @@
+### Fixed
+- Selecting one of your units that can still move lights its reach at once, as in Civ: a click on a lit hex moves it
+ there now, a click on a farther hex gives a go-to, and a click on another unit selects that unit. A short right click
+ on a hex gives the same order (even onto another unit's hex); a right drag still pans the map. Before, only the Move
+ button lit the hexes, so a click on the map after selecting a unit dropped it (the owner's v0.3.0 playtest). The
+ empty panel's hint says so in English and draft Hebrew.
diff --git a/unity/Assets/Scripts/Map/CameraController.cs b/unity/Assets/Scripts/Map/CameraController.cs
index d861794a2..dce9e8677 100644
--- a/unity/Assets/Scripts/Map/CameraController.cs
+++ b/unity/Assets/Scripts/Map/CameraController.cs
@@ -77,6 +77,12 @@ namespace Statecraft.Game.Map
/// <summary>The highest the ground (and the frame round the map, which stays below it) reaches in world y: with it,
/// ViewFootprint bounds the near side of the view tightly. ShadowFit.GroundY (the default) means flat ground.</summary>
public float GroundTop = ShadowFit.GroundY;
+ /// <summary>True while the right button's press could still be a right click (MapPointer.RightTapCandidate): its drag
+ /// is held, not panned, until the press leaves the click's slop, and then applied at once. A press is a right click
+ /// (an order, #1654) or a pan, never both. Null: the drag pans at once.</summary>
+ public Func<bool>? HoldsMouseDrag;
+ /// <summary>The same for a one-finger drag and a tap (MapPointer.TouchTapCandidate).</summary>
+ public Func<bool>? HoldsTouchDrag;
CameraRig rig = null!;
InputAction? pan, dragPan, zoom, zoomKeys, orbit;
@@ -97,6 +103,7 @@ namespace Statecraft.Game.Map
void OnDisable() => InputSystem.actions?.FindActionMap("Camera")?.Disable();
bool dragFromUi, dragWasDown;
+ Vector2 heldDrag; // the drag of a press that may still be a click (HoldsMouseDrag, HoldsTouchDrag)
void Update() => Tick(Time.unscaledDeltaTime);
@@ -108,6 +115,7 @@ namespace Statecraft.Game.Map
if (pan == null || dragPan == null || zoom == null || zoomKeys == null || orbit == null) return;
Vector2? pointer = Pointer.current != null ? Pointer.current.position.ReadValue() : (Vector2?)null;
var down = Mouse.current != null && Mouse.current.rightButton.isPressed;
+ var held = down && HoldsMouseDrag?.Invoke() == true;
var drag = dragPan.ReadValue<Vector2>();
var zoomRaw = WheelOr(zoom.ReadValue<float>());
var ts = Touchscreen.current;
@@ -119,6 +127,7 @@ namespace Statecraft.Game.Map
case 1:
drag += a.delta.ReadValue();
down = true;
+ held |= HoldsTouchDrag?.Invoke() == true;
pointer = a.position.ReadValue();
break;
// a pinch zooms by how far the fingers move; the UI check follows the first finger
@@ -128,11 +137,23 @@ namespace Statecraft.Game.Map
break;
}
}
+ drag = HoldDrag(drag, down, held);
var modifier = ModifierHeld(Keyboard.current);
Step(rig, Gather(pan.ReadValue<Vector2>(), drag, zoomRaw, orbit.ReadValue<float>(), down, pointer, zoomKeys.ReadValue<float>(), modifier),
ClampDt(dt), Bounds, Ground, GroundTop);
}
+ /// <summary>This frame's drag, given whether a drag press is <paramref name="down"/> and still <paramref name="held"/>
+ /// (it may yet be a click): nothing while held (kept), the kept drag and this frame's once it is not, and the kept
+ /// drag dropped when the press ends while still held (it was a click).</summary>
+ internal Vector2 HoldDrag(Vector2 drag, bool down, bool held)
+ {
+ if (!down) { heldDrag = Vector2.zero; return drag; }
+ if (held) { heldDrag += drag; return Vector2.zero; }
+ drag += heldDrag; heldDrag = Vector2.zero;
+ return drag;
+ }
+
/// <summary>The first two touches down (2 stands for two or more), or fewer.</summary>
static int FingersDown(Touchscreen ts, out UnityEngine.InputSystem.Controls.TouchControl a,
out UnityEngine.InputSystem.Controls.TouchControl b)
diff --git a/unity/Assets/Scripts/Map/MapPointer.cs b/unity/Assets/Scripts/Map/MapPointer.cs
index a987e470f..2b605da3f 100644
--- a/unity/Assets/Scripts/Map/MapPointer.cs
+++ b/unity/Assets/Scripts/Map/MapPointer.cs
@@ -18,6 +18,11 @@ namespace Statecraft.Game.Map
Vector2 start;
bool down, moved, pinched;
+ /// <summary>True while the press could still end as a tap: it is down, has stayed inside the slop and no second
+ /// finger came. The camera does not pan on such a press (CameraController.HoldsDrag), so a press is either a tap or a
+ /// pan, never both (#1654 review).</summary>
+ public bool TapCandidate => down && !moved && !pinched;
+
/// <summary>One frame of the watched finger: its pressed and released edges, where it is, and whether any
/// other finger is down. The tap's position on a release frame that still qualifies, otherwise null.</summary>
public Vector2? Step(bool pressed, bool released, Vector2 position, bool otherFingerDown)
@@ -34,12 +39,17 @@ namespace Statecraft.Game.Map
/// <summary>Left click on the map (not on the UI) selects the hex under the pointer: a ray from the camera hits the
/// terrain's collider, the hit becomes lon/lat (GeoFrame) and then a hex (HexPicker). On a touchscreen a tap (press and
- /// release inside TapPress.SlopPixels, with no second finger down) does the same, so a one-finger drag pans and a pinch zooms without selecting.</summary>
+ /// release inside TapPress.SlopPixels, with no second finger down) does the same, so a one-finger drag pans and a pinch zooms without selecting.
+ /// A right click (press and release inside the same slop) raises HexOrdered instead, selecting nothing. One TapPress per
+ /// gesture decides both a click and the camera's pan (RightTapCandidate, TouchTapCandidate): the camera pans only once
+ /// the press has left the slop, so a press is a click or a pan, never both (#1654 review).</summary>
public sealed class MapPointer : MonoBehaviour
{
public MapScene? Map;
public Func<Vector2, bool>? IsOverUi;
public event Action<int, int>? HexClicked;
+ /// <summary>A right click on a hex (owner, 25 Oct 2026, "Civ: select, then click": it moves the selected unit there).</summary>
+ public event Action<int, int>? HexOrdered;
/// <summary>The hex a point goes to before the terrain is asked, or null: a city's name pill sends its click to the
/// city's hex (#1063), wherever the land under the pill is.</summary>
public Func<Vector2, (int q, int r)?>? PillHex;
@@ -48,21 +58,52 @@ namespace Statecraft.Game.Map
// queued and evaluated in order in Update: several presses in one slow frame are each checked where they happened,
// never all at the frame's last pointer position (playtest 2, P2-4).
readonly Queue<Vector2> presses = new Queue<Vector2>();
- InputAction? press;
+ // Right clicks, as presses are: the right button's press, every pointer move while it is held and its release are
+ // each stepped at their own event's position, so a drag out and back inside one slow frame is still a drag.
+ readonly Queue<Vector2> rightClicks = new Queue<Vector2>();
+ InputAction? press, rightPress, rightMove;
+
+ TapPress tap, rightTap;
- TapPress tap;
+ /// <summary>True while the right button's press could still end as a right click (TapPress.TapCandidate): the
+ /// camera holds its right-drag pan until it is false.</summary>
+ public bool RightTapCandidate => rightTap.TapCandidate;
+ /// <summary>True while the primary finger's press could still end as a tap: the camera holds its one-finger pan.</summary>
+ public bool TouchTapCandidate => tap.TapCandidate;
void OnEnable()
{
press = new InputAction("map-press", InputActionType.Button, "<Mouse>/leftButton");
press.performed += OnPressed;
press.Enable();
+ rightPress = new InputAction("map-right-press", InputActionType.Button, "<Mouse>/rightButton");
+ rightPress.performed += OnRightPressed;
+ rightPress.canceled += OnRightReleased;
+ rightPress.Enable();
+ rightMove = new InputAction("map-right-move", InputActionType.PassThrough, "<Mouse>/position");
+ rightMove.performed += OnRightMoved;
+ rightMove.Enable();
}
void OnDisable()
{
if (press != null) { press.performed -= OnPressed; press.Dispose(); press = null; }
- presses.Clear();
+ if (rightPress != null) { rightPress.performed -= OnRightPressed; rightPress.canceled -= OnRightReleased; rightPress.Dispose(); rightPress = null; }
+ if (rightMove != null) { rightMove.performed -= OnRightMoved; rightMove.Dispose(); rightMove = null; }
+ presses.Clear(); rightClicks.Clear();
+ rightTap = default;
+ }
+
+ void OnRightPressed(InputAction.CallbackContext ctx)
+ {
+ if (ctx.control.device is Pointer p) RightStep(true, false, p.position.ReadValue());
+ }
+
+ void OnRightMoved(InputAction.CallbackContext ctx) => RightStep(false, false, ctx.ReadValue<Vector2>());
+
+ void OnRightReleased(InputAction.CallbackContext ctx)
+ {
+ if (ctx.control.device is Pointer p) RightStep(false, true, p.position.ReadValue());
}
void OnPressed(InputAction.CallbackContext ctx)
@@ -77,6 +118,7 @@ namespace Statecraft.Game.Map
internal void ProcessPresses()
{
while (presses.Count > 0) HandleClick(presses.Dequeue());
+ while (rightClicks.Count > 0) HandleRightClick(rightClicks.Dequeue());
}
void Update()
@@ -106,6 +148,25 @@ namespace Statecraft.Game.Map
return true;
}
+ /// <summary>One right-button event: its press, a pointer move or its release, at the event's own position. A release
+ /// with the press never past TapPress.SlopPixels queues a right click where it was pressed (handled in Update, as
+ /// presses are); a press that went farther was the camera's drag pan.</summary>
+ internal void RightStep(bool pressed, bool released, Vector2 position)
+ {
+ if (rightTap.Step(pressed, released, position, false) is Vector2 at) rightClicks.Enqueue(at);
+ }
+
+ /// <summary>A right click at <paramref name="pos"/> (screen pixels): ignored over the UI, otherwise the hex under the
+ /// pointer is raised as HexOrdered (no outline: it selects nothing). Returns whether a hex was raised.</summary>
+ public bool HandleRightClick(Vector2 pos)
+ {
+ var overUi = IsOverUi != null && IsOverUi(pos);
+ Boot.DiagLog.NavLine(FormattableString.Invariant($"map right click at ({pos.x:0}, {pos.y:0}) overUi={overUi}"));
+ if (overUi || HexAt(pos, false, true) is not (int q, int r)) return false;
+ HexOrdered?.Invoke(q, r);
+ return true;
+ }
+
/// <summary>The pick without the UI check: the hex under <paramref name="pos"/> (screen pixels) is outlined and raised
/// as HexClicked, as for a click. The keyboard's map stop (MapFocusPresenter, #41 B1b) picks here at the projected
/// look-at point: that is not a pointer, and on a narrow window the info panel may sit over the centre. Returns
diff --git a/unity/Assets/Scripts/UI/GameRoot.cs b/unity/Assets/Scripts/UI/GameRoot.cs
index 8ccc0a50f..05e6afb27 100644
--- a/unity/Assets/Scripts/UI/GameRoot.cs
+++ b/unity/Assets/Scripts/UI/GameRoot.cs
@@ -411,6 +411,9 @@ namespace Statecraft.Game.UI
Func<Vector2, bool> pointerOverUi = p => outcomes?.HoldsThePointer == true
|| (UiPointer.PickAt(root.panel, p, Screen.height) is { } picked && !info.TakesClickThrough(picked, () => pointer.HexUnder(p)));
pointer.IsOverUi = pointerOverUi;
+ // #1654 review: the pointer's tap rule decides both a click and the camera's drag, so a press is never both.
+ Func<bool> holdsMouseDrag = () => pointer.RightTapCandidate, holdsTouchDrag = () => pointer.TouchTapCandidate;
+ cameraController.HoldsMouseDrag = holdsMouseDrag; cameraController.HoldsTouchDrag = holdsTouchDrag;
Action<int, int> onHex = (q, r) =>
{
OnHexClicked(map, unitLayer, info, q, r, UnityEngine.InputSystem.Pointer.current is UnityEngine.InputSystem.Touchscreen);
@@ -419,6 +422,8 @@ namespace Statecraft.Game.UI
advisor?.Notice(AdvisorSignals.CityShown);
};
pointer.HexClicked += onHex;
+ Action<int, int> onOrder = (q, r) => OnHexOrdered(map, info, q, r);
+ pointer.HexOrdered += onOrder;
// #1063: a click on a city's name pill is a click on the city's hex (its settlement hex, where the city panel opens).
Func<Vector2, (int q, int r)?> pillHex = p =>
{
@@ -477,9 +482,12 @@ namespace Statecraft.Game.UI
bridge.Changed -= onChanged;
bridge.TurnEnded -= onTurn;
pointer.HexClicked -= onHex;
+ pointer.HexOrdered -= onOrder;
if (pointer.PillHex == pillHex) pointer.PillHex = null;
if (pointer.IsOverUi == pointerOverUi) pointer.IsOverUi = null;
if (cameraController.IsOverUi == overUi) cameraController.IsOverUi = null;
+ if (cameraController.HoldsMouseDrag == holdsMouseDrag) cameraController.HoldsMouseDrag = null;
+ if (cameraController.HoldsTouchDrag == holdsTouchDrag) cameraController.HoldsTouchDrag = null;
if (pointer.Map == map) pointer.Map = null;
cameraController.Bounds = oldBounds;
cameraController.Ground = oldGround; cameraController.GroundTop = oldTop;
@@ -626,7 +634,11 @@ namespace Statecraft.Game.UI
/// <summary>A map click: on a unit's hex it selects the unit (the ring and its card; the hex outline is cleared, so
/// the unit has the promo's one highlight); a second click on it, or a click anywhere else, shows the hex (so a token
/// never hides the hex's map actions). While the card's Move or Attack pick is open (#754), a target click gives the
- /// order and keeps the unit's card; any other click ends the pick first and then selects as usual.</summary>
+ /// order and keeps the unit's card; any other click ends the pick first and then selects as usual. A selected unit
+ /// that can move has its Move pick open (InfoPanelPresenter.RenderLines; Civ, owner 25 Oct 2026), so a click on a lit
+ /// hex moves it; a click on another unit's hex or on a city selects that unit or shows the city, as in Civ, lit or
+ /// not (owner, 25 Oct 2026: "Clicking another unit or a city still selects it"; a right click moves there:
+ /// OnHexOrdered).</summary>
internal static void OnHexClicked(MapScene map, Statecraft.Game.Map.Units.UnitLayer units, InfoPanelPresenter info, int q, int r, bool touch = false)
{
if (info.Covered)
@@ -636,13 +648,22 @@ namespace Statecraft.Game.UI
if (info.Selected is (int sq, int sr) && !info.ShowsUnit) map.Select(sq, sr); else map.ClearSelection();
return;
}
- if (info.PickTarget(q, r, touch)) { map.ClearSelection(); return; } // the unit keeps its ring, the one highlight
var id = units.UnitToSelectAt(q, r);
+ if (!(info.MovePicking && (id != null || info.IsCity(q, r))) && info.PickTarget(q, r, touch)) { map.ClearSelection(); return; } // the unit keeps its ring, the one highlight
units.Select(id);
if (id != null) { map.ClearSelection(); info.ShowUnit(); }
else info.Show(q, r);
}
+ /// <summary>A right click on the map (MapPointer.HexOrdered; owner, 25 Oct 2026, "Civ: select, then click"): while the
+ /// shown unit's pick takes (q, r), the order a left click there gives (PickTarget), even on another unit's hex.
+ /// Otherwise nothing: no unit shown, a hex it cannot reach, or a screen over the panel (#210).</summary>
+ internal static void OnHexOrdered(MapScene map, InfoPanelPresenter info, int q, int r)
+ {
+ if (info.Covered || !info.ShowsUnit || !info.PickTakes(q, r)) return;
+ if (info.PickTarget(q, r)) map.ClearSelection();
+ }
+
/// <summary>Selects a drawn unit row, opens its card and centres the camera on its current hex.</summary>
internal void FocusUnit(string rowId)
{
diff --git a/unity/Assets/Scripts/UI/InfoPanelPresenter.cs b/unity/Assets/Scripts/UI/InfoPanelPresenter.cs
index e79171a6e..9367b61e6 100644
--- a/unity/Assets/Scripts/UI/InfoPanelPresenter.cs
+++ b/unity/Assets/Scripts/UI/InfoPanelPresenter.cs
@@ -257,7 +257,8 @@ namespace Statecraft.Game.UI
}
/// <summary>Move's or Attack's button: starts its pick (the sim's hexes lit), or ends it when pressed again; a press
- /// of the other ends the open pick and starts its own.</summary>
+ /// of the other ends the open pick and starts its own. A unit that can move never stays without a pick: RenderLines
+ /// opens Move's again at once (a second press of Move keeps its hexes lit; a second press of Attack goes back to Move).</summary>
void TogglePick(bool attack)
{
var again = pick?.attack == attack;
@@ -373,11 +374,25 @@ namespace Statecraft.Game.UI
for (var e = picked; e != panel; e = e.parent) if (e is Button) return false;
if (!(hexUnder() is { } h)) return false;
if (clickThrough is { } known && known.hex == h) return known.takes;
- var takes = p.hexes.Contains(h) || RouteTo(p, h.q, h.r).Count > 0; // RouteTo: PickTarget's go-to rule
+ var takes = Takes(p, h.q, h.r);
clickThrough = (h, takes);
return takes;
}
+ /// <summary>True when (q, r) is one of a city's settlement hexes (GameRoot.CityAt): a left click there shows the city
+ /// even while Move picks (owner, 25 Oct 2026: "Clicking another unit or a city still selects it").</summary>
+ public bool IsCity(int q, int r) => GameRoot.CityAt(bridge.Content, bridge.State, q, r) != null;
+
+ /// <summary>True while the open pick is a Move's (not an Attack's).</summary>
+ public bool MovePicking => pick is { attack: false };
+
+ /// <summary>True when a pick is open and PickTarget would give an order for (q, r): a lit hex, or, for Move, an unlit
+ /// hex with a go-to route. A right click (GameRoot.OnHexOrdered) gives one only then.</summary>
+ public bool PickTakes(int q, int r) => pick is { } p && Takes(p, q, r);
+
+ bool Takes((int unit, HashSet<(int q, int r)> hexes, GameSession session, int turn, bool attack, (int q, int r)? touchRoute) p,
+ int q, int r) => p.hexes.Contains((q, r)) || RouteTo(p, q, r).Count > 0; // RouteTo: PickTarget's go-to rule
+
/// <summary>A map click while the player picks a Move's or an Attack's hex (GameRoot.OnHexClicked asks first): a lit
/// hex gives the Move or attack; an unlit hex with a route gives go-to. Touch previews that route on the first tap and
/// confirms it on a second tap of the same hex. A hex with no target ends the pick and selects as usual.</summary>
@@ -563,6 +578,16 @@ namespace Statecraft.Game.UI
&& (open.session != bridge.Session || open.turn != s.Turn || unit == null || UnitCard.SimUnit(c, s, unit.Value.Token) != open.unit))
EndPick();
var moves = MoveTargets();
+ if (pick is { attack: false } && moves == null) EndPick(); // no Move any more (Send home queued, no points, game over)
+ // Civ (owner, 25 Oct 2026: "the unit must move when you click on the fucking lit hex"; spec 2.1, "Selecting a unit
+ // lights its one-turn reach"): a shown unit that can move has its Move pick open, with no press of Move. Its
+ // button stays (keyboard, the guide); pressing it, or Attack again, comes back here and lights the reach again.
+ if (pick == null && moves is { } armed)
+ {
+ var hexes = armed.hexes.Keys.Select(h => (h.Q, h.R)).ToList();
+ pick = (armed.unit, new HashSet<(int q, int r)>(hexes), bridge.Session, s.Turn, false, null);
+ showReachable?.Invoke(hexes);
+ }
moveButton.style.display = moves != null ? DisplayStyle.Flex : DisplayStyle.None;
// Fortify and Hold (#754): each offered only where the sim's Orders.Check takes it; else the sim's reason, as given,
// on Israel's units only (an enemy's card would only repeat the sim's English "That unit is not yours").
diff --git a/unity/Assets/Tests/EditMode/GameSceneTests.cs b/unity/Assets/Tests/EditMode/GameSceneTests.cs
index 03d765629..eb194c8c3 100644
--- a/unity/Assets/Tests/EditMode/GameSceneTests.cs
+++ b/unity/Assets/Tests/EditMode/GameSceneTests.cs
@@ -403,6 +403,59 @@ public class GameSceneTests
}
}
+ /// <summary>#1654 (owner, 25 Oct 2026, "Civ: select, then click"), through the game's own wiring: selecting Golani lights
+ /// its reach with no Move press, the camera holds its right drag on the pointer's tap rule, and a right click that the
+ /// game's MapPointer raises on a lit hex moves Golani there at once (GameRoot's HexOrdered subscription).</summary>
+ [UnityTest]
+ public IEnumerator ARightClickThroughTheGamesPointerMovesTheSelectedUnit()
+ {
+ EditorSceneManager.OpenScene("Assets/Map.unity", OpenSceneMode.Single);
+ var doc = Object.FindFirstObjectByType<UIDocument>();
+ var cam = Camera.main!;
+ var rt = new RenderTexture(1920, 1080, 0);
+ var camRt = new RenderTexture(1920, 1080, 24);
+ var ps = Object.Instantiate(doc.panelSettings);
+ ps.targetTexture = rt;
+ try
+ {
+ doc.panelSettings = ps;
+ cam.targetTexture = camRt;
+ var map = Object.FindFirstObjectByType<MapScene>();
+ map.Build(Inputs.Map);
+ var root = Object.FindFirstObjectByType<GameRoot>();
+ root.Store = new SaveStore(saveDir);
+ root.Begin(Inputs, 0);
+ var ui = doc.rootVisualElement;
+ HideTheOpeningCard(ui);
+ yield return null;
+ var bridge = root.Bridge!; var c = bridge.Content;
+ var layer = root.Units!;
+ var golani = layer.Tokens.Single(p => p.Token.Unit.Id == "golani");
+ var id = UnitCard.SimUnit(c, bridge.State, golani.Token.Unit)!.Value;
+ GameRoot.OnHexClicked(map, layer, root.Info!, golani.Q, golani.R);
+ Assert.IsTrue(root.Info!.MovePicking, "selecting Golani opened its Move pick");
+ int Room((int q, int r) h) => bridge.State.Units.Values.Select(u => MapActions.Distance(u.Q, u.R, h.q, h.r))
+ .Concat(c.SettlementHexes.Select(x => MapActions.Distance(x.Q, x.R, h.q, h.r))).Min();
+ var lit = Movement.Reachable(c, bridge.State, id).Keys.Select(k => (k.Q, k.R)).OrderByDescending(Room).First();
+ Assert.GreaterOrEqual(Room(lit), 1, "precondition: no unit or settlement on the lit hex");
+ var pointer = Object.FindFirstObjectByType<MapPointer>();
+ var camera = cam.GetComponent<CameraController>();
+ Assert.IsNotNull(camera.HoldsMouseDrag, "the camera holds its right drag on the pointer's tap rule");
+ Assert.IsNotNull(camera.HoldsTouchDrag, "and its one-finger drag");
+ var probe = AimAt(lit.Item1, lit.Item2);
+ Assert.IsTrue(pointer.HandleRightClick(probe), "the right click picks the lit hex");
+ Assert.AreEqual(lit, (bridge.State.Units[id].Q, bridge.State.Units[id].R), "the right click moved Golani at once");
+ Assert.IsTrue(root.Info.ShowsUnit, "Golani's card stays");
+ }
+ finally
+ {
+ EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Single);
+ if (ps != null) Object.DestroyImmediate(ps);
+ if (rt != null) { rt.Release(); Object.DestroyImmediate(rt); }
+ if (camRt != null) { camRt.Release(); Object.DestroyImmediate(camRt); }
+ }
+ }
+
/// <summary>Since the GDD cutover the game opens on its first card, One Army (idf_founding, window from 15 May 1948 per
/// #567: the order it asks about was signed on 26 May, before the next monthly turn), and its photograph covers the map. A
/// player hides it to use the map; so do these tests.</summary>
diff --git a/unity/Assets/Tests/EditMode/InfoPanelLayoutTests.cs b/unity/Assets/Tests/EditMode/InfoPanelLayoutTests.cs
index 03d49b064..22bee8ff1 100644
--- a/unity/Assets/Tests/EditMode/InfoPanelLayoutTests.cs
+++ b/unity/Assets/Tests/EditMode/InfoPanelLayoutTests.cs
@@ -201,7 +201,7 @@ public class InfoPanelLayoutTests
}
/// <summary>GDD Phase 5 PR 15, slices 1 to 3 (#754): Golani's card at the start with its Move, Fortify and Hold buttons,
- /// as it is, picking a Move's hex (the pick line under the card's lines), with Fortify queued (its line), after the
+ /// as it is, picking a Move's hex (the pick line under the card's lines, there from the selection too), with Fortify queued (its line), after the
/// armistices with Send home offered (#1309: its button) and queued (its line, and no other order: #1527's follow-up), on the turn
/// after a Hold (Hold refused, with the sim's reason), and picking an Attack's hex (an enemy put in its reach if none is) (the
/// pick line, the enemy's name, strength ratio and outcome bands), at every window size in English and Hebrew: the panel lies in the
@@ -237,8 +237,10 @@ public class InfoPanelLayoutTests
if (Shown(move) == goingHome) { problems.Add($"{at}: precondition: the Move button shows unless the unit is going home"); return; }
if (Shown(root.Q<Button>("info-send-home")) != (state == "armistice")) problems.Add($"{at}: Send home visibility");
var lines = root.Q<Label>("info-settlements").text;
- foreach (var (key, when) in new[] { ("unit.move_pick", "info-move"), ("unit.fortify_queued", "info-fortify"), ("unit.send_home_queued", "info-send-home"), ("unit.attack_pick", "info-attack") })
- if (lines.Contains((hebrew ? he : Text)[key]) != (state == when)) problems.Add($"{at}: {key} shows: {state != when}");
+ // A unit that can move has its Move pick open from the selection (owner, 25 Oct 2026): its line shows in
+ // every state but going home (no Move) and an Attack's pick.
+ foreach (var (key, shows) in new[] { ("unit.move_pick", !goingHome && state != "info-attack"), ("unit.fortify_queued", state == "info-fortify"), ("unit.send_home_queued", goingHome), ("unit.attack_pick", state == "info-attack") })
+ if (lines.Contains((hebrew ? he : Text)[key]) != shows) problems.Add($"{at}: {key} shows: {!shows}");
if (Shown(root.Q<Button>("info-hold")) == (state == "holding" || goingHome)) problems.Add($"{at}: precondition: Hold shows only while it is not held and the unit is not going home");
if (!Inside(panel.worldBound, window)) problems.Add($"{at}: the panel {panel.worldBound} leaves the window {window}");
foreach (var l in panel.Query<TextElement>().ToList().Where(l => !string.IsNullOrEmpty(l.text) && Shown(l)))
diff --git a/unity/Assets/Tests/EditMode/MapPressTests.cs b/unity/Assets/Tests/EditMode/MapPressTests.cs
index f13b034e7..b1aa04a54 100644
--- a/unity/Assets/Tests/EditMode/MapPressTests.cs
+++ b/unity/Assets/Tests/EditMode/MapPressTests.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using NUnit.Framework;
using Statecraft.Game.Map;
using UnityEngine;
+using UnityEditor;
using UnityEngine.InputSystem;
/// <summary>Playtest 2, P2-4: map clicks under same-frame input.</summary>
@@ -68,3 +69,117 @@ public class MapPressTests
Assert.AreEqual((Vector2?)new Vector2(300, 300), tap.Step(false, true, new Vector2(300, 300), false));
}
}
+
+/// <summary>#1654 review (blocker): a right press is a right click (an order) or the camera's drag pan, never both. Real
+/// mouse events go through the Input System test fixture into MapPointer (its own right-button actions) and the project's
+/// Camera actions into CameraController.Tick, wired as GameRoot wires them (HoldsMouseDrag = RightTapCandidate). The UI
+/// recorder stands in for the map: HandleRightClick asks it once per right click. Edit mode sends no OnEnable, so the
+/// test sends it.</summary>
+public class RightClickOrPanTests : InputTestFixture
+{
+ static void Send(Object o, string message) =>
+ o.GetType().GetMethod(message, System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)!.Invoke(o, null);
+
+ sealed class Rig : System.IDisposable
+ {
+ public readonly GameObject Go;
+ public readonly CameraRig View;
+ public readonly CameraController Controller;
+ public readonly MapPointer Pointer;
+ public readonly List<Vector2> Clicks = new List<Vector2>();
+ public Rig()
+ {
+ Go = new GameObject("RightClickOrPan", typeof(UnityEngine.Camera));
+ View = Go.AddComponent<CameraRig>();
+ View.LookAt = new Vector3(500000, 0, 500000); View.Distance = 100000f;
+ Controller = Go.AddComponent<CameraController>();
+ Controller.Bounds = new Rect(0, 0, 1000000, 1000000); // far larger than the view: no view clamp here
+ Pointer = Go.AddComponent<MapPointer>();
+ var clicks = Clicks;
+ Pointer.IsOverUi = p => { clicks.Add(p); return true; }; // asked once per right click; true: no map needed
+ var pointer = Pointer;
+ Controller.HoldsMouseDrag = () => pointer.RightTapCandidate; // as GameRoot wires it
+ Send(Controller, "Awake"); Send(Controller, "OnEnable"); Send(Pointer, "OnEnable");
+ }
+ public void Frame() { Controller.Tick(0.016f); Pointer.ProcessPresses(); }
+ public void Dispose() { Send(Pointer, "OnDisable"); Send(Controller, "OnDisable"); Object.DestroyImmediate(Go); }
+ }
+
+ Mouse mouse = null!;
+
+ [SetUp]
+ public void Devices()
+ {
+ InputSystem.actions = AssetDatabase.LoadAssetAtPath<InputActionAsset>("Assets/InputSystem_Actions.inputactions");
+ mouse = InputSystem.AddDevice<Mouse>();
+ }
+
+ /// <summary>Drags the right button from <paramref name="from"/> through <paramref name="path"/> (one frame a step) and
+ /// releases it at the last point. Returns where the look-at point was while the button was still held.</summary>
+ Vector3 Drag(Rig rig, Vector2 from, params Vector2[] path)
+ {
+ Set(mouse.position, from);
+ rig.Frame();
+ Press(mouse.rightButton);
+ rig.Frame();
+ var at = from;
+ foreach (var p in path) { Move(mouse.position, p, p - at); at = p; rig.Frame(); }
+ var held = rig.View.LookAt;
+ Release(mouse.rightButton);
+ rig.Frame();
+ return held;
+ }
+
+ [Test]
+ public void AShortRightDragIsAClickAndNeverPans()
+ {
+ using var rig = new Rig();
+ var start = rig.View.LookAt;
+ var from = new Vector2(700, 400);
+ Drag(rig, from, from + new Vector2(10, 0), from + new Vector2(20, 0));
+ Assert.AreEqual(start, rig.View.LookAt, "a 20 px right drag does not pan");
+ CollectionAssert.AreEqual(new[] { from }, rig.Clicks, "it is one right click, where it was pressed");
+ }
+
+ [Test]
+ public void ARightDragAtTheSlopIsStillAClickAndOnePastItOnlyPans()
+ {
+ using var rig = new Rig();
+ var start = rig.View.LookAt;
+ var from = new Vector2(700, 400);
+ Drag(rig, from, from + new Vector2(TapPress.SlopPixels, 0));
+ Assert.AreEqual(start, rig.View.LookAt, "at the slop: no pan");
+ CollectionAssert.AreEqual(new[] { from }, rig.Clicks, "at the slop: a click");
+ rig.Clicks.Clear();
+ var held = Drag(rig, from, from + new Vector2(TapPress.SlopPixels + 1, 0));
+ Assert.AreNotEqual(start, held, "past the slop: the camera pans");
+ Assert.IsEmpty(rig.Clicks, "past the slop: no click");
+ }
+
+ [Test]
+ public void ARightDragOutAndBackPansAndIsNoClick()
+ {
+ using var rig = new Rig();
+ var start = rig.View.LookAt;
+ var from = new Vector2(700, 400);
+ var held = Drag(rig, from, from + new Vector2(100, 0), from + new Vector2(1, 0));
+ Assert.AreNotEqual(start, held, "the drag panned");
+ Assert.IsEmpty(rig.Clicks, "coming back does not make it a click");
+ }
+
+ [Test]
+ public void ARightDragOutAndBackInsideOneFrameIsNoClick()
+ {
+ using var rig = new Rig();
+ var from = new Vector2(700, 400);
+ Set(mouse.position, from);
+ rig.Frame();
+ // one slow frame: press, out past the slop, back and release, all before the next Update
+ Press(mouse.rightButton);
+ Move(mouse.position, from + new Vector2(200, 0));
+ Move(mouse.position, from);
+ Release(mouse.rightButton);
+ rig.Frame();
+ Assert.IsEmpty(rig.Clicks, "each event is stepped at its own position: the excursion makes it a drag");
+ }
+}
diff --git a/unity/Assets/Tests/EditMode/SelectThenClickMoveTests.cs b/unity/Assets/Tests/EditMode/SelectThenClickMoveTests.cs
new file mode 100644
index 000000000..9a5c585e7
--- /dev/null
+++ b/unity/Assets/Tests/EditMode/SelectThenClickMoveTests.cs
@@ -0,0 +1,332 @@
+#nullable enable
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using NUnit.Framework;
+using Statecraft.Game;
+using Statecraft.Game.Map;
+using Statecraft.Game.Map.Units;
+using Statecraft.Game.UI;
+using Statecraft.Sim;
+using UnityEditor;
+using UnityEditor.SceneManagement;
+using UnityEngine;
+using UnityEngine.UIElements;
+
+/// <summary>The owner, playing on 25 October 2026: "i still can't move a fucking unit", "the unit must move when you click on
+/// the fucking lit hex" and "not wait for the end of the fucking turn"; asked how, "Civ: select, then click (Recommended)".
+/// Selecting a unit that can move lights its reach at once (spec 2.1, "Selecting a unit lights its one-turn reach"), with no
+/// press of Move: a left click (or a tap) on a lit hex moves it now, on a farther hex gives a go-to, on another unit's hex
+/// selects that unit, and on a hex it cannot reach selects that hex as before. A short right click gives the left click's
+/// order (even on another unit's hex), and nothing else; a right drag stays the camera's pan.</summary>
+public class SelectThenClickMoveTests
+{
+ static readonly Content C = ContentLoader.Load(Paths.Content);
+ static List<UnitEntry> Units => UnitData.Parse(File.ReadAllText(Path.Combine(Paths.Content, "map", UnitData.DefaultFileName)));
+ static UiText Text => UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.Strings).text);
+
+ sealed class Rig : System.IDisposable
+ {
+ public readonly MapScene Map;
+ public readonly UiTestKit Ui;
+ public readonly SimBridge Bridge;
+ public readonly UnitLayer Layer;
+ public readonly InfoPanelPresenter Info;
+ public readonly List<IReadOnlyCollection<(int q, int r)>> Lit = new List<IReadOnlyCollection<(int q, int r)>>();
+
+ public Rig()
+ {
+ EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects, NewSceneMode.Single);
+ Map = new GameObject("MapScene").AddComponent<MapScene>();
+ Map.Configure(Load("Terrain"), Load("SettlementMarker"), Load("HexSelection"), Load("Sea"), Load("MapFrame"));
+ Map.Build();
+ Ui = new UiTestKit(); // after the new scene, which would take the UI document with it
+ Bridge = new SimBridge(GameSession.New(C, GoldenRun.Seed, Mode.Historical), Text);
+ Layer = UnitLayer.Create(Map, Units, C.Hexes, still: true);
+ Layer.Show(Bridge.Content, Bridge.State);
+ var layer = Layer; var map = Map; var lit = Lit;
+ Info = new InfoPanelPresenter(Ui.Root, Bridge, Text, C.SettlementNames,
+ selectedUnit: () => layer.Selected is string sel ? layer.Tokens.First(p => p.Token.Unit.Id == sel) : (PlacedToken?)null,
+ showReachable: hexes => { lit.Add(hexes.ToList()); map.ShowReachable(hexes); }, showRoute: map.ShowRoute,
+ clearSelection: () => { layer.Select(null); map.ClearSelection(); });
+ }
+
+ public PlacedToken Token(string row) => Layer.Tokens.Single(p => p.Token.Unit.Id == row);
+ public int Id(PlacedToken t) => UnitCard.SimUnit(C, Bridge.State, t.Token.Unit)!.Value;
+ public List<(int q, int r)> Reach(int id) => Movement.Reachable(C, Bridge.State, id, Bridge.Spent).Keys.Select(h => (h.Q, h.R)).ToList();
+ public (int q, int r) At(int id) => (Bridge.State.Units[id].Q, Bridge.State.Units[id].R);
+ public void Click(int q, int r, bool touch = false) => GameRoot.OnHexClicked(Map, Layer, Info, q, r, touch);
+ public void Select(PlacedToken t) => Click(t.Q, t.R);
+
+ public void Dispose()
+ {
+ Info.Dispose();
+ Ui.Dispose();
+ Object.DestroyImmediate(Map.gameObject);
+ }
+
+ static Material Load(string name) => AssetDatabase.LoadAssetAtPath<Material>($"Assets/Materials/{name}.mat");
+ }
+
+ /// <summary>A click on the unit lights Movement.Reachable's hexes at once, with no press of Move, and the card says to
+ /// choose one; a click on a lit hex then moves the unit at once (no End turn), and its remaining reach lights again.</summary>
+ [Test]
+ public void SelectingAUnitLightsItsReachAndALeftClickOnALitHexMovesItAtOnce()
+ {
+ using var rig = new Rig();
+ var golani = rig.Token("golani"); var id = rig.Id(golani);
+ var reach = rig.Reach(id);
+ Assert.IsNotEmpty(reach, "precondition: Golani can move");
+ rig.Select(golani);
+ Assert.IsTrue(rig.Info.ShowsUnit);
+ CollectionAssert.AreEqual(reach, rig.Lit.Last(), "the reach lights on selection, no Move press");
+ Assert.IsTrue(rig.Info.MovePicking);
+ StringAssert.Contains(Text["unit.move_pick"], rig.Ui.Q<Label>("info-settlements").text);
+ var turn = rig.Bridge.State.Turn;
+ var to = reach.First(h => rig.Layer.UnitToSelectAt(h.q, h.r) == null);
+ rig.Click(to.q, to.r);
+ Assert.AreEqual(to, rig.At(id), "the unit moved at once");
+ Assert.AreEqual(turn, rig.Bridge.State.Turn, "no End turn");
+ Assert.AreEqual("golani", rig.Layer.Selected, "the unit stays selected");
+ if (Movement.PointsLeft(C, rig.Bridge.State, id, rig.Bridge.Spent) > 0 && rig.Reach(id).Count > 0)
+ CollectionAssert.AreEquivalent(rig.Reach(id), rig.Lit.Last(), "the points left light again");
+ }
+
+ /// <summary>A left click on an unlit land hex with a route gives the go-to, with no press of Move.</summary>
+ [Test]
+ public void ALeftClickOnAFarHexGivesAGoTo()
+ {
+ using var rig = new Rig();
+ var golani = rig.Token("golani"); var id = rig.Id(golani);
+ var lit = rig.Reach(id).ToHashSet();
+ var far = C.Hexes.Where(h => h.Land && !lit.Contains((h.Q, h.R)) && (h.Q, h.R) != (golani.Q, golani.R))
+ .Select(h => (h.Q, h.R)).First(h => rig.Layer.UnitToSelectAt(h.Q, h.R) == null
+ && Movement.Route(C, rig.Bridge.State, id, h.Q, h.R, new Dictionary<int, int>()).LastOrDefault().Turn == 2);
+ rig.Select(golani);
+ rig.Click(far.Q, far.R);
+ Assert.AreEqual((Movement.GoTo, $"{far.Q},{far.R}"), (rig.Bridge.State.Units[id].Order, rig.Bridge.State.Units[id].OrderTarget));
+ }
+
+ /// <summary>A left click on a hex the unit cannot reach (the sea: no move, no route) gives no order and selects that hex,
+ /// as before; the lit hexes go away.</summary>
+ [Test]
+ public void ALeftClickOnAnUnreachableHexSelectsThatHex()
+ {
+ using var rig = new Rig();
+ var golani = rig.Token("golani");
+ var sea = C.Hexes.First(h => !h.Land);
+ rig.Select(golani);
+ rig.Click(sea.Q, sea.R);
+ Assert.IsEmpty(rig.Bridge.Session.Committed);
+ Assert.IsEmpty(rig.Bridge.Queued);
+ Assert.IsFalse(rig.Info.ShowsUnit);
+ Assert.AreEqual((sea.Q, sea.R), rig.Info.Selected);
+ Assert.IsEmpty(rig.Lit.Last());
+ }
+
+ /// <summary>A unit of Israel's that stands on another one's lit hex: a left click there selects it (Civ) and gives no
+ /// order; a right click there moves the first unit onto it.</summary>
+ [Test]
+ public void ALeftClickOnAnotherUnitSelectsItAndARightClickMovesOntoIt()
+ {
+ using var rig = new Rig();
+ var own = rig.Layer.Tokens.Where(t => t.Token.Unit.Side == UnitData.Israel && UnitCard.SimUnit(C, rig.Bridge.State, t.Token.Unit) != null).ToList();
+ var pair = (from a in own from b in own
+ where a.Token.Unit.Id != b.Token.Unit.Id && (a.Q, a.R) != (b.Q, b.R)
+ && rig.Layer.At(b.Q, b.R)?.Token.Unit.Id == b.Token.Unit.Id && rig.Reach(rig.Id(a)).Contains((b.Q, b.R))
+ select (a, b)).FirstOrDefault();
+ Assert.IsNotNull(pair.a, "precondition: one unit of Israel's has another's hex in its reach");
+ var (mover, other) = pair;
+ var id = rig.Id(mover);
+ rig.Select(mover);
+ rig.Click(other.Q, other.R);
+ Assert.IsEmpty(rig.Bridge.Session.Committed, "a left click on another unit gives no order");
+ Assert.AreEqual(other.Token.Unit.Id, rig.Layer.Selected, "it selects that unit");
+ rig.Select(mover);
+ GameRoot.OnHexOrdered(rig.Map, rig.Info, other.Q, other.R);
+ Assert.AreEqual((other.Q, other.R), rig.At(id), "a right click moves onto it");
+ Assert.AreEqual(mover.Token.Unit.Id, rig.Layer.Selected);
+ }
+
+ /// <summary>An enemy in Golani's reach (UnitOrdersTests.EnemyInGolanisReach): with Golani's Move pick open from the
+ /// selection, neither a left nor a right click on the enemy's hex orders a move or a go-to into it (Attack is its own
+ /// pick, from its button).</summary>
+ [Test]
+ public void NoClickOnAnEnemyOrdersAMoveIntoIt()
+ {
+ using var rig = new Rig();
+ var s = rig.Bridge.State;
+ var id = UnitOrdersTests.EnemyInGolanisReach(s);
+ rig.Layer.Show(rig.Bridge.Content, s);
+ var enemy = s.Units.Values.Where(u => u.Side != "" && u.Side != Movement.PlayerSide).Select(u => (u.Q, u.R))
+ .First(h => Combat.Check(C, s, id, h.Q, h.R) == null);
+ var golani = rig.Token("golani");
+ var from = rig.At(id);
+ rig.Select(golani);
+ Assert.IsTrue(rig.Info.MovePicking, "precondition: the Move pick is open");
+ rig.Click(enemy.Q, enemy.R);
+ Assert.IsEmpty(rig.Bridge.Session.Committed, "a left click on the enemy orders nothing");
+ Assert.AreEqual(from, rig.At(id));
+ Assert.AreNotEqual(Movement.GoTo, rig.Bridge.State.Units[id].Order);
+ rig.Select(golani);
+ GameRoot.OnHexOrdered(rig.Map, rig.Info, enemy.Q, enemy.R);
+ Assert.IsEmpty(rig.Bridge.Session.Committed, "a right click on the enemy orders nothing");
+ Assert.AreEqual(from, rig.At(id));
+ }
+
+ /// <summary>A short right click on a lit hex moves the shown unit, as a left click would; with no unit shown, or on a
+ /// hex the unit cannot reach, it does nothing: the card, its lit hexes and the selection stay.</summary>
+ [Test]
+ public void ARightClickMovesTheShownUnitAndOtherwiseDoesNothing()
+ {
+ using var rig = new Rig();
+ var golani = rig.Token("golani"); var id = rig.Id(golani);
+ var reach = rig.Reach(id);
+ var to = reach.First(h => rig.Layer.UnitToSelectAt(h.q, h.r) == null);
+ GameRoot.OnHexOrdered(rig.Map, rig.Info, to.q, to.r);
+ Assert.IsEmpty(rig.Bridge.Session.Committed, "no unit shown: nothing");
+ Assert.IsNull(rig.Layer.Selected);
+ rig.Select(golani);
+ var sea = C.Hexes.First(h => !h.Land);
+ GameRoot.OnHexOrdered(rig.Map, rig.Info, sea.Q, sea.R);
+ Assert.IsEmpty(rig.Bridge.Session.Committed, "an unreachable hex: nothing");
+ Assert.IsTrue(rig.Info.ShowsUnit, "the card stays");
+ CollectionAssert.AreEqual(reach, rig.Lit.Last(), "and its lit hexes");
+ GameRoot.OnHexOrdered(rig.Map, rig.Info, to.q, to.r);
+ Assert.AreEqual(to, rig.At(id), "a right click on a lit hex moves the unit at once");
+ Assert.AreEqual("golani", rig.Layer.Selected);
+ }
+
+ /// <summary>On a touchscreen (no right button) a tap on a lit hex after selecting moves the unit, as a left click does.</summary>
+ [Test]
+ public void ATapOnALitHexMovesTheUnit()
+ {
+ using var rig = new Rig();
+ var golani = rig.Token("golani"); var id = rig.Id(golani);
+ var to = rig.Reach(id).First(h => rig.Layer.UnitToSelectAt(h.q, h.r) == null);
+ rig.Click(golani.Q, golani.R, touch: true);
+ rig.Click(to.q, to.r, touch: true);
+ Assert.AreEqual(to, rig.At(id));
+ }
+
+ /// <summary>#1650: Escape clears the selected unit and its lit hexes, and orders nothing.</summary>
+ [Test]
+ public void EscapeClearsTheUnitAndItsReachWithoutAnOrder()
+ {
+ using var rig = new Rig();
+ rig.Select(rig.Token("golani"));
+ Assert.IsNotEmpty(rig.Lit.Last(), "precondition");
+ Assert.IsTrue(rig.Info.Escape());
+ Assert.IsFalse(rig.Info.ShowsUnit);
+ Assert.IsNull(rig.Layer.Selected);
+ Assert.IsEmpty(rig.Lit.Last());
+ Assert.IsEmpty(rig.Bridge.Session.Committed);
+ }
+
+ /// <summary>#210: under a screen covering the panel, neither a left nor a right click on a lit hex orders the unit.</summary>
+ [Test]
+ public void UnderACoveringScreenNoClickMovesTheUnit()
+ {
+ using var rig = new Rig();
+ var golani = rig.Token("golani"); var id = rig.Id(golani);
+ var to = rig.Reach(id).First(h => rig.Layer.UnitToSelectAt(h.q, h.r) == null);
+ rig.Select(golani);
+ var hud = rig.Ui.Q<VisualElement>("info-panel").parent;
+ hud.AddToClassList(ScreenNav.WideOpenClass);
+ rig.Click(to.q, to.r);
+ GameRoot.OnHexOrdered(rig.Map, rig.Info, to.q, to.r);
+ Assert.IsEmpty(rig.Bridge.Session.Committed);
+ Assert.AreEqual("golani", rig.Layer.Selected);
+ hud.RemoveFromClassList(ScreenNav.WideOpenClass);
+ rig.Click(to.q, to.r);
+ Assert.AreEqual(to, rig.At(id), "uncovered, the same click moves it");
+ }
+
+ /// <summary>A second press of Move, or of Attack, never leaves a unit that can move with no lit reach; nor does a new
+ /// turn (the turn's pick is over, the next one lights).</summary>
+ [Test]
+ public void AUnitThatCanMoveKeepsItsReachLit()
+ {
+ using var rig = new Rig();
+ var golani = rig.Token("golani"); var id = rig.Id(golani);
+ rig.Select(golani);
+ UiTestKit.Press(rig.Ui.Q<Button>("info-move"));
+ Assert.IsTrue(rig.Info.MovePicking, "Move keeps its pick");
+ CollectionAssert.AreEqual(rig.Reach(id), rig.Lit.Last());
+ rig.Bridge.EndTurn();
+ Assert.IsTrue(rig.Bridge.State.Units.ContainsKey(id) && rig.Reach(id).Count > 0, "precondition: Golani can move on the next turn");
+ Assert.IsTrue(rig.Info.ShowsUnit);
+ Assert.IsTrue(rig.Info.MovePicking, "the new turn lights its reach");
+ CollectionAssert.AreEquivalent(rig.Reach(id), rig.Lit.Last());
+ }
+
+ /// <summary>Owner, 25 Oct 2026: "Clicking another unit or a city still selects it." With Golani's Move pick open, a
+ /// left click on a city's hex (Tel Aviv: out of reach this turn, with a go-to route) shows the city and orders nothing; a
+ /// right click there gives the go-to.</summary>
+ [Test]
+ public void ALeftClickOnACityShowsItAndARightClickSendsTheUnitThere()
+ {
+ using var rig = new Rig();
+ var golani = rig.Token("golani"); var id = rig.Id(golani);
+ var tlv = C.SettlementHexes.First(x => x.Id == "tel_aviv" && rig.Layer.UnitToSelectAt(x.Q, x.R) == null);
+ Assert.IsNotEmpty(Movement.Route(C, rig.Bridge.State, id, tlv.Q, tlv.R, rig.Bridge.Spent), "precondition: a go-to route reaches Tel Aviv");
+ rig.Select(golani);
+ Assert.IsTrue(rig.Info.MovePicking, "precondition: the Move pick is open");
+ rig.Click(tlv.Q, tlv.R);
+ Assert.IsEmpty(rig.Bridge.Session.Committed, "a left click on a city orders nothing");
+ Assert.IsFalse(rig.Info.ShowsUnit);
+ Assert.AreEqual((tlv.Q, tlv.R), rig.Info.Selected, "it shows the city's hex");
+ rig.Select(golani);
+ GameRoot.OnHexOrdered(rig.Map, rig.Info, tlv.Q, tlv.R);
+ Assert.AreEqual((Movement.GoTo, $"{tlv.Q},{tlv.R}"), (rig.Bridge.State.Units[id].Order, rig.Bridge.State.Units[id].OrderTarget), "a right click sends the unit there");
+ }
+
+ /// <summary>A unit of Israel's with no reach left (Golani, its points spent by moves this turn) opens no pick: a left
+ /// click on land selects that hex and a right click does nothing.</summary>
+ [Test]
+ public void AUnitWithNoReachOpensNoPick()
+ {
+ using var rig = new Rig();
+ var id = rig.Id(rig.Token("golani"));
+ for (var reach = rig.Reach(id); reach.Count > 0; reach = rig.Reach(id))
+ Assert.IsNull(rig.Bridge.Queue(new Move(id, reach.Last().q, reach.Last().r)), "precondition: the move is taken");
+ rig.Layer.Show(rig.Bridge.Content, rig.Bridge.State);
+ var still = rig.Token("golani");
+ Assert.AreEqual(rig.At(id), (still.Q, still.R), "precondition: the token stands where Golani moved");
+ var given = rig.Bridge.Session.Committed.Count; // the moves above are committed at once
+ var land = C.Hexes.First(h => h.Land && rig.Layer.At(h.Q, h.R) == null && !rig.Info.IsCity(h.Q, h.R) && (h.Q, h.R) != (still.Q, still.R));
+ rig.Layer.Select(null);
+ rig.Select(still);
+ Assert.AreEqual("golani", rig.Layer.Selected, "precondition: Golani's card");
+ Assert.IsFalse(rig.Info.MovePicking, "no reach: no pick");
+ GameRoot.OnHexOrdered(rig.Map, rig.Info, land.Q, land.R);
+ Assert.AreEqual(given, rig.Bridge.Session.Committed.Count, "a right click orders nothing");
+ Assert.IsTrue(rig.Info.ShowsUnit, "and changes nothing");
+ rig.Click(land.Q, land.R);
+ Assert.AreEqual(given, rig.Bridge.Session.Committed.Count, "a left click orders nothing");
+ Assert.AreEqual((land.Q, land.R), rig.Info.Selected, "a left click selects the hex");
+ }
+
+ /// <summary>The Attack pick is the button's, as before: pressing Attack lights the enemy, a right click on it gives the
+ /// attack (as a left click does), and pressing Attack again goes back to the Move pick.</summary>
+ [Test]
+ public void ARightClickOnAnAttackPicksTargetAttacksAndAttackAgainGoesBackToMove()
+ {
+ using var rig = new Rig();
+ var s = rig.Bridge.State;
+ var id = UnitOrdersTests.EnemyInGolanisReach(s);
+ rig.Layer.Show(rig.Bridge.Content, s);
+ var enemy = s.Units.Values.Where(u => u.Side != "" && u.Side != Movement.PlayerSide).Select(u => (u.Q, u.R))
+ .First(h => Combat.Check(C, s, id, h.Q, h.R) == null);
+ rig.Select(rig.Token("golani"));
+ var attack = rig.Ui.Q<Button>("info-attack");
+ UiTestKit.Press(attack);
+ UiTestKit.Press(attack);
+ Assert.IsTrue(rig.Info.MovePicking, "Attack pressed again goes back to the Move pick");
+ UiTestKit.Press(attack);
+ Assert.IsFalse(rig.Info.MovePicking, "precondition: the Attack pick is open");
+ GameRoot.OnHexOrdered(rig.Map, rig.Info, enemy.Q, enemy.R);
+ var given = rig.Bridge.Session.Committed.OfType<UnitOrder>().Single();
+ Assert.AreEqual((id, Combat.Attack), (given.Unit, given.Order), "the right click gave the attack");
+ }
+}
diff --git a/unity/Assets/Tests/EditMode/SelectThenClickMoveTests.cs.meta b/unity/Assets/Tests/EditMode/SelectThenClickMoveTests.cs.meta
new file mode 100644
index 000000000..994e47e36
--- /dev/null
+++ b/unity/Assets/Tests/EditMode/SelectThenClickMoveTests.cs.meta
@@ -0,0 +1,2 @@
+fileFormatVersion: 2
+guid: 71cc4c01c81634110bacabd994b9cdcf
\ No newline at end of file
diff --git a/unity/Assets/Tests/EditMode/UnitOrdersTests.cs b/unity/Assets/Tests/EditMode/UnitOrdersTests.cs
index 66f650a8c..3abd7816e 100644
--- a/unity/Assets/Tests/EditMode/UnitOrdersTests.cs
+++ b/unity/Assets/Tests/EditMode/UnitOrdersTests.cs
@@ -86,7 +86,8 @@ public class UnitOrdersTests
/// <summary>Move lights exactly Movement.Reachable's hexes. A click on one commits Move(unit, q, r) through SimBridge and
/// keeps the card; a click on an unreachable water hex commits nothing and shows that hex;
- /// a second press of Move ends the pick. Each end of the pick clears the overlay.</summary>
+ /// a second press of Move keeps the pick (a unit that can move always has it open, owner 25 Oct 2026). Each end of the
+ /// pick clears the overlay.</summary>
[Test]
public void AClickOnALitHexCommitsTheMoveAndAnUnreachableClickEndsThePick()
{
@@ -112,9 +113,9 @@ public class UnitOrdersTests
CollectionAssert.AreEqual(reach, lit.Last(), "the overlay is Reachable's hexes, in its order");
Assert.IsTrue(map.Terrain.transform.Find(MapScene.ReachableName).GetComponent<MeshRenderer>().enabled);
Assert.IsTrue(ui.Q<Label>("info-settlements").text.Contains(Text["unit.move_pick"]), ui.Q<Label>("info-settlements").text);
- UiTestKit.Press(move); // a second press ends the pick
- Assert.IsEmpty(lit.Last());
- Assert.IsFalse(map.Terrain.transform.Find(MapScene.ReachableName).GetComponent<MeshRenderer>().enabled);
+ UiTestKit.Press(move); // a second press keeps the pick: a unit that can move always has its reach lit
+ CollectionAssert.AreEqual(reach, lit.Last(), "a second press of Move keeps the reach lit");
+ Assert.IsTrue(map.Terrain.transform.Find(MapScene.ReachableName).GetComponent<MeshRenderer>().enabled);
// Task12/spec8.1:248: unlit land with a route now gives go-to (tested below); water ends the pick.
var water = C.Hexes.First(h => !h.Land);
Assert.IsFalse(reach.Contains((water.Q, water.R)), "precondition: water has no move or go-to route");
@@ -178,7 +179,8 @@ public class UnitOrdersTests
/// <summary>#1617: while a Move pick is open, a click on the unit card is the map's only where it falls on the card's
/// text (not a button, not another panel) over a hex PickTarget takes: a lit hex, or an unlit hex with a go-to route
- /// (#1398); an unlit hex with no route stays blocked. The hex is asked only then. With no pick open, never.</summary>
+ /// (#1398); an unlit hex with no route stays blocked. The hex is asked only then. With no pick open, never. Selecting
+ /// the unit opens its pick, with no press of Move (owner, 25 Oct 2026).</summary>
[Test]
public void OnlyAHexTheMovePickTakesUnderTheCardsTextTakesAClickThroughTheCard()
{
@@ -202,8 +204,7 @@ public class UnitOrdersTests
var title = ui.Q<Label>("info-title"); var move = ui.Q<Button>("info-move");
var asked = 0;
System.Func<(int q, int r)?> At((int q, int r)? hex) => () => { asked++; return hex; };
- Assert.IsFalse(info.TakesClickThrough(title, At(lit)), "no pick open");
- Assert.AreEqual(0, asked, "the hex is not asked with no pick open");
+ Assert.IsTrue(info.TakesClickThrough(title, At(lit)), "selecting the unit opened its pick");
UiTestKit.Press(move);
Assert.IsTrue(info.TakesClickThrough(title, At(lit)), "the card's text over a lit hex");
Assert.IsTrue(info.TakesClickThrough(ui.Q<VisualElement>("info-panel"), At(lit)), "the card's own background over a lit hex");
@@ -216,8 +217,12 @@ public class UnitOrdersTests
Assert.IsFalse(info.TakesClickThrough(ui.Q<VisualElement>("top-bar"), At(lit)), "another panel keeps its click");
Assert.IsFalse(info.TakesClickThrough(null, At(lit)), "no UI: the map has the click anyway");
Assert.AreEqual(0, asked, "the hex is asked only for the card's text");
- UiTestKit.Press(move); // a second press ends the pick
- Assert.IsFalse(info.TakesClickThrough(title, At(lit)), "the pick has ended");
+ UiTestKit.Press(move); // a second press keeps the pick
+ Assert.IsTrue(info.TakesClickThrough(title, At(lit)), "a second press of Move keeps the pick");
+ info.Clear();
+ asked = 0;
+ Assert.IsFalse(info.TakesClickThrough(title, At(lit)), "no pick open");
+ Assert.AreEqual(0, asked, "the hex is not asked with no pick open");
info.Dispose();
}
diff --git a/unity/Assets/Tests/EditMode/UnitsFromStateTests.cs b/unity/Assets/Tests/EditMode/UnitsFromStateTests.cs
index c2cc42fd8..0da76f41f 100644
--- a/unity/Assets/Tests/EditMode/UnitsFromStateTests.cs
+++ b/unity/Assets/Tests/EditMode/UnitsFromStateTests.cs
@@ -226,8 +226,9 @@ public class UnitsFromStateTests
Assert.AreEqual(Text["unit.service.army"], ui.Q<Label>("info-subtitle").text);
var points = C.UnitTypes.Single(t => t.Id == raised.Type).MovementPoints;
Assert.AreEqual(Text.Format("unit.strength", raised.Strength) + "\n" + Text.Format("unit.home_city", C.SettlementNames[raised.HomeCity])
- + "\n" + Text.Format("unit.points", points, points), // #1398 (U1): the card shows the movement points left
- ui.Q<Label>("info-settlements").text, "strength, home city and movement points, and no empty sector line");
+ + "\n" + Text.Format("unit.points", points, points) // #1398 (U1): the card shows the movement points left
+ + "\n" + Text["unit.move_pick"], // owner, 25 Oct 2026: selecting a unit that can move opens its Move pick
+ ui.Q<Label>("info-settlements").text, "strength, home city, movement points and the Move pick, and no empty sector line");
Assert.AreEqual(DisplayStyle.Flex, ui.Q<Button>("info-move").style.display.value);
Assert.AreEqual(Text["unit.order.move"], ui.Q<Button>("info-move").text);
info.Dispose();
diff --git a/unity/Assets/UI/strings.en.yaml b/unity/Assets/UI/strings.en.yaml
index bed1b0e45..801f939fa 100644
--- a/unity/Assets/UI/strings.en.yaml
+++ b/unity/Assets/UI/strings.en.yaml
@@ -450,8 +450,9 @@ defence.section_leadership: "Leadership"
defence.section_ladder: "Security level"
defence.section_callup: "Reserve call-up"
defence.section_budget: "Defence share of the budget"
-# The empty info panel's hint: the mouse, the keyboard's map stop (#41 B1b, #1116) and the right-drag pan (#998).
-info.hint: "Click the map, or Tab to it and press Enter, to inspect a hex; right-drag to move the map"
+# The empty info panel's hint: moving a unit (owner, 25 Oct 2026, "Civ: select, then click"), the mouse, the keyboard's
+# map stop (#41 B1b, #1116) and the right-drag pan (#998).
+info.hint: "Click a unit, then a hex, to move it. Click the map, or Tab and Enter, to inspect a hex; right-drag to move the map"
info.off_map: "Off the map"
info.hex: "{0} · elevation {1:N0} m"
info.region: "{0}, {1} (Mandate sub-districts, 1947)"
diff --git a/unity/Assets/UI/strings.he.yaml b/unity/Assets/UI/strings.he.yaml
index 52fa29af7..546826d0b 100644
--- a/unity/Assets/UI/strings.he.yaml
+++ b/unity/Assets/UI/strings.he.yaml
@@ -469,9 +469,11 @@ card.offices_separator: " · "
# The tag on the selected Cabinet seat's card (PersonCard; #41 M6). Not "נבחר": on a minister's card in a game about the
# Knesset it reads as "elected". "מסומן" agrees with the card (כרטיס), masculine. For the native reviewer (#564).
card.selected: "מסומן"
-# The empty info panel's hint: a click, or Tab to the map's stop and Enter (#41 B1b, #1116), and the right-drag pan (#998).
-# "Tab" and "Enter" are the keys' printed names. For the native reviewer (#564).
-info.hint: "יש ללחוץ על המפה, או לעבור אליה ב־Tab וללחוץ Enter, כדי לבדוק משושה; גרירה בלחצן הימני מזיזה את המפה"
+# The empty info panel's hint: moving a unit (owner, 25 Oct 2026, "Civ: select, then click"), a click, or Tab to the
+# map's stop and Enter (#41 B1b, #1116), and the right-drag pan (#998). "Tab" and "Enter" are the keys' printed names.
+# Agent-drafted Hebrew, native review pending (new wording) (#564): shortened to stay within two lines on a phone
+# (InfoPanelLayoutTests), in the nominal form of the drag clause.
+info.hint: "לחיצה על יחידה ואז על משושה מזיזה אותה; לחיצה על המפה, או Tab ו־Enter, בודקת משושה; גרירה בלחצן הימני מזיזה את המפה"
info.off_map: "מחוץ למפה"
info.hex: "{0} · גובה {1:N0} מ׳"
info.region: "{0}, {1} (נפות המנדט, 1947)"