RegionSliderFillUI

Overview

A procedural fill bar for region stats with optional prediction overlays. It directly resizes a RectTransform (width only) and can recolor overflow states by personality. Variants also pulse a colored overlay when previewing predicted increases.

Serialized

  • LinkedData linkedData — what to show: Police/Cartel Severity, Min Severities, Control, Production, Demand, Overproduction, Predicted variants.
  • RectTransform fillTransform — the bar to stretch (width). Constant width baseline: 845 px.
  • ColorConstant schemerOverproductionColor, subterfugeOverproductionColor; IntVariable selectedPersonality; bool coloredOverflow.
  • (Prediction) FloatEvent predictedChange, Image sliderFill, Color predictedPositiveColor, predictedNegativeColor, float pulseEffectTime, pulseEffectMin.

Live Values (UpdateUI)

  • POLICE_SEVERITY / CARTEL_SEVERITY → bar = value × 845. If coloredOverflow and personality is Schemer (1), tint the fill with schemerOverproductionColor while the region is in OverSupply; otherwise revert to startingColor.
  • MIN_POLICE_SEVERITY / MIN_CARTEL_SEVERITY → from the region’s min caps.
  • CONTROL → bar = Control × 845. If coloredOverflow and personality is Subterfuge (2), tint with subterfugeOverproductionColor during OverSupply.
  • PRODUCTIONmin(LocalProduction, LocalDemand) / 5f (normalized to 0–1) × 845.
  • DEMANDLocalDemand / 5f × 845.
  • OVERPRODUCTIONLocalProduction / 5f × 845.

Predictions (UpdatePredictedUI)

When predictedChange is wired:

  • POLICE/CARTEL_SEVERITY → clamp down to [minSeverity, current] to preview possible reductions.
  • CONTROL → clamp down to [0, current] for previewed losses.
  • PREDICTED_POLICE/CARTEL_SEVERITY/CONTROL → clamp up to [current, 1] to preview increases, color sliderFill using positive/negative colors, and start a PulseEffect() (alpha ping–pong).

Notes

  • Pulse uses unscaled deltaTime so it’s visible while the game is paused.
  • Unregisters from predictedChange on destroy and stops coroutines on disable.