Back to Home

ESO Lua File v100023

ingame/giftinventory/keyboard/giftinventorydialogs_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
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
-- Claim Gift
    local noteEdit = self:GetNamedChild("NoteEdit")
    local randomNoteButton = self:GetNamedChild("NoteRandomText"):GetNamedChild("Button")
    randomNoteButton:SetText(zo_iconFormat("EsoUI/Art/Market/Keyboard/giftMessageIcon_up.dds", "100%", "100%"))
    randomNoteButton:SetHandler("OnClicked", function()
        noteEdit:SetText(GetRandomGiftThankYouNoteText())
    end)
    ZO_Dialogs_RegisterCustomDialog("CONFIRM_CLAIM_GIFT_KEYBOARD",
    {
        title =
        {
            text = SI_CONFIRM_CLAIM_GIFT_TITLE,
        },
      
        customControl = self,
        setup = function(dialog, gift)
            local noteHeaderLabel = dialog:GetNamedChild("NoteHeader")
            noteHeaderLabel:SetText(zo_strformat(SI_CONFIRM_CLAIM_GIFT_NOTE_ENTRY_HEADER, ZO_WHITE:Colorize(gift:GetUserFacingPlayerName())))
            dialog:GetNamedChild("NoteEdit"):SetText("")
        end,
        buttons =
        {
            -- Cancel Button
            {
                control = self:GetNamedChild("Cancel"),
                keybind = "DIALOG_NEGATIVE",
                text = GetString(SI_DIALOG_CANCEL),
            },
            -- Confirm Button
            {
                control = self:GetNamedChild("Confirm"),
                keybind = "DIALOG_PRIMARY",
                text = GetString(SI_DIALOG_CONFIRM),
                callback = function(dialog)
                    local noteText = dialog:GetNamedChild("NoteEdit"):GetText()
                    dialog.data:TakeGift(noteText)
                end,
                clickSound = SOUNDS.GIFT_INVENTORY_ACTION_CLAIM,
            },
        },
    })
end
-- Return Gift
    -- We don't have prewritten notes for returning gifts
    self:GetNamedChild("NoteRandomText"):SetHidden(true)
    ZO_Dialogs_RegisterCustomDialog("CONFIRM_RETURN_GIFT_KEYBOARD",
    {
        title =
        {
            text = SI_CONFIRM_RETURN_GIFT_TITLE,
        },
      
        customControl = self,
        setup = function(dialog, gift)
            dialog:GetNamedChild("NoteEdit"):SetText("")
        end,
        buttons =
        {
            -- Cancel Button
            {
                control = self:GetNamedChild("Cancel"),
                keybind = "DIALOG_NEGATIVE",
                text = GetString(SI_DIALOG_CANCEL),
            },
            -- Confirm Button
            {
                control = self:GetNamedChild("Confirm"),
                keybind = "DIALOG_PRIMARY",
                text = GetString(SI_DIALOG_CONFIRM),
                callback = function(dialog)
                    local noteText = dialog:GetNamedChild("NoteEdit"):GetText()
                    dialog.data:ReturnGift(noteText)
                end,
            },
        },
    })
end
-- Delete Gift
ZO_Dialogs_RegisterCustomDialog("CONFIRM_DELETE_GIFT_KEYBOARD",
{
    title =
    {
        text = SI_CONFIRM_DELETE_GIFT_TITLE,
    },
    mainText =
    {
        text = SI_CONFIRM_DELETE_GIFT_PROMPT,
    },
      
    buttons =
    {
        -- Confirm Button
        {
            keybind = "DIALOG_PRIMARY",
            text = GetString(SI_DIALOG_CONFIRM),
            callback = function(dialog)
                local gift = dialog.data
                gift:DeleteGift()
            end,
        },
        -- Cancel Button
        {
            keybind = "DIALOG_NEGATIVE",
            text = GetString(SI_DIALOG_CANCEL),
        },
    },
})