2019-05-04 22:01:00 +00:00
|
|
|
extends Control
|
|
|
|
|
2019-08-16 13:29:00 +00:00
|
|
|
onready var cardanim = $CardAnimations
|
2019-05-12 20:58:33 +00:00
|
|
|
onready var cardPic = $CardZoom
|
2019-05-04 22:01:00 +00:00
|
|
|
|
2019-05-06 21:18:04 +00:00
|
|
|
var menu: PopupMenu = null
|
|
|
|
|
2019-05-05 22:39:55 +00:00
|
|
|
func _card_selected(card: Card):
|
2019-05-12 21:37:44 +00:00
|
|
|
# TODO Hide card if it shouldn't be visible
|
2019-05-12 20:58:33 +00:00
|
|
|
cardPic.texture = card.texture
|
2019-08-16 13:29:00 +00:00
|
|
|
cardanim.play("fade ui card")
|
2019-05-04 22:01:00 +00:00
|
|
|
|
2019-05-05 22:39:55 +00:00
|
|
|
func _card_unselected(card: Card):
|
2019-08-16 13:29:00 +00:00
|
|
|
cardanim.play_backwards("fade ui card")
|
2019-05-05 23:35:58 +00:00
|
|
|
|
2019-05-20 21:52:38 +00:00
|
|
|
func show_card_menu(card: Card, cbobj: Object, cbfn):
|
2019-05-06 21:18:04 +00:00
|
|
|
# Close any open menus
|
|
|
|
if menu != null:
|
|
|
|
menu.queue_free()
|
|
|
|
remove_child(menu)
|
|
|
|
menu = PopupMenu.new()
|
|
|
|
if card.inHand:
|
|
|
|
menu.add_separator("Hand actions")
|
|
|
|
menu.add_item("Reveal card", 3)
|
|
|
|
menu.add_item("Discard card", 4)
|
|
|
|
menu.add_item("Banish card", 5)
|
|
|
|
else:
|
|
|
|
menu.add_separator("Card actions")
|
|
|
|
menu.add_item("Flip card", 0)
|
|
|
|
menu.add_separator("Counters & status")
|
|
|
|
menu.add_item("Set Pumped", 1)
|
|
|
|
menu.add_item("Set Cutie-Marked", 2)
|
|
|
|
menu.add_item("Add color", 3)
|
|
|
|
menu.add_item("Add marker", 4)
|
2019-05-20 21:52:38 +00:00
|
|
|
menu.connect("id_pressed", cbobj, cbfn, [card])
|
2019-05-05 23:35:58 +00:00
|
|
|
add_child(menu)
|
2019-05-06 21:18:04 +00:00
|
|
|
menu.popup(Rect2(get_viewport().get_mouse_position(), Vector2(150,10)))
|