Refactor button colorization
This commit is contained in:
@@ -310,7 +310,6 @@ function shared.Config.Init()
|
|||||||
local color = res and buttonColors.enabled or buttonColors.disabled
|
local color = res and buttonColors.enabled or buttonColors.disabled
|
||||||
button:SetBackdropColor(unpack(color))
|
button:SetBackdropColor(unpack(color))
|
||||||
end)
|
end)
|
||||||
local color = Heimdall_Data.config.spotter.enabled and buttonColors.enabled or buttonColors.disabled
|
|
||||||
button:SetBackdrop({
|
button:SetBackdrop({
|
||||||
bgFile = "Interface/Tooltips/UI-Tooltip-Background",
|
bgFile = "Interface/Tooltips/UI-Tooltip-Background",
|
||||||
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
|
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
|
||||||
@@ -324,7 +323,10 @@ function shared.Config.Init()
|
|||||||
bottom = 2
|
bottom = 2
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
button:SetBackdropColor(unpack(color))
|
button.UpdateColor = function(self, state)
|
||||||
|
local color = state and buttonColors.enabled or buttonColors.disabled
|
||||||
|
self:SetBackdropColor(unpack(color))
|
||||||
|
end
|
||||||
--spotterEnableButton:SetChecked(Heimdall_Data.config.spotter.enabled)
|
--spotterEnableButton:SetChecked(Heimdall_Data.config.spotter.enabled)
|
||||||
local spotterEnableButtonLabel = button:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
local spotterEnableButtonLabel = button:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
||||||
spotterEnableButtonLabel:SetText(text)
|
spotterEnableButtonLabel:SetText(text)
|
||||||
@@ -396,13 +398,15 @@ function shared.Config.Init()
|
|||||||
Heimdall_Data.config.spotter.enabled = not Heimdall_Data.config.spotter.enabled
|
Heimdall_Data.config.spotter.enabled = not Heimdall_Data.config.spotter.enabled
|
||||||
return Heimdall_Data.config.spotter.enabled
|
return Heimdall_Data.config.spotter.enabled
|
||||||
end)
|
end)
|
||||||
spotterConfigFrame:Add(spotterEnableButton, 1, 5)
|
spotterEnableButton:UpdateColor(Heimdall_Data.config.spotter.enabled)
|
||||||
|
spotterConfigFrame:Add(spotterEnableButton, 1, 6)
|
||||||
|
|
||||||
local spotterEveryoneButton = BasicButton("HeimdallSpotterConfigEveryoneButton",
|
local spotterEveryoneButton = BasicButton("HeimdallSpotterConfigEveryoneButton",
|
||||||
spotterConfigFrame.frame, "Everyone", function()
|
spotterConfigFrame.frame, "Everyone", function()
|
||||||
Heimdall_Data.config.spotter.everyone = not Heimdall_Data.config.spotter.everyone
|
Heimdall_Data.config.spotter.everyone = not Heimdall_Data.config.spotter.everyone
|
||||||
return Heimdall_Data.config.spotter.everyone
|
return Heimdall_Data.config.spotter.everyone
|
||||||
end)
|
end)
|
||||||
|
spotterEveryoneButton:UpdateColor(Heimdall_Data.config.spotter.everyone)
|
||||||
spotterConfigFrame:Add(spotterEveryoneButton, 1, 6)
|
spotterConfigFrame:Add(spotterEveryoneButton, 1, 6)
|
||||||
|
|
||||||
local spotterHostileButton = BasicButton("HeimdallSpotterConfigHostileButton",
|
local spotterHostileButton = BasicButton("HeimdallSpotterConfigHostileButton",
|
||||||
@@ -410,6 +414,7 @@ function shared.Config.Init()
|
|||||||
Heimdall_Data.config.spotter.hostile = not Heimdall_Data.config.spotter.hostile
|
Heimdall_Data.config.spotter.hostile = not Heimdall_Data.config.spotter.hostile
|
||||||
return Heimdall_Data.config.spotter.hostile
|
return Heimdall_Data.config.spotter.hostile
|
||||||
end)
|
end)
|
||||||
|
spotterHostileButton:UpdateColor(Heimdall_Data.config.spotter.hostile)
|
||||||
spotterConfigFrame:Add(spotterHostileButton, 1, 4)
|
spotterConfigFrame:Add(spotterHostileButton, 1, 4)
|
||||||
|
|
||||||
local spotterAllianceButton = BasicButton("HeimdallSpotterConfigAllianceButton",
|
local spotterAllianceButton = BasicButton("HeimdallSpotterConfigAllianceButton",
|
||||||
@@ -417,6 +422,7 @@ function shared.Config.Init()
|
|||||||
Heimdall_Data.config.spotter.alliance = not Heimdall_Data.config.spotter.alliance
|
Heimdall_Data.config.spotter.alliance = not Heimdall_Data.config.spotter.alliance
|
||||||
return Heimdall_Data.config.spotter.alliance
|
return Heimdall_Data.config.spotter.alliance
|
||||||
end)
|
end)
|
||||||
|
spotterAllianceButton:UpdateColor(Heimdall_Data.config.spotter.alliance)
|
||||||
spotterConfigFrame:Add(spotterAllianceButton, 1, 4)
|
spotterConfigFrame:Add(spotterAllianceButton, 1, 4)
|
||||||
|
|
||||||
local spotterStinkyButton = BasicButton("HeimdallSpotterConfigStinkyButton",
|
local spotterStinkyButton = BasicButton("HeimdallSpotterConfigStinkyButton",
|
||||||
@@ -424,6 +430,7 @@ function shared.Config.Init()
|
|||||||
Heimdall_Data.config.spotter.stinky = not Heimdall_Data.config.spotter.stinky
|
Heimdall_Data.config.spotter.stinky = not Heimdall_Data.config.spotter.stinky
|
||||||
return Heimdall_Data.config.spotter.stinky
|
return Heimdall_Data.config.spotter.stinky
|
||||||
end)
|
end)
|
||||||
|
spotterStinkyButton:UpdateColor(Heimdall_Data.config.spotter.stinky)
|
||||||
spotterConfigFrame:Add(spotterStinkyButton, 1, 4)
|
spotterConfigFrame:Add(spotterStinkyButton, 1, 4)
|
||||||
|
|
||||||
local testEditBox = CreateBasicSmallEditBox("HeimdallSpotterConfigTestEditBox",
|
local testEditBox = CreateBasicSmallEditBox("HeimdallSpotterConfigTestEditBox",
|
||||||
|
|||||||
Reference in New Issue
Block a user