From bafbc44f1a07281f447842694549df3af41c3369 Mon Sep 17 00:00:00 2001 From: Nordup Date: Sat, 17 Jun 2023 21:26:47 +0400 Subject: [PATCH] set current url --- project/scenes/menu_body/world.tscn | 1 + project/scripts/ui/search.gd | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/project/scenes/menu_body/world.tscn b/project/scenes/menu_body/world.tscn index 72b8fca..269a2ed 100644 --- a/project/scenes/menu_body/world.tscn +++ b/project/scenes/menu_body/world.tscn @@ -401,6 +401,7 @@ theme_override_font_sizes/normal_font_size = 24 text = "No description" [node name="Url" type="LineEdit" parent="HBoxContainer/GateInfo"] +visible = false layout_mode = 2 theme_override_colors/font_uneditable_color = Color(1, 1, 1, 1) theme_override_font_sizes/font_size = 20 diff --git a/project/scripts/ui/search.gd b/project/scripts/ui/search.gd index 2e22ef4..48fc7d5 100644 --- a/project/scripts/ui/search.gd +++ b/project/scripts/ui/search.gd @@ -4,6 +4,16 @@ extends LineEdit var url: String +func _ready() -> void: + gate_events.open_gate.connect(set_current_url) + gate_events.exit_gate.connect(set_current_url.bind("")) + + +func set_current_url(_url: String) -> void: + url = _url + text = url + + func _input(event: InputEvent) -> void: if (has_focus() and event is InputEventMouseButton