diff --git a/Data/Constants.lua b/Data/Constants.lua index 4b9771d..fbe6dc1 100644 --- a/Data/Constants.lua +++ b/Data/Constants.lua @@ -180,6 +180,7 @@ const.OPTION_KIND = { TARGET_SEPARATOR = "targetSeparator", TIME_TO_HOLD = "timeToHold", INTERRUPTED_LABEL = "interruptedLabel", + ICON_TEXTURE = "iconTexture", } ---@enum AURA_OPTION_KIND diff --git a/Data/Defaults.lua b/Data/Defaults.lua index 54e4f71..1ba185f 100644 --- a/Data/Defaults.lua +++ b/Data/Defaults.lua @@ -642,6 +642,7 @@ Defaults.Widgets = { enabled = false, frameLevel = 10, hideAtMaxLevel = false, + iconTexture = "", size = { width = 20, height = 20, diff --git a/Menu/Builder.lua b/Menu/Builder.lua index 393dd1c..12a0059 100644 --- a/Menu/Builder.lua +++ b/Menu/Builder.lua @@ -61,7 +61,8 @@ Builder.MenuOptions = { TotemOptions = 34, HideAtMaxLevel = 35, HideOutOfCombat = 36, - Glow = 37 + Glow = 37, + IconTexture = 38, } local FAILED = FAILED or "Failed" @@ -1294,6 +1295,18 @@ function Builder:CreateGlowOptions(parent, widgetName) return f end +function Builder:CreateIconTextureOptions(parent, widgetName) + ---@class IconTextureOptions: OptionsFrame + local f = CUF:CreateFrame(nil, parent, 1, 1, true, true) + f.id = "IconTextureOptions" + f.optionHeight = 20 + + local texturePath = self:CreateEditBox(f, widgetName, L["Texture"], 350, const.OPTION_KIND.ICON_TEXTURE) + texturePath:SetPoint("TOPLEFT") + + return f +end + ------------------------------------------------- -- MARK: Aura Icon ------------------------------------------------- @@ -2173,4 +2186,5 @@ Builder.MenuFuncs = { [Builder.MenuOptions.HideAtMaxLevel] = Builder.CreateHideAtMaxLevel, [Builder.MenuOptions.HideOutOfCombat] = Builder.CreateHideOutOfCombat, [Builder.MenuOptions.Glow] = Builder.CreateGlowOptions, + [Builder.MenuOptions.IconTexture] = Builder.CreateIconTextureOptions, } diff --git a/WidgetAnnotations.lua b/WidgetAnnotations.lua index 26768f9..4670cb3 100644 --- a/WidgetAnnotations.lua +++ b/WidgetAnnotations.lua @@ -167,6 +167,7 @@ ---@field frameLevel number ---@field size SizeOpt ---@field hideAtMaxLevel boolean +---@field iconTexture string ---@class ReadyCheckIconWidgetTable ---@field enabled boolean diff --git a/Widgets/Icons/RestingIcon.lua b/Widgets/Icons/RestingIcon.lua index ba443bc..a5c2f2a 100644 --- a/Widgets/Icons/RestingIcon.lua +++ b/Widgets/Icons/RestingIcon.lua @@ -24,6 +24,7 @@ menu:AddWidget(const.WIDGET_KIND.RESTING_ICON, Builder.MenuOptions.Anchor, Builder.MenuOptions.SingleSize, Builder.MenuOptions.HideAtMaxLevel, + Builder.MenuOptions.IconTexture, Builder.MenuOptions.FrameLevel) ---@param button CUFUnitButton @@ -37,6 +38,9 @@ function W.UpdateRestingIconWidget(button, unit, setting, subSetting) restingIcon.hideAtMaxLevel = styleTable.hideAtMaxLevel restingIcon:UpdateEventListeners() end + if not setting or setting == const.OPTION_KIND.ICON_TEXTURE then + restingIcon:SetTexture(styleTable.iconTexture) + end restingIcon.Update(button) end @@ -122,6 +126,18 @@ local function UpdateEventListeners(self) end end +---@param self RestingIconWidget +---@param texture string +local function SetTexture(self, texture) + if texture == "" then + self.tex:SetTexture("Interface\\CharacterFrame\\UI-StateIcon") + self.tex:SetTexCoord(0, .5, 0, .421875) + else + self.tex:SetTexture(texture) + self.tex:SetTexCoord(0, 1, 0, 1) + end +end + ------------------------------------------------- -- MARK: Create ------------------------------------------------- @@ -154,6 +170,8 @@ function W:CreateRestingIcon(button) restingIcon.UpdateEventListeners = UpdateEventListeners + restingIcon.SetTexture = SetTexture + restingIcon.SetEnabled = W.SetEnabled restingIcon.SetPosition = W.SetPosition restingIcon._SetIsSelected = W.SetIsSelected