EventPanelUI
Overview
Full-screen panel to present and resolve a gameplay event for a specific Region. It loads variant images, localizes text, validates each option, supports prediction previews, applies the selected effects (with multipliers/modifiers), and optionally chains into a follow-up event. Plays appear/select/confirm SFX and closes back to the Region canvas when done. fileciteturn24file2
Serialized (Atoms & UI)
- Labels/Images:
eventTitle,eventDesc,eventSeverityText,regionName,eventImg,backgroundImg - Options:
EventOptionUI optionA, optionB, optionC - Atoms (subset):
money,loyalty,maxLabProduction, affinities (affinityMobster/Schemer/Subterfuge), personalities (commented out), per-parameter event multipliers/modifiers (event*CostMult,event*ProfitMult, demand modifiers), special-option flags (mobster/schemer/subterfugeSpecialOptionFree),currentRegion,navigationRoute,openRegionCanvas,discardEvent,updateUI,eventPanelClosed,showTutorialEvent,chainEventPooledfileciteturn24file2 - Audio:
SFXSingle appearSFX, selectSFX, confirmSFX - Helpers:
PassiveEffectLibrary effectLibrary,EventPredictionUI predictionUI(fetched viaGetComponent) fileciteturn24file2
Flow
- Start(): register
ClosePaneltodiscardEvent, disable self, cachepredictionUI, and hook I2OnLocalizeEvent. fileciteturn24file2 - DisplayEvent(ChairmanEvent e):
- Show panel, clear selection & predictions, set
displayedEventand itsregion, and updatenavigationRoutetosec/game/sub/gameplay/q/event. - Set
currentRegion.Valuewithout firing itsChangedevent (temporary unsubscribe). fileciteturn24file2 - Fill title/desc/region/severity (Low/Mid/High by
minSeverity) and call Localize() to swap to translated strings & keys. - Load random variant sprites from
Resourcesfolders:
Event Backgrounds\{path}_VariantsandEvent Foregrounds\{path}_Variants. fileciteturn24file2 - For each response (A/B/C):
option.UpdateUI(response, ValidateButton(response, region)); thenupdateUI.Raise()andappearSFX.Play(). fileciteturn24file2
- Show panel, clear selection & predictions, set
- Localize(): swaps title/desc to
displayedEvent.GetLocalizedTitle/Desc(), severity toSEVERITY_LOW/MID/HIGH, and region name toregion.GetLocalizedName(). Also pushes localized response lines to options (with “selected” state). fileciteturn24file2
Validation
ValidateButton(EventResponse r, Region region) denies if any of these would go out of bounds:
- Loyalty < 0
- Demand would leave
[0.5, 5.0] - Affinities < 0 and the matching
*SpecialOptionFreeflag is 0
(Production/Control checks exist but are currently commented out.) fileciteturn24file2
Selection & Confirmation
- First tap on a response → selects it, sets
navigationRoute = "sec/game/sub/gameplay", callspredictionUI.UpdatePredictionsUI(...), and playsselectSFX. - Second tap on the same response → applies effects in order, honoring event multipliers/modifiers and clamping:
- Money/Loyalty/Control/Severities/Demand/Affinities, plus PRODUCTION, DESTROY_ROUTE, DESTROY_LAB, and PASSIVE_EFFECT (via
PassiveEffect+ library). - Note: for Money, both signs currently use
eventMoneyProfitMult(likely intentional or a TODO). - Demand has an extra guard so decreases can’t jump above the lower bound when a positive modifier applies. fileciteturn24file2
- Money/Loyalty/Control/Severities/Demand/Affinities, plus PRODUCTION, DESTROY_ROUTE, DESTROY_LAB, and PASSIVE_EFFECT (via
- Chained events: if
displayedEvent.IsChained(), resolve the next link with the chosen index, assign the same target region, and raisechainEventPooled. fileciteturn24file2 - Finally: play
confirmSFX, clear predictions,eventPanelClosed.Raise(), andClosePanel(). fileciteturn24file2
Close & Cleanup
ClosePanel() → openRegionCanvas.Raise(true) and hide self. OnDestroy() unregisters discardEvent and I2 localization hook. fileciteturn24file2