Skip to content

Commit

Permalink
AuraBar options expansion.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wutname1 committed Aug 17, 2024
1 parent 225472a commit 15ccdd0
Show file tree
Hide file tree
Showing 3 changed files with 211 additions and 30 deletions.
131 changes: 119 additions & 12 deletions Modules/UnitFrames/Elements/AuraBars.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local UF = SUI.UF
local L = SUI.L
-- local AuraFilter = UF.AuraFilter

-- function UF:AuraBars_UpdateBar(bar)
Expand Down Expand Up @@ -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

Expand Down
93 changes: 91 additions & 2 deletions Modules/UnitFrames/Elements/ClassPower.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
17 changes: 1 addition & 16 deletions Modules/UnitFrames/Elements/TargetIndicator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 15ccdd0

Please sign in to comment.