This commit is contained in:
@@ -1,22 +1,24 @@
|
||||
extends Control
|
||||
|
||||
@onready
|
||||
var search_list := $ScrollContainer/VBoxContainer
|
||||
var search_list: VBoxContainer = $ScrollContainer/VBoxContainer
|
||||
|
||||
@onready
|
||||
var clear_button := $ClearButton
|
||||
var search_panel: Panel = %SearchPanel
|
||||
|
||||
@onready
|
||||
var close_button := $CloseButton
|
||||
var clear_button: Button = $ClearButton
|
||||
|
||||
@onready
|
||||
var search_bar := $Searchbar
|
||||
var close_button: Button = $CloseButton
|
||||
|
||||
var games := []
|
||||
@onready
|
||||
var search_bar: TextEdit = $Searchbar
|
||||
|
||||
var games: Array = []
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
get_list_of_games()
|
||||
clear_button.pressed.connect(clear)
|
||||
close_button.pressed.connect(close)
|
||||
search_bar.grab_focus()
|
||||
@@ -100,7 +102,7 @@ func compile_regex(search_term: String) -> RegEx:
|
||||
|
||||
func get_list_of_games() -> void:
|
||||
print("get_list_of_games")
|
||||
var handle_games = func handle_games(array):
|
||||
var handle_games: Callable = func handle_games(array) -> void:
|
||||
if typeof(array) == TYPE_ARRAY:
|
||||
games = []
|
||||
Settings.delete_children(search_list)
|
||||
@@ -114,6 +116,13 @@ func get_list_of_games() -> void:
|
||||
print("Unexpected data")
|
||||
Settings.make_request2("/music/all/order", handle_games, true)
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if self.visible == true:
|
||||
if event is InputEventMouseButton && event.is_pressed():
|
||||
var evLocal: InputEvent = make_input_local(event)
|
||||
if !Rect2(Vector2(0, 0), search_panel.size).has_point(evLocal.position):
|
||||
self.visible = false
|
||||
|
||||
func clear() -> void:
|
||||
search_bar.text = ""
|
||||
search()
|
||||
|
||||
Reference in New Issue
Block a user