main_menu¶
Source: base/tealdef/gui/menu/main_menu.d.tl
Notes
Shared types of the main menu and the in-game pause menu: page names, the common parameters every menu page receives, save-game groups and release-note data.
Page¶
enum global base/tealdef/gui/menu/main_menu.d.tl:3
global enum Page
Notes
Name of a menu page, passed to CommonMenuParams.setPage.
Details
The main menu handles Main, NewGame, NewGameOrMapSettings, LoadGame, Tutorial, Campaign, ModManager,
Achievements, Settings, Credits, LicensePage and ProgressPage; any other value shows the main page. The
in-game pause menu handles Main (its own start page), SaveGame, LoadGame, Settings and ModManager. No base
game script sets MapEditor or ReleaseNotes (release notes are opened with CommonMenuParams.showReleaseNotes).
NewOrLoadPage¶
enum global base/tealdef/gui/menu/main_menu.d.tl:27
global enum NewOrLoadPage
Notes
Tab of the new-game / map settings page and of the load-game settings.
| Value | Description |
|---|---|
"NewOrLoadMain" |
General settings tab. |
"NewOrLoadAdvanced" |
Advanced settings tab. |
"NewOrLoadMods" |
Mods tab. |
CommonMenuParams¶
record global base/tealdef/gui/menu/main_menu.d.tl:33
global record CommonMenuParams
Notes
Services that the main menu or the in-game pause menu hands to each of its pages as commonParams.
Details
The pause menu fills only setPage, windowContainer, calloutContainerRef, onClose, inGame (true) and
setBlockedForModal. The main menu fills all other fields but not onClose and inGame.
Fields
| Name | Type | Description |
|---|---|---|
windowContainer |
ReactRefWrapApiT<Builtin.WindowContainerDelegateParam, Builtin.WindowAPI> |
Window container of the menu; call windowContainer:get():getApi() to get the Builtin.WindowAPI used to add and remove dialog windows. |
calloutContainerRef |
ReactRefWrapApi0<CalloutApi> |
Ref to the menu's callout container. |
inGame |
boolean |
True when the page is shown in the in-game pause menu; not set (nil) in the main menu. |
fadeIn |
FadeInMode |
Current fade-in state of the main page; nil once the fade-in is over. |
Functions
setPage(Page, params? : any) base/tealdef/gui/menu/main_menu.d.tl:34
Notes
Switches the menu to another page.
Details
The second argument is passed to the new page as its params (e.g. a CampaignParam or a
ProgressPageMissionParam). In the main menu, leaving a page while mods are still downloading first asks the player
in a dialog, and switching also sets the Mod Hub management mode for the new page.
showReleaseNotes(fadeIn? : boolean, closeCallback? : function(), pos? : Vec2f) base/tealdef/gui/menu/main_menu.d.tl:35
Notes
Opens the release-notes window (main menu only).
Details
fadeIn adds the fade-in style class, closeCallback is called when the window closes and pos is the initial
window position.
setBlockedForModal(blocked : boolean) base/tealdef/gui/menu/main_menu.d.tl:38
Notes
Call with true when a modal dialog opens and with false when it closes. Calls are counted, so each true needs a matching false.
onClose() base/tealdef/gui/menu/main_menu.d.tl:39
Notes
Closes the pause menu (pause menu only).
getDLCModState() : GameEditionTextParam base/tealdef/gui/menu/main_menu.d.tl:42
Notes
Returns which edition packs are installed (main menu only).
Returns GameEditionTextParam: A GameEditionTextParam.
triggerBackgroundEvent(pos : Vec2f, forceR? : boolean, forceG? : boolean, forceB? : boolean, forceA? : boolean) base/tealdef/gui/menu/main_menu.d.tl:43
Notes
Starts a highlight effect of the animated main-menu background at a position (main menu only). Ignored if the last background event was less than 0.6 seconds ago.
Details
The background has four effect channels (R, G, B, A) that are used in turn; forceR to forceA select a specific
channel instead.
triggerBackgroundEventBig(pos? : Vec2f) base/tealdef/gui/menu/main_menu.d.tl:44
Notes
Starts the large effect of the animated main-menu background (main menu only); pos defaults to the centre (0.5, 0.5). Ignored if the last background event was less than 0.6 seconds ago.
CommonMenuParams.FadeInMode¶
enum base/tealdef/gui/menu/main_menu.d.tl:46
enum FadeInMode
Notes
Visibility state of the main page while the main menu fades in.
| Value | Description |
|---|---|
"Invisible" |
The main page is still hidden (first frames, to hide transition lag). |
"FadeIn" |
The main page is fading in. |
GroupId¶
record global base/tealdef/gui/menu/main_menu.d.tl:53
global record GroupId
Notes
Identifies a save-game group, i.e. all saves of one game (manual saves, autosaves, ...).
Fields
SaveGroup¶
record global base/tealdef/gui/menu/main_menu.d.tl:58
global record SaveGroup
Notes
Saves of one game grouped together, as returned by savegame_react_util.groupSaves.
Fields
| Name | Type | Description |
|---|---|---|
mostRecent |
SaveGameInfo |
The newest manual save of the group, or the newest save of any type if there is no manual save. |
mostRecentIndex |
integer |
Index of mostRecent in saves. |
saves |
{SaveGameInfo} |
All saves of the group, newest first. |
groupName |
GroupId |
Id of the group. |
GameEditionTextParam¶
record global base/tealdef/gui/menu/main_menu.d.tl:65
global record GameEditionTextParam
Notes
Which edition packs are installed; used to choose the logo and the release-note texts.
Fields
| Name | Type | Description |
|---|---|---|
hasDeluxeDLC |
boolean |
True when the mod urbangames_deluxe_upgrade_pack is installed. |
hasPreorderDLC |
boolean |
True when the mod urbangames_preorder_pack is installed. |
ReleaseNoteData¶
record global base/tealdef/gui/menu/main_menu.d.tl:70
global record ReleaseNoteData
Notes
Content of the release-notes window, returned by data(edition) in /gui/menu/configs/release_notes.lua.
Fields
| Name | Type | Description |
|---|---|---|
infoItemsPerPage |
integer |
How many items are shown per tab page of the window. |
updateMessageID |
integer |
Version number of these release notes; increase it for each new update. |
title |
string |
Window title; a single space is used when nil. |
infoItems |
{InfoItem} |
The items, in display order. |
ReleaseNoteData.InfoItem¶
record base/tealdef/gui/menu/main_menu.d.tl:71
record InfoItem
Notes
One page (text and/or image) of the release notes.
Used in the base game: 1 time in 1 file
base/content/gui/gui/menu/releasenotes_util.tl:8
Fields
ProgressData¶
record global base/tealdef/gui/menu/main_menu.d.tl:90
global record ProgressData
Notes
Mission and save game shown by the loading screen; also the payload of the SetProgressData GUI event.
Fields
| Name | Type | Description |
|---|---|---|
mission |
ResName |
Mission resource being loaded, used for the loading-screen image and text. Optional. |
saveGameId |
SaveGameId |
Save game being loaded; its group name is shown as the title. Optional. |
MissionPageContentParam¶
record global base/tealdef/gui/menu/main_menu.d.tl:95
global record MissionPageContentParam
Notes
Parameters of the mission page content recipe (/gui/menu/mission_page_content.tl) of the campaign page.
Fields
| Name | Type | Description |
|---|---|---|
campaign |
string |
Campaign resource name; .campaign is appended if missing. |
mission |
string |
Mission resource name; .mission is appended if missing. |
Functions
onLoad(onMount : function()) base/tealdef/gui/menu/main_menu.d.tl:98
Notes
Called when the player starts or continues the mission.
Details
The argument is a function that actually loads the mission or save game. The campaign page switches to the
ProgressPage and passes this function as ProgressPageMissionParam.onMount, so loading starts once the loading
screen is shown.
IMenuPageParam¶
interface global base/tealdef/gui/menu/main_menu.d.tl:101
global interface IMenuPageParam
Notes
Parameters every menu page recipe receives: the shared commonParams and page-specific params.
Fields
| Name | Type | Description |
|---|---|---|
commonParams |
CommonMenuParams |
Services of the hosting menu (main menu or pause menu). |
params |
ISpecificParam |
Page-specific parameters, i.e. the second argument of CommonMenuParams.setPage. May be nil. |
IMenuPageParam.ISpecificParam¶
interface base/tealdef/gui/menu/main_menu.d.tl:103
interface ISpecificParam
Notes
Marker interface for the page-specific parameter types (such as CampaignParam or MainPageParam).
CampaignParam¶
record global base/tealdef/gui/menu/main_menu.d.tl:108
global record CampaignParam
Notes
Page parameters of the Campaign page.
Fields
ProgressPageMissionParam¶
record global base/tealdef/gui/menu/main_menu.d.tl:114
global record ProgressPageMissionParam
Notes
Page parameters of the ProgressPage (loading screen).
Fields
| Name | Type | Description |
|---|---|---|
mission |
ResName |
Mission being loaded. |
saveGameId |
SaveGameId |
Save game being loaded. |
Functions
onMount() base/tealdef/gui/menu/main_menu.d.tl:117
Notes
Called once, on the first frame after the loading screen is shown; used to start the actual load.
MainPageParam¶
record global base/tealdef/gui/menu/main_menu.d.tl:120
global record MainPageParam
Notes
Page parameters of the Main page.
Fields
| Name | Type | Description |
|---|---|---|
startWithReleaseNotes |
boolean |
Opens the release notes when the main page appears; the main menu sets it on start when there are unseen release notes. |
MenuPageParam¶
record global base/tealdef/gui/menu/main_menu.d.tl:124
global record MenuPageParam<P is IMenuPageParam.ISpecificParam> is IMenuPageParam
Notes
IMenuPageParam with a typed params field; page recipes declare their parameter as e.g. MenuPageParam<CampaignParam>.
Fields
| Name | Type | Description |
|---|---|---|
params |
P |
Page-specific parameters of type P. May be nil. |