Back to Home

ESO Lua File v101044

ingame/endlessdungeon/gamepad/endlessdungeonbufftracker_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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
ZO_ENDLESS_DUNGEON_BUFF_GRID_ENTRY_DIMENSIONS_GAMEPAD_X = 111
ZO_ENDLESS_DUNGEON_BUFF_GRID_ENTRY_DIMENSIONS_GAMEPAD_Y = 111
ZO_ENDLESS_DUNGEON_BUFF_GRID_ENTRY_ICON_DIMENSIONS_GAMEPAD_X = 96
ZO_ENDLESS_DUNGEON_BUFF_GRID_ENTRY_ICON_DIMENSIONS_GAMEPAD_Y = 96
ZO_ENDLESS_DUNGEON_BUFF_GRID_ENTRY_PADDING_GAMEPAD_X = 0
ZO_ENDLESS_DUNGEON_BUFF_GRID_ENTRY_PADDING_GAMEPAD_Y = 0
ZO_ENDLESS_DUNGEON_BUFF_GRID_ENTRY_ROW_HEIGHT_GAMEPAD = ZO_ENDLESS_DUNGEON_BUFF_GRID_ENTRY_DIMENSIONS_GAMEPAD_Y + ZO_ENDLESS_DUNGEON_BUFF_GRID_ENTRY_PADDING_GAMEPAD_Y
ZO_ENDLESS_DUNGEON_BUFF_GRID_ENTRY_WIDTH_GAMEPAD = ZO_ENDLESS_DUNGEON_BUFF_GRID_ENTRY_DIMENSIONS_GAMEPAD_X + ZO_ENDLESS_DUNGEON_BUFF_GRID_ENTRY_PADDING_GAMEPAD_X
ZO_ENDLESS_DUNGEON_BUFF_GRID_HEADER_ROW_HEIGHT_GAMEPAD = 50
ZO_ENDLESS_DUNGEON_BUFF_GRID_SECTION_PADDING_GAMEPAD_Y = 20
ZO_ENDLESS_DUNGEON_BUFF_TRACKER_GRID_LIST_MAX_WIDTH_GAMEPAD = 655
ZO_EndlessDungeonBuffTracker_Gamepad = ZO_EndlessDungeonBuffTracker_Shared:Subclass()
function ZO_EndlessDungeonBuffTracker_Gamepad:Initialize(...)
    ZO_EndlessDungeonBuffTracker_Shared.Initialize(self, ...)
    local scene = self:GetScene()
    ENDLESS_DUNGEON_BUFF_TRACKER_SCENE_GAMEPAD = scene
    SYSTEMS:RegisterGamepadRootScene("endlessDungeonBuffTracker", scene)
end
-- Overridden from base
function ZO_EndlessDungeonBuffTracker_Gamepad:OnDeferredInitialize()
    ZO_EndlessDungeonBuffTracker_Shared.OnDeferredInitialize(self)
end
function ZO_EndlessDungeonBuffTracker_Gamepad:InitializeControls()
    ZO_EndlessDungeonBuffTracker_Shared.InitializeControls(self)
    local scene = self:GetScene()
    scene:AddFragmentGroup(FRAGMENT_GROUP.GAMEPAD_DRIVEN_UI_NO_KEYBIND_BACKGROUND_WINDOW)
    scene:AddFragment(MINIMIZE_CHAT_FRAGMENT)
    ApplyTemplateToControl(self.switchToSummaryKeybindButton, "ZO_KeybindButton_Gamepad_Template")
    ApplyTemplateToControl(self.closeKeybindButton, "ZO_KeybindButton_Gamepad_Template")
end
function ZO_EndlessDungeonBuffTracker_Gamepad:InitializeGridList()
    ZO_EndlessDungeonBuffTracker_Shared.InitializeGridList(self, "ZO_EndDunBuffTrackerGridEntry_Gamepad", "ZO_EndDunBuffTrackerGridHeader_Gamepad")
    self.entryDataObjectPool = ZO_EntryDataPool:New(ZO_EntryData)
    local NO_AUTO_FILL_ROWS = nil
    local RESIZE_TO_FIT_COLUMN_MAX = 5
    local RESIZE_TO_FIT_ROW_MAX = 6
    self.gridList = ZO_GridScrollList_Gamepad:New(self.gridListControl, "ZO_GridScrollList_Highlight_Gamepad", NO_AUTO_FILL_ROWS, RESIZE_TO_FIT_COLUMN_MAX, RESIZE_TO_FIT_ROW_MAX)
    local NO_HIDE_CALLBACK = nil
    local NO_RESET_CALLBACK = nil
    local CONSIDER_HEADER_WIDTH = true
    local gridList = self.gridList
    gridList:AddHeaderTemplate("ZO_EndDunBuffTrackerGridHeader_Gamepad", ZO_ENDLESS_DUNGEON_BUFF_GRID_HEADER_ROW_HEIGHT_GAMEPAD, ZO_EndlessDungeonBuffTracker_Shared.SetupGridHeader, NO_HIDE_CALLBACK, NO_RESET_CALLBACK, CONSIDER_HEADER_WIDTH)
    gridList:AddEntryTemplate("ZO_EndDunBuffTrackerGridEntry_Gamepad", ZO_ENDLESS_DUNGEON_BUFF_GRID_ENTRY_DIMENSIONS_GAMEPAD_X, ZO_ENDLESS_DUNGEON_BUFF_GRID_ENTRY_DIMENSIONS_GAMEPAD_Y, ZO_GetCallbackForwardingFunction(self, self.SetupGridEntry), NO_HIDE_CALLBACK, ZO_GetCallbackForwardingFunction(self, self.ResetGridEntry), ZO_ENDLESS_DUNGEON_BUFF_GRID_ENTRY_PADDING_GAMEPAD_X, ZO_ENDLESS_DUNGEON_BUFF_GRID_ENTRY_PADDING_GAMEPAD_Y)
    gridList:SetAutoFillEntryTemplate("ZO_EndDunBuffTrackerEmptyGridEntry_Gamepad")
    gridList:SetEntryTemplateEqualityFunction("ZO_EndDunBuffTrackerGridEntry_Gamepad", self.CompareGridEntries)
    gridList:SetHeaderPrePadding(ZO_ENDLESS_DUNGEON_BUFF_GRID_SECTION_PADDING_GAMEPAD_Y)
    gridList:SetHeaderNarrationFunction(function()
        local narrations = {}
        ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(self.titleText))
        if self.progressionNarrationText then
            for _, progressNarration in ipairs(self.progressionNarrationText) do
                ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(progressNarration))
            end
        end
        if not self.emptyLabel:IsHidden() then
            ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(self.emptyLabel:GetText()))
        end
        return narrations
    end)
end
function ZO_EndlessDungeonBuffTracker_Gamepad:GetSceneName()
    return "endlessDungeonBuffTrackerGamepad"
end
function ZO_EndlessDungeonBuffTracker_Gamepad:OnHiding()
    ZO_EndlessDungeonBuffTracker_Shared.OnHiding(self)
    self.gridList:Deactivate()
    GAMEPAD_TOOLTIPS:ClearTooltip(GAMEPAD_RIGHT_TOOLTIP)
end
function ZO_EndlessDungeonBuffTracker_Gamepad:OnShown()
    ZO_EndlessDungeonBuffTracker_Shared.OnShown(self)
    self.gridList:Activate()
    local ANIMATE_INSTANTLY = true
    local SCROLL_INTO_VIEW = true
    self.gridList:RefreshSelection(ANIMATE_INSTANTLY, SCROLL_INTO_VIEW)
end
function ZO_EndlessDungeonBuffTracker_Gamepad:OnGridEntrySelected(previousData, currentData)
    if currentData then
        self:SetGridEntryFocus(currentData.dataEntry.control, true)
        -- Show the tooltip for the entry that is selected.
        if currentData.abilityId then
            GAMEPAD_TOOLTIPS:LayoutEndlessDungeonBuffAbility(GAMEPAD_RIGHT_TOOLTIP, currentData.abilityId)
            return
        end
    end
    GAMEPAD_TOOLTIPS:ClearTooltip(GAMEPAD_RIGHT_TOOLTIP)
end
function ZO_EndlessDungeonBuffTracker_Gamepad:UpdateGridListDimensions(numVerseEntries, numVisionEntries)
    ZO_EndlessDungeonBuffTracker_Shared.UpdateGridListDimensions(self, numVerseEntries, numVisionEntries, ZO_ENDLESS_DUNGEON_BUFF_TRACKER_GRID_LIST_MAX_WIDTH_GAMEPAD, ZoFontGamepad36, ZO_ENDLESS_DUNGEON_BUFF_GRID_ENTRY_WIDTH_GAMEPAD, ZO_ENDLESS_DUNGEON_BUFF_GRID_ENTRY_ROW_HEIGHT_GAMEPAD, ZO_ENDLESS_DUNGEON_BUFF_GRID_HEADER_ROW_HEIGHT_GAMEPAD, ZO_ENDLESS_DUNGEON_BUFF_GRID_SECTION_PADDING_GAMEPAD_Y)
end
-- Overridden from base
function ZO_EndlessDungeonBuffTracker_Gamepad:UpdateProgress()
    ZO_EndlessDungeonBuffTracker_Shared.UpdateProgress(self)
    if ENDLESS_DUNGEON_MANAGER:IsEndlessDungeonStarted() then
        local stageNarration, cycleNarration, arcNarration = ENDLESS_DUNGEON_MANAGER:GetCurrentProgressionNarrationDescriptions()
        self.progressionNarrationText = { arcNarration, cycleNarration, stageNarration }
        if self:IsShowing() then
            local NARRATE_HEADER = true
            SCREEN_NARRATION_MANAGER:QueueGridListEntry(self.gridList, NARRATE_HEADER)
        end
    else
        self.progressionNarrationText = nil
    end
end
function ZO_EndlessDungeonBuffTracker_Gamepad.OnControlInitialized(control)
    ENDLESS_DUNGEON_BUFF_TRACKER_GAMEPAD = ZO_EndlessDungeonBuffTracker_Gamepad:New(control)
end