Back to Home

ESO Lua File v100032

pregame/gamepad/pregametemplates.lua

[◄ back to folders ]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
--[[ Template Initialization and Setup Functions ]]--
-- Text Edit
    control.backdrop = control:GetNamedChild("Backdrop")
    if control.backdrop ~= nil then
        control.edit = control.backdrop:GetNamedChild("Edit")
        control.highlight = control.backdrop:GetNamedChild("Highlight")
    end
    control.text = control:GetNamedChild("Label")
end
function ZO_PregameGamepadTextEditTemplate_Setup(control, data, selected, selectedDuringRebuild, enabled, activated)
    control.contentsChangedCallback = data.contentsChangedCallback
    if data.textType ~= nil then
        control.edit:SetTextType(data.textType)
    end
    if data.contents then
        local contents = data.contents
        if type(contents) == "function" then
            contents = contents(data)
        end
        if contents then
            control.edit:SetText(contents)
        end
    end
    if control.focusedChangedAnimation == nil then
        control.focusedChangedAnimation = ANIMATION_MANAGER:CreateTimelineFromVirtual("GamepadMenuEntryFocusedAnimation", control.highlight)
    end
    local focusChanged = (control.focused ~= selected)
    control.focused = selected
    if focusChanged then
        if control.focused then
            control.focusedChangedAnimation:PlayForward()
        else
            control.focusedChangedAnimation:PlayBackward()
        end
        control.highlight:SetHidden(not control.focused)
    end
end
    local callback = textEdit.contentsChangedCallback
    if callback then
        callback(newText)
    end
end
-- Button with Icon
    control.text = control:GetNamedChild("Label")
    control.label = control.text -- Gamepad templates expects this to be called label
    control.icon = control:GetNamedChild("Icon")
end