Back to Home

ESO Lua File v101042

ingame/inventory/gamepad/itemtransferdialog_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
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
local ItemTransferDialog_Gamepad = ZO_ItemTransferDialog_Base:Subclass()
function ItemTransferDialog_Gamepad:New(...)
    return ZO_ItemTransferDialog_Base.New(self, ...)
end
function ItemTransferDialog_Gamepad:Initialize()
    ZO_ItemTransferDialog_Base.Initialize(self)
    local setupFunc = function(dialog)
                        dialog:setupFunc()
                        -- hide the left icon as we only want to show the stack that's going to be transferred
                        dialog.icon1:SetHidden(true)
                        dialog.sliderValue1:SetHidden(true)
                      end
    local callbackFunc = function(dialog)
                            local quantity = ZO_GenericGamepadItemSliderDialogTemplate_GetSliderValue(dialog)
                            self:Transfer(quantity)
                        end
    ZO_Dialogs_RegisterCustomDialog("ITEM_TRANSFER_ADD_TO_CRAFT_BAG_GAMEPAD",
    {
        canQueue = true,
        gamepadInfo = {
            dialogType = GAMEPAD_DIALOGS.ITEM_SLIDER,
        },
        setup = setupFunc,
        title =
        {
            text = SI_PROMPT_TITLE_ADD_ITEMS_TO_CRAFT_BAG,
        },
        buttons =
        {
            {
                text =  SI_ITEM_ACTION_ADD_ITEMS_TO_CRAFT_BAG,
                callback =  callbackFunc,
            },
            {
                text = SI_DIALOG_CANCEL,
            }
        }
    })
    ZO_Dialogs_RegisterCustomDialog("ITEM_TRANSFER_REMOVE_FROM_CRAFT_BAG_GAMEPAD",
    {
        canQueue = true,
        gamepadInfo = {
            dialogType = GAMEPAD_DIALOGS.ITEM_SLIDER,
        },
        setup = setupFunc,
        title =
        {
            text = SI_PROMPT_TITLE_REMOVE_ITEMS_FROM_CRAFT_BAG,
        },
        buttons =
        {
            {
                text =  SI_ITEM_ACTION_REMOVE_ITEMS_FROM_CRAFT_BAG,
                callback =  callbackFunc,
            },
            {
                text = SI_DIALOG_CANCEL,
            }
        }
    })
end
function ItemTransferDialog_Gamepad:ShowDialog()
    local maxStack = self:GetTransferMaximum()
    local dialogData =
                {
                    sliderMin = 1,
                    sliderMax = maxStack,
                    sliderStartValue = maxStack,
                    bagId = self.bag,
                    slotIndex = self.slotIndex,
                }
    
    if self.targetBag == BAG_VIRTUAL then
        ZO_Dialogs_ShowGamepadDialog("ITEM_TRANSFER_ADD_TO_CRAFT_BAG_GAMEPAD", dialogData)
    else
        ZO_Dialogs_ShowGamepadDialog("ITEM_TRANSFER_REMOVE_FROM_CRAFT_BAG_GAMEPAD", dialogData)
    end
end
-------------------
-- Global functions
-------------------
    local dialog = ItemTransferDialog_Gamepad:New()
    SYSTEMS:RegisterGamepadObject("ItemTransferDialog", dialog)
end