Back to Home

ESO Lua File v100020

pregame/chapterupgrade/gamepad/chapterupgrade_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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
local ChapterUpgrade_Gamepad = ZO_ChapterUpgrade_Shared:Subclass()
function ChapterUpgrade_Gamepad:New(...)
    return ZO_ChapterUpgrade_Shared.New(self, ...)
end
function ChapterUpgrade_Gamepad:Initialize(control)
    ZO_ChapterUpgrade_Shared.Initialize(self, control, "chapterUpgradeGamepad")
    self.focus = ZO_GamepadFocus:New(control, nil, MOVEMENT_CONTROLLER_DIRECTION_HORIZONTAL)
    
    local enterCodeButton = control:GetNamedChild("EnterCodeButton")
    local enterCodeButtonFocusData = 
    {
        highlight = enterCodeButton:GetNamedChild("Highlight"),
        control = enterCodeButton,
        callback = function() self:EnterCodeButtonClicked() end,
    }
    local upgradeButton = control:GetNamedChild("UpgradeButton")
    local upgradeButtonFocusData = 
    {
        highlight = upgradeButton:GetNamedChild("Highlight"),
        control = upgradeButton,
        callback = function() self:UpgradeButtonClicked() end,
    }
    
    self.focus:AddEntry(enterCodeButtonFocusData)
    self.focus:AddEntry(upgradeButtonFocusData)
    self.keybindStripDescriptor =
    {
        alignment = KEYBIND_STRIP_ALIGN_LEFT,
        {
            keybind = "UI_SHORTCUT_PRIMARY",
            name = GetString(SI_GAMEPAD_SELECT_OPTION),
            callback = function()
                local selection = self.focus:GetFocusItem()
                if selection and selection.callback then
                    selection.callback()
                end
            end,
        },
        {
            keybind = "UI_SHORTCUT_NEGATIVE",
            name = GetString(SI_CHAPTER_UPGRADE_CONTINUE),
            callback = function()
                self:ShowContinueDialog()
            end,
        },
    }
end
function ChapterUpgrade_Gamepad:UpgradeButtonClicked()
    ZO_Dialogs_ShowGamepadDialog("CHAPTER_UPGRADE_STORE_CONSOLE")
end
function ChapterUpgrade_Gamepad:EnterCodeButtonClicked()
    ZO_Dialogs_ShowGamepadDialog("SHOW_REDEEM_CODE_CONSOLE")
end
function ChapterUpgrade_Gamepad:OnShowing()
    ZO_ChapterUpgrade_Shared.OnShowing(self)
    KEYBIND_STRIP:RemoveDefaultExit()
    KEYBIND_STRIP:AddKeybindButtonGroup(self.keybindStripDescriptor)
    self.focus:Activate()
end
function ChapterUpgrade_Gamepad:OnHiding()
    ZO_ChapterUpgrade_Shared.OnHiding(self)
    KEYBIND_STRIP:RemoveKeybindButtonGroup(self.keybindStripDescriptor)
    KEYBIND_STRIP:RestoreDefaultExit()
    self.focus:Deactivate()
end
    CHAPTER_UPGRADE_SCREEN_GAMEPAD = ChapterUpgrade_Gamepad:New(control)
end