Ui
constUi:object
Defined in: client/api.d.ts:790
Mafia II’s own interactive prompts, driven locally. Each call takes a caller-defined id that the resulting client event echoes back, so several prompts can be told apart.
Type Declaration
Section titled “Type Declaration”cancelLockpick()
Section titled “cancelLockpick()”cancelLockpick():
void
Closes the active lockpicking minigame, reported as escaped.
Returns
Section titled “Returns”void
cancelQuestion()
Section titled “cancelQuestion()”cancelQuestion():
void
Closes the active question or dialog without raising an answer event.
Returns
Section titled “Returns”void
showDialog()
Section titled “showDialog()”showDialog(
questionId,title,acceptLabel,declineLabel,timeoutSeconds?):void
Shows a native two-choice confirmation dialog. The result arrives as the dialogAnswer event.
Parameters
Section titled “Parameters”questionId
Section titled “questionId”number
Opaque caller-defined ID echoed by the dialogAnswer event.
string
Dialog question or title text.
acceptLabel
Section titled “acceptLabel”string
Label for the accepting option.
declineLabel
Section titled “declineLabel”string
Label for the declining option.
timeoutSeconds?
Section titled “timeoutSeconds?”number
Time before the dialog is dismissed automatically; defaults to 10, and zero or less disables the timeout.
Returns
Section titled “Returns”void
showQuestion()
Section titled “showQuestion()”showQuestion(
questionId,question,answers,timeoutSeconds?):void
Shows the native multiple-choice question UI. The result arrives as the questionAnswer event with a one-based answer index, or -1 when the prompt timed out or was dismissed.
Parameters
Section titled “Parameters”questionId
Section titled “questionId”number
Opaque caller-defined ID echoed by the questionAnswer event.
question
Section titled “question”string
Question text shown to the player.
answers
Section titled “answers”string[]
One to four answer labels; entries beyond the fourth are ignored.
timeoutSeconds?
Section titled “timeoutSeconds?”number
Time before the prompt is dismissed automatically; defaults to 10, and zero or less disables the timeout.
Returns
Section titled “Returns”void
startLockpick()
Section titled “startLockpick()”startLockpick(
lockpickId,pins?,maxFails?):void
Starts the native lockpicking minigame. Completion, failure, or escape arrives as the lockpickResult event. Movement is locked while it runs on foot, because the tension wrench rides the move axis.
Parameters
Section titled “Parameters”lockpickId
Section titled “lockpickId”number
Opaque caller-defined ID echoed by the lockpickResult event.
number
Difficulty from 1 through 5 pins; defaults to 4.
maxFails?
Section titled “maxFails?”number
Allowed broken pins before failure; zero or less, the default, means unlimited attempts.
Returns
Section titled “Returns”void
