infight: add glow effect for screen and unitframes

This commit is contained in:
shagu
2016-12-16 20:26:44 +01:00
parent 518d6b22a8
commit cc3dd26f0e
6 changed files with 97 additions and 1 deletions
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+4
View File
@@ -12,6 +12,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("global", nil, "errors_hide", "0")
pfUI:UpdateConfig("global", nil, "hidebuff", "0")
pfUI:UpdateConfig("global", nil, "hidewbuff", "0")
pfUI:UpdateConfig("appearance", "border", "background", "0,0,0,1")
pfUI:UpdateConfig("appearance", "border", "color", "0.3,0.3,0.3,1")
pfUI:UpdateConfig("appearance", "border", "default", "3")
@@ -29,6 +30,9 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("appearance", "castbar", "castbarcolor", ".7,.7,.9,.8")
pfUI:UpdateConfig("appearance", "castbar", "channelcolor", ".9,.9,.7,.8")
pfUI:UpdateConfig("appearance", "loot", "autoresize", "1")
pfUI:UpdateConfig("appearance", "infight", "screen", "0")
pfUI:UpdateConfig("appearance", "infight", "common", "1")
pfUI:UpdateConfig("appearance", "infight", "group", "0")
pfUI:UpdateConfig("unitframes", nil, "disable", "0")
pfUI:UpdateConfig("unitframes", nil, "pastel", "1")
+4 -1
View File
@@ -688,7 +688,10 @@ pfUI:RegisterModule("gui", function ()
pfUI.gui:CreateConfig(pfUI.gui.appearance, "Cooldown text threshold", pfUI_config.appearance.cd, "threshold")
pfUI.gui:CreateConfig(pfUI.gui.appearance, "Castbar color", pfUI_config.appearance.castbar, "castbarcolor", "color")
pfUI.gui:CreateConfig(pfUI.gui.appearance, "Castbar color (Channeling)", pfUI_config.appearance.castbar, "channelcolor", "color")
pfUI.gui:CreateConfig(pfUI.gui.appearance, "Auto-resize Lootframe)", pfUI_config.appearance.loot, "autoresize", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.appearance, "Auto-resize Lootframe", pfUI_config.appearance.loot, "autoresize", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.appearance, "Show combat glow effect on screen edges", pfUI_config.appearance.infight, "screen", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.appearance, "Show combat glow effect on common unit frames", pfUI_config.appearance.infight, "common", "checkbox")
pfUI.gui:CreateConfig(pfUI.gui.appearance, "Show combat glow effect on group frames", pfUI_config.appearance.infight, "group", "checkbox")
-- modules
pfUI.gui.modules = pfUI.gui:CreateConfigTab("Modules")
+88
View File
@@ -0,0 +1,88 @@
pfUI:RegisterModule("loot", function ()
local default_border = pfUI_config.appearance.border.default
if pfUI_config.appearance.border.unitframes ~= "-1" then
default_border = pfUI_config.appearance.border.unitframes
end
-- build the frame
pfUI.infight = CreateFrame("Frame", "pfUICombat", UIParent)
pfUI.infight.backdrop = {
edgeFile = "Interface\\AddOns\\pfUI\\img\\glow", edgeSize = 8,
insets = {left = 0, right = 0, top = 0, bottom = 0},
}
pfUI.infight.backdrop_outline = {
edgeFile = "Interface\\AddOns\\pfUI\\img\\glow2", edgeSize = 8,
insets = {left = 0, right = 0, top = 0, bottom = 0},
}
pfUI.infight.elements = {}
function pfUI.infight:CreateGlow(unit, frame)
local anchor = pfUI.uf[unit]
if not pfUI.uf[unit] then anchor = frame end
pfUI.infight[unit] = CreateFrame("Frame", "pfUICombat" .. unit, anchor)
pfUI.infight[unit]:SetFrameStrata("BACKGROUND")
pfUI.infight[unit]:SetBackdrop(pfUI.infight.backdrop_outline)
pfUI.infight[unit]:SetPoint("TOPLEFT", anchor, "TOPLEFT", -7 - default_border,7 + default_border)
pfUI.infight[unit]:SetPoint("BOTTOMRIGHT", anchor, "BOTTOMRIGHT", 7 + default_border,-7 - default_border)
pfUI.infight[unit]:Hide()
table.insert(pfUI.infight.elements, unit)
end
pfUI.infight:SetScript("OnUpdate",function(s,e)
if not pfUI.infight.clock then pfUI.infight.clock = GetTime() -0.1 end
if GetTime() >= pfUI.infight.clock + 0.1 then
pfUI.infight.clock = GetTime()
if not pfUI.infight.fadeValue then pfUI.infight.fadeValue = 1 end
if pfUI.infight.fadeValue >= 0.3 then
pfUI.infight.fadeModifier = -0.1
end
if pfUI.infight.fadeValue <= 0 then
pfUI.infight.fadeModifier = 0.1
end
pfUI.infight.fadeValue = pfUI.infight.fadeValue + pfUI.infight.fadeModifier
for _,unit in pairs (pfUI.infight.elements) do
if UnitAffectingCombat(unit) then
pfUI.infight[unit]:Show()
pfUI.infight[unit]:SetBackdropBorderColor(1,0.2+pfUI.infight.fadeValue, pfUI.infight.fadeValue, 1-pfUI.infight.fadeValue);
else
pfUI.infight[unit]:Hide()
end
end
if pfUI_config.appearance.infight.screen == "1" and pfUI.infight.screen then
if UnitAffectingCombat("player") then
pfUI.infight.screen:Show()
pfUI.infight.screen:SetBackdropBorderColor(1,0.2+pfUI.infight.fadeValue, pfUI.infight.fadeValue, 1-pfUI.infight.fadeValue);
else
pfUI.infight.screen:Hide()
end
end
end
end)
if pfUI_config.appearance.infight.screen == "1" then
pfUI.infight.screen = CreateFrame("Frame", "pfUICombatScreen", UIParent)
pfUI.infight.screen:SetFrameStrata("BACKGROUND")
pfUI.infight.screen:SetBackdrop(pfUI.infight.backdrop)
pfUI.infight.screen:SetAllPoints(WorldFrame)
pfUI.infight.screen:Hide()
end
if pfUI_config.appearance.infight.common == "1" then
pfUI.infight:CreateGlow("player")
pfUI.infight:CreateGlow("target")
pfUI.infight:CreateGlow("targettarget")
pfUI.infight:CreateGlow("pet")
end
if pfUI_config.appearance.infight.group == "1" then
for i=1,4 do
pfUI.infight:CreateGlow("party" .. i, getglobal("pfGroup" .. i))
end
end
end)
+1
View File
@@ -51,3 +51,4 @@ modules\thirdparty.lua
modules\buff.lua
modules\nameplates.lua
modules\loot.lua
modules\infight.lua