fix: search game
parent
e05ded74a9
commit
92b7090e9c
|
@ -2,6 +2,7 @@ extends Node
|
||||||
|
|
||||||
|
|
||||||
@export var GameBox : VBoxContainer
|
@export var GameBox : VBoxContainer
|
||||||
|
@export var SearchLine : LineEdit
|
||||||
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
|
@ -12,14 +13,22 @@ func create_game(_gameData:Dictionary):
|
||||||
rpc_id(1, "rpc_create_game", _gameData)
|
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 Client
|
||||||
@rpc("authority", "call_local", "unreliable", 2)
|
@rpc("authority", "call_local", "unreliable", 2)
|
||||||
func rpc_set_games_list(_games:Array):
|
func rpc_set_games_list(_games:Array):
|
||||||
for game in _games:
|
if _games.size() > 0:
|
||||||
var gameLabel = preload("res://data/scenes/lobbies/GameLabel.tscn").instantiate()
|
for game in _games:
|
||||||
gameLabel.set_game_data(game)
|
var gameLabel = preload("res://data/scenes/lobbies/GameLabel.tscn").instantiate()
|
||||||
GameBox.add_child(gameLabel)
|
gameLabel.set_game_data(game)
|
||||||
|
GameBox.add_child(gameLabel)
|
||||||
if GATEWAY.debug:
|
if GATEWAY.debug:
|
||||||
print("Get games list")
|
print("Get games list")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue