Restore card drag and drop

This commit is contained in:
blinry 2020-11-25 13:53:07 +01:00
parent abbfc4f1d6
commit f27faabcba
2 changed files with 5 additions and 4 deletions

View file

@ -33,15 +33,17 @@ func _input(event):
if dragged: if dragged:
for area in get_tree().get_nodes_in_group("drop_areas"): for area in get_tree().get_nodes_in_group("drop_areas"):
if area.hovered: if area.hovered:
if area.highlighted and game.dragged_object: if area.highlighted:
game.dragged_object.dropped_on(area.get_parent_with_type()) get_parent_with_type().dropped_on(area.get_parent_with_type())
_turn_off_highlights() _turn_off_highlights()
dragged = false dragged = false
if game.dragged_object:
if hovered and highlighted:
game.dragged_object.dropped_on(get_parent_with_type())
if event.button_index == BUTTON_LEFT and event.pressed and hovered: if event.button_index == BUTTON_LEFT and event.pressed and hovered:
if get_parent().type == "file" and get_parent().item_type == "wd": if get_parent().type == "file" and get_parent().item_type == "wd":
dragged = true dragged = true
game.dragged_object = get_parent_with_type()
_turn_on_highlights() _turn_on_highlights()
func _set_highlighted(new_highlighted): func _set_highlighted(new_highlighted):

View file

@ -17,7 +17,6 @@ void fragment() {
COLOR = vec4(0.4 + hovered*0.2, 0.65 + hovered*0.2, 1, smoothstep(0.5,0.2 + hovered*0.1,d)); COLOR = vec4(0.4 + hovered*0.2, 0.65 + hovered*0.2, 1, smoothstep(0.5,0.2 + hovered*0.1,d));
} }
" "
custom_defines = ""
[sub_resource type="ShaderMaterial" id=3] [sub_resource type="ShaderMaterial" id=3]
resource_local_to_scene = true resource_local_to_scene = true