Hover stack

This commit is contained in:
2025-09-13 21:58:28 +02:00
parent 5e63ef4576
commit 365fe26bd1
5 changed files with 61 additions and 32 deletions

View File

@@ -0,0 +1 @@
uid://b3t7vygme1tsa

View File

@@ -3,15 +3,19 @@ extends PanelContainer
var tools: Dictionary
@export var toolButtonContainer: Container
@export var hover_stack_displayer: Node
func _ready() -> void:
if toolButtonContainer.get_child_count() == 0:
return
for child: DevToolToggleButton in toolButtonContainer.get_children():
tools[child.tool_id] = child.tool_node
child.connect("toggle", func(tool_id): toggle_tool(tool_id))
for child: Control in toolButtonContainer.get_children():
if child is DevToolToggleButton:
tools[child.tool_id] = child.tool_node
child.connect("toggle", func(tool_id): toggle_tool(tool_id))
escoria.inputs_manager.hover_stack.connect("hover_stack_changed", Callable(hover_stack_displayer, "update"))
func toggle_tool(toolId: String):
tools[toolId].visible = !tools[toolId].visible
for tool in tools:
if tool != toolId:
tools[tool].visible = false
#for tool in tools:
# if tool != toolId:
# tools[tool].visible = false

View File

@@ -1,16 +1,24 @@
[gd_scene load_steps=6 format=3 uid="uid://yc6r8t73rwrc"]
[gd_scene load_steps=8 format=3 uid="uid://yc6r8t73rwrc"]
[ext_resource type="Script" uid="uid://co3lr1fo4jcio" path="res://addons/escoria-ui-return-monkey-island/tools/dev/dev_tools.gd" id="1_081at"]
[ext_resource type="PackedScene" uid="uid://ciyttd4u8lpfa" path="res://addons/escoria-ui-return-monkey-island/tools/dev/globals_watcher.tscn" id="1_wjhmu"]
[ext_resource type="Script" uid="uid://dmtnqjdnfeu2u" path="res://addons/escoria-ui-return-monkey-island/tools/dev/ui/tool_toggle_button.gd" id="2_op8os"]
[ext_resource type="PackedScene" uid="uid://dq6oyy5g2m03m" path="res://addons/escoria-ui-return-monkey-island/tools/dev/global_inspector.tscn" id="3_rmud2"]
[ext_resource type="PackedScene" uid="uid://b0q36us3uuimq" path="res://addons/escoria-core/game/scenes/esc_prompt/esc_prompt_popup.tscn" id="4_gnply"]
[ext_resource type="PackedScene" uid="uid://ceu6y33rrbdr" path="res://addons/escoria-core/ui_library/tools/hover_stack/hover_stack.tscn" id="6_v60c2"]
[node name="DevTools" type="PanelContainer" node_paths=PackedStringArray("toolButtonContainer")]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_v60c2"]
[node name="DevTools" type="PanelContainer" node_paths=PackedStringArray("toolButtonContainer", "hover_stack_displayer")]
custom_minimum_size = Vector2(1280, 0)
offset_right = 40.0
offset_bottom = 40.0
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_styles/panel = SubResource("StyleBoxEmpty_v60c2")
script = ExtResource("1_081at")
toolButtonContainer = NodePath("MarginContainer/VBoxContainer/Toolbar")
hover_stack_displayer = NodePath("MarginContainer/VBoxContainer/VBoxContainer/hover_stack_layer")
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 2
@@ -21,20 +29,21 @@ layout_mode = 2
[node name="Toolbar" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="Watcher" type="Button" parent="MarginContainer/VBoxContainer/Toolbar" node_paths=PackedStringArray("tool_node")]
[node name="Globals list" type="Button" parent="MarginContainer/VBoxContainer/Toolbar" node_paths=PackedStringArray("tool_node")]
layout_mode = 2
text = "Globals list"
script = ExtResource("2_op8os")
tool_id = "globals_list"
tool_node = NodePath("../../VBoxContainer/GlobalList")
metadata/_custom_type_script = "uid://dmtnqjdnfeu2u"
[node name="Global watcher" type="Button" parent="MarginContainer/VBoxContainer/Toolbar" node_paths=PackedStringArray("tool_node")]
layout_mode = 2
toggle_mode = true
text = "Watcher"
script = ExtResource("2_op8os")
tool_id = "watcher"
tool_node = NodePath("../../ToolContainer/GlobalWatcher")
metadata/_custom_type_script = "uid://dmtnqjdnfeu2u"
[node name="Inspector" type="Button" parent="MarginContainer/VBoxContainer/Toolbar" node_paths=PackedStringArray("tool_node")]
layout_mode = 2
text = "Inspector"
script = ExtResource("2_op8os")
tool_id = "inspector"
tool_node = NodePath("../../ToolContainer/GlobalInspector")
tool_node = NodePath("../../VBoxContainer/GlobalWatcher")
metadata/_custom_type_script = "uid://dmtnqjdnfeu2u"
[node name="Prompt" type="Button" parent="MarginContainer/VBoxContainer/Toolbar" node_paths=PackedStringArray("tool_node")]
@@ -42,18 +51,36 @@ layout_mode = 2
text = "Prompt"
script = ExtResource("2_op8os")
tool_id = "prompt"
tool_node = NodePath("../../ToolContainer/esc_prompt_popup")
tool_node = NodePath("../../VBoxContainer/esc_prompt_popup")
metadata/_custom_type_script = "uid://dmtnqjdnfeu2u"
[node name="ToolContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer"]
[node name="Hover" type="Button" parent="MarginContainer/VBoxContainer/Toolbar" node_paths=PackedStringArray("tool_node")]
layout_mode = 2
text = "Hover"
script = ExtResource("2_op8os")
tool_id = "hover_stack"
tool_node = NodePath("../../VBoxContainer/hover_stack_layer")
metadata/_custom_type_script = "uid://dmtnqjdnfeu2u"
[node name="ToolContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="GlobalWatcher" parent="MarginContainer/VBoxContainer/ToolContainer" instance=ExtResource("1_wjhmu")]
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="GlobalList" parent="MarginContainer/VBoxContainer/VBoxContainer" instance=ExtResource("3_rmud2")]
visible = false
layout_mode = 2
size_flags_horizontal = 0
[node name="GlobalInspector" parent="MarginContainer/VBoxContainer/ToolContainer" instance=ExtResource("3_rmud2")]
[node name="GlobalWatcher" parent="MarginContainer/VBoxContainer/VBoxContainer" instance=ExtResource("1_wjhmu")]
visible = false
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
[node name="esc_prompt_popup" parent="MarginContainer/VBoxContainer/ToolContainer" instance=ExtResource("4_gnply")]
[node name="esc_prompt_popup" parent="MarginContainer/VBoxContainer/VBoxContainer" instance=ExtResource("4_gnply")]
initial_position = 2
[node name="hover_stack_layer" parent="MarginContainer/VBoxContainer/VBoxContainer" instance=ExtResource("6_v60c2")]
visible = false

View File

@@ -10,11 +10,10 @@ labelContainer = NodePath("PanelContainer/MarginContainer/ScrollContainer/VBoxCo
[node name="PanelContainer" type="PanelContainer" parent="."]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
offset_right = 500.0
offset_bottom = 400.0
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"]
custom_minimum_size = Vector2(500, 400)
layout_mode = 2
[node name="ScrollContainer" type="ScrollContainer" parent="PanelContainer/MarginContainer"]

View File

@@ -6,10 +6,8 @@ class_name DevToolToggleButton
signal toggle
func _ready():
self.connect("pressed", _toggle)
#self.connect("pressed", func(): toggle.emit(tool_id))
func _toggle():
toggle.emit(tool_id)
pass
func _ready():
self.connect("pressed", func(): toggle.emit(tool_id))
self.toggle_mode = true