From 9075ec35cf8953662e6e41cd6ea75a7f3f8f7ec5 Mon Sep 17 00:00:00 2001 From: Mario Steele Date: Sat, 28 Feb 2026 02:41:42 -0600 Subject: [PATCH] Updated FloatingMenu Added test button from Script Editor. Changed Settings from adding to tree as a panel, and instead use a Window that will handle the panel. Also implemented this for Script Editor. --- UI/floating_menu.gd | 43 ++++++++++++++++++++++++++++++++++++++++--- UI/floating_menu.tscn | 12 ++++++++++++ 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/UI/floating_menu.gd b/UI/floating_menu.gd index 34d333d7..1c00babe 100644 --- a/UI/floating_menu.gd +++ b/UI/floating_menu.gd @@ -5,6 +5,7 @@ const COL_ON := Color.LIGHT_GREEN const COL_OFF := Color.LIGHT_SALMON const SETTINGS_PANEL = preload("res://UI/settings_panel.tscn") +const SCRIPT_EDITOR = preload("res://UI/Controls/script_editor.tscn") # Indicators @onready var indicators: Control = %indicators @@ -18,6 +19,7 @@ const SETTINGS_PANEL = preload("res://UI/settings_panel.tscn") @onready var btn_step_away: GDSubMenuButton = %btn_step_away @onready var btn_tuber: GDSubMenuButton = %btn_tuber @onready var btn_chat: GDSubMenuButton = %btn_chat +@onready var btn_script_editor: GDSubMenuButton = %btn_script_editor @onready var btn_user_list: GDSubMenuButton = %btn_user_list @onready var btn_settings: GDSubMenuButton = %btn_settings @onready var btn_end: GDSubMenuButton = %btn_end @@ -25,6 +27,9 @@ const SETTINGS_PANEL = preload("res://UI/settings_panel.tscn") var is_anchored := true var anchored_position: Vector2 +var _set_win: Window +var _edit_win: Window + func start(_main_menu_button: GDSubMenuButton = null) -> void: anchored_position = position var _parent: Control = get_parent() @@ -98,11 +103,43 @@ func calculate_anchored_pos() -> void: func _connect_signals() -> void: btn_end.properly_pressed.connect(func(): get_tree().quit()) btn_settings.properly_pressed.connect(_handle_settings) + btn_script_editor.properly_pressed.connect(_handle_script_editor) + btn_run_obs.properly_pressed.connect(_handle_run_obs) func _handle_settings() -> void: + if _set_win: return + var win := Window.new() + win.borderless = false + win.always_on_top = false + win.mode = Window.MODE_WINDOWED var pnl := SETTINGS_PANEL.instantiate() - Globals.disable_mouse_passthrough() - get_tree().root.add_child(pnl) - pnl.show() + #Globals.disable_mouse_passthrough() + win.add_child(pnl) + win.size = Vector2i(1000,800) + win.close_requested.connect(func(): win.queue_free(); _set_win = null) + win.name = "SettingsWindow" + win.title = "Settings" + get_tree().root.add_child(win) + win.show() + _set_win = win + +func _handle_script_editor() -> void: + if _edit_win: return + var win := Window.new() + win.borderless = false + win.always_on_top = false + win.mode = Window.MODE_WINDOWED + var pnl := SCRIPT_EDITOR.instantiate() + win.name = "ScriptEditorWindow" + win.title = "Script Editor" + win.add_child(pnl) + win.size = Vector2i(800,600) + win.close_requested.connect(func(): win.queue_free(); _edit_win = null) + get_tree().root.add_child(win) + win.show() + _edit_win = win + +func _handle_run_obs() -> void: + EventManager.test_notification("Hello World!") #endregion diff --git a/UI/floating_menu.tscn b/UI/floating_menu.tscn index 848266b3..44a95d48 100644 --- a/UI/floating_menu.tscn +++ b/UI/floating_menu.tscn @@ -15,6 +15,7 @@ [ext_resource type="Texture2D" uid="uid://2fmj2y31d8gh" path="res://UI/assets/bootstrap/chat-fill.svg" id="13_2lv5e"] [ext_resource type="Texture2D" uid="uid://cnwnao243j1jb" path="res://UI/assets/font_awesome/camera.svg" id="13_64x86"] [ext_resource type="Texture2D" uid="uid://byn16ueoaws0c" path="res://UI/assets/font_awesome/users-rectangle.svg" id="14_64x86"] +[ext_resource type="Texture2D" uid="uid://d1nwblkrn087m" path="res://UI/assets/simple/purescript.svg" id="15_i4a5v"] [ext_resource type="Texture2D" uid="uid://cjkwqaf31p1w0" path="res://UI/assets/font_awesome/gear.svg" id="15_ud5hd"] [ext_resource type="Texture2D" uid="uid://d4httqv81w0nn" path="res://UI/assets/font_awesome/circle-xmark.svg" id="16_i4a5v"] @@ -231,6 +232,17 @@ icon = ExtResource("15_ud5hd") script = ExtResource("8_ttodq") metadata/_custom_type_script = "uid://8715vyt7prmd" +[node name="btn_script_editor" type="Button" parent="btn_settings" unique_id=1321927447] +unique_name_in_owner = true +visible = false +layout_mode = 0 +offset_right = 40.0 +offset_bottom = 40.0 +tooltip_text = "Script Editor" +icon = ExtResource("15_i4a5v") +script = ExtResource("8_ttodq") +metadata/_custom_type_script = "uid://8715vyt7prmd" + [node name="btn_end" type="Button" parent="." unique_id=59540475] unique_name_in_owner = true visible = false