Back to Home

ESO Lua File v101044

ingame/map/gamepad/worldmapinfo_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
local WorldMapInfo_Gamepad = ZO_WorldMapInfo_Shared:Subclass()
function WorldMapInfo_Gamepad:Initialize(control)
    ZO_WorldMapInfo_Shared.Initialize(self, control, ZO_TranslateFromLeftSceneFragment)
    GAMEPAD_WORLD_MAP_INFO_FRAGMENT = self:GetFragment()
end
function WorldMapInfo_Gamepad:Show()
    SCENE_MANAGER:AddFragment(GAMEPAD_WORLD_MAP_INFO_FRAGMENT)
    SCENE_MANAGER:AddFragment(GAMEPAD_NAV_QUADRANT_1_BACKGROUND_FRAGMENT)
end
function WorldMapInfo_Gamepad:Hide()
    SCENE_MANAGER:RemoveFragment(GAMEPAD_NAV_QUADRANT_1_BACKGROUND_FRAGMENT)
    SCENE_MANAGER:RemoveFragment(GAMEPAD_WORLD_MAP_INFO_FRAGMENT)
end
function WorldMapInfo_Gamepad:ShowCurrentFragments()
    if self.fragment then
        SCENE_MANAGER:AddFragment(self.fragment)
        if self.usesRightSideContent then
            SCENE_MANAGER:AddFragment(GAMEPAD_NAV_QUADRANT_4_BACKGROUND_FRAGMENT)
        end
    end
end
function WorldMapInfo_Gamepad:RemoveCurrentFragments()
    if self.fragment then
        SCENE_MANAGER:RemoveFragment(self.fragment)
        SCENE_MANAGER:RemoveFragment(GAMEPAD_NAV_QUADRANT_4_BACKGROUND_FRAGMENT)
    end
end
function WorldMapInfo_Gamepad:SwitchToFragment(fragment, usesRightSideContent)
    if self.fragment == fragment then
        return
    end
    self.fragment = fragment
    self.usesRightSideContent = usesRightSideContent
    if self:GetFragment():IsShowing() then
        self:ShowCurrentFragments()
    end
end
function WorldMapInfo_Gamepad:InitializeTabs()
    self.header = self.control:GetNamedChild("Container"):GetNamedChild("Header")
    ZO_GamepadGenericHeader_Initialize(self.header, ZO_GAMEPAD_HEADER_TABBAR_CREATE)
    local USES_RIGHT_SIDE_CONTENT = true
    local DOESNT_USE_RIGHT_SIDE_CONTENT = false
    -- Table for the Window data. Each entry is a tab in the UI.
    self.tabBarEntries = 
    {
        {
            text = GetString(SI_MAP_INFO_MODE_QUESTS),
            callback = function() self:SwitchToFragment(GAMEPAD_WORLD_MAP_QUESTS_FRAGMENT, USES_RIGHT_SIDE_CONTENT) end,
        },
        {
            text = GetString(SI_ZONE_STORY_ACTIVITY_COMPLETION_HEADER),
            callback = function()
                self:SwitchToFragment(WORLD_MAP_ZONE_INFO_STORY_GAMEPAD_FRAGMENT, USES_RIGHT_SIDE_CONTENT)
            end,
            visible = function()
                return WORLD_MAP_ZONE_STORY_GAMEPAD and WORLD_MAP_ZONE_STORY_GAMEPAD:HasZoneStoryData()
            end,
        },
        {
            text = GetString(SI_MAP_INFO_MODE_LOCATIONS),
            callback = function()
                self:SwitchToFragment(GAMEPAD_WORLD_MAP_LOCATIONS_FRAGMENT, USES_RIGHT_SIDE_CONTENT)
            end,
        },
        {
            text = GetString(SI_MAP_INFO_MODE_FILTERS),
            callback = function()
                self:SwitchToFragment(GAMEPAD_WORLD_MAP_FILTERS_FRAGMENT, DOESNT_USE_RIGHT_SIDE_CONTENT)
            end,
        },
        {
            text = GetString(SI_MAP_INFO_MODE_HOUSES),
            callback = function()
                self:SwitchToFragment(GAMEPAD_WORLD_MAP_HOUSES:GetFragment(), DOESNT_USE_RIGHT_SIDE_CONTENT)
            end,
        },
        {
            text = GetString(SI_MAP_INFO_MODE_ANTIQUITIES),
            callback = function()
                self:SwitchToFragment(WORLD_MAP_ANTIQUITIES_GAMEPAD:GetFragment(), DOESNT_USE_RIGHT_SIDE_CONTENT)
            end,
            visible = AreAntiquitySkillLinesDiscovered,
        },
    }
    self.baseHeaderData = 
    {
        tabBarEntries = self.tabBarEntries,
    }
    ZO_GamepadGenericHeader_Refresh(self.header, self.baseHeaderData)
    CALLBACK_MANAGER:RegisterCallback("OnWorldMapChanged", function()
        ZO_GamepadGenericHeader_Refresh(self.header, self.baseHeaderData)
    end)
end
function WorldMapInfo_Gamepad:OnShowing()
    CALLBACK_MANAGER:FireCallbacks("WorldMapInfo_Gamepad_Showing")
    ZO_GamepadGenericHeader_Refresh(self.header, self.baseHeaderData)
end
function WorldMapInfo_Gamepad:OnHiding()
    --The fragments must hide immediately on removal otherwise they won't have removed their keybinds before the world map keybinds are restored on the line below.
end
function WorldMapInfo_Gamepad:OnHidden()
    CALLBACK_MANAGER:FireCallbacks("WorldMapInfo_Gamepad_Hidden")
end
function WorldMapInfo_Gamepad:GetHeaderNarration()
    return ZO_GamepadGenericHeader_GetNarrationText(self.header, self.baseHeaderData)
end
--Global
    GAMEPAD_WORLD_MAP_INFO = WorldMapInfo_Gamepad:New(ZO_WorldMapInfo_Gamepad)
end
    PlaySound(SOUNDS.GAMEPAD_MENU_BACK)
    GAMEPAD_WORLD_MAP_INFO:Hide()
end