Back to Home

ESO Lua File v100024

internalingame/marketannouncement/gamepad/marketannouncementmarketproducttile_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
----
-- ZO_MarketAnnouncementMarketProductTile_Gamepad
----
-- Primary logic class must be subclassed after the platform class so that platform specific functions will have priority over the logic class functionality
ZO_MarketAnnouncementMarketProductTile_Gamepad = ZO_Object.MultiSubclass(ZO_ActionTile_Gamepad, ZO_MarketAnnouncementMarketProductTile)
function ZO_MarketAnnouncementMarketProductTile_Gamepad:New(...)
    return ZO_MarketAnnouncementMarketProductTile.New(self, ...)
end
function ZO_MarketAnnouncementMarketProductTile_Gamepad:InitializePlatform()
    ZO_ActionTile_Gamepad.InitializePlatform(self)
    self.helpButtonKeybindDescriptor = 
    {
        name = GetString(SI_MARKET_ANNOUNCEMENT_HELP_BUTTON),
        keybind = "UI_SHORTCUT_SECONDARY",
        sound = function()
             if self:IsActionAvailable() then
                return SOUNDS.DIALOG_ACCEPT
            else
                return SOUNDS.DIALOG_DECLINE
            end
        end,
        visible = function()
            return self:IsHelpButtonKeybindVisible()
        end,
        callback = function()
            if self.marketProduct then
                local helpCategoryIndex, helpIndex = GetMarketAnnouncementHelpLinkIndices(self.marketProduct.marketProductId)
                RequestShowSpecificHelp(helpCategoryIndex, helpIndex)
            end
        end
    }
end
function ZO_MarketAnnouncementMarketProductTile_Gamepad:IsHelpButtonKeybindVisible()
    local marketProductType = GetMarketProductType(self.marketProduct.marketProductId)
    return marketProductType == MARKET_PRODUCT_TYPE_PROMO
end
function ZO_MarketAnnouncementMarketProductTile_Gamepad:Layout(marketProduct, selected)
    ZO_MarketAnnouncementMarketProductTile.Layout(self, marketProduct, selected)
    local tile = self.control.object
    tile:SetActionCallback(function() ZO_GAMEPAD_MARKET_ANNOUNCEMENT:OnMarketAnnouncementViewCrownStoreKeybind() end)
    tile:SetSelected(selected)
end
function ZO_MarketAnnouncementMarketProductTile_Gamepad:SetSelected(isSelected)
    ZO_ActionTile_Gamepad.SetSelected(self, isSelected)
    if self.marketProduct then
        self.marketProduct:SetIsFocused(isSelected)
        -- Set hidden state for help keybind if marketProduct is a promo product
        if self.keybindButton and self.keybindAnchorControl and self.keybindHelpButton and self.keybindHelpButton:GetKeybindButtonDescriptorReference() == self.helpButtonKeybindDescriptor then
            if isSelected then
                if self:IsHelpButtonKeybindVisible() then
                    self.keybindButton:SetAnchor(TOPRIGHT, self.keybindHelpButton, TOPLEFT)
                    self.keybindHelpButton:SetAnchor(TOPRIGHT, self.keybindAnchorControl, TOPLEFT)
                    self.keybindHelpButton:SetHidden(false)
                else
                    self.keybindButton:SetAnchor(TOPRIGHT, self.keybindAnchorControl, TOPLEFT)
                    self.keybindHelpButton:SetHidden(true)
                end
            end
        end
    end
end
function ZO_MarketAnnouncementMarketProductTile_Gamepad:UpdateKeybindButton()
    ZO_ActionTile_Gamepad.UpdateKeybindButton(self)
    if self.keybindHelpButton and self:IsSelected() then
        self.keybindHelpButton:SetKeybindButtonDescriptor(self.helpButtonKeybindDescriptor)
    end
end
function ZO_MarketAnnouncementMarketProductTile_Gamepad:SetHelpKeybindButton(keybindHelpButton)
    self.keybindHelpButton = keybindHelpButton
end
function ZO_MarketAnnouncementMarketProductTile_Gamepad:SetKeybindAnchorControl(keybindAnchorControl)
    self.keybindAnchorControl = keybindAnchorControl
end
-----
-- Global XML Functions
-----
    ZO_MarketAnnouncementMarketProductTile_Gamepad:New(control)
end