Controllervotescreen
Based on game build 714014 | Last updated: 2026-03-09
Overview
ControllerVoteScreen is a UI screen that overlays and manages the controller-focused interaction with the vote dialog. It wraps the existing VoteDialog widget, positions it correctly relative to HUD controls, and integrates controller focus (via gain/loss focus callbacks) with a dynamic prompt text that displays the localized "accept" button label. The screen listens to HUD scale and vote-dialog hide events to ensure responsive UI behavior.
Usage example
local ControllerVoteScreen = require "screens/controllervotescreen"
local vote_dialog = CreateWidget("votedialog") -- assuming standard setup
local screen = ControllerVoteScreen(vote_dialog)
TheFrontEnd:PushScreen(screen)
Dependencies & tags
Components used: None identified
Tags: None identified
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
votedialog | table | nil | Reference to the parent VoteDialog widget instance. |
blackoverlay | Image widget | nil | Full-screen darkening overlay. |
root | Widget | nil | Root widget for positioning the dialog relative to HUD. |
scale_root | Widget | nil | Widget used to apply HUD scaling changes. |
dialogroot | Widget | nil | Container widget mirroring the VoteDialog root position. |
prompt | Text widget | nil | Dynamic text showing the localized controller accept button. |
selection | number or nil | nil | Index of the currently focused vote button (1-based). |
Main functions
ControllerVoteScreen:OnBecomeInactive()
- Description: Called when the screen loses focus. If the prompt is active, it triggers closing the screen.
- Parameters: None.
- Returns: Nothing.
- Error states: Calls
Close()ifself.promptis notnil, potentially triggering side effects even during deactivation.
ControllerVoteScreen:Close()
- Description: Closes the screen, cleans up focus bindings, kills the prompt, restores the
VoteDialogroot to its owner, and notifies theVoteDialogof selection state before popping itself from the screen stack. - Parameters: None.
- Returns: Nothing.
ControllerVoteScreen:OnControl(control, down)
- Description: Handles input control events. Delegates to base screen first; if the base handles it, returns
true. Otherwise, if the cancel button is released, closes the screen. - Parameters:
control(Control enum) – the input control pressed/released.down(boolean) –trueif the control is pressed,falseif released.
- Returns:
trueif the event was handled;falseotherwise. - Error states: Returns
trueearly if the base screen handled the event or ifCONTROL_CANCELis released.
Events & listeners
- Listens to:
refreshhudsize– updatesscale_rootwhen HUD scaling changes. Event data includesscale.hidevotedialog– triggersClose()on the screen when the vote dialog should be hidden.