Repository navigation
Pop ups tips and message boxes
Pieces of the game's own UI that you fill with text: pop-ups on the HUD, tips, the game's message box, UI sounds, and the help bar and hint line of your own pages. The platform draws them in the game's look and decides when they show, so nothing you pass can break the game's screens.
New in 0.12.0. Needs FH2 Mod Platform 2.9.0 or later. On an older platform each of these does nothing and returns false (or 0), so your mod still runs there.
They're all on Mod, and they go out under your mod's name. Thread: any, unless a member says otherwise.
The game's HUD notification: one of its pictures, a title and a line, bottom centre over the driving view, for about 5 seconds.
ShowPopup(new PopupOptions("Lap record") { Text = "1:02.481 at Castelletto", Icon = PopupIcon.Trophy, Sound = UiSound.Notify });ShowPopup(New PopupOptions("Lap record") With {.Text = "1:02.481 at Castelletto", .Icon = PopupIcon.Trophy, .Sound = UiSound.Notify})| Member | What it does |
|---|---|
ShowPopup(PopupOptions popup) → bool
|
Queues it. False if it wasn't (pop-ups are off, no title; the log says which). |
ShowPopup(string title, string? text = null) → bool
|
The same, with just a title and a line. |
ClearPopup(string? key = null) |
Takes down your waiting pop-up key, or all your waiting ones. One on screen runs its 5 seconds. |
| Property | |
|---|---|
Title |
Shown in capitals; 28 characters. Pass sentence case. |
Text |
The line under it; 45 characters. |
Key |
Up to 32 letters, digits and _. A new pop-up with the same key replaces your waiting one (a score that keeps changing, say). |
Icon |
One of the game's nine pictures (PopupIcon.Trophy, Photo, Payout...), or none. |
Sound |
A UiSound as it appears. None by default, as the game's own. |
Urgent |
Something the player must act on: first in the queue. Two a session; later ones are normal. |
Reply |
It answers the player's own press (a hotkey): shown within 6 seconds or dropped. |
Private |
The text may name people: platform.log gets only your mod and the key. |
ExpireSeconds |
Dropped if it couldn't show for this long (1 to 600; default 120). |
- One queue for every mod, spaced around the game's own notifications. Up to 4 of yours wait; a 5th drops your oldest.
- They wait while the player is in the pause menu, photo mode, a replay, loading or a cutscene. Waiting there doesn't count toward
ExpireSeconds. - The player decides: the platform's Mod pop-ups row and the game's Minor notifications option turn every mod's off. Call
DeclareUi(UiUses.Popups)inOnInitand your mod's page gets a Pop-ups row of its own. -
UI.Notify(title, text)is the simple version: it goes out under Platform.NET's name (see UI and Hud).
A hint with a button in it, shown once rather than every session: a pop-up with your mod's name as its title, after a while of driving.
ShowTip(new TipOptions("tip_boost", "Press {button} for a boost") { Button = Prompt.ForHotkey("Boost") });| Member | What it does |
|---|---|
ShowTip(TipOptions tip) → bool
|
Queues it. False if it was seen, tips are off, or there's a button but no {button} in the text. |
TipSeen(string key) → bool
|
True once it has been seen, in any session. |
SetTipSeen(string key, bool seen = true) |
Marks it seen (and drops it if it's waiting), or not seen, to show it again. |
TipOptions: Key (the seen key: up to 32 letters, digits and _, so tip_boost, not tip.boost), Text (with {button}; 45 characters in all), Button (a Prompt), DelaySeconds (of driving before it shows; default 60), UntilDone (seen only when you call SetTipSeen, once the player has done it), MaxSessions (with UntilDone: shown in at most this many sessions).
- The button is written as the player last pressed: (A) on a pad, [SPACE] on the keyboard.
- At least 3 minutes after any other mod's tip. Which tips were seen is kept in
fh2-mods\platform-seen.txt. - Call
DeclareUi(UiUses.Tips)inOnInitif you use tips: that starts the watch on which device the player used last.
A button shown in a tip or a page's help bar: the game's picture of it on a pad, the key on the keyboard.
| Make one with | |
|---|---|
Prompt.Pad(PadGlyph.Y, "Reload", vk: 'R') |
A controller button, and the key to show for keyboard players. |
Prompt.Key(0x20, "Jump", PadGlyph.A) |
A key, and the button to show for pad players. |
Prompt.ForHotkey("Boost", "Boost") |
One of your hotkeys: whatever the player bound it to. |
new Prompt { Glyph = PadGlyph.X, Word = UiWord.Toggle } |
The game's own word ("Toggle"), in the player's language. |
The game's own message box over the page the player is on: a title, a message, your choices, and Back, which the platform adds.
AddPage(new PageOptions("Saves", "Saves")
{
Selected = row => ShowMessageBox(new MessageBoxOptions("delete", "Delete it?", ["Keep it", "Delete"])
{
Message = "This can't be undone.",
Chosen = c => { if (c == 1) Delete(row); },
}),
});| Member | What it does |
|---|---|
ShowMessageBox(MessageBoxOptions box) → bool
|
Shows it. Only from a callback of one of your pages, settings or title entries; false anywhere else. |
MessageBoxOptions: Key, Title (30 characters), Choices (1 to 99; the safe one first, no Back of your own), Message (200 characters, wrapped), Focus (the choice the focus starts on), Chosen (gets the choice from 0, or MessageBoxOptions.Back, on the game's UI thread; it may never be called if the player leaves another way).
One box at a time, and nothing is queued.
| Member | What it does |
|---|---|
PlaySound(UiSound sound) → bool
|
One of the game's UI sounds (Select, Back, Error, Notify, Shutter...). Never make a sound the only cue. |
UiStatus (property, UiStatus) |
What works now: Popups (they can show this session), PopupsOff, TipsOff, OnScreen (the HUD is up), GameHudHidden, Keyboard (used last). |
DeclareUi(UiUses uses) → bool
|
From OnInit: what you use (Popups, Tips, OwnSwitch). Only honoured while the game starts; a reload keeps what the first copy said. |
| Member | What it does |
|---|---|
SetPageHelp(string pageKey, params Prompt[] prompts) → int
|
The page's help bar, beside the platform's own Back and Select. Only buttons the page can handle: A and B on a page of rows; A, B, X, Y, LB and RB on a page of your own design. Returns how many were taken. |
SetPageHints(string pageKey, params string[] hints) → bool
|
The texts the page's hint line can show (up to 8, 80 characters each). From OnInit or the page's Opened. |
ShowPageHint(string pageKey, int index, HintKind kind = HintKind.Info) → bool
|
Shows one (Info, Attention in orange, Fault in red), or none for -1. |
- Translations: all of these take translated text.
- UI and Hud
Playing
Getting started
Writing mods
- Hosted or NativeAOT?
- Threads
- Reloading and debugging
- Reading game memory safely
- Pop-ups, tips and message boxes
- Translations
The FH2 classes
- Game
- Player
- Vehicle
- World
- Garage, CarCatalog, Profile
- UI and Hud
- Camera
- Audio
- ANNA
- Skills
- Radio
- Livery
- GameDb
- DebugOverlay
- Controller
- GameInput
- GameWindow
- Menus and UiElement
- SettingsTile
- ButtonIcons and Picture
- MapView, PhotoCamera, GarageCamera
More