Back to Home

ESO Lua File v100026

libraries/zo_sortfilterlist/gamepad/zo_sortfilterlist_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
82
----------------------
--Sort/Filter List
----------------------
ZO_SortFilterList_Gamepad = ZO_SortFilterList:Subclass()
function ZO_SortFilterList_Gamepad:New(...)
    return ZO_SortFilterList.New(self, ...)
end
function ZO_SortFilterList_Gamepad:Initialize(...)
    ZO_SortFilterList.Initialize(self, ...)
    self.movementController = ZO_MovementController:New(MOVEMENT_CONTROLLER_DIRECTION_VERTICAL)
    self.isActive = false
end
function ZO_SortFilterList_Gamepad:InitializeSortFilterList(control)
    ZO_SortFilterList.InitializeSortFilterList(self, control)
    ZO_ScrollList_EnableSelection(self.list, "ZO_GamepadInteractiveSortFilterDefaultHighlight", function(oldData, newData) self:OnSelectionChanged(oldData, newData) end)
end
function ZO_SortFilterList_Gamepad:SetDirectionalInputEnabled(enabled)
    if self.directionalInputEnabled ~= enabled then
        self.directionalInputEnabled = enabled
        if enabled then
            DIRECTIONAL_INPUT:Activate(self, self.control)
        else
            DIRECTIONAL_INPUT:Deactivate(self)
        end
    end
end
function ZO_SortFilterList_Gamepad:IsActivated()
    return self.isActive
end
function ZO_SortFilterList_Gamepad:Activate()
    if not self.isActive then
        self.isActive = true
        self:SetDirectionalInputEnabled(true)
    end
end
function ZO_SortFilterList_Gamepad:Deactivate()
    if self.isActive then
        self:SetDirectionalInputEnabled(false)
        ZO_ScrollList_SelectData(self.list, nil)
        self.isActive = false
    end
end
function ZO_SortFilterList_Gamepad:MovePrevious()
    if not ZO_ScrollList_AtTopOfList(self.list) then
        PlaySound(SOUNDS.GAMEPAD_MENU_UP)
        self:UpdateKeybinds()
    end
end
function ZO_SortFilterList_Gamepad:MoveNext()
    if not ZO_ScrollList_AtBottomOfList(self.list) then
        PlaySound(SOUNDS.GAMEPAD_MENU_DOWN)
        self:UpdateKeybinds()
    end
end
function ZO_SortFilterList_Gamepad:UpdateDirectionalInput()
    local result = self.movementController:CheckMovement()
    if result == MOVEMENT_CONTROLLER_MOVE_NEXT then
        self:MoveNext()
    elseif result == MOVEMENT_CONTROLLER_MOVE_PREVIOUS then
        self:MovePrevious()
    end
end
function ZO_SortFilterList_Gamepad:SetEmptyText(emptyText)
    self.emptyRow = CreateControlFromVirtual("$(parent)EmptyRow", self.list, "ZO_SortFilterListEmptyRow_Gamepad")
    GetControl(self.emptyRow, "Message"):SetText(emptyText)
end