In a project I am working on, I have:
func process_key_event(event):
if(event.is_action_pressed("ui_accept")):
print("ui_accept triggered")
emit_signal("char_action_signal")
Thing is, I want that button to do different things in different contexts. If I have an item menu open... I want this signal to open the currently selected menu option. If I have a dialogue window open, I want this action to move the dialogue forwards. If I am in a Battle menu, I want it to select a battle option.
I do this by changing the function that gets called based on a GameMode + other relevant context.
This action is bound to the "Enter" button; but using the same technique on a button in the UI would give you the same flexibility of different behavior for different context.
Implementing this as an abstract method with an interface.... I admit that I haven't figured out how to do this in GDScript, yet. I believe it would be possible in GDNative (c++), though.