From 15ccdd06080563275f0d648ba0c030020c67e744 Mon Sep 17 00:00:00 2001 From: wutname1 Date: Sat, 17 Aug 2024 14:40:13 -0500 Subject: [PATCH] AuraBar options expansion. --- Modules/UnitFrames/Elements/AuraBars.lua | 131 ++++++++++++++++-- Modules/UnitFrames/Elements/ClassPower.lua | 93 ++++++++++++- .../UnitFrames/Elements/TargetIndicator.lua | 17 +-- 3 files changed, 211 insertions(+), 30 deletions(-) diff --git a/Modules/UnitFrames/Elements/AuraBars.lua b/Modules/UnitFrames/Elements/AuraBars.lua index b6a75fa1..9984eda6 100644 --- a/Modules/UnitFrames/Elements/AuraBars.lua +++ b/Modules/UnitFrames/Elements/AuraBars.lua @@ -1,4 +1,5 @@ local UF = SUI.UF +local L = SUI.L -- local AuraFilter = UF.AuraFilter -- function UF:AuraBars_UpdateBar(bar) @@ -91,29 +92,135 @@ end ---@param unitName string ---@param OptionSet AceConfig.OptionsTable local function Options(unitName, OptionSet) - local ElementSettings = UF.CurrentSettings[unitName].elements.AuraWatch + local ElementSettings = UF.CurrentSettings[unitName].elements.AuraBars local function OptUpdate(option, val) - --Update memory UF.CurrentSettings[unitName].elements.AuraBars[option] = val - --Update the DB UF.DB.UserSettings[UF.DB.Style][unitName].elements.AuraBars[option] = val - --Update the screen UF.Unit[unitName]:ElementUpdate('AuraBars') end - --local DB = UF.CurrentSettings[unitName].elements.AuraBars OptionSet.args.Layout = { - name = '', + name = L['Layout'], type = 'group', order = 100, inline = true, - args = {}, + args = { + growth = { + name = L['Growth Direction'], + desc = L['Choose the direction in which aura bars grow'], + type = 'select', + order = 1, + values = { + UP = L['Up'], + DOWN = L['Down'], + }, + get = function() + return ElementSettings.growth + end, + set = function(_, val) + OptUpdate('growth', val) + end, + }, + maxBars = { + name = L['Maximum Bars'], + desc = L['Set the maximum number of aura bars to display'], + type = 'range', + order = 2, + min = 1, + max = 40, + step = 1, + get = function() + return ElementSettings.maxBars + end, + set = function(_, val) + OptUpdate('maxBars', val) + end, + }, + barSpacing = { + name = L['Bar Spacing'], + desc = L['Set the space between aura bars'], + type = 'range', + order = 3, + min = 0, + max = 20, + step = 1, + get = function() + return ElementSettings.barSpacing + end, + set = function(_, val) + OptUpdate('barSpacing', val) + end, + }, + }, } - OptionSet.args.Filters.args.NOTFINISHED = { - name = SUI.L['The below options are not finished, and may not work at all or be wiped in the next update. Use at your own risk.'], - type = 'description', - fontSize = 'medium', - order = 0.1, + + OptionSet.args.Appearance = { + name = L['Appearance'], + type = 'group', + order = 200, + inline = true, + args = { + fgalpha = { + name = L['Foreground Alpha'], + desc = L['Set the opacity of the aura bar foreground'], + type = 'range', + order = 1, + min = 0, + max = 1, + step = 0.01, + get = function() + return ElementSettings.fgalpha + end, + set = function(_, val) + OptUpdate('fgalpha', val) + end, + }, + bgalpha = { + name = L['Background Alpha'], + desc = L['Set the opacity of the aura bar background'], + type = 'range', + order = 2, + min = 0, + max = 1, + step = 0.01, + get = function() + return ElementSettings.bgalpha + end, + set = function(_, val) + OptUpdate('bgalpha', val) + end, + }, + spellNameSize = { + name = L['Spell Name Font Size'], + desc = L['Set the font size for spell names on aura bars'], + type = 'range', + order = 3, + min = 6, + max = 20, + step = 1, + get = function() + return ElementSettings.spellNameSize + end, + set = function(_, val) + OptUpdate('spellNameSize', val) + end, + }, + spellTimeSize = { + name = L['Spell Time Font Size'], + desc = L['Set the font size for spell durations on aura bars'], + type = 'range', + order = 4, + min = 6, + max = 20, + step = 1, + get = function() + return ElementSettings.spellTimeSize + end, + set = function(_, val) + OptUpdate('spellTimeSize', val) + end, + }, + }, } end diff --git a/Modules/UnitFrames/Elements/ClassPower.lua b/Modules/UnitFrames/Elements/ClassPower.lua index 75b6b928..d1747c66 100644 --- a/Modules/UnitFrames/Elements/ClassPower.lua +++ b/Modules/UnitFrames/Elements/ClassPower.lua @@ -44,22 +44,111 @@ end ---@param unitName string ---@param OptionSet AceConfig.OptionsTable local function Options(unitName, OptionSet) + local ElementSettings = UF.CurrentSettings[unitName].elements.ClassPower + local function OptUpdate(option, val) + UF.CurrentSettings[unitName].elements.ClassPower[option] = val + UF.DB.UserSettings[UF.DB.Style][unitName].elements.ClassPower[option] = val + UF.Unit[unitName]:ElementUpdate('ClassPower') + end + OptionSet.args.texture = { type = 'select', dialogControl = 'LSM30_Statusbar', order = 2, width = 'double', - name = 'Bar Texture', + name = L['Bar Texture'], + desc = L['Select the texture used for the class power bars'], values = AceGUIWidgetLSMlists.statusbar, + get = function() + return ElementSettings.texture + end, + set = function(_, val) + OptUpdate('texture', val) + end, } - OptionSet.args.display.args.size = nil + OptionSet.args.display.args.height = { type = 'range', order = 1, name = L['Height'], + desc = L['Set the height of the class power bars'], + min = 1, + max = 100, + step = 1, + get = function() + return ElementSettings.height + end, + set = function(_, val) + OptUpdate('height', val) + end, + } + + OptionSet.args.display.args.width = { + type = 'range', + order = 2, + name = L['Width'], + desc = L['Set the width of individual class power bars'], min = 1, max = 100, step = 1, + get = function() + return ElementSettings.width + end, + set = function(_, val) + OptUpdate('width', val) + end, + } + + OptionSet.args.display.args.spacing = { + type = 'range', + order = 3, + name = L['Spacing'], + desc = L['Set the spacing between class power bars'], + min = 0, + max = 20, + step = 1, + get = function() + return ElementSettings.spacing + end, + set = function(_, val) + OptUpdate('spacing', val) + end, + } + + OptionSet.args.colors = { + type = 'group', + order = 4, + name = L['Colors'], + inline = true, + args = { + useClassColors = { + type = 'toggle', + order = 1, + name = L['Use Class Colors'], + desc = L['Use class-specific colors for power bars'], + get = function() + return ElementSettings.useClassColors + end, + set = function(_, val) + OptUpdate('useClassColors', val) + end, + }, + customColor = { + type = 'color', + order = 2, + name = L['Custom Color'], + desc = L['Set a custom color for power bars'], + disabled = function() + return ElementSettings.useClassColors + end, + get = function() + return unpack(ElementSettings.customColor or { 1, 1, 1 }) + end, + set = function(_, r, g, b) + OptUpdate('customColor', { r, g, b }) + end, + }, + }, } end diff --git a/Modules/UnitFrames/Elements/TargetIndicator.lua b/Modules/UnitFrames/Elements/TargetIndicator.lua index 3c165392..b15108c3 100644 --- a/Modules/UnitFrames/Elements/TargetIndicator.lua +++ b/Modules/UnitFrames/Elements/TargetIndicator.lua @@ -34,25 +34,10 @@ local function Update(frame, settings) end end ----@param unitName string ----@param OptionSet AceConfig.OptionsTable ----@param DB? table -local function Options(unitName, OptionSet, DB) - local function OptUpdate(option, val) - --Update memory - UF.CurrentSettings[unitName].elements.TargetIndicator[option] = val - --Update the DB - UF.DB.UserSettings[UF.DB.Style][unitName].elements.TargetIndicator[option] = val - --Update the screen - UF.Unit:Get(unitName):ElementUpdate('TargetIndicator') - end - --local DB = UF.CurrentSettings[unitName].elements.TargetIndicator -end - local Settings = { config = { NoBulkUpdate = false, }, } -UF.Elements:Register('TargetIndicator', Build, Update, Options, Settings) +UF.Elements:Register('TargetIndicator', Build, Update, _, Settings)