RerouteRoutePanelUI
Overview
Panel used when rerouting an existing route using the Route Builder. Compares previous vs. new destination/nodes, shows the node difference, and displays the total cost (positive = pay, negative = refund). Locks the builder while shown. fileciteturn22file2
Flow
- OpenPanel()
- Clone
RouteBuilderUI.newRouteNodesintorouteNodes. IfCount >= 2:cost = ReroutingCost()(see below).- Compute
nodeDifference = previousNodes - (routeNodes.Count-1)and annotate(±N). - Build
infoText:To (prev),To (now),Nodes (prev),Nodes (now) (±N), blank lines,Total Cost(es-ES). Show panel. fileciteturn22file2
- Clone
- ReroutingCost()
previous = reroutingRoute.Value.NodesTraversedcurrent = routeNodes.Count - 1- If
previous > current→ refund =-(routeCostPerNode * (previous-current)) * 0.5f - Else → charge =
-(routeCostPerNode * (previous-current))(positive) fileciteturn22file2
- OnConfirmButtonPressed()
- Remove old route without refund, add new via origin Lab, apply
currentMoney -= cost, clearreroutingRoute, close panel,openRegionCanvas.Raise(false), and setcurrentRegionto the new destination. fileciteturn22file2
- Remove old route without refund, add new via origin Lab, apply
Locking
OnEnable() sets routeBuilderUI.Lock = true; OnDisable() clears it. fileciteturn22file2