forked from Balatro-Multiplayer/BalatroMultiplayer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisableable_button.lua
More file actions
17 lines (16 loc) · 877 Bytes
/
Copy pathdisableable_button.lua
File metadata and controls
17 lines (16 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function MP.UI.Disableable_Button(args)
local enabled_table = args.enabled_ref_table or {}
local enabled = enabled_table[args.enabled_ref_value]
args.colour = args.colour or G.C.RED
args.text_colour = args.text_colour or G.C.UI.TEXT_LIGHT
args.disabled_text = args.disabled_text or args.label
args.label = not enabled and args.disabled_text or args.label
local button_component = UIBox_button(args)
button_component.nodes[1].config.button = enabled and args.button or nil
button_component.nodes[1].config.hover = enabled
button_component.nodes[1].config.shadow = enabled
button_component.nodes[1].config.colour = enabled and args.colour or G.C.UI.BACKGROUND_INACTIVE
button_component.nodes[1].nodes[1].nodes[1].colour = enabled and args.text_colour or G.C.UI.TEXT_INACTIVE
button_component.nodes[1].nodes[1].nodes[1].shadow = enabled
return button_component
end