ESO Lua File v100014

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
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,
                        iconScaleAnimation = ANIMATION_MANAGER:CreateTimelineFromVirtual("ZO_DyeingEquipSlot_Gamepad_FocusScaleAnimation", dyeControl),
                    }
        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
    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)
end
function ZO_Dyeing_Equipment_Gamepad:Populate()
    self:ResetData()
    local activeEquipSlot = ZO_Dyeing_GetActiveOffhandEquipSlot()
    for i=1, #ZO_DYEABLE_EQUIP_SLOTS_GAMEPAD_ORDER do
        local equipSlot = ZO_DYEABLE_EQUIP_SLOTS_GAMEPAD_ORDER[i]
        if (equipSlot ~= EQUIP_SLOT_OFF_HAND and equipSlot ~= EQUIP_SLOT_BACKUP_OFF) 
            or equipSlot == activeEquipSlot then
            local data = {
                    equipSlot = equipSlot,
                    setupFunc = self.equipmentSetupFunction,
                }
            self:AddEntry(nil, nil, nil, nil, data)
        end
    end
    self:Refresh()
end