toggle inv ui
This commit is contained in:
parent
458912bbe1
commit
32be032c4a
3 changed files with 14 additions and 13 deletions
|
@ -8,6 +8,7 @@
|
||||||
[ext_resource type="Script" uid="uid://dfvvqpgu8r5v6" path="res://src/item_details_ui.gd" id="6_uae8j"]
|
[ext_resource type="Script" uid="uid://dfvvqpgu8r5v6" path="res://src/item_details_ui.gd" id="6_uae8j"]
|
||||||
|
|
||||||
[node name="Control" type="Control"]
|
[node name="Control" type="Control"]
|
||||||
|
visible = false
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
|
@ -66,17 +67,14 @@ description_label = NodePath("ItemDescription/Label")
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
[node name="ItemDisplay" type="Control" parent="VBoxContainer/Details"]
|
[node name="ItemDisplay" type="HBoxContainer" parent="VBoxContainer/Details"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
[node name="TextureRect" type="TextureRect" parent="VBoxContainer/Details/ItemDisplay"]
|
[node name="TextureRect" type="TextureRect" parent="VBoxContainer/Details/ItemDisplay"]
|
||||||
layout_mode = 1
|
layout_mode = 2
|
||||||
anchors_preset = 15
|
size_flags_horizontal = 3
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
grow_horizontal = 2
|
|
||||||
grow_vertical = 2
|
|
||||||
expand_mode = 5
|
expand_mode = 5
|
||||||
stretch_mode = 4
|
stretch_mode = 4
|
||||||
|
|
||||||
|
@ -93,7 +91,7 @@ grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
autowrap_mode = 2
|
autowrap_mode = 2
|
||||||
|
|
||||||
[connection signal="pressed" from="." to="." method="show"]
|
[connection signal="pressed" from="." to="." method="set_visible"]
|
||||||
[connection signal="pressed" from="VBoxContainer/ItemNavigation/MoveLeft" to="VBoxContainer/ItemNavigation/HItemList" method="move_left"]
|
[connection signal="pressed" from="VBoxContainer/ItemNavigation/MoveLeft" to="VBoxContainer/ItemNavigation/HItemList" method="move_left"]
|
||||||
[connection signal="selected" from="VBoxContainer/ItemNavigation/HItemList" to="VBoxContainer/Details" method="_on_updated"]
|
[connection signal="selected" from="VBoxContainer/ItemNavigation/HItemList" to="VBoxContainer/Details" method="_on_updated"]
|
||||||
[connection signal="pressed" from="VBoxContainer/ItemNavigation/MoveRight" to="VBoxContainer/ItemNavigation/HItemList" method="move_right"]
|
[connection signal="pressed" from="VBoxContainer/ItemNavigation/MoveRight" to="VBoxContainer/ItemNavigation/HItemList" method="move_right"]
|
||||||
|
|
|
@ -16,7 +16,7 @@ func _ready() -> void:
|
||||||
ring_buffer = RingBuffer.new(items.size(), buffer_size, buffer_size - 1)
|
ring_buffer = RingBuffer.new(items.size(), buffer_size, buffer_size - 1)
|
||||||
ring_buffer.rotated.connect(_on_rotated)
|
ring_buffer.rotated.connect(_on_rotated)
|
||||||
|
|
||||||
for _i in range(buffer_size):
|
for _i in range(buffer_size - self.get_child_count()):
|
||||||
add_child(create_item.call())
|
add_child(create_item.call())
|
||||||
|
|
||||||
_hide_buffered_items()
|
_hide_buffered_items()
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
class_name InputListener extends Node
|
class_name InputListener extends Node
|
||||||
|
|
||||||
signal pressed
|
signal pressed(toggle_state: bool)
|
||||||
signal released
|
signal released(toggle_state: bool)
|
||||||
|
|
||||||
|
@export var toggle_state: bool
|
||||||
|
|
||||||
@export var action: String
|
@export var action: String
|
||||||
|
|
||||||
func _input(event: InputEvent) -> void:
|
func _input(event: InputEvent) -> void:
|
||||||
if event.is_action_pressed(action):
|
if event.is_action_pressed(action):
|
||||||
pressed.emit()
|
self.toggle_state = !toggle_state
|
||||||
|
pressed.emit(toggle_state)
|
||||||
|
|
||||||
if event.is_action_released(action):
|
if event.is_action_released(action):
|
||||||
released.emit()
|
released.emit(toggle_state)
|
||||||
|
|
Loading…
Add table
Reference in a new issue