Back to Home

ESO Lua File v100018

ingame/map/gamepad/worldmapkeepupgrade_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
--Keep Upgrade Window Gamepad
local SYMBOL_PARAMS = {
    FIRST_SECTION_OFFSET_X = 39,
    FIRST_SECTION_OFFSET_Y = 50,
    SYMBOL_PADDING_X = 10,
    SYMBOL_PADDING_Y = 0,
    SYMBOL_SECTION_OFFSET_X = 0,
    SYMBOL_SECTION_OFFSET_Y = 20,
}
local NORMAL_BUTTON_TEXTURE = "EsoUI/Art/ActionBar/abilityFrame64_up.dds"
local FOCUSED_BUTTON_TEXTURE = "EsoUI/Art/ActionBar/actionBar_mouseOver.dds"
local MapKeepUpgrade_Gamepad = ZO_Object.MultiSubclass(ZO_MapKeepUpgrade_Shared, ZO_GamepadGrid)
function MapKeepUpgrade_Gamepad:New(...)
    local object = ZO_MapKeepUpgrade_Shared.New(self, ...)
    return object
end
function MapKeepUpgrade_Gamepad:Initialize(control)
    self.symbolParams = SYMBOL_PARAMS
    self.selector = control:GetNamedChild("Selector")
    self.sideContent = control:GetNamedChild("SideContent")
    local ROW_MAJOR_GRID = true
    ZO_GamepadGrid.Initialize(self, control, ROW_MAJOR_GRID)
    self.levelLayout = "ZO_WorldMapKeepUpgradeLevel_Gamepad"
    self.buttonLayout = "ZO_WorldMapKeepUpgradeButton_Gamepad"
    self.scrollTooltip = control:GetNamedChild("SideContent"):GetNamedChild("Tooltip")
    ZO_ScrollTooltip_Gamepad:Initialize(self.scrollTooltip, ZO_TOOLTIP_STYLES, "worldMapTooltip")
    zo_mixin(self.scrollTooltip, ZO_MapInformationTooltip_Gamepad_Mixin)
    ZO_Scroll_Gamepad_SetScrollIndicatorSide(self.scrollTooltip.scrollIndicator, ZO_SharedGamepadNavQuadrant_4_Background, LEFT)
    ZO_MapKeepUpgrade_Shared.Initialize(self, control)
    self.fragment = ZO_FadeSceneFragment:New(control)
    self.fragment:RegisterCallback("StateChange", function(oldState, newState)
        if(newState == SCENE_FRAGMENT_SHOWN) then
            self:RefreshAll()
            DIRECTIONAL_INPUT:Activate(self, control)
            SCENE_MANAGER:AddFragment(GAMEPAD_NAV_QUADRANT_4_BACKGROUND_FRAGMENT)
        elseif(newState == SCENE_FRAGMENT_HIDDEN) then
            self.keepUpgradeObject = nil
            DIRECTIONAL_INPUT:Deactivate(self)
            self.scrollTooltip:ClearLines()
            SCENE_MANAGER:RemoveFragment(GAMEPAD_NAV_QUADRANT_4_BACKGROUND_FRAGMENT)
        end
    end)
end
function MapKeepUpgrade_Gamepad:RefreshAll()
    self:ClearButtonHighlight()     -- Need to do this before RefreshLevels so the button is back to normal
    self:RefreshData()
    self:RefreshLevels()
end
function MapKeepUpgrade_Gamepad:RefreshData()
    self.keepUpgradeObject = GAMEPAD_WORLD_MAP_KEEP_INFO:GetKeepUpgradeObject()
end
function MapKeepUpgrade_Gamepad:ClearButtonHighlight()
    self.selector:SetHidden(true)
end
function MapKeepUpgrade_Gamepad:GetGridItems()
    return self.buttons
end
function MapKeepUpgrade_Gamepad:RefreshGridHighlight()
    -- Unhighlight old button
    self.scrollTooltip:ClearLines()
    local x, y = self:GetGridPosition()
    local button = self.buttons[y][x]
    local selector = self.selector
    if button then
        selector:SetParent(button)
        selector:SetAnchor(CENTER, button, CENTER, 0, 0)
        selector:SetHidden(false)
        local info = button.info
        
        if info.description and info.description ~= "" then
            self.scrollTooltip:LayoutKeepUpgrade(info.name, info.description)
        end
    else
        selector:SetHidden(true)
    end
end
--Globals
    GAMEPAD_WORLD_MAP_KEEP_UPGRADE = MapKeepUpgrade_Gamepad:New(self)
    GAMEPAD_WORLD_MAP_KEEP_INFO:SetFragment("UPGRADE_FRAGMENT", GAMEPAD_WORLD_MAP_KEEP_UPGRADE:GetFragment())
end