Back to Home

ESO Lua File v100018

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
87
88
89
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, data)
    local dyeableSlot = data.dyeableSlot
    self.controlsBySlot[dyeableSlot] = control
    ZO_Dyeing_SetupDyeableSlotControl(control.slot, dyeableSlot)
end
function ZO_Dyeing_Slots_Gamepad:Populate()
    self:ResetData()
    local activeDyeableSlot = ZO_Dyeing_GetActiveOffhandDyeableSlot()
    local slotsByMode = ZO_Dyeing_GetSlotsForMode(self.mode)
    for i=1, #slotsByMode do
        local dyeableSlotData = slotsByMode[i]
        local dyeableSlot = dyeableSlotData.dyeableSlot
        if (dyeableSlot ~= DYEABLE_SLOT_OFF_HAND and dyeableSlot ~= DYEABLE_SLOT_BACKUP_OFF) 
            or dyeableSlot == activeDyeableSlot then
            local data = {
                    dyeableSlot = dyeableSlot,
                    setupFunc = self.dyeableSlotSetupFunction,
                }
            self:AddEntry(nil, nil, nil, nil, data)
        end
    end
    self:Refresh()
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