UpgradeLabPanelUI
Overview
Confirmation panel for upgrading a region’s Laboratory by one half-star (i.e., BaseProduction += 0.5). Shows the target Region name, a before/after star bar, and the total upgrade cost formatted using the Spanish locale. Pauses gameplay while visible and disables time controls.
Serialized Atoms & UI
- LabUpgradeCostTable
upgradeLabCostTable— prices per level. - RegionVariable
currentRegion— region being upgraded. - BoolVariable
paused - VoidEvent
enableTimeControls,disableTimeControls - TextMeshProUGUI
infoText - Transform
FromStarbar,ToStarbar— star rows. - Sprites
left/rightfilled/unfilled for drawing half-stars.
Behavior
- OnEnable()
- Formats
infoTextwith:- Region localized name
- Empty spacer lines (layout-driven)
- Current and next star bars (via
SetStarbarValue) - Total Cost:
upgradeLabCostTable.labUpgradeCosts[currentLevel]formatted with"es-ES"and a trailing$.
- Sets
paused = trueand raisesdisableTimeControls.
- Formats
- OnConfirmButtonPressed()
- Calls
currentRegion.Value.UpgradeLab()and hides the panel. - Sets
paused = falseand raisesenableTimeControls.
- Calls
- OnDenyButtonPressed()
- Hides, unpauses, and re-enables time controls.
Star Rendering
SetStarbarValue(Transform target, float value) iterates children and swaps left/right sprites for each half-star based on the target integer value (1-based indexing).
Notes
- Next level is computed as
Mathf.FloorToInt((BaseProduction + 0.5f) * 2f)for the To star bar.