Mercurial > wow > reaction
diff 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 |
line wrap: on
line diff
--- a/classes/ReAction_ActionDisplay.lua Tue Mar 20 21:25:29 2007 +0000 +++ b/classes/ReAction_ActionDisplay.lua Tue Mar 20 21:33:59 2007 +0000 @@ -7,12 +7,22 @@ -- This mixin uses properties of self.config to define display elements: -- -- self.config = { --- keyBindLoc = "POSITION", -- keybind anchor location --- stackCountLoc = "POSITION", -- stack count anchor location --- showKeyBind = true/false, -- show keybind labels --- showStackCount = true/false, -- show stack count labels --- showMacroText = true/false, -- show macro name labels --- showGrid = true/false, -- always show empty buttons +-- keyBindLoc = "POSITION", -- keybind anchor location +-- stackCountLoc = "POSITION", -- stack count anchor location +-- showKeyBind = true/false, -- show keybind labels +-- showStackCount = true/false, -- show stack count labels +-- showMacroText = true/false, -- show macro name labels +-- showGrid = true/false, -- always show empty buttons +-- hideCooldown = true/false, -- hide the cooldown timer +-- hideGlobalCooldown = true/false, -- hide cooldown timers if duration < 1.5 seconds (global) +-- opacity = { +-- default = 0-100 [100], -- button opacity when the action is usable (default opacity) +-- notUsable = 0-100 [100], -- button opacity when the action is not usable +-- oom = 0-100 [notUsable], -- button opacity when the action is not usable due to OOM +-- ooRange = 0-100 [notUsable], -- button opacity when the action is not usable due to out of range +-- empty = 0-100 [0], -- button opacity when the action slot is empty +-- }, +-- hideEmptySlots = true/false, -- show/hide empty buttons rather than change opacity to 0 -- } -- @@ -116,7 +126,7 @@ self:DisplayVisibility() -- refresh the action ID display if ReAction.showIDs_ then - self:DisplayID(self:GetID()) + self:DisplayID(true) end end @@ -134,9 +144,9 @@ return 36 end -function RAAD:DisplayID( id ) +function RAAD:DisplayID( show ) local f = self.frames.actionID - if id then + if show then if not f then -- create the actionID label f = self.frames.button:CreateFontString(nil,"ARTWORK","NumberFontNormalSmall") @@ -144,7 +154,7 @@ f:SetTextColor( tcolor(actionIDColor) ) self.frames.actionID = f end - f:SetText(tostring(id)) + f:SetText(tostring(self:GetID())) f:Show() elseif f then f:Hide() @@ -161,6 +171,21 @@ f.icon:SetVertexColor( self:GetIconColor(isUsable, notEnoughMana, outOfRange) ) f.button:GetNormalTexture():SetVertexColor( self:GetBorderColor(isUsable, notEnoughMana, outOfRange) ) f.hotkey:SetTextColor( self:GetHotkeyColor(isUsable, notEnoughMana, outOfRange, f.hotkey:GetText()) ) + + local o + if isUsable then + o = self.config.opacity and self.config.opacity.usable or 1 + else + o = self.config.opacity and self.config.opacity.notUsable or 1 + if notEnoughMana then + o = self.config.opacity and self.config.opacity.oom or o + elseif outOfRange then + o = self.config.opacity and self.config.opacity.ooRange or o + end + end + + self.currentOpacity = o -- store for use in DisplayVisibility + self:DisplayVisibility() end function RAAD:DisplayEquipped( equipped ) @@ -205,6 +230,7 @@ end function RAAD:DisplayCooldown( start, duration, enable ) + enable = enable and not self.config.hideCooldown and (not self.config.hideGlobalCooldown or duration > 1.5) CooldownFrame_SetTimer(self.frames.cooldown, start, duration, enable) end @@ -377,15 +403,26 @@ if not InCombatLockdown() then b:Hide() end + elseif self.showTmp_ and self.showTmp_ > 0 then + b:GetNormalTexture():SetAlpha(0.5) + if self:IsActionEmpty() then + self.frames.cooldown:Hide() + if not InCombatLockdown() and not b:IsShown() then + b:Show() + end + end + b:SetAlpha(1) elseif not self:IsActionEmpty() then b:GetNormalTexture():SetAlpha(1.0) - b:SetAlpha(1) - elseif self.showTmp_ and self.showTmp_ > 0 or self.config.showGrid then - b:GetNormalTexture():SetAlpha(0.5) - self.frames.cooldown:Hide() - b:SetAlpha(1) + b:SetAlpha(self.currentOpacity or (self.config.opacity and self.config.opacity.usable) or 1) else - b:SetAlpha(0) + if self.config.hideEmptySlots then + if not InCombatLockdown() then + b:Hide() + end + else + b:SetAlpha(self.config.opacity and self.config.opacity.empty or 0) + end end end