Script v1.7.1.0
- AI
- Animals
- Contracts
- Debug
- Economy
- Effects
- Events
- Farms
- GUI
- AnimalScreen
- AnimationElement
- BitmapElement
- BoxLayoutElement
- BreadcrumbsElement
- ButtonElement
- ButtonOverlay
- ChatWindow
- CheckedOptionElement
- ClearElement
- ContextActionDisplay
- DialogElement
- FieldInfoDisplay
- FillLevelsDisplay
- FlowLayoutElement
- FocusManager
- FrameElement
- FrameReferenceElement
- GameInfoDisplay
- GamePausedDisplay
- Gui
- GuiDataSource
- GuiElement
- GuiMixin
- GuiOverlay
- GuiProfile
- GuiSoundPlayer
- GuiTopDownCamera
- GuiUtils
- HUDDisplayElement
- HUDElement
- HUDFrameElement
- HUDPopupMessage
- HUDTextDisplay
- IndexChangeSubjectMixin
- IndexStateElement
- InGameIcon
- IngameMap
- IngameMapElement
- InputGlyphElement
- InputHelpDisplay
- ListElement
- ListItemElement
- MapHotspot
- MapOverlayGenerator
- MixerWagonHUDExtension
- MultiTextOptionElement
- MultiValueTween
- Overlay
- PagingElement
- PlaySampleMixin
- RenderElement
- RoundStatusBar
- ScreenElement
- SettingsModel
- SideNotification
- SliderElement
- SpeakerDisplay
- SpeedMeterDisplay
- StableListElement
- StatusBar
- TabbedMenu
- TabbedMenuFrameElement
- TabbedMenuWithDetails
- TableElement
- TableHeaderElement
- TextElement
- TextInputElement
- TimerElement
- ToggleButtonElement
- TopNotification
- Tween
- TweenSequence
- VehicleHUDExtension
- VehicleSchemaDisplay
- VideoElement
- Handtools
- I3d
- Materials
- Misc
- Objects
- Placeables
- Player
- Shop
- Sounds
- Specializations
- Triggers
- Utils
- Vehicles
- Weather
Engine v1.7.1.0
- AI
- Animation
- Camera
- Entity
- Fillplanes
- General
- I3D
- Input
- Lighting
- Math
- Network
- Node
- Overlays
- Particle System
- Physics
- Rendering
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- XML
- general
Foundation Reference
DialogElement
DescriptionBase element for modal dialogs. Dialogs are a specialization of ScreenElement, but work mostly the same in terms of loading and configuration. Much like screens, dialogs are controlled and configured by correspondingly named [dialogName]Dialog.lua and [dialogName]Dialog.xml files.Parent
ScreenElementFunctions
close
DescriptionDefinitionclose()Code
66 | function DialogElement:close() |
67 | g_gui:closeDialogByName(self.name) |
68 | end |
new
DescriptionDefinitionnew()Code
54 | function DialogElement:new(target, custom_mt) |
55 | local self = ScreenElement:new(target, custom_mt or DialogElement_mt) |
56 | |
57 | self.isCloseAllowed = true |
58 | |
59 | self:registerControls(DialogElement.CONTROLS) |
60 | |
61 | return self |
62 | end |
onClickBack
DescriptionDefinitiononClickBack()Code
72 | function DialogElement:onClickBack(forceBack, usedMenuButton) |
73 | if (self.isCloseAllowed or forceBack) and not usedMenuButton then |
74 | self:close() |
75 | return false -- event used |
76 | else |
77 | return true -- event unused |
78 | end |
79 | end |
setDialogType
DescriptionDefinitionsetDialogType()Code
83 | function DialogElement:setDialogType(dialogType) |
84 | dialogType = Utils.getNoNil(dialogType, DialogElement.TYPE_WARNING) |
85 | |
86 | -- apply element visibility based on dialog type |
87 | for dt, id in pairs(TYPE_ICON_ID_MAPPING) do |
88 | local typeElement = self[id] |
89 | if typeElement then |
90 | typeElement:setVisible(dt == dialogType) |
91 | end |
92 | end |
93 | |
94 | -- apply circle profile |
95 | if self.dialogCircle ~= nil then |
96 | if dialogType == DialogElement.TYPE_WARNING then |
97 | self.dialogCircle:applyProfile(DialogElement.DIALOG_CIRCLE_PROFILE) |
98 | else |
99 | self.dialogCircle:applyProfile(DialogElement.DIALOG_CIRCLE_PROFILE_WARNING) |
100 | end |
101 | end |
102 | end |
setIsCloseAllowed
DescriptionDefinitionsetIsCloseAllowed()Code
106 | function DialogElement:setIsCloseAllowed(isAllowed) |
107 | self.isCloseAllowed = isAllowed |
108 | end |