fix: search game

pull/10/head
Евгений Сугоняко 2024-05-17 15:29:11 +03:00
parent e05ded74a9
commit 92b7090e9c
1 changed files with 13 additions and 4 deletions

View File

@ -2,6 +2,7 @@ extends Node
@export var GameBox : VBoxContainer
@export var SearchLine : LineEdit
func _ready():
@ -12,10 +13,18 @@ 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):
if _games.size() > 0:
for game in _games:
var gameLabel = preload("res://data/scenes/lobbies/GameLabel.tscn").instantiate()
gameLabel.set_game_data(game)