Files
gymkhana-actions/addons/escoria-ui-9verbs/verbs_menu.gd
Dennis Ploeger a639ad5f32 Issue 343 (#379)
Co-authored-by: Dennis Ploeger <develop@dieploegers.de>
Co-authored-by: dploeger <dploeger@users.noreply.github.com>
2021-08-28 22:29:04 +02:00

31 lines
715 B
GDScript

extends Control
"""
This script is out of Escoria's scope. It controls the UI reaction to an
UI event (eg right click) to change the cursor accordingly.
"""
var selected_action
func _ready():
for but in get_children():
but.connect("pressed", self, "_on_action_selected", [but.name])
but.toggle_mode = true
func _on_action_selected(action: String):
escoria.action_manager.set_current_action(action)
for but in get_children():
but.set_pressed(but.get_name() == action)
func unselect_actions():
for but in get_children():
but.set_pressed(false)
func set_by_name(action_name: String):
selected_action = action_name
for but in get_children():
but.set_pressed(but.get_name() == action_name)