Back to Home

ESO Lua File v100023

ingame/logout/dailyrewardslogouttile.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
----
-- ZO_DailyRewardsLogoutTile
----
ZO_DailyRewardsLogoutTile = ZO_Object:MultiSubclass(ZO_ActionTile, ZO_DailyRewards_TileInfo)
function ZO_DailyRewardsLogoutTile:New(...)
    return ZO_ActionTile.New(self, ...)
end
function ZO_DailyRewardsLogoutTile:Initialize(control)
    ZO_ActionTile.Initialize(self, control)
    control:RegisterForEvent(EVENT_DAILY_LOGIN_REWARDS_UPDATED, function() self:RefreshLayout() end)
    control:RegisterForEvent(EVENT_NEW_DAILY_LOGIN_REWARD_AVAILABLE, function() self:RefreshLayout() end)
end
function ZO_DailyRewardsLogoutTile:PostInitialize()
    ZO_ActionTile.PostInitialize(self, control)
    self:SetActionCallback(function() self:ViewReward() end)
    self:SetActionText(GetString(SI_DAILY_LOGIN_REWARDS_TILE_VIEW_REWARDS))
end
function ZO_DailyRewardsLogoutTile:OnControlShown()
    ZO_Tile.OnControlShown(self)
    self.control:SetHandler("OnUpdate", function(_, currentTimeS) self:OnCountDownLabelUpdate(currentTimeS) end)
end
function ZO_DailyRewardsLogoutTile:OnControlHidden()
    ZO_Tile.OnControlHidden(self)
    self.control:SetHandler("OnUpdate", nil)
end
function ZO_DailyRewardsLogoutTile:OnCountDownLabelUpdate()
    -- if action is not available, it means we are waiting for the next daily reward
    if not self:IsActionAvailable() then
        self:RefreshHeaderText()
    end
end
function ZO_DailyRewardsLogoutTile:RefreshLayoutInternal()
    local dailyRewardIndex = ZO_DAILYLOGINREWARDS_MANAGER:GetDailyLoginRewardIndex()
    self:Layout(dailyRewardIndex)
end
function ZO_DailyRewardsLogoutTile:RefreshHeaderText()
    else
    end
end
function ZO_DailyRewardsLogoutTile:Layout(dailyRewardIndex)
    ZO_Tile.Layout(self, dailyRewardIndex)
     local showingCurrentReward = dailyRewardIndex == GetDailyLoginClaimableRewardIndex()
    self:SetActionAvailable(showingCurrentReward)
     
    local title, background = self:GetTitleAndBackground(dailyRewardIndex)
    self:SetTitle(title)
    self:SetBackground(background)
end
function ZO_DailyRewardsLogoutTile:ViewReward()
    ZO_DAILYLOGINREWARDS_MANAGER:ShowDailyLoginRewardsScene()
end