ESO Lua File v100012

ingame/gamepad/playermenu/playermenu.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
local function ShowLogoutDialog()
    ZO_Dialogs_ShowPlatformDialog("LOG_OUT")
end
--[[
menuTable = the table to add the entry to. MUST exist and be a table
entryName = the display name in the menu.
icon = the icon displayed to the left of the name. Can be nil.
isNew = function or boolean determining if the new icon indicator should display. Can be nil.
isVisibleCallback = function determining when to show the entry. If nil, the entry is always shown.
header = string to set as the header for the entry. Can be nil. If header is an empty string, the entry will have a blank header.
--]]
local function AddEntryToMenu(menuTable, entryName, icon, sceneName, isNew, isVisibleCallback, header)
    local entry = ZO_GamepadEntryData:New(entryName, icon, nil, nil, isNew)
    entry.scene = sceneName
    if header then
        entry:SetHeader(header)
    end
    table.insert(menuTable, entry)
    return entry
end
-- a table of layout information to display a list of scenes available to the user
-- Entries are addded to the list in order, so the first entry added to the table appears at the top of the list
-- If you disable a category in PlayerMenu.lua you should also disable it in MainMenu.lua
local function GetLayoutData()
    local layoutData = {}
    -- Notifications --
    local MARK_NOTIFICATIONS_NEW = true -- when we have notifications, we are always new
    local notifications = AddEntryToMenu(layoutData, "", "EsoUI/Art/MenuBar/Gamepad/gp_playerMenu_icon_notifications.dds", "gamepad_notifications_root", MARK_NOTIFICATIONS_NEW,
                                            function()
                                                if GAMEPAD_NOTIFICATIONS then
                                                    return GAMEPAD_NOTIFICATIONS:GetNumNotifications() > 0
                                                else
                                                    return false
                                                end
                                            end)
    notifications.refreshCallback = function()
                                        local numNotifications = GAMEPAD_NOTIFICATIONS and GAMEPAD_NOTIFICATIONS:GetNumNotifications() or 0
                                        local textString = zo_strformat(SI_GAMEPAD_MAIN_MENU_NOTIFICATIONS, numNotifications)
                                        notifications:SetText(textString)
                                    end
    notifications:refreshCallback()
    -- Crown Store --
    local market = AddEntryToMenu(layoutData, GetString(SI_GAMEPAD_MAIN_MENU_MARKET_ENTRY), "EsoUI/Art/MenuBar/Gamepad/gp_PlayerMenu_icon_store.dds", "gamepad_market_pre_scene")
    market.additionalScenes =   {
                                    "gamepad_market",
                                    "gamepad_market_preview",
                                    "gamepad_market_bundle_contents",
                                    "gamepad_market_purchase",
                                    "gamepad_market_locked",
                                }
    market.disableWhenDead = true
    -- Collections --
    local collections = AddEntryToMenu(layoutData, GetString(SI_MAIN_MENU_COLLECTIONS), "EsoUI/Art/MenuBar/Gamepad/gp_playerMenu_icon_collections.dds", "gamepadCollectionsBook")
    collections:SetNew(function() return GAMEPAD_NOTIFICATIONS and GAMEPAD_NOTIFICATIONS:GetNumCollectionsNotifications() > 0 or false end)
    collections.disableWhenDead = true
    -- Inventory --
    AddEntryToMenu(layoutData, GetString(SI_MAIN_MENU_INVENTORY), "EsoUI/Art/MenuBar/Gamepad/gp_playerMenu_icon_inventory.dds", "gamepad_inventory_root",
                    function() return SHARED_INVENTORY:AreAnyItemsNew(nil, nil, BAG_BACKPACK) end)
    -- Character Sheet --
    local character = AddEntryToMenu(layoutData, GetString(SI_MAIN_MENU_CHARACTER), "EsoUI/Art/MenuBar/Gamepad/gp_playerMenu_icon_character.dds", "gamepad_stats_root")
    character.canLevel = function() return GetAttributeUnspentPoints() > 0 end
    -- Skills --
    local skills = AddEntryToMenu(layoutData, GetString(SI_MAIN_MENU_SKILLS), "EsoUI/Art/MenuBar/Gamepad/gp_playerMenu_icon_skills.dds", "gamepad_skills_root")
    skills.canLevel = function() return GetAvailableSkillPoints() > 0 end
    skills.canAnimate = true
    
    -- Champion --
    local champion = AddEntryToMenu(layoutData, GetString(SI_MAIN_MENU_CHAMPION), "EsoUI/Art/MenuBar/Gamepad/gp_playerMenu_icon_champion.dds", "gamepad_championPerks_root",
                                        function()
                                            if CHAMPION_PERKS then
                                                return CHAMPION_PERKS:IsChampionSystemNew()
                                            end
                                        end,
                                        function() return IsChampionSystemUnlocked() end)
    champion.canLevel = function()
        if CHAMPION_PERKS then
            return CHAMPION_PERKS:HasAnyUnspentPoints()
        end
    end
    -- Alliance War --
    AddEntryToMenu(layoutData, GetString(SI_PLAYER_MENU_CAMPAIGNS), "EsoUI/Art/MenuBar/Gamepad/gp_playerMenu_icon_allianceWar.dds", "gamepad_campaign_root",
                    function()
                        local tutorialId = GetTutorialId(TUTORIAL_TRIGGER_CAMPAIGN_BROWSER_OPENED)
                        if CanTutorialBeSeen(tutorialId) then
                            return not HasSeenTutorial(tutorialId)
                        end
                        return false
                    end,
                    function()
                        local currentLevel = GetUnitLevel("player")
                        return currentLevel >= GetMinLevelForCampaignTutorial()
                    end)
    -- Journal Menu --
    local journal = AddEntryToMenu(layoutData, GetString(SI_MAIN_MENU_JOURNAL), "EsoUI/Art/MenuBar/Gamepad/gp_playerMenu_icon_quests.dds")
    journal.subMenu = {}
    -- Quests --
    AddEntryToMenu(journal.subMenu, GetString(SI_GAMEPAD_MAIN_MENU_JOURNAL_QUESTS), "EsoUI/Art/MenuBar/Gamepad/gp_playerMenu_icon_quests.dds", "gamepad_quest_journal", nil, nil, GetString(SI_MAIN_MENU_JOURNAL))
    -- Cadwell's Journal --
    AddEntryToMenu(journal.subMenu, GetString(SI_GAMEPAD_MAIN_MENU_JOURNAL_CADWELL), "EsoUI/Art/MenuBar/Gamepad/gp_playerMenu_icon_cadwell.dds", "cadwellGamepad", nil,
                    function()
                        return GetPlayerDifficultyLevel() > PLAYER_DIFFICULTY_LEVEL_FIRST_ALLIANCE
                    end)
    -- Lore Library --
    AddEntryToMenu(journal.subMenu, GetString(SI_GAMEPAD_MAIN_MENU_JOURNAL_LORE_LIBRARAY), "EsoUI/Art/MenuBar/Gamepad/gp_playerMenu_icon_loreLibrary.dds", "loreLibraryGamepad")
    -- Achievements --
    AddEntryToMenu(journal.subMenu, GetString(SI_GAMEPAD_MAIN_MENU_JOURNAL_ACHIEVEMENTS), "EsoUI/Art/MenuBar/Gamepad/gp_playerMenu_icon_achievements.dds", "achievementsGamepad")
    -- Leaderboards --
    AddEntryToMenu(journal.subMenu, GetString(SI_JOURNAL_MENU_LEADERBOARDS), "EsoUI/Art/MenuBar/Gamepad/gp_playerMenu_icon_leaderBoards.dds", "gamepad_leaderboards")
    -- Social Menu --
    local social = AddEntryToMenu(layoutData, GetString(SI_MAIN_MENU_SOCIAL), "EsoUI/Art/MenuBar/Gamepad/gp_playerMenu_icon_multiplayer.dds", nil,
                                        function()
                                            return HasUnreadMail()
                                        end)
    social.subMenu = {}
    -- Voice Chat --
    if IsConsoleUI() then
        AddEntryToMenu(social.subMenu, GetString(SI_MAIN_MENU_GAMEPAD_VOICECHAT), "EsoUI/Art/MenuBar/Gamepad/gp_playerMenu_icon_communications.dds", "gamepad_voice_chat", nil, nil, GetString(SI_MAIN_MENU_SOCIAL))
    
            -- Text Chat --
        if IsChatSystemAvailableForCurrentPlatform() then
            AddEntryToMenu(social.subMenu, GetString(SI_GAMEPAD_TEXT_CHAT), "EsoUI/Art/MenuBar/Gamepad/gp_playerMenu_icon_communications.dds", "gamepad_text_chat")
        end
    end
    -- Emotes --
    local headerText
    if not IsConsoleUI() then
        headerText = GetString(SI_MAIN_MENU_SOCIAL)
    end
    AddEntryToMenu(social.subMenu, GetString(SI_GAMEPAD_MAIN_MENU_EMOTES), "EsoUI/Art/MenuBar/Gamepad/gp_playerMenu_icon_emotes.dds", "gamepad_player_emote", nil, nil, headerText)
    -- Group --
    AddEntryToMenu(social.subMenu, GetString(SI_PLAYER_MENU_GROUP), "EsoUI/Art/MenuBar/Gamepad/gp_playerMenu_icon_groups.dds", "gamepad_groupList")
    -- Guilds --
    AddEntryToMenu(social.subMenu, GetString(SI_MAIN_MENU_GUILDS), "EsoUI/Art/MenuBar/Gamepad/gp_playerMenu_icon_guilds.dds", "gamepad_guild_hub")
    -- Friends --
    AddEntryToMenu(social.subMenu, GetString(SI_GAMEPAD_CONTACTS_FRIENDS_LIST_TITLE), "EsoUI/Art/MenuBar/Gamepad/gp_playerMenu_icon_contacts.dds", "gamepad_friends")
    -- Ignored List --
    if not IsConsoleUI() then
        AddEntryToMenu(social.subMenu, GetString(SI_GAMEPAD_CONTACTS_IGNORED_LIST_TITLE), "EsoUI/Art/MenuBar/Gamepad/gp_playerMenu_icon_contacts.dds", "gamepad_ignored")
    end
    -- Mail --
    local mailbox = AddEntryToMenu(social.subMenu, GetString(SI_MAIN_MENU_MAIL), "EsoUI/Art/MenuBar/Gamepad/gp_playerMenu_icon_mail.dds", "mailManagerGamepad",
                                    function()
                                        return HasUnreadMail()
                                    end)
    mailbox.disableWhenDead = true
    mailbox.disableWhenInCombat = true
    mailbox.disableWhenReviving = true
    -- Help --
    AddEntryToMenu(layoutData, GetString(SI_MAIN_MENU_HELP), "EsoUI/Art/MenuBar/Gamepad/gp_playerMenu_icon_help.dds", "helpRootGamepad")
    -- Options --
    AddEntryToMenu(layoutData, GetString(SI_GAMEPAD_OPTIONS_MENU), "EsoUI/Art/MenuBar/Gamepad/gp_playerMenu_icon_settings.dds", "gamepad_options_root")
    -- Log Out --
    local logOut = AddEntryToMenu(layoutData, GetString(SI_GAME_MENU_LOGOUT), "EsoUI/Art/MenuBar/Gamepad/gp_playerMenu_icon_logout.dds")
    return layoutData
end
local CATEGORY_LAYOUT_INFO = GetLayoutData()
local GENERIC_ENTRY_TEMPLATE = "ZO_GamepadNewMenuEntryTemplate"
local ENTRY_WITH_SUB_MENU_TEMPLATE = "ZO_GamepadMenuEntryTemplateWithArrow"
local ANIMATING_ENTRY_TEMPLATE = "ZO_GamepadNewAnimatingMenuEntryTemplate"
local MODE_MAIN_LIST = 1
local MODE_SUBLIST = 2
--
--[[ ZO_PlayerMenuManager ]]--
--
local ZO_PlayerMenuManager = ZO_Gamepad_ParametricList_Screen:Subclass()
function ZO_PlayerMenuManager:New(control)
    return ZO_Gamepad_ParametricList_Screen.New(self, control)
end
function ZO_PlayerMenuManager:Initialize(control)
    PLAYER_MENU_SCENE = ZO_Scene:New("playerMenu", SCENE_MANAGER)
    PLAYER_SUBMENU_SCENE = ZO_Scene:New("playerSubmenu", SCENE_MANAGER)
    local DONT_ACTIVATE_ON_SHOW = false
    ZO_Gamepad_ParametricList_Screen.Initialize(self, control, ZO_GAMEPAD_HEADER_TABBAR_DONT_CREATE, DONT_ACTIVATE_ON_SHOW, PLAYER_MENU_SCENE)
    control.header:SetHidden(true)
    self.mainList = self:GetMainList()
    self.subList = self:AddList("Submenu")
    self.lastList = self.mainList
    self.mode = MODE_MAIN_LIST
    control:RegisterForEvent(EVENT_LEVEL_UPDATE,
            function()
                self:RefreshLists()
            end)
    control:AddFilterForEvent(EVENT_LEVEL_UPDATE, REGISTER_FILTER_UNIT_TAG, "player")
    control:RegisterForEvent(EVENT_DIFFICULTY_LEVEL_CHANGED, function() self:RefreshLists() end)
    PLAYER_SUBMENU_SCENE:RegisterCallback("StateChange", function(oldState, newState)
        if newState == SCENE_SHOWING then
            self.mode = MODE_SUBLIST
        end
        ZO_Gamepad_ParametricList_Screen.OnStateChanged(self, oldState, newState)
    end)
end
function ZO_PlayerMenuManager:OnShowing()
    self:RefreshLists()
    -- Both PLAYER_MENU_SCENE and PLAYER_SUBMENU_SCENE use OnShowing to set the active list, which also adds the appropriate list fragment to the scene
    -- Two separate scenes are needed for this to properly control the direction the fragments conveyor in and out.
    self:SetCurrentList(self.mode == MODE_SUBLIST and self.subList or self.mainList)
end
function ZO_PlayerMenuManager:OnHiding()
    self.mode = MODE_MAIN_LIST
end
do
    local function ReanchorList(list)
        local control = list:GetControl()
        local container = control:GetParent()
        control:ClearAnchors()
        control:SetAnchorFill(container)
    end
    function ZO_PlayerMenuManager:ReanchorListsOverHeader()
        ReanchorList(self.mainList)
        ReanchorList(self.subList)
    end
end
local function AnimatingLabelEntrySetup(control, data, selected, reselectingDuringRebuild, enabled, active)
    ZO_SharedGamepadEntry_OnSetup(control, data, selected, reselectingDuringRebuild, enabled, active)
    local totalSpendablePoints = GetAttributeUnspentPoints()
    if totalSpendablePoints ~= nil then
        local shouldAnimate = totalSpendablePoints > 0
        local animatingControl = control.label
        local animatingControlTimeline = animatingControl.animationTimeline
        local isAnimating = animatingControlTimeline:IsPlaying()
        if(shouldAnimate ~= isAnimating) then
            animatingControl:SetText(animatingControl.text[1])
            if(shouldAnimate) then
                animatingControl.textIndex = 1
                animatingControlTimeline:PlayFromStart()
            else
                animatingControlTimeline:Stop()
                animatingControl:SetAlpha(1)
            end
        end
    end
end
local function EntryWithSubMenuSetup(control, data, selected, reselectingDuringRebuild, enabled, active)
    ZO_SharedGamepadEntry_OnSetup(control, data, selected, reselectingDuringRebuild, enabled, active)
    local color = data:GetNameColor(selected)
    if type(color) == "function" then
        color = color(data)
    end
end
function ZO_PlayerMenuManager:SetupList(list)
    list:AddDataTemplateWithHeader(GENERIC_ENTRY_TEMPLATE, ZO_SharedGamepadEntry_OnSetup, ZO_GamepadMenuEntryTemplateParametricListFunction, nil, "ZO_GamepadMenuEntryHeaderTemplate")
    list:AddDataTemplateWithHeader(ENTRY_WITH_SUB_MENU_TEMPLATE, EntryWithSubMenuSetup, ZO_GamepadMenuEntryTemplateParametricListFunction, nil, "ZO_GamepadMenuEntryHeaderTemplate")
end
do
    local function GetCategoryState(categoryInfo)
        if MAIN_MENU_SINGLETON:IsPlayerDead() and categoryInfo.disableWhenDead then
            return MAIN_MENU_CATEGORY_DISABLED_WHILE_DEAD
        elseif MAIN_MENU_SINGLETON:IsPlayerInCombat() and categoryInfo.disableWhenInCombat then
            return MAIN_MENU_CATEGORY_DISABLED_WHILE_IN_COMBAT
        elseif MAIN_MENU_SINGLETON:IsPlayerReviving() and categoryInfo.disableWhenReviving then
            return MAIN_MENU_CATEGORY_DISABLED_WHILE_REVIVING
        else
            return MAIN_MENU_CATEGORY_ENABLED
        end
    end
    local function TryHideCategoryScene(categoryInfo)
        local shouldHide = false
        if SCENE_MANAGER:IsShowing(categoryInfo.scene) then
            shouldHide = true
        elseif categoryInfo.additionalScenes then
            for _, sceneName in ipairs(categoryInfo.additionalScenes) do
                if SCENE_MANAGER:IsShowing(sceneName) then
                    shouldHide = true
                    break
                end
            end
        end
        if shouldHide then
            SCENE_MANAGER:ShowBaseScene()
        end
    end
    local function DetermineCategoryEnabled(categoryInfo)
        local shouldBeEnabled = GetCategoryState(categoryInfo) == MAIN_MENU_CATEGORY_ENABLED
        categoryInfo:SetEnabled(shouldBeEnabled)
        if not shouldBeEnabled then
            TryHideCategoryScene(categoryInfo)
        end
    end
    function ZO_PlayerMenuManager:UpdateCategories()
        for _, categoryInfo in ipairs(CATEGORY_LAYOUT_INFO) do
            DetermineCategoryEnabled(categoryInfo)
            if categoryInfo.subMenu then
                for _, subCategoryInfo in ipairs(categoryInfo.subMenu) do
                    DetermineCategoryEnabled(subCategoryInfo)
                end
            end
        end
        self:RefreshLists()
    end
end
function ZO_PlayerMenuManager:RefreshLists()
    if self.mode == MODE_MAIN_LIST then
        self:RefreshMainList()
    else
        local targetData = self.mainList:GetTargetData()
        self:RefreshSubList(targetData)
    end
end
function ZO_PlayerMenuManager:OnDeferredInitialize()
    local function MarkNewnessDirty()
        self:MarkNewnessDirty()
    end
    local function OnBlockingSceneCleared(nextSceneData, showBaseScene)
        if IsInGamepadPreferredMode() then
            if showBaseScene then
                SCENE_MANAGER:ShowBaseScene()
            elseif nextSceneData and nextSceneData.sceneName then
                SCENE_MANAGER:Toggle(nextSceneData.sceneName)
            end
        end
    end
    SHARED_INVENTORY:RegisterCallback("FullInventoryUpdate", MarkNewnessDirty)
    SHARED_INVENTORY:RegisterCallback("SingleSlotInventoryUpdate", MarkNewnessDirty)
    EVENT_MANAGER:RegisterForEvent("PlayerMenu", EVENT_LEVEL_UPDATE, MarkNewnessDirty)
    EVENT_MANAGER:RegisterForEvent("PlayerMenu", EVENT_MAIL_NUM_UNREAD_CHANGED, MarkNewnessDirty)
    MAIN_MENU_SINGLETON:RegisterCallback("OnPlayerStateUpdate", function() self:UpdateCategories() end)
    MAIN_MENU_SINGLETON:RegisterCallback("OnBlockingSceneCleared", OnBlockingSceneCleared)
end
function ZO_PlayerMenuManager:InitializeKeybindStripDescriptors()
    self.keybindStripDescriptor = {
        alignment = KEYBIND_STRIP_ALIGN_LEFT,
        {
            name = GetString(SI_MAIN_MENU_GAMEPAD_VOICECHAT),
            keybind = "UI_SHORTCUT_TERTIARY",
            visible = function() return IsConsoleUI() end,
            callback = function() SCENE_MANAGER:Push("gamepad_voice_chat") end,
        },
        {
            name = GetString(SI_GAMEPAD_MAIN_MENU_EMOTES),
            keybind = "UI_SHORTCUT_SECONDARY",
            callback = function() SCENE_MANAGER:Push("gamepad_player_emote") end,
        }
    }
    local  function IsForwardNavigationEnabled()
        local currentList = self:GetCurrentList() 
        local categoryInfo = currentList and currentList:GetTargetData()
        return categoryInfo and categoryInfo:IsEnabled()
    end
    ZO_Gamepad_AddForwardNavigationKeybindDescriptors(self.keybindStripDescriptor, GAME_NAVIGATION_TYPE_BUTTON, function() self:SwitchToSelectedScene(self:GetCurrentList()) end, nil, nil, IsForwardNavigationEnabled)
    ZO_Gamepad_AddBackNavigationKeybindDescriptors(self.keybindStripDescriptor, GAME_NAVIGATION_TYPE_BUTTON, function()
        if self:IsCurrentList(self.mainList) then
            self:Exit()
        else
            SCENE_MANAGER:HideCurrentScene()
        end
    end)
end
function ZO_PlayerMenuManager:SwitchToSelectedScene(list)
    local targetData = list:GetTargetData()
    if targetData.enabled then
        local scene = targetData.scene
        local activatedCallback = targetData.activatedCallback
        if scene then
            list:SetActive(false)
            SCENE_MANAGER:Push(scene)
        elseif targetData.subMenu then
            list:SetActive(false)
            SCENE_MANAGER:Push("playerSubmenu")
        elseif activatedCallback then
            activatedCallback()
        end
    else
        PlaySound(SOUNDS.PLAYER_MENU_ENTRY_DISABLED)
    end
end
function ZO_PlayerMenuManager:Exit()
    SCENE_MANAGER:Hide("playerMenu")
end
local function AddEntryToList(list, entry)
    if not entry.isVisibleCallback or entry.isVisibleCallback() then
        if entry.refreshCallback then
            entry.refreshCallback()
        end
        entry:SetIconTintOnSelection(true)
        entry:SetIconDisabledTintOnSelection(true)
        local entryTemplate = GENERIC_ENTRY_TEMPLATE
        
        if entry.canAnimate then
            entryTemplate = ANIMATING_ENTRY_TEMPLATE
        elseif entry.subMenu then
            entryTemplate = ENTRY_WITH_SUB_MENU_TEMPLATE
        end
        if entry.header then
            list:AddEntryWithHeader(entryTemplate, entry)
        else
            list:AddEntry(entryTemplate, entry)
        end
    end
end
function ZO_PlayerMenuManager:RefreshMainList()
    self.mainList:Clear()
    for _, layout in ipairs(CATEGORY_LAYOUT_INFO) do
        AddEntryToList(self.mainList, layout)
    end
    -- if we haven't yet initialized, set the default selection to be the inventory
    -- we only need to default to inventory the first time the Player Menu is shown
    -- so as soon as we init, we don't need to update this any more
    if not self.initialized then
        -- notifications will appear at the top of the list if there are any available
        local INVENTORY_LIST_INDEX = GAMEPAD_NOTIFICATIONS:GetNumNotifications() == 0 and 3 or 4
        self.mainList:SetDefaultSelectedIndex(INVENTORY_LIST_INDEX)
    end
    self.mainList:Commit()
end
function ZO_PlayerMenuManager:RefreshSubList(targetData)
    self.subList:Clear()
    if targetData and targetData.subMenu then
        for _, entry in ipairs(targetData.subMenu) do
            AddEntryToList(self.subList, entry)
        end
    end
    self.subList:Commit()
end
function ZO_PlayerMenuManager:IsShowing()
    return SCENE_MANAGER:IsShowing("playerMenu") or SCENE_MANAGER:IsShowing("playerSubmenu")
end
function ZO_PlayerMenuManager:ShowLastCategory()
    SCENE_MANAGER:Show("playerMenu")
end
function ZO_PlayerMenuManager:MarkNewnessDirty()
    if self:IsShowing() then
        self:RefreshLists()
    end
end
function ZO_PlayerMenuManager:OnNumNotificationsChanged(numNotifications)
end
function ZO_PlayerMenuManager:ShowScene(sceneName)
    if MAIN_MENU_SINGLETON:HasBlockingScene() then
        local sceneData = {
            sceneName = sceneName,
        }
        MAIN_MENU_SINGLETON:ActivatedBlockingScene_Scene(sceneData)
    else
        SCENE_MANAGER:Toggle(sceneName)
    end
end
function ZO_PlayerMenuManager:AttemptShowBaseScene()
    if MAIN_MENU_SINGLETON:HasBlockingScene() then
        MAIN_MENU_SINGLETON:ActivatedBlockingScene_BaseScene()
    else
        SCENE_MANAGER:ShowBaseScene()
    end
end
    PLAYER_MENU = ZO_PlayerMenuManager:New(self)
end