Back to Home

ESO Lua File v100036

ingame/inventory/gamepad/buybagspace_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
GAMEPAD_BUY_BAG_SPACE_SCENE_NAME = "gamepad_buy_bag_space"
ZO_BuyBagSpace_Gamepad = ZO_Object:Subclass()
function ZO_BuyBagSpace_Gamepad:New(...)
    local object = ZO_Object.New(self)
    object:Initialize(...)
    return object
end
local function BuyBagSpaceAndAlert()
    BuyBagSpace()
    ZO_AlertNoSuppression(UI_ALERT_CATEGORY_ALERT, nil, zo_strformat(SI_GAMEPAD_BUY_BAG_SPACE_ALERT_MESSAGE, NUM_BACKPACK_SLOTS_PER_UPGRADE))
end
function ZO_BuyBagSpace_Gamepad:Initialize(control)
    
    self.control = control
    self.buySpace = ZO_BuySpaceGamepad:New(control:GetNamedChild("BuySpace"), zo_strformat(SI_BUY_BAG_SPACE, NUM_BACKPACK_SLOTS_PER_UPGRADE), GetString(SI_BUY_BAG_SPACE_CANNOT_AFFORD), BuyBagSpaceAndAlert)
    self.header = control:GetNamedChild("HeaderContainer"):GetNamedChild("Header")
    ZO_GamepadGenericHeader_Initialize(self.header, ZO_GAMEPAD_HEADER_TABBAR_DONT_CREATE)
    self.headerData = {
        titleText = GetString(SI_PROMPT_TITLE_BUY_BAG_SPACE)
    }
    GAMEPAD_BUY_BAG_SPACE_SCENE = ZO_InteractScene:New(GAMEPAD_BUY_BAG_SPACE_SCENE_NAME, SCENE_MANAGER, BUY_BAG_SPACE_INTERACTION)
    
    local StateChanged = function(oldState, newState)
        if newState == SCENE_SHOWING then
            self.buySpace:Activate(self.cost)
        elseif newState == SCENE_HIDDEN then
            self.buySpace:Deactivate()
        end
    end
    GAMEPAD_BUY_BAG_SPACE_SCENE:RegisterCallback("StateChange", StateChanged)
end
function ZO_BuyBagSpace_Gamepad:Show(cost)
    self.cost = cost
    SCENE_MANAGER:Show(GAMEPAD_BUY_BAG_SPACE_SCENE_NAME)
end
function ZO_BuyBagSpace_Gamepad:Hide()
    SCENE_MANAGER:Hide(GAMEPAD_BUY_BAG_SPACE_SCENE_NAME)
end
    BUY_BAG_SPACE_GAMEPAD = ZO_BuyBagSpace_Gamepad:New(control)
end