UI Module
Flowgraph module that builds mission start/end screen UIs. Provides a builder pattern for composing screen layouts with elements (text panels, objectives, ratings, drift stats, lap times, crash analys
Flowgraph module that builds mission start/end screen UIs. Provides a builder pattern for composing screen layouts with elements (text panels, objectives, ratings, drift stats, lap times, crash analysis), buttons, and multi-page navigation. Manages game state backup/restore and app container contexts.
Module Properties
| Property | Value | Description |
|---|---|---|
moduleOrder | 1000 | Late initialization order |
hooks | onRequestMissionScreenData, onMissionScreenButtonClicked, onGetIsMissionStartOrEndScreenActive | UI communication hooks |
dependencies | ui_gameplayAppContainers | Required extension |
Class Methods
Lifecycle
| Method | Description |
|---|---|
C:init() | Calls clear() |
C:clear() | Resets isBuilding, uiLayout, appContainerContext |
C:executionStarted() | Saves game state and recovery prompt; disables recovery prompt; loads generic mission data and points bar extensions; clears tasklist |
C:executionStopped() | Clears mission data/points bar; resets app container context; restores recovery prompt and game state |
Builder Pattern
| Method | Description |
|---|---|
C:startUIBuilding(uiMode, node) | Begins building a layout ("startScreen" or "endScreen"); stores source node reference |
C:finishUIBuilding() | Finalizes layout; adds start button for start screens; sets up pages; triggers state change to mission-control |
C:addUIElement(element) | Appends a layout element (must be building) |
C:addHeader(header) | Sets the screen header |
C:addButton(fun, meta) | Registers a button callback; returns button metadata with mgrId and funId |
C:clearButtonFunctions() | Clears all registered button callbacks |
C:setupPages() | Builds page tabs from layout elements' pages fields; configures order, icons, mandatory flags |
Content Elements
| Method | Description |
|---|---|
C:addObjectives(change) | Adds star objectives panel with enabled/visible/reward state from active star cache |
C:addRatings(change) | Adds leaderboard ratings, rewards, and unlock panels |
C:addDriftStats(driftStats) | Adds performance stats, tier breakdown, and drift events tables |
C:addLaptimesForVehicle(state, attempt) | Adds lap times table with best-lap highlighting |
C:addCrashAnalysisStepDetails(stepDetails) | Adds crash test step score details |
C:addReplayPanelAndSupportsReplay() | Adds replay recording panel if mission supports replay |
Configuration
| Method | Description |
|---|---|
C:setStartButtonText(text) | Overrides default start button label |
C:setStartScreenAsSimple() | Marks start screen as simple (disables replay panel) |
C:setGameState(...) | Forwards to core_gamestate.setGameState(...) |
C:setAppContainerContext(context) | Sets gameplay app container context |
C:keepGameState(keep) | If keep=true, game state will NOT be restored on stop |
Hook Handlers
| Method | Description |
|---|---|
C:onRequestMissionScreenData(mode) | Sends layout data to UI via onRequestMissionScreenDataReady trigger |
C:onMissionScreenButtonClicked(button) | Executes button callback matching mgrId; clears layout |
C:onGetIsMissionStartOrEndScreenActive(screensActive) | Reports current screen mode to query |
Usage Example
local uiMod = mgr.modules.ui
-- Build a start screen
uiMod:startUIBuilding("startScreen", self)
uiMod:addHeader({ title = "Race Challenge" })
uiMod:addObjectives()
uiMod:setStartButtonText("ui.missions.start.go")
uiMod:finishUIBuilding()
-- Build an end screen with ratings
uiMod:startUIBuilding("endScreen", self)
uiMod:addObjectives(change)
uiMod:addRatings(change)
uiMod:addLaptimesForVehicle(lapState, attempt)
uiMod:finishUIBuilding()Internal Details
- Page configuration defines 10 built-in pages (timeslip, main, rewards, unlocks, leaderboards, drift, lapTimes, rules, crashAnalysisStep, recording) with order/icon/mandatory
- Button callbacks stored in
buttonFunctionsarray; UI sends backmgrId + funIdto invoke - Game state serialized at start and restored on stop (unless
keepGameStatecalled) - Recovery prompt state preserved and disabled during mission
formatMissionlocal helper formats mission data for unlock display
Additional Exports
getFreeId()
- Returns:
any
nextPage()
idCounter-number- (see source)
See Also
- Flowgraph Action Module - Related reference
- Flowgraph AI Recording Module - Related reference
- Flowgraph Button Module - Related reference
- FlowGraph Guide - Guide
Traffic Module
Flowgraph module wrapping `gameplay_traffic` and `gameplay_parking` APIs for flowgraph-managed traffic and parked car activation/deactivation. Automatically cleans up traffic and parking state when th
Vehicle Module
Flowgraph module that tracks all vehicles used by a flowgraph-spawned or foreign. Manages vehicle readiness, coupler attachments, bus systems, fuel storage, walk blacklist backup, and cleanup on flowg