fix: wire item_confirmed signal and set item cursor icon
This commit is contained in:
@@ -193,40 +193,6 @@ func _gui_input(event: InputEvent) -> void:
|
||||
hide_overlay()
|
||||
close_requested.emit()
|
||||
|
||||
func _gui_input(event: InputEvent) -> void:
|
||||
print("HI")
|
||||
if not _is_visible:
|
||||
return
|
||||
|
||||
if event is InputEventMouseButton:
|
||||
print("CLOSE")
|
||||
if event.button_index == 1 and event.pressed:
|
||||
|
||||
_clear_selection()
|
||||
hide_overlay()
|
||||
close_requested.emit()
|
||||
if not _is_dragging:
|
||||
pass
|
||||
elif event.button_index == 1 and not event.pressed:
|
||||
if _is_dragging:
|
||||
if _hovered_slot == null:
|
||||
_clear_selection()
|
||||
hide_overlay()
|
||||
close_requested.emit()
|
||||
elif _hovered_slot == _selected_slot:
|
||||
_handle_release_same_item()
|
||||
else:
|
||||
combine_requested.emit(_selected_slot.item_id, _hovered_slot.item_id)
|
||||
_clear_selection()
|
||||
return
|
||||
|
||||
if event is InputEventMouseMotion and _is_dragging and _dragged_item:
|
||||
_dragged_item.position = get_local_mouse_position() - Vector2(24, 24)
|
||||
var panel_rect = panel.get_global_rect()
|
||||
if not panel_rect.has_point(get_global_mouse_position()):
|
||||
_clear_selection()
|
||||
hide_overlay()
|
||||
close_requested.emit()
|
||||
|
||||
func _on_combination_attempted(item_a_id: String, item_b_id: String) -> void:
|
||||
pass
|
||||
|
||||
@@ -52,10 +52,15 @@ color = Color(0.15, 0.15, 0.2, 1)
|
||||
|
||||
[node name="ItemGrid" type="GridContainer" parent="InventoryPanel" unique_id=-1294967291]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 10.0
|
||||
offset_top = 10.0
|
||||
offset_right = -10.0
|
||||
offset_bottom = -50.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="HoverLabel" type="Label" parent="InventoryPanel" unique_id=-1294967290]
|
||||
layout_mode = 1
|
||||
|
||||
@@ -1,27 +1,32 @@
|
||||
[gd_scene format=3 uid="uid://1esl88fgtd2p6"]
|
||||
[gd_scene format=3 uid="uid://c7depvvxf5s6l"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://oegm753jbl9m" path="res://inventory/inventory_overlay/InventorySlot.gd" id="1"]
|
||||
[ext_resource type="Script" uid="uid://oegm753jbmam" path="res://inventory/inventory_overlay/InventorySlot.gd" id="1"]
|
||||
|
||||
[node name="InventorySlot" type="Control" unique_id=2000000001]
|
||||
custom_minimum_size = Vector2i(64, 64)
|
||||
custom_minimum_size = Vector2(64, 64)
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
script = ExtResource("1")
|
||||
|
||||
[node name="ItemBox" type="ColorRect" parent="." unique_id=2000000002]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.062
|
||||
anchor_top = 0.062
|
||||
anchor_right = 0.938
|
||||
anchor_bottom = 0.938
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 1
|
||||
color = Color(1, 0.6, 0.2, 1)
|
||||
|
||||
[node name="HoverHighlight" type="ColorRect" parent="." unique_id=2000000003]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 1
|
||||
color = Color(1, 1, 1, 0.3)
|
||||
visible = false
|
||||
|
||||
Reference in New Issue
Block a user