Back to Home

ESO Lua File v101044

ingame/groupfinder/gamepad/groupfinder_createeditgrouplisting_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
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
--------------------------------------------
-- Group Finder Create Edit Group Listing --
--------------------------------------------
ZO_GroupFinder_CreateEditGroupListing_Gamepad = ZO_GroupFinder_CreateEditGroupListing_Shared:Subclass()
function ZO_GroupFinder_CreateEditGroupListing_Gamepad:Initialize()
    ZO_GroupFinder_CreateEditGroupListing_Shared.Initialize(self)
end
function ZO_GroupFinder_CreateEditGroupListing_Gamepad:InitializeCreateEditDialog()
    local function GetDialogText()
        if self.userTypeData:GetUserType() == GROUP_FINDER_GROUP_LISTING_USER_TYPE_CREATED_GROUP_LISTING then
            return GetString(SI_GROUP_FINDER_CONFIRM_EDIT_GROUP)
        else
            return GetString(SI_GAMEPAD_GROUP_FINDER_CREATE_GROUP)
        end
    end
    local function setupFunction(dialog)
        self:UpdateUserType()
        self.showInviteCode = true
        local titleText = GetDialogText()
        if not dialog.dropdowns then
            dialog.dropdowns = {}
        end
        dialog:setupFunc()
    end
    local function OnReleaseDialog(dialog)
        if dialog.dropdowns then
            for _, dropdown in ipairs(dialog.dropdowns) do
                dropdown:Deactivate()
            end
        end
        dialog.dropdowns = nil
        CancelEditGroupListing()
    end
    ZO_Dialogs_RegisterCustomDialog("GROUP_FINDER_CREATE_EDIT_GROUP_LISTING_GAMEPAD",
    {
        canQueue = true,
        gamepadInfo =
        {
            dialogType = GAMEPAD_DIALOGS.PARAMETRIC,
            allowRightStickPassThrough = true,
        },
        setup = setupFunction,
        parametricList = self:BuildCreateEditList(),
        blockDialogReleaseOnPress = true,
        parametricListOnSelectionChangedCallback = function(dialog, list, newSelectedData, oldSelectedData)
            if newSelectedData and newSelectedData.isTitle then
                self:UpdateTitleTooltip(dialog)
            else
                ZO_GenericGamepadDialog_HideTooltip(dialog)
            end
        end,
        parametricListOnActivatedChangedCallback = function(list, isActive)
            if not isActive then
                local selectedControl = list:GetSelectedControl()
                if selectedControl and selectedControl.roleSpinner then
                    selectedControl.roleSpinner:SetActive(false)
                end
            end
        end,
        buttons =
        {
            {
                keybind = "DIALOG_PRIMARY",
                text = SI_GAMEPAD_SELECT_OPTION,
                callback = function(dialog)
                    local targetData = dialog.entryList:GetTargetData()
                    if targetData and targetData.callback then
                        targetData.callback(dialog)
                    end
                end,
                visible = function(dialog)
                    local targetData = dialog.entryList:GetTargetData()
                    if targetData and targetData.roleType then
                        return false
                    end
                    return true
                end,
                enabled = function(dialog)
                    local targetData = dialog.entryList:GetTargetData()
                    if targetData then
                        if type(targetData.enabled) == "function" then
                            return targetData.enabled()
                        else
                            return targetData.enabled
                        end
                    end
                end,
            },
            {
                keybind = "DIALOG_NEGATIVE",
                text = SI_GAMEPAD_BACK_OPTION,
                callback =  function(dialog)
                    ZO_Dialogs_ReleaseDialogOnButtonPress("GROUP_FINDER_CREATE_EDIT_GROUP_LISTING_GAMEPAD")
                end,
            },
            {
                keybind = "DIALOG_SECONDARY",
                text = GetDialogText,
                enabled = function(dialog)
                    local IS_EDITING = true
                    return ZO_GroupFinder_CanDoCreateEdit(self.userTypeData, self.groupTitleEditControl, IS_EDITING)
                end,
                callback = function(dialog)
                    self:DoCreateEdit()
                    -- TODO GroupFinder: Put up waiting dialog while create request is sent to server
                    ZO_Dialogs_ReleaseDialogOnButtonPress("GROUP_FINDER_CREATE_EDIT_GROUP_LISTING_GAMEPAD")
                end,
            },
            {
                keybind = "DIALOG_TERTIARY",
                text = function()
                    return self.showInviteCode and GetString(SI_EDIT_BOX_HIDE_PASSWORD) or GetString(SI_EDIT_BOX_SHOW_PASSWORD)
                end,
                callback = function(dialog)
                    local data = dialog.entryList:GetTargetData()
                    data.togglePasswordCallback(dialog)
                    ZO_GenericGamepadDialog_RefreshKeybinds(dialog)
                    --Re-narrate since keybind will have changed
                    SCREEN_NARRATION_MANAGER:QueueDialog(dialog)
                end,
                visible = function(dialog)
                    local data = dialog.entryList:GetTargetData()
                    if data and data.togglePasswordCallback then
                        return true
                    end
                    return false
                end,
            },
        },
        onHidingCallback = OnReleaseDialog,
        noChoiceCallback = OnReleaseDialog,
    })
end
function ZO_GroupFinder_CreateEditGroupListing_Gamepad:ShowDialog()
    self:Refresh()
    ZO_Dialogs_ShowGamepadDialog("GROUP_FINDER_CREATE_EDIT_GROUP_LISTING_GAMEPAD")
end
function ZO_GroupFinder_CreateEditGroupListing_Gamepad:Refresh()
    -- Clear entry control references before refresh because rebuilding the dialog will recycle the control
    self.categoryDropdown = nil
    self.primaryOptionDropdown = nil
    self.secondaryOptionDropdown = nil
    self.sizeDropdown = nil
    self.groupTitleEditControl = nil
    self.descriptionEditControl = nil
    self.playstyleDropdown = nil
    self.championCheckbox = nil
    self.championPointsEditBoxControl = nil
    self.voipCheckbox = nil
    self.inviteCodeCheckbox = nil
    self.inviteCodeEditBoxControl = nil
    self.autoAcceptCheckbox = nil
    self.enforceRolesCheckbox = nil
    ZO_GroupFinder_CreateEditGroupListing_Shared.Refresh(self)
    local dialog = ZO_Dialogs_FindDialog("GROUP_FINDER_CREATE_EDIT_GROUP_LISTING_GAMEPAD")
    if dialog then
        local RESELECT_ENTRY = true
        local DONT_LIMIT_NUM_ENTRIES = nil
        ZO_GenericParametricListGamepadDialogTemplate_RebuildEntryList(dialog, DONT_LIMIT_NUM_ENTRIES, RESELECT_ENTRY)
    end
end
do
    local MAX_CP_ALLOWED = GetMaxSpendableChampionPointsInAttribute() * GetNumChampionDisciplines()
    function ZO_GroupFinder_CreateEditGroupListing_Gamepad:BuildCreateEditList(category)
        -- TODO GroupFinder: Populate the dropdowns from the client
        local parametricList = {}
        local categoryEntry =
        {
            template = "ZO_GamepadDropdownItem",
            headerTemplate = "ZO_GamepadMenuEntryFullWidthHeaderTemplate",
            header = GetString(SI_GAMEPAD_GROUP_FINDER_FILTERS_CATEGORY),
            templateData =
            {
                setup = function(control, data, selected, reselectingDuringRebuild, enabled, active)
                    local dialog = data.dialog
                    self.categoryDropdown = control.dropdown
                    table.insert(dialog.dropdowns, self.categoryDropdown)
                    self.categoryDropdown:SetNormalColor(ZO_GAMEPAD_COMPONENT_COLORS.UNSELECTED_INACTIVE:UnpackRGB())
                    self.categoryDropdown:SetHighlightedColor(ZO_GAMEPAD_COMPONENT_COLORS.SELECTED_ACTIVE:UnpackRGB())
                    self.categoryDropdown:SetSelectedItemTextColor(selected)
                    self:PopulateCategoryDropdown()
                    SCREEN_NARRATION_MANAGER:RegisterDialogDropdown(dialog, self.categoryDropdown)
                end,
                callback = function(dialog)
                    local targetControl = dialog.entryList:GetTargetControl()
                    targetControl.dropdown:Activate()
                end,
                visible = function(dialog)
                    return self.userTypeData:GetUserType() == GROUP_FINDER_GROUP_LISTING_USER_TYPE_GROUP_LISTING_DRAFT
                end,
            },
        }
        table.insert(parametricList, categoryEntry)
        local primaryOptionEntry =
        {
            template = "ZO_GamepadDropdownItem",
            headerTemplate = "ZO_GamepadMenuEntryFullWidthHeaderTemplate",
            templateData =
            {
                setup = function(control, data, selected, reselectingDuringRebuild, enabled, active)
                    local dialog = data.dialog
                    self.primaryOptionDropdown = control.dropdown
                    table.insert(dialog.dropdowns, self.primaryOptionDropdown)
                    self.primaryOptionDropdown:SetNormalColor(ZO_GAMEPAD_COMPONENT_COLORS.UNSELECTED_INACTIVE:UnpackRGB())
                    self.primaryOptionDropdown:SetHighlightedColor(ZO_GAMEPAD_COMPONENT_COLORS.SELECTED_ACTIVE:UnpackRGB())
                    self.primaryOptionDropdown:SetSelectedItemTextColor(selected)
                    self:PopulatePrimaryDropdown()
                    SCREEN_NARRATION_MANAGER:RegisterDialogDropdown(dialog, self.primaryOptionDropdown)
                end,
                callback = function(dialog)
                    local targetControl = dialog.entryList:GetTargetControl()
                    targetControl.dropdown:Activate()
                end,
                visible = function(dialog)
                    local groupFinderCategory = self.userTypeData:GetCategory()
                    return self.userTypeData:GetUserType() == GROUP_FINDER_GROUP_LISTING_USER_TYPE_GROUP_LISTING_DRAFT
                        and groupFinderCategory ~= GROUP_FINDER_CATEGORY_ENDLESS_DUNGEON
                        and groupFinderCategory ~= GROUP_FINDER_CATEGORY_CUSTOM
                end,
            },
        }
        table.insert(parametricList, primaryOptionEntry)
        local secondaryOptionEntry =
        {
            template = "ZO_GamepadDropdownItem",
            headerTemplate = "ZO_GamepadMenuEntryFullWidthHeaderTemplate",
            templateData =
            {
                setup = function(control, data, selected, reselectingDuringRebuild, enabled, active)
                    local dialog = data.dialog
                    self.secondaryOptionDropdown = control.dropdown
                    table.insert(dialog.dropdowns, self.secondaryOptionDropdown)
                    self.secondaryOptionDropdown:SetNormalColor(ZO_GAMEPAD_COMPONENT_COLORS.UNSELECTED_INACTIVE:UnpackRGB())
                    self.secondaryOptionDropdown:SetHighlightedColor(ZO_GAMEPAD_COMPONENT_COLORS.SELECTED_ACTIVE:UnpackRGB())
                    self.secondaryOptionDropdown:SetSelectedItemTextColor(selected)
                    self:PopulateSecondaryDropdown()
                    SCREEN_NARRATION_MANAGER:RegisterDialogDropdown(dialog, self.secondaryOptionDropdown)
                end,
                callback = function(dialog)
                    local targetControl = dialog.entryList:GetTargetControl()
                    targetControl.dropdown:Activate()
                end,
                visible = function(dialog)
                    local groupFinderCategory = self.userTypeData:GetCategory()
                    return self.userTypeData:GetUserType() == GROUP_FINDER_GROUP_LISTING_USER_TYPE_GROUP_LISTING_DRAFT
                        and groupFinderCategory ~= GROUP_FINDER_CATEGORY_ENDLESS_DUNGEON
                        and groupFinderCategory ~= GROUP_FINDER_CATEGORY_CUSTOM
                end,
            },
        }
        table.insert(parametricList, secondaryOptionEntry)
        local groupSizeEntry =
        {
            template = "ZO_GamepadDropdownItem",
            headerTemplate = "ZO_GamepadMenuEntryFullWidthHeaderTemplate",
            templateData =
            {
                setup = function(control, data, selected, reselectingDuringRebuild, enabled, active)
                    local dialog = data.dialog
                    self.sizeDropdown = control.dropdown
                    table.insert(dialog.dropdowns, self.sizeDropdown)
                    self.sizeDropdown:SetNormalColor(ZO_GAMEPAD_COMPONENT_COLORS.UNSELECTED_INACTIVE:UnpackRGB())
                    self.sizeDropdown:SetHighlightedColor(ZO_GAMEPAD_COMPONENT_COLORS.SELECTED_ACTIVE:UnpackRGB())
                    self.sizeDropdown:SetSelectedItemTextColor(selected)
                    self:PopulateSizeDropdown()
                    SCREEN_NARRATION_MANAGER:RegisterDialogDropdown(dialog, self.sizeDropdown)
                end,
                callback = function(dialog)
                    local targetControl = dialog.entryList:GetTargetControl()
                    targetControl.dropdown:Activate()
                end,
                visible = function(dialog)
                    return self.userTypeData:GetUserType() == GROUP_FINDER_GROUP_LISTING_USER_TYPE_GROUP_LISTING_DRAFT
                end,
            },
        }
        table.insert(parametricList, groupSizeEntry)
        local groupListingTitle =
        {
            template = "ZO_Gamepad_GenericDialog_Parametric_TextFieldItem",
            headerTemplate = "ZO_GamepadMenuEntryFullWidthHeaderTemplate",
            templateData =
            {
                isTitle = true,
                focusLostCallback = function(control)
                    local newTitle = control:GetText()
                    self.userTypeData:SetTitle(newTitle)
                    local dialog = ZO_GenericGamepadDialog_GetControl(GAMEPAD_DIALOGS.PARAMETRIC)
                    ZO_GenericGamepadDialog_RefreshKeybinds(dialog)
                end,
                textChangedCallback = function(control)
                    local newTitle = control:GetText()
                    if newTitle ~= self.userTypeData:GetTitle() then
                        self.userTypeData:SetTitle(newTitle)
                        local dialog = ZO_GenericGamepadDialog_GetControl(GAMEPAD_DIALOGS.PARAMETRIC)
                        self:UpdateTitleTooltip(dialog)
                    end
                end,
                setup = function(control, data, selected, reselectingDuringRebuild, enabled, active)
                    control.highlight:SetHidden(not selected)
                    self.groupTitleEditControl = control.editBoxControl
                    control.editBoxControl:SetMaxInputChars(GROUP_FINDER_GROUP_LISTING_TITLE_MAX_LENGTH)
                    control.editBoxControl:SetDefaultText(GetString(SI_GROUP_FINDER_CREATE_TITLE_DEFAULT_TEXT))
                    control.editBoxControl.focusLostCallback = data.focusLostCallback
                    control.editBoxControl.textChangedCallback = data.textChangedCallback
                    self:UpdateEditBoxGroupListingTitle()
                end,
                callback = function(dialog)
                    local editControl = dialog.entryList:GetTargetControl().editBoxControl
                    editControl:TakeFocus()
                end,
                narrationTooltip = GAMEPAD_LEFT_DIALOG_TOOLTIP,
            }
        }
        table.insert(parametricList, groupListingTitle)
        local groupListingDescription =
        {
            template = "ZO_Gamepad_GenericDialog_Parametric_TextFieldItem_Multiline",
            templateData =
            {
                focusLostCallback = function(control)
                    local description = control:GetText()
                    self.userTypeData:SetDescription(description)
                    local dialog = ZO_GenericGamepadDialog_GetControl(GAMEPAD_DIALOGS.PARAMETRIC)
                    ZO_GenericGamepadDialog_RefreshKeybinds(dialog)
                end,
                setup = function(control, data, selected, reselectingDuringRebuild, enabled, active)
                    control.highlight:SetHidden(not selected)
                    self.descriptionEditControl = control.editBoxControl
                    control.editBoxControl:SetMaxInputChars(GROUP_FINDER_GROUP_LISTING_DESCRIPTION_MAX_LENGTH)
                    control.editBoxControl:SetDefaultText(GetString(SI_GROUP_FINDER_CREATE_DESCRIPTION_DEFAULT_TEXT))
                    control.editBoxControl.focusLostCallback = data.focusLostCallback
                    self:UpdateEditBoxGroupListingDescription()
                end,
                callback = function(dialog)
                    local editControl = dialog.entryList:GetTargetControl().editBoxControl
                    editControl:TakeFocus()
                end,
            }
        }
        table.insert(parametricList, groupListingDescription)
        local playstyleEntry =
        {
            template = "ZO_GamepadDropdownItem",
            headerTemplate = "ZO_GamepadMenuEntryFullWidthHeaderTemplate",
            header = GetString(SI_GROUP_FINDER_HEADER_LABEL_PLAYSTYLE),
            templateData =
            {
                setup = function(control, data, selected, reselectingDuringRebuild, enabled, active)
                    local dialog = data.dialog
                    self.playstyleDropdown = control.dropdown
                    table.insert(dialog.dropdowns, self.playstyleDropdown)
                    self.playstyleDropdown:SetNormalColor(ZO_GAMEPAD_COMPONENT_COLORS.UNSELECTED_INACTIVE:UnpackRGB())
                    self.playstyleDropdown:SetHighlightedColor(ZO_GAMEPAD_COMPONENT_COLORS.SELECTED_ACTIVE:UnpackRGB())
                    self.playstyleDropdown:SetSelectedItemTextColor(selected)
                    self:PopulatePlaystyleDropdown()
                    SCREEN_NARRATION_MANAGER:RegisterDialogDropdown(dialog, self.playstyleDropdown)
                end,
                callback = function(dialog)
                    local targetControl = dialog.entryList:GetTargetControl()
                    targetControl.dropdown:Activate()
                end,
                visible = function(dialog)
                    local groupFinderCategory = self.userTypeData:GetCategory()
                    return groupFinderCategory == GROUP_FINDER_CATEGORY_DUNGEON
                        or groupFinderCategory == GROUP_FINDER_CATEGORY_ARENA
                        or groupFinderCategory == GROUP_FINDER_CATEGORY_TRIAL
                end,
            },
        }
        table.insert(parametricList, playstyleEntry)
        local championCheckboxEntry =
        {
            template = "ZO_CheckBoxTemplate_WithoutIndent_Gamepad",
            text = zo_strformat(SI_GROUP_FINDER_CHAMPION_REQUIRED_TEXT, ZO_GetChampionIconMarkupString(ZO_GROUP_LISTING_CHAMPION_ICON_SIZE)),
            templateData =
            {
                setup = function(control, data, selected, reselectingDuringRebuild, enabled, active)
                    self.championCheckbox = control.checkBox
                    ZO_GamepadCheckBoxTemplate_Setup(control, data, selected, reselectingDuringRebuild, enabled, active)
                    self:UpdateCheckStateRequireChampion()
                end,
                callback = function(dialog)
                    local targetControl = dialog.entryList:GetTargetControl()
                    ZO_GamepadCheckBoxTemplate_OnClicked(targetControl)
                    self.userTypeData:SetGroupRequiresChampion(ZO_GamepadCheckBoxTemplate_IsChecked(targetControl))
                    SCREEN_NARRATION_MANAGER:QueueDialog(dialog)
                    local RESELECT_ENTRY = true
                    local DONT_LIMIT_NUM_ENTRIES = nil
                    ZO_GenericParametricListGamepadDialogTemplate_RebuildEntryList(dialog, DONT_LIMIT_NUM_ENTRIES, RESELECT_ENTRY)
                end,
                checked = function()
                    return self.userTypeData:DoesGroupRequireChampion()
                end,
            },
        }
        table.insert(parametricList, championCheckboxEntry)
        local championPointsEntry =
        {
            template = "ZO_GroupFinder_ChampionPoint_EditBox_Gamepad",
            headerTemplate = "ZO_GamepadMenuEntryFullWidthHeaderTemplate",
            templateData =
            {
                focusLostCallback = function(control)
                    local championPointsText = control:GetText()
                    if championPointsText ~= "" then
                        local championPoints = tonumber(championPointsText)
                        if championPoints > MAX_CP_ALLOWED then
                            championPoints = MAX_CP_ALLOWED
                            control:SetText(championPoints)
                        end
                        if championPoints ~= 0 then
                            self.userTypeData:SetChampionPoints(championPoints)
                        end
                    end
                    local dialog = ZO_GenericGamepadDialog_GetControl(GAMEPAD_DIALOGS.PARAMETRIC)
                    ZO_GenericGamepadDialog_RefreshKeybinds(dialog)
                end,
                setup = function(control, data, selected, reselectingDuringRebuild, enabled, active)
                    control.highlight:SetHidden(not selected)
                    self.championPointsEditBoxControl = control.editBoxControl
                    control.editBoxControl.focusLostCallback = data.focusLostCallback
                    self:UpdateChampionPointsEditBox()
                end,
                callback = function(dialog)
                    local editControl = dialog.entryList:GetTargetControl().editBoxControl
                    editControl:TakeFocus()
                end,
                visible = function(dialog)
                    return self.userTypeData:DoesGroupRequireChampion()
                end,
            }
        }
        table.insert(parametricList, championPointsEntry)
        local voipCheckboxEntry =
        {
            template = "ZO_CheckBoxTemplate_WithoutIndent_Gamepad",
            text = GetString(SI_GROUP_FINDER_CREATE_VOIP_REQUIRED_TEXT),
            templateData =
            {
                setup = function(control, data, selected, reselectingDuringRebuild, enabled, active)
                    self.voipCheckbox = control.checkBox
                    ZO_GamepadCheckBoxTemplate_Setup(control, data, selected, reselectingDuringRebuild, enabled, active)
                    self:UpdateCheckStateRequireVOIP()
                end,
                callback = function(dialog)
                    local targetControl = dialog.entryList:GetTargetControl()
                    ZO_GamepadCheckBoxTemplate_OnClicked(targetControl)
                    self.userTypeData:SetGroupRequiresVOIP(ZO_GamepadCheckBoxTemplate_IsChecked(targetControl))
                    ZO_GenericGamepadDialog_RefreshKeybinds(dialog)
                    SCREEN_NARRATION_MANAGER:QueueDialog(dialog)
                end,
                checked = function()
                    return self.userTypeData:DoesGroupRequireVOIP()
                end,
            },
        }
        table.insert(parametricList, voipCheckboxEntry)
        local inviteCodeCheckboxEntry =
        {
            template = "ZO_CheckBoxTemplate_WithoutIndent_Gamepad",
            text = GetString(SI_GROUP_FINDER_CREATE_INVITE_CODE_TEXT),
            templateData =
            {
                setup = function(control, data, selected, reselectingDuringRebuild, enabled, active)
                    self.inviteCodeCheckbox = control.checkBox
                    ZO_GamepadCheckBoxTemplate_Setup(control, data, selected, reselectingDuringRebuild, enabled, active)
                    self:UpdateCheckStateInviteCode()
                end,
                callback = function(dialog)
                    local targetControl = dialog.entryList:GetTargetControl()
                    ZO_GamepadCheckBoxTemplate_OnClicked(targetControl)
                    self.userTypeData:SetGroupRequiresInviteCode(ZO_GamepadCheckBoxTemplate_IsChecked(targetControl))
                    SCREEN_NARRATION_MANAGER:QueueDialog(dialog)
                    local RESELECT_ENTRY = true
                    local DONT_LIMIT_NUM_ENTRIES = nil
                    ZO_GenericParametricListGamepadDialogTemplate_RebuildEntryList(dialog, DONT_LIMIT_NUM_ENTRIES, RESELECT_ENTRY)
                end,
                checked = function()
                    return self.userTypeData:DoesGroupRequireInviteCode()
                end,
            },
        }
        table.insert(parametricList, inviteCodeCheckboxEntry)
        local inviteCodeEditBoxEntry =
        {
            template = "ZO_GroupFinder_InviteCode_EditBox_Gamepad",
            headerTemplate = "ZO_GamepadMenuEntryFullWidthHeaderTemplate",
            templateData =
            {
                focusLostCallback = function(control)
                    local newInviteCode = control:GetText()
                    self.userTypeData:SetInviteCode(tonumber(newInviteCode))
                    local dialog = ZO_GenericGamepadDialog_GetControl(GAMEPAD_DIALOGS.PARAMETRIC)
                    ZO_GenericGamepadDialog_RefreshKeybinds(dialog)
                end,
                setup = function(control, data, selected, reselectingDuringRebuild, enabled, active)
                    control.highlight:SetHidden(not selected)
                    self.inviteCodeEditBoxControl = control.editBoxControl
                    control.editBoxControl.focusLostCallback = data.focusLostCallback
                    self.inviteCodeEditBoxControl:SetAsPassword(not self.showInviteCode)
                    self:UpdateInviteCodeEditBox()
                    KEYBIND_STRIP:UpdateCurrentKeybindButtonGroups()
                end,
                callback = function(dialog)
                    local editControl = dialog.entryList:GetTargetControl().editBoxControl
                    editControl:TakeFocus()
                end,
                togglePasswordCallback = function(dialog)
                    self.showInviteCode = not self.showInviteCode
                    local targetControl = dialog.entryList:GetTargetControl()
                    targetControl.editBoxControl:SetAsPassword(not self.showInviteCode)
                end,
                visible = function(dialog)
                    return self.userTypeData:DoesGroupRequireInviteCode()
                end,
            }
        }
        table.insert(parametricList, inviteCodeEditBoxEntry)
        local autoAcceptCheckboxEntry =
        {
            template = "ZO_CheckBoxTemplate_WithoutIndent_Gamepad",
            text = GetString(SI_GROUP_FINDER_CREATE_AUTO_ACCEPT_TEXT),
            templateData =
            {
                setup = function(control, data, selected, reselectingDuringRebuild, enabled, active)
                    self.autoAcceptCheckbox = control.checkBox
                    ZO_GamepadCheckBoxTemplate_Setup(control, data, selected, reselectingDuringRebuild, enabled, active)
                    self:UpdateCheckStateAutoAcceptRequests()
                end,
                callback = function(dialog)
                    local targetControl = dialog.entryList:GetTargetControl()
                    ZO_GamepadCheckBoxTemplate_OnClicked(targetControl)
                    self.userTypeData:SetGroupAutoAcceptRequests(ZO_GamepadCheckBoxTemplate_IsChecked(targetControl))
                    ZO_GenericGamepadDialog_RefreshKeybinds(dialog)
                    SCREEN_NARRATION_MANAGER:QueueDialog(dialog)
                end,
                checked = function()
                    return self.userTypeData:DoesGroupAutoAcceptRequests()
                end,
            },
        }
        table.insert(parametricList, autoAcceptCheckboxEntry)
        local enforceRolesCheckboxEntry =
        {
            template = "ZO_CheckBoxTemplate_WithoutIndent_Gamepad",
            text = GetString(SI_GROUP_FINDER_CREATE_ENFORCE_ROLES_TEXT),
            templateData =
            {
                setup = function(control, data, selected, reselectingDuringRebuild, enabled, active)
                    self.enforceRolesCheckbox = control.checkBox
                    ZO_GamepadCheckBoxTemplate_Setup(control, data, selected, reselectingDuringRebuild, enabled, active)
                    self:UpdateCheckStateEnforceRoles()
                end,
                callback = function(dialog)
                    local targetControl = dialog.entryList:GetTargetControl()
                    ZO_GamepadCheckBoxTemplate_OnClicked(targetControl)
                    self.userTypeData:SetGroupEnforceRoles(ZO_GamepadCheckBoxTemplate_IsChecked(targetControl))
                    SCREEN_NARRATION_MANAGER:QueueDialog(dialog)
                    local RESELECT_ENTRY = true
                    local DONT_LIMIT_NUM_ENTRIES = nil
                    ZO_GenericParametricListGamepadDialogTemplate_RebuildEntryList(dialog, DONT_LIMIT_NUM_ENTRIES, RESELECT_ENTRY)
                end,
                checked = function()
                    return self.userTypeData:DoesGroupEnforceRoles()
                end,
            },
        }
        table.insert(parametricList, enforceRolesCheckboxEntry)
        local spinnerRoles =
        {
            LFG_ROLE_TANK,
            LFG_ROLE_HEAL,
            LFG_ROLE_DPS,
            LFG_ROLE_INVALID,
        }
        self.roleSpinnerTable = {}
        for i, roleType in ipairs(spinnerRoles) do
            local enforceRoleSpinnerEntry =
            {
                template = "ZO_SpinnerEntry_Indented_Gamepad",
                templateData =
                {
                    setup = function(control, data, selected, reselectingDuringRebuild, enabled, active)
                        local function GetRoleMin(spinner)
                            if spinner.roleType == LFG_ROLE_INVALID then
                                return self.userTypeData:GetDesiredRoleCountAtEdit(LFG_ROLE_INVALID)
                            else
                                return self.userTypeData:GetAttainedRoleCountAtEdit(spinner.roleType)
                            end
                        end
                        local function GetRoleMax(spinner)
                            if spinner.roleType == LFG_ROLE_INVALID then
                                return self.userTypeData:GetDesiredRoleCountAtEdit(LFG_ROLE_INVALID)
                            else
                                return self.userTypeData:GetDesiredRoleCountAtEdit(spinner.roleType) + self.userTypeData:GetDesiredRoleCountAtEdit(LFG_ROLE_INVALID)
                            end
                        end
                        local function OnValueChanged(value, spinner)
                            self.userTypeData:SetDesiredRoleCountAtEdit(spinner.roleType, value)
                            self:UpdateRoles()
                            local dialog = data.dialog
                            ZO_GenericGamepadDialog_RefreshKeybinds(dialog)
                            --Re-narrate when the value changes
                            SCREEN_NARRATION_MANAGER:QueueDialog(dialog)
                        end
                        data.roleType = roleType
                        self.roleSpinnerTable[roleType] = control
                        local roleName = self:GetRoleLabelText(roleType)
                        control:GetNamedChild("Label"):SetText(roleName)
                        if control.roleSpinner == nil then
                            control.roleSpinner = ZO_Spinner_Gamepad:New(control:GetNamedChild("Spinner"))
                        end
                        control.roleSpinner.roleType = roleType
                        control.roleSpinner:SetMinMax(GetRoleMin, GetRoleMax)
                        control.roleSpinner:UnregisterAllCallbacks("OnValueChanged")
                        -- set value before registering the callback because we're just setting up, not making changes
                        control.roleSpinner:SetValue(self.userTypeData:GetDesiredRoleCountAtEdit(roleType))
                        control.roleSpinner:RegisterCallback("OnValueChanged", OnValueChanged)
                        control.roleSpinner:SetName(roleName)
                        control.roleSpinner:SetButtonsHidden(roleType == LFG_ROLE_INVALID)
                        control.roleSpinner:SetActive(selected)
                        local function GetDirectionalInputNarrationData()
                            --Only narrate directional input if there is more than one possible value
                            if control.roleSpinner:GetMin() ~= control.roleSpinner:GetMax() then
                                local decreaseEnabled = control.roleSpinner:IsDecreaseEnabled()
                                local increaseEnabled = control.roleSpinner:IsIncreaseEnabled()
                                return ZO_GetNumericHorizontalDirectionalInputNarrationData(decreaseEnabled, increaseEnabled)
                            else
                                return {}
                            end
                        end
                        data.additionalInputNarrationFunction = GetDirectionalInputNarrationData
                    end,
                    visible = function(dialog)
                        return self.userTypeData:DoesGroupEnforceRoles()
                    end,
                    narrationText = function(entryData, entryControl)
                        return entryControl.roleSpinner:GetNarrationText()
                    end,
                },
            }
            table.insert(parametricList, enforceRoleSpinnerEntry)
        end
        return parametricList
    end
end
function ZO_GroupFinder_CreateEditGroupListing_Gamepad:UpdateTitleTooltip(dialog)
    local tooltipText = self:GetTitleTooltipText()
    if tooltipText ~= "" then
        GAMEPAD_TOOLTIPS:LayoutTextBlockTooltip(GAMEPAD_LEFT_DIALOG_TOOLTIP, tooltipText)
        ZO_GenericGamepadDialog_ShowTooltip(dialog)
    else
        ZO_GenericGamepadDialog_HideTooltip(dialog)
    end
end
function ZO_GroupFinder_CreateEditGroupListing_Gamepad:UpdateRoles()
    for roleType, control in pairs(self.roleSpinnerTable) do
        if control and control.roleSpinner and not control.roleSpinner:SetValue(self.userTypeData:GetDesiredRoleCountAtEdit(roleType)) then
            control.roleSpinner:UpdateButtons()
        end
    end
end
function ZO_GroupFinder_CreateEditGroupListing_Gamepad:OnGroupMemberRoleChanged()
    if ZO_Dialogs_IsShowing("GROUP_FINDER_CREATE_EDIT_GROUP_LISTING_GAMEPAD") then
        local dialog = ZO_GenericGamepadDialog_GetControl(GAMEPAD_DIALOGS.PARAMETRIC)
    end
end