Skip to content

Commit

Permalink
Override support added for addons like Kaliel's Tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
Wutname1 committed Jul 27, 2019
1 parent b769145 commit 93d8eb5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 22 deletions.
23 changes: 21 additions & 2 deletions Components/Objectives.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@ local Conditions = {
}

local HideFrame = function()
if not SUI.DB.EnabledComponents.Objectives or module.Override then
return
end
if _G[frameName]:GetAlpha() == 0 and _G[frameName].HeaderMenu then
_G[frameName].HeaderMenu.MinimizeButton:Hide()
end
end

local ObjTrackerUpdate = function()
if not SUI.DB.EnabledComponents.Objectives or module.Override then
return
end
local FadeIn = true -- Default to display incase user changes to disabled while hidden
local FadeOut = false

Expand Down Expand Up @@ -56,7 +62,7 @@ local ObjTrackerUpdate = function()
end

-- Always Shown logic
if (not SUI.DB.EnabledComponents.Objectives) or (SUI.DBMod.Objectives.AlwaysShowScenario and ScenarioActive) then
if (SUI.DBMod.Objectives.AlwaysShowScenario and ScenarioActive) then
FadeIn = true
FadeOut = false
end
Expand Down Expand Up @@ -101,6 +107,10 @@ function module:OnInitialize()
end

function module:OnEnable()
if not SUI.DB.EnabledComponents.Objectives or module.Override then
return
end

module:FirstTimeSetup()

-- Add Fade in and out
Expand Down Expand Up @@ -151,6 +161,15 @@ function module:OnEnable()
module:BuildOptions()
end

function module:OnDisable()
-- Make sure everything is visible
if _G[frameName].HeaderMenu then
_G[frameName].HeaderMenu.MinimizeButton:Show()
end
_G[frameName].FadeOut:Stop()
_G[frameName].FadeIn:Play()
end

function module:BuildOptions()
SUI.opt.args['ModSetting'].args['Objectives'] = {
type = 'group',
Expand Down Expand Up @@ -232,7 +251,7 @@ function module:FirstTimeSetup()
local SUI_Win = window.content
local StdUi = window.StdUi
local gui = LibStub('AceGUI-3.0')
if not SUI.DB.EnabledComponents.Objectives then
if not SUI.DB.EnabledComponents.Objectives or module.Override then
window.Skip:Click()
end

Expand Down
32 changes: 12 additions & 20 deletions Core/Options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -988,46 +988,38 @@ function module:OnInitialize()
Displayname = submodule.DisplayName
end

SUI.opt.args['ModSetting'].args['Components'].args[RealName] = {
SUI.opt.args.ModSetting.args.Components.args[RealName] = {
name = Displayname,
type = 'toggle',
disabled = submodule.Override or false,
get = function(info)
if submodule.Override then
return false
end
return SUI.DB.EnabledComponents[RealName]
end,
set = function(info, val)
SUI.DB.EnabledComponents[RealName] = val
if submodule.Disable then
if submodule.OnDisable then
if val then
submodule:Enable()
submodule:OnEnable()
else
submodule:Disable()
submodule:OnDisable()
end
else
SUI:reloadui()
end
SUI:reloadui()
end
}
end
end

SUI.opt.args['ModSetting'].args['enabled'] = {
SUI.opt.args.ModSetting.args['enabled'] = {
name = L['Enabled modules'],
type = 'group',
order = .1,
args = {
Styles = {
name = L['Styles'],
type = 'group',
order = 100,
inline = true,
args = SUI.opt.args['ModSetting'].args['Styles'].args
},
Components = {
name = L['Components'],
type = 'group',
order = 200,
inline = true,
args = SUI.opt.args['ModSetting'].args['Components'].args
}
Components = SUI.opt.args.ModSetting.args['Components']
}
}
end
Expand Down

0 comments on commit 93d8eb5

Please sign in to comment.