RouteBuilderUI

Overview

Coordinator for the route construction flow. Tracks the list of selected nodes, highlights connections, enables Confirm/Undo, integrates with TutorialMaster, and supports rerouting by seeding from an existing route. fileciteturn22file3

Core Behavior

  • OnEnable(): clears state, NodeMap.UnfocusAllConnections(), seeds from reroutingRoute or currentRegion, disables confirm (half-alpha), moves buttonsAnchor to last node, raises updateRouteUI. fileciteturn22file3
  • AddNode(GameObject):
    • Inserts sea connection intermediates when needed.
    • Shows builder usage + focus on all connections.
    • Moves buttonsAnchor to the new node.
    • Confirm becomes interactable only when last node is not MARITIME, has no incoming route, and has no Lab.
    • Updates currentRegion without emitting its Changed event.
    • Applies tutorial-specific interactivity overrides. fileciteturn22file3
  • RemoveLastNode():
    • Hides last connection usage, pops, updates icons/eligibility, raises UI, syncs currentRegion & selectedRegionVariable. If only the start remains, undo icon changes to quit; another press → ExitBuilding(). fileciteturn22file3
  • ExitBuilding(): reopens lab canvas, raises openRegionCanvas(false), clears reroutingRoute.
  • OnDisable(): clears all builder usage; OnDestroy(): unregisters event. fileciteturn22file3

UI & Atoms

currentRegion, reroutingRoute, updateRouteUI, addNodeToRoute, openRegionCanvas, selectedRegionVariable, AddRoutePanelUI refs, confirm/undo buttons & icons. fileciteturn22file3