checheche/Robo-Bus-A31-HMI/common/tool/card_tool.gd
2024-12-06 21:22:11 +08:00

19 lines
572 B
GDScript

class_name CardTool
extends Node
static func add_card(card_id,post=Vector2(),parent_card = null):
var card = preload("res://card/card.tscn").instantiate()
if parent_card == null:
Global.scence.cards.add_child(card)
else:
parent_card.net_card_node.add_child(card)
card.parent_card = parent_card
card.parent_card.net_card = card
card.target_post = post
card.global_position = post
Global.card_arr.append(card)
card.name = "card"+str(Global.card_arr.size())
card.card_id = card_id
card.trascina.connect(Callable(Global.scence,"trascina_card"))
return card