fix: wire backpack signals and simplify positioning
- Connect overlay_show_requested/overlay_hide_requested signals in Game.tscn to new handlers in MainGame.gd that call show_overlay()/hide_overlay() - Simplify backpack to fixed 70x70 position at top-left (layout_mode=0) - Remove broken anchor overrides from Game.tscn that were anchoring to bottom
This commit is contained in:
12
Game.tscn
12
Game.tscn
@@ -190,17 +190,11 @@ autowrap_mode = 3
|
||||
layer = 5
|
||||
|
||||
[node name="InventoryBackpack" parent="HUD" unique_id=-294967294 instance=ExtResource("9_backpack")]
|
||||
anchors_preset = 12
|
||||
anchor_top = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = -64.65503
|
||||
offset_bottom = -4.654907
|
||||
grow_vertical = 0
|
||||
|
||||
[node name="InventoryOverlayLayer" type="CanvasLayer" parent="." unique_id=-294967293]
|
||||
layer = 10
|
||||
visible = false
|
||||
|
||||
[node name="InventoryOverlay" parent="InventoryOverlayLayer" unique_id=-294967292 instance=ExtResource("a_overlay")]
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[connection signal="overlay_show_requested" from="HUD/InventoryBackpack" to="HUD/InventoryBackpack/.." method="_on_backpack_show_overlay"]
|
||||
[connection signal="overlay_hide_requested" from="HUD/InventoryBackpack" to="HUD/InventoryBackpack/.." method="_on_backpack_hide_overlay"]
|
||||
|
||||
@@ -74,6 +74,12 @@ func restore_cursor() -> void:
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
$SceneViewport.push_input(event)
|
||||
|
||||
func _on_backpack_show_overlay() -> void:
|
||||
$HUD/InventoryOverlay.show_overlay()
|
||||
|
||||
func _on_backpack_hide_overlay() -> void:
|
||||
$HUD/InventoryOverlay.hide_overlay()
|
||||
|
||||
func _input(event):
|
||||
if event.is_action_released("quit"):
|
||||
get_tree().quit()
|
||||
|
||||
@@ -3,11 +3,8 @@
|
||||
[ext_resource type="Script" uid="uid://2x3g0ethsdcgo" path="res://inventory/inventory_backpack/InventoryBackpack.gd" id="1"]
|
||||
|
||||
[node name="InventoryBackpack" type="Control" unique_id=1000000001]
|
||||
layout_mode = 3
|
||||
anchors_preset = 2
|
||||
anchor_right = 1.0
|
||||
offset_top = 10.0
|
||||
offset_right = -70.0
|
||||
layout_mode = 0
|
||||
offset_right = 70.0
|
||||
offset_bottom = 70.0
|
||||
script = ExtResource("1")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user