Back to Home

ESO Lua File v100021

ingame/dyeing/gamepad/dyeing_slots_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
local SWAP_SAVED_ICON = "EsoUI/Art/Dye/GamePad/Dye_set_icon.dds"
ZO_Dyeing_Slots_Gamepad = ZO_Dyeing_RadialMenu_Gamepad:Subclass()
function ZO_Dyeing_Slots_Gamepad:New(control, sharedHighlight)
    local dyeableSlotMenu = ZO_Dyeing_RadialMenu_Gamepad.New(self, control, "ZO_DyeingSlot_Gamepad", sharedHighlight)
    dyeableSlotMenu.dyeableSlotSetupFunction = function(...) dyeableSlotMenu:SetupDyeableSlot(...) end
    return dyeableSlotMenu
end
function ZO_Dyeing_Slots_Gamepad:SetupDyeableSlot(control, dyeableSlotData)
    ZO_Restyle_SetupSlotControl(control.slot, dyeableSlotData)
    ZO_Dyeing_RefreshDyeableSlotControlDyes(control.dyeControls, dyeableSlotData)
end
do
    local NO_NAME = nil
    local NO_INACTIVE_ICON = nil
    local NO_ACTIVE_ICON = nil
    local NO_CALLBACK = nil
    function ZO_Dyeing_Slots_Gamepad:Populate()
        self:ResetData()
        local slotsByMode = ZO_Dyeing_GetSlotsForMode(self.mode)
        for _, dyeableSlotData in ipairs(slotsByMode) do
            if not dyeableSlotData:ShouldBeHidden() then
                local entryData = ZO_RestyleSlotData:Copy(dyeableSlotData)
                entryData.setupFunc = self.dyeableSlotSetupFunction
                self:AddEntry(NO_NAME, NO_INACTIVE_ICON, NO_ACTIVE_ICON, NO_CALLBACK, entryData)
            end
        end
        self:Refresh()
    end
end
function ZO_Dyeing_Slots_Gamepad:SetMode(mode)
    self.mode = mode
end
function ZO_Dyeing_Slots_Gamepad:SetSelectionChangedCallback(callback)
end
-- XML functions --
-------------------
    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)
    
    for i=1, #control.dyeControls do
        local dyeControl = control.dyeControls[i]
        local entry = {
                        control = dyeControl,
                        slotIndex = i,
                        iconScaleAnimation = ANIMATION_MANAGER:CreateTimelineFromVirtual("ZO_DyeingSlot_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
    local function OnSelectionChanged(entry)
        ZO_Dyeing_Gamepad_Highlight(control, entry and entry.control)
        if control.onSelectionChangedCallback then
            control.onSelectionChangedCallback()
        end
    end
end