Schematic lists revealed gear; scan progress indicators at both ends

Entity.RevealedGear and SchematicRows' enemy branch (revealed weapons then revealed gear); SchematicRow.Range is float? (null for a non-weapon claim); SchematicDisplay shows ShowGear rows for non-weapon claims and hides the range label when null; SchematicListElement.ShowGear. ActionGameManager: one progress-indicator list (lock weapons hostile-gated, scanners ungated) and the incoming indicator follows Track or Scan paints. Not Unity-compiled yet; Shared tests unaffected by the UI files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-14 21:11:37 +02:00
commit b14d609cae
5 changed files with 96 additions and 34 deletions

View file

@ -94,12 +94,12 @@ public class SchematicDisplay : MonoBehaviour
CargoTemperatureLabel.text = "N/A";
}
BuildRows(WeaponRows());
BuildRows(Rows());
}
// Which rows, which class and which range label are Entity.SchematicRows' decision (aetheria-ew, classify-from-belief);
// this display only renders them.
private IEnumerable<SchematicRow> WeaponRows() => (_player ?? _entity).SchematicRows(_entity);
private IEnumerable<SchematicRow> Rows() => (_player ?? _entity).SchematicRows(_entity);
private void ReturnRows()
{
@ -125,6 +125,8 @@ public class SchematicDisplay : MonoBehaviour
{
if(x.Row.Claimed is WeaponItemData weaponItemData)
x.ListElement.ShowWeapon(weaponItemData);
else
x.ListElement.ShowGear(x.Row.Claimed.HardpointType, x.Row.Claimed.Name);
//x.ListElement.Label.text = x.Item.EquippableItem.Name;
if (!_enemy)
{
@ -194,11 +196,11 @@ public class SchematicDisplay : MonoBehaviour
// }
// A reveal gained or ended after selection changes the rows with no event to hook: rebuild when the
// revealed weapon set differs from the rows' items.
if (_enemy && !WeaponRows().Select(r => r.Key).SequenceEqual(_schematicItems.Select(x => x.Row.Key)))
// revealed set differs from the rows' items.
if (_enemy && !Rows().Select(r => r.Key).SequenceEqual(_schematicItems.Select(x => x.Row.Key)))
{
ReturnRows();
BuildRows(WeaponRows());
BuildRows(Rows());
}
// Cut 2 (docs/fire-control-cut.md): marks whichever row is the player's current aim point.
@ -239,7 +241,11 @@ public class SchematicDisplay : MonoBehaviour
}
if (x.ListElement.RangeLabel)
x.ListElement.RangeLabel.text = ((int) x.Row.Range).ToString();
{
var range = x.Row.Range;
x.ListElement.RangeLabel.gameObject.SetActive(range.HasValue);
if (range.HasValue) x.ListElement.RangeLabel.text = ((int) range.Value).ToString();
}
}
}
}

View file

@ -22,6 +22,49 @@ public class SchematicListElement : MonoBehaviour
private List<Prototype> _iconInstances = new List<Prototype>();
// A gear row names its class; created on first use as VisibleTargetIndicator.ShowLabel creates its own (no scene or
// prefab edit) and hidden by every other row kind, because pools are shared.
private TextMeshProUGUI _nameLabel;
private void ClearIcons()
{
foreach(var prototype in _iconInstances) prototype.ReturnToPool();
_iconInstances.Clear();
}
private void SetName(string name)
{
var show = !string.IsNullOrEmpty(name);
if (_nameLabel == null)
{
if (!show) return;
var child = new GameObject("Name", typeof(RectTransform));
child.transform.SetParent(transform, false);
_nameLabel = child.AddComponent<TextMeshProUGUI>();
_nameLabel.fontSize = 14;
_nameLabel.alignment = TextAlignmentOptions.Left;
_nameLabel.raycastTarget = false;
var rect = _nameLabel.rectTransform;
rect.anchorMin = new Vector2(0, 0);
rect.anchorMax = new Vector2(1, 1);
rect.offsetMin = new Vector2(40, 0);
rect.offsetMax = Vector2.zero;
}
_nameLabel.gameObject.SetActive(show);
if (show && _nameLabel.text != name) _nameLabel.text = name;
}
// A revealed item that is not a weapon: its hardpoint's icon and, when given, its class name. Layout-aim reuses this with
// a null name for mount rows.
public void ShowGear(HardpointType type, string name)
{
ClearIcons();
var icon = IconPrototype.Instantiate<Image>();
_iconInstances.Add(icon.GetComponent<Prototype>());
icon.sprite = Settings.GetIcon(type);
SetName(name);
}
public void SetSelected(bool selected)
{
if (SelectedIndicator != null) SelectedIndicator.SetActive(selected);
@ -29,8 +72,8 @@ public class SchematicListElement : MonoBehaviour
public void ShowWeapon(WeaponItemData weapon)
{
foreach(var prototype in _iconInstances) prototype.ReturnToPool();
_iconInstances.Clear();
ClearIcons();
SetName(null);
var caliberIcon = IconPrototype.Instantiate<Image>();
_iconInstances.Add(caliberIcon.GetComponent<Prototype>());