card picker will now emit a signal and drop focus when finished

This commit is contained in:
betalars 2023-07-03 23:06:07 +02:00
parent 9064b84e65
commit 32f02117bb
1 changed files with 8 additions and 0 deletions

View File

@ -42,6 +42,8 @@ var curr_selection_id: int = -1:
var output:Array var output:Array
var options:Array var options:Array
signal cards_picked(Array)
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
var card_controls = $cards.get_children() var card_controls = $cards.get_children()
@ -129,6 +131,12 @@ func pick(id: int):
await anim_players[0].animation_finished await anim_players[0].animation_finished
selection_state = POSTS selection_state = POSTS
input_locked = false input_locked = false
else:
var out_str:Array[String] = []
for card in output:
out_str.append(card.name)
emit_signal("cards_picked", out_str)
State.drop_focus(self)
func handle_hover(new_highlight): func handle_hover(new_highlight):
if not input_locked: if not input_locked: