Back to Home

ESO Lua File v101041

libraries/zo_templates/gamepad/windowtemplates_gamepad.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
62
function ZO_GamepadEditBox_FocusGained(editControl)
    editControl.descriptor =
    {
        alignment = KEYBIND_STRIP_ALIGN_LEFT,
        {
            name = GetString(SI_GAMEPAD_ACCEPT_OPTION),
            keybind = "UI_SHORTCUT_PRIMARY",
            callback = function()
                editControl:LoseFocus()
            end,
            sound = SOUNDS.DIALOG_ACCEPT,
        },
        {
            name = GetString(SI_CANCEL),
            keybind = "UI_SHORTCUT_NEGATIVE",
            callback = function()
                editControl:SetText(editControl.oldText)
                editControl:LoseFocus()
            end,
            sound = SOUNDS.DIALOG_DECLINE,
        },
        {
            --Ethereal binds show no text, the name field is used to help identify the keybind when debugging. This text does not have to be localized.
            name = "Gamepad Edit Box Accept",
            ethereal = true,
            keybind = "DIALOG_PRIMARY",
            callback = function()
                editControl:LoseFocus()
            end,
            sound = SOUNDS.DIALOG_ACCEPT,
        },
        {
            --Ethereal binds show no text, the name field is used to help identify the keybind when debugging. This text does not have to be localized.
            name = "Gamepad Edit Box Cancel",
            ethereal = true,
            keybind = "DIALOG_NEGATIVE",
            callback = function()
                editControl:SetText(editControl.oldText)
                editControl:LoseFocus()
            end,
            sound = SOUNDS.DIALOG_DECLINE,
        },
    }
    editControl.oldText = editControl:GetText() 
    editControl.m_keybindState = KEYBIND_STRIP:PushKeybindGroupState()
    KEYBIND_STRIP:RemoveDefaultExit(editControl.m_keybindState)
    KEYBIND_STRIP:AddKeybindButtonGroup(editControl.descriptor, editControl.m_keybindState)
end
function ZO_GamepadEditBox_FocusLost(editControl)
    if editControl.descriptor then
        KEYBIND_STRIP:RemoveKeybindButtonGroup(editControl.descriptor, editControl.m_keybindState)
        KEYBIND_STRIP:RestoreDefaultExit(editControl.m_keybindState)
        KEYBIND_STRIP:PopKeybindGroupState()
    end
    if editControl.focusLostCallback then
        editControl.focusLostCallback(editControl)
    end
end