EndScreenUI
Overview
End-of-game panel that presents a Victory or Defeat screen, including playtime, earnings, debt, infrastructure counts, and averaged control across all regions. Uses I2 Localization for titles/subtitles and formats numbers with custom culture rules.
Serialized Atoms & UI
- Atoms:
playTime,totalMoneyGained,maxDebtReached,totalLabsBuilt,totalRoutesBuilt,totalUpgradesPurchased,totalRegionsSecured,captureProgress,notorietyProgress,selectedRegion - UI:
playTimeText,totalMoneyGainedText,maxDebtReachedText,totalLabsBuiltText,totalRoutesBuiltText,totalUpgradesPurchasedText,totalRegionsSecuredText,captureProgressText,notorietyProgressText,background,hideableUI,titleText,subtitleText,backgroundImage - Sprites:
victoryBackgroundSprite,loyaltyDefeatBackgroundSprite,captureDefeatBackgroundSprite
Public API
Victory()— clears current region, shows panel/background, sets localized victory title/subtitle and sprite, then calls UpdateCommonUI.Defeat()— clears current region, shows panel/background, sets defeat title; subtitle and background depend oncaptureProgress > 1(capture defeat) vs loyalty defeat; then calls UpdateCommonUI.OnWorldButtonPressed()— toggles background and a block of UI for a clean screenshot/peek.
Common UI Update
- Play time:
"{hours}h, {minutes}min"from seconds. - Money:
totalMoneyGainedformatted;maxDebtReachedshown as a negative with the same formatter. - Counts: total labs/routes/upgrades as integers.
- Progress:
captureProgressandnotorietyProgressclamped to0–100%with0.#formatting. - Regions secured: average of all
Region.Controlvalues ×100, formatted with 1 decimal. RequiresGameManager.GetAllRegions().
Money Formatting Rules
- < 10 000 → integer with dot thousands group (e.g.,
9.876). - ≥ 10 000 → compact:
- k: thousands, M: millions.
- Keep up to 4 significant integer digits (excluding the decimal separator).
- Use comma as decimal separator for compact values (e.g.,
12,5k,1,25M). - Auto-promote
999,95k → 1,0Mafter rounding. - Trim trailing zeros and dangling commas.
Notes
- Uses I2 keys:
ENDSCREEN_VICTORY,ENDSCREEN_VICTORY_DESC,ENDSCREEN_DEFEAT,ENDSCREEN_DEFEAT_DESC_NOTORIETY,ENDSCREEN_DEFEAT_DESC_LOYALTY. - Keeps a
screenHiddenflag when toggling background/overlay.