flickerstreak@7
|
1 -- The ReAction.ActionDisplay mixin defines 'regular' action button display functionality
|
flickerstreak@7
|
2 -- and is an implementation of the ReAction.IDisplay and ReAction.ActionType.IDisplay interfaces.
|
flickerstreak@7
|
3 --
|
flickerstreak@7
|
4 -- This Mixin assumes that it has been mixed in with a ReAction-derived class which implements
|
flickerstreak@7
|
5 -- the ReAction.IActionType and ReAction.IColorScheme interfaces.
|
flickerstreak@7
|
6 --
|
flickerstreak@7
|
7 -- This mixin uses properties of self.config to define display elements:
|
flickerstreak@7
|
8 --
|
flickerstreak@7
|
9 -- self.config = {
|
flickerstreak@8
|
10 -- keyBindLoc = "POSITION", -- keybind anchor location
|
flickerstreak@8
|
11 -- stackCountLoc = "POSITION", -- stack count anchor location
|
flickerstreak@8
|
12 -- showKeyBind = true/false, -- show keybind labels
|
flickerstreak@8
|
13 -- showStackCount = true/false, -- show stack count labels
|
flickerstreak@8
|
14 -- showMacroText = true/false, -- show macro name labels
|
flickerstreak@8
|
15 -- showGrid = true/false, -- always show empty buttons
|
flickerstreak@8
|
16 -- hideCooldown = true/false, -- hide the cooldown timer
|
flickerstreak@8
|
17 -- hideGlobalCooldown = true/false, -- hide cooldown timers if duration < 1.5 seconds (global)
|
flickerstreak@8
|
18 -- opacity = {
|
flickerstreak@8
|
19 -- default = 0-100 [100], -- button opacity when the action is usable (default opacity)
|
flickerstreak@8
|
20 -- notUsable = 0-100 [100], -- button opacity when the action is not usable
|
flickerstreak@8
|
21 -- oom = 0-100 [notUsable], -- button opacity when the action is not usable due to OOM
|
flickerstreak@8
|
22 -- ooRange = 0-100 [notUsable], -- button opacity when the action is not usable due to out of range
|
flickerstreak@8
|
23 -- empty = 0-100 [0], -- button opacity when the action slot is empty
|
flickerstreak@8
|
24 -- },
|
flickerstreak@8
|
25 -- hideEmptySlots = true/false, -- show/hide empty buttons rather than change opacity to 0
|
flickerstreak@7
|
26 -- }
|
flickerstreak@7
|
27 --
|
flickerstreak@7
|
28
|
flickerstreak@7
|
29 local AceOO = AceLibrary("AceOO-2.0")
|
flickerstreak@7
|
30
|
flickerstreak@7
|
31 ReAction.ActionDisplay = AceOO.Mixin {
|
flickerstreak@7
|
32 -- ReAction.IDisplay interface
|
flickerstreak@7
|
33 "SetupDisplay",
|
flickerstreak@7
|
34 "UpdateDisplay",
|
flickerstreak@7
|
35 "TempShow",
|
flickerstreak@7
|
36 "GetActionFrame",
|
flickerstreak@7
|
37 "GetBaseButtonSize",
|
flickerstreak@7
|
38 "DisplayID",
|
flickerstreak@7
|
39 "DisplayHotkey",
|
flickerstreak@7
|
40
|
flickerstreak@7
|
41 -- ReAction.ActionType.IDisplay interface
|
flickerstreak@7
|
42 "DisplayUsable",
|
flickerstreak@7
|
43 "DisplayEquipped",
|
flickerstreak@7
|
44 "DisplayAutoRepeat",
|
flickerstreak@7
|
45 "DisplayInUse",
|
flickerstreak@7
|
46 "DisplayIcon",
|
flickerstreak@7
|
47 "DisplayName",
|
flickerstreak@7
|
48 "DisplayCount",
|
flickerstreak@7
|
49 "DisplayCooldown",
|
flickerstreak@7
|
50
|
flickerstreak@7
|
51 -- Event handlers
|
flickerstreak@7
|
52 "PostClick",
|
flickerstreak@7
|
53 "OnDragStart",
|
flickerstreak@7
|
54 "OnReceiveDrag",
|
flickerstreak@7
|
55 "OnEnter",
|
flickerstreak@7
|
56 "OnLeave",
|
flickerstreak@7
|
57 "OnUpdate",
|
flickerstreak@7
|
58
|
flickerstreak@7
|
59 -- internal functions
|
flickerstreak@7
|
60 "ApplyLayout",
|
flickerstreak@7
|
61 "ApplyStyle",
|
flickerstreak@7
|
62 "StartFlash",
|
flickerstreak@7
|
63 "StopFlash",
|
flickerstreak@7
|
64 "IsFlashing",
|
flickerstreak@7
|
65 "DisplayVisibility",
|
flickerstreak@7
|
66 }
|
flickerstreak@7
|
67
|
flickerstreak@7
|
68 local RAAD = ReAction.ActionDisplay
|
flickerstreak@7
|
69
|
flickerstreak@7
|
70
|
flickerstreak@7
|
71 -- private constants
|
flickerstreak@7
|
72 local _G = getfenv(0)
|
flickerstreak@7
|
73
|
flickerstreak@7
|
74 local equippedActionBorderColor = { r=0.00, g=1.00, b=0.00, a=0.35 } -- transparent green
|
flickerstreak@7
|
75 local actionIDColor = { r=1.00, g=0.82, b=0.00, a=1.00 } -- gold
|
flickerstreak@7
|
76
|
flickerstreak@7
|
77 -- private functions
|
flickerstreak@7
|
78 -- extract and return color fields from a table, to be fed into SetVertexColor()/SetTextColor()
|
flickerstreak@7
|
79 local function tcolor(c)
|
flickerstreak@7
|
80 return c.r, c.g, c.b, c.a
|
flickerstreak@7
|
81 end
|
flickerstreak@7
|
82
|
flickerstreak@7
|
83
|
flickerstreak@7
|
84 -----------------------------------
|
flickerstreak@7
|
85 -- Interface Implementation Methods
|
flickerstreak@7
|
86 -----------------------------------
|
flickerstreak@7
|
87 function RAAD:SetupDisplay( name )
|
flickerstreak@7
|
88 -- create the button widget
|
flickerstreak@7
|
89 local b = CreateFrame("CheckButton", name, nil, "SecureActionButtonTemplate, ActionButtonTemplate")
|
flickerstreak@7
|
90
|
flickerstreak@7
|
91 -- store references to the various sub-frames of ActionButtonTemplate so we don't have to look it up all the time
|
flickerstreak@7
|
92 self.frames = {
|
flickerstreak@7
|
93 button = b,
|
flickerstreak@7
|
94 hotkey = _G[name.."HotKey"],
|
flickerstreak@7
|
95 count = _G[name.."Count"],
|
flickerstreak@7
|
96 cooldown = _G[name.."Cooldown"],
|
flickerstreak@7
|
97 macro = _G[name.."Name"],
|
flickerstreak@7
|
98 icon = _G[name.."Icon"],
|
flickerstreak@7
|
99 border = _G[name.."Border"],
|
flickerstreak@7
|
100 flash = _G[name.."Flash"],
|
flickerstreak@7
|
101 normalTexture = _G[name.."NormalTexture"],
|
flickerstreak@7
|
102 actionID = nil, -- defer creating actionID font string until it's actually requested
|
flickerstreak@7
|
103 }
|
flickerstreak@7
|
104
|
flickerstreak@7
|
105 -- ??? odd: why do we have to increment the cooldown frame level to get it to show?
|
flickerstreak@7
|
106 -- (otherwise it's behind the icon). The default UI doesn't have to (or at least I can't
|
flickerstreak@7
|
107 -- find where it does) but for some reason we have to here.
|
flickerstreak@7
|
108 self.frames.cooldown:SetFrameLevel(self.frames.cooldown:GetFrameLevel() + 1)
|
flickerstreak@7
|
109
|
flickerstreak@7
|
110 b:EnableMouse()
|
flickerstreak@7
|
111 b:RegisterForDrag("LeftButton", "RightButton")
|
flickerstreak@7
|
112 b:RegisterForClicks("AnyUp")
|
flickerstreak@7
|
113 b:SetScript("PostClick", function(arg1) self:PostClick(arg1) end)
|
flickerstreak@7
|
114 b:SetScript("OnDragStart", function(arg1) self:OnDragStart(arg1) end)
|
flickerstreak@7
|
115 b:SetScript("OnReceiveDrag", function() self:OnReceiveDrag() end)
|
flickerstreak@7
|
116 b:SetScript("OnEnter", function() self:OnEnter() end)
|
flickerstreak@7
|
117 b:SetScript("OnLeave", function() self:OnLeave() end)
|
flickerstreak@7
|
118 -- defer setting OnUpdate until actions are actually attached
|
flickerstreak@7
|
119
|
flickerstreak@7
|
120 self.tmpShow_ = 0
|
flickerstreak@7
|
121 end
|
flickerstreak@7
|
122
|
flickerstreak@7
|
123 function RAAD:UpdateDisplay()
|
flickerstreak@7
|
124 self:ApplyLayout()
|
flickerstreak@7
|
125 self:ApplyStyle()
|
flickerstreak@7
|
126 self:DisplayVisibility()
|
flickerstreak@7
|
127 -- refresh the action ID display
|
flickerstreak@7
|
128 if ReAction.showIDs_ then
|
flickerstreak@8
|
129 self:DisplayID(true)
|
flickerstreak@7
|
130 end
|
flickerstreak@7
|
131 end
|
flickerstreak@7
|
132
|
flickerstreak@7
|
133 function RAAD:TempShow( visible )
|
flickerstreak@7
|
134 visible = visible and true or false -- force data integrity
|
flickerstreak@7
|
135 self.showTmp_ = max(0, (self.showTmp_ or 0) + (visible and 1 or -1))
|
flickerstreak@7
|
136 self:DisplayVisibility()
|
flickerstreak@7
|
137 end
|
flickerstreak@7
|
138
|
flickerstreak@7
|
139 function RAAD:GetActionFrame()
|
flickerstreak@7
|
140 return self.frames.button
|
flickerstreak@7
|
141 end
|
flickerstreak@7
|
142
|
flickerstreak@7
|
143 function RAAD:GetBaseButtonSize()
|
flickerstreak@7
|
144 return 36
|
flickerstreak@7
|
145 end
|
flickerstreak@7
|
146
|
flickerstreak@8
|
147 function RAAD:DisplayID( show )
|
flickerstreak@7
|
148 local f = self.frames.actionID
|
flickerstreak@8
|
149 if show then
|
flickerstreak@7
|
150 if not f then
|
flickerstreak@7
|
151 -- create the actionID label
|
flickerstreak@7
|
152 f = self.frames.button:CreateFontString(nil,"ARTWORK","NumberFontNormalSmall")
|
flickerstreak@7
|
153 f:SetPoint("BOTTOMLEFT")
|
flickerstreak@7
|
154 f:SetTextColor( tcolor(actionIDColor) )
|
flickerstreak@7
|
155 self.frames.actionID = f
|
flickerstreak@7
|
156 end
|
flickerstreak@8
|
157 f:SetText(tostring(self:GetID()))
|
flickerstreak@7
|
158 f:Show()
|
flickerstreak@7
|
159 elseif f then
|
flickerstreak@7
|
160 f:Hide()
|
flickerstreak@7
|
161 end
|
flickerstreak@7
|
162 end
|
flickerstreak@7
|
163
|
flickerstreak@7
|
164 function RAAD:DisplayHotkey(txt)
|
flickerstreak@7
|
165 self.frames.hotkey:SetText(string.upper(txt or ""))
|
flickerstreak@7
|
166 self:UpdateUsable()
|
flickerstreak@7
|
167 end
|
flickerstreak@7
|
168
|
flickerstreak@7
|
169 function RAAD:DisplayUsable( isUsable, notEnoughMana, outOfRange )
|
flickerstreak@7
|
170 local f = self.frames
|
flickerstreak@7
|
171 f.icon:SetVertexColor( self:GetIconColor(isUsable, notEnoughMana, outOfRange) )
|
flickerstreak@7
|
172 f.button:GetNormalTexture():SetVertexColor( self:GetBorderColor(isUsable, notEnoughMana, outOfRange) )
|
flickerstreak@7
|
173 f.hotkey:SetTextColor( self:GetHotkeyColor(isUsable, notEnoughMana, outOfRange, f.hotkey:GetText()) )
|
flickerstreak@8
|
174
|
flickerstreak@8
|
175 local o
|
flickerstreak@8
|
176 if isUsable then
|
flickerstreak@8
|
177 o = self.config.opacity and self.config.opacity.usable or 1
|
flickerstreak@8
|
178 else
|
flickerstreak@8
|
179 o = self.config.opacity and self.config.opacity.notUsable or 1
|
flickerstreak@8
|
180 if notEnoughMana then
|
flickerstreak@8
|
181 o = self.config.opacity and self.config.opacity.oom or o
|
flickerstreak@8
|
182 elseif outOfRange then
|
flickerstreak@8
|
183 o = self.config.opacity and self.config.opacity.ooRange or o
|
flickerstreak@8
|
184 end
|
flickerstreak@8
|
185 end
|
flickerstreak@8
|
186
|
flickerstreak@8
|
187 self.currentOpacity = o -- store for use in DisplayVisibility
|
flickerstreak@8
|
188 self:DisplayVisibility()
|
flickerstreak@7
|
189 end
|
flickerstreak@7
|
190
|
flickerstreak@7
|
191 function RAAD:DisplayEquipped( equipped )
|
flickerstreak@7
|
192 local b = self.frames.border
|
flickerstreak@7
|
193 if equipped then
|
flickerstreak@7
|
194 b:Show()
|
flickerstreak@7
|
195 else
|
flickerstreak@7
|
196 b:Hide()
|
flickerstreak@7
|
197 end
|
flickerstreak@7
|
198 end
|
flickerstreak@7
|
199
|
flickerstreak@7
|
200 function RAAD:DisplayAutoRepeat( r )
|
flickerstreak@7
|
201 if r then
|
flickerstreak@7
|
202 self:StartFlash()
|
flickerstreak@7
|
203 else
|
flickerstreak@7
|
204 self:StopFlash()
|
flickerstreak@7
|
205 end
|
flickerstreak@7
|
206 end
|
flickerstreak@7
|
207
|
flickerstreak@7
|
208 function RAAD:DisplayInUse( inUse )
|
flickerstreak@7
|
209 self.frames.button:SetChecked( inUse and 1 or 0 )
|
flickerstreak@7
|
210 end
|
flickerstreak@7
|
211
|
flickerstreak@7
|
212 function RAAD:DisplayIcon( texture )
|
flickerstreak@7
|
213 local f = self.frames.button
|
flickerstreak@7
|
214 local icon = self.frames.icon
|
flickerstreak@7
|
215 if texture then
|
flickerstreak@7
|
216 icon:SetTexture(texture)
|
flickerstreak@7
|
217 icon:Show()
|
flickerstreak@7
|
218 self.rangeTimer = -1
|
flickerstreak@7
|
219 f:SetNormalTexture("Interface\\Buttons\\UI-Quickslot2")
|
flickerstreak@7
|
220 if f:GetScript("OnUpdate") == nil then
|
flickerstreak@7
|
221 f:SetScript("OnUpdate", function(frame, elapsed) self:OnUpdate(elapsed) end)
|
flickerstreak@7
|
222 end
|
flickerstreak@7
|
223 else
|
flickerstreak@7
|
224 icon:Hide()
|
flickerstreak@7
|
225 self.rangeTimer = nil
|
flickerstreak@7
|
226 f:SetNormalTexture("Interface\\Buttons\\UI-Quickslot")
|
flickerstreak@7
|
227 f:SetScript("OnUpdate",nil)
|
flickerstreak@7
|
228 end
|
flickerstreak@7
|
229 self:DisplayVisibility()
|
flickerstreak@7
|
230 end
|
flickerstreak@7
|
231
|
flickerstreak@7
|
232 function RAAD:DisplayCooldown( start, duration, enable )
|
flickerstreak@9
|
233 enable = (enable > 0 ) and not self.config.hideCooldown and (not self.config.hideGlobalCooldown or duration > 1.5) and 1 or 0
|
flickerstreak@7
|
234 CooldownFrame_SetTimer(self.frames.cooldown, start, duration, enable)
|
flickerstreak@7
|
235 end
|
flickerstreak@7
|
236
|
flickerstreak@7
|
237 function RAAD:DisplayName( name )
|
flickerstreak@7
|
238 self.frames.macro:SetText(name and tostring(name) or "")
|
flickerstreak@7
|
239 end
|
flickerstreak@7
|
240
|
flickerstreak@7
|
241 function RAAD:DisplayCount( count )
|
flickerstreak@7
|
242 self.frames.count:SetText(count and tostring(count) or "")
|
flickerstreak@7
|
243 end
|
flickerstreak@7
|
244
|
flickerstreak@7
|
245
|
flickerstreak@7
|
246
|
flickerstreak@7
|
247
|
flickerstreak@7
|
248
|
flickerstreak@7
|
249 ----------------------
|
flickerstreak@7
|
250 -- Event Handlers
|
flickerstreak@7
|
251 ----------------------
|
flickerstreak@7
|
252 function RAAD:PostClick()
|
flickerstreak@7
|
253 self:UpdateInUse()
|
flickerstreak@7
|
254 end
|
flickerstreak@7
|
255
|
flickerstreak@7
|
256 function RAAD:OnDragStart()
|
flickerstreak@7
|
257 if LOCK_ACTIONBAR ~= "1" or IsShiftKeyDown() then
|
flickerstreak@7
|
258 self:PickupAction()
|
flickerstreak@7
|
259 end
|
flickerstreak@7
|
260 end
|
flickerstreak@7
|
261
|
flickerstreak@7
|
262 function RAAD:OnReceiveDrag()
|
flickerstreak@7
|
263 self:PlaceAction()
|
flickerstreak@7
|
264 end
|
flickerstreak@7
|
265
|
flickerstreak@7
|
266 function RAAD:OnEnter()
|
flickerstreak@7
|
267 self:SetTooltip() -- from ReAction base class
|
flickerstreak@7
|
268 self.tooltipTime = TOOLTIP_UPDATE_TIME
|
flickerstreak@7
|
269 end
|
flickerstreak@7
|
270
|
flickerstreak@7
|
271 function RAAD:OnLeave()
|
flickerstreak@7
|
272 self:ClearTooltip() -- from ReAction base class
|
flickerstreak@7
|
273 self.tooltipTime = nil
|
flickerstreak@7
|
274 end
|
flickerstreak@7
|
275
|
flickerstreak@7
|
276 function RAAD:OnUpdate(elapsed)
|
flickerstreak@7
|
277 -- handle flashing
|
flickerstreak@7
|
278 if self:IsFlashing() then
|
flickerstreak@7
|
279 self.flashtime = self.flashtime - elapsed
|
flickerstreak@7
|
280 if self.flashtime <= 0 then
|
flickerstreak@7
|
281 local overtime = -self.flashtime
|
flickerstreak@7
|
282 if overtime >= ATTACK_BUTTON_FLASH_TIME then
|
flickerstreak@7
|
283 overtime = 0
|
flickerstreak@7
|
284 end
|
flickerstreak@7
|
285 self.flashtime = ATTACK_BUTTON_FLASH_TIME - overtime
|
flickerstreak@7
|
286
|
flickerstreak@7
|
287 local f = self.frames.flash
|
flickerstreak@7
|
288 if f then
|
flickerstreak@7
|
289 if f:IsVisible() then
|
flickerstreak@7
|
290 f:Hide()
|
flickerstreak@7
|
291 else
|
flickerstreak@7
|
292 f:Show()
|
flickerstreak@7
|
293 end
|
flickerstreak@7
|
294 end
|
flickerstreak@7
|
295 end
|
flickerstreak@7
|
296 end
|
flickerstreak@7
|
297
|
flickerstreak@7
|
298 -- Handle range indicator
|
flickerstreak@7
|
299 if self.rangeTimer then
|
flickerstreak@7
|
300 self.rangeTimer = self.rangeTimer - elapsed
|
flickerstreak@7
|
301 if self.rangeTimer <= 0 then
|
flickerstreak@7
|
302 self:UpdateUsable()
|
flickerstreak@7
|
303 self.rangeTimer = TOOLTIP_UPDATE_TIME
|
flickerstreak@7
|
304 end
|
flickerstreak@7
|
305 end
|
flickerstreak@7
|
306
|
flickerstreak@7
|
307 -- handle tooltip update
|
flickerstreak@7
|
308 if self.tooltipTime then
|
flickerstreak@7
|
309 self.tooltipTime = self.tooltipTime - elapsed
|
flickerstreak@7
|
310 if self.tooltipTime <= 0 then
|
flickerstreak@7
|
311 if GameTooltip:IsOwned(self.frames.button) then
|
flickerstreak@7
|
312 self:UpdateTooltip()
|
flickerstreak@7
|
313 self.tooltipTime = TOOLTIP_UPDATE_TIME
|
flickerstreak@7
|
314 else
|
flickerstreak@7
|
315 self.tooltipTime = nil
|
flickerstreak@7
|
316 end
|
flickerstreak@7
|
317 end
|
flickerstreak@7
|
318 end
|
flickerstreak@7
|
319 end
|
flickerstreak@7
|
320
|
flickerstreak@7
|
321
|
flickerstreak@7
|
322
|
flickerstreak@7
|
323 ----------------------
|
flickerstreak@7
|
324 -- Internal methods
|
flickerstreak@7
|
325 ----------------------
|
flickerstreak@7
|
326
|
flickerstreak@7
|
327 local function placeLabel( label, anchor )
|
flickerstreak@7
|
328 local top = string.match(anchor,"TOP")
|
flickerstreak@7
|
329 local bottom = string.match(anchor, "BOTTOM")
|
flickerstreak@7
|
330 label:ClearAllPoints()
|
flickerstreak@7
|
331 label:SetWidth(40)
|
flickerstreak@7
|
332 label:SetPoint(top or bottom or "CENTER",0,top and 2 or bottom and -2 or 0)
|
flickerstreak@7
|
333 local j
|
flickerstreak@7
|
334 if string.match(anchor,"LEFT") then
|
flickerstreak@7
|
335 j = "LEFT"
|
flickerstreak@7
|
336 elseif string.match(anchor,"RIGHT") then
|
flickerstreak@7
|
337 j = "RIGHT"
|
flickerstreak@7
|
338 else
|
flickerstreak@7
|
339 j = "CENTER"
|
flickerstreak@7
|
340 end
|
flickerstreak@7
|
341 label:SetJustifyH(j)
|
flickerstreak@7
|
342 end
|
flickerstreak@7
|
343
|
flickerstreak@7
|
344
|
flickerstreak@7
|
345 function RAAD:ApplyLayout()
|
flickerstreak@7
|
346 local f = self.frames
|
flickerstreak@7
|
347
|
flickerstreak@7
|
348 if self.config.keyBindLoc then
|
flickerstreak@7
|
349 placeLabel(f.hotkey, self.config.keyBindLoc)
|
flickerstreak@7
|
350 end
|
flickerstreak@7
|
351
|
flickerstreak@7
|
352 if self.config.stackCountLoc then
|
flickerstreak@7
|
353 placeLabel(f.count, self.config.stackCountLoc)
|
flickerstreak@7
|
354 end
|
flickerstreak@7
|
355
|
flickerstreak@7
|
356 if self.config.showKeyBind then
|
flickerstreak@7
|
357 f.hotkey:Show()
|
flickerstreak@7
|
358 else
|
flickerstreak@7
|
359 f.hotkey:Hide()
|
flickerstreak@7
|
360 end
|
flickerstreak@7
|
361
|
flickerstreak@7
|
362 if self.config.showStackCount then
|
flickerstreak@7
|
363 f.count:Show()
|
flickerstreak@7
|
364 else
|
flickerstreak@7
|
365 f.count:Hide()
|
flickerstreak@7
|
366 end
|
flickerstreak@7
|
367
|
flickerstreak@7
|
368 if self.config.showMacroName then
|
flickerstreak@7
|
369 f.macro:Show()
|
flickerstreak@7
|
370 else
|
flickerstreak@7
|
371 f.macro:Hide()
|
flickerstreak@7
|
372 end
|
flickerstreak@7
|
373
|
flickerstreak@7
|
374 end
|
flickerstreak@7
|
375
|
flickerstreak@7
|
376 function RAAD:ApplyStyle()
|
flickerstreak@7
|
377 local f = self.frames
|
flickerstreak@7
|
378 -- for now, just a static style
|
flickerstreak@7
|
379 f.hotkey:SetFontObject(NumberFontNormal)
|
flickerstreak@7
|
380 f.count:SetFontObject(NumberFontNormalYellow)
|
flickerstreak@7
|
381 f.border:SetVertexColor( tcolor(equippedActionBorderColor) )
|
flickerstreak@7
|
382 end
|
flickerstreak@7
|
383
|
flickerstreak@7
|
384 function RAAD:StartFlash()
|
flickerstreak@7
|
385 self.flashing = true
|
flickerstreak@7
|
386 self.flashtime = 0
|
flickerstreak@7
|
387 end
|
flickerstreak@7
|
388
|
flickerstreak@7
|
389 function RAAD:StopFlash()
|
flickerstreak@7
|
390 self.flashing = false
|
flickerstreak@7
|
391 self.frames.flash:Hide()
|
flickerstreak@7
|
392 end
|
flickerstreak@7
|
393
|
flickerstreak@7
|
394 function RAAD:IsFlashing()
|
flickerstreak@7
|
395 return self.flashing
|
flickerstreak@7
|
396 end
|
flickerstreak@7
|
397
|
flickerstreak@7
|
398 function RAAD:DisplayVisibility()
|
flickerstreak@7
|
399 local b = self.frames.button
|
flickerstreak@7
|
400
|
flickerstreak@7
|
401 if b:GetAttribute("statehidden") then
|
flickerstreak@7
|
402 -- can't hide/show in combat
|
flickerstreak@7
|
403 if not InCombatLockdown() then
|
flickerstreak@7
|
404 b:Hide()
|
flickerstreak@7
|
405 end
|
flickerstreak@8
|
406 elseif self.showTmp_ and self.showTmp_ > 0 then
|
flickerstreak@8
|
407 b:GetNormalTexture():SetAlpha(0.5)
|
flickerstreak@8
|
408 if self:IsActionEmpty() then
|
flickerstreak@8
|
409 self.frames.cooldown:Hide()
|
flickerstreak@8
|
410 if not InCombatLockdown() and not b:IsShown() then
|
flickerstreak@8
|
411 b:Show()
|
flickerstreak@8
|
412 end
|
flickerstreak@8
|
413 end
|
flickerstreak@8
|
414 b:SetAlpha(1)
|
flickerstreak@7
|
415 elseif not self:IsActionEmpty() then
|
flickerstreak@7
|
416 b:GetNormalTexture():SetAlpha(1.0)
|
flickerstreak@8
|
417 b:SetAlpha(self.currentOpacity or (self.config.opacity and self.config.opacity.usable) or 1)
|
flickerstreak@7
|
418 else
|
flickerstreak@8
|
419 if self.config.hideEmptySlots then
|
flickerstreak@8
|
420 if not InCombatLockdown() then
|
flickerstreak@8
|
421 b:Hide()
|
flickerstreak@8
|
422 end
|
flickerstreak@8
|
423 else
|
flickerstreak@8
|
424 b:SetAlpha(self.config.opacity and self.config.opacity.empty or 0)
|
flickerstreak@8
|
425 end
|
flickerstreak@7
|
426 end
|
flickerstreak@7
|
427 end
|
flickerstreak@7
|
428
|