Fixed settings and updated player view. Fixed many other smaler things
This commit is contained in:
@@ -35,13 +35,33 @@ func search():
|
||||
print(search_bar.text)
|
||||
delete_children(search_list)
|
||||
for game in games:
|
||||
if search_bar.text == "" || game.replace(" ", "").to_lower().contains(search_bar.text.replace(" ", "").to_lower()):
|
||||
if is_match(search_bar.text, game):
|
||||
var label := Label.new()
|
||||
label.text = game
|
||||
label.autowrap_mode = TextServer.AUTOWRAP_WORD
|
||||
search_list.add_child(label)
|
||||
|
||||
func is_match(search_term: String, game_name: String) -> bool:
|
||||
search_term = search_term.replace(" ", "").replace("é", "e").to_lower()
|
||||
game_name = game_name.replace(" ", "").replace("é", "e").to_lower()
|
||||
|
||||
static func delete_children(node):
|
||||
if search_term == "":
|
||||
return true
|
||||
elif compile_regex(search_term).search(game_name):
|
||||
return true
|
||||
else:
|
||||
return false
|
||||
|
||||
func compile_regex(search_term: String) -> RegEx:
|
||||
var regex = RegEx.new()
|
||||
var regText: String = ".*"
|
||||
for letter in search_term:
|
||||
regText += letter + ".*"
|
||||
print(regText)
|
||||
regex.compile(regText)
|
||||
return regex
|
||||
|
||||
func delete_children(node):
|
||||
for n in node.get_children():
|
||||
node.remove_child(n)
|
||||
n.queue_free()
|
||||
@@ -57,7 +77,7 @@ func get_list_of_games() -> void:
|
||||
push_error("An error occurred in the HTTP request.")
|
||||
|
||||
# Called when the HTTP request is completed.
|
||||
func _http_request_completed(result, response_code, headers, body):
|
||||
func _http_request_completed(_result, _response_code, _headers, body):
|
||||
var json = JSON.new()
|
||||
var error = json.parse(body.get_string_from_utf8())
|
||||
|
||||
@@ -75,4 +95,6 @@ func _http_request_completed(result, response_code, headers, body):
|
||||
|
||||
func clear():
|
||||
search_bar.text = ""
|
||||
search()
|
||||
search_bar.grab_focus()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user