Back to Home

ESO Lua File v100032

ingame/collections/keyboard/outfitstylesbook_keyboard.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
ZO_OutfitStylesBook_Keyboard = ZO_RestyleCommon_Keyboard:Subclass()
function ZO_OutfitStylesBook_Keyboard:New(...)
    return ZO_RestyleCommon_Keyboard.New(self, ...)
end
function ZO_OutfitStylesBook_Keyboard:Initialize(control)
    ZO_RestyleCommon_Keyboard.Initialize(self, control)
    ZO_OUTFIT_STYLES_BOOK_SCENE = ZO_Scene:New("outfitStylesBook", SCENE_MANAGER)
    ZO_OUTFIT_STYLES_BOOK_FRAGMENT = self:GetFragment()
    self.onModeDropdownChangedCallback = function()
        ZO_OUTFIT_STYLES_PANEL_KEYBOARD:ClearAllCurrentSlotPreviews()
    end
    self.previewAvailable = true
    control:SetHandler("OnUpdate", function() self:OnUpdate() end)
end
function ZO_OutfitStylesBook_Keyboard:InitializeKeybindStripDescriptors()
    local INITIAL_CONTEXT_MENU_REF_COUNT = 1
    self.keybindStripDescriptor =
    {
        alignment = KEYBIND_STRIP_ALIGN_CENTER,
        
        -- Cancel All Previews
        {
            name = GetString(SI_OUTFIT_STYLES_BOOK_END_ALL_PREVIEWS_KEYBIND),
            keybind = "UI_SHORTCUT_NEGATIVE",
            visible = function()
                return ZO_OUTFIT_STYLES_PANEL_KEYBOARD:HasAnyCurrentSlotPreviews()
            end,
            callback = function()
                ZO_OUTFIT_STYLES_PANEL_KEYBOARD:ClearAllCurrentSlotPreviews()
            end,
        },
        -- Preview Target
        {
            alignment = KEYBIND_STRIP_ALIGN_RIGHT,
            name = function()
                local collectibleData = ZO_OUTFIT_STYLES_PANEL_KEYBOARD:GetMouseOverEntryData().data
                if ZO_OUTFIT_STYLES_PANEL_KEYBOARD:IsPreviewingOutfitStyle(collectibleData) then
                    return GetString(SI_OUTFIT_STYLES_BOOK_END_PREVIEW_KEYBIND)
                else
                    return GetString(SI_OUTFIT_STYLES_BOOK_PREVIEW_KEYBIND)
                end
            end,
            keybind = "UI_SHORTCUT_PRIMARY",
            visible = function()
                return self.previewAvailable and ZO_OUTFIT_STYLES_PANEL_KEYBOARD:GetMouseOverEntryData() ~= nil
            end,
            callback = function()
                local collectibleData = ZO_OUTFIT_STYLES_PANEL_KEYBOARD:GetMouseOverEntryData().data
                ZO_OUTFIT_STYLES_PANEL_KEYBOARD:TogglePreviewOutfitStyle(collectibleData)
            end,
        },
        -- Change outfit name
        {
            alignment = KEYBIND_STRIP_ALIGN_LEFT,
            keybind = "UI_SHORTCUT_QUATERNARY",
            name = GetString(SI_OUTFIT_CHANGE_NAME),
            visible = function()
                local currentSheet = ZO_RESTYLE_SHEET_WINDOW_KEYBOARD:GetCurrentSheet()
                return currentSheet:GetRestyleMode() == RESTYLE_MODE_OUTFIT
            end,
            callback = function()
                local currentSheet = ZO_RESTYLE_SHEET_WINDOW_KEYBOARD:GetCurrentSheet()
                local outfitManipulator = currentSheet:GetCurrentOutfitManipulator()
                ZO_Dialogs_ShowDialog("RENAME_OUFIT", { outfitIndex = outfitManipulator:GetOutfitIndex() }, { initialEditText = outfitManipulator:GetOutfitName() })
            end,
        },
    }
end
function ZO_OutfitStylesBook_Keyboard:RegisterForEvents()
    ZO_RestyleCommon_Keyboard.RegisterForEvents(self)
    ZO_OUTFIT_STYLES_PANEL_KEYBOARD:RegisterCallback("PreviewSlotsChanged", self.updateKeybindCallback)
    ZO_RESTYLE_SHEET_WINDOW_KEYBOARD:RegisterCallback("ModeSelectorDropdownChanged", self.onModeDropdownChangedCallback)
end
function ZO_OutfitStylesBook_Keyboard:UnregisterForEvents()
    ZO_RestyleCommon_Keyboard.UnregisterForEvents(self)
    ZO_OUTFIT_STYLES_PANEL_KEYBOARD:UnregisterCallback("PreviewSlotsChanged", self.updateKeybindCallback)
    ZO_RESTYLE_SHEET_WINDOW_KEYBOARD:UnregisterCallback("ModeSelectorDropdownChanged", self.onModeDropdownChangedCallback)
end
function ZO_OutfitStylesBook_Keyboard:InitializeModeData()
    ZO_RESTYLE_SHEET_WINDOW_KEYBOARD:PopulateEquipmentModeDropdown()
end
function ZO_OutfitStylesBook_Keyboard:OnHidden()
    ZO_RestyleCommon_Keyboard.OnHidden(self)
    ZO_OUTFIT_STYLES_PANEL_KEYBOARD:ClearAllCurrentSlotPreviews()
end
function ZO_OutfitStylesBook_Keyboard:OnUpdate()
    local isPreviewingAvailable = IsCharacterPreviewingAvailable()
    if self.previewAvailable ~= isPreviewingAvailable then
        self.previewAvailable = isPreviewingAvailable
        self.updateKeybindCallback()
    end
end
do
    local DISALLOW_DYEING = false
    local SPECIALIZED_COLLECTIBLE_CATEGORY_ENABLED = true
    local DERIVES_COLLECTIBLE_CATEGORIES_FROM_SLOTS = false
    local RESTYLE_CATEGORY_DATA = ZO_RestyleCategoryData:New(DISALLOW_DYEING, COLLECTIBLE_CATEGORY_SPECIALIZATION_OUTFIT_STYLES, SPECIALIZED_COLLECTIBLE_CATEGORY_ENABLED, DERIVES_COLLECTIBLE_CATEGORIES_FROM_SLOTS)
    function ZO_OutfitStylesBook_Keyboard:GetRestyleCategoryData()
        return RESTYLE_CATEGORY_DATA
    end
end
function ZO_OutfitStylesBook_Keyboard:NavigateToCollectibleData(collectibleData)
    if not ZO_OUTFIT_STYLES_BOOK_SCENE:IsShowing() then
        MAIN_MENU_KEYBOARD:ToggleSceneGroup("collectionsSceneGroup", "outfitStylesBook")
    end
    ZO_RestyleCommon_Keyboard.NavigateToCollectibleData(self, collectibleData)
end
    ZO_OUTFIT_STYLES_BOOK_KEYBOARD:OnSearchTextChanged()
end
    ZO_OUTFIT_STYLES_BOOK_KEYBOARD = ZO_OutfitStylesBook_Keyboard:New(control)
end