Script v1_7_1_0
- AI
- Animals
- Collections
- Contracts
- Debug
- Economy
- Elements
- EnvironmentalScore
- Errors
- Events
- GUI
- Handtools
- Hud
- I3d
- Input
- Jobs
- Maps
- Materials
- Misc
- Objects
- Parameters
- Placeables
- Placement
- Player
- Shop
- Sounds
- Specialization
- Specializations
- StateMachine
- Statistics
- Tasks
- Triggers
- Utils
- Vehicles
Engine v1_7_1_0
- AI
- Animation
- Camera
- Entity
- Fillplanes
- general
- General
- I3D
- Input
- Lighting
- Math
- Network
- Node
- NoteNode
- Overlays
- Particle System
- Physics
- Rendering
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- VoiceChat
- XML
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
67 | function DialogElement:close() |
68 | g_gui:closeDialogByName(self.name) |
69 | end |
new
DescriptionDefinitionnew()Code
55 | function DialogElement.new(target, custom_mt) |
56 | local self = ScreenElement.new(target, custom_mt or DialogElement_mt) |
57 | |
58 | self.isCloseAllowed = true |
59 | |
60 | self:registerControls(DialogElement.CONTROLS) |
61 | |
62 | return self |
63 | end |
onClickBack
DescriptionDefinitiononClickBack()Code
73 | function DialogElement:onClickBack(forceBack, usedMenuButton) |
74 | if (self.isCloseAllowed or forceBack) and not usedMenuButton then |
75 | self:close() |
76 | return false -- event used |
77 | else |
78 | return true -- event unused |
79 | end |
80 | end |
setDialogType
DescriptionDefinitionsetDialogType()Code
84 | function DialogElement:setDialogType(dialogType) |
85 | dialogType = Utils.getNoNil(dialogType, DialogElement.TYPE_WARNING) |
86 | self.dialogType = dialogType |
87 | |
88 | -- apply element visibility based on dialog type |
89 | for dt, id in pairs(TYPE_ICON_ID_MAPPING) do |
90 | local typeElement = self[id] |
91 | if typeElement then |
92 | typeElement:setVisible(dt == dialogType) |
93 | end |
94 | end |
95 | |
96 | if self.dialogCircle ~= nil then |
97 | self.dialogCircle:setVisible(dialogType ~= DialogElement.TYPE_LOADING) |
98 | end |
99 | end |
setIsCloseAllowed
DescriptionDefinitionsetIsCloseAllowed()Code
103 | function DialogElement:setIsCloseAllowed(isAllowed) |
104 | self.isCloseAllowed = isAllowed |
105 | end |