diff --git a/data/scenes/lobbies/GamesSinhronizer.gd b/data/scenes/lobbies/GamesSinhronizer.gd index 94b969d..f7cec36 100644 --- a/data/scenes/lobbies/GamesSinhronizer.gd +++ b/data/scenes/lobbies/GamesSinhronizer.gd @@ -2,6 +2,7 @@ extends Node @export var GameBox : VBoxContainer +@export var SearchLine : LineEdit func _ready(): @@ -12,14 +13,22 @@ func create_game(_gameData:Dictionary): rpc_id(1, "rpc_create_game", _gameData) +func _on_search_button_button_up(): + if SearchLine.text == "": + rpc_id(1, "rpc_get_games_list") + else: + rpc_id(1, "rpc_get_game", SearchLine.text) + + #--------------------------------------------------------------------------------------------------- # RPC Client @rpc("authority", "call_local", "unreliable", 2) func rpc_set_games_list(_games:Array): - for game in _games: - var gameLabel = preload("res://data/scenes/lobbies/GameLabel.tscn").instantiate() - gameLabel.set_game_data(game) - GameBox.add_child(gameLabel) + if _games.size() > 0: + for game in _games: + var gameLabel = preload("res://data/scenes/lobbies/GameLabel.tscn").instantiate() + gameLabel.set_game_data(game) + GameBox.add_child(gameLabel) if GATEWAY.debug: print("Get games list")