refactor: UI Toolkit screen elements move into a shared module behind one entry point

Merged
HA
4d ago
+546-289

Summary

  • Moves the UI Toolkit screen-element code that screenshot annotations use into a shared module, so simulate-mouse-ui can find and press the same controls next. No behaviour change.

User Impact

  • None. screenshot --annotate-elements reports the same UI Toolkit entries with the same coordinates.

Changes

  • New assembly UnityCLILoop.FirstPartyTools.Common.UIToolkit.Editor (Editor only, not auto-referenced, references Common.MouseUi).
    • Public entry point UIToolkitScreenElements.CollectControls(probePointsForTopLeftBounds) and result type UIToolkitScreenControl. Both work in top-left Game View pixels.
    • Internal parts: panel gathering and picking, element paths, the control walk, plus the classifier, panel kind, screen mapping and reachability probe moved with git mv. Internals are visible to the test assemblies only.
  • Common.MouseUi exposes its internals to the new module, which uses GameObjectPathUtility.
  • Screenshot keeps UIToolkitElementCollector.Collect(elements, gameViewHeight) as an adapter. It supplies the uGUI probe points and converts the results back to bottom-left entries, using the same conversions in the same order as before.
  • Screenshot and the EditMode / PlayMode test assemblies reference the new module.

Verification

  • uloop compile: 0 errors. The one warning is an existing one in a test fixture.
  • EditMode, one class at a time: UIToolkitElementClassifierTests 13/13, UIToolkitPanelKindTests 4/4, UIToolkitReachabilityProbeTests 6/6, UIToolkitScreenMappingTests 9/9, UIElementAnnotatorCollectTests 11/11, OnionAssemblyDependencyTests 83/83.
  • PlayMode UIToolkitElementCollectorTests 18/18.
  • check-asmdef-policy: no violations.
  • scripts/test-screenshot-uitoolkit-annotation.sh: PASS, with the coordinate checks against the elements-only capture (±1 px) passing. git status was unchanged after the run.