add configuration option for health bar texture (#39)

* add configuration option for health bar texture

* add usage example for bartexture

* add desc

* fix needing to reload ui

* fix needing to reload ui

---------

Co-authored-by: pepopo978 <149287158+pepopo978@users.noreply.github.com>
This commit is contained in:
seybsen
2025-07-27 12:27:32 -07:00
committed by GitHub
co-authored by pepopo978
parent cd1b47ec45
commit 01385ba2a7
3 changed files with 29 additions and 2 deletions
+4
View File
@@ -55,6 +55,8 @@ L:RegisterTranslations("enUS", function()
["Show Unit Name"] = true,
["Health Bar/Unit Name Width"] = true,
["Health Bar/Unit Name Height"] = true,
["Health Bar Texture"] = true,
["Health Bar Texture Desc"] = "Full path to the texture file like the default: Interface\\TargetingFrame\\UI-StatusBar",
["Raid Icon Size"] = true,
["Curse Icon Size"] = true,
["Spacing"] = true,
@@ -256,6 +258,8 @@ L:RegisterTranslations("zhCN", function()
["Show Unit Name"] = "显示单位名称",
["Health Bar/Unit Name Width"] = "生命条宽度",
["Health Bar/Unit Name Height"] = "生命条高度",
["Health Bar Texture"] = "生命条纹理",
["Health Bar Texture Desc"] = "生命条纹理的完整路径,例如默认值:Interface\\TargetingFrame\\UI-StatusBar",
["Raid Icon Size"] = "团队标记大小",
["Curse Icon Size"] = "诅咒图标大小",
["Spacing"] = "间距",
+19
View File
@@ -29,6 +29,8 @@ Cursive:RegisterDefaults("profile", {
scale = 1,
healthwidth = 100,
height = 16,
bartexture = "Interface\\TargetingFrame\\UI-StatusBar",
raidiconsize = 16,
curseiconsize = 16,
maxcurses = 5,
@@ -165,6 +167,23 @@ local barOptions = {
end
end,
},
["bartexture"] = {
type = "text",
name = L["Health Bar Texture"],
desc = L["Health Bar Texture Desc"],
order = 55,
usage = "Interface\\TargetingFrame\\UI-StatusBar",
get = function()
return Cursive.db.profile.bartexture
end,
set = function(v)
if v ~= Cursive.db.profile.bartexture then
Cursive.db.profile.bartexture = v
Cursive.UpdateFramesFromConfig()
Cursive.ResetUnitFrames()
end
end,
},
["raidiconsize"] = {
type = "range",
name = L["Raid Icon Size"],
+6 -2
View File
@@ -159,6 +159,11 @@ Cursive.UpdateFramesFromConfig = function()
end
end
Cursive.ResetUnitFrames = function()
-- clear cached frames so they are recreated
ui.unitFrames = {}
end
ui.BarEnter = function()
if this.parent.healthBar then
this.parent.healthBar.border:SetBackdropBorderColor(1, 1, 1, 1)
@@ -312,7 +317,7 @@ local function CreateBarSecondSection(unitFrame, guid)
-- create health bar
if config.showhealthbar then
local healthBar = CreateFrame("StatusBar", "CursiveHealthBar", secondSection)
healthBar:SetStatusBarTexture("Interface\\TargetingFrame\\UI-StatusBar")
healthBar:SetStatusBarTexture(config.bartexture)
healthBar:SetStatusBarColor(1, .8, .2, 1)
healthBar:SetMinMaxValues(0, 100)
healthBar:SetValue(20)
@@ -599,7 +604,6 @@ local function CheckForCleanup(guid, time)
end
end
local shouldDisplayGuids = {};
local displayedGuids = {};