Mercurial > wow > reaction
comparison classes/ReAction_ActionDisplay.lua @ 8:c05fd3e18b4f
Version 0.31
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Tue, 20 Mar 2007 21:33:59 +0000 |
parents | f920db5fc6b1 |
children | 650f75d08952 |
comparison
equal
deleted
inserted
replaced
7:f920db5fc6b1 | 8:c05fd3e18b4f |
---|---|
5 -- the ReAction.IActionType and ReAction.IColorScheme interfaces. | 5 -- the ReAction.IActionType and ReAction.IColorScheme interfaces. |
6 -- | 6 -- |
7 -- This mixin uses properties of self.config to define display elements: | 7 -- This mixin uses properties of self.config to define display elements: |
8 -- | 8 -- |
9 -- self.config = { | 9 -- self.config = { |
10 -- keyBindLoc = "POSITION", -- keybind anchor location | 10 -- keyBindLoc = "POSITION", -- keybind anchor location |
11 -- stackCountLoc = "POSITION", -- stack count anchor location | 11 -- stackCountLoc = "POSITION", -- stack count anchor location |
12 -- showKeyBind = true/false, -- show keybind labels | 12 -- showKeyBind = true/false, -- show keybind labels |
13 -- showStackCount = true/false, -- show stack count labels | 13 -- showStackCount = true/false, -- show stack count labels |
14 -- showMacroText = true/false, -- show macro name labels | 14 -- showMacroText = true/false, -- show macro name labels |
15 -- showGrid = true/false, -- always show empty buttons | 15 -- showGrid = true/false, -- always show empty buttons |
16 -- hideCooldown = true/false, -- hide the cooldown timer | |
17 -- hideGlobalCooldown = true/false, -- hide cooldown timers if duration < 1.5 seconds (global) | |
18 -- opacity = { | |
19 -- default = 0-100 [100], -- button opacity when the action is usable (default opacity) | |
20 -- notUsable = 0-100 [100], -- button opacity when the action is not usable | |
21 -- oom = 0-100 [notUsable], -- button opacity when the action is not usable due to OOM | |
22 -- ooRange = 0-100 [notUsable], -- button opacity when the action is not usable due to out of range | |
23 -- empty = 0-100 [0], -- button opacity when the action slot is empty | |
24 -- }, | |
25 -- hideEmptySlots = true/false, -- show/hide empty buttons rather than change opacity to 0 | |
16 -- } | 26 -- } |
17 -- | 27 -- |
18 | 28 |
19 local AceOO = AceLibrary("AceOO-2.0") | 29 local AceOO = AceLibrary("AceOO-2.0") |
20 | 30 |
114 self:ApplyLayout() | 124 self:ApplyLayout() |
115 self:ApplyStyle() | 125 self:ApplyStyle() |
116 self:DisplayVisibility() | 126 self:DisplayVisibility() |
117 -- refresh the action ID display | 127 -- refresh the action ID display |
118 if ReAction.showIDs_ then | 128 if ReAction.showIDs_ then |
119 self:DisplayID(self:GetID()) | 129 self:DisplayID(true) |
120 end | 130 end |
121 end | 131 end |
122 | 132 |
123 function RAAD:TempShow( visible ) | 133 function RAAD:TempShow( visible ) |
124 visible = visible and true or false -- force data integrity | 134 visible = visible and true or false -- force data integrity |
132 | 142 |
133 function RAAD:GetBaseButtonSize() | 143 function RAAD:GetBaseButtonSize() |
134 return 36 | 144 return 36 |
135 end | 145 end |
136 | 146 |
137 function RAAD:DisplayID( id ) | 147 function RAAD:DisplayID( show ) |
138 local f = self.frames.actionID | 148 local f = self.frames.actionID |
139 if id then | 149 if show then |
140 if not f then | 150 if not f then |
141 -- create the actionID label | 151 -- create the actionID label |
142 f = self.frames.button:CreateFontString(nil,"ARTWORK","NumberFontNormalSmall") | 152 f = self.frames.button:CreateFontString(nil,"ARTWORK","NumberFontNormalSmall") |
143 f:SetPoint("BOTTOMLEFT") | 153 f:SetPoint("BOTTOMLEFT") |
144 f:SetTextColor( tcolor(actionIDColor) ) | 154 f:SetTextColor( tcolor(actionIDColor) ) |
145 self.frames.actionID = f | 155 self.frames.actionID = f |
146 end | 156 end |
147 f:SetText(tostring(id)) | 157 f:SetText(tostring(self:GetID())) |
148 f:Show() | 158 f:Show() |
149 elseif f then | 159 elseif f then |
150 f:Hide() | 160 f:Hide() |
151 end | 161 end |
152 end | 162 end |
159 function RAAD:DisplayUsable( isUsable, notEnoughMana, outOfRange ) | 169 function RAAD:DisplayUsable( isUsable, notEnoughMana, outOfRange ) |
160 local f = self.frames | 170 local f = self.frames |
161 f.icon:SetVertexColor( self:GetIconColor(isUsable, notEnoughMana, outOfRange) ) | 171 f.icon:SetVertexColor( self:GetIconColor(isUsable, notEnoughMana, outOfRange) ) |
162 f.button:GetNormalTexture():SetVertexColor( self:GetBorderColor(isUsable, notEnoughMana, outOfRange) ) | 172 f.button:GetNormalTexture():SetVertexColor( self:GetBorderColor(isUsable, notEnoughMana, outOfRange) ) |
163 f.hotkey:SetTextColor( self:GetHotkeyColor(isUsable, notEnoughMana, outOfRange, f.hotkey:GetText()) ) | 173 f.hotkey:SetTextColor( self:GetHotkeyColor(isUsable, notEnoughMana, outOfRange, f.hotkey:GetText()) ) |
174 | |
175 local o | |
176 if isUsable then | |
177 o = self.config.opacity and self.config.opacity.usable or 1 | |
178 else | |
179 o = self.config.opacity and self.config.opacity.notUsable or 1 | |
180 if notEnoughMana then | |
181 o = self.config.opacity and self.config.opacity.oom or o | |
182 elseif outOfRange then | |
183 o = self.config.opacity and self.config.opacity.ooRange or o | |
184 end | |
185 end | |
186 | |
187 self.currentOpacity = o -- store for use in DisplayVisibility | |
188 self:DisplayVisibility() | |
164 end | 189 end |
165 | 190 |
166 function RAAD:DisplayEquipped( equipped ) | 191 function RAAD:DisplayEquipped( equipped ) |
167 local b = self.frames.border | 192 local b = self.frames.border |
168 if equipped then | 193 if equipped then |
203 end | 228 end |
204 self:DisplayVisibility() | 229 self:DisplayVisibility() |
205 end | 230 end |
206 | 231 |
207 function RAAD:DisplayCooldown( start, duration, enable ) | 232 function RAAD:DisplayCooldown( start, duration, enable ) |
233 enable = enable and not self.config.hideCooldown and (not self.config.hideGlobalCooldown or duration > 1.5) | |
208 CooldownFrame_SetTimer(self.frames.cooldown, start, duration, enable) | 234 CooldownFrame_SetTimer(self.frames.cooldown, start, duration, enable) |
209 end | 235 end |
210 | 236 |
211 function RAAD:DisplayName( name ) | 237 function RAAD:DisplayName( name ) |
212 self.frames.macro:SetText(name and tostring(name) or "") | 238 self.frames.macro:SetText(name and tostring(name) or "") |
375 if b:GetAttribute("statehidden") then | 401 if b:GetAttribute("statehidden") then |
376 -- can't hide/show in combat | 402 -- can't hide/show in combat |
377 if not InCombatLockdown() then | 403 if not InCombatLockdown() then |
378 b:Hide() | 404 b:Hide() |
379 end | 405 end |
406 elseif self.showTmp_ and self.showTmp_ > 0 then | |
407 b:GetNormalTexture():SetAlpha(0.5) | |
408 if self:IsActionEmpty() then | |
409 self.frames.cooldown:Hide() | |
410 if not InCombatLockdown() and not b:IsShown() then | |
411 b:Show() | |
412 end | |
413 end | |
414 b:SetAlpha(1) | |
380 elseif not self:IsActionEmpty() then | 415 elseif not self:IsActionEmpty() then |
381 b:GetNormalTexture():SetAlpha(1.0) | 416 b:GetNormalTexture():SetAlpha(1.0) |
382 b:SetAlpha(1) | 417 b:SetAlpha(self.currentOpacity or (self.config.opacity and self.config.opacity.usable) or 1) |
383 elseif self.showTmp_ and self.showTmp_ > 0 or self.config.showGrid then | 418 else |
384 b:GetNormalTexture():SetAlpha(0.5) | 419 if self.config.hideEmptySlots then |
385 self.frames.cooldown:Hide() | 420 if not InCombatLockdown() then |
386 b:SetAlpha(1) | 421 b:Hide() |
387 else | 422 end |
388 b:SetAlpha(0) | 423 else |
389 end | 424 b:SetAlpha(self.config.opacity and self.config.opacity.empty or 0) |
390 end | 425 end |
391 | 426 end |
427 end | |
428 |