AddLabPanelUI
Overview
Confirmation panel for building a new Laboratory in the current region. Shows the region name, base lab cost, current lab count and next count, a multiplicative cost breakdown, and the final Total Cost — all formatted with the Spanish locale. Pauses gameplay while open and disables time controls.
Serialized Atoms
- RegionVariable
currentRegion - FloatVariable
currentMoney - FloatVariable
labCost— dynamic, scales with lab count. - FloatVariable
buildingCostMult— global multiplier. - IntVariable
labCount, IntVariabletotalLabCount - BoolVariable
paused - VoidEvent
enableTimeControls,disableTimeControls,forcePlay
UI
- TextMeshProUGUI
infoText
Behavior
- OnEnable()
- Sets
paused = true, raisesdisableTimeControls. - Composes
infoTextwith:- Region name
- Base Cost (
labCost.InitialValue) - Lab Count (
labCount→ shows"(+1)") - Build Cost (
(labCount+1) × labCost.InitialValue) - Cost Multiplier (
buildingCostMult) - Total Cost (
labCost.Value * buildingCostMult.Value)
- Sets
- OnConfirmButtonPressed()
- If building the first lab (
labCount <= 0) → raisesforcePlayto resume time immediately after. - Else unpauses and re-enables time controls.
- Calls
ClearIncomingRoutes()to remove any routes whose destination equals the current region. - Deducts money:
currentMoney -= labCost * buildingCostMult. - Increments
labCountandtotalLabCount. - Recomputes next
labCostasInitialValue * (labCount + 1). - Calls
currentRegion.Value.AddLaboratory()and hides the panel.
- If building the first lab (
- OnDenyButtonPressed() unpauses, re-enables controls, and hides.
Helper: ClearIncomingRoutes()
Iterates all labs, finds routes with route.Destination == currentRegion, removes them (without refund), and exits early once a match is removed per lab.
Notes
- All currency is formatted using
"es-ES"culture and appended with a$sign.