Back to Home

ESO Lua File v101042

publicallingames/tribute/keyboard/tributecardtile_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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
ZO_TRIBUTE_CARD_TILE_WIDTH_KEYBOARD = 180
ZO_TRIBUTE_CARD_TILE_HEIGHT_KEYBOARD = 300
ZO_TRIBUTE_CARD_TILE_TALL_HEIGHT_KEYBOARD = 330
ZO_TRIBUTE_PATRON_BOOK_TILE_WIDE_WIDTH_KEYBOARD = 275
ZO_TRIBUTE_PATRON_BOOK_TILE_WIDTH_KEYBOARD = 180
ZO_TRIBUTE_PATRON_BOOK_TILE_HEIGHT_KEYBOARD = 330
local TRIBUTE_CARD_UPGRADE_TO_ICON = "EsoUI/Art/Tribute/tribute_icon_upgradeAvailable.dds"
local TRIBUTE_CARD_UPGRADED_ICON = "EsoUI/Art/Tribute/tribute_icon_upgraded.dds"
-----------------------
-- Tribute Card Tile --
-----------------------
ZO_TributeCardTile_Keyboard = ZO_ContextualActionsTile_Keyboard:Subclass()
function ZO_TributeCardTile_Keyboard:New(...)
    return ZO_ContextualActionsTile_Keyboard.New(self, ...)
end
-- Begin ZO_ContextualActionsTile_Keyboard Overrides --
function ZO_TributeCardTile_Keyboard:OnFocusChanged(isFocused)
    ZO_ContextualActionsTile.OnFocusChanged(self, isFocused)
    if isFocused then
        local data = self.data
        ClearTooltip(ItemTooltip)
        InitializeTooltip(ItemTooltip)
        ZO_Tooltips_SetupDynamicTooltipAnchors(ItemTooltip, self.control)
        ItemTooltip:SetTributeCard(data.patronId, data.cardId)
    elseif not self.togglingTooltip then
        ClearTooltip(ItemTooltip)
    end
end
-- End ZO_ContextualActionsTile_Keyboard Overrides --
function ZO_TributeCardTile_Keyboard:LayoutPlatform(data)
    self.cardData.control:SetAnchor(CENTER, nil, CENTER, 0, 0)
    self.cardData.control:SetScale(0.60)
    self:SetCanFocus(true)
end
-----------------------------------
-- Tribute Patron Book Card Tile --
-----------------------------------
-- Primary logic class must be subclassed after the platform class so that platform specific functions will have priority over the logic class functionality
ZO_TributePatronBookCardTile_Keyboard = ZO_Object.MultiSubclass(ZO_TributeCardTile_Keyboard, ZO_TributePatronBookCardTile_Shared)
function ZO_TributePatronBookCardTile_Keyboard:New(...)
    return ZO_TributePatronBookCardTile_Shared.New(self, ...)
end
function ZO_TributePatronBookCardTile_Keyboard:InitializePlatform(...)
    ZO_TributeCardTile_Keyboard.InitializePlatform(self, ...)
    self.upgradeToIcon = TRIBUTE_CARD_UPGRADE_TO_ICON
    self.upgradedIcon = TRIBUTE_CARD_UPGRADED_ICON
end
function ZO_TributePatronBookCardTile_Keyboard:ToggleCardTooltipCallback()
    self.togglingTooltip = true
    local data = self.data
    ClearTooltip(ItemTooltip)
    local offsetX = self.control:GetParent():GetLeft() - self.control:GetLeft() - 5
    InitializeTooltip(ItemTooltip, self.control, RIGHT, offsetX, 0, LEFT)
    if self.showBaseTooltip then
        local SHOW_UPGRADE = true
        ItemTooltip:SetTributePatronDockCard(data.patronId, data.cardIndex, SHOW_UPGRADE)
    else
        ItemTooltip:SetTributePatronDockCard(data.patronId, data.cardIndex, data.upgradesFrom ~= nil)
    end
    self.showBaseTooltip = not self.showBaseTooltip
    self.togglingTooltip = false
end
-- Begin ZO_TributeCardTile_Keyboard Overrides --
function ZO_TributePatronBookCardTile_Keyboard:OnFocusChanged(isFocused)
    ZO_ContextualActionsTile.OnFocusChanged(self, isFocused)
    if isFocused and not self.togglingTooltip then
        local data = self.data
        ClearTooltip(ItemTooltip)
        local offsetX = self.control:GetParent():GetLeft() - self.control:GetLeft() - 5
        InitializeTooltip(ItemTooltip, self.control, RIGHT, offsetX, 0, LEFT)
        if data.isStarter then
            ItemTooltip:HideComparativeTooltips()
            ItemTooltip:SetTributePatronStarterCard(data.patronId, data.cardIndex)
        else
            local USE_RELATIVE_ANCHORS = true
            ItemTooltip:SetTributePatronDockCard(data.patronId, data.cardIndex, data.upgradesFrom ~= nil)
            ItemTooltip:HideComparativeTooltips()
            ItemTooltip:ShowComparativeTooltips()
            ZO_PlayShowAnimationOnComparisonTooltip(ComparativeTooltip1)
            ZO_PlayShowAnimationOnComparisonTooltip(ComparativeTooltip2)
            ZO_Tooltips_SetupDynamicTooltipAnchors(ItemTooltip, self.control, ComparativeTooltip1, ComparativeTooltip2, USE_RELATIVE_ANCHORS)
            self.showBaseTooltip = true
        end
    elseif not self.togglingTooltip then
        ClearTooltip(ItemTooltip)
    end
end
function ZO_TributePatronBookCardTile_Keyboard:LayoutPlatform(data)
    self.cardData.control:SetAnchor(CENTER, nil, CENTER, 0, 10)
    self.cardData.control:SetScale(0.60)
    self.lockOverlay:ClearAnchors()
    self.lockOverlay:SetAnchor(CENTER, nil, CENTER, 0, 10)
    self.lockOverlay:SetScale(0.60)
    local desaturation = self.isCardLocked and 1 or 0
    self:GetHighlightControl():SetDesaturation(desaturation)
    self:SetCanFocus(true)
end
-- End ZO_TributeCardTile_Keyboard Overrides --
-- XML functions
----------------
    ZO_TributePatronBookCardTile_Keyboard:New(control)
end
-----------------------------------
-- Tribute Pile Viewer Card Tile --
-----------------------------------
-- Primary logic class must be subclassed after the platform class so that platform specific functions will have priority over the logic class functionality
ZO_TributePileViewerCardTile_Keyboard = ZO_Object.MultiSubclass(ZO_TributeCardTile_Keyboard, ZO_TributePileViewerCardTile_Shared)
function ZO_TributePileViewerCardTile_Keyboard:New(...)
    return ZO_TributePileViewerCardTile_Shared.New(self, ...)
end
function ZO_TributePileViewerCardTile_Keyboard:InitializePlatform(...)
    ZO_TributeCardTile_Keyboard.InitializePlatform(self, ...)
end
function ZO_TributePileViewerCardTile_Keyboard:PostInitializePlatform(...)
    ZO_TributeCardTile_Keyboard.PostInitializePlatform(self, ...)
    --This needs to be done manually to override logic in ZO_ContextualActionsTile_Keyboard
    self.keybindStripDescriptor.alignment = KEYBIND_STRIP_ALIGN_CENTER
end
-- Begin ZO_ContextualActionsTile_Keyboard Overrides --
function ZO_TributePileViewerCardTile_Keyboard:OnMouseUp(button, upInside)
    if upInside and self.cardData:IsPlayable() then
        local FROM_PILE_VIEWER = true
        InteractWithTributeCard(self.data.cardInstanceId, FROM_PILE_VIEWER)
    end
end
-- End ZO_ContextualActionsTile_Keyboard Overrides --
-- XML functions
----------------
    ZO_TributePileViewerCardTile_Keyboard:New(control)
end
-----------------------------------
-- Tribute Target Viewer Card Tile --
-----------------------------------
-- Primary logic class must be subclassed after the platform class so that platform specific functions will have priority over the logic class functionality
ZO_TributeTargetViewerCardTile_Keyboard = ZO_Object.MultiSubclass(ZO_TributeCardTile_Keyboard, ZO_TributeTargetViewerCardTile_Shared)
function ZO_TributeTargetViewerCardTile_Keyboard:New(...)
    return ZO_TributeTargetViewerCardTile_Shared.New(self, ...)
end
function ZO_TributeTargetViewerCardTile_Keyboard:InitializePlatform(...)
    ZO_TributeCardTile_Keyboard.InitializePlatform(self, ...)
end
function ZO_TributeTargetViewerCardTile_Keyboard:PostInitializePlatform(...)
    ZO_TributeCardTile_Keyboard.PostInitializePlatform(self, ...)
    --This needs to be done manually to override logic in ZO_ContextualActionsTile_Keyboard
    self.keybindStripDescriptor.alignment = KEYBIND_STRIP_ALIGN_CENTER
end
-- Begin ZO_ContextualActionsTile_Keyboard Overrides --
function ZO_TributeTargetViewerCardTile_Keyboard:OnMouseUp(button, upInside)
    if upInside then
        local FROM_TARGET_VIEWER = true
        InteractWithTributeCard(self.data.cardInstanceId, FROM_TARGET_VIEWER)
    end
end
-- End ZO_ContextualActionsTile_Keyboard Overrides --
-- XML functions
----------------
    ZO_TributeTargetViewerCardTile_Keyboard:New(control)
end
------------------------------------------
-- Tribute Confinement Viewer Card Tile --
------------------------------------------
-- Primary logic class must be subclassed after the platform class so that platform specific functions will have priority over the logic class functionality
ZO_TributeConfinementViewerCardTile_Keyboard = ZO_Object.MultiSubclass(ZO_TributeCardTile_Keyboard, ZO_TributeConfinementViewerCardTile_Shared)
function ZO_TributeConfinementViewerCardTile_Keyboard:New(...)
    return ZO_TributeConfinementViewerCardTile_Shared.New(self, ...)
end
function ZO_TributeConfinementViewerCardTile_Keyboard:PostInitializePlatform(...)
    ZO_TributeCardTile_Keyboard.PostInitializePlatform(self, ...)
    --This needs to be done manually to override logic in ZO_ContextualActionsTile_Keyboard
    self.keybindStripDescriptor.alignment = KEYBIND_STRIP_ALIGN_CENTER
end
-- XML functions
----------------
    ZO_TributeConfinementViewerCardTile_Keyboard:New(control)
end