ESO Lua File v100012

ingame/dyeing/gamepad/dyeing_equipment_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
local SWAP_SAVED_ICON = "EsoUI/Art/Dye/GamePad/Dye_set_icon.dds"
ZO_Dyeing_Equipment_Gamepad = ZO_Dyeing_RadialMenu_Gamepad:Subclass()
    control.slot = control:GetNamedChild("Slot")
    control.multiFocusControl = control:GetNamedChild("Dyes")
    control.dyeControls = control.multiFocusControl.dyeControls
    control.singleFocusControl = control.dyeControls[1]
    control.highlight = control:GetNamedChild("SharedHighlight")
    control.dyeSelector = ZO_GamepadFocus:New(control, nil, MOVEMENT_CONTROLLER_DIRECTION_HORIZONTAL)
    control.dyeSelector:SetFocusChangedCallback(function(entry) ZO_Dyeing_Gamepad_Highlight(control, entry and entry.control) end)
    for i=1, #control.dyeControls do
        local dyeControl = control.dyeControls[i]
        local entry = {
                        control = dyeControl,
                        slotIndex = i,
                    }
        control.dyeSelector:AddEntry(entry)
    end
    control.Activate = function(control, ...)
                control.dyeSelector:SetFocusByIndex(1)
                control.dyeSelector:Activate(...)
            end
    control.Deactivate = function(control, ...)
                control.dyeSelector:Deactivate(...)
            end
end
function ZO_Dyeing_Equipment_Gamepad:New(control, sharedHighlight)
    local equipment = ZO_Dyeing_RadialMenu_Gamepad.New(self, control, "ZO_DyeingEquipSlot_Gamepad", sharedHighlight)
    equipment.equipmentSetupFunction = function(...) equipment:SetupEquipment(...) end
    equipment.switchSetupFunction = function(...) equipment:SetupSwitchControl(...) end
    return equipment
end
function ZO_Dyeing_Equipment_Gamepad:SetupEquipment(control, data)
    local equipSlot = data.equipSlot
    self.controlsBySlot[equipSlot] = control
    ZO_Dyeing_SetupEquipmentControl(control.slot, equipSlot)
    control.shouldHighlight = IsItemDyeable(BAG_WORN, equipSlot)
end
function ZO_Dyeing_Equipment_Gamepad:SetupSwitchControl(control, data)
    local iconControl = control.slot:GetNamedChild("Icon")
    if iconControl then
        iconControl:SetTexture(SWAP_SAVED_ICON)
        iconControl:SetHidden(false)
    end
    local NOT_DYEABLE = false
    control.shouldHighlight = false
end
function ZO_Dyeing_Equipment_Gamepad:Populate()
    self:ResetData()
    for i=1, #ZO_DYEABLE_EQUIP_SLOTS_GAMEPAD_ORDER do
        local equipSlot = ZO_DYEABLE_EQUIP_SLOTS_GAMEPAD_ORDER[i]
        local data = {
                    equipSlot = equipSlot,
                    setupFunc = self.equipmentSetupFunction,
                }
        self:AddEntry(nil, nil, nil, nil, data)
    end
    local data = {
            setupFunc = self.switchSetupFunction,
        }
    self:AddEntry(nil, nil, nil, nil, data)
    self:Refresh()
end