challenge-editor/scene/basic_mes_item_drop_data.gd

29 lines
654 B
GDScript3
Raw Normal View History

2024-09-28 12:04:15 +08:00
extends Label
2024-09-28 18:46:15 +08:00
signal fresh
2024-09-28 12:04:15 +08:00
@export var type:int=0
@export var texture:TextureRect
2024-09-28 18:46:15 +08:00
var item_data
#当前使用的页面
var page:int=0
@export var index:int=0
2024-09-28 12:04:15 +08:00
func _can_drop_data(at_position: Vector2, data: Variant) -> bool:
if data.has("type") and data["type"]==type:
return true
else:
return false
func _drop_data(at_position: Vector2, data: Variant) -> void:
2024-09-28 18:46:15 +08:00
Global.replace_equip_with_data(page,index,data)
Global.decrease_item_num_index(data["ind"])
2024-09-28 12:04:15 +08:00
item_data=data
2024-09-28 18:46:15 +08:00
fresh.emit()
2024-09-28 12:04:15 +08:00
2024-09-28 18:46:15 +08:00
func set_data(_data):
if _data==null:
texture.texture=null
item_data=null
return
item_data=_data
texture.texture=Global.get_texture(_data["texture"])