ESO Lua File v100010

ingame/stable/gamepad/stable_common_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
    control.name:SetDimensions(75, 50)
    control.name:SetAnchor( TOPLEFT, control, TOPLEFT, 0, 0 )
    control.name:SetFont("ZoFontGamepad24")
    control.name:SetModifyTextType(MODIFY_TEXT_TYPE_UPPERCASE)
    control.value:SetFont("ZoFontGamepad30")
    control.value:SetAnchor( RIGHT, nil, RIGHT, 53, 0 )
    control:GetNamedChild("BarContainer"):SetAnchor( TOPLEFT, control.name, TOPRIGHT, 5, 0 )
end
    control.name = control:GetNamedChild("Name")
    control.levelAndBreed = control:GetNamedChild("LevelAndBreed")
    control.icon = control:GetNamedChild("Icon")
    control.name:SetFont("ZoFontGamepad30")
end
    control.levelAndBreed:SetFont("ZoFontGamepad24")
    control.speedRow = control:GetNamedChild("AttributeBars"):GetNamedChild("SpeedRow")
    control.speedRow.name:SetText(GetString(SI_MOUNT_ATTRIBUTE_SPEED))
    ZO_StatusBar_SetGradientColor(control.speedRow.bar, ZO_XP_BAR_GRADIENT_COLORS)
    control.staminaRow = control:GetNamedChild("AttributeBars"):GetNamedChild("StaminaRow")
    control.staminaRow.name:SetText(GetString(SI_MOUNT_ATTRIBUTE_STAMINA))
    ZO_StatusBar_SetGradientColor(control.staminaRow.bar, ZO_XP_BAR_GRADIENT_COLORS)
    control.carryRow = control:GetNamedChild("AttributeBars"):GetNamedChild("CarryRow")
    control.carryRow.name:SetText(GetString(SI_MOUNT_ATTRIBUTE_CARRY))
    ZO_StatusBar_SetGradientColor(control.carryRow.bar, ZO_XP_BAR_GRADIENT_COLORS)
    control.price = control:GetNamedChild("Price")
    ZO_CurrencyControl_InitializeDisplayTypes(control.price, CURRENCY_TYPE_MONEY)
end
end
    control.readyForFeed = control:GetNamedChild("ReadyForFeed")
    control.feedTime = control:GetNamedChild("FeedTime")
    control.cost = control:GetNamedChild("Cost")
end
--======================== BUY SELL SCREEN COMMON FUNCTIONS ========================--
MOUNT_BUYSELL_PRE_SELECTED_PADDING = 30
MOUNT_BUYSELL_POST_SELECTED_PADDING = 130
function ZO_Stables_BuySellStateChangeCallback_Gamepad(scene, oldState, newState)
    if newState == SCENE_SHOWING then
        scene:RefreshAll()
            
        scene.itemList:Activate()
        KEYBIND_STRIP:AddKeybindButtonGroup(scene.keybindStripDescriptor)
    elseif newState == SCENE_HIDING then
        KEYBIND_STRIP:RemoveKeybindButtonGroup(scene.keybindStripDescriptor)
        scene.itemList:Deactivate()
    end    
end
local function SetupBuySellMountEntry_Gamepad(control, data, selected, selectedDuringRebuild, enable, activated)
    data.control = control
    local mountName     = control:GetNamedChild("Name")
    local mountIcon     = control:GetNamedChild("Icon")
    local activeIcon     = control:GetNamedChild("ActiveIcon")
    local levelAndBreed = control:GetNamedChild("LevelAndBreed")
    local price         = control:GetNamedChild("Price")
    
    mountName:SetText(data.name)
    mountIcon:SetTexture(data.icon)
    activeIcon:SetHidden(data.stableIndex ~= ACTIVE_MOUNT_INDEX)
    if data.level == nil or data.breed == nil then
        levelAndBreed:SetHidden(true)
    else
        levelAndBreed:SetText(zo_strformat(SI_STABLE_ACTIVE_MOUNT_DESCRIPTION, data.level, data.breed))
    end
    ZO_CurrencyControl_SetCurrencyData(price, CURRENCY_TYPE_MONEY, data.price, CURRENCY_DONT_SHOW_ALL, data.invalidPrice)
    ZO_CurrencyControl_SetCurrency(price, GAMEPAD_INVENTORY_CURRENCY_OPTIONS)
    if(selected) then
        control:SetAlpha(1.0)
        control:GetNamedChild("AttributeBars"):SetHidden(false)
        local FORCE_VALUE = true
        local speedRow = control:GetNamedChild("AttributeBars"):GetNamedChild("SpeedRow")
        speedRow.value:SetText(zo_strformat(SI_MOUNT_ATTRIBUTE_SPEED_FORMAT, data.speedBonus))
        ZO_StatusBar_SmoothTransition(speedRow.bar, data.speedBonus, data.maxSpeedBonus, FORCE_VALUE)
        local staminaRow = control:GetNamedChild("AttributeBars"):GetNamedChild("StaminaRow")
        staminaRow.value:SetText(data.staminaBonus)
        ZO_StatusBar_SmoothTransition(staminaRow.bar, data.staminaBonus, data.maxStaminaBonus, FORCE_VALUE)
        local carryRow = control:GetNamedChild("AttributeBars"):GetNamedChild("CarryRow")
        carryRow.value:SetText(data.inventoryBonus)
        ZO_StatusBar_SmoothTransition(carryRow.bar, data.inventoryBonus, data.maxInventoryBonus, FORCE_VALUE)
        if not control.scaleAnimation then
            control.scaleAnimation = ANIMATION_MANAGER:CreateTimelineFromVirtual("IconSlotMouseOverAnimation", mountIcon)
            control.scaleAnimation:PlayForward()
        end
    else
        control:GetNamedChild("AttributeBars"):SetHidden(true)
        control:SetAlpha(0.5)
        if control.scaleAnimation then
            control.scaleAnimation:PlayBackward()
            control.scaleAnimation = nil
        end
    end
end
local function SetupBuySellMountEntryEmpty_Gamepad(control, data, selected, selectedDuringRebuild, enable, activated)
    data.control = control
    data.canSelect = false
    local mountName = control:GetNamedChild("Name")
    local mountIcon = control:GetNamedChild("Icon")
    
    mountName:SetText(GetString(SI_GAMEPAD_STABLE_NO_SELL_MOUNT))
    mountIcon:SetTexture("EsoUI/Art/Mounts/mountPortait_empty.dds")
    if selected then
        control:SetAlpha(1.0)
        if not control.scaleAnimation then
            control.scaleAnimation = ANIMATION_MANAGER:CreateTimelineFromVirtual("IconSlotMouseOverAnimation", mountIcon)
            control.scaleAnimation:PlayForward()
        end
    else
        control:SetAlpha(0.5)
        if control.scaleAnimation then
            control.scaleAnimation:PlayBackward()
            control.scaleAnimation = nil
        end
    end
end
    local listContainer = scene.control:GetNamedChild("Item"):GetNamedChild("Container")
    scene.itemList = ZO_GamepadVerticalItemParametricScrollList:New(listContainer:GetNamedChild("List"))
    scene.itemList:SetFixedCenterOffset(-100)
    listContainer:SetHidden(false)
    scene:InitializeEvents()    
end