castbar: add option to show icon

This commit is contained in:
shagu
2019-04-18 21:01:16 +02:00
parent 564688f6b3
commit 6f0b21dd01
3 changed files with 31 additions and 4 deletions
+2
View File
@@ -766,9 +766,11 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("castbar", "player", "hide_pfui", "0")
pfUI:UpdateConfig("castbar", "player", "width", "-1")
pfUI:UpdateConfig("castbar", "player", "height", "-1")
pfUI:UpdateConfig("castbar", "player", "showicon", "0")
pfUI:UpdateConfig("castbar", "target", "hide_pfui", "0")
pfUI:UpdateConfig("castbar", "target", "width", "-1")
pfUI:UpdateConfig("castbar", "target", "height", "-1")
pfUI:UpdateConfig("castbar", "target", "showicon", "0")
pfUI:UpdateConfig("castbar", nil, "use_unitfonts", "0")
pfUI:UpdateConfig("tooltip", nil, "position", "chat")
+27 -4
View File
@@ -10,14 +10,23 @@ pfUI:RegisterModule("castbar", 20400, function ()
local function CreateCastbar(name, parent, unitstr, unitname)
local cb = CreateFrame("Frame", name, parent or UIParent)
CreateBackdrop(cb, default_border)
cb:SetHeight(C.global.font_size * 1.5)
cb:SetFrameStrata("MEDIUM")
cb.unitstr = unitstr
cb.unitname = unitname
-- icon
cb.icon = CreateFrame("Frame", nil, cb)
cb.icon:SetPoint("TOPLEFT", 0, 0)
cb.icon:SetHeight(16)
cb.icon:SetWidth(16)
cb.icon.texture = cb.icon:CreateTexture(nil, "OVERLAY")
cb.icon.texture:SetAllPoints()
cb.icon.texture:SetTexCoord(.08, .92, .08, .92)
CreateBackdrop(cb.icon, default_border)
-- statusbar
cb.bar = CreateFrame("StatusBar", nil, cb)
cb.bar:SetStatusBarTexture("Interface\\AddOns\\pfUI\\img\\bar")
@@ -27,6 +36,7 @@ pfUI:RegisterModule("castbar", 20400, function ()
cb.bar:SetValue(20)
local r,g,b,a = strsplit(",", C.appearance.castbar.castbarcolor)
cb.bar:SetStatusBarColor(r,g,b,a)
CreateBackdrop(cb.bar, default_border)
-- text left
cb.bar.left = cb.bar:CreateFontString("Status", "DIALOG", "GameFontNormal")
@@ -93,6 +103,19 @@ pfUI:RegisterModule("castbar", 20400, function ()
this.bar.left:SetText(cast)
this.fadeout = nil
this.endTime = endTime
-- set texture
if texture and this.showicon then
local size = this:GetHeight()
this.icon:Show()
this.icon:SetHeight(size)
this.icon:SetWidth(size)
this.icon.texture:SetTexture(texture)
this.bar:SetPoint("TOPLEFT", this.icon, "TOPRIGHT", 3, 0)
else
this.bar:SetPoint("TOPLEFT", this, 0, 0)
this.icon:Hide()
end
end
if channel then
@@ -154,8 +177,7 @@ pfUI:RegisterModule("castbar", 20400, function ()
-- [[ pfPlayerCastbar ]] --
if C.castbar.player.hide_pfui == "0" then
pfUI.castbar.player = CreateCastbar("pfPlayerCastbar", UIParent, "player")
local width = C.castbar.player.width ~= "0" and C.castbar.player.width
pfUI.castbar.player.showicon = C.castbar.player.showicon == "1" and true or nil
if pfUI.uf.player then
local pspace = tonumber(C.unitframes.player.pspace)
@@ -178,6 +200,7 @@ pfUI:RegisterModule("castbar", 20400, function ()
-- [[ pfTargetCastbar ]] --
if C.castbar.target.hide_pfui == "0" then
pfUI.castbar.target = CreateCastbar("pfTargetCastbar", UIParent, "target")
pfUI.castbar.target.showicon = C.castbar.target.showicon == "1" and true or nil
if pfUI.uf.target then
local pspace = tonumber(C.unitframes.target.pspace)
+2
View File
@@ -1783,11 +1783,13 @@ pfUI:RegisterModule("gui", 20400, function ()
CreateConfig(nil, T["Disable Blizzard Castbar"], C.castbar.player, "hide_blizz", "checkbox")
CreateConfig(nil, T["Player Castbar"], nil, nil, "header")
CreateConfig(nil, T["Show Spell Icon"], C.castbar.player, "showicon", "checkbox")
CreateConfig(nil, T["Castbar Width"], C.castbar.player, "width")
CreateConfig(nil, T["Castbar Height"], C.castbar.player, "height")
CreateConfig(nil, T["Disable Player Castbar"], C.castbar.player, "hide_pfui", "checkbox")
CreateConfig(nil, T["Target Castbar"], nil, nil, "header")
CreateConfig(nil, T["Show Spell Icon"], C.castbar.target, "showicon", "checkbox")
CreateConfig(nil, T["Castbar Width"], C.castbar.target, "width")
CreateConfig(nil, T["Castbar Height"], C.castbar.target, "height")
CreateConfig(nil, T["Disable Target Castbar"], C.castbar.target, "hide_pfui", "checkbox")