diff --git a/Localization.lua b/Localization.lua index 94aca0b..c1fc226 100644 --- a/Localization.lua +++ b/Localization.lua @@ -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"] = "间距", diff --git a/settings.lua b/settings.lua index bbbc78c..ee30f6c 100644 --- a/settings.lua +++ b/settings.lua @@ -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"], diff --git a/ui.lua b/ui.lua index 41cddf2..bf3414c 100644 --- a/ui.lua +++ b/ui.lua @@ -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 = {};