Back to Home

ESO Lua File v101041

internalingame/marketannouncement/eventannouncementtile.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
----
-- ZO_EventAnnouncementTile
----
ZO_EventAnnouncementTile = ZO_ActionTile:Subclass()
function ZO_EventAnnouncementTile:New(...)
    return ZO_ActionTile.New(self, ...)
end
function ZO_EventAnnouncementTile:Initialize(control)
    ZO_ActionTile.Initialize(self, control)
    self.control:SetHandler("OnUpdate", function()
        local remainingTime = ZO_MARKET_ANNOUNCEMENT_MANAGER:GetEventAnnouncementRemainingTimeByIndex(self.data.index)
        self:SetHeaderText(self:GetTimeRemainingText(remainingTime))
    end)
end
function ZO_EventAnnouncementTile:GetTimeRemainingText(remainingTime)
    local countDownText = ZO_FormatTime(remainingTime, TIME_FORMAT_STYLE_COLONS, TIME_FORMAT_PRECISION_TWELVE_HOUR_NO_SECONDS)
    return zo_strformat(SI_EVENT_ANNOUNCEMENT_TIME, countDownText)
end
function ZO_EventAnnouncementTile:Layout(data)
    ZO_Tile.Layout(self, data)
    self.data = ZO_MARKET_ANNOUNCEMENT_MANAGER:GetEventAnnouncementDataByIndex(data.eventAnnouncementIndex)
    self:SetActionAvailable(self.data.marketProductId ~= 0)
    -- The tile on all platforms is of a landscape dimension rather than portrait as in gamepad,
    -- so we want to use the keyboard background on tiles regardless of platform.
    self:SetBackground(self.data.tileImage)
end