36 lines
No EOL
981 B
GDScript
36 lines
No EOL
981 B
GDScript
extends Control
|
|
|
|
onready var animation = $AnimationPlayer
|
|
onready var cardPic = $CardZoom
|
|
|
|
var menu: PopupMenu = null
|
|
|
|
func _card_selected(card: Card):
|
|
cardPic.texture = card.texture
|
|
animation.play("fade ui card")
|
|
|
|
func _card_unselected(card: Card):
|
|
animation.play_backwards("fade ui card")
|
|
|
|
func show_card_menu(card):
|
|
# 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)
|
|
menu.connect("id_pressed", card, "_menu_action")
|
|
add_child(menu)
|
|
menu.popup(Rect2(get_viewport().get_mouse_position(), Vector2(150,10))) |