Back to Home

ESO Lua File v101038

ingame/logout/gamepad/logoutdialog_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
local function SetupLogoutDialog(dialog)
     local dailyRewardTile = dialog:GetNamedChild("DailyRewardTile")
    local isLocked = ZO_DAILYLOGINREWARDS_MANAGER:IsDailyRewardsLocked()
     if dailyRewardTile then
        local tileObject = dailyRewardTile.object
        tileObject:SetHidden(isLocked)
          tileObject:SetActionAvailable(not isLocked)
          tileObject:RefreshLayout()
          tileObject:SetSelected(true)
     end
    local dividerControl = dialog:GetNamedChild("TileDivider")
    dividerControl:SetHidden(isLocked)
end
    local dailyRewardTile = self:GetNamedChild("DailyRewardTile")
    local tileObject = dailyRewardTile.object
    tileObject:SetKeybindKey("DIALOG_SECONDARY")
    tileObject:RegisterCallback("OnRefreshLayout", function() ZO_GenericGamepadDialog_RefreshKeybinds(self) end)
     ZO_Dialogs_RegisterCustomDialog("GAMEPAD_LOG_OUT",
    {
          gamepadInfo = 
          {
               dialogType = GAMEPAD_DIALOGS.CUSTOM
          },
        customControl = self,
        setup = SetupLogoutDialog,
        updateFn = function(dialog)
            local isLocked = ZO_DAILYLOGINREWARDS_MANAGER:IsDailyRewardsLocked()
            if tileObject:IsActionAvailable() == isLocked then
                tileObject:SetHidden(isLocked)
                  tileObject:SetActionAvailable(not isLocked)
                tileObject:RefreshLayout()
                ZO_GenericGamepadDialog_RefreshKeybinds(self)
                local dividerControl = dialog:GetNamedChild("TileDivider")
                dividerControl:SetHidden(isLocked)
            end
        end,
        OnHiddenCallback = CleanupLogoutDialog,
        blockDialogReleaseOnPress = true,
        canQueue = true,
        title =
        {
            text = SI_PROMPT_TITLE_LOG_OUT,
        },
        buttons =
        {
            {
                keybind = "DIALOG_PRIMARY",
                text = SI_LOG_OUT_GAME_CONFIRM_KEYBIND,
                callback = function(dialog)
                    Logout()
                    ZO_Dialogs_ReleaseDialogOnButtonPress("GAMEPAD_LOG_OUT")
                end
            },
            tileObject:GetKeybindDescriptor(),
            {
                keybind = "DIALOG_NEGATIVE",
                text = SI_DIALOG_CANCEL,
                callback = function(dialog)
                    ZO_Dialogs_ReleaseDialogOnButtonPress("GAMEPAD_LOG_OUT")
                end
            },
        },
    })
end