Checkbox now makes sound

This commit is contained in:
OldManAlpha 2025-08-28 20:03:49 -07:00
parent 87d27f4cc9
commit c00be9fd64

View File

@ -23,4 +23,21 @@ function PTGuiCheckbox:OnDispose()
self:SetChecked(false)
end
function PTGuiCheckbox:SetScript(scriptName, script, noSelf)
if scriptName ~= "OnClick" then
return self.super.SetScript(self, scriptName, script, noSelf)
end
self:GetHandle():SetScript(scriptName, function()
if self:GetChecked() then
PlaySound("igMainMenuOptionCheckBoxOn")
else
PlaySound("igMainMenuOptionCheckBoxOff")
end
if script then
script(self)
end
end)
return self
end
PTGuiLib.RegisterComponent(PTGuiCheckbox)