summaryrefslogtreecommitdiff
path: root/addons/escoria-core/ui_library/tools
diff options
context:
space:
mode:
authorRadio <radiohotline@disroot.org>2026-06-04 15:15:11 +0300
committerRadio <radiohotline@disroot.org>2026-06-04 15:15:11 +0300
commit9d74b49ab62908d4acf53dde444413886b8b28e5 (patch)
tree0cb785267ea7e239b19d88684c0d64b9bd5d52f0 /addons/escoria-core/ui_library/tools
parent2c85d452ad02a5f89cd43bad7f9de31d0e4fa0c1 (diff)
escoria setup and old branch archives
Diffstat (limited to 'addons/escoria-core/ui_library/tools')
-rw-r--r--addons/escoria-core/ui_library/tools/hover_stack/hover_stack.gd14
-rw-r--r--addons/escoria-core/ui_library/tools/hover_stack/hover_stack.gd.uid1
-rw-r--r--addons/escoria-core/ui_library/tools/hover_stack/hover_stack.tscn23
-rw-r--r--addons/escoria-core/ui_library/tools/room_select/room_select.gd73
-rw-r--r--addons/escoria-core/ui_library/tools/room_select/room_select.gd.uid1
-rw-r--r--addons/escoria-core/ui_library/tools/room_select/room_select.tscn25
6 files changed, 137 insertions, 0 deletions
diff --git a/addons/escoria-core/ui_library/tools/hover_stack/hover_stack.gd b/addons/escoria-core/ui_library/tools/hover_stack/hover_stack.gd
new file mode 100644
index 0000000..0443f91
--- /dev/null
+++ b/addons/escoria-core/ui_library/tools/hover_stack/hover_stack.gd
@@ -0,0 +1,14 @@
+extends CanvasLayer
+
+@onready var list = $VBoxContainer/hover_stack
+
+func update() -> void:
+ for e in list.get_children():
+ list.remove_child(e)
+ e.queue_free()
+ if escoria.inputs_manager.hover_stack.is_empty():
+ return
+ for e in escoria.inputs_manager.hover_stack.get_all():
+ var l = Label.new()
+ l.text = e.global_id
+ list.add_child(l)
diff --git a/addons/escoria-core/ui_library/tools/hover_stack/hover_stack.gd.uid b/addons/escoria-core/ui_library/tools/hover_stack/hover_stack.gd.uid
new file mode 100644
index 0000000..a06dc00
--- /dev/null
+++ b/addons/escoria-core/ui_library/tools/hover_stack/hover_stack.gd.uid
@@ -0,0 +1 @@
+uid://csscdvd15atps
diff --git a/addons/escoria-core/ui_library/tools/hover_stack/hover_stack.tscn b/addons/escoria-core/ui_library/tools/hover_stack/hover_stack.tscn
new file mode 100644
index 0000000..f368ce7
--- /dev/null
+++ b/addons/escoria-core/ui_library/tools/hover_stack/hover_stack.tscn
@@ -0,0 +1,23 @@
+[gd_scene load_steps=2 format=3 uid="uid://ceu6y33rrbdr"]
+
+[ext_resource type="Script" uid="uid://csscdvd15atps" path="res://addons/escoria-core/ui_library/tools/hover_stack/hover_stack.gd" id="1"]
+
+[node name="hover_stack_layer" type="CanvasLayer"]
+script = ExtResource("1")
+
+[node name="VBoxContainer" type="VBoxContainer" parent="."]
+offset_top = 32.0
+offset_right = 167.0
+offset_bottom = 84.0
+size_flags_horizontal = 3
+size_flags_vertical = 3
+
+[node name="title" type="RichTextLabel" parent="VBoxContainer"]
+layout_mode = 2
+size_flags_vertical = 3
+bbcode_enabled = true
+text = "Hover stack"
+
+[node name="hover_stack" type="VBoxContainer" parent="VBoxContainer"]
+layout_mode = 2
+size_flags_vertical = 3
diff --git a/addons/escoria-core/ui_library/tools/room_select/room_select.gd b/addons/escoria-core/ui_library/tools/room_select/room_select.gd
new file mode 100644
index 0000000..cc03b40
--- /dev/null
+++ b/addons/escoria-core/ui_library/tools/room_select/room_select.gd
@@ -0,0 +1,73 @@
+# A small utility to quickly switch to a room while developing
+extends OptionButton
+
+
+# The selected option
+var _selected_id = 0
+
+
+# The path to available rooms
+var _options_paths = []
+
+
+# Build up the list of rooms
+func _ready():
+ var rooms_folder = ESCProjectSettingsManager.get_setting(
+ ESCProjectSettingsManager.ROOM_SELECTOR_ROOM_DIR
+ )
+ if rooms_folder == "" or \
+ not ESCProjectSettingsManager.get_setting(
+ ESCProjectSettingsManager.ENABLE_ROOM_SELECTOR
+ ):
+ return
+ var rooms_list: Array = []
+ var path = ProjectSettings.globalize_path(rooms_folder)
+ if not OS.has_feature("editor"):
+ path = OS.get_executable_path().get_base_dir().path_join(path)
+ var dir = DirAccess.open(path)
+ if dir != null:
+ dir.list_dir_begin() # TODOConverter3To4 fill missing arguments https://github.com/godotengine/godot/pull/40547
+ var file_name = dir.get_next()
+ while file_name != "":
+ if dir.current_is_dir():
+ rooms_list.push_back(file_name)
+ file_name = dir.get_next()
+
+ rooms_list.sort()
+ for room in rooms_list:
+ add_item(room)
+ _options_paths.push_back("%s/%s/%s.tscn" %[
+ rooms_folder,
+ room,
+ room
+ ])
+
+ else:
+ escoria.logger.warn(
+ self,
+ "A problem occurred while opening rooms folder %s." % str(path)
+ )
+
+
+# Switch to the selected room
+func _on_button_pressed():
+ # When next room is loaded, we don't want to consider ESC_LAST_SCENE for
+ # automatic transitions.
+ # If FORCE_LAST_SCENE_NULL is True when change_scene starts:
+ # - ESC_LAST_SCENE is set to empty
+ escoria.globals_manager.set_global(
+ escoria.room_manager.GLOBAL_FORCE_LAST_SCENE_NULL,
+ true,
+ true
+ )
+
+ escoria.event_manager.interrupt()
+ escoria.room_manager.change_scene_to_file(_options_paths[_selected_id], false)
+
+
+# A room was selected, store the selection
+#
+# #### Parameters
+# - index: The index of the selected room in the paths list
+func _on_option_item_selected(index):
+ _selected_id = index
diff --git a/addons/escoria-core/ui_library/tools/room_select/room_select.gd.uid b/addons/escoria-core/ui_library/tools/room_select/room_select.gd.uid
new file mode 100644
index 0000000..b36c503
--- /dev/null
+++ b/addons/escoria-core/ui_library/tools/room_select/room_select.gd.uid
@@ -0,0 +1 @@
+uid://b5uyabsv4jdxn
diff --git a/addons/escoria-core/ui_library/tools/room_select/room_select.tscn b/addons/escoria-core/ui_library/tools/room_select/room_select.tscn
new file mode 100644
index 0000000..3feb0d5
--- /dev/null
+++ b/addons/escoria-core/ui_library/tools/room_select/room_select.tscn
@@ -0,0 +1,25 @@
+[gd_scene load_steps=2 format=3 uid="uid://c5xhvh8pw1qba"]
+
+[ext_resource type="Script" uid="uid://b5uyabsv4jdxn" path="res://addons/escoria-core/ui_library/tools/room_select/room_select.gd" id="1"]
+
+[node name="room_select" type="HBoxContainer"]
+offset_right = 63.0
+offset_bottom = 40.0005
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="option" type="OptionButton" parent="."]
+offset_right = 29.0
+offset_bottom = 40.0
+size_flags_horizontal = 3
+script = ExtResource("1")
+
+[node name="button" type="Button" parent="."]
+offset_left = 33.0
+offset_right = 63.0
+offset_bottom = 40.0
+text = "Go"
+
+[connection signal="item_selected" from="option" to="option" method="_on_option_item_selected"]
+[connection signal="pressed" from="button" to="option" method="_on_button_pressed"]