AddRoutePanelUI
Overview
Confirmation panel shown after selecting an origin and destination in the route builder. Computes and displays a cost breakdown (base, per-node, multiplier, total) using es-ES number formatting. On confirm it creates the route, deducts money, bumps the global route count, and opens the region canvas. Supports reroute flow via a companion panel. fileciteturn18file3
Serialized Atoms & UI
- RegionVariable
currentRegion - IntVariable
totalRoutesCount - FloatVariable
currentMoney,routeBaseCost,routeCostPerNode,routeCostMultiplier - RouteVariable
reroutingRoute - BoolEvent
openRegionCanvas - VoidEvent
openRegionInfoPanel,closeRegionInfoPanel - TextMeshProUGUI
infoText - RouteBuilderUI
routeBuilderUI - RerouteRoutePanelUI
rerouteUI(used when rerouting). fileciteturn18file3
Flow
- OpenPanel()
- Clones
RouteBuilderUI.newRouteNodes. - If there are 2+ nodes:
origin = first.Region,dest = last.Region.- If not rerouting:
cost = (routeBaseCost + routeCostPerNode*(nodes-1)) * routeCostMultiplier- Build multi-line
infoTextwith From/To, base cost,nodes-1 × per-node, multiplierxM, and Total; all formatted withes-ESand a$suffix. gameObject.SetActive(true)
- Else open
rerouteUIand hide this panel. - Set
currentRegion = destandopenRegionInfoPanel.Raise().
- Clones
- OnConfirmButtonPressed()
origin.AddRoute(routeNodes)→ newRoutecurrentMoney -= costtotalRoutesCount++- Hide and
openRegionCanvas.Raise(true)
- OnDenyButtonPressed() — hide and
closeRegionInfoPanel.Raise() - OnEnable/OnDisable — set
routeBuilderUI.Lockto block UI while the panel is shown. fileciteturn18file3