Back to Home

ESO Lua File v100028

ingame/logout/keyboard/logoutdialog_keyboard.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
local function SetupLogoutDialog(dialog)
    local isLocked = ZO_DAILYLOGINREWARDS_MANAGER:IsDailyRewardsLocked()
     local dailyRewardTile = dialog:GetNamedChild("DailyRewardTile")
     if dailyRewardTile then
        dailyRewardTile.object:SetHidden(isLocked)
        dailyRewardTile.object:SetActionAvailable(not isLocked)
          dailyRewardTile.object:RefreshLayout()
     end
     local dividerControl = dialog:GetNamedChild("TileDivider")
    dividerControl:SetHidden(isLocked)
end
     ZO_Dialogs_RegisterCustomDialog("LOG_OUT",
        {
            customControl = self,
            setup = SetupLogoutDialog,
            canQueue = true,
            title =
            {
                text = SI_PROMPT_TITLE_LOG_OUT,
            },
            updateFn = function(dialog) -- if lock status changes, make sure to update the tile visibility
                local isLocked = ZO_DAILYLOGINREWARDS_MANAGER:IsDailyRewardsLocked()
                local dailyRewardTile = dialog:GetNamedChild("DailyRewardTile")
                if dailyRewardTile.object:IsActionAvailable() == isLocked then
                    SetupLogoutDialog(dialog)
                end
            end,
            buttons =
            {
                {
                    keybind = "DIALOG_PRIMARY",
                    control = self:GetNamedChild("Confirm"),
                    text = SI_LOG_OUT_GAME_CONFIRM_KEYBIND,
                    callback = function(dialog)
                        Logout()
                    end
                },
                {
                    control = self:GetNamedChild("Cancel"),
                    text = SI_DIALOG_CANCEL,
                },
            },
        })
end