ESO Lua File v100015

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
local WorldMapInfo_Gamepad = ZO_WorldMapInfo_Shared:Subclass()
function WorldMapInfo_Gamepad:New(...)
    local object = ZO_WorldMapInfo_Shared.New(self, ...)
    return object
end
function WorldMapInfo_Gamepad:Initialize(control)
    ZO_WorldMapInfo_Shared.Initialize(self, control)
    GAMEPAD_WORLD_MAP_INFO_FRAGMENT = ZO_FadeSceneFragment:New(control)
    GAMEPAD_WORLD_MAP_INFO_FRAGMENT:RegisterCallback("StateChange", function(oldState, newState)
        if(newState == SCENE_FRAGMENT_SHOWING) then
            ZO_GamepadGenericHeader_Activate(self.header)
            ZO_WorldMap_SetGamepadKeybindsShown(false)
            self:ShowCurrentFragments()
        elseif(newState == SCENE_FRAGMENT_HIDDEN) then
            self:RemoveCurrentFragments()
        end
    end)
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_WORLD_MAP_INFO_FRAGMENT)
    SCENE_MANAGER:RemoveFragment(GAMEPAD_NAV_QUADRANT_1_BACKGROUND_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 SCENE_MANAGER:IsShowing("gamepad_worldMap") 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_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
        },
    }
    self.baseHeaderData = {
        tabBarEntries = self.tabBarEntries,
    }
    ZO_GamepadGenericHeader_Refresh(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