ESO Lua File v100011

ingame/banking/gamepad/banking_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
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
local MODE_WITHDRAW = 1
local MODE_DEPOSIT = 2
local BANKING_INTERACTION =
{
    type = "Banking",
    interactTypes = { INTERACTION_BANK },
}
local GOLD_ICON_16 = zo_iconFormat(GAMEPAD_INVENTORY_CURRENCY_ICON_GOLD_TEXTURE, 16, 16)
local GOLD_ICON_24 = zo_iconFormat(GAMEPAD_INVENTORY_CURRENCY_ICON_GOLD_TEXTURE, 24, 24)
-----------------------
-- Gamepad Banking
-----------------------
local GAMEPAD_BANKING_SCENE_NAME = "gamepad_banking"
ZO_GamepadBanking = ZO_Gamepad_ParametricList_Screen:Subclass()
function ZO_GamepadBanking:New(...)
    return ZO_Gamepad_ParametricList_Screen.New(self, ...)
end
local function OnCloseBank()
    if IsInGamepadPreferredMode() then
        SCENE_MANAGER:Hide(GAMEPAD_BANKING_SCENE_NAME)
    end
end
function ZO_GamepadBanking:Initialize(control)
    local function OnOpenBank()
        if IsInGamepadPreferredMode() then
            self.firstOpenedModeIndex = MODE_WITHDRAW
            SCENE_MANAGER:Show(GAMEPAD_BANKING_SCENE_NAME)
        end
    end
    self.isInitialized = false
    local DONT_ACTIVATE_LIST_ON_SHOW = false
    GAMEPAD_BANKING_SCENE = ZO_InteractScene:New(GAMEPAD_BANKING_SCENE_NAME, SCENE_MANAGER, BANKING_INTERACTION)
    ZO_Gamepad_ParametricList_Screen.Initialize(self, control, ZO_GAMEPAD_HEADER_TABBAR_CREATE, DONT_ACTIVATE_LIST_ON_SHOW, GAMEPAD_BANKING_SCENE)
    self.control:RegisterForEvent(EVENT_OPEN_BANK, OnOpenBank)
    self.control:RegisterForEvent(EVENT_CLOSE_BANK, OnCloseBank)
end
function ZO_GamepadBanking:OnStateChanged(oldState, newState)
    if newState == SCENE_SHOWING then
        self:RegisterForEvents()
        if self.firstOpenedModeIndex then
            self:SetMode(self.firstOpenedModeIndex)
            self.firstOpenedModeIndex = nil
        end
        self:RefreshHeaderData()
        self.header:SetHidden(false)
        self:SetCurrentList(self.currentItemList)
        KEYBIND_STRIP:AddKeybindButtonGroup(self.mainKeybindStripDescriptor)
    elseif newState == SCENE_HIDDEN then
        self:UnregisterForEvents()
        self:DisableCurrentList()
        self.header:SetHidden(true)
        KEYBIND_STRIP:RemoveKeybindButtonGroup(self.mainKeybindStripDescriptor)
    elseif newState == SCENE_HIDING then
        self:OnSelectionChanged(nil)
    end
end
local ALWAYS_ANIMATE = true
function ZO_GamepadBanking:PerformDeferredInitialization()
    if self.isInitialized then return end
    self.spinner = self.control:GetNamedChild("SpinnerContainer")
    self.spinner:InitializeSpinner()
    local function OnSelectedDataCallback(...)
        self:OnSelectionChanged(...)
    end
    local function ItemSetupTemplate(...)
        self:SetupItem(...)
    end
    local SETUP_LIST_LOCALLY = true
    self.bankList = self:AddList("withdraw", SETUP_LIST_LOCALLY, ZO_GamepadInventoryList, BAG_BANK, SLOT_TYPE_BANK_ITEM, OnSelectedDataCallback, nil, nil, nil, nil, nil, ItemSetupTemplate)
    self.backpackList = self:AddList("deposit", SETUP_LIST_LOCALLY, ZO_GamepadInventoryList, BAG_BACKPACK, SLOT_TYPE_ITEM, OnSelectedDataCallback, nil, nil, nil, nil, nil, ItemSetupTemplate)
    self.backpackList:SetItemFilterFunction(function(slot) return not slot.stolen end)
    self.isInitialized = true
end
function ZO_GamepadBanking:SetupItem(control, data, selected, selectedDuringRebuild, enabled, activated)
    ZO_SharedGamepadEntry_OnSetup(control, data, selected, selectedDuringRebuild, enabled, activated)
    if selected then
        control:SetHidden(self.confirmationMode)
    end
end
function ZO_GamepadBanking:SetSpinnerValue(max, value)
    self.spinner:SetMinMax(1, max)
    self.spinner:SetValue(value)
end
local ACTIVATE_SPINNER = true
local DEACTIVATE_SPINNER = false
local function CanWithdrawDeposit(inventoryData, bagType)
    local bag, index = ZO_Inventory_GetBagAndIndex(inventoryData)
    if not DoesBagHaveSpaceFor(bagType, bag, index) then
        ZO_Alert(UI_ALERT_CATEGORY_ERROR, SOUNDS.NEGATIVE_CLICK, bagType == BAG_BANK and SI_INVENTORY_ERROR_BANK_FULL or SI_INVENTORY_ERROR_INVENTORY_FULL)
    else
        return true
    end
end
function ZO_GamepadBanking:ConfirmWithdrawDeposit(list, bagType)
    local inventoryData = list:GetSelectedData()
    if CanWithdrawDeposit(inventoryData, bagType) then
        local bag, index = ZO_Inventory_GetBagAndIndex(inventoryData)
        if self.confirmationMode then
            local quantity = self.spinner:GetValue()
            if quantity > 0 then
                PickupInventoryItem(bag, index, quantity)
                PlaceInTransfer()
                self:UpdateSpinnerConfirmation(DEACTIVATE_SPINNER, list)
            end
        elseif inventoryData.stackCount > 1 then
            self:UpdateSpinnerConfirmation(ACTIVATE_SPINNER, list)
            self:SetSpinnerValue(inventoryData.stackCount, inventoryData.stackCount)
        else
            PickupInventoryItem(bag, index)
            PlaceInTransfer()
        end
    end
end
function ZO_GamepadBanking:ActivateSpinner()
    self.spinner:SetHidden(false)
    self.spinner:Activate()
end
function ZO_GamepadBanking:DeactivateSpinner()
    self.spinner:SetValue(1)
    self.spinner:SetHidden(true)
    self.spinner:Deactivate()
end
function ZO_GamepadBanking:UpdateSpinnerConfirmation(activateSpinner, list)
    self.confirmationMode = activateSpinner
    if activateSpinner then
        self:ActivateSpinner()
        KEYBIND_STRIP:RemoveKeybindButtonGroup(self.mainKeybindStripDescriptor)
        KEYBIND_STRIP:AddKeybindButtonGroup(self.spinnerKeybindStripDescriptor)
    else
        self:DeactivateSpinner()
        KEYBIND_STRIP:RemoveKeybindButtonGroup(self.spinnerKeybindStripDescriptor)
        KEYBIND_STRIP:AddKeybindButtonGroup(self.mainKeybindStripDescriptor)
    end
    list:RefreshVisible()
    list:SetUseTriggers(not activateSpinner)
    list:SetDirectionalInputEnabled(not activateSpinner)
end
function ZO_GamepadBanking:CancelWithdrawDeposit(list)
    if self.confirmationMode then
        self:UpdateSpinnerConfirmation(DEACTIVATE_SPINNER, list)
    else
        SCENE_MANAGER:HideCurrentScene()
    end
end
function ZO_GamepadBanking:InitializeKeybindStripDescriptors()
    local withdrawDepositKeybind =
    {
        keybind = "UI_SHORTCUT_PRIMARY",
        name = function()
            if self.mode == MODE_WITHDRAW then
                return GetString(SI_BANK_WITHDRAW)
            else
                return GetString(SI_BANK_DEPOSIT)
            end
        end,
        callback = function()
            if self.mode == MODE_WITHDRAW then
                self:ConfirmWithdrawDeposit(self.bankList, BAG_BACKPACK)
            else
                self:ConfirmWithdrawDeposit(self.backpackList, BAG_BANK)
            end
        end,
        visible = function()
            if self.mode == MODE_WITHDRAW then
                return GetNumBagUsedSlots(BAG_BANK) > 0
            else
                return GetNumBagUsedSlots(BAG_BACKPACK) > 0
            end
        end
    }
    self.mainKeybindStripDescriptor = {
        alignment = KEYBIND_STRIP_ALIGN_LEFT,
        withdrawDepositKeybind,
        {
            keybind = "UI_SHORTCUT_SECONDARY",
            name = function()
                if self.mode == MODE_WITHDRAW then
                    return GetString(SI_BANK_WITHDRAW_GOLD_BIND)
                else
                    return GetString(SI_BANK_DEPOSIT_GOLD_BIND)
                end
            end,
            callback = function ()
                KEYBIND_STRIP:RemoveKeybindButtonGroup(self.mainKeybindStripDescriptor)
                if self.mode == MODE_WITHDRAW then
                    GAMEPAD_BANKING_WITHDRAW_DEPOSIT_GOLD:ShowWithdraw()
                else
                    GAMEPAD_BANKING_WITHDRAW_DEPOSIT_GOLD:ShowDeposit()
                end
            end,
        },
        {
            keybind = "UI_SHORTCUT_TERTIARY",
            name = function()
                local cost = GetNextBankUpgradePrice()
                if GetCurrentMoney() >= cost then
                    return zo_strformat(SI_BANK_UPGRADE_TEXT, ZO_CurrencyControl_FormatCurrency(cost), GOLD_ICON_24)
                end
                return zo_strformat(SI_BANK_UPGRADE_TEXT, ZO_ERROR_COLOR:Colorize(ZO_CurrencyControl_FormatCurrency(cost)), GOLD_ICON_24)
            end,
            visible = function()
                return IsBankUpgradeAvailable()
            end,
            callback = function()
                if GetNextBankUpgradePrice() > GetCurrentMoney() then
                    ZO_AlertNoSuppression(UI_ALERT_CATEGORY_ALERT, nil, GetString(SI_BUY_BANK_SPACE_CANNOT_AFFORD))
                else
                    KEYBIND_STRIP:RemoveKeybindButtonGroup(self.mainKeybindStripDescriptor)
                    DisplayBankUpgrade()
                end
            end
        },
    }
    ZO_Gamepad_AddBackNavigationKeybindDescriptors(self.mainKeybindStripDescriptor, GAME_NAVIGATION_TYPE_BUTTON)
    self.spinnerKeybindStripDescriptor = {
        alignment = KEYBIND_STRIP_ALIGN_LEFT,
        withdrawDepositKeybind,
    }
    ZO_Gamepad_AddBackNavigationKeybindDescriptors(self.spinnerKeybindStripDescriptor,
                                                    GAME_NAVIGATION_TYPE_BUTTON,
                                                    function()
                                                        local list = self.mode == MODE_WITHDRAW and self.bankList or self.backpackList
                                                        self:CancelWithdrawDeposit(list)
                                                    end)
end
local function CreateModeData(name, mode, icon, itemList)
    return {
        text = GetString(name),
        mode = mode,
        iconFile = icon,
        itemList = itemList,
    }
end
local function SetSimpleCurrency(control, amount)
    ZO_CurrencyControl_SetSimpleCurrency(control, CURRENCY_TYPE_MONEY, amount, GAMEPAD_INVENTORY_BANKED_CURRENCY_OPTIONS)
    return true
end
function ZO_GamepadBanking:InitializeHeader()
    local withdrawTabData = CreateModeData(SI_BANK_WITHDRAW, MODE_WITHDRAW, "EsoUI/Art/Bank/bank_tabIcon_withdraw_up.dds", self.bankList)
    local depositTabData = CreateModeData(SI_BANK_DEPOSIT, MODE_DEPOSIT, "EsoUI/Art/Bank/bank_tabIcon_withdraw_up.dds", self.backpackList)
    local function UpdateGold(control)
        if self.mode == MODE_WITHDRAW then
            return SetSimpleCurrency(control, GetBankedMoney())
        else
            return SetSimpleCurrency(control, GetCurrentMoney())
        end
    end
    local function UpdateCapacityLabel()
        if self.mode == MODE_WITHDRAW then
            return GetString(SI_GAMEPAD_BANK_CAPACITY)
        else
            return GetString(SI_GAMEPAD_INVENTORY_CAPACITY)
        end
    end
    local function UpdateCapacityString()
        if self.mode == MODE_WITHDRAW then
            return zo_strformat(SI_GAMEPAD_INVENTORY_CAPACITY_FORMAT, GetNumBagUsedSlots(BAG_BANK), GetBagSize(BAG_BANK))
        else
            return zo_strformat(SI_GAMEPAD_INVENTORY_CAPACITY_FORMAT, GetNumBagUsedSlots(BAG_BACKPACK), GetBagSize(BAG_BACKPACK))
        end
    end
    local function OnCategoryChanged(selectedData)
        self.mode = selectedData.mode
        KEYBIND_STRIP:UpdateKeybindButtonGroup(self.mainKeybindStripDescriptor)
        self:RefreshHeaderData()
        self:SetCurrentList(selectedData.itemList)
        self.currentItemList = selectedData.itemList
    end
    self.tabsTable = {
        {
            text = GetString(SI_BANK_WITHDRAW),
            callback = function() OnCategoryChanged(withdrawTabData) end,
        },
        {
            text = GetString(SI_BANK_DEPOSIT),
            callback = function() OnCategoryChanged(depositTabData) end,
        },
    }
    self.headerData = {
        data1HeaderText = GetString(SI_GAMEPAD_GUILD_BANK_AVAILABLE_FUNDS),
        data1Text = UpdateGold,
        data2HeaderText = UpdateCapacityLabel,
        data2Text = UpdateCapacityString,
        tabBarEntries = self.tabsTable
    }
end
function ZO_GamepadBanking:RefreshHeaderData()
end
function ZO_GamepadBanking:RegisterForEvents()
    local function RefreshHeaderData()
        self:RefreshHeaderData()
    end
    local function OnInventoryUpdate()
        self:RefreshHeaderData()
        KEYBIND_STRIP:UpdateKeybindButtonGroup(self.mainKeybindStripDescriptor)
    end
    self.control:RegisterForEvent(EVENT_MONEY_UPDATE, RefreshHeaderData)
    self.control:RegisterForEvent(EVENT_BANKED_MONEY_UPDATE, RefreshHeaderData)
    self.control:RegisterForEvent(EVENT_INVENTORY_FULL_UPDATE, OnInventoryUpdate)
    self.control:RegisterForEvent(EVENT_INVENTORY_SINGLE_SLOT_UPDATE, OnInventoryUpdate)
end
function ZO_GamepadBanking:UnregisterForEvents()
    self.control:UnregisterForEvent(EVENT_MONEY_UPDATE)
    self.control:UnregisterForEvent(EVENT_BANKED_MONEY_UPDATE)
    self.control:UnregisterForEvent(EVENT_INVENTORY_FULL_UPDATE)
    self.control:UnregisterForEvent(EVENT_INVENTORY_SINGLE_SLOT_UPDATE)
end
function ZO_GamepadBanking:SetMode(mode)
    self.mode = mode
end
function ZO_GamepadBanking:OnSelectionChanged(_, inventoryData)
    GAMEPAD_TOOLTIPS:ClearLines(GAMEPAD_LEFT_TOOLTIP)
    if inventoryData then
        GAMEPAD_TOOLTIPS:LayoutBagItem(GAMEPAD_LEFT_TOOLTIP, inventoryData.bagId, inventoryData.slotIndex)
    end
end
    GAMEPAD_BANKING = ZO_GamepadBanking:New(control)
end
-----------------------
-- Buy Bank Space
-----------------------
GAMEPAD_BUY_BANK_SPACE_SCENE_NAME = "gamepad_buy_bank_space"
ZO_BuyBankSpace_Gamepad = ZO_Object:Subclass()
function ZO_BuyBankSpace_Gamepad:New(...)
    local object = ZO_Object.New(self)
    object:Initialize(...)
    return object
end
function ZO_BuyBankSpace_Gamepad:Initialize(control)
    ZO_Dialogs_RegisterCustomDialog("BUY_BANK_SPACE_GAMEPAD",
    {
        gamepadInfo =
        {
            dialogType = GAMEPAD_DIALOGS.BASIC,
        },
        title =
        {
            text = SI_PROMPT_TITLE_BUY_BANK_SPACE,
        },
        mainText =
        {
            text = zo_strformat(SI_BUY_BANK_SPACE, NUM_BANK_SLOTS_PER_UPGRADE),
        },
        buttons =
        {
            {
                keybind = "DIALOG_NEGATIVE",
                text = SI_DIALOG_DECLINE,
                callback = function() self:Hide() end
            },
            {
                keybind = "DIALOG_PRIMARY",
                text = function()
                    local costString = ZO_CurrencyControl_FormatCurrency(self.cost)
                    return zo_strformat(SI_GAMEPAD_BANK_UPGRADE_ACCEPT, costString, GOLD_ICON_24)
                end,
                callback =  function(dialog)
                    BuyBankSpace()
                    ZO_AlertNoSuppression(UI_ALERT_CATEGORY_ALERT, nil, GetString(SI_GAMEPAD_BANK_UPGRADED_ALERT))
                    self:Hide()
                end,
            }
        }
    })
    GAMEPAD_BUY_BANK_SPACE_SCENE = ZO_InteractScene:New(GAMEPAD_BUY_BANK_SPACE_SCENE_NAME, SCENE_MANAGER, BANKING_INTERACTION)
    local StateChanged = function(oldState, newState)
        if newState == SCENE_SHOWN then
            ZO_Dialogs_ShowGamepadDialog("BUY_BANK_SPACE_GAMEPAD", { cost = self.cost })
        end
    end
    GAMEPAD_BUY_BANK_SPACE_SCENE:RegisterCallback("StateChange", StateChanged)
end
function ZO_BuyBankSpace_Gamepad:Show(cost)
    self.cost = cost
    SCENE_MANAGER:Push(GAMEPAD_BUY_BANK_SPACE_SCENE_NAME)
end
function ZO_BuyBankSpace_Gamepad:Hide()
    SCENE_MANAGER:Hide(GAMEPAD_BUY_BANK_SPACE_SCENE_NAME)
end
    BUY_BANK_SPACE_GAMEPAD = ZO_BuyBankSpace_Gamepad:New(control)
end
-----------------------
-- Withdraw/Deposit Gold
-----------------------
GAMEPAD_BANKING_WITHDRAW_DEPOSIT_GOLD_SCENE_NAME = "gamepad_withdraw_deposit_gold"
ZO_BankingWithdrawDepositGold_Gamepad = ZO_Object:Subclass()
function ZO_BankingWithdrawDepositGold_Gamepad:New(...)
    local object = ZO_Object.New(self)
    object:Initialize(...)
    return object
end
function ZO_BankingWithdrawDepositGold_Gamepad:Initialize(control)
    self.control = control
    self.isInitialized = false
    GAMEPAD_BANKING_WITHDRAW_DEPOSIT_GOLD_SCENE = ZO_InteractScene:New(GAMEPAD_BANKING_WITHDRAW_DEPOSIT_GOLD_SCENE_NAME, SCENE_MANAGER, BANKING_INTERACTION)
    local StateChanged = function(oldState, newState)
        if newState == SCENE_SHOWING then
            self:PerformDeferredInitialization()
            self:RegisterForEvents()
            self:SetTitleText()
            self:UpdateInput()
            self.selector:Activate()
            KEYBIND_STRIP:AddKeybindButtonGroup(self.keybindStripDescriptor)
        elseif newState == SCENE_HIDDEN then
            self.selector:Clear()
            self.selector:Deactivate()
            self:UnregisterForEvents()
            KEYBIND_STRIP:RemoveKeybindButtonGroup(self.keybindStripDescriptor)
        end
    end
    GAMEPAD_BANKING_WITHDRAW_DEPOSIT_GOLD_SCENE:RegisterCallback("StateChange", StateChanged)
end
function ZO_BankingWithdrawDepositGold_Gamepad:UpdateInput()
    if self.initData and self.initData.currentQueryAmountFunction then
        local amount = self.initData.currentQueryAmountFunction()
        self.selector:SetMaxValue(amount)
        local hasEnough = (amount >= self.selector:GetValue())
        if hasEnough ~= self.hasEnough then
            self.hasEnough = hasEnough
            self.selector:SetTextColor(hasEnough and ZO_SELECTED_TEXT or ZO_ERROR_COLOR)
            KEYBIND_STRIP:UpdateKeybindButtonGroup(self.keybindStripDescriptor) -- The keybindings need visible to check for self.hasEnough
        end
    end
end
function ZO_BankingWithdrawDepositGold_Gamepad:PerformDeferredInitialization()
    if self.isInitialized then return end
    local selectorChild = self.control:GetNamedChild("InputContainer"):GetNamedChild("Selector")
    self.selector = ZO_CurrencySelector_Gamepad:New(selectorChild)
    self.selector:SetClampValues(true)
    self.isInitialized = true
end
function ZO_BankingWithdrawDepositGold_Gamepad:RegisterForEvents()
    local function OnUpdateEvent()
        self:UpdateInput()
        self:RefreshHeader()
    end
    self.control:RegisterForEvent(EVENT_MONEY_UPDATE, OnUpdateEvent)
    self.control:RegisterForEvent(EVENT_BANKED_MONEY_UPDATE, OnUpdateEvent)
    self.selector:RegisterCallback("OnValueChanged", OnUpdateEvent)
end
function ZO_BankingWithdrawDepositGold_Gamepad:UnregisterForEvents()
    self.control:UnregisterForEvent(EVENT_MONEY_UPDATE)
    self.control:UnregisterForEvent(EVENT_BANKED_MONEY_UPDATE)
    self.selector:UnregisterCallback("OnValueChanged")
end
function ZO_BankingWithdrawDepositGold_Gamepad:InitializeKeybindStrip()
    self.keybindStripDescriptor =
    {
        {
            alignment = KEYBIND_STRIP_ALIGN_LEFT,
            name = GetString(SI_GAMEPAD_SELECT_OPTION),
            keybind = "UI_SHORTCUT_PRIMARY",
            visible = function()
                return self.hasEnough
            end,
            callback = function()
                local amount = self.selector:GetValue()
                self.initData.selectFunc(amount)
                SCENE_MANAGER:HideCurrentScene()
            end,
        }
    }
    ZO_Gamepad_AddBackNavigationKeybindDescriptors(self.keybindStripDescriptor, GAME_NAVIGATION_TYPE_BUTTON)
end
local function UpdateCarriedGold(control)
end
local function UpdateBankedGold(control)
end
function ZO_BankingWithdrawDepositGold_Gamepad:InitializeHeader()
    self.header = self.control:GetNamedChild("HeaderContainer"):GetNamedChild("Header")
    ZO_GamepadGenericHeader_Initialize(self.header, ZO_GAMEPAD_HEADER_TABBAR_DONT_CREATE)
    self.headerData = {
        data1HeaderText = GetString(SI_CURRENCY_YOUR_GOLD),
        data1Text = UpdateCarriedGold,
        data2HeaderText = GetString(SI_CURRENCY_YOUR_BANKED_GOLD),
        data2Text = UpdateBankedGold,
    }
end
function ZO_BankingWithdrawDepositGold_Gamepad:RefreshHeader()
end
function ZO_BankingWithdrawDepositGold_Gamepad:SetTitleText()
    if self.initData then
        self.headerData.titleText = self.initData.title
        self:RefreshHeader()
    end
end
local function WithdrawMoney(amount)
    WithdrawMoneyFromBank(amount)
    local alertString = zo_strformat(SI_GAMEPAD_BANK_GOLD_AMOUNT_WITHDRAWN, ZO_CurrencyControl_FormatCurrency(amount), GOLD_ICON_16)
    ZO_AlertNoSuppression(UI_ALERT_CATEGORY_ALERT, nil, alertString)
end
local function DepositMoney(amount)
    DepositMoneyIntoBank(amount)
    local alertString = zo_strformat(SI_GAMEPAD_BANK_GOLD_AMOUNT_DEPOSITED, ZO_CurrencyControl_FormatCurrency(amount), GOLD_ICON_16)
    ZO_AlertNoSuppression(UI_ALERT_CATEGORY_ALERT, nil, alertString)
end
local WITHDRAW_INIT_DATA =
{
    title = GetString(SI_BANK_WITHDRAW_GOLD_TITLE),
}
local DEPOSIT_INIT_DATA =
{
    title = GetString(SI_BANK_DEPOSIT_GOLD_TITLE),
    selectFunc = DepositMoney,
}
local function PushWithdrawDepositGoldScene()
    SCENE_MANAGER:Push(GAMEPAD_BANKING_WITHDRAW_DEPOSIT_GOLD_SCENE_NAME)
end
function ZO_BankingWithdrawDepositGold_Gamepad:ShowWithdraw()
    self.initData = WITHDRAW_INIT_DATA
end
function ZO_BankingWithdrawDepositGold_Gamepad:ShowDeposit()
    self.initData = DEPOSIT_INIT_DATA
end
     GAMEPAD_BANKING_WITHDRAW_DEPOSIT_GOLD = ZO_BankingWithdrawDepositGold_Gamepad:New(control)
end