LUADOC - Farming Simulator 19

Script v1.7.1.0

Engine v1.7.1.0

Foundation Reference

DialogElement

Description
Base 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
ScreenElement
Functions

close

Description
Definition
close()
Code
66function DialogElement:close()
67 g_gui:closeDialogByName(self.name)
68end

new

Description
Definition
new()
Code
54function 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
62end

onClickBack

Description
Definition
onClickBack()
Code
72function 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
79end

setDialogType

Description
Definition
setDialogType()
Code
83function 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
102end

setIsCloseAllowed

Description
Definition
setIsCloseAllowed()
Code
106function DialogElement:setIsCloseAllowed(isAllowed)
107 self.isCloseAllowed = isAllowed
108end