Back to Home

ESO Lua File v100022

pregame/charactercreate/gamepad/zo_charactercreate_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
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
local g_controlLookup = {}
local g_randomizeAppearanceEnabled = true
local CHARACTER_CREATE_GAMEPAD_DIALOG = "CHARACTER_CREATE_GAMEPAD"
local SKIP_TUTORIAL_GAMEPAD_DIALOG = "SKIP_TUTORIAL_GAMEPAD"
local SELECTOR_PER_ROW_CENTER_OFFSET = -65
local INITIAL_BUCKET = CREATE_BUCKET_RACE
local function CreatePreviewOption(dressingOption)
    return  {
                name = zo_strformat(SI_CREATE_CHARACTER_GAMEPAD_PREVIEW_OPTION_FORMAT, GetString("SI_CHARACTERCREATEDRESSINGOPTION", dressingOption)),
                OnSelectedCallback =    function()
                                            SelectClothing(dressingOption)
                                        end
            }
end
local PREVIEW_NO_GEAR = CreatePreviewOption(DRESSING_OPTION_NUDE)
local PREVIEW_NOVICE_GEAR = CreatePreviewOption(DRESSING_OPTION_STARTING_GEAR)
local PREVIEW_CHAMPION_GEAR = CreatePreviewOption(DRESSING_OPTION_WARDROBE_1)
local PREVIEW_CURRENT_GEAR = CreatePreviewOption(DRESSING_OPTION_YOUR_GEAR)
local PREVIEW_CURRENT_GEAR_AND_COLLECTIBLES = CreatePreviewOption(DRESSING_OPTION_YOUR_GEAR_AND_COLLECTIBLES)
local CHARACTER_CREATE_PREVIEW_GEAR_INFO = 
{
    PREVIEW_NOVICE_GEAR,
    PREVIEW_CHAMPION_GEAR,
    PREVIEW_NO_GEAR,
}
local CHARACTER_EDIT_PREVIEW_GEAR_INFO = 
{
    PREVIEW_CURRENT_GEAR_AND_COLLECTIBLES, -- match the first appearance here to the default apperance set in PregameCharacterManager to avoid reloading the character
    PREVIEW_CURRENT_GEAR,
    PREVIEW_CHAMPION_GEAR,
    PREVIEW_NO_GEAR,
}
-- Slider Randomization Helper...all sliders share the sliderObject from the top control, so this just helps cut down on duplicate functions
local function RandomizeSlider(control, randomizeType)
    control.sliderObject:Randomize(randomizeType)
end
-- Character Create Slider and Appearance Slider Managers
-- Manages a collection of sliders with a pool
local CharacterCreateSliderManager = ZO_Object:Subclass()
function CharacterCreateSliderManager:New(...)
    local manager = ZO_Object.New(self)
    manager:Initialize(...)
    return manager
end
function CharacterCreateSliderManager:Initialize(parent)
    local CreateSlider =    function(pool)
                                local control = ZO_ObjectPool_CreateNamedControl("CharacterCreateSlider", "ZO_CharacterCreateSlider_Gamepad", pool, parent)
                                return ZO_CharacterCreateSlider_Gamepad:New(control)
                            end
    local CreateAppearanceSlider =  function(pool)
                                        local control = ZO_ObjectPool_CreateNamedControl("CharacterCreateAppearanceSlider", "ZO_CharacterCreateSlider_Gamepad", pool, parent)
                                        return ZO_CharacterCreateAppearanceSlider_Gamepad:New(control)
                                    end
    local CreateColorPicker =   function(pool)
                                    local control = ZO_ObjectPool_CreateNamedControl("CharacterCreateColorPicker", "ZO_CharacterCreateSlider_Gamepad", pool, parent)
                                    return ZO_CharacterCreateAppearanceSlider_Gamepad:New(control)
                                end
    local CreateVoiceSlider =   function(pool)
                                    local control = ZO_ObjectPool_CreateNamedControl("CharacterCreateVoiceSlider", "ZO_CharacterCreateSlider_Gamepad", pool, parent)
                                    return ZO_CharacterCreateVoiceSlider_Gamepad:New(control)
                                end
    local CreateGenderSlider =  function(pool)
                                    local control = ZO_ObjectPool_CreateNamedControl("CharacterCreateGenderSlider", "ZO_CharacterCreateSlider_Gamepad", pool, parent)
                                    return ZO_CharacterCreateGenderSlider_Gamepad:New(control)
                                end
    local function ResetSlider(slider)
        local sliderControl = slider.control
        GAMEPAD_BUCKET_MANAGER:RemoveControl(sliderControl)
        sliderControl:SetHidden(true)
        if slider:IsLocked() then
            slider:ToggleLocked()
        end
    end
    self.pools =
    {
        [CHARACTER_CREATE_SLIDER_TYPE_SLIDER] = ZO_ObjectPool:New(CreateSlider, ResetSlider),
        [CHARACTER_CREATE_SLIDER_TYPE_ICON] = ZO_ObjectPool:New(CreateAppearanceSlider, ResetSlider),
        [CHARACTER_CREATE_SLIDER_TYPE_COLOR] = ZO_ObjectPool:New(CreateColorPicker, ResetSlider),
        [CHARACTER_CREATE_SLIDER_TYPE_NAMED] = ZO_ObjectPool:New(CreateVoiceSlider, ResetSlider),
        [CHARACTER_CREATE_SLIDER_TYPE_GENDER] = ZO_ObjectPool:New(CreateGenderSlider, ResetSlider),
    }
end
function CharacterCreateSliderManager:AcquireObject(objectType)
    local pool = self.pools[objectType]
    if pool then
        return pool:AcquireObject()
    end
end
function CharacterCreateSliderManager:ReleaseAllObjects()
    for poolType, pool in pairs(self.pools) do
        pool:ReleaseAllObjects()
    end
end
--[[ Character Create Manager ]]--
local ZO_CharacterCreate_Gamepad = ZO_CharacterCreate_Base:Subclass()
function ZO_CharacterCreate_Gamepad:New(...)
    return ZO_CharacterCreate_Base.New(self, ...)
end
function ZO_CharacterCreate_Gamepad:Initialize(...)
    ZO_CharacterCreate_Base.Initialize(self, ...)
    CHARACTER_CREATE_GAMEPAD_FRAGMENT = ZO_FadeSceneFragment:New(self.control)
    GAMEPAD_CHARACTER_CREATE_SCENE = ZO_Scene:New("gamepadCharacterCreate", SCENE_MANAGER)
    GAMEPAD_CHARACTER_CREATE_SCENE:AddFragment(CHARACTER_CREATE_GAMEPAD_FRAGMENT)
    GAMEPAD_CHARACTER_CREATE_SCENE:RegisterCallback("StateChange", function(...) self:OnStateChanged(...) end)
    self.scene = GAMEPAD_CHARACTER_CREATE_SCENE
    local ALWAYS_ANIMATE = true
    CHARACTER_CREATE_GAMEPAD_FINISH_ERROR_FRAGMENT = ZO_FadeSceneFragment:New(ZO_CharacterCreate_GamepadFinishError, ALWAYS_ANIMATE)
    CHARACTER_CREATE_GAMEPAD_CONTAINER_FRAGMENT = ZO_FadeSceneFragment:New(ZO_CharacterCreate_GamepadContainer, ALWAYS_ANIMATE)
    local function CharacterNameValidationCallback(isValid)
        if isValid then
            if ZO_CHARACTERCREATE_MANAGER:GetShouldPromptForTutorialSkip() and CanSkipTutorialArea() then
                ZO_CHARACTERCREATE_MANAGER:SetShouldPromptForTutorialSkip(false)
                -- color the character name white so it's highlighted in the dialog
                local characterMode = ZO_CHARACTERCREATE_MANAGER:GetCharacterMode()
                local genderDecoratedCharacterName = ZO_SELECTED_TEXT:Colorize(GetGrammarDecoratedName(self.characterName, CharacterCreateGetGender(characterMode)))
                ZO_Dialogs_ShowGamepadDialog(SKIP_TUTORIAL_GAMEPAD_DIALOG, { characterName = self.characterName }, {mainTextParams = { genderDecoratedCharacterName }})
            else
                ZO_CharacterCreate_Gamepad_DoCreate(self.characterStartLocation, self.characterCreateOption)
            end
        else
            local errorReason = GetString("SI_CHARACTERCREATEEDITERROR", CHARACTER_CREATE_EDIT_ERROR_INVALID_NAME)
            ZO_Dialogs_ShowGamepadDialog("CHARACTER_CREATE_FAILED_REASON", nil, {mainTextParams = {errorReason}})
        end
    end
        {
            errorControl = ZO_CharacterCreate_GamepadFinishError,
            errorFragment = CHARACTER_CREATE_GAMEPAD_FINISH_ERROR_FRAGMENT,
            dialogName = CHARACTER_CREATE_GAMEPAD_DIALOG,
            dialogTitle = SI_CREATE_CHARACTER_GAMEPAD_FINISH_TITLE,
            dialogMainText = "",
            onBack = function() 
                if self.focusControl then
                    self.focusControl:EnableFocus(true)
                end
            end,
            onFinish = function(dialog)
                local characterName = dialog.selectedName
                self.characterName = characterName
                if characterName and #characterName > 0 then
                    if IsConsoleUI() then
                        PLAYER_CONSOLE_INFO_REQUEST_MANAGER:RequestNameValidation(characterName, CharacterNameValidationCallback)
                    else
                        CharacterNameValidationCallback(IsValidName(characterName))
                    end
                end
            end,
        })
    self.currentGearPreviewIndex = 1
    -- MovementController for changing the option on the currently selected Focus
    self.movementControllerChangeGenericOption = ZO_MovementController:New(MOVEMENT_CONTROLLER_DIRECTION_HORIZONTAL)
    -- MovementController for changing focus between controls
    self.movementControllerMoveFocus = ZO_MovementController:New(MOVEMENT_CONTROLLER_DIRECTION_VERTICAL)
    self.focusControl = nil
end
local function CreateTriangle(control, setterFn, updaterFn, triangleStringId, topStringId, leftStringId, rightStringId)
    local triangle = ZO_CharacterCreateTriangle_Gamepad:New(control, setterFn, updaterFn, triangleStringId, topStringId, leftStringId, rightStringId)
    control.selectedCenterOffset = -140
    return triangle
end
function ZO_CharacterCreate_Gamepad:InitializeControls()
    self.control.fadeTimeline = ANIMATION_MANAGER:CreateTimelineFromVirtual("CharacterCreateMainControlsFade", self.control)
    self.bucketsControl = self.control:GetNamedChild("ContainerInnerBuckets")
    self.sliderManager = CharacterCreateSliderManager:New(self.bucketsControl)
    self.allianceRadioGroup = ZO_RadioButtonGroup:New()
    self.raceRadioGroup = ZO_RadioButtonGroup:New()
    self.classRadioGroup = ZO_RadioButtonGroup:New()
    -- create the triangle controls
    local physiqueTriangleControl = CreateControlFromVirtual("$(parent)PhysiqueSelection", self.control, "ZO_CharacterCreateTriangleTemplate_Gamepad")
    self.physiqueTriangle = CreateTriangle(physiqueTriangleControl, SetPhysique, GetPhysique, SI_CREATE_CHARACTER_BODY_TRIANGLE_LABEL, SI_CREATE_CHARACTER_TRIANGLE_MUSCULAR, SI_CREATE_CHARACTER_TRIANGLE_FAT, SI_CREATE_CHARACTER_TRIANGLE_THIN)
    local faceTriangleControl = CreateControlFromVirtual("$(parent)FaceSelection", self.control, "ZO_CharacterCreateTriangleTemplate_Gamepad")
    self.faceTriangle = CreateTriangle(faceTriangleControl, SetFace, GetFace, SI_CREATE_CHARACTER_FACE_TRIANGLE_LABEL, SI_CREATE_CHARACTER_TRIANGLE_FACE_MUSCULAR, SI_CREATE_CHARACTER_TRIANGLE_FACE_FAT, SI_CREATE_CHARACTER_TRIANGLE_FACE_THIN)
    self.containerControl = self.control:GetNamedChild("Container")
    self.containerControl:SetHandler("OnUpdate", function (...) self:ContainerOnUpdate(...) end)
    self.header = self.containerControl:GetNamedChild("HeaderContainerHeader")
    ZO_GamepadGenericHeader_Initialize(self.header, ZO_GAMEPAD_HEADER_TABBAR_CREATE)
    self.customBucketControls = 
    {
        [GAMEPAD_BUCKET_CUSTOM_CONTROL_GENDER] = {control = self.genderSlider.control, updateFn = UpdateSlider, shouldAdd = true},
        [GAMEPAD_BUCKET_CUSTOM_CONTROL_ALLIANCE] = {control = ZO_CharacterCreate_GamepadAlliance, updateFn = function() self:UpdateRaceControl() end, shouldAdd = true},
        [GAMEPAD_BUCKET_CUSTOM_CONTROL_RACE] = {control = ZO_CharacterCreate_GamepadRace, updateFn = function() self:UpdateRaceControl() end, shouldAdd = true},
        [GAMEPAD_BUCKET_CUSTOM_CONTROL_CLASS] = {control = ZO_CharacterCreate_GamepadClass, updateFn = function() self:UpdateClassControl() end, shouldAdd = true},
        [GAMEPAD_BUCKET_CUSTOM_CONTROL_PHYSIQUE] = {control = physiqueTriangleControl, updateFn = UpdateSlider, randomizeFn = RandomizeSlider, shouldAdd = true},
        [GAMEPAD_BUCKET_CUSTOM_CONTROL_FACE] = {control = faceTriangleControl, updateFn = UpdateSlider, randomizeFn = RandomizeSlider, shouldAdd = true},
    }
end
function ZO_CharacterCreate_Gamepad:InitializeSelectors()
end
function ZO_CharacterCreate_Gamepad:OnCharacterCreateRequested()
    ZO_Dialogs_ShowGamepadDialog("CHARACTER_CREATE_CREATING")
end
function ZO_CharacterCreate_Gamepad:OnCharacterCreateFailed(reason)
    local errorReason = GetString("SI_CHARACTERCREATEEDITERROR", reason)
    -- Show the fact that the character could not be created.
    ZO_Dialogs_ShowGamepadDialog("CHARACTER_CREATE_FAILED_REASON", nil, {mainTextParams = {errorReason}})
    self.isCreating = false
end
function ZO_CharacterCreate_Gamepad:OnStateChanged(oldState, newState)
    if newState == SCENE_SHOWING then
        self.currentGearPreviewIndex = 1
        self.scene:AddFragment(KEYBIND_STRIP_GAMEPAD_FRAGMENT)
        ZO_CharacterCreate_GamepadCharacterViewport.Activate()
        SCENE_MANAGER:AddFragment(CHARACTER_CREATE_GAMEPAD_CONTAINER_FRAGMENT)
        GAMEPAD_BUCKET_MANAGER:Activate()
        -- Refresh the keybind strip after we activate our bucket since
        -- that may change our focus control which will impact the keybinds
        self:RefreshKeybindStrip()
    elseif newState == SCENE_HIDDEN then
        self.scene:RemoveFragment(KEYBIND_STRIP_GAMEPAD_FRAGMENT)
        ZO_CharacterCreate_GamepadCharacterViewport.Deactivate()
        SCENE_MANAGER:RemoveFragment(CHARACTER_CREATE_GAMEPAD_CONTAINER_FRAGMENT)
        if self.currentKeystrip then
            KEYBIND_STRIP:RemoveKeybindButtonGroup(self.currentKeystrip)
            self.currentKeystrip = nil
        end
        self.isCreating = false
        GAMEPAD_BUCKET_MANAGER:Deactivate()
    end
end
function ZO_CharacterCreate_Gamepad:InitializeSkipTutorialDialog()
    ZO_Dialogs_RegisterCustomDialog(SKIP_TUTORIAL_GAMEPAD_DIALOG,
    {
        mustChoose = true,
        canQueue = true,
        gamepadInfo =
        {
            dialogType = GAMEPAD_DIALOGS.BASIC,
        },
        title =
        {
            text = SI_PROMPT_TITLE_SKIP_TUTORIAL,
        },
        mainText = 
        {
            text = SI_PROMPT_BODY_SKIP_TUTORIAL,
        },
        buttons =
        {
            {
                text = SI_PROMPT_PLAY_TUTORIAL_BUTTON,
                keybind = "DIALOG_PRIMARY",
                callback =  function(dialog)
                                self:CreateCharacter(dialog.data.startLocation, CHARACTER_CREATE_DEFAULT_LOCATION)
                            end,
            },
            {
                text = SI_PROMPT_SKIP_TUTORIAL_BUTTON,
                keybind = "DIALOG_SECONDARY",
                callback =  function(dialog)
                                self:CreateCharacter(dialog.data.startLocation, CHARACTER_CREATE_SKIP_TUTORIAL)
                            end,
            },
            {
                text = SI_PROMPT_BACK_TUTORIAL_BUTTON,
                keybind = "DIALOG_NEGATIVE",
                callback =  function(dialog)
                                ZO_CharacterCreate_Gamepad_CancelSkipDialogue()
                                ZO_Dialogs_ShowGamepadDialog(CHARACTER_CREATE_GAMEPAD_DIALOG, { characterName = dialog.data.characterName })
                            end,
            },
        }
    })
end
do
    local function ReturnToCharacterSelect()
        PlaySound(SOUNDS.GAMEPAD_MENU_BACK)
        GAMEPAD_CHARACTER_CREATE_MANAGER:ExitToState("CharacterSelect")
    end
    function ZO_CharacterCreate_Gamepad:GenerateKeybindingDescriptor()
        if self.isCreating then
            return nil  -- No keybind while creating
        end
        local keybindStripDescriptor =
        {
            alignment = KEYBIND_STRIP_ALIGN_LEFT,
            {
                name = function()
                    return (self.focusControl and self.focusControl.primaryButtonName) or GetString(SI_GAMEPAD_SELECT_OPTION)
                end,
                keybind = "UI_SHORTCUT_PRIMARY",
                ethereal = not (self.focusControl and self.focusControl.showKeybind),
                callback = function()
                    ZO_CharacterCreate_Gamepad_OnPrimaryButtonPressed()
                end,
            },
            {
                name = GetString(SI_CREATE_CHARACTER_GAMEPAD_FINISH),
                keybind = "UI_SHORTCUT_TERTIARY",
                callback = function()
                    if ZO_CHARACTERCREATE_MANAGER:GetCharacterMode() == CHARACTER_MODE_CREATION then
                        PlaySound(SOUNDS.GAMEPAD_MENU_FORWARD)
                        ZO_CharacterCreate_Gamepad_ShowFinishScreen()
                    else
                        self:SaveCharacterChanges()
                    end
                end,
            },
            {
                name = GetString(SI_CREATE_CHARACTER_GAMEPAD_RANDOMIZE),
                keybind = "UI_SHORTCUT_SECONDARY",
                callback = function()
                    ZO_CharacterCreate_Gamepad_RandomizeAppearance()
                end,
                sound = SOUNDS.CC_RANDOMIZE,
            },
            {
                name = GetString(SI_CREATE_CHARACTER_GAMEPAD_USE_TEMPLATE),
                keybind = "UI_SHORTCUT_LEFT_TRIGGER",
                callback = function()
                    PlaySound(SOUNDS.CC_GAMEPAD_CHARACTER_CLICK)
                    ZO_Dialogs_ShowGamepadDialog("CHARACTER_CREATE_TEMPLATE_SELECT")
                end,
                visible = function()
                        local shouldShow = false
                        if ZO_CHARACTERCREATE_MANAGER:GetCharacterMode() == CHARACTER_MODE_CREATION then
                            if GetTemplateStatus() then
                                local templates = self.characterData:GetTemplateInfo()
                                shouldShow = templates and #templates > 0
                            end
                        end
                        return shouldShow
                end,
            }
        }
        if self.focusControl and self.focusControl.CanLock then
            if self.focusControl.CanLock() then
                local keybindName
                local callbackSound
                if self.focusControl:IsLocked() then
                    keybindName = GetString(SI_CREATE_CHARACTER_GAMEPAD_UNLOCK_VALUE)
                    callbackSound = SOUNDS.CC_UNLOCK_VALUE
                else
                    keybindName = GetString(SI_CREATE_CHARACTER_GAMEPAD_LOCK_VALUE)
                    callbackSound = SOUNDS.CC_LOCK_VALUE
                end
                keybindStripDescriptor[#keybindStripDescriptor + 1] =
                    {
                        name = keybindName,
                        keybind = "UI_SHORTCUT_RIGHT_STICK",
                        callback = function()
                            self.focusControl:ToggleLocked()
                            PlaySound(callbackSound)
                            self:RefreshKeybindStrip()
                        end,
                    }
            end
        end
        local gearPreviews
        if ZO_CHARACTERCREATE_MANAGER:GetCharacterMode() == CHARACTER_MODE_CREATION then
            gearPreviews = CHARACTER_CREATE_PREVIEW_GEAR_INFO
        else
            gearPreviews = CHARACTER_EDIT_PREVIEW_GEAR_INFO
        end
        local nextGear = (self.currentGearPreviewIndex % #gearPreviews) + 1
        local name = gearPreviews[nextGear].name
        keybindStripDescriptor[#keybindStripDescriptor + 1] =
        {
            name = name,
            keybind = "UI_SHORTCUT_RIGHT_TRIGGER",
            callback = function()
                self.currentGearPreviewIndex = (self.currentGearPreviewIndex % #gearPreviews) + 1
                gearPreviews[self.currentGearPreviewIndex].OnSelectedCallback()
                PlaySound(SOUNDS.CC_PREVIEW_GEAR)
                self:RefreshKeybindStrip()
            end,
        }
        local state = PregameStateManager_GetPreviousState()
        local numCharacters = GetNumCharacters()
        if (state == "CharacterSelect" or state == "CharacterSelect_FromCinematic") and numCharacters > 0 then
            keybindStripDescriptor[#keybindStripDescriptor + 1] = KEYBIND_STRIP:GenerateGamepadBackButtonDescriptor(ReturnToCharacterSelect)
        elseif numCharacters == 0 then
            -- mimic the behavior from the character select screen
            keybindStripDescriptor[#keybindStripDescriptor + 1] = KEYBIND_STRIP:GenerateGamepadBackButtonDescriptor(ZO_Disconnect)
        end
        return keybindStripDescriptor
    end
end
-- Can't simply return (currentStrip ~= newStrip) because ZoKeybindStrip stores additional
-- variables on the descriptor (such as currentStrip.handledDown). This causes an altered
-- version of the keybind strip to differ from an unaltered version of the same strip.
local function ShouldRefreshKeybindStrip(currentStrip, newStrip)
    local stripsExist = currentStrip and newStrip
    if stripsExist then
        -- if the strips have the same number of buttons see if they are all the same
        if #currentStrip == #newStrip then
            for i = 1, #currentStrip do
                local currentButton = currentStrip[i]
                local newButton = newStrip[i]
                if currentButton.name ~= newButton.name then
                    return true
                end
            end
            -- all the buttons are the same in the strips, so don't refresh
            return false
        end
    end
    -- the keybind strips don't match so we should refresh
    return true
end
function ZO_CharacterCreate_Gamepad:RefreshKeybindStrip()
    local keybindStrip = self:GenerateKeybindingDescriptor()
    local removed = true
    if ShouldRefreshKeybindStrip(self.currentKeystrip, keybindStrip) then
        if self.currentKeystrip then
            removed = KEYBIND_STRIP:RemoveKeybindButtonGroup(self.currentKeystrip)
        end
        -- won't try to replace keybind strip if there's a current one and it wasn't removed
        -- this occurs when current descriptor is pushed to stack, so can't be found
        if removed then
            self.currentKeystrip = keybindStrip
            if self.currentKeystrip then
                KEYBIND_STRIP:RemoveDefaultExit()
                KEYBIND_STRIP:AddKeybindButtonGroup(self.currentKeystrip)
            end
        end
    end
end
function ZO_CharacterCreate_Gamepad:SetFocus(newFocusControl)
    local oldFocusControl = self.focusControl
    if newFocusControl and oldFocusControl and oldFocusControl ~= newFocusControl then
        if newFocusControl.SetHighlightIndexByColumn and oldFocusControl.GetHighlightColumn then
            -- Highlight the current selection
            newFocusControl:SetHighlightIndexByColumn(oldFocusControl:GetHighlightColumn(), newFocusControl:GetFocusIndex() > oldFocusControl:GetFocusIndex())
        end
    end
    if oldFocusControl ~= nil and oldFocusControl.EnableFocus then
        oldFocusControl:EnableFocus(false)
    end
    self.focusControl = newFocusControl
    if newFocusControl ~= nil and newFocusControl.EnableFocus then
        newFocusControl:EnableFocus(true)
    end
    if not self.control:IsHidden() then
        self:RefreshKeybindStrip()
    end
end
function ZO_CharacterCreate_Gamepad:GetNextFocus(control)
    if control == nil then
        return nil
    end
    local bucket = control.info.bucketIndex
    local index = control.info.index
    while index < #(ZO_CHARACTER_CREATE_BUCKET_WINDOW_DATA_GAMEPAD[bucket].controls) do
        index = index + 1
        local newControl = self.controls[bucket][index]
        if newControl then
            return newControl
        end
    end
    return control
end
function ZO_CharacterCreate_Gamepad:GetPreviousFocus(self, control)
    if control == nil then
        return nil
    end
    local bucket = control.info.bucketIndex
    local index = control.info.index
    while index > 1 do
        index = index - 1
        local newControl = self.controls[bucket][index]
        if newControl then
            return newControl
        end
    end
    return control
end
-- Creator Control Initialization
function ZO_CharacterCreate_Gamepad:UpdateGenderSpecificText(currentGender)
    local characterMode = ZO_CHARACTERCREATE_MANAGER:GetCharacterMode()
    currentGender = currentGender or CharacterCreateGetGender(characterMode)
    ZO_CharacterCreate_GamepadLoreInfoRaceName:SetText(zo_strformat(SI_RACE_NAME, GetRaceName(currentGender, CharacterCreateGetRace(characterMode))))
    ZO_CharacterCreate_GamepadLoreInfoClassName:SetText(zo_strformat(SI_CLASS_NAME, GetClassName(currentGender, CharacterCreateGetClass(characterMode))))
end
local function SetSelectorsControlSelectedCenterOffset(control, numSelectors)
    if control then
        if numSelectors > GAMEPAD_SELECTOR_STRIDE then
            control.selectedCenterOffset = zo_ceil((numSelectors - GAMEPAD_SELECTOR_STRIDE) / GAMEPAD_SELECTOR_STRIDE) * SELECTOR_PER_ROW_CENTER_OFFSET
        else
            control.selectedCenterOffset = 0
        end
    end
end
-- override of ZO_CharacterCreate_Base:SetSelectorButtonEnabled
function ZO_CharacterCreate_Gamepad:SetSelectorButtonEnabled(selectorButton, radioGroup, enabled)
    radioGroup:SetButtonIsValidOption(selectorButton, enabled)
    local alpha = enabled and 1 or 0.5
    selectorButton:SetAlpha(alpha)
end
function ZO_CharacterCreate_Gamepad:InitializeSelectorButtonTextures(buttonControl, data)
    buttonControl:SetNormalTexture(data.gamepadNormalIcon)
    buttonControl:SetPressedTexture(data.gamepadPressedIcon)
end
function ZO_CharacterCreate_Gamepad:InitializeAllianceSelectors()
    local layoutTable =
    {
        ZO_CharacterCreate_GamepadAllianceAllianceSelector1,
        ZO_CharacterCreate_GamepadAllianceAllianceSelector2,
        ZO_CharacterCreate_GamepadAllianceAllianceSelector3,
    }
    local alliances = self.characterData:GetAllianceInfo()
    for _, alliance in ipairs(alliances) do
        local selector = layoutTable[alliance.position]
        self:InitializeAllianceSelector(selector, alliance)
    end
    SetSelectorsControlSelectedCenterOffset(ZO_CharacterCreate_GamepadAlliance, #alliances)
end
function ZO_CharacterCreate_Gamepad:InitializeRaceSelectors()
    local layoutTable =
    {
        ZO_CharacterCreate_GamepadRaceColumn11,
        ZO_CharacterCreate_GamepadRaceColumn21,
        ZO_CharacterCreate_GamepadRaceColumn31,
        ZO_CharacterCreate_GamepadRaceColumn12,
        ZO_CharacterCreate_GamepadRaceColumn22,
        ZO_CharacterCreate_GamepadRaceColumn32,
        ZO_CharacterCreate_GamepadRaceColumn13,
        ZO_CharacterCreate_GamepadRaceColumn23,
        ZO_CharacterCreate_GamepadRaceColumn33,
        ZO_CharacterCreate_GamepadRaceSingleButton,
    }
    -- Hide and reset buttons
    for i, button in ipairs(layoutTable) do
        button:SetHidden(true)
        button.nameFn = nil
        button.defId = nil
        button.alliance = nil
    end
    -- We either need to show 3, 4, 9, or 10 buttons
    -- 3 if they can't play any race any alliance or imperial
    -- 4 if they can't play any race any alliance but can play as imperial
    -- 9 if they can play any race any alliance but not imperial
    -- 10 if they can play any race any alliance and imperial
    local characterMode = ZO_CHARACTERCREATE_MANAGER:GetCharacterMode()
    local selectedAlliance = CharacterCreateGetAlliance(characterMode)
    local position = 1
    local finalRace
    local races = self.characterData:GetRaceInfo()
    for i, race in ipairs(races) do
        if race.alliance == 0 or race.alliance == selectedAlliance or CanPlayAnyRaceAsAnyAlliance() then
            race.position = position
            position = position + 1
            finalRace = race
        else
            race.position = GAMEPAD_SELECTOR_IGNORE_POSITION
        end
    end
    local raceObject = ZO_CharacterCreate_GamepadRace
    raceObject.numButtons = position - 1
    SetSelectorsControlSelectedCenterOffset(raceObject, raceObject.numButtons)
    for i, race in ipairs(races) do
        if race.position == GAMEPAD_SELECTOR_IGNORE_POSITION then
            --nothing for now
        else
            local raceButton = layoutTable[race.position]
            -- If there are 4 buttons we should center the final button
            if raceObject.numButtons == 4 and raceObject.numButtons == race.position then
                raceButton = layoutTable[5]
            end
            raceButton:SetHidden(false)
            self:InitializeSelectorButton(raceButton, race, self.raceRadioGroup)
            self:AddRaceSelectionDataToSelector(raceButton, race)
        end
    end
end
local function SetValidRace()
    local characterMode = ZO_CHARACTERCREATE_MANAGER:GetCharacterMode()
    local currentRace = CharacterCreateGetRace(characterMode)
    local currentAlliance = CharacterCreateGetAlliance(characterMode)
    local race = self.characterData:GetRaceForRaceDef(currentRace)
    if race then
        if race.alliance == 0 or race.alliance == currentAlliance or CanPlayAnyRaceAsAnyAlliance() then
            return
        end
    end
    local races = self.characterData:GetRaceInfo()
    for i, race in ipairs(races) do
        if race.alliance == 0 or race.alliance == currentAlliance or CanPlayAnyRaceAsAnyAlliance() then
            GAMEPAD_CHARACTER_CREATE_MANAGER:SetRace(race.race, "preventAllianceChange")
            return
        end
    end
end
function ZO_CharacterCreate_Gamepad:UpdateRaceControl()
    local characterMode = ZO_CHARACTERCREATE_MANAGER:GetCharacterMode()
    local currentRace = CharacterCreateGetRace(characterMode)
    local function IsRaceClicked(button)
        return button.defId == currentRace
    end
    self.raceRadioGroup:UpdateFromData(IsRaceClicked)
    ZO_CharacterCreate_GamepadRace.sliderObject:UpdateButtons()
    -- if we're focused on race, refocus to update name
    if ZO_CharacterCreate_GamepadRace.sliderObject.focused then
        ZO_CharacterCreate_GamepadRace.sliderObject:FocusButton(true)
    end
    local currentAlliance = CharacterCreateGetAlliance(characterMode)
    local function IsAllianceClicked(button)
        return button.defId == currentAlliance
    end
    self.allianceRadioGroup:UpdateFromData(IsAllianceClicked)
    ZO_CharacterCreate_GamepadAlliance.sliderObject:UpdateButtons()
    local race = self.characterData:GetRaceForRaceDef(currentRace)
    if race then
        self:UpdateGenderSpecificText()
        ZO_CharacterCreate_GamepadLoreInfoRaceDescription:SetText(race.lore)
        ZO_CharacterCreate_GamepadLoreInfoRaceIcon:SetTexture(race.gamepadPressedIcon)
        local alliance = self.characterData:GetAllianceForAllianceDef(currentAlliance)
        ZO_CharacterCreate_GamepadLoreInfoAllianceIcon:SetTexture(alliance.gamepadPressedIcon)
        ZO_CharacterCreate_GamepadLoreInfoAllianceName:SetText(zo_strformat(SI_ALLIANCE_NAME, alliance.name))
        ZO_CharacterCreate_GamepadLoreInfoAllianceDescription:SetText(alliance.lore)
    end
end
function ZO_CharacterCreate_Gamepad:UpdateClassControl()
    local characterMode = ZO_CHARACTERCREATE_MANAGER:GetCharacterMode()
    local currentClass = CharacterCreateGetClass(characterMode)
    local function IsClassClicked(button)
        return button.defId == currentClass
    end
    self.classRadioGroup:UpdateFromData(IsClassClicked)
    ZO_CharacterCreate_GamepadClass.sliderObject:UpdateButtons()
    local class = self.characterData:GetClassForClassDef(currentClass)
    if class then
        self:UpdateGenderSpecificText()
        ZO_CharacterCreate_GamepadLoreInfoClassIcon:SetTexture(class.gamepadPressedIcon)
        ZO_CharacterCreate_GamepadLoreInfoClassDescription:SetText(class.lore)
    end
end
local function UpdateSlider(slider)
    slider.sliderObject:Update()
end
local function FindBucketFromName(type, name)
    for k,v in pairs(ZO_CHARACTER_CREATE_BUCKET_WINDOW_DATA_GAMEPAD) do
        if v.controls then
            for index, item in ipairs(v.controls) do
                if item[1] == type and item[2] == name then
                    return k, index
                end
            end
        end
    end
    return nil
end
local function ControlComparator(data1, data2)
    local bucket1, index1 = data1.bucketIndex, data1.index
    local bucket2, index2 = data2.bucketIndex, data2.index
    if bucket1 == nil then
        return false
    elseif bucket2 == nil then
        return true
    end
    if bucket1 ~= bucket2 then
        return bucket1 < bucket2
    end
    return index1 < index2
end
function ZO_CharacterCreate_Gamepad:CreateGenderControl()
    self.genderSlider = self.sliderManager:AcquireObject(CHARACTER_CREATE_SLIDER_TYPE_GENDER)
    self.genderSlider:SetData()
end
function ZO_CharacterCreate_Gamepad:ResetControls()
    -- If this was being suppressed changes MUST be applied now or there will be no slider data to build
    self.sliderManager:ReleaseAllObjects()
    GAMEPAD_BUCKET_MANAGER:Reset()
    local controlData = {}
    self.controls = {}
    -- Sliders
    for i = 1, GetNumSliders() do
        local name, category, steps, value, defaultValue = GetSliderInfo(i)
        if name then
            local slider = self.sliderManager:AcquireObject(CHARACTER_CREATE_SLIDER_TYPE_SLIDER)
            slider:SetData(i, name, category, steps, value, defaultValue)
            local bucketIndex, index = FindBucketFromName(GAMEPAD_BUCKET_CONTROL_TYPE_SLIDER, name)
            if bucketIndex then
                local info = { bucketIndex = bucketIndex, index = index, type = GAMEPAD_BUCKET_CONTROL_TYPE_SLIDER, name = name, control = slider.control, updateFn = UpdateSlider, randomizeFn = RandomizeSlider }
                slider.info = info
                controlData[#controlData + 1] = info
                self.controls[bucketIndex] = self.controls[bucketIndex] or {}
                self.controls[bucketIndex][index] = slider
            else
                slider.control:SetHidden(true)       -- Hide unused controls
            end
        end
    end
    -- Appearances
    for i = 1, GetNumAppearances() do
        local name, appearanceType, numValues, displayName = GetAppearanceInfo(i)
        if numValues > 0 then
            local slider = self.sliderManager:AcquireObject(appearanceType)
            slider:SetData(name, numValues, displayName)
            local bucketIndex, index = FindBucketFromName(GAMEPAD_BUCKET_CONTROL_TYPE_APPEARANCE, name)
            if bucketIndex then
                local info = { bucketIndex = bucketIndex, index = index, type = GAMEPAD_BUCKET_CONTROL_TYPE_APPEARANCE, name = name, control = slider.control, updateFn = UpdateSlider, randomizeFn = RandomizeSlider }
                slider.info = info
                controlData[#controlData + 1] = info
                self.controls[bucketIndex] = self.controls[bucketIndex] or {}
                self.controls[bucketIndex][index] = slider
            else
                slider.control:SetHidden(true)       -- Hide unused controls
            end
        end
    end
    -- Custom controls
    local customControls = self.customBucketControls
    for bucketIndex, bucket in pairs(ZO_CHARACTER_CREATE_BUCKET_WINDOW_DATA_GAMEPAD) do
        if bucket.controls then
            for index, controlItem in ipairs(bucket.controls) do
                if controlItem[1] == GAMEPAD_BUCKET_CONTROL_TYPE_CUSTOM then
                    local controlInfo = customControls[ controlItem[2] ]
                    if controlInfo.shouldAdd then
                        local control = controlInfo.control
                        if type(control) == "function" then
                            control = control()
                        end
                        local info =    {
                                            index = index,
                                            type = GAMEPAD_BUCKET_CONTROL_TYPE_CUSTOM,
                                            bucketIndex = bucketIndex,
                                            control = control,
                                            updateFn = controlInfo.updateFn,
                                            randomizeFn = controlInfo.randomizeFn
                                        }
                        control.sliderObject = control.sliderObject or {}
                        control.sliderObject.info = info
                        controlData[#controlData + 1] = info
                        self.controls[bucketIndex] = self.controls[bucketIndex] or {}
                        self.controls[bucketIndex][index] = control.sliderObject
                    end
                end
            end
        end
    end
    table.sort(controlData, ControlComparator)
    for _, orderingData in ipairs(controlData) do
        GAMEPAD_BUCKET_MANAGER:AddControl(orderingData.control, orderingData.bucketIndex, orderingData.updateFn, orderingData.randomizeFn)
    end
    for category, bucket in pairs(ZO_CHARACTER_CREATE_BUCKET_WINDOW_DATA_GAMEPAD) do
        GAMEPAD_BUCKET_MANAGER:SetEnabled(category, (self.controls[category] ~= nil))
    end
    GAMEPAD_BUCKET_MANAGER:Finalize()
    -- TODO: this fixes a bug where the triangles don't reflect the correct data...there will be more fixes to pregameCharacterManager to address the real issue
    -- (where the triangle data needs to live on its own rather than being tied to the unit)
    self.physiqueTriangle:Update()
    self.faceTriangle:Update()
end
function ZO_CharacterCreate_Gamepad:OnGenerateRandomCharacter()
end
function ZO_CharacterCreate_Gamepad:Reset()
    -- Sanity check
    if not IsPregameCharacterConstructionReady() then
        return
    end
    SetCharacterCameraZoomAmount(-1) -- zoom all the way out when a reset happens
    SetSuppressCharacterChanges(true) -- this will be disabled later, right before controls are reset
    local controlsInitialized = false
    local characterMode = ZO_CHARACTERCREATE_MANAGER:GetCharacterMode()
    if characterMode == CHARACTER_MODE_CREATION then
        controlsInitialized = self:GenerateRandomCharacter()
    end
    if not controlsInitialized then
        self:ResetControls()
    end
    GAMEPAD_BUCKET_MANAGER:SwitchBuckets(INITIAL_BUCKET)
    GAMEPAD_BUCKET_MANAGER:SwitchBucketsInternal(INITIAL_BUCKET)
    GAMEPAD_BUCKET_MANAGER:UpdateControlsFromData()
    self.characterStartLocation = nil
    ZO_CHARACTERCREATE_MANAGER:SetShouldPromptForTutorialSkip(true)
    self.characterCreateOption = CHARACTER_CREATE_DEFAULT_LOCATION
end
local function AddClassSelectionDataToSelector(buttonControl, classData)
    buttonControl.nameFn = GetClassName
    buttonControl.defId = classData.class
end
function ZO_CharacterCreate_Gamepad:InitializeClassSelectors()
    local classes = self.characterData:GetClassInfo()
    local layoutTable
    -- TODO: Create these controls dynamically
    if #classes <= 4 then
        layoutTable = {
            ZO_CharacterCreate_GamepadClassColumn11,
            ZO_CharacterCreate_GamepadClassColumn21,
            ZO_CharacterCreate_GamepadClassColumn31,
            ZO_CharacterCreate_GamepadClassColumn22,
        }
    else -- assuming 5 classes
        layoutTable = {
            ZO_CharacterCreate_GamepadClassColumn11,
            ZO_CharacterCreate_GamepadClassColumn21,
            ZO_CharacterCreate_GamepadClassColumn31,
            ZO_CharacterCreate_GamepadClassColumn12,
            ZO_CharacterCreate_GamepadClassColumn22,
        }
    end
    -- Hide buttons
    for i, button in ipairs(layoutTable) do
        button:SetHidden(true)
    end
    for i, class in ipairs(classes) do
        class.position = i
        local classButton = layoutTable[i]
        assert(classButton ~= nil, "Unable to get class button for class #" .. i)
        self:InitializeSelectorButton(classButton, class, self.classRadioGroup)
        AddClassSelectionDataToSelector(classButton, class)
    end
    SetSelectorsControlSelectedCenterOffset(ZO_CharacterCreate_GamepadClass, #classes)
end
    g_randomizeAppearanceEnabled = enabled
end
function ZO_CharacterCreate_Gamepad:SetTemplate(templateId)
    local templateData = self.characterData:GetTemplate(templateId)
        if not templateData then
            return false
        end
    local characterMode = ZO_CHARACTERCREATE_MANAGER:GetCharacterMode()
    if not templateData.isSelectable or CharacterCreateGetTemplate(characterMode) == templateId then
            return false
        end
    CharacterCreateSetTemplate(templateId)
    GAMEPAD_BUCKET_MANAGER:SwitchBuckets(CREATE_BUCKET_RACE)
    -- Disable appearance related controls if the appearance is overridden in the template.
    local enabled = not templateData.overrideAppearance
    GAMEPAD_BUCKET_MANAGER:SetEnabled(CREATE_BUCKET_BODY, enabled)
    GAMEPAD_BUCKET_MANAGER:SetEnabled(CREATE_BUCKET_FACE, enabled)
    local validRaces = {}
    self:UpdateSelectorsForTemplate(function(...) return self:UpdateRaceSelectorsForTemplate(...) end, self.characterData:GetRaceInfo(), templateData, self.raceRadioGroup, validRaces)
    self:UpdateSelectorsForTemplate(function(...) return self:UpdateClassSelectorsForTemplate(...) end, self.characterData:GetClassInfo(), templateData, self.classRadioGroup)
    local validAlliances = {}
    self.characterData:UpdateAllianceSelectability()
    self:UpdateSelectorsForTemplate(function(...) return self:UpdateAllianceSelectorsForTemplate(...) end, self.characterData:GetAllianceInfo(), templateData, self.allianceRadioGroup, validAlliances)
    if templateData.gender ~= 0 then
        self.genderSlider:ToggleLocked()
    end
    -- Pick a race
    if templateData.race ~= 0 then
        CharacterCreateSetRace(templateData.race)
    else
        CharacterCreateSetRace(self.characterData:PickRandomRace(validRaces))
    end
    -- Pick an alliance
    local alliance = templateData.alliance
    if alliance == 0 then
        -- (never random unless a race without a fixed alliance is picked)
        alliance = self.characterData:GetRaceForRaceDef(CharacterCreateGetRace(characterMode)).alliance
        if alliance == 0 then
            alliance = self.characterData:PickRandomAlliance(validAlliances)
        end
    end
    self:SetAlliance(alliance, "preventRaceChange")
    -- Pick a class
    if templateData.class ~= 0 then
        CharacterCreateSetClass(templateData.class)
    else
        self:PickRandomSelectableClass()
    end
    
    -- Pick a gender
    if templateData.gender ~= 0 then
        CharacterCreateSetGender(templateData.gender)
    else
        self:PickRandomGender()
    end
    -- Make the controls match what you picked...
    self.genderSlider:Update()
    if not templateData.overrideAppearance then
    else
        InitializeAppearanceFromTemplate(templateId)
    end
    return true
end
function ZO_CharacterCreate_Gamepad:InitializeTemplatesDialog()
    local templates = self.characterData:GetTemplateInfo()
    local dialogDescription = 
    {
        gamepadInfo =
        {
            dialogType = GAMEPAD_DIALOGS.PARAMETRIC
        },
        setup = function(dialog)
            dialog:setupFunc()
        end,
        title =
        {
            text = GetString(SI_CREATE_CHARACTER_TEMPLATE_SELECT_TITLE),
        },
        mainText = 
        {
            text = GetString(SI_CREATE_CHARACTER_TEMPLATE_SELECT_DESCRIPTION),
        },
        parametricList = {},
       
        buttons =
        {
            {
                keybind = "DIALOG_PRIMARY",
                text = SI_GAMEPAD_SELECT_OPTION,
                callback = function(dialog)
                    local selectedData = dialog.entryList:GetTargetData()
                    if selectedData and selectedData.callback then
                        selectedData.callback()
                    end
                end,
            },
            {
                keybind = "DIALOG_NEGATIVE",
                text = SI_DIALOG_CANCEL,
            },
        }
    }
    for index, characterTemplate in ipairs(templates) do
        local data =
        {
            template = "ZO_GamepadMenuEntryTemplate",
            templateData = {
                isHome = true,
                text = characterTemplate.name,
                setup = ZO_SharedGamepadEntry_OnSetup,
                callback = function() 
                    self:SetTemplate(characterTemplate.template)
                end,
            },
        }
        table.insert(dialogDescription.parametricList, data)
    end
    
    ZO_Dialogs_RegisterCustomDialog("CHARACTER_CREATE_TEMPLATE_SELECT", dialogDescription)
end
function ZO_CharacterCreate_Gamepad:CreateCharacter(startLocation, createOption)
    if not self.isCreating then
        self.isCreating = true
        ZO_CharacterCreate_Base.CreateCharacter(self, startLocation, createOption)
    end
end
do
    -- Lore Info Controls
    local CREATE_LORE_INFO_CONTROLS =
    {
        [GAMEPAD_BUCKET_CUSTOM_CONTROL_ALLIANCE] = {
            "AllianceIcon",
            "AllianceName",
            "AllianceDescription",
        },
        [GAMEPAD_BUCKET_CUSTOM_CONTROL_RACE] = {
            "RaceIcon",
            "RaceName",
            "RaceDescription",
        },
        [GAMEPAD_BUCKET_CUSTOM_CONTROL_CLASS] = {
            "ClassIcon",
            "ClassName",
            "ClassDescription",
        },
    }
    function ZO_CharacterCreate_Gamepad:ShowLoreInfo(type)
        SCENE_MANAGER:AddFragment(CHARACTER_CREATE_GAMEPAD_LORE_INFO_FRAGMENT)
        SCENE_MANAGER:AddFragment(GAMEPAD_NAV_QUADRANT_4_BACKGROUND_FRAGMENT)
        for sourceType, t in pairs(CREATE_LORE_INFO_CONTROLS) do
            for i, control in pairs(t) do
                ZO_CharacterCreate_GamepadLoreInfo:GetNamedChild(control):SetHidden(type ~= sourceType)
            end
        end
    end
end
function ZO_CharacterCreate_Gamepad:HideLoreInfo()
    SCENE_MANAGER:RemoveFragment(CHARACTER_CREATE_GAMEPAD_LORE_INFO_FRAGMENT)
    SCENE_MANAGER:RemoveFragment(GAMEPAD_NAV_QUADRANT_4_BACKGROUND_FRAGMENT)
end
function ZO_CharacterCreate_Gamepad:ShowInformationTooltip(title, description)
    SCENE_MANAGER:AddFragment(CHARACTER_CREATE_GAMEPAD_INFORMATION_TOOLTIP_FRAGMENT)
    SCENE_MANAGER:AddFragment(GAMEPAD_NAV_QUADRANT_2_BACKGROUND_FRAGMENT)
    local infoTooltip = CHARACTER_CREATE_GAMEPAD_INFORMATION_TOOLTIP_FRAGMENT:GetControl()
    local titleLabel = infoTooltip:GetNamedChild("ContainerTitle")
    titleLabel:SetText(title)
    local descriptionLabel = infoTooltip:GetNamedChild("ContainerDescription")
    descriptionLabel:SetText(description)
end
function ZO_CharacterCreate_Gamepad:HideInformationTooltip()
    SCENE_MANAGER:RemoveFragment(CHARACTER_CREATE_GAMEPAD_INFORMATION_TOOLTIP_FRAGMENT)
    SCENE_MANAGER:RemoveFragment(GAMEPAD_NAV_QUADRANT_2_BACKGROUND_FRAGMENT)
end
-- XML Handlers and global functions
    if g_randomizeAppearanceEnabled then
        GAMEPAD_BUCKET_MANAGER:RandomizeAppearance(randomizeType)
    end
end
function ZO_CharacterCreate_Gamepad:ContainerOnUpdate()
    if self.focusControl and self.focusControl.disableFocusMovementController then
        -- Just do focus update
        if self.focusControl and self.focusControl.FocusUpdate then
            self.focusControl:FocusUpdate(moveFocus)
        end
        return
    end
    -- Handle Generic Option changes
    local changeOption = self.movementControllerChangeGenericOption:CheckMovement()
    if changeOption == MOVEMENT_CONTROLLER_MOVE_NEXT then
        if self.focusControl and self.focusControl.MoveNext then
            self.focusControl:MoveNext()
        end
    elseif changeOption == MOVEMENT_CONTROLLER_MOVE_PREVIOUS then
        if self.focusControl and self.focusControl.MovePrevious then
            self.focusControl:MovePrevious()
        end
    end
    local moveFocus = self.movementControllerMoveFocus:CheckMovement()
    local updatedFocusControl = false
    if self.focusControl and self.focusControl.FocusUpdate then
        updatedFocusControl = self.focusControl:FocusUpdate(moveFocus)
    end
    if not updatedFocusControl then
      -- Allow the bucketManager to consume the input
        if moveFocus == MOVEMENT_CONTROLLER_MOVE_NEXT then
            GAMEPAD_BUCKET_MANAGER:MoveNext()
        elseif moveFocus == MOVEMENT_CONTROLLER_MOVE_PREVIOUS then
            GAMEPAD_BUCKET_MANAGER:MovePrevious()
        end
    end
end
function ZO_CharacterCreate_Gamepad:InitializeForEditChanges(characterInfo, mode)
    local raceTemplate = characterInfo
    local customControls = self.customBucketControls
    if mode == CHARACTER_CREATE_MODE_EDIT_RACE then
        raceTemplate =  {
                            race = 0,
                            alliance = characterInfo.alliance,
                        }
        customControls[GAMEPAD_BUCKET_CUSTOM_CONTROL_ALLIANCE].shouldAdd = false
        customControls[GAMEPAD_BUCKET_CUSTOM_CONTROL_RACE].shouldAdd = true
        customControls[GAMEPAD_BUCKET_CUSTOM_CONTROL_CLASS].shouldAdd = false
    elseif mode == CHARACTER_CREATE_MODE_EDIT_APPEARANCE then
        customControls[GAMEPAD_BUCKET_CUSTOM_CONTROL_ALLIANCE].shouldAdd = false
        customControls[GAMEPAD_BUCKET_CUSTOM_CONTROL_RACE].shouldAdd = false
        customControls[GAMEPAD_BUCKET_CUSTOM_CONTROL_CLASS].shouldAdd = false
    end
    self:UpdateSelectorsForTemplate(function(...) return self:UpdateRaceSelectorsForTemplate(...) end, self.characterData:GetRaceInfo(), raceTemplate, self.raceRadioGroup)
    self:UpdateSelectorsForTemplate(function(...) return self:UpdateClassSelectorsForTemplate(...) end, self.characterData:GetClassInfo(), characterInfo, self.classRadioGroup)
    self:UpdateSelectorsForTemplate(function(...) return self:UpdateAllianceSelectorsForTemplate(...) end, self.characterData:GetAllianceInfo(), characterInfo, self.allianceRadioGroup)
    self:Reset()
    -- Make the controls match what you picked...
    self.genderSlider:Update()
end
function ZO_CharacterCreate_Gamepad:InitializeForAppearanceChange(characterInfo)
    self:InitializeForEditChanges(characterInfo, CHARACTER_CREATE_MODE_EDIT_APPEARANCE)
end
function ZO_CharacterCreate_Gamepad:InitializeForRaceChange(characterInfo)
    self:InitializeForEditChanges(characterInfo, CHARACTER_CREATE_MODE_EDIT_RACE)
end
function ZO_CharacterCreate_Gamepad:InitializeForCharacterCreate()
    self:SetCharacterCreateMode(CHARACTER_CREATE_MODE_CREATE)
    local customControls = self.customBucketControls
    customControls[GAMEPAD_BUCKET_CUSTOM_CONTROL_ALLIANCE].shouldAdd = true
    customControls[GAMEPAD_BUCKET_CUSTOM_CONTROL_RACE].shouldAdd = true
    customControls[GAMEPAD_BUCKET_CUSTOM_CONTROL_CLASS].shouldAdd = true
    local characterMode = ZO_CHARACTERCREATE_MANAGER:GetCharacterMode()
    local templateData = self.characterData:GetTemplate(CharacterCreateGetTemplate(characterMode))
    -- we may not have any template selected or we have no templates
    -- so create a default template with no restrictions
    if templateData == nil then
        templateData = self.characterData:GetNoneTemplate()
    end
    self:UpdateSelectorsForTemplate(function(...) return self:UpdateRaceSelectorsForTemplate(...) end, self.characterData:GetRaceInfo(), templateData, self.raceRadioGroup)
    self:UpdateSelectorsForTemplate(function(...) return self:UpdateClassSelectorsForTemplate(...) end, self.characterData:GetClassInfo(), templateData, self.classRadioGroup)
    self.characterData:UpdateAllianceSelectability()
    self:UpdateSelectorsForTemplate(function(...) return self:UpdateAllianceSelectorsForTemplate(...) end, self.characterData:GetAllianceInfo(), templateData, self.allianceRadioGroup)
    -- make sure the controls appear correctly
    self:ResetControls()
    -- Make the controls match what you picked...
    self.genderSlider:Update()
end
    GAMEPAD_BUCKET_MANAGER.isCreating = false
    GAMEPAD_CHARACTER_CREATE_MANAGER.focusControl:EnableFocus(false)
    ZO_Dialogs_ShowGamepadDialog(CHARACTER_CREATE_GAMEPAD_DIALOG)
end
    -- Gamepad pregame is only available to consoles or clients set to force the console flow
    -- so we won't create this on PC for some efficiency
    if IsInGamepadPreferredMode() then
        GAMEPAD_CHARACTER_CREATE_MANAGER = ZO_CharacterCreate_Gamepad:New(control)
        SYSTEMS:RegisterGamepadObject(ZO_CHARACTER_CREATE_SYSTEM_NAME, GAMEPAD_CHARACTER_CREATE_MANAGER)
        local containerBuckets = control:GetNamedChild("ContainerInnerBuckets")
        GAMEPAD_BUCKET_MANAGER = ZO_CharacterCreateBucketManager_Gamepad:New(containerBuckets)
    end
end
    if GAMEPAD_CHARACTER_CREATE_MANAGER.focusControl ~= nil and GAMEPAD_CHARACTER_CREATE_MANAGER.focusControl.OnPrimaryButtonPressed then
        GAMEPAD_CHARACTER_CREATE_MANAGER.focusControl:OnPrimaryButtonPressed()
    end
end
function ZO_CharacterCreate_Gamepad_DoCreate(startLocation, createOption)
    GAMEPAD_CHARACTER_CREATE_MANAGER:CreateCharacter(startLocation, createOption)
end
    GAMEPAD_CHARACTER_CREATE_MANAGER.isCreating = false
    ZO_CHARACTERCREATE_MANAGER:SetShouldPromptForTutorialSkip(true) -- should be prompted for tutorial again
end
    return GAMEPAD_CHARACTER_CREATE_MANAGER.isCreating
end
    local selectorHandlers =
    {
        [CHARACTER_CREATE_SELECTOR_RACE] =  function(button)
                        GAMEPAD_CHARACTER_CREATE_MANAGER:SetRace(button.defId)
                        GAMEPAD_CHARACTER_CREATE_MANAGER:UpdateRaceControl()
                    end,
        [CHARACTER_CREATE_SELECTOR_CLASS] = function(button)
                        CharacterCreateSetClass(button.defId)
                        GAMEPAD_CHARACTER_CREATE_MANAGER:UpdateClassControl()
                    end,
        [CHARACTER_CREATE_SELECTOR_ALLIANCE] =  function(button)
                            GAMEPAD_CHARACTER_CREATE_MANAGER:SetAlliance(button.defId, "preventRaceChange")
                            local oldPosition = ZO_CharacterCreate_GamepadRace.sliderObject:GetSelectedIndex()
                            GAMEPAD_CHARACTER_CREATE_MANAGER:InitializeRaceSelectors()
                            local newButton = ZO_CharacterCreate_GamepadRace.sliderObject:GetButton(oldPosition)
                            if newButton then
                                GAMEPAD_CHARACTER_CREATE_MANAGER:SetRace(newButton.defId)
                            else
                                SetValidRace()
                            end
                            GAMEPAD_CHARACTER_CREATE_MANAGER:UpdateRaceControl()
                        end,
    }
    local handler = selectorHandlers[button.selectorType]
    if handler then
        handler(button)
        PlaySound(SOUNDS.CC_GAMEPAD_CHARACTER_CLICK)
    end
end
    ZO_CharacterCreateAllianceSelector_Gamepad:New(control)
end
    ZO_CharacterCreateRaceSelector_Gamepad:New(control)
end
    ZO_CharacterCreateClassSelector_Gamepad:New(control)
end
    local ALWAYS_ANIMATE = true
    CHARACTER_CREATE_GAMEPAD_LORE_INFO_FRAGMENT = ZO_FadeSceneFragment:New(control, ALWAYS_ANIMATE)
end
    local ALWAYS_ANIMATE = true
    CHARACTER_CREATE_GAMEPAD_INFORMATION_TOOLTIP_FRAGMENT = ZO_FadeSceneFragment:New(control, ALWAYS_ANIMATE)
end
do
    local paperDollInputObject =
    {
        UpdateDirectionalInput = function(self)
            local mx, my = DIRECTIONAL_INPUT:GetXY(ZO_DI_RIGHT_STICK)
            if zo_abs(mx) > zo_abs(my) then
                local scalex = -6.0
                if mx ~= 0 then
                    CharacterCreateStartMouseSpin(mx * scalex)
                else
                    CharacterCreateStopMouseSpin()
                end
                StopCharacterCameraZoom()
            else
                if my > 0 then
                    MoveCharacterCameraZoomAmount(1)
                elseif my < 0 then
                    MoveCharacterCameraZoomAmount(-1)
                else
                    StopCharacterCameraZoom()
                end
                CharacterCreateStopMouseSpin()
            end
        end,
    }
        self.Activate = function()
            DIRECTIONAL_INPUT:Activate(paperDollInputObject, self)
        end
        self.Deactivate = function()
            DIRECTIONAL_INPUT:Deactivate(paperDollInputObject)
        end
        self.StopAllInput = function()
            CharacterCreateStopMouseSpin()
            StopCharacterCameraZoom()
        end
    end
end
    local parametricDialog = ZO_GenericGamepadDialog_GetControl(GAMEPAD_DIALOGS.PARAMETRIC)
    self.errorLabel = params.errorControl:GetNamedChild("Errors")
    local function UpdateSelectedName(name, suppressErrors)
        if parametricDialog.selectedName ~= name then
            parametricDialog.selectedName = name
            parametricDialog.nameViolations = { IsValidCharacterName(parametricDialog.selectedName) }
            parametricDialog.noViolations = #parametricDialog.nameViolations == 0
            parametricDialog.selectedName = CorrectCharacterNameCase(parametricDialog.selectedName)
            
            if not parametricDialog.noViolations then
                if suppressErrors then
                    SCENE_MANAGER:RemoveFragment(params.errorFragment)
                else
                    local HIDE_UNVIOLATED_RULES = true
                    local violationString = ZO_ValidNameInstructions_GetViolationString(parametricDialog.selectedName, parametricDialog.nameViolations, HIDE_UNVIOLATED_RULES, SI_CREATE_CHARACTER_GAMEPAD_INVALID_NAME_DIALOG_INSTRUCTION_FORMAT)
                    self.errorLabel:SetText(violationString)
                    SCENE_MANAGER:AddFragment(params.errorFragment)
                end
            else
                SCENE_MANAGER:RemoveFragment(params.errorFragment)
            end
        end
        KEYBIND_STRIP:UpdateCurrentKeybindButtonGroups()
    end
    local function ReleaseDialog()
        SCENE_MANAGER:RemoveFragment(params.errorFragment)
        ZO_Dialogs_ReleaseDialogOnButtonPress(params.dialogName)
    end 
    local function SetupDialog(dialog, data)
        dialog.selectedName = nil
        local headerData = {}
        if data ~= nil and data.characterName ~= nil then
            UpdateSelectedName(data.characterName)
        else
            local SUPPRESS_ERRORS = true
            UpdateSelectedName("", SUPPRESS_ERRORS)
        end
        if params and params.createHeaderDataFunction then
            headerData = params.createHeaderDataFunction(dialog, data)
        end
        dialog:setupFunc(nil, headerData)
    end
    local doneEntry = ZO_GamepadEntryData:New(GetString(SI_CREATE_CHARACTER_GAMEPAD_FINISH_DONE), "EsoUI/Art/Miscellaneous/Gamepad/gp_submit.dds")
    doneEntry.setup = function(control, data, selected, reselectingDuringRebuild, _, active)
        self.doneControl = control
        data.disabled = not parametricDialog.noViolations or self.isCreating
        local enabled = not data.disabled
        data:SetEnabled(enabled)
        ZO_SharedGamepadEntry_OnSetup(control, data, selected, reselectingDuringRebuild, enabled, active)
    end
    ZO_Dialogs_RegisterCustomDialog(params.dialogName,
    {
        mustChoose = true,
        canQueue = true,
        gamepadInfo = {
            dialogType = GAMEPAD_DIALOGS.PARAMETRIC,
        },
        setup = SetupDialog,
        OnShownCallback = function()
            -- Open Keyboard immediately on entering finishing character dialog
            if self.editBoxControl then
                self.editBoxControl:TakeFocus()
            end
        end,
        blockDialogReleaseOnPress = true, -- We'll handle Dialog Releases ourselves since we don't want DIALOG_PRIMARY to release the dialog on press.
        title =
        {
            text = params.dialogTitle,
        },
        mainText = 
        {
            text = params.dialogMainText,
        },
        parametricList =
        {
            -- name edit box
            {
                template = "ZO_Gamepad_GenericDialog_Parametric_TextFieldItem",
                templateData = {
                    nameField = true,
                    textChangedCallback = function(control) 
                        local newName = control:GetText()
                        
                        UpdateSelectedName(newName)
                        if control:GetText() ~= parametricDialog.selectedName then
                            control:SetText(parametricDialog.selectedName)
                        end
                    end,
                    setup = function(control, data, selected, reselectingDuringRebuild, enabled, active)
                        control.editBoxControl.textChangedCallback = data.textChangedCallback
                        
                        ZO_EditDefaultText_Initialize(control.editBoxControl, GetString(SI_CREATE_CHARACTER_GAMEPAD_ENTER_NAME))
                        local validInput = parametricDialog.selectedName and parametricDialog.selectedName ~= ""
                        if validInput then
                            control.editBoxControl:SetText(parametricDialog.selectedName)
                        end
                        
                        SetupEditControlForNameValidation(control.editBoxControl)
                        control.editBoxControl:SetMaxInputChars(CHARNAME_MAX_LENGTH)
                        control.highlight:SetHidden(not selected)
                        self.editBoxSelected = selected
                        self.editBoxControl = control.editBoxControl
                    end,
                },
            },
            -- Done menu item
            {
                template = "ZO_GamepadTextFieldSubmitItem",
                templateData = doneEntry,
            },
        },
       
        buttons =
        {
            {
                keybind = "DIALOG_PRIMARY",
                text = GetString(SI_CREATE_CHARACTER_GAMEPAD_FINISH_SELECT),
                callback = function(dialog)
                    if self.editBoxSelected then
                        local targetControl = dialog.entryList:GetTargetControl()
                        if targetControl and targetControl.editBoxControl then
                            targetControl.editBoxControl:TakeFocus()
                        end
                    else
                        if not dialog.noViolations then
                            return
                        end
                        ReleaseDialog()
                        if params.onFinish then
                            params.onFinish(dialog)
                        end
                    end
                end,
                enabled = function()
                    return self.editBoxSelected or parametricDialog.noViolations
                end,
            },
            {
                keybind = "DIALOG_NEGATIVE",
                text = GetString(SI_CREATE_CHARACTER_GAMEPAD_FINISH_BACK),
                callback = function(dialog)
                    ReleaseDialog()
                    if params.onBack then
                        params.onBack(dialog)
                    end
                    PlaySound(SOUNDS.GAMEPAD_MENU_BACK)
                end,
            },
        },
    })
end