ESO Lua File v100015

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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
----------------------
--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_SortFilterListBase.Initialize(self)
end
function ZO_SortFilterList_Gamepad:InitializeSortFilterList(control, magnitudeQueryFunction, scrollListAsBlock)
    ZO_SortFilterList.InitializeSortFilterList(self, control)
    self.scrollListAsBlock = scrollListAsBlock
    self.movementController = ZO_MovementController:New(MOVEMENT_CONTROLLER_DIRECTION_VERTICAL, nil, magnitudeQueryFunction)
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:UpdateDirectionalInput()
    local result = self.movementController:CheckMovement()
    if result == MOVEMENT_CONTROLLER_MOVE_NEXT then
        if self.scrollListAsBlock then
            self:MoveNextAsBlock()
        else
            self:MoveNext()
        end
    elseif result == MOVEMENT_CONTROLLER_MOVE_PREVIOUS then
        if self.scrollListAsBlock then
            self:MovePreviousAsBlock()
        else
            self:MovePrevious()
        end
    end
end
function ZO_SortFilterList_Gamepad:MovePrevious()
    if not ZO_ScrollList_AtTopOfList(self.list) then
        self:RefreshVisible()
        self:UpdateKeybinds()
    end
end
function ZO_SortFilterList_Gamepad:MoveNext()
    if not ZO_ScrollList_AtBottomOfList(self.list) then
        self:RefreshVisible()
        self:UpdateKeybinds()
    end
end
function ZO_SortFilterList_Gamepad:MovePreviousAsBlock()
    if ZO_ScrollList_CanScrollUp(self.list) then
        local atTop, topData = ZO_ScrollList_AtTopOfVisible(self.list)
        if atTop then
            ZO_ScrollList_SelectPreviousData(self.list)
        else
            ZO_ScrollList_SelectDataAndScrollIntoView(self.list, topData)
        end
        self:RefreshVisible()
    end
end
function ZO_SortFilterList_Gamepad:MoveNextAsBlock()
        local atBottom, bottomData = ZO_ScrollList_AtBottomOfVisible(self.list)
        if atBottom then
            ZO_ScrollList_SelectNextData(self.list)
        else
            ZO_ScrollList_SelectDataAndScrollIntoView(self.list, bottomData)
        end
        self:RefreshVisible()
    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