Back to Home

ESO Lua File v101044

ingame/chapterupgrade/gamepad/chapterupgrade_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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
----------
-- Pane --
----------
local CHAPTER_UPGRADE_REWARD_HEADER_DATA = 1
local CHAPTER_UPGRADE_REWARD_EDITION_HEADER_DATA = 2
local CHAPTER_UPGRADE_REWARD_DATA = 3
ZO_CHAPTER_UPGRADE_GAMEPAD_REWARD_ENTRY_HEADER_HEIGHT = 50
ZO_CHAPTER_UPGRADE_GAMEPAD_REWARD_ENTRY_HEIGHT = 80
ZO_ChapterUpgradePane_Gamepad = ZO_Object.MultiSubclass(ZO_ChapterUpgradePane_Shared, ZO_SortFilterList_Gamepad)
function ZO_ChapterUpgradePane_Gamepad:New(...)
    return ZO_ChapterUpgradePane_Shared.New(self, ...)
end
function ZO_ChapterUpgradePane_Gamepad:Initialize(control)
    ZO_ChapterUpgradePane_Shared.Initialize(self, control)
    ZO_SortFilterList_Gamepad.Initialize(self, control)
end
function ZO_ChapterUpgradePane_Gamepad:InitializeSortFilterList(...)
    ZO_SortFilterList_Gamepad.InitializeSortFilterList(self, ...)
    local function SetupRewardsHeader(control, data)
        control.descriptor:SetText(data.text)
        if control.collectorsLabel and data.collectorsLabelText then
            control.collectorsLabel:SetText(data.collectorsLabelText)
        end
    end
    local function SetupReward(control, data)
        control.icon:SetTexture(data.icon)
        control.displayName:SetText(data.text)
        control.standardCheckMark:SetHidden(not data.isStandardReward)
        control.collectorsCheckMark:SetHidden(not data.isCollectorsReward)
    end
    ZO_ScrollList_AddDataType(self.list, CHAPTER_UPGRADE_REWARD_HEADER_DATA, "ZO_ChapterUpgrade_Gamepad_RewardsEntryHeader", ZO_CHAPTER_UPGRADE_GAMEPAD_REWARD_ENTRY_HEADER_HEIGHT, SetupRewardsHeader)
    ZO_ScrollList_AddDataType(self.list, CHAPTER_UPGRADE_REWARD_EDITION_HEADER_DATA, "ZO_ChapterUpgrade_Gamepad_RewardsEditionEntryHeader", ZO_CHAPTER_UPGRADE_GAMEPAD_REWARD_ENTRY_HEADER_HEIGHT, SetupRewardsHeader)
    ZO_ScrollList_AddDataType(self.list, CHAPTER_UPGRADE_REWARD_DATA, "ZO_ChapterUpgrade_Gamepad_RewardsEntry", ZO_CHAPTER_UPGRADE_GAMEPAD_REWARD_ENTRY_HEIGHT, SetupReward)
    ZO_ScrollList_SetTypeSelectable(self.list, CHAPTER_UPGRADE_REWARD_HEADER_DATA, false)
    ZO_ScrollList_SetTypeSelectable(self.list, CHAPTER_UPGRADE_REWARD_EDITION_HEADER_DATA, false)
    ZO_ScrollList_SetTypeCategoryHeader(self.list, CHAPTER_UPGRADE_REWARD_HEADER_DATA, true)
    ZO_ScrollList_SetTypeCategoryHeader(self.list, CHAPTER_UPGRADE_REWARD_EDITION_HEADER_DATA, true)
end
function ZO_ChapterUpgradePane_Gamepad:ShowSelectedDataTooltip()
    local marketProductId = self:GetSelectedProductId()
    if marketProductId ~= 0 then
        local SHOW_PURCHASABLE_HINT = true
        GAMEPAD_TOOLTIPS:LayoutMarketProduct(GAMEPAD_RIGHT_TOOLTIP, marketProductId, SHOW_PURCHASABLE_HINT)
    end
end
function ZO_ChapterUpgradePane_Gamepad:ShowPreviewIndexTooltip()
    local marketProductId = ITEM_PREVIEW_LIST_HELPER_GAMEPAD:GetCurrentPreviewData()
    if marketProductId then
        local SHOW_PURCHASABLE_HINT = true
        GAMEPAD_TOOLTIPS:LayoutMarketProduct(GAMEPAD_RIGHT_TOOLTIP, marketProductId, SHOW_PURCHASABLE_HINT)
    end
end
-- Begin ZO_SortFilterList Overrides --
do
    local function AddRewards(scrollData, rewardsData)
        for _, reward in ipairs(rewardsData) do
            local entryData = ZO_GamepadEntryData:New(reward.displayName, reward.icon)
            entryData:SetDataSource(reward)
            table.insert(scrollData, ZO_ScrollList_CreateDataEntry(CHAPTER_UPGRADE_REWARD_DATA, entryData))
        end
    end
    function ZO_ChapterUpgradePane_Gamepad:FilterScrollList()
        -- We don't need to keep a master list around in this class, so ignore BuildMasterList()
        local scrollData = ZO_ScrollList_GetDataList(self.list)
        ZO_ScrollList_Clear(self.list)
        if self.chapterUpgradeData:IsPreRelease() then
            local prePurchaseRewards = self.chapterUpgradeData:GetPrePurchaseRewards()
            if #prePurchaseRewards > 0 then
                local headerData = ZO_GamepadEntryData:New(GetString(SI_CHAPTER_UPGRADE_PREPURCHASE_HEADER))
                table.insert(scrollData, ZO_ScrollList_CreateDataEntry(CHAPTER_UPGRADE_REWARD_HEADER_DATA, headerData))
                AddRewards(scrollData, prePurchaseRewards)
            end
        end
        
        local editionRewards = self.chapterUpgradeData:GetEditionRewards()
        if #editionRewards > 0 then
            local headerData = ZO_GamepadEntryData:New(GetString(SI_CHAPTER_UPGRADE_CHOOSE_EDITION_HEADER))
            local isContentPass = self.chapterUpgradeData:IsContentPass()
            local collectorsLabelText = isContentPass and GetString(SI_CHAPTER_UPGRADE_CONTENT_PASS_COLLECTORS_REWARDS_HEADER) or GetString(SI_CHAPTER_UPGRADE_COLLECTORS_REWARDS_HEADER)
            headerData.collectorsLabelText = collectorsLabelText
            table.insert(scrollData, ZO_ScrollList_CreateDataEntry(CHAPTER_UPGRADE_REWARD_EDITION_HEADER_DATA, headerData))
            AddRewards(scrollData, editionRewards)
        end
    end
end
function ZO_ChapterUpgradePane_Gamepad:UpdateKeybinds()
    ZO_CHAPTER_UPGRADE_GAMEPAD:RefreshKeybinds()
end
function ZO_ChapterUpgradePane_Gamepad:OnSelectionChanged(oldData, newData)
    ZO_SortFilterList_Gamepad.OnSelectionChanged(self, oldData, newData)
    local RETAIN_FRAGMENT = true
    ZO_CHAPTER_UPGRADE_GAMEPAD:RefreshTooltip(RETAIN_FRAGMENT)
end
function ZO_ChapterUpgradePane_Gamepad:GetNarrationText()
    local narrations = {}
    local selectedData = self:GetSelectedData()
    if selectedData then
        ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(selectedData.text))
        if selectedData.isStandardReward then
            ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(GetString(SI_CHAPTER_UPGRADE_STANDARD_REWARDS_HEADER)))
        end
        if selectedData.isCollectorsReward then
            local isContentPass = self.chapterUpgradeData:IsContentPass()
            local collectorsHeaderText = isContentPass and GetString(SI_CHAPTER_UPGRADE_CONTENT_PASS_COLLECTORS_REWARDS_HEADER) or GetString(SI_CHAPTER_UPGRADE_COLLECTORS_REWARDS_HEADER)
            ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(collectorsHeaderText))
        end
    end
    return narrations
end
-- End ZO_SortFilterList Overrides --
-- Begin ZO_ChapterUpgradePane_Shared Overrides --
function ZO_ChapterUpgradePane_Gamepad:SetChapterUpgradeData(data)
    ZO_ChapterUpgradePane_Shared.SetChapterUpgradeData(self, data)
    self:RefreshData()
end
function ZO_ChapterUpgradePane_Gamepad:GetSelectedProductId()
    local selectedData = ZO_ScrollList_GetAutoSelectData(self.list)
    if selectedData then
        return selectedData.marketProductId
    end
    return 0
end
function ZO_ChapterUpgradePane_Gamepad:GetItemPreviewListHelper()
    return ITEM_PREVIEW_LIST_HELPER_GAMEPAD
end
-- End ZO_ChapterUpgradePane_Shared Overrides --
------------
-- Screen --
------------
local SELECTION_MODE =
{
    CHAPTER = 1,
    REWARD = 2,
}
ZO_ChapterUpgrade_Gamepad = ZO_Gamepad_ParametricList_Screen:Subclass()
function ZO_ChapterUpgrade_Gamepad:New(...)
    return ZO_Gamepad_ParametricList_Screen.New(self, ...)
end
function ZO_ChapterUpgrade_Gamepad:Initialize(control)
    ZO_GAMEPAD_CHAPTER_UPGRADE_SCENE = ZO_Scene:New("chapterUpgradeGamepad", SCENE_MANAGER)
    local ACTIVATE_ON_SHOW = true
    ZO_Gamepad_ParametricList_Screen.Initialize(self, control, ZO_GAMEPAD_HEADER_TABBAR_DONT_CREATE, ACTIVATE_ON_SHOW, ZO_GAMEPAD_CHAPTER_UPGRADE_SCENE)
    self.headerData =
    {
        titleText = GetString(SI_MAIN_MENU_CHAPTERS),
    }
    self.categoryList = self:GetMainList()
    local rightPaneContentsControl = control:GetNamedChild("RightPaneContents")
    self.chapterUpgradePane = ZO_ChapterUpgradePane_Gamepad:New(rightPaneContentsControl)
    GAMEPAD_CHAPTER_UPGRADE_FRAGMENT = ZO_SimpleSceneFragment:New(control)
    GAMEPAD_CHAPTER_UPGRADE_FRAGMENT:SetHideOnSceneHidden(true)
    GAMEPAD_CHAPTER_UPGRADE_PANE_FRAGMENT = ZO_FadeSceneFragment:New(rightPaneContentsControl)
    ZO_CHAPTER_UPGRADE_MANAGER:RegisterCallback("ChapterUpgradeDataUpdated", function() self:Update() end)
    local function OnRequestShowGamepadChapterUpgrade(eventId, chapterUpgradeId)
        if IsInGamepadPreferredMode() then
            self:RequestShowChapterUpgrade(chapterUpgradeId)
        end
    end
    EVENT_MANAGER:RegisterForEvent("ZO_ChapterUpgrade_Gamepad", EVENT_REQUEST_SHOW_GAMEPAD_CHAPTER_UPGRADE, OnRequestShowGamepadChapterUpgrade)
    EVENT_MANAGER:RegisterForEvent("ZO_ChapterUpgrade_Gamepad", EVENT_COLLECTIBLES_UNLOCK_STATE_CHANGED, function() self:Update() end)
    self.selectionMode = SELECTION_MODE.CHAPTER
    local chapterUpgradeSceneGroup = ZO_SceneGroup:New("chapterUpgradeGamepad", "chapterUpgradePreviewGamepad")
    chapterUpgradeSceneGroup:RegisterCallback("StateChange", function(_, newState)
        if newState == SCENE_GROUP_SHOWING then
            self:OnSceneGroupShowing()
        elseif newState == SCENE_GROUP_HIDDEN then
            self:OnSceneGroupHidden()
        end
    end)
    SCENE_MANAGER:AddSceneGroup("gamepad_chapterUpgrade_scenegroup", chapterUpgradeSceneGroup)
end
function ZO_ChapterUpgrade_Gamepad:InitializeKeybindStripDescriptors()
    -- Category Keybind
    self.keybindStripDescriptor =
    {
        alignment = KEYBIND_STRIP_ALIGN_LEFT,
        -- Select
        {
            name = function()
                if self.selectionMode == SELECTION_MODE.CHAPTER then
                    return GetString(SI_GAMEPAD_SELECT_OPTION)
                else
                    return GetString(SI_ITEM_ACTION_PREVIEW)
                end
            end,
            keybind = "UI_SHORTCUT_PRIMARY",
            sound = SOUNDS.GAMEPAD_MENU_FORWARD,
            visible = function()
                return self.chapterUpgradePane:HasEntries()
            end,
            enabled = function()
                return self.selectionMode == SELECTION_MODE.CHAPTER or self.chapterUpgradePane:CanPreviewSelection()
            end,
            callback = function()
                if self.selectionMode == SELECTION_MODE.CHAPTER then
                    self:SwitchView()
                else
                    self:Preview()
                end
            end,
        },
        -- Upgrade
        {
            alignment = KEYBIND_STRIP_ALIGN_CENTER,
            name = function()
                local chapterUpgradeTargetData = self.categoryList:GetTargetData()
                if chapterUpgradeTargetData:IsPreRelease() then
                    return GetString(SI_CHAPTER_UPGRADE_GAMEPAD_PREPURCHASE_KEYBIND)
                else
                    return GetString(SI_CHAPTER_UPGRADE_GAMEPAD_UPGRADE_KEYBIND)
                end
            end,
            keybind = "UI_SHORTCUT_SECONDARY",
            
            visible = function()
                local chapterUpgradeData = self.categoryList:GetTargetData()
                return chapterUpgradeData and not chapterUpgradeData:IsOwned()
            end,
            callback = function()
                ZO_Dialogs_ShowGamepadDialog("GAMEPAD_CHAPTER_UPGRADE_CHOOSE_EDITION", { chapterUpgradeData = self.categoryList:GetTargetData(), })
            end,
        },
        {
            --Ethereal binds show no text, the name field is used to help identify the keybind when debugging. This text does not have to be localized.
            name = "Gamepad Chapter Upgrade Previous Section in List",
            keybind = "UI_SHORTCUT_LEFT_TRIGGER",
            ethereal = true,
            callback = function()
                if ZO_ScrollList_CanScrollUp(self.chapterUpgradePane.list) then
                    ZO_ScrollList_SelectFirstIndexInCategory(self.chapterUpgradePane.list, ZO_SCROLL_SELECT_CATEGORY_PREVIOUS)
                    PlaySound(ZO_PARAMETRIC_SCROLL_MOVEMENT_SOUNDS[ZO_PARAMETRIC_MOVEMENT_TYPES.JUMP_PREVIOUS])
                end
            end,
            enabled = function()
                return self.selectionMode == SELECTION_MODE.REWARD
            end,
        },
        {
            --Ethereal binds show no text, the name field is used to help identify the keybind when debugging. This text does not have to be localized.
            name = "Gamepad Chapter Upgrade Next Section in List",
            keybind = "UI_SHORTCUT_RIGHT_TRIGGER",
            ethereal = true,
            callback = function()
                if ZO_ScrollList_CanScrollDown(self.chapterUpgradePane.list) then
                    ZO_ScrollList_SelectFirstIndexInCategory(self.chapterUpgradePane.list, ZO_SCROLL_SELECT_CATEGORY_NEXT)
                    PlaySound(ZO_PARAMETRIC_SCROLL_MOVEMENT_SOUNDS[ZO_PARAMETRIC_MOVEMENT_TYPES.JUMP_NEXT])
                end
            end,
           enabled = function()
                return self.selectionMode == SELECTION_MODE.REWARD
            end,
        },
    }
    local function BackCallback()
        if self.selectionMode == SELECTION_MODE.CHAPTER then
            SCENE_MANAGER:HideCurrentScene()
        else
            self:SwitchView()
        end
    end
    ZO_Gamepad_AddBackNavigationKeybindDescriptors(self.keybindStripDescriptor, GAME_NAVIGATION_TYPE_BUTTON, BackCallback)
    self.previewKeybindStripDesciptor =
    {
        KEYBIND_STRIP:GetDefaultGamepadBackButtonDescriptor()
    }
end
function ZO_ChapterUpgrade_Gamepad:InitializePreviewScene()
    ZO_GAMEPAD_CHAPTER_UPGRADE_PREVIEW_SCENE = ZO_Scene:New("chapterUpgradePreviewGamepad", SCENE_MANAGER)
    local RefreshTooltipFunction = function() self:RefreshTooltip() end
    local function PreviewSceneOnStateChange(oldState, newState)
        if newState == SCENE_SHOWING then
            KEYBIND_STRIP:AddKeybindButtonGroup(self.previewKeybindStripDesciptor)
            ITEM_PREVIEW_LIST_HELPER_GAMEPAD:RegisterCallback("OnPreviewChanged", RefreshTooltipFunction)
        elseif newState == SCENE_SHOWN then
            --Preventing an out of order issue with the begin preview mode
            self.chapterUpgradePane:PreviewSelection()
        elseif newState == SCENE_HIDDEN then
            KEYBIND_STRIP:RemoveKeybindButtonGroup(self.previewKeybindStripDesciptor)
            ITEM_PREVIEW_LIST_HELPER_GAMEPAD:UnregisterCallback("OnPreviewChanged", RefreshTooltipFunction)
        end
    end
    ZO_GAMEPAD_CHAPTER_UPGRADE_PREVIEW_SCENE:RegisterCallback("StateChange", PreviewSceneOnStateChange)
end
function ZO_ChapterUpgrade_Gamepad:OnSceneGroupShowing()
    ZO_CHAPTER_UPGRADE_MANAGER:RequestPrepurchaseData()
end
function ZO_ChapterUpgrade_Gamepad:OnSceneGroupHidden()
    self.selectionMode = SELECTION_MODE.CHAPTER
end
function ZO_ChapterUpgrade_Gamepad:RefreshActiveList()
    if self.selectionMode == SELECTION_MODE.CHAPTER then
        self.chapterUpgradePane:Deactivate()
        self:ActivateCurrentList()
    else
        self:DeactivateCurrentList()
        self.chapterUpgradePane:Activate()
    end
    self:RefreshTooltip()
end
do
    local function AddChapterUpgradeEntry(list, chapterUpgradeData)
        local entryData = ZO_GamepadEntryData:New(chapterUpgradeData:GetFormattedName(), chapterUpgradeData:GetCollectibleIcon())
        if chapterUpgradeData:IsNew() and not chapterUpgradeData:IsOwned() then
            entryData:SetNew(true)
        end
        entryData:SetDataSource(chapterUpgradeData)
        entryData:SetIconTintOnSelection(true)
        list:AddEntry("ZO_GamepadMenuEntryTemplate", entryData)
    end
    function ZO_ChapterUpgrade_Gamepad:BuildCategories()
        self.categoryList:Clear()
        for index = 1, ZO_CHAPTER_UPGRADE_MANAGER:GetNumChapterUpgrades() do
            local chapterUpgradeData = ZO_CHAPTER_UPGRADE_MANAGER:GetChapterUpgradeDataByIndex(index)
            AddChapterUpgradeEntry(self.categoryList, chapterUpgradeData)
        end
        self.categoryList:Commit()
        -- If we're rebuilding the categories, we rebuilt the rewards as well, so if we're in rewards view we want to come back out to the categories
        if self.selectionMode ~= SELECTION_MODE.CHAPTER then
            self:SwitchView()
        end
    end
end
function ZO_ChapterUpgrade_Gamepad:RefreshTooltip(retainFragment)
    GAMEPAD_TOOLTIPS:ClearTooltip(GAMEPAD_RIGHT_TOOLTIP, retainFragment)
    if self.selectionMode == SELECTION_MODE.CHAPTER then
        local selectedData = self.categoryList:GetSelectedData()
        GAMEPAD_TOOLTIPS:LayoutTitleAndDescriptionTooltip(GAMEPAD_RIGHT_TOOLTIP, selectedData:GetFormattedName(), selectedData:GetSummary())
    elseif ZO_GAMEPAD_CHAPTER_UPGRADE_PREVIEW_SCENE:IsShowing() then
        self.chapterUpgradePane:ShowPreviewIndexTooltip()
    else
        self.chapterUpgradePane:ShowSelectedDataTooltip()
    end
end
function ZO_ChapterUpgrade_Gamepad:SwitchView()
    if self.selectionMode == SELECTION_MODE.CHAPTER then
        self.selectionMode = SELECTION_MODE.REWARD
    else
        self.selectionMode = SELECTION_MODE.CHAPTER
    end
end
function ZO_ChapterUpgrade_Gamepad:Preview()
    SCENE_MANAGER:Push("chapterUpgradePreviewGamepad")
end
function ZO_ChapterUpgrade_Gamepad:TrySelectQueuedChapterUpgrade()
    if self.queuedChapterUpgradeId ~= nil and GetMarketState(MARKET_DISPLAY_GROUP_CHAPTER_UPGRADE) == MARKET_STATE_OPEN then
        local function IsQueuedChapterUpgrade(data)
            return data.chapterUpgradeId == self.queuedChapterUpgradeId
        end
        self.categoryList:SetSelectedDataByEval(IsQueuedChapterUpgrade)
        self.queuedChapterUpgradeId = nil
    end
end
function ZO_ChapterUpgrade_Gamepad:RequestShowChapterUpgrade(chapterUpgradeId)
    self.queuedChapterUpgradeId = chapterUpgradeId
    if SCENE_MANAGER:IsShowing("chapterUpgradeGamepad") then
        if self.selectionMode == SELECTION_MODE.CHAPTER then
            self:TrySelectQueuedChapterUpgrade()
        end
    else
        SCENE_MANAGER:Show("chapterUpgradeGamepad")
    end
end
function ZO_ChapterUpgrade_Gamepad:InitializeSelectEditionDialog()
    ZO_Dialogs_RegisterCustomDialog("GAMEPAD_CHAPTER_UPGRADE_CHOOSE_EDITION",
    {
        canQueue = true,
        gamepadInfo = 
        {
            dialogType = GAMEPAD_DIALOGS.PARAMETRIC,
        },
        setup = function(dialog)
            dialog:setupFunc()
        end,
        title =
        {
            text = SI_CHAPTER_UPGRADE_GAMEPAD_SELECT_EDITION_DIALOG_TITLE,
        },
        parametricList =
        {
            -- Collector's
            {
                template = "ZO_GamepadMenuEntryTemplate",
                templateData =
                {
                    text = function(dialog)
                        if dialog.data.chapterUpgradeData:IsContentPass() then
                            return GetString(SI_CHAPTER_UPGRADE_CONTENT_PASS_GAMEPAD_SELECT_EDITION_DIALOG_COLLECTORS_ENTRY)
                        else
                            return GetString(SI_CHAPTER_UPGRADE_GAMEPAD_SELECT_EDITION_DIALOG_COLLECTORS_ENTRY)
                        end
                    end,
                    setup = ZO_SharedGamepadEntry_OnSetup,
                    isCollectorsEdition = true,
                },
            },
            -- Standard
            {
                template = "ZO_GamepadMenuEntryTemplate",
                templateData =
                {
                    text = GetString(SI_CHAPTER_UPGRADE_GAMEPAD_SELECT_EDITION_DIALOG_STANDARD_ENTRY),
                    setup = ZO_SharedGamepadEntry_OnSetup,
                    isCollectorsEdition = false,
                },
            },
        },
        buttons =
        {
            {
                keybind = "DIALOG_PRIMARY",
                text = SI_GAMEPAD_SELECT_OPTION,
                callback =  function(dialog)
                    local entryData = dialog.entryList:GetTargetData()
                    if dialog.data.chapterUpgradeData:IsPreRelease() then
                        ZO_ShowChapterPrepurchasePlatformDialog(dialog.data.chapterUpgradeData:GetChapterUpgradeId(), entryData.isCollectorsEdition, CHAPTER_UPGRADE_SOURCE_IN_GAME)
                    else
                        ZO_ShowChapterUpgradePlatformDialog(entryData.isCollectorsEdition, CHAPTER_UPGRADE_SOURCE_IN_GAME)
                    end
                end,
            },
            {
                keybind = "DIALOG_NEGATIVE",
                text = SI_DIALOG_CANCEL,
            },
        }
    })
end
-- Begin ZO_Gamepad_ParametricList_Screen Overrides --
function ZO_ChapterUpgrade_Gamepad:OnShowing()
    ZO_Gamepad_ParametricList_Screen.OnShowing(self)
end
function ZO_ChapterUpgrade_Gamepad:OnHiding()
    self.chapterUpgradePane:Deactivate()
    GAMEPAD_TOOLTIPS:ClearTooltip(GAMEPAD_RIGHT_TOOLTIP)
end
function ZO_ChapterUpgrade_Gamepad:PerformUpdate()
    self.dirty = false
end
function ZO_ChapterUpgrade_Gamepad:OnSelectionChanged(list, selectedData, oldSelectedData)
    self.chapterUpgradePane:SetChapterUpgradeData(selectedData)
        
    local RETAIN_FRAGMENT = true
    self:RefreshTooltip(RETAIN_FRAGMENT)
end
-- End ZO_Gamepad_ParametricList_Screen Overrides --
-- Begin Global XML Functions --
    ZO_CHAPTER_UPGRADE_GAMEPAD = ZO_ChapterUpgrade_Gamepad:New(control)
end
-- End Global XML Functions --