Back to Home

ESO Lua File v101042

ingame/gamepad/zo_gamepadparametricscrolllist_search_screen.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
99
100
101
ZO_Gamepad_ParametricList_Search_Screen = ZO_Object.MultiSubclass(ZO_Gamepad_ParametricList_Screen, ZO_TextSearchObject)
function ZO_Gamepad_ParametricList_Search_Screen:Initialize(searchFilterType, searchContext, ...)
    ZO_Gamepad_ParametricList_Screen.Initialize(self, ...)
    self.searchFilterType = searchFilterType
    local function OnTextSearchTextChanged(editBox)
        self:OnTextSearchTextChanged(editBox)
    end
    self:AddSearch(self.textSearchKeybindStripDescriptor, OnTextSearchTextChanged)
    ZO_TextSearchObject.Initialize(self, searchContext, self:GetSearchEditBox())
end
function ZO_Gamepad_ParametricList_Search_Screen:SetupOnTextChangedHandler()
    -- Due to addition of text search, navigation of the list is now handled by the screen as opposed to the list itself.
    -- As such, Update handler is needed to update the current list.
    self.control:SetHandler("OnUpdate", function() self:OnUpdate() end)
end
function ZO_Gamepad_ParametricList_Search_Screen:OnUpdate()
    local list = self:GetCurrentList()
    if list then
        local listObject = list.list
        if listObject then
            listObject:OnUpdate()
        end
    end
end
-- Overrides ZO_TextSearchObject
function ZO_Gamepad_ParametricList_Search_Screen:OnUpdateSearchResults()
    self:Update()
end
function ZO_Gamepad_ParametricList_Search_Screen:InitializeKeybindStripDescriptors()
    self.textSearchKeybindStripDescriptor =
    {
        {
            alignment = KEYBIND_STRIP_ALIGN_LEFT,
            keybind = "UI_SHORTCUT_PRIMARY",
            name = function()
                return GetString(SI_GAMEPAD_SELECT_OPTION)
            end,
            callback = function()
                self:SetTextSearchFocused(true)
            end,
        },
    }
    ZO_Gamepad_AddBackNavigationKeybindDescriptors(self.textSearchKeybindStripDescriptor, GAME_NAVIGATION_TYPE_BUTTON, function()
        self:OnBackButtonClicked()
    end)
end
function ZO_Gamepad_ParametricList_Search_Screen:PerformUpdate()
    if self.dirty then
        self.dirty = false
        local list = self:GetCurrentList()
        if list then
            list:RefreshList()
        end
    end
end
function ZO_Gamepad_ParametricList_Search_Screen:OnBackButtonClicked()
    -- Default back functionality, override this function for different behaviour
    SCENE_MANAGER:HideCurrentScene()
end
-- Overrides ZO_TextSearchObject
function ZO_Gamepad_ParametricList_Search_Screen:GetSearchEditBox()
    return self.textSearchHeaderFocus
end
-- Overrides ZO_TextSearchObject
function ZO_Gamepad_ParametricList_Search_Screen:GetTextSearchText()
    if self.textSearchHeaderFocus then
        return self.textSearchHeaderFocus:GetText()
    end
    return ""
end
-- Overrides ZO_TextSearchObject
function ZO_Gamepad_ParametricList_Search_Screen:UpdateSearchText()
    if self.textSearchHeaderFocus and self.searchContext then
        self.textSearchHeaderFocus:UpdateTextForContext(self.searchContext)
    end
end
function ZO_Gamepad_ParametricList_Search_Screen:OnShow()
end
function ZO_Gamepad_ParametricList_Search_Screen:OnHiding()
end
function ZO_Gamepad_ParametricList_Search_Screen:MarkDirty(shouldSuppressSearchUpdate)
    TEXT_SEARCH_MANAGER:MarkDirtyByFilterTarget(self.searchFilterType, shouldSuppressSearchUpdate)
end