ESO Lua File v100011

ingame/help/gamepad/help_entries_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
99
100
101
102
103
104
105
106
107
108
109
local HelpTutorialsEntriesGamepad = ZO_HelpTutorialsGamepad:Subclass()
function HelpTutorialsEntriesGamepad:New(...)
    return ZO_HelpTutorialsGamepad.New(self, ...)
end
function HelpTutorialsEntriesGamepad:Initialize(control)
    ZO_HelpTutorialsGamepad.Initialize(self, control)
    local helpEntriesFragment = ZO_FadeSceneFragment:New(control)
    HELP_TUTORIALS_ENTRIES_GAMEPAD = ZO_Scene:New("helpTutorialsEntriesGamepad", SCENE_MANAGER)
    HELP_TUTORIALS_ENTRIES_GAMEPAD:AddFragment(helpEntriesFragment)
    local function OnStateChanged(...)
        self:OnStateChanged(...)
    end
    HELP_TUTORIALS_ENTRIES_GAMEPAD:RegisterCallback("StateChange", OnStateChanged)
    self.tutorialBox = control:GetNamedChild("TutorialText")
    self.tutorialHeader = self.tutorialBox:GetNamedChild("Header")
    self.tutorialTitle = self.tutorialBox:GetNamedChild("Title")
    self.tutorialText = self.tutorialBox:GetNamedChild("Text")
end
function HelpTutorialsEntriesGamepad:Push(categoryIndex, searchString, searchResults)
    if self.categoryIndex ~= categoryIndex then
        self.dirty = true
    end
    self.searchString = searchString
    self.searchResults = searchResults
    self.categoryIndex = categoryIndex
    SCENE_MANAGER:Push("helpTutorialsEntriesGamepad")
    self:OnSelectionChanged(self.itemList, self.itemList:GetSelectedData(), nil)
end
function HelpTutorialsEntriesGamepad:InitializeKeybindStripDescriptors()
    self.keybindStripDescriptor =
    {
        alignment = KEYBIND_STRIP_ALIGN_LEFT,
        -- Back
        KEYBIND_STRIP:GetDefaultGamepadBackButtonDescriptor(),
    }
    ZO_Gamepad_AddListTriggerKeybindDescriptors(self.keybindStripDescriptor, function() return self.itemList end )
end
function HelpTutorialsEntriesGamepad:AddHelpEntry(categoryIndex, helpIndex)
    local helpName, keyboardDescription1, keyboardDescription2, image, gamepadDescription1, gamepadDescription2 = GetHelpInfo(categoryIndex, helpIndex)
    local entryData = ZO_GamepadEntryData:New(helpName, image)
    entryData.helpIndex = helpIndex
    entryData.description = gamepadDescription1 ~= "" and gamepadDescription1 or keyboardDescription1
    entryData.description2 = gamepadDescription2 ~= "" and gamepadDescription2 or keyboardDescription2
    self.itemList:AddEntry("ZO_GamepadMenuEntryTemplate", entryData)
end
function HelpTutorialsEntriesGamepad:PerformUpdate()
    self.dirty = false
    -- Add the entries.
    self.itemList:Clear()
    if self.searchString and self.searchString ~= "" then
        for i = 1, #self.searchResults do
            local searchResult = self.searchResults[i]
            if searchResult and searchResult.helpCategoryIndex == self.categoryIndex then
                self:AddHelpEntry(self.categoryIndex, searchResult.helpIndex)
            end
        end
    else
        for helpIndex = 1, GetNumHelpEntriesWithinCategory(self.categoryIndex) do
            self:AddHelpEntry(self.categoryIndex, helpIndex)
        end
    end
    self.itemList:Commit()
    -- Update the key bindings.
    KEYBIND_STRIP:UpdateKeybindButtonGroup(self.keybindStripDescriptor)
    -- Update the header.
    local categoryName, _, _, _, _ = GetHelpCategoryInfo(self.categoryIndex)
    self.headerData.titleText = categoryName
    self:SetupSearchHeaderData(self.searchString, self.headerData)
end
function HelpTutorialsEntriesGamepad:OnSelectionChanged(list, selectedData, oldSelectedData)
    if not selectedData then
        return
    end
    local helpName = selectedData.name
    local description = selectedData.description
    local description2 = selectedData.description2
    self.tutorialTitle:SetText(helpName)
    self.tutorialText:SetText(description .. '\n\n' .. description2)
end
function HelpTutorialsEntriesGamepad:OnHide()
    ZO_HelpTutorialsGamepad.OnHide(self)
end
    HELP_TUTORIALS_ENTRIES_GAMEPAD = HelpTutorialsEntriesGamepad:New(control)
end